usbdl_usb.h
18.3 KB
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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
/*****************************************************************************
* Copyright Statement:
* --------------------
* This software is protected by Copyright and the information contained
* herein is confidential. The software may not be copied and the information
* contained herein may not be used or disclosed except with the written
* permission of MediaTek Inc. (C) 2005
*
* BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
* RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
* AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
* SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
* NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
* SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
* BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
* LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
* THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
* WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
* LAWS PRINCIPLES. ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
* RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
* THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/
/*****************************************************************************
*
* Filename:
* ---------
* usb.h
*
* Project:
* --------
* Maui_Software
*
* Description:
* ------------
* This file intends for usb1.1 definitions.
*
* Author:
* -------
* -------
* -------
*
*============================================================================
* HISTORY
* Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*------------------------------------------------------------------------------
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
*
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
* removed!
*------------------------------------------------------------------------------
* Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
*============================================================================
****************************************************************************/
#ifndef USB_H
#define USB_H
#include "kal_non_specific_general_types.h"
#if defined(__USBDL_BOOTROM__)
#include "usbdl_bootrom.h"
#else
#include "usb_custom.h"
#include "usbdl_usb_drv.h"
#include "usb_comm.h"
#endif
/***********************************************
standard command definition
************************************************/
/* Standard Request Codes */
#define USB_GET_STATUS 0x00
#define USB_CLEAR_FEATURE 0x01
#define USB_SET_FEATURE 0x03
#define USB_SET_ADDRESS 0x05
#define USB_GET_DESCRIPTOR 0x06
#define USB_SET_DESCRIPTOR 0x07
#define USB_GET_CONFIGURATION 0x08
#define USB_SET_CONFIGURATION 0x09
#define USB_GET_INTERFACE 0x0A
#define USB_SET_INTERFACE 0x0B
#define USB_SYNCH_FRAME 0x0C
/* Command bit fields */
#define USB_CMD_DATADIR 0x80
/* Request Type Field */
#define USB_CMD_TYPEMASK 0x60
#define USB_CMD_STDREQ 0x00
#define USB_CMD_CLASSREQ 0x20
#define USB_CMD_VENDREQ 0x40
#define USB_CMD_STDDEVIN 0x80
#define USB_CMD_STDDEVOUT 0x00
#define USB_CMD_STDIFIN 0x81
#define USB_CMD_STDIFOUT 0x01
#define USB_CMD_STDEPIN 0x82
#define USB_CMD_STDEPOUT 0x02
#define USB_CMD_CLASSIFIN 0xa1
#define USB_CMD_CLASSIFOUT 0x21
/* Standard command descriptor type*/
#define USB_DEVICE 0x01
#define USB_CONFIG 0x02
#define USB_STRING 0x03
#define USB_INTERFACE 0x04
#define USB_ENDPOINT 0x05
#define USB_DEVICE_QUALIFIER 0x06
#define USB_OTHER_SPEED 0x07
#define USB_INTERFACE_POWER 0x08
#define USB_OTG_DESC 0x09
#define USB_INTERFACE_ASSOCIATION 0x0b
#define USB_CMD_DESCMASK 0xFF00
#define USB_CMD_DEVICE (USB_DEVICE<<8)
#define USB_CMD_CONFIG (USB_CONFIG<<8)
#define USB_CMD_STRING (USB_STRING<<8)
#define USB_CMD_INTERFACE (USB_INTERFACE<<8)
#define USB_CMD_ENDPOINT (USB_ENDPOINT<<8)
#define USB_CMD_DEVICE_QUALIFIER (USB_DEVICE_QUALIFIER<<8)
#define USB_CMD_OTHER_SPEED (USB_OTHER_SPEED<<8)
#define USB_CMD_INTERFACE_POWER (USB_INTERFACE_POWER<<8)
/* Standard Device Feature Selectors */
#define USB_FTR_DEVREMWAKE 0x0001
#define USB_FTR_EPHALT 0x0000
#define USB_FTR_B_HNP_ENB 0x0003
#define USB_FTR_A_HNP_SUPPORT 0x0004
#define USB_FTR_A_ALT_HNP_SUPPORT 0x0005
#define USB_FTR_TEST_MODE 0x0002
#define USB_TEST_J 0x01
#define USB_TEST_K 0x02
#define USB_TEST_SE0_NAK 0x03
#define USB_TEST_PACKET 0x04
/***********************************************
standard descriptor definition
************************************************/
/*Scriptor length*/
#define USB_DEVDSC_LENGTH 18
#define USB_CFGDSC_LENGTH 9
#define USB_IFDSC_LENGTH 9
#define USB_MAX_IFDSC_LENGTH 28 /* this will change depend on different class interface */
//#define USB_MAX_IFDSC_LENGTH 258 /* this will change depend on different class interface */
/*descriptor requirment*/
/* 28 is for CDC ACM communication class interface */
/* 258 is for video streaming class interface */
#define USB_EPDSC_LENGTH 7
#define USB_OTGDSC_LENGTH 3
#define USB_MAX_CLASS_EPDESC_LENGTH 12 /* this will change depend on different class interface */
/*descriptor requirment*/
/* 12 is for video control interrupt ep */
#define USB_IAD_LENGTH 8
#define USB_DEV_QUA_DSC_LENGTH 10
#define USB_OTHER_CFGDSC_LENGTH 9
/* Endpoint direction */
#define USB_EP_DIR 0x80
#define USB_EP_DIR_IN 0x80
#define USB_EP_DIR_OUT 0x00
/* Endpoint transfer types */
#define USB_EP_TFMASK 0x03
#define USB_EP_CONTROL 0x00
#define USB_EP_ISO 0x01
#define USB_EP_BULK 0x02
#define USB_EP_INTR 0x03
/* ISO Synchronization types */
#define USB_ISO_NO_SYNCHRONIZATION 0x00
#define USB_ISO_ASYNCHRONOUS 0x01
#define USB_ISO_ADAPTIVE 0x02
#define USB_ISO_SYNCHRONOUS 0x03
/* ISO Usage types */
#define USB_ISO_DATA 0x00
#define USB_ISO_FEEDBACK 0x01
#define USB_ISO_IMPLICIT_FEEDBACK 0x02
/*****Descriptor Element*****/
/* Define values for Standard Device Descriptor */
/*For Device descriptor*/
#define USB_DEVDSC_PRODUCT_COMPOSITE 0x0004 /* Product ID */
//#define USB_DEVDSC_MAXPKTSIZE 0x08 /* Packet Size */
#define USB_DEVDSC_BCDDEVICE 0x0100 /*Release number of Device*/
#define USB_DEVDSC_CONFIGS 1 /* Number of possible configurations */
/*For Configuration descriptor*/
#define USB_CFGDSC_ATTR_NATURE 0x80
#define USB_CFGDSC_ATTR_SELFPOWER 0x40
#define USB_CFGDSC_ATTR_REMOTEWAKEUP 0x20
#define USB_CFGDSC_MAXPOWER (500/2)
#define USB_OTG_HNP_SUPPORT 0x02
#define USB_OTG_SRP_SUPPORT 0x01
/***********************************************
implement definition
************************************************/
/* define configuration,interface, ep number */
#define USB_MAX_CONFIG 8 /* configuration number */
#define USB_MAX_IAD 1
#ifdef __USB_COMPORT_SUPPORT_TC01_DRIVER__
#define USB_MAX_INTERFACE 3 /* interface number */
#else
#define USB_MAX_INTERFACE 2 /* interface number */
#endif
#ifdef __ENDPOINT_TWO_TEST__
#define USB_MAX_EP_BULK_IN 2 /* max bulk in ep number */
#define USB_MAX_EP_BULK_OUT 2 /* max bulk in ep number */
#else
#ifdef __USB_COMPORT_SUPPORT_TC01_DRIVER__
#define USB_MAX_EP_BULK_IN 2 /* max bulk in ep number */
#define USB_MAX_EP_BULK_OUT 3 /* max bulk in ep number */
#else
#define USB_MAX_EP_BULK_IN 1 /* max bulk in ep number */
#define USB_MAX_EP_BULK_OUT 1 /* max bulk in ep number */
#endif
#endif
#define USB_MAX_EP_INTR 1 /* max interrupt ep number */
#define USB_MAX_STRING 10 /* string number */
#define USB_MAX_EP_PER_IF 3 /* 3 is for image class */
/* serial string array size for that unique Serial number*/
#define USB_SERIAL_STRING_LEN 16
/* define endpoint data parameters */
#define USB_EP_NODATA -1 /* no more data for endpoint to send */
/***********************************************
standard command structure
************************************************/
/* usb standard command structure */
typedef struct
{
kal_uint8 bmRequestType;
kal_uint8 bRequest;
kal_uint16 wValue;
kal_uint16 wIndex;
kal_uint16 wLength;
} Usb_Command;
/***********************************************
standard descriptor structure
************************************************/
/* standard device descriptor */
typedef struct
{
kal_uint8 bLength;
kal_uint8 bDescriptorType;
kal_uint16 bcdUSB;
kal_uint8 bDeviceClass;
kal_uint8 bDeviceSubClass;
kal_uint8 bDeviceProtocol;
kal_uint8 bMaxPacketSize0;
kal_uint16 idVendor;
kal_uint16 idProduct;
kal_uint16 bcdDevice;
kal_uint8 iManufacturer;
kal_uint8 iProduct;
kal_uint8 iSerialNumber;
kal_uint8 bNumConfigurations;
} Usb_Dev_Dscr;
/* standard configuration descriptor */
typedef struct
{
kal_uint8 bLength;
kal_uint8 bDescriptorType;
kal_uint16 wTotalLength;
kal_uint8 bNumInterfaces;
kal_uint8 bConfigurationValue;
kal_uint8 iConfiguration;
kal_uint8 bmAttributes;
kal_uint8 bMaxPower;
} Usb_Cfg_Dscr;
/* standard IAD descriptor */
typedef struct
{
kal_uint8 bLength;
kal_uint8 bDescriptorType;
kal_uint8 bFirstInterface;
kal_uint8 bInterfaceCount;
kal_uint8 bFunctionClass;
kal_uint8 bFunctionSubClass;
kal_uint8 bFunctionProtocol;
kal_uint8 iFunction;
} Usb_IAD_Dscr;
/* standard interface descriptor */
typedef struct
{
kal_uint8 bLength;
kal_uint8 bDescriptorType;
kal_uint8 bInterfaceNumber;
kal_uint8 bAlternateSetting;
kal_uint8 bNumEndpoints;
kal_uint8 bInterfaceClass;
kal_uint8 bInterfaceSubClass;
kal_uint8 bInterfaceProtocol;
kal_uint8 iInterface;
} Usb_If_Dscr;
/* standard endpoint descriptor */
typedef struct
{
kal_uint8 bLength;
kal_uint8 bDescriptorType;
kal_uint8 bEndpointAddress;
kal_uint8 bmAttributes;
kal_uint8 wMaxPacketSize[2];
kal_uint8 bInterval;
} Usb_Ep_Dscr;
/* standard string descriptor */
typedef struct
{
kal_uint8 bLength;
kal_uint8 bDescriptorType;
kal_uint16 wData[1];
}Usb_String_Dscr;
/* standard string descriptor */
typedef struct
{
kal_uint8 bLength;
kal_uint8 bDescriptorType;
kal_uint8 bAttribute;
}Usb_Otg_Dscr;
typedef struct
{
kal_uint8 bLength;
kal_uint8 bDescriptorType;
kal_uint16 bcdUSB;
kal_uint8 bDeviceClass;
kal_uint8 bDeviceSubClass;
kal_uint8 bDeviceProtocol;
kal_uint8 bMaxPacketSize0;
kal_uint8 bNumConfigurations;
kal_uint8 bReserved;
}Usb_Dev_Qual_Dscr;
typedef struct
{
kal_uint8 bLength;
kal_uint8 bDescriptorType;
kal_uint16 wTotalLength;
kal_uint8 bNumInterfaces;
kal_uint8 bConfigurationValue;
kal_uint8 iConfiguration;
kal_uint8 bmAttributes;
kal_uint8 MaxPower;
}Usb_Other_Speed_Cfg_Dscr;
/***********************************************
implement enum and structure
************************************************/
/* device states */
typedef enum
{
DEVSTATE_DEFAULT = 0,
DEVSTATE_SET_ADDRESS,
DEVSTATE_ADDRESS,
DEVSTATE_CONFIG
} USB_DEVICE_STATE;
/* Endpoint 0 state */
typedef enum
{
USB_EP0_IDLE=0,
USB_EP0_RX,
USB_EP0_TX,
USB_EP0_RX_STATUS
} USB_EP0_STATE;
/* EP0 status */
typedef struct
{
kal_uint8 byFAddr; /* new function address */
kal_int32 nBytesLeft; /* number of bytes left to send in TX mode */
void *pData; /* pointer to data to transmit/receive */
kal_int32 nBytesRecv; /* number of bytes received in RX mode */
} Usb_Ep0_Status;
/* Bulk IN endpoint status */
typedef struct
{
kal_uint8 byEP; /* endpoint number */
void *pData; /* pointer to data buffer */
kal_int32 nBytesLeft; /* number of bytes left to send */
} Usb_EpBIn_Status;
/* Bulk OUT endpoint status */
typedef struct
{
kal_uint8 byEP; /* endpoint number */
void *pData; /* pointer to data buffer */
kal_int32 nBuffLen; /* length of data buffer */
kal_int32 nBytesRecv; /* number of bytes received */
} Usb_EpBOut_Status;
/* interface create function pointer */
typedef void (*usb_create_if_func_ptr)(void *);
/* interface speed reset function pointer */
typedef void (* usb_speed_if_func_ptr)(kal_bool bset);
/* EP0 rx interrupt handler */
typedef void (*usb_ep0_rx_ptr)(void *);
/* class specific command interrupt handler */
typedef void (*usb_class_specific_handler_ptr)(Usb_Ep0_Status *, Usb_Command*);
/* endpoint interrupt handler */
typedef void (*usb_ep_handler_ptr)(void);
/* EP0 command interrupt handler */
typedef void (*usb_ep0_cmd_ptr)(Usb_Command *pcmd);
/* endpoint information, including endpoint status */
typedef struct
{
union
{
Usb_Ep_Dscr stdep; /* ep descriptor */
kal_uint8 classep[USB_MAX_CLASS_EPDESC_LENGTH];
}epdesc;
kal_uint16 epdscr_size; /* descriptor length */
usb_ep_handler_ptr ep_reset; /* ep reset handler */
union
{
Usb_EpBIn_Status epin_status;
Usb_EpBOut_Status epout_status;
}ep_status; /* ep status */
} Usb_Ep_Info;
/* interface information, including endpoint information and interface information*/
//extern struct Usb_Cdc_If_Dscr;
typedef struct
{
kal_char *interface_name_ptr; /* interface name */
usb_class_specific_handler_ptr if_class_specific_hdlr; /* interface specific handler, handle ep0 class specific request */
kal_uint16 ifdscr_size; /* descriptor length */
union
{
Usb_If_Dscr stdif;
kal_uint8 classif[USB_MAX_IFDSC_LENGTH];
}ifdscr;
Usb_Ep_Info *ep_info[USB_MAX_EP_PER_IF];/* endpoint attach to the interface info */
} Usb_Interface_Info;
/* configuration information */
typedef struct
{
kal_char *cfg_name_ptr; /* config name */
Usb_Cfg_Dscr stdcfg; /* config descriptor */
}Usb_Config_Info;
typedef struct
{
kal_bool b_enable;
kal_uint8 cmd;
usb_ep0_cmd_ptr ep0_cmd_hdlr;
}Usb_EPo_Cmd_Hdler;
/* device information, used for usb level */
typedef struct
{
Usb_Dev_Dscr devdscr;
/* Usb_Config_Info cfg_info[USB_MAX_CONFIG]; */
/* the configuration only one for saving memory */
Usb_Config_Info cfg_info;
Usb_Interface_Info if_info[USB_MAX_INTERFACE];
Usb_Ep_Info ep_bulkin_info[USB_MAX_EP_BULK_IN];
Usb_Ep_Info ep_bulkout_info[USB_MAX_EP_BULK_OUT];
Usb_Ep_Info ep_intr_info[USB_MAX_EP_INTR];
Usb_String_Dscr *resource_string[USB_MAX_STRING];
// Usb_IAD_Dscr iad_desc[USB_MAX_IAD];
#ifdef USB_20_ENABLE
Usb_Dev_Qual_Dscr dev_qual_dscr;
Usb_Other_Speed_Cfg_Dscr other_speed_cfg_dscr;
USB_TEST_MODE_TYPE usb_test_type;
kal_bool usb_enter_test_mode;
#endif
kal_uint8 *conf; /*just for descriptor transfer*/
Usb_Command cmd; /*USB_COMMAND*/
USB_DEVICE_TYPE device_type;
USB_DEVICE_STATE nDevState; /*DEVSTATE_CONFIG,DEVSTATE_ADDRESS,DEVSTATE_DEFAULT*/
kal_bool remoteWk;
kal_bool self_powered;
// kal_bool usb_comport_boot; /* a flag to check if usb boot as com port */
// kal_bool is_configured_now; /* a flag to check that after reset and before set configuration, the all DMA call back messages will be ignored */
kal_bool is_usb_download_mode;
kal_uint8 config_num;
kal_uint8 interface_num;
USB_EP0_STATE ep0_state;
Usb_Ep0_Status ep0info;
usb_ep0_rx_ptr ep0_rx_handler;
// Usb_EPo_Cmd_Hdler ep0_class_cmd_handler; /* class specific ep0 cmd */
// kal_bool usb_config_result; /* configure may be fail */
/* used for resource management*/
kal_uint8 resource_ep_bulkin_number;
kal_uint8 resource_ep_bulkout_number;
kal_uint8 resource_ep_intr_number;
kal_uint8 resource_interface_number;
kal_uint8 resource_string_number;
// kal_uint8 resource_iad_number;
/* serial string unique for each phone*/
// kal_uint16 serial_string[USB_SERIAL_STRING_LEN];
/* customizable variables*/
const USB_DEVICE_PARAM *device_param;
} Usb_Device;
/***********************************************
function and global variable
************************************************/
extern Usb_Device gUsbDevice;
extern void USB_Init_Device_Status(void);
//extern void USB_Release_Device_Status(void);
extern void USB_Register_EP0_RxHdlr(usb_ep0_rx_ptr handler);
//extern void USB_Register_EP0_Class_CmdHdlr(kal_uint8 cmd, usb_ep0_cmd_ptr handler);
extern void USB_Init(USB_DEVICE_TYPE type, kal_bool b_enable,kal_bool is_ft_mode);
//extern void USB_Release(void);
extern void USB_Generate_EP0Data(Usb_Ep0_Status*pep0state, Usb_Command*pcmd, void *data, kal_int32 len);
#endif /* USB_H */