reqcode.c
上传用户:ids068
上传日期:2013-04-04
资源大小:639k
文件大小:19k
源码类别:

USB编程

开发平台:

C/C++

  1. //***********************************************************************
  2. //                         *  
  3. //                P H I L I P S   P R O P R I E T A R Y              *
  4. //                                                                      *
  5. //          COPYRIGHT (c)   1999 BY PHILIPS SINGAPORE (APIC).        *
  6. //                    --  ALL RIGHTS RESERVED  --                  *
  7. //                                                                      *
  8. //  File Name :       RequestCode.c                                 *
  9. //  Author :       Albert Goh         *
  10. //  Created :       3 March 2000                                *
  11. //                                                                      *
  12. //***********************************************************************
  13. //***********************************************************************
  14. //                                                                      *
  15. // Debug.c file contain the location of the routine for debugging of    *
  16. // the D14. It consist of PIO,USB,UDMA,MDMA,GDMA debugging location    *
  17. // It will branch to the respective routine via the UART or the CODE   *
  18. // definition                                                           *
  19. //                                                                      *
  20. //***********************************************************************
  21. //***********************************************************************
  22. //                                                                      *
  23. //  Module History             *
  24. //  **************             *
  25. //                   *
  26. //  Date    Version Author Changes       *  
  27. //  ==== ======= ====== =======          *
  28. //  030300   0.1  Albert Created           *
  29. //                                                                      *
  30. //                                                                      *
  31. //***********************************************************************
  32. //***********************************************************************
  33. //*                *
  34. //*                      Include Files Definition    *
  35. //*                *
  36. //***********************************************************************
  37. #include "standard.h"
  38. #include "Usb.h"
  39. #include "kernel.h"
  40. //***********************************************************************
  41. //*                *
  42. //*                      Variable Definition        *
  43. //*                *
  44. //***********************************************************************
  45. //***********************************************************************
  46. //*                *
  47. //*                      Routine Definition    *
  48. //*                *
  49. //***********************************************************************
  50. //***********************************************************************
  51. //*                     *
  52. //* Routine  :  Standard Device Descriptor                        *
  53. //* Input :  None                        *
  54. //* Output   :  None                                    *
  55. //* Function :  None                                          *
  56. //*                *
  57. //***********************************************************************
  58. DEVICE_DESCRIPTOR code   Standard_Device_Descriptor[] =
  59. {
  60.     
  61.     sizeof(DEVICE_DESCRIPTOR), /*        length  */
  62. 0x01,     /*  1.    bDescriptorType            */
  63. SWAP(0x0110),    /*  2.-3. Version 1.1 USB spec Word  */
  64. 0x00,       /*  4.    Class                      */
  65. 0x00,     /*  5.    bDeviceSubClass            */
  66. 0x00,     /*  6.    bDeviceProtocol            */
  67. 0x40, /*  7.    bMaxPacketSize0            */
  68. SWAP(0x04CC), /* 8.-9.  idVendor                   */
  69. SWAP(0x1B49),    /* a.-b.  idProduct for no Filter Driver      */
  70. SWAP(0x0000),    /* c.-d.  bcdDevice                  */
  71. 0x01,    /* e.    iManufacturer             */
  72. 0x02,     /* f.    iProduct      */
  73. 0x00,     /* 10.    iSerialNumber              */
  74. 0x01      /* 11.    bNumConfigurations  */
  75. };
  76. DEVICE_DESCRIPTOR code  HS_Device_Descriptor[] =
  77. {
  78.     
  79.     sizeof(DEVICE_DESCRIPTOR), /*        length  */
  80. 0x01,     /*  1.    bDescriptorType            */
  81. SWAP(0x0200),    /*  2.-3. Version 2.0 USB spec Word  */
  82. 0x00,       /*  4.    Class                      */
  83. 0x00,     /*  5.    bDeviceSubClass            */
  84. 0x00,     /*  6.    bDeviceProtocol            */
  85. 0x40, /*  7.    bMaxPacketSize0            */
  86. SWAP(0x04CC), /* 8.-9.  idVendor                   */
  87. SWAP(0x1B49),    /* a.-b.  idProduct                  */
  88. SWAP(0x0000),    /* c.-d.  bcdDevice                  */
  89. 0x01,    /* e.    iManufacturer             */
  90. 0x02,     /* f.    iProduct      */
  91. 0x00,     /* 10.    iSerialNumber              */
  92. 0x01      /* 11.    bNumConfigurations  */
  93. };
  94. //***********************************************************************
  95. //*                     *
  96. //* Routine  :  HS Device Qualifier                               *
  97. //* Input :  None                        *
  98. //* Output :  None                                    *
  99. //* Function :  None                                          *
  100. //*                *
  101. //***********************************************************************
  102. HS_DEVICE_QUALIFIER code HS_Device_Qualifier[] =
  103. {
  104. sizeof(HS_DEVICE_QUALIFIER), //length of HS Device Descriptor
  105. 0x06, //HS Device Qualifier Type
  106. SWAP(0x0200), // USB 2.0 version
  107. 0x00, //Device class
  108. 0x00, //Device SubClass
  109. 0x00,  //Device Protocol Code
  110. 0x40, //Maximum Packet SIze for other speed
  111. 0x01, //Number of Other speed configurations
  112. 0x00 //Reserved
  113. };
  114. //***********************************************************************
  115. //*                     *
  116. //* Routine  :  Standard Configuration Descriptor                 *
  117. //* Input :  None                        *
  118. //* Output   :  None                                    *
  119. //* Function :  None                                          *
  120. //*                *
  121. //***********************************************************************
  122. CONFIGURATION_DESCRIPTOR code Standard_Config_Descriptor[] =
  123. {
  124. sizeof(CONFIGURATION_DESCRIPTOR), //Length of the configuration Descriptor
  125. 0x02,   //Configuration Descriptor
  126. SWAP(CONFIG_LENGTH),      //Total length of the configurations,interface and class/endpoint
  127. 0x01,   //No. of interface supported
  128. 0x01,   //Configuration Value
  129. 0x00,   //Index of string descriptor
  130. 0xC0,   //Configurations Characteristic
  131. 0x32   //Maximun Power
  132. };
  133. //***********************************************************************
  134. //*                     *
  135. //* Routine  :  Other speed Configuration Descriptor              *
  136. //* Input :  None                        *
  137. //* Output :  None                                    *
  138. //* Function :  None                                          *
  139. //*                *
  140. //***********************************************************************
  141. OTHER_SPEED_CONFIG_DESCRIPTOR code Other_Speed_Config_Descriptor[] =
  142. {
  143. sizeof(OTHER_SPEED_CONFIG_DESCRIPTOR), //length of other speed configuration descriptor
  144. 0x07, //Other speed configuration Type
  145. SWAP(CONFIG_LENGTH), //Total length
  146. 0x01, //No of interface supported
  147. 0x01, //Configuration Value
  148. 0x00, //Index of string descriptor
  149. 0xC0, //Configurations Characteristic
  150. 0x32 //Maximun Power
  151. };
  152. //***********************************************************************
  153. //*                     *
  154. //* Routine  :  Standard Interface Descriptor                     *
  155. //* Input :  None                        *
  156. //* Output :  None                                    *
  157. //* Function :  None                                          *
  158. //*                *
  159. //***********************************************************************
  160. INTERFACE_DESCRIPTOR code Bulk_Interface_Descriptor[] =
  161. {
  162. sizeof(INTERFACE_DESCRIPTOR), //Length of standard interface descriptor
  163. 0x04, //Standard Interface Type
  164. 0x00, //No of Interface
  165. 0x00, //Alternate Setting Selector
  166. 0x04, //No of Endpoints
  167. 0x00, //Interface Class
  168. 0x00, //ATAPI Interface Sub Class
  169. 0x00, //Bulk Only Interface Protocol
  170. 0x00 //Index of interface string desriptor
  171. };
  172. INTERFACE_DESCRIPTOR code HS_Bulk_Interface_Descriptor[] =
  173. {
  174. sizeof(INTERFACE_DESCRIPTOR), //Length of standard interface descriptor
  175. 0x04, //Standard Interface Type
  176. 0x00, //No of Interface
  177. 0x00, //Alternate Setting Selector
  178. 0x04, //No of Endpoints
  179. 0x00, //Interface Class
  180. 0x00, //ATAPI Interface Sub Class
  181. 0x00, //Bulk Only Interface Protocol
  182. 0x00 //Index of interface string desriptor
  183. };
  184. //***********************************************************************
  185. //*                     *
  186. //* Routine  :  Standard Endpoint Descriptor                     *
  187. //* Input :  None                        *
  188. //* Output :  None                                    *
  189. //* Function :  None                                          *
  190. //*                *
  191. //***********************************************************************
  192. ENDPOINT_DESCRIPTOR code Bulk_Out_Descriptor[] =
  193. {
  194. sizeof(ENDPOINT_DESCRIPTOR), //Length of Standard Endpoint Descriptor
  195. 0x05, //Standard Endpoint Type
  196. 0x02,  //Set Bulk endpoint to 1 for ATAPI mode
  197. 0x02, //Endpoint Characteristic
  198. SWAP(0x0040), //Endpoint Max Packet Size
  199. 0x00 //Interval for Polling Endpoint for data transfer
  200. };
  201. ENDPOINT_DESCRIPTOR code Bulk_In_Descriptor[] =
  202. {
  203. sizeof(ENDPOINT_DESCRIPTOR), //Length of Standard Endpoint Descriptor
  204. 0x05, //Standard Endpoint Type
  205. 0x82,  //Set Bulk endpoint to 1 for ATAPI mode
  206. 0x02, //Endpoint Characteristic
  207. SWAP(0x0040), //Endpoint Max Packet Size
  208. 0x00 //Interval for Polling Endpoint for data transfer
  209. };
  210. ENDPOINT_DESCRIPTOR code HS_Bulk_Out_Descriptor[] =
  211. {
  212. sizeof(ENDPOINT_DESCRIPTOR), //Length of Standard Endpoint Descriptor
  213. 0x05, //Standard Endpoint Type
  214. 0x02,  //Set Bulk endpoint to 1 for ATAPI mode
  215. 0x02, //Endpoint Characteristic
  216. SWAP(0x0200), //Endpoint Max Packet Size
  217. 0x00 //Interval for Polling Endpoint for data transfer
  218. };
  219. ENDPOINT_DESCRIPTOR code HS_Bulk_In_Descriptor[] =
  220. {
  221. sizeof(ENDPOINT_DESCRIPTOR), //Length of Standard Endpoint Descriptor
  222. 0x05, //Standard Endpoint Type
  223. 0x82,  //Set Bulk endpoint to 1 for ATAPI mode
  224. 0x02, //Endpoint Characteristic
  225. SWAP(0x0200), //Endpoint Max Packet Size
  226. 0x00 //Interval for Polling Endpoint for data transfer
  227. };
  228. ENDPOINT_DESCRIPTOR code Int_Out_Descriptor[] =
  229. {
  230. sizeof(ENDPOINT_DESCRIPTOR), //Length of Standard Endpoint Descriptor
  231. 0x05, //Standard Endpoint Type
  232. 0x01,  //Set Int endpoint to 2 for ATAPI mode
  233. 0x03, //Endpoint Characteristic
  234. SWAP(0x0040), //Endpoint Max Packet Size
  235. 0x01 //Interval for Polling Endpoint for data transfer
  236. };
  237. ENDPOINT_DESCRIPTOR code Int_In_Descriptor[] =
  238. {
  239. sizeof(ENDPOINT_DESCRIPTOR), //Length of Standard Endpoint Descriptor
  240. 0x05, //Standard Endpoint Type
  241. 0x81,  //Set Int endpoint to 2 for ATAPI mode
  242. 0x03,   //Endpoint Characteristic
  243. SWAP(0x0040), //Endpoint Max Packet Size
  244. 0x01 //Interval for Polling Endpoint for data transfer
  245. };
  246. ENDPOINT_DESCRIPTOR code HS_Int_Out_Descriptor[] =
  247. {
  248. sizeof(ENDPOINT_DESCRIPTOR), //Length of Standard Endpoint Descriptor
  249. 0x05, //Standard Endpoint Type
  250. 0x01,  //Set Int endpoint to 2 for ATAPI mode
  251. 0x03, //Endpoint Characteristic
  252. SWAP(0x0040), //Endpoint Max Packet Size
  253. 0x01 //Interval for Polling Endpoint for data transfer
  254. };
  255. ENDPOINT_DESCRIPTOR code HS_Int_In_Descriptor[] =
  256. {
  257. sizeof(ENDPOINT_DESCRIPTOR), //Length of Standard Endpoint Descriptor
  258. 0x05, //Standard Endpoint Type
  259. 0x81,  //Set Int endpoint to 2 for ATAPI mode
  260. 0x03,   //Endpoint Characteristic
  261. SWAP(0x0040), //Endpoint Max Packet Size
  262. 0x01 //Interval for Polling Endpoint for data transfer
  263. };
  264. //***********************************************************************
  265. //*                     *
  266. //* Routine  :  Standard Interface Descriptor                     *
  267. //* Input :  None                        *
  268. //* Output :  None                                    *
  269. //* Function :  None                                          *
  270. //*                *
  271. //***********************************************************************
  272. INTERFACE_DESCRIPTOR code Iso_Interface_Descriptor[] =
  273. {
  274. sizeof(INTERFACE_DESCRIPTOR), //Length of standard interface descriptor
  275. 0x04, //Standard Interface Type
  276. 0x00, //No of Interface
  277. 0x01, //Alternate Setting Selector
  278. 0x02, //No of Endpoints
  279. 0x00, //Interface Class
  280. 0x00, //Interface Sub Class
  281. 0x00, //Interface Protocol
  282. 0x00 //Index of interface string desriptor
  283. };
  284. ENDPOINT_DESCRIPTOR code Iso_Out_Descriptor[] =
  285. {
  286. sizeof(ENDPOINT_DESCRIPTOR), //Length of Standard Endpoint Descriptor
  287. 0x05, //Standard Endpoint Type
  288. 0x03,  //Enndpoint Address
  289. 0x01, //Endpoint Characteristic
  290. SWAP(0x0040), //Endpoint Max Packet Size
  291. 0x01 //Interval for Polling Endpoint for data transfer
  292. };
  293. ENDPOINT_DESCRIPTOR code Iso_In_Descriptor[] =
  294. {
  295. sizeof(ENDPOINT_DESCRIPTOR), //Length of Standard Endpoint Descriptor
  296. 0x05, //Standard Endpoint Type
  297. 0x83,  //Enndpoint Address
  298. 0x01, //Endpoint Characteristic
  299. SWAP(0x0040), //Endpoint Max Packet Size
  300. 0x01 //Interval for Polling Endpoint for data transfer
  301. };
  302. ENDPOINT_DESCRIPTOR code Iso_Out_Zero_Descriptor[] =
  303. {
  304. sizeof(ENDPOINT_DESCRIPTOR), //Length of Standard Endpoint Descriptor
  305. 0x05, //Standard Endpoint Type
  306. 0x03,  //Enndpoint Address
  307. 0x01, //Endpoint Characteristic
  308. SWAP(0x0000), //Endpoint Max Packet Size
  309. 0x01 //Interval for Polling Endpoint for data transfer
  310. };
  311. ENDPOINT_DESCRIPTOR code Iso_In_Zero_Descriptor[] =
  312. {
  313. sizeof(ENDPOINT_DESCRIPTOR), //Length of Standard Endpoint Descriptor
  314. 0x05, //Standard Endpoint Type
  315. 0x83,  //Enndpoint Address
  316. 0x01, //Endpoint Characteristic
  317. SWAP(0x0000), //Endpoint Max Packet Size
  318. 0x01 //Interval for Polling Endpoint for data transfer
  319. };
  320. //***********************************************************************
  321. //*                     *
  322. //* Routine  :  Standard String Descriptor                        *
  323. //* Input :  None                        *
  324. //* Output :  None                                    *
  325. //* Function :  None                                          *
  326. //*                *
  327. //***********************************************************************
  328. STRING_DESCRIPTOR code Standard_Product_String[] =      
  329. {  0x30,    /* length                   */
  330. 0x03,     /* descriptor type = string */
  331. 'P' , 0x00,
  332. 'h' , 0x00,
  333. 'i' , 0x00,
  334. 'l' , 0x00,
  335. 'i' , 0x00,
  336. 'p' , 0x00,
  337. 's' , 0x00,
  338. ' ' , 0x00,
  339. 'I' , 0x00,
  340. 'S' , 0x00,
  341. 'P' , 0x00,
  342. '1' , 0x00,
  343. '5' , 0x00,
  344. '8' , 0x00,
  345. '1' , 0x00,
  346. ' ' , 0x00,
  347. 'V' , 0x00,
  348. 'e' , 0x00,
  349. 'r' , 0x00,
  350. ' ' , 0x00,
  351. '1' , 0x00,
  352. '.' , 0x00,
  353. '0' , 0x00
  354. };
  355. //***********************************************************************
  356. //*                     *
  357. //* Routine  :  Standard String Descriptor                        *
  358. //* Input :  None                        *
  359. //* Output :  None                                    *
  360. //* Function :  None                                          *
  361. //*                *
  362. //***********************************************************************
  363. STRING_DESCRIPTOR code Standard_Manufacturer_String[] =      
  364. {  0x1C,    /* length                   */
  365. 0x03,     /* descriptor type = string */
  366. 'P' , 0x00,
  367. 'h' , 0x00,
  368. 'i' , 0x00,
  369. 'l' , 0x00,
  370. 'i' , 0x00,
  371. 'p' , 0x00,
  372. ' ' , 0x00,
  373. '-' , 0x00,
  374. ' ' , 0x00,
  375. 'A' , 0x00,
  376. 'P' , 0x00,
  377. 'I' , 0x00,
  378. 'C' , 0x00
  379. };
  380. //***********************************************************************
  381. //*                     *
  382. //* Routine  :  Standard String Identifications                   *
  383. //* Input :  None                        *
  384. //* Output :  None                                    *
  385. //* Function :  None                                          *
  386. //*                *
  387. //***********************************************************************
  388. STRING_ID  code Standard_String_ID[] = 
  389. {
  390. 0x04,
  391. 0x03,
  392. 0x09,
  393. 0x04
  394. };  
  395. //***********************************************************************
  396. //*                     *
  397. //* Routine  :  Standard Mass Storage Identifications                 *
  398. //* Input :  None                        *
  399. //* Output :  None                                    *
  400. //* Function :  None                                          *
  401. //*                *
  402. //***********************************************************************
  403. UC code  Test_Packet[] =
  404. {
  405. // 0x00, 0x00,
  406. // 0x00, 0x80, // syn pattern
  407. 0xc3,
  408. 0x00, 0x00,
  409. 0x00, 0x00,
  410. 0x00, 0x00,
  411. 0x00, 0x00,
  412. 0x00, 0xaa,
  413. 0xaa, 0xaa,
  414. 0xaa, 0xaa,
  415. 0xaa, 0xaa,
  416. 0xaa, 0xee,  //aa*4
  417. 0xee, 0xee,
  418. 0xee, 0xee,
  419. 0xee, 0xee,
  420. 0xee, 0xfe,  //ee*4
  421. 0xff, 0xff,
  422. 0xff, 0xff,
  423. 0xff, 0xff,
  424. 0xff, 0xff,
  425. 0xff, 0xff,  //FF*6
  426. 0xff, 0x7f,
  427. 0xbf, 0xdf,
  428. 0xef, 0xf7,
  429. 0xfb, 0xfd,
  430. 0xfc, 0x7e,
  431. 0xbf, 0xdf,
  432. 0xef, 0xf7,
  433. 0xfb, 0xfd,
  434. 0x7e,
  435. 0xb6, 0xce  // crc
  436. // 0xff, 0xf7
  437. };