summaryrefslogtreecommitdiff
path: root/common/usbx_host_classes/inc/ux_host_class_printer.h
blob: 7cdf4b76a63d36aec8476715c67aa5aa14799784 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/**************************************************************************/
/*                                                                        */
/*       Copyright (c) Microsoft Corporation. All rights reserved.        */
/*                                                                        */
/*       This software is licensed under the Microsoft Software License   */
/*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
/*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
/*       and in the root directory of this software.                      */
/*                                                                        */
/**************************************************************************/


/**************************************************************************/
/**************************************************************************/
/**                                                                       */ 
/** USBX Component                                                        */ 
/**                                                                       */
/**   Printer Class                                                       */
/**                                                                       */
/**************************************************************************/
/**************************************************************************/


/**************************************************************************/ 
/*                                                                        */ 
/*  COMPONENT DEFINITION                                   RELEASE        */ 
/*                                                                        */ 
/*    ux_host_class_printer.h                             PORTABLE C      */ 
/*                                                           6.0          */
/*  AUTHOR                                                                */
/*                                                                        */
/*    Chaoqiong Xiao, Microsoft Corporation                               */
/*                                                                        */
/*  DESCRIPTION                                                           */
/*                                                                        */ 
/*    This file contains all the header and extern functions used by the  */
/*    USBX printer class.                                                 */ 
/*                                                                        */ 
/*  RELEASE HISTORY                                                       */ 
/*                                                                        */ 
/*    DATE              NAME                      DESCRIPTION             */ 
/*                                                                        */ 
/*  05-19-2020     Chaoqiong Xiao           Initial Version 6.0           */
/*                                                                        */
/**************************************************************************/

#ifndef UX_HOST_CLASS_PRINTER_H
#define UX_HOST_CLASS_PRINTER_H


/* Define Printer Class constants.  */

#define UX_HOST_CLASS_PRINTER_CLASS_TRANSFER_TIMEOUT            300000
#define UX_HOST_CLASS_PRINTER_CLASS                             7
#define UX_HOST_CLASS_PRINTER_SUBCLASS                          1
#define UX_HOST_CLASS_PRINTER_PROTOCOL_BI_DIRECTIONAL           2
#define UX_HOST_CLASS_PRINTER_GET_STATUS                        1
#define UX_HOST_CLASS_PRINTER_SOFT_RESET                        2
#define UX_HOST_CLASS_PRINTER_STATUS_LENGTH                     4
#define UX_HOST_CLASS_PRINTER_DESCRIPTOR_LENGTH                 1024
#define UX_HOST_CLASS_PRINTER_GET_DEVICE_ID                     0
#define UX_HOST_CLASS_PRINTER_NAME_LENGTH                       64


/* Define Printer Class 1284 descriptor tag constants.  */

#define UX_HOST_CLASS_PRINTER_TAG_DESCRIPTION                   "DESCRIPTION:"
#define UX_HOST_CLASS_PRINTER_TAG_DES                           "DES:"


/* Define Printer Class string constants.  */

#define    UX_HOST_CLASS_PRINTER_GENERIC_NAME                   "USB PRINTER"

/* Define Printer Class structure.  */

typedef struct UX_HOST_CLASS_PRINTER_STRUCT 
{

    struct UX_HOST_CLASS_PRINTER_STRUCT  
                    *ux_host_class_printer_next_instance;
    UX_HOST_CLASS   *ux_host_class_printer_class;
    UX_DEVICE       *ux_host_class_printer_device;
    UX_INTERFACE    *ux_host_class_printer_interface;
    UX_ENDPOINT     *ux_host_class_printer_bulk_out_endpoint;
    UX_ENDPOINT     *ux_host_class_printer_bulk_in_endpoint;
    UINT            ux_host_class_printer_state;
    UCHAR           ux_host_class_printer_name[UX_HOST_CLASS_PRINTER_NAME_LENGTH];
    TX_SEMAPHORE    ux_host_class_printer_semaphore;
} UX_HOST_CLASS_PRINTER;


/* Define Printer Class function prototypes.  */

UINT    _ux_host_class_printer_activate(UX_HOST_CLASS_COMMAND *command);
UINT    _ux_host_class_printer_configure(UX_HOST_CLASS_PRINTER *printer);
UINT    _ux_host_class_printer_deactivate(UX_HOST_CLASS_COMMAND *command);
UINT    _ux_host_class_printer_endpoints_get(UX_HOST_CLASS_PRINTER *printer);
UINT    _ux_host_class_printer_entry(UX_HOST_CLASS_COMMAND *command);
UINT    _ux_host_class_printer_name_get(UX_HOST_CLASS_PRINTER *printer);
UINT    _ux_host_class_printer_read (UX_HOST_CLASS_PRINTER *printer, UCHAR *data_pointer, 
                                    ULONG requested_length, ULONG *actual_length);
UINT    _ux_host_class_printer_soft_reset(UX_HOST_CLASS_PRINTER *printer);
UINT    _ux_host_class_printer_status_get(UX_HOST_CLASS_PRINTER *printer, ULONG *printer_status);
UINT    _ux_host_class_printer_write(UX_HOST_CLASS_PRINTER *printer, UCHAR * data_pointer, 
                                    ULONG requested_length, ULONG *actual_length);

/* Define Printer Class API prototypes.  */

#define   ux_host_class_printer_activate                               _ux_host_class_printer_activate
#define   ux_host_class_printer_name_get                               _ux_host_class_printer_name_get
#define   ux_host_class_printer_read                                   _ux_host_class_printer_read
#define   ux_host_class_printer_soft_reset                             _ux_host_class_printer_soft_reset
#define   ux_host_class_printer_status_get                             _ux_host_class_printer_status_get
#define   ux_host_class_printer_write                                  _ux_host_class_printer_write

#endif