1 /**************************************************************************/
2 /*                                                                        */
3 /*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4 /*                                                                        */
5 /*       This software is licensed under the Microsoft Software License   */
6 /*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7 /*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8 /*       and in the root directory of this software.                      */
9 /*                                                                        */
10 /**************************************************************************/
11 
12 
13 /**************************************************************************/
14 /**************************************************************************/
15 /**                                                                       */
16 /** USBX Component                                                        */
17 /**                                                                       */
18 /**   Host Sierra Wireless AR module class                                */
19 /**                                                                       */
20 /**************************************************************************/
21 /**************************************************************************/
22 
23 
24 /**************************************************************************/
25 /*                                                                        */
26 /*  COMPONENT DEFINITION                                   RELEASE        */
27 /*                                                                        */
28 /*    ux_host_class_swar.h                                PORTABLE C      */
29 /*                                                           6.1.8        */
30 /*  AUTHOR                                                                */
31 /*                                                                        */
32 /*    Chaoqiong Xiao, Microsoft Corporation                               */
33 /*                                                                        */
34 /*  DESCRIPTION                                                           */
35 /*                                                                        */
36 /*    This file contains all the header and extern functions used by the  */
37 /*    USBX Sierra Wireless AR Class.                                      */
38 /*                                                                        */
39 /*  RELEASE HISTORY                                                       */
40 /*                                                                        */
41 /*    DATE              NAME                      DESCRIPTION             */
42 /*                                                                        */
43 /*  05-19-2020     Chaoqiong Xiao           Initial Version 6.0           */
44 /*  09-30-2020     Chaoqiong Xiao           Modified comment(s),          */
45 /*                                            used UX prefix to refer to  */
46 /*                                            TX symbols instead of using */
47 /*                                            them directly,              */
48 /*                                            resulting in version 6.1    */
49 /*  08-02-2021     Wen Wang                 Modified comment(s),          */
50 /*                                            added extern "C" keyword    */
51 /*                                            for compatibility with C++, */
52 /*                                            resulting in version 6.1.8  */
53 /*                                                                        */
54 /**************************************************************************/
55 
56 #ifndef UX_HOST_CLASS_SWAR_H
57 #define UX_HOST_CLASS_SWAR_H
58 
59 /* Determine if a C++ compiler is being used.  If so, ensure that standard
60    C is used to process the API information.  */
61 
62 #ifdef   __cplusplus
63 
64 /* Yes, C++ compiler is present.  Use standard C.  */
65 extern   "C" {
66 
67 #endif
68 
69 
70 /* Define Sierra Wireless AR Class constants.  */
71 
72 #define UX_HOST_CLASS_SWAR_CLASS_TRANSFER_TIMEOUT               300000
73 #ifndef UX_HOST_CLASS_SWAR_VENDOR_ID
74 #define UX_HOST_CLASS_SWAR_VENDOR_ID                            0X1199
75 #define UX_HOST_CLASS_SWAR_PRODUCT_ID                           0X68A3
76 #endif
77 
78 /* Define Sierra Wireless AR Class packet equivalences.  */
79 #define UX_HOST_CLASS_SWAR_PACKET_SIZE                          128
80 
81 /* Define Sierra Wireless AR Class data interface.  */
82 #define UX_HOST_CLASS_SWAR_DATA_INTERFACE                       3
83 
84 /* Define Sierra Wireless AR IOCTL functions.  */
85 #define UX_HOST_CLASS_SWAR_IOCTL_ABORT_IN_PIPE                  1
86 #define UX_HOST_CLASS_SWAR_IOCTL_ABORT_OUT_PIPE                 2
87 
88 /* Define CDC ACM Reception States. */
89 
90 #define UX_HOST_CLASS_SWAR_RECEPTION_STATE_STOPPED              0
91 #define UX_HOST_CLASS_SWAR_RECEPTION_STATE_STARTED              1
92 #define UX_HOST_CLASS_SWAR_RECEPTION_STATE_IN_TRANSFER          2
93 
94 
95 /* Define Sierra Wireless Airprime Class instance structure.  */
96 
97 typedef struct UX_HOST_CLASS_SWAR_STRUCT
98 {
99 
100     struct UX_HOST_CLASS_SWAR_STRUCT
101                     *ux_host_class_swar_next_instance;
102     UX_HOST_CLASS   *ux_host_class_swar_class;
103     UX_DEVICE       *ux_host_class_swar_device;
104     UX_INTERFACE    *ux_host_class_swar_interface;
105     UX_ENDPOINT     *ux_host_class_swar_bulk_out_endpoint;
106     UX_ENDPOINT     *ux_host_class_swar_bulk_in_endpoint;
107     UINT            ux_host_class_swar_state;
108     UX_SEMAPHORE    ux_host_class_swar_semaphore;
109 
110     struct UX_HOST_CLASS_SWAR_RECEPTION_STRUCT
111                     *ux_host_class_swar_reception;
112     ULONG           ux_host_class_swar_notification_count;
113 } UX_HOST_CLASS_SWAR;
114 
115 /* Define Sierra Wireless reception structure. */
116 
117 typedef struct UX_HOST_CLASS_SWAR_RECEPTION_STRUCT
118 {
119 
120     ULONG           ux_host_class_swar_reception_state;
121     ULONG           ux_host_class_swar_reception_block_size;
122     UCHAR           *ux_host_class_swar_reception_data_buffer;
123     ULONG           ux_host_class_swar_reception_data_buffer_size;
124     UCHAR           *ux_host_class_swar_reception_data_head;
125     UCHAR           *ux_host_class_swar_reception_data_tail;
126     VOID            (*ux_host_class_swar_reception_callback)(struct UX_HOST_CLASS_SWAR_STRUCT *swar,
127                                                                 UINT  status,
128                                                                 UCHAR *reception_buffer,
129                                                                 ULONG reception_size);
130 
131 } UX_HOST_CLASS_SWAR_RECEPTION;
132 
133 /* Define  Sierra Wireless Airprime Classfunction prototypes.  */
134 
135 UINT    _ux_host_class_swar_activate(UX_HOST_CLASS_COMMAND *command);
136 UINT    _ux_host_class_swar_configure(UX_HOST_CLASS_SWAR *swar);
137 UINT    _ux_host_class_swar_deactivate(UX_HOST_CLASS_COMMAND *command);
138 UINT    _ux_host_class_swar_endpoints_get(UX_HOST_CLASS_SWAR *swar);
139 UINT    _ux_host_class_swar_entry(UX_HOST_CLASS_COMMAND *command);
140 UINT    _ux_host_class_swar_read (UX_HOST_CLASS_SWAR *swar, UCHAR *data_pointer,
141                                     ULONG requested_length, ULONG *actual_length);
142 UINT    _ux_host_class_swar_write(UX_HOST_CLASS_SWAR *swar, UCHAR *data_pointer,
143                                     ULONG requested_length, ULONG *actual_length);
144 UINT    _ux_host_class_swar_ioctl(UX_HOST_CLASS_SWAR *swar, ULONG ioctl_function,
145                                     VOID *parameter);
146 VOID    _ux_host_class_swar_reception_callback (UX_TRANSFER *transfer_request);
147 UINT    _ux_host_class_swar_reception_stop (UX_HOST_CLASS_SWAR *swar,
148                                     UX_HOST_CLASS_SWAR_RECEPTION *swar_reception);
149 UINT    _ux_host_class_swar_reception_start (UX_HOST_CLASS_SWAR *swar,
150                                     UX_HOST_CLASS_SWAR_RECEPTION *swar_reception);
151 
152 /* Define SWAR Class API prototypes.  */
153 
154 #define  ux_host_class_swar_entry                           _ux_host_class_swar_entry
155 #define  ux_host_class_swar_read                            _ux_host_class_swar_read
156 #define  ux_host_class_swar_write                           _ux_host_class_swar_write
157 #define  ux_host_class_swar_ioctl                           _ux_host_class_swar_ioctl
158 #define  ux_host_class_swar_command                         _ux_host_class_swar_command
159 #define  ux_host_class_swar_reception_stop                  _ux_host_class_swar_reception_stop
160 #define  ux_host_class_swar_reception_start                 _ux_host_class_swar_reception_start
161 #define  ux_host_class_swar_setup                           _ux_host_class_swar_setup
162 
163 /* Determine if a C++ compiler is being used.  If so, complete the standard
164    C conditional started above.  */
165 #ifdef __cplusplus
166 }
167 #endif
168 
169 #endif
170