USB_Registers_H.#1
上传用户:gxz1972
上传日期:2019-09-13
资源大小:323k
文件大小:4k
源码类别:

传真(Fax)编程

开发平台:

C/C++

  1. //-----------------------------------------------------------------------------
  2. // USB_Registers.h
  3. //-----------------------------------------------------------------------------
  4. //-----------------------------------------------------------------------------
  5. // Copyright 2007 Vson Technology, Inc.
  6. // http://www.usbmcu.com
  7. //
  8. // Program Description:
  9. //
  10. //
  11. //
  12. //
  13. //
  14. // MCU:            C8051F347
  15. // Tool chain:     Keil C51 7.50 / Keil EVAL C51
  16. //                 Silicon Laboratories IDE version 2.6
  17. // Command Line:   
  18. // Project Name:   TR1000
  19. //
  20. //
  21. // Release 1.0
  22. //    -All changes by Brin Cai
  23. //    -24 JUL 2007
  24. //
  25. //
  26. #ifndef  _USB_REGISTERS_H
  27. #define  _USB_REGISTERS_H
  28. //-----------------------------------------------------------------------------
  29. // Global Constants
  30. //-----------------------------------------------------------------------------
  31. // USB Core Registers
  32. #define  BASE     0x00
  33. #define  FADDR    BASE
  34. #define  POWER    BASE + 0x01
  35. #define  IN1INT   BASE + 0x02
  36. #define  OUT1INT  BASE + 0x04
  37. #define  CMINT    BASE + 0x06
  38. #define  IN1IE    BASE + 0x07
  39. #define  OUT1IE   BASE + 0x09
  40. #define  CMIE     BASE + 0x0B
  41. #define  FRAMEL   BASE + 0x0C
  42. #define  FRAMEH   BASE + 0x0D
  43. #define  INDEX    BASE + 0x0E
  44. #define  CLKREC   BASE + 0x0F
  45. #define  E0CSR    BASE + 0x11
  46. #define  EINCSRL  BASE + 0x11
  47. #define  EINCSRH  BASE + 0x12
  48. #define  EOUTCSRL BASE + 0x14
  49. #define  EOUTCSRH BASE + 0x15
  50. #define  E0CNT    BASE + 0x16
  51. #define  EOUTCNTL BASE + 0x16
  52. #define  EOUTCNTH BASE + 0x17
  53. #define  FIFO_EP0 BASE + 0x20
  54. #define  FIF0_EP1 BASE + 0x21
  55. #define  FIF0_EP2 BASE + 0x22
  56. #define  FIFO_EP3 BASE + 0x23
  57. // USB Core Register Bits
  58. // POWER
  59. #define  rbISOUD        0x80
  60. #define  rbSPEED        0x40
  61. #define  rbUSBRST       0x08
  62. #define  rbRESUME       0x04
  63. #define  rbSUSMD        0x02
  64. #define  rbSUSEN        0x01
  65. // IN1INT
  66. #define  rbIN3          0x08
  67. #define  rbIN2          0x04
  68. #define  rbIN1          0x02
  69. #define  rbEP0          0x01
  70. // OUT1INT
  71. #define  rbOUT3         0x08
  72. #define  rbOUT2         0x04
  73. #define  rbOUT1         0x02
  74. // CMINT
  75. #define  rbSOF          0x08
  76. #define  rbRSTINT       0x04
  77. #define  rbRSUINT       0x02
  78. #define  rbSUSINT       0x01
  79. // IN1IE
  80. #define  rbIN3E         0x08
  81. #define  rbIN2E         0x04
  82. #define  rbIN1E         0x02
  83. #define  rbEP0E         0x01
  84. // OUT1IE
  85. #define  rbOUT3E        0x08
  86. #define  rbOUT2E        0x04
  87. #define  rbOUT1E        0x02
  88. // CMIE
  89. #define  rbSOFE         0x08
  90. #define  rbRSTINTE      0x04
  91. #define  rbRSUINTE      0x02
  92. #define  rbSUSINTE      0x01
  93. // E0CSR
  94. #define  rbSSUEND       0x80
  95. #define  rbSOPRDY       0x40
  96. #define  rbSDSTL        0x20
  97. #define  rbSUEND        0x10
  98. #define  rbDATAEND      0x08
  99. #define  rbSTSTL        0x04
  100. #define  rbINPRDY       0x02
  101. #define  rbOPRDY        0x01
  102. // EINCSRL
  103. #define  rbInCLRDT      0x40
  104. #define  rbInSTSTL      0x20
  105. #define  rbInSDSTL      0x10
  106. #define  rbInFLUSH      0x08
  107. #define  rbInUNDRUN     0x04
  108. #define  rbInFIFONE     0x02
  109. #define  rbInINPRDY     0x01
  110. // EINCSRH
  111. #define  rbInDBIEN      0x80
  112. #define  rbInISO        0x40
  113. #define  rbInDIRSEL     0x20
  114. #define  rbInFCDT       0x08
  115. #define  rbInSPLIT      0x04
  116. // EOUTCSRL
  117. #define  rbOutCLRDT     0x80
  118. #define  rbOutSTSTL     0x40
  119. #define  rbOutSDSTL     0x20
  120. #define  rbOutFLUSH     0x10
  121. #define  rbOutDATERR    0x08 
  122. #define  rbOutOVRUN     0x04
  123. #define  rbOutFIFOFUL   0x02
  124. #define  rbOutOPRDY     0x01
  125. // EOUTCSRH
  126. #define  rbOutDBOEN     0x80
  127. #define  rbOutISO       0x40
  128. //-----------------------------------------------------------------------------
  129. // Macros
  130. //-----------------------------------------------------------------------------
  131. // Register read/write macros
  132. #define UREAD_BYTE(addr,target) {  USB0ADR = (0x80 | addr); 
  133.                                    while(USB0ADR & 0x80);   
  134.    target = USB0DAT; }
  135. #define UWRITE_BYTE(addr,data)  {  USB0ADR = addr; 
  136.                                    USB0DAT = data; 
  137.    while(USB0ADR & 0x80); }
  138. #endif                                 // F34x_USB_REGISTERS_H
  139. //-----------------------------------------------------------------------------
  140. // End Of File
  141. //-----------------------------------------------------------------------------