ivic.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:13k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* ivic.h - Ironics/VTCs VME Interface Chip (VIC) constants */
  2. /*
  3. modification history
  4. --------------------
  5. 02d,22sep92,rrr  added support for c++
  6. 02c,26may92,rrr  the tree shuffle
  7. 02b,04oct91,rrr  passed through the ansification filter
  8.   -fixed #else and #endif
  9.   -changed ASMLANGUAGE to _ASMLANGUAGE
  10.   -changed copyright notice
  11. 02a,31jan91,rjt  initial release to windriver after many minor
  12.                  fixes and alterations.
  13. 01a,25jul90,rjt  writen by modifying IV-SPRC sparcmon versions.
  14. */
  15. #ifndef __INCivich
  16. #define __INCivich
  17. #ifdef __cplusplus
  18. extern "C" {
  19. #endif
  20. /*=========================================================================*/
  21. /*                                                                         */
  22. /* NOTE:                                                                   */
  23. /* assembly language files should turn off type declartions by not         */
  24. /* including those portions of this include file, this is done by          */
  25. /* placing a    */
  26. /*    */
  27. /* #define _ASMLANGUAGE    */
  28. /*    */
  29. /* statement before this file is included in any other files               */
  30. /*                                                                         */
  31. /* Also in order to incorparate stronger typing of all constants, and to   */
  32. /* allow the same constants to be typed in C files,yet usable in           */
  33. /* assembly files. An unorthadox method of TYPING is used by CONDITIONALLY */
  34. /* #define'ing the constant TYPES. If no _ASMLANGUAGE #define is present,   */
  35. /* then the type is defined to a blank space, otherwise it is defined      */
  36. /* to be a C type. This looks weird but works nicely.                      */
  37. /*                                                                         */
  38. /*=========================================================================*/
  39. /*=========================================================================*
  40. Naming of register names and constants was done ( or was attempted ) so that
  41. the front end of the names would indicate a related group while the tail
  42. end of the names would further define the purpose of the name. Some groups
  43. often contained sub-groups. Also some names don't follow this convention for
  44. the sake of readability and other reasons.
  45. An H_ prefix indicates that the constant is typed as a pointer to
  46. unsigned short register.
  47. An B_ prefix indicates that the constant is typed as a pointer to
  48. unsigned char register.
  49. Because of unpredictability of structure sizing and placement for
  50. different compilers, we use contants to access each register.
  51. Most constants are defined for consistancy in name AND intended usage.
  52. BIT MANIPUATION is set up so that each bit field has 3 or more defines
  53. associated with it.
  54. 1. BIT VALUE MASK
  55. 2. ASSERTED VALUE(S)
  56. 3. DEASERTED VALUE
  57. where ASSERTED VALUE = 0 and dasserted value = 0xff for ACTIVE LOW SIGNALS
  58.   OR visa versa
  59. where ASSERTED VALUE = 0xff and dasserted value = 0 for ACTIVE HIGH SIGNALS
  60. NOTE: The active high bits may also be something other than 0xff for
  61.       multi-bit fields.  EG: for at 2 bit active high field there may be
  62.       4 asserted values associated with it: 0x00 0x01 0x02 0x03.
  63. the bit field should be altered as follows:
  64. new_reg_value =   (old_reg_val & ~MASK) | (MASK & VALUE )
  65. REGISTER BIT STATUS for a bit field has 2 or more defines associated with it.
  66. 1.  BIT MASK
  67. 2.  POSSIBLE BIT VALUE
  68. 3.     .
  69. 4      .
  70. returned_bit_field_status  =  MASK & reg_value
  71. Most constants are declared immediatly after the register they are used in.
  72. Some constants are shared between more than 1 register and are only defined
  73. once after the first register.
  74. Some of names used here indicatate the following:
  75. virqack - interrupt from the completion of vme irq acknowledge cycle
  76. virq    - interrupt from vme
  77. virqreq - interrupt to vme
  78. lirq    - interrupt from the boards local stuff ie timers, sio etc.
  79. misci   - interrupt from error,dma or vmeack
  80. erri    - interrupt from error register
  81. dmai    - interrupt from dma register
  82. icgsi   - interrupt from icgs facilities
  83. icmsi   - interrupt from icms facilities
  84. ======================================================================**/
  85. /* IMPORTANT NOTICE: NOT ALL CONSTANTS HAVE BEEN TESTED */
  86. /* The following #defines allow or disallow C types */
  87. #ifndef _ASMLANGUAGE
  88. /* C code type casting */
  89. #ifndef P_VI_TYPE
  90. #define P_VI_TYPE (unsigned char *)
  91. #endif
  92. #ifndef VI_TYPE
  93. #define VI_TYPE  (unsigned char)
  94. #endif
  95. #else
  96. /* No type casting allowed in assembly */
  97. #define VI_TYPE
  98. #define P_VI_TYPE
  99. #endif /* _ASMLANGUAGE */
  100. #define VIC_ADR 0xfffc0000
  101. #define VIC_TYPE unsigned char
  102. /* IMPORTANT */
  103. /* Some boards may require a special routine to access the vic registers.    */
  104. /* ( ex: a board whose cache must be bypassed to ensure register integrity ) */
  105. /* If they do, there should be  viXetReg() macros #define'd to call that     */
  106. /* special routine. Otherwise the following viXetReg() macros will be used.  */
  107. /* For portability reasons, it might be a good idea to only use viRegSet()   */
  108. /* to alter any vic registers in C code.      */
  109. /*              */
  110. /* #undef the following macro to replace it if needed                        */
  111. #ifndef viRegSet
  112. #define viRegSet(bReg,val) *(bReg) = (VIC_TYPE)(val)
  113. #endif
  114. #ifndef viRegGet
  115. #define viRegGet(bReg) *(bReg)
  116. #endif
  117. /* BEGIN REGISTER CONSTANTS */
  118. /* VME Intr IACK cntl */
  119. #define B_VIC_VIRQACK_CTL P_VI_TYPE (VIC_ADR +  0x03)
  120. #define VIRQACK_MASK VI_TYPE 0x80
  121. #define VIRQACK_ENABLE VI_TYPE 0x0
  122. #define VIRQACK_DISABLE VI_TYPE 0x80
  123. #define VIRQACK_IPL_MASK VI_TYPE 0x07
  124. /* VME IRQ handler cntl lev 1-7 */
  125. #define B_VIC_VIRQ1_CTL  P_VI_TYPE (VIC_ADR +  0x07)
  126. #define B_VIC_VIRQ2_CTL  P_VI_TYPE (VIC_ADR +  0x0b)
  127. #define B_VIC_VIRQ3_CTL  P_VI_TYPE (VIC_ADR +  0x0f)
  128. #define B_VIC_VIRQ4_CTL  P_VI_TYPE (VIC_ADR +  0x13)
  129. #define B_VIC_VIRQ5_CTL  P_VI_TYPE (VIC_ADR +  0x17)
  130. #define B_VIC_VIRQ6_CTL  P_VI_TYPE (VIC_ADR +  0x1b)
  131. #define B_VIC_VIRQ7_CTL  P_VI_TYPE (VIC_ADR +  0x1f)
  132. /* these are used a shift values to access the proper ctl reg */
  133. #define VIRQ1 VI_TYPE 0x01
  134. #define VIRQ2 VI_TYPE 0x02
  135. #define VIRQ3 VI_TYPE 0x03
  136. #define VIRQ4 VI_TYPE 0x04
  137. #define VIRQ5 VI_TYPE 0x05
  138. #define VIRQ6 VI_TYPE 0x06
  139. #define VIRQ7 VI_TYPE 0x07
  140. #define         VIRQ_CTL_IPL_MASK VI_TYPE 0x7
  141. #define  VIRQ_MASK   VI_TYPE 0x80
  142. #define  VIRQ_ENABLE    VI_TYPE 0x0
  143. #define  VIRQ_DISABLE   VI_TYPE 0x80
  144.  /* DMA Status Interrupt cntl */
  145. #define B_VIC_DMAI_CTL  P_VI_TYPE (VIC_ADR +  0x23)
  146. #define         DMAI_IPL_MASK 0x7
  147. #define DMAI_MASK  VI_TYPE 0x80
  148. #define DMAI_ENABLE   VI_TYPE 0x0
  149. #define DMAI_DISABLE  VI_TYPE 0x80
  150. /* Local Interrupt cntl lev 1-7 */
  151. #define B_VIC_LIRQ1_CTL  P_VI_TYPE (VIC_ADR +  0x27)
  152. #define B_VIC_LIRQ2_CTL  P_VI_TYPE (VIC_ADR +  0x2b)
  153. #define B_VIC_LIRQ3_CTL  P_VI_TYPE (VIC_ADR +  0x2f)
  154. #define B_VIC_LIRQ4_CTL  P_VI_TYPE (VIC_ADR +  0x33)
  155. #define B_VIC_LIRQ5_CTL  P_VI_TYPE (VIC_ADR +  0x37)
  156. #define B_VIC_LIRQ6_CTL  P_VI_TYPE (VIC_ADR +  0x3b)
  157. #define B_VIC_LIRQ7_CTL  P_VI_TYPE (VIC_ADR +  0x3f)
  158. /* these are used as shift values to access the proper ctl reg */
  159. /* these are also used for lirq status */
  160. #define LIRQ1   VI_TYPE 0x01
  161. #define LIRQ2   VI_TYPE 0x02
  162. #define LIRQ3   VI_TYPE 0x03
  163. #define LIRQ4   VI_TYPE 0x04
  164. #define LIRQ5   VI_TYPE 0x05
  165. #define LIRQ6   VI_TYPE 0x06
  166. #define LIRQ7   VI_TYPE 0x07
  167. #define LIRQ_MASK  VI_TYPE 0x80
  168. #define LIRQ_ENABLE    VI_TYPE 0x0
  169. #define LIRQ_DISABLE            VI_TYPE 0x80
  170. #define SENCE_MASK  VI_TYPE 0x70
  171. #define ACTIVE_MASK         VI_TYPE 0x40
  172. #define LEVEL_MASK  VI_TYPE 0x20
  173. #define VIC_VECTOR_MASK          VI_TYPE 0x10
  174. #define ACTIVE_HIGH         VI_TYPE 0x40
  175. #define ACTIVE_LOW          VI_TYPE 0x00
  176. #define EDGE_SENSITIVE     VI_TYPE 0x20
  177. #define LEVEL_SENSITIVE     VI_TYPE 0x00
  178. #define VIC_SUP_VECTOR     VI_TYPE 0x10
  179. #define VIC_NO_SUP_VECTOR   VI_TYPE 0x00
  180. /* mask for state of LIRQ X VIC input signal */
  181. #define LIRQ_INPUT_SIGNAL_MASK  VI_TYPE 0x08
  182. #define LIRQ_CTL_IPL_MASK   VI_TYPE 0x07
  183. #define B_VIC_ICGSI_CTL  P_VI_TYPE (VIC_ADR +  0x43)
  184. #define ICGSI_ENABLE VI_TYPE  0x00
  185. #define ICGSI_DISABLE VI_TYPE  0xf0
  186. /*
  187. These are actually masks which may be or'ed together.
  188. NOTE:
  189. These are used for shift base values, to access the control
  190. bit in the B_VIC_ICGSI_CTL reg do  0x1 << (ICGSx + 4)
  191. these constants are used for other ICF functions.
  192. */
  193. #define ICGS3  VI_TYPE 0x3
  194. #define ICGS2  VI_TYPE 0x2
  195. #define ICGS1  VI_TYPE 0x1
  196. #define ICGS0  VI_TYPE 0x0
  197. #define ICGSI_IPL_MASK VI_TYPE 0x07
  198. #define B_VIC_ICMSI_CTL  P_VI_TYPE (VIC_ADR +  0x47)
  199. #define ICMSI_ENABLE VI_TYPE  0x00
  200. #define ICMSI_DISABLE VI_TYPE  0xf0
  201. /* these are actually masks which may be or'ed together */
  202. #define ICMS3  VI_TYPE 0x3
  203. #define ICMS2  VI_TYPE 0x2
  204. #define ICMS1  VI_TYPE 0x1
  205. #define ICMS0  VI_TYPE 0x0
  206. #define ICMSI_IPL_MASK VI_TYPE 0x07
  207. #define B_VIC_ERRI_CTL  P_VI_TYPE (VIC_ADR +  0x4b)
  208. #define ERRI_ENABLE VI_TYPE  0x00
  209. #define ERRI_DISABLE VI_TYPE  0xf0
  210. /* these are actually masks which may be or'ed together */
  211. #define ERRI_SYSFAIL  VI_TYPE 0x10
  212. #define ERRI_ARB_TIMEOUT   VI_TYPE 0x20
  213. #define ERRI_WRITE_POST  VI_TYPE 0x40
  214. #define ERRI_ACFAIL  VI_TYPE 0x80
  215. #define ERRI_IPL_MASK VI_TYPE 0x07
  216. #define B_VIC_ICGSI_VBASE       P_VI_TYPE (VIC_ADR +  0x4f)
  217. #define B_VIC_ICGSI_STAT        P_VI_TYPE (VIC_ADR +  0x4f)
  218. #define ICGSI_VBASE_MASK    VI_TYPE 0xfc
  219. #define ICGSI_STAT_MASK         VI_TYPE 0x03
  220. /* defined above but shown here
  221. #define ICGS0 0
  222. #define ICGS1 1
  223. #define ICGS2 2
  224. #define ICGS3 3
  225. */
  226. #define B_VIC_ICMSI_VBASE  P_VI_TYPE (VIC_ADR +  0x53)
  227. #define B_VIC_ICMSI_STAT  P_VI_TYPE (VIC_ADR +  0x53)
  228. #define ICMSI_VBASE_MASK    VI_TYPE 0xfc
  229. #define ICMSI_STAT_MASK   VI_TYPE 0x03
  230. /* defined above but shown here
  231. #define ICMS0 0
  232. #define ICMS1 1
  233. #define ICMS2 2
  234. #define ICMS3 3
  235. */
  236. #define B_VIC_LIRQ_VBASE P_VI_TYPE (VIC_ADR +  0x57)
  237. #define B_VIC_LIRQ_STAT  P_VI_TYPE (VIC_ADR +  0x57)
  238. #define LIRQ_VBASE_MASK     VI_TYPE 0xf8
  239. #define LIRQ_STAT_MASK          VI_TYPE 0x07
  240. /* this was B_VIC_ERRI_xxxx */
  241. #define B_VIC_MISCI_VBASE   P_VI_TYPE (VIC_ADR +  0x5b)
  242. #define B_VIC_MISCI_STAT   P_VI_TYPE (VIC_ADR +  0x5b)
  243. #define MISCI_VBASE_MASK     VI_TYPE 0xf8
  244. #define MISCI_STAT_MASK          VI_TYPE 0x07
  245. #define MISCI_DMA  VI_TYPE 0x5
  246. #define MISCI_VME_IACK    VI_TYPE 0x4
  247. #define MISCI_SYSFAIL  VI_TYPE 0x3
  248. #define MISCI_ARB_TIMEOUT   VI_TYPE 0x2
  249. #define MISCI_WRITE_POST   VI_TYPE 0x1
  250. #define MISCI_ACFAIL  VI_TYPE 0x0
  251. #define B_VIC_IPC_SWITCH  P_VI_TYPE (VIC_ADR +  0x5f)
  252. /* ICMSX and ICGSX contants above and shift accordingly */
  253. #define B_VIC_IPC_REG0  P_VI_TYPE (VIC_ADR +  0x63)
  254. #define B_VIC_IPC_REG1  P_VI_TYPE (VIC_ADR +  0x67)
  255. #define B_VIC_IPC_REG2  P_VI_TYPE (VIC_ADR +  0x6b)
  256. #define B_VIC_IPC_REG3  P_VI_TYPE (VIC_ADR +  0x6f)
  257. #define B_VIC_IPC_REG4  P_VI_TYPE (VIC_ADR +  0x73)
  258. #define B_VIC_IPC_REG5  P_VI_TYPE (VIC_ADR +  0x77)
  259. #define B_VIC_IPC_REG6  P_VI_TYPE (VIC_ADR +  0x7b)
  260. #define B_VIC_IPC_REG7  P_VI_TYPE (VIC_ADR +  0x7f)
  261. #define B_VIC_VIRQREQ_CTL   P_VI_TYPE (VIC_ADR +  0x83)
  262. #define B_VIC_VIRQREQ_STAT  P_VI_TYPE (VIC_ADR +  0x83)
  263. #define VIRQREQ_MASK  VI_TYPE 0x01
  264. #define VIRQREQ_ENABLE  VI_TYPE 0x01
  265. #define VIRQREQ_DISABLE    VI_TYPE 0x00
  266. #define VIRQREQ_CTL_MASK  VI_TYPE 0xfe
  267. #define VIRQREQ_STAT    VI_TYPE 0xfe
  268. #define VIRQ1REQ  VI_TYPE 0x02
  269. #define VIRQ2REQ  VI_TYPE 0x04
  270. #define VIRQ3REQ  VI_TYPE 0x08
  271. #define VIRQ4REQ  VI_TYPE 0x10
  272. #define VIRQ5REQ  VI_TYPE 0x20
  273. #define VIRQ6REQ  VI_TYPE 0x40
  274. #define VIRQ7REQ  VI_TYPE 0x80
  275. #define B_VIC_VIRQ1REQ_VECTOR  P_VI_TYPE (VIC_ADR +  0x87)
  276. #define B_VIC_VIRQ2REQ_VECTOR  P_VI_TYPE (VIC_ADR +  0x8b)
  277. #define B_VIC_VIRQ3REQ_VECTOR  P_VI_TYPE (VIC_ADR +  0x8f)
  278. #define B_VIC_VIRQ4REQ_VECTOR  P_VI_TYPE (VIC_ADR +  0x93)
  279. #define B_VIC_VIRQ5REQ_VECTOR  P_VI_TYPE (VIC_ADR +  0x97)
  280. #define B_VIC_VIRQ6REQ_VECTOR  P_VI_TYPE (VIC_ADR +  0x9b)
  281. #define B_VIC_VIRQ7REQ_VECTOR  P_VI_TYPE (VIC_ADR +  0x9f)
  282. #define B_VIC_TIMEOUTS  P_VI_TYPE (VIC_ADR +  0xa3)
  283. #define B_VIC_LBUS_TIMING  P_VI_TYPE (VIC_ADR +  0xa7)
  284. #define B_VIC_BLK_XFER_DEF  P_VI_TYPE (VIC_ADR +  0xab)
  285. #define B_VIC_VME_CONFIG  P_VI_TYPE (VIC_ADR +  0xaf)
  286. #define B_VIC_ARB_REQ_CONFIG  P_VI_TYPE (VIC_ADR +  0xb3)
  287. #define B_VIC_AM_SRC  P_VI_TYPE (VIC_ADR +  0xb7)
  288. /* bus error status reg */
  289. #define B_VIC_BERR_STAT  P_VI_TYPE (VIC_ADR +  0xbb)
  290. #define LBUS_VME_ACQ_TIME_OUT    VI_TYPE 0x01
  291. #define SELF_SLAVE1_ACC   VI_TYPE 0x02
  292. #define SELF_SLAVE0_ACC   VI_TYPE 0x04
  293. #define LBUS_TIME_OUT  VI_TYPE 0x08
  294. #define VME_TIMEOUT  VI_TYPE 0x10
  295. #define VME_BUS_ERROR  VI_TYPE 0x20
  296. #define LBUS_ERROR  VI_TYPE 0x40
  297. #define IAM_SYSCON  VI_TYPE 0x80
  298. #define B_VIC_DMA_STAT  P_VI_TYPE (VIC_ADR +  0xbf)
  299. #define B_VIC_SLS0_CTL0  P_VI_TYPE (VIC_ADR +  0xc3)
  300. #define TMR_MASK   VI_TYPE 0xc0
  301. #define DISABLE_TMR  VI_TYPE  0x0
  302. #define ENABLE_HZ50  VI_TYPE 0x40
  303. #define ENABLE_HZ1000  VI_TYPE 0x80
  304. #define ENABLE_HZ100  VI_TYPE 0xc0
  305. #define ASIZE_MASK VI_TYPE 0x0c
  306. #define ASIZE_32 VI_TYPE 0x00
  307. #define ASIZE_24 VI_TYPE 0x04
  308. #define ASIZE_16 VI_TYPE 0x08
  309. #define B_VIC_SLS0_CTL1  P_VI_TYPE (VIC_ADR +  0xc7)
  310. #define B_VIC_SLS1_CTL0  P_VI_TYPE (VIC_ADR +  0xcb)
  311. #define B_VIC_SLS1_CTL1  P_VI_TYPE (VIC_ADR +  0xcf)
  312. #define B_VIC_RLSE_CTL  P_VI_TYPE (VIC_ADR +  0xd3)
  313. #define B_VIC_BLK_XFER_CTL  P_VI_TYPE (VIC_ADR +  0xd7)
  314. #define B_VIC_BLK_XFER_LEN0  P_VI_TYPE (VIC_ADR +  0xdb)
  315. #define B_VIC_BLK_XFER_LEN1  P_VI_TYPE (VIC_ADR +  0xdf)
  316. #define B_VIC_SYS_RESET  P_VI_TYPE (VIC_ADR +  0xe3)
  317. #define SYS_RESET_ENABLE  VI_TYPE 0xf0
  318. #ifdef __cplusplus
  319. }
  320. #endif
  321. #endif /* __INCivich */