summaryrefslogtreecommitdiff
path: root/common/usbx_host_classes/inc/ux_host_class_swar.h
blob: 91c41fc80a9355432c16e9b5bf83bdd801c41687 (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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
/***************************************************************************
 * Copyright (c) 2024 Microsoft Corporation
 * Copyright (c) 2026-present Eclipse ThreadX contributors
 *
 * This program and the accompanying materials are made available under the
 * terms of the MIT License which is available at
 * https://opensource.org/licenses/MIT.
 *
 * SPDX-License-Identifier: MIT
 **************************************************************************/


/**************************************************************************/
/**************************************************************************/
/**                                                                       */
/** USBX Component                                                        */
/**                                                                       */
/**   Host Sierra Wireless AR module class                                */
/**                                                                       */
/**************************************************************************/
/**************************************************************************/


/**************************************************************************/
/*                                                                        */
/*  COMPONENT DEFINITION                                   RELEASE        */
/*                                                                        */
/*    ux_host_class_swar.h                                PORTABLE C      */
/*                                                           6.1.8        */
/*  AUTHOR                                                                */
/*                                                                        */
/*    Chaoqiong Xiao, Microsoft Corporation                               */
/*                                                                        */
/*  DESCRIPTION                                                           */
/*                                                                        */
/*    This file contains all the header and extern functions used by the  */
/*    USBX Sierra Wireless AR Class.                                      */
/*                                                                        */
/**************************************************************************/

#ifndef UX_HOST_CLASS_SWAR_H
#define UX_HOST_CLASS_SWAR_H

/* Determine if a C++ compiler is being used.  If so, ensure that standard
   C is used to process the API information.  */

#ifdef   __cplusplus

/* Yes, C++ compiler is present.  Use standard C.  */
extern   "C" {

#endif


/* Internal option: enable the basic USBX error checking. This define is typically used
   while debugging application.  */
#if defined(UX_ENABLE_ERROR_CHECKING) && !defined(UX_HOST_CLASS_SWAR_ENABLE_ERROR_CHECKING)
#define UX_HOST_CLASS_SWAR_ENABLE_ERROR_CHECKING
#endif


/* Define Sierra Wireless AR Class constants.  */

#define UX_HOST_CLASS_SWAR_CLASS_TRANSFER_TIMEOUT               300000
#ifndef UX_HOST_CLASS_SWAR_VENDOR_ID
#define UX_HOST_CLASS_SWAR_VENDOR_ID                            0X1199
#define UX_HOST_CLASS_SWAR_PRODUCT_ID                           0X68A3
#endif

/* Define Sierra Wireless AR Class packet equivalences.  */
#define UX_HOST_CLASS_SWAR_PACKET_SIZE                          128

/* Define Sierra Wireless AR Class data interface.  */
#define UX_HOST_CLASS_SWAR_DATA_INTERFACE                       3

/* Define Sierra Wireless AR IOCTL functions.  */
#define UX_HOST_CLASS_SWAR_IOCTL_ABORT_IN_PIPE                  1
#define UX_HOST_CLASS_SWAR_IOCTL_ABORT_OUT_PIPE                 2

/* Define CDC ACM Reception States. */

#define UX_HOST_CLASS_SWAR_RECEPTION_STATE_STOPPED              0
#define UX_HOST_CLASS_SWAR_RECEPTION_STATE_STARTED              1
#define UX_HOST_CLASS_SWAR_RECEPTION_STATE_IN_TRANSFER          2


/* Define Sierra Wireless Airprime Class instance structure.  */

typedef struct UX_HOST_CLASS_SWAR_STRUCT
{

    struct UX_HOST_CLASS_SWAR_STRUCT
                    *ux_host_class_swar_next_instance;
    UX_HOST_CLASS   *ux_host_class_swar_class;
    UX_DEVICE       *ux_host_class_swar_device;
    UX_INTERFACE    *ux_host_class_swar_interface;
    UX_ENDPOINT     *ux_host_class_swar_bulk_out_endpoint;
    UX_ENDPOINT     *ux_host_class_swar_bulk_in_endpoint;
    UINT            ux_host_class_swar_state;
    UX_SEMAPHORE    ux_host_class_swar_semaphore;

    struct UX_HOST_CLASS_SWAR_RECEPTION_STRUCT
                    *ux_host_class_swar_reception;
    ULONG           ux_host_class_swar_notification_count;
} UX_HOST_CLASS_SWAR;

/* Define Sierra Wireless reception structure. */

typedef struct UX_HOST_CLASS_SWAR_RECEPTION_STRUCT
{

    ULONG           ux_host_class_swar_reception_state;
    ULONG           ux_host_class_swar_reception_block_size;
    UCHAR           *ux_host_class_swar_reception_data_buffer;
    ULONG           ux_host_class_swar_reception_data_buffer_size;
    UCHAR           *ux_host_class_swar_reception_data_head;
    UCHAR           *ux_host_class_swar_reception_data_tail;
    VOID            (*ux_host_class_swar_reception_callback)(struct UX_HOST_CLASS_SWAR_STRUCT *swar,
                                                                UINT  status,
                                                                UCHAR *reception_buffer,
                                                                ULONG reception_size);

} UX_HOST_CLASS_SWAR_RECEPTION;

/* Define  Sierra Wireless Airprime Classfunction prototypes.  */

UINT    _ux_host_class_swar_activate(UX_HOST_CLASS_COMMAND *command);
UINT    _ux_host_class_swar_configure(UX_HOST_CLASS_SWAR *swar);
UINT    _ux_host_class_swar_deactivate(UX_HOST_CLASS_COMMAND *command);
UINT    _ux_host_class_swar_endpoints_get(UX_HOST_CLASS_SWAR *swar);
UINT    _ux_host_class_swar_entry(UX_HOST_CLASS_COMMAND *command);
UINT    _ux_host_class_swar_read (UX_HOST_CLASS_SWAR *swar, UCHAR *data_pointer,
                                    ULONG requested_length, ULONG *actual_length);
UINT    _ux_host_class_swar_write(UX_HOST_CLASS_SWAR *swar, UCHAR *data_pointer,
                                    ULONG requested_length, ULONG *actual_length);
UINT    _ux_host_class_swar_ioctl(UX_HOST_CLASS_SWAR *swar, ULONG ioctl_function,
                                    VOID *parameter);
VOID    _ux_host_class_swar_reception_callback (UX_TRANSFER *transfer_request);
UINT    _ux_host_class_swar_reception_stop (UX_HOST_CLASS_SWAR *swar,
                                    UX_HOST_CLASS_SWAR_RECEPTION *swar_reception);
UINT    _ux_host_class_swar_reception_start (UX_HOST_CLASS_SWAR *swar,
                                    UX_HOST_CLASS_SWAR_RECEPTION *swar_reception);


UINT    _uxe_host_class_swar_read (UX_HOST_CLASS_SWAR *swar, UCHAR *data_pointer,
                                    ULONG requested_length, ULONG *actual_length);
UINT    _uxe_host_class_swar_write(UX_HOST_CLASS_SWAR *swar, UCHAR *data_pointer,
                                    ULONG requested_length, ULONG *actual_length);
UINT    _uxe_host_class_swar_ioctl(UX_HOST_CLASS_SWAR *swar, ULONG ioctl_function,
                                    VOID *parameter);
UINT    _uxe_host_class_swar_reception_stop (UX_HOST_CLASS_SWAR *swar,
                                    UX_HOST_CLASS_SWAR_RECEPTION *swar_reception);
UINT    _uxe_host_class_swar_reception_start (UX_HOST_CLASS_SWAR *swar,
                                    UX_HOST_CLASS_SWAR_RECEPTION *swar_reception);

/* Define SWAR Class API prototypes.  */

#define  ux_host_class_swar_entry                           _ux_host_class_swar_entry
#define  ux_host_class_swar_setup                           _ux_host_class_swar_setup

#if defined(UX_HOST_CLASS_SWAR_ENABLE_ERROR_CHECKING)

#define  ux_host_class_swar_read                            _uxe_host_class_swar_read
#define  ux_host_class_swar_write                           _uxe_host_class_swar_write
#define  ux_host_class_swar_ioctl                           _uxe_host_class_swar_ioctl
#define  ux_host_class_swar_reception_stop                  _uxe_host_class_swar_reception_stop
#define  ux_host_class_swar_reception_start                 _uxe_host_class_swar_reception_start

#else

#define  ux_host_class_swar_read                            _ux_host_class_swar_read
#define  ux_host_class_swar_write                           _ux_host_class_swar_write
#define  ux_host_class_swar_ioctl                           _ux_host_class_swar_ioctl
#define  ux_host_class_swar_reception_stop                  _ux_host_class_swar_reception_stop
#define  ux_host_class_swar_reception_start                 _ux_host_class_swar_reception_start

#endif

/* Determine if a C++ compiler is being used.  If so, complete the standard
   C conditional started above.  */
#ifdef __cplusplus
}
#endif

#endif