D14.H
上传用户:ids068
上传日期:2013-04-04
资源大小:639k
文件大小:9k
源码类别:

USB编程

开发平台:

C/C++

  1. /****************************************Copyright (c)**************************************************
  2. **                               广州周立功单片机发展有限公司
  3. **                                     研    究    所
  4. **                                 http://www.zlgmcu.com
  5. **--------------当前版本修订------------------------------------------------------------------------------
  6. ** 修改人: 刘英斌
  7. ** 日 期:2003-03-13
  8. ** 描 述:ISP1581 V1.0
  9. **------------------------------------------------------------------------------------------------------
  10. ********************************************************************************************************/
  11. typedef union ADDRESS_REG
  12. {
  13. struct ADDRESS_BITS
  14. {
  15. UC DEVADDR : 7;
  16. UC DEVEN : 1;
  17. }BITS;
  18. UC VALUE;
  19. }ADDRESS_REG;
  20. typedef union USB_MODE
  21. {
  22. struct USB_MODE_BITS
  23. {
  24. UC SOFTCT : 1;
  25. UC PWROFF : 1;
  26. UC WKUPC : 1;
  27. UC GLINTE : 1;
  28. UC SFRESET : 1;
  29. UC GOSUSP : 1;
  30. UC SNDRSU : 1;
  31. UC DISGLBL : 1;
  32. }BITS;
  33. UC VALUE;
  34. }USB_MODE;
  35. typedef union INT_CONFIG
  36. {
  37. struct INT_CONFIG_BITS
  38. {
  39. UC INTPOL : 1;
  40. UC INTLVL : 1;
  41. UC DDBGMODOUT : 2;
  42. UC DDBGMODIN : 2;
  43. UC CDBGMOD : 2;
  44. }BITS;
  45. UC VALUE;
  46. }INT_CONFIG;
  47. typedef union INT_ENABLE
  48. {
  49. struct INT_ENABLE_BITS
  50. {
  51. UC IERST :  1;
  52. UC IESOF : 1;
  53. UC IEPSOF : 1;
  54. UC IESUSP : 1;
  55. UC IEHS_STA : 1;
  56. UC IEDMA : 1;
  57. UC RESERVED3 : 1;
  58. UC IEP0SETUP : 1;
  59. UC RESERVED2 :  1;
  60. UC IEP0RX : 1;
  61. UC IEP0TX : 1;
  62. UC IEP1RX : 1;
  63. UC IEP1TX : 1;
  64. UC IEP2RX : 1;
  65. UC IEP2TX : 1;
  66. UC IEP3RX : 1;
  67. UC IEP3TX : 1;
  68. UC IEP4RX : 1;
  69. UC IEP4TX : 1;
  70. UC IEP5RX : 1;
  71. UC IEP5TX : 1;
  72. UC IEP6RX : 1;
  73. UC IEP6TX : 1;
  74. UC IEP7RX : 1;
  75. UC IEP7TX : 1;
  76. UC RESERVED1 : 6;
  77. }BITS;
  78. UL VALUE;
  79. }INT_ENABLE;
  80. typedef union INTERRUPT_STATUS
  81. {
  82. struct INTERRUPT_STATUS_BITS
  83. {
  84. UC RESET :  1;
  85. UC SOF : 1;
  86. UC PSOF : 1;
  87. UC SUSP : 1;
  88. UC RESUME : 1;
  89. UC HS_STAT : 1;
  90. UC DMA : 1;
  91. UC RESERVED3 : 1;
  92. UC EP0SETUP : 1;
  93. UC RESERVED2 :  1;
  94. UC EP0RX : 1;
  95. UC EP0TX : 1;
  96. UC EP1RX : 1;
  97. UC EP1TX : 1;
  98. UC EP2RX : 1;
  99. UC EP2TX : 1;
  100. UC EP3RX : 1;
  101. UC EP3TX : 1;
  102. UC EP4RX : 1;
  103. UC EP4TX : 1;
  104. UC EP5RX : 1;
  105. UC EP5TX : 1;
  106. UC EP6RX : 1;
  107. UC EP6TX : 1;
  108. UC EP7RX : 1;
  109. UC EP7TX : 1;
  110. UC RESERVED1 : 6;
  111. }BITS;
  112. UL VALUE;
  113. }INTERRUPT_STATUS;
  114. typedef union ENDPT_MAXSIZE
  115. {
  116. struct ENDPT_MAXSIZE_BITS
  117. {
  118. UC FFOSZ7_0 : 8;
  119. UC FFOSZ10_8 : 3;
  120. UC NTRANS : 2;
  121. UC RESERVED2 : 3;
  122. }BITS;
  123. UI VALUE;
  124. }ENDPT_MAXSIZE;
  125. typedef union ENDPT_INDEX
  126. {
  127. struct ENDPT_INDEX_BITS
  128. {
  129. UC DIR : 1;
  130. UC ENDPIDX : 4;
  131. UC EP0SETUP : 1;
  132. UC RESERVED : 2;
  133. }BITS;
  134. UC VALUE;
  135. }ENDPT_INDEX;
  136. typedef union CONTROL
  137. {
  138. struct CONTROL_BITS
  139. {
  140. UC STALL : 1;
  141. UC STATUS : 1;
  142. UC RESERVED2 : 1;
  143. UC VENDP : 1;
  144. UC CLBUF : 1;
  145. UC RESERVED1 : 3;
  146. }BITS;
  147. UC VALUE;
  148. }CONTROL;
  149. typedef union ENDPT_TYPE
  150. {
  151. struct ENDPT_TYPE_BITS
  152. {
  153. UC ENDPTYP : 2;
  154. UC DBLBUF :  1;
  155. UC ENABLE : 1;
  156. UC ZERO_PKT_DIS: 1;
  157. UC RESERVED1 : 3;
  158. UC RESRVED2 : 8;
  159. }BITS;
  160. UI VALUE;
  161. }ENDPT_TYPE;
  162. typedef union ERROR_CODE
  163. {
  164. struct ERROR_CODE_BITS
  165. {
  166. UC RTOK : 1;
  167. UC ERROR : 4;
  168. UC RESERVED: 1;
  169. UC DATA01 : 1;
  170. UC UNREAD : 1;
  171. }BITS;
  172. UC VALUE;
  173. }ERROR_CODE;
  174. typedef union VALIDSHORT
  175. {
  176. struct VALIDSHORT_BITS
  177. {
  178. UC  RESERVED : 8;
  179. UC OUT0SH : 1;
  180. UC OUT1SH : 1;
  181. UC OUT2SH : 1;
  182. UC OUT3SH : 1;
  183. UC OUT4SH : 1;
  184. UC OUT5SH : 1;
  185. UC OUT6SH : 1;
  186. UC OUT7SH : 1;
  187. }BITS;
  188. UI VALUE;
  189. }VALIDSHORT;
  190. typedef union FRAME_NO
  191. {
  192. struct FRAME_NO_BITS
  193. {
  194. UC SOFL : 8;
  195. UC SOFH : 3;
  196. UC USOF : 3;
  197. UC RESERVED : 2;
  198. }BITS;
  199. UI VALUE;
  200. }FRAME_NO; 
  201. typedef union TESTMODE
  202. {
  203. struct TESTMODE_BITS
  204. {
  205. UC SE0_NAK : 1;
  206. UC JSTATE : 1;
  207. UC KSTATE : 1;
  208. UC PRBS : 1;
  209. UC FORCEFS : 1;
  210. UC LPBK : 1;
  211. UC PHYTEST : 1;
  212. UC FORCEHS : 1;
  213. }BITS;
  214. UC VALUE;
  215. }TESTMODE;
  216. typedef union GDMA_CONFIG
  217. {
  218. struct GDMA_CONFIG_BITS
  219. {
  220. UC WIDTH :  1;
  221. UC RES1 : 1;
  222. UC DMA_MODE : 2;
  223. UC BURST : 3;
  224. UC CNTENA : 1;
  225. }BITS;
  226. UC VALUE;
  227. }GDMA_CONFIG;
  228. typedef union UDMA_CONFIG
  229. {
  230. struct UDMA_CONFIG_BITS
  231. {
  232. UC PIO_MODE : 3;
  233. UC UDMA_MODE : 2;
  234. UC ATA_MODE : 1;
  235. UC IGNORE_IORDY: 1;
  236. UC RES2 : 1;
  237. }BITS;
  238. UC VALUE;
  239. }UDMA_CONFIG;
  240. typedef union DMA_HARDWARE
  241. {
  242. struct DMA_HARDWARE_BITS
  243. {
  244. UC READ_POL : 1;
  245. UC WRITE_POL : 1;
  246. UC DREQ_POL : 1;
  247. UC ACK_POL : 1;
  248. UC MASTER : 1;
  249. UC EOT_POL : 1;
  250. UC ENDIAN : 2;
  251. }BITS;
  252. UC VALUE;
  253. }DMA_HARDWARE;
  254. typedef union DMA_STROBE
  255. {
  256. struct DMA_STROBE_BITS
  257. {
  258. UC DMA_STROBE : 5;
  259. UC RES : 3;
  260. }BITS;
  261. UC VALUE;
  262. }DMA_STROBE;
  263. typedef union DMA_INT
  264. {
  265. struct DMA_INT_BITS
  266. {
  267. UC CMD_AUTO_COMPLETE : 1;
  268. UC INTRQ_PENDING : 1;
  269. UC TASKFILE_READ_COMPLETE : 1;
  270. UC BSY_DRQ_POLL_DONE : 1;
  271. UC START_READ_1F0_RD_FIFO : 1;
  272. UC RD_1F0_FIFO_EMPTY : 1;
  273. UC WR_1F0_FIFO_FULL : 1;
  274. UC WR_1F0_FIFO_EMPTY : 1;
  275. UC DMA_DONE : 1;
  276. UC PENDING_INTRQ : 1;
  277.          UC       INT_EOT                             :        1;
  278.          UC       EXT_EOT                             :        1;
  279. UC RES1 : 4;
  280. }BITS;
  281. UI VALUE;
  282. }DMA_INT;
  283. typedef union DMA_INT_ENABLE
  284. {
  285. struct DMA_INT_ENABLE_BITS
  286. {
  287. UC CMD_AUTO_COMPLETE : 1;
  288. UC INTRQ_PENDING : 1;
  289. UC TASKFILE_READ_COMPLETE : 1;
  290. UC BSY_DRQ_POLL_DONE : 1;
  291. UC START_READ_1F0_RD_FIFO : 1;
  292. UC RD_1F0_FIFO_EMPTY : 1;
  293. UC WR_1F0_FIFO_FULL : 1;
  294. UC WR_1F0_FIFO_EMPTY : 1;
  295. UC DMA_DONE : 1;
  296. UC RES1 : 7;
  297. }BITS;
  298. UI VALUE;
  299. }DMA_INT_ENABLE;
  300. /*
  301. typedef union DMA_ENDPT
  302. {
  303. struct DMA_ENDPT_BITS
  304. {
  305. UC DMADIR : 1;
  306. UC EDPIDX : 3;
  307. UC NOT_USED :  4;
  308. }BITS;
  309. UC VALUE;
  310. }DMA_ENDPT;
  311. */
  312. typedef union DMA_STATE_1
  313. {
  314. struct DMA_STATE_1_BITS
  315. {
  316. UC PIO_SEQ_STATE : 3;
  317. UC PIO_CMD_STATE : 5;
  318. }BITS;
  319. UC VALUE;
  320. }DMA_STATE_1;
  321. typedef union DMA_STATE_2
  322. {
  323. struct DMA_STATE_2_BITS
  324. {
  325. UC RES : 8;
  326. }BITS;
  327. UC VALUE;
  328. }DMA_STATE_2;
  329. typedef struct D14_CNTRL_REG
  330. {
  331. ADDRESS_REG D14_ADDRESS;
  332. UC DUMMY_01;
  333. UC DUMMY_02;
  334. UC DUMMY_03;
  335.   ENDPT_MAXSIZE D14_ENDPT_MAXPKTSIZE;
  336. UC DUMMY_06;
  337. UC DUMMY_07;
  338. ENDPT_TYPE D14_ENDPT_TYPE;
  339. UC DUMMY_0A;
  340. UC DUMMY_0B;
  341. USB_MODE D14_MODE;
  342. UC DUMMY_0D;
  343. UC DUMMY_0E;
  344. UC DUMMY_0F;
  345. INT_CONFIG D14_INT_CONFIG;
  346. UC DUMMY_11;
  347. UC DUMMY_12;
  348. UC DUMMY_13;
  349. INT_ENABLE D14_INT_ENABLE;
  350. INTERRUPT_STATUS D14_INT;
  351. UC D14_BUFFER_LENGTH_LSB;
  352. UC D14_BUFFER_LENGTH_MSB;
  353. UC DUMMY_1E;
  354. UC DUMMY_1F;
  355.    UC D14_DATA_PORT_LSB;
  356.    UC D14_DATA_PORT_MSB;
  357. UC DUMMY_22;
  358. UC DUMMY_23;
  359. VALIDSHORT D14_VALIDATE_SHORT;
  360. UC DUMMY_26;
  361. UC DUMMY_27;
  362. CONTROL D14_CONTROL_FUNCTION;
  363. UC DUMMY_29;
  364. UC DUMMY_2A;
  365. UC DUMMY_2B;
  366. UC D14_ENDPT_INDEX;
  367. UC DUMMY_2D;
  368. UC DUMMY_2E;
  369. UC DUMMY_2F;
  370. UC D14_DMA_COMMAND;
  371. UC DUMMY_31;
  372. UC DUMMY_32;
  373. UC DUMMY_33;
  374. UC D14_DMA_TRANSFER_COUNTER_LSB;
  375. UC D14_DMA_TRANSFER_COUNTER_BYTE2;
  376. UC D14_DMA_TRANSFER_COUNTER_BYTE3;
  377. UC D14_DMA_TRANSFER_COUNTER_MSB;
  378. GDMA_CONFIG D14_GDMA_CONFIG;
  379. UDMA_CONFIG D14_UDMA_CONFIG;
  380. UC DUMMY_3A;
  381. UC DUMMY_3B;
  382.   DMA_HARDWARE D14_DMA_HARDWARE;
  383. UC DUMMY_3D;
  384. UC DUMMY_3E;
  385. UC DUMMY_3F;
  386. UC D14_DATA_TASKFILE_LSB;
  387. UC DATA_TASKFILE_BYTE2;
  388. UC DATA_TASKFILE_BYTE3;
  389. UC DATA_TASKFILE_MSB;
  390. UC D14_CMD_STATUS_TASKFILE;
  391. UC DUMMY_45;
  392. UC DUMMY_46;
  393. UC DUMMY_47;
  394. UC D14_ERROR_FEATURE_TASKFILE;
  395. UC D14_INTERRUPT_TASKFILE;
  396. UC D14_SECTOR_NUMBER;
  397. UC D14_BYTECOUNT_LSB_TASKFILE;
  398. UC D14_BYTECOUNT_MSB_TASKFILE;
  399. UC D14_DRIVE_SELECT_TASKFILE;
  400. UC D14_ALT_STATUS_DEVCNTRL_TASKFILE;
  401. UC D14_TASKFILE;
  402. DMA_INT D14_DMA_INT;
  403. UC DUMMY_52;
  404. UC DUMMY_53;
  405. DMA_INT_ENABLE D14_DMA_INT_ENABLE;
  406. UC DUMMY_56;
  407. UC DUMMY_57;
  408. UC D14_DMA_ENDPOINT;
  409. UC DUMMY_59;
  410. UC DUMMY_5A;
  411. UC DUMMY_5B;
  412. DMA_STATE_1 D14_DMA_STATE_1;
  413. UC DUMMY_5D;
  414. UC DUMMY_5E;
  415. UC DUMMY_5F;
  416. DMA_STROBE DMA_STROBE_TIMING;
  417. UC DUMMY_61;
  418. UC DUMMY_62;
  419. UC DUMMY_63;
  420. UC UDMA_BYTE_COUNT_LSB;
  421. UC UDMA_BYTE_COUNT_MSB;
  422. UC DUMMY_66;
  423. UC COUNT_1F0;
  424. UC PMU_TRANSFER_COUNT_0;
  425. UC PMU_TRANSFER_COUNT_1;
  426. UC PMU_TRANSFER_COUNT_2;
  427. UC PMU_TRANSFER_COUNT_3;
  428. UC DUMMY_6C;
  429. UC DUMMY_6D;
  430. UC DUMMY_6E;
  431. UC DUMMY_6F;
  432.   
  433. UC D14_CHIP_ID_LSB;
  434. UC D14_CHIP_ID_MBYTE;
  435. UC D14_CHIP_ID_MSB;
  436. UC DUMMY_73;
  437. FRAME_NO D14_FRAME_NUMBER;
  438. UC DUMMY_76;
  439. UC DUMMY_77;
  440. UI D14_SCRATCH_REGISTER;
  441. UC DUMMY_7A;
  442. UC DUMMY_7B;
  443. UC D14_UNLOCK_DEVICE_LSB;
  444. UC D14_UNLOCK_DEVICE_MSB;
  445. UC DUMMY_7E;
  446. UC DUMMY_7F;
  447. ERROR_CODE D14_ERROR_CODE;
  448. UC DUMMY_81;
  449. UC DUMMY_82;
  450. UC DUMMY_83;
  451. TESTMODE D14_TEST_MODE;
  452. UC DUMMY_85;
  453. UC DUMMY_86;
  454. UC DUMMY_87;
  455. UC DUMMY_88;
  456. }D14_CNTRL_REG;