preliminaryDataProcessing.h 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. /*
  2. * SA-1101.h
  3. *
  4. * Copyright (c) Peter Danielsson 1999
  5. *
  6. * Definition of constants related to the sa1101
  7. * support chip for the sa1100
  8. *
  9. */
  10. /* Be sure that virtual mapping is defined right */
  11. #ifndef __ASM_ARCH_HARDWARE_H
  12. #error You must include hardware.h not SA-1101.h
  13. #endif
  14. #ifndef SA1101_BASE
  15. #error You must define SA-1101 physical base address
  16. #endif
  17. #ifndef LANGUAGE
  18. # ifdef __ASSEMBLY__
  19. # define LANGUAGE Assembly
  20. # else
  21. # define LANGUAGE C
  22. # endif
  23. #endif
  24. /*
  25. * We have mapped the sa1101 depending on the value of SA1101_BASE.
  26. * It then appears from 0xf4000000.
  27. */
  28. #define SA1101_p2v( x ) ((x) - SA1101_BASE + 0xf4000000)
  29. #define SA1101_v2p( x ) ((x) - 0xf4000000 + SA1101_BASE)
  30. #ifndef SA1101_p2v
  31. #define SA1101_p2v(PhAdd) (PhAdd)
  32. #endif
  33. #include <mach/bitfield.h>
  34. #define C 0
  35. #define Assembly 1
  36. /*
  37. * Memory map
  38. */
  39. #define __SHMEM_CONTROL0 0x00000000
  40. #define __SYSTEM_CONTROL1 0x00000400
  41. #define __ARBITER 0x00020000
  42. #define __SYSTEM_CONTROL2 0x00040000
  43. #define __SYSTEM_CONTROL3 0x00060000
  44. #define __PARALLEL_PORT 0x00080000
  45. #define __VIDMEM_CONTROL 0x00100000
  46. #define __UPDATE_FIFO 0x00120000
  47. #define __SHMEM_CONTROL1 0x00140000
  48. #define __INTERRUPT_CONTROL 0x00160000
  49. #define __USB_CONTROL 0x00180000
  50. #define __TRACK_INTERFACE 0x001a0000
  51. #define __MOUSE_INTERFACE 0x001b0000
  52. #define __KEYPAD_INTERFACE 0x001c0000
  53. #define __PCMCIA_INTERFACE 0x001e0000
  54. #define __VGA_CONTROL 0x00200000
  55. #define __GPIO_INTERFACE 0x00300000
  56. /*
  57. * Macro that calculates real address for registers in the SA-1101
  58. */
  59. #define _SA1101( x ) ((x) + SA1101_BASE)
  60. /*
  61. * Interface and shared memory controller registers
  62. *
  63. * Registers
  64. * SKCR SA-1101 control register (read/write)
  65. * SMCR Shared Memory Controller Register
  66. * SNPR Snoop Register
  67. */
  68. #define _SKCR _SA1101( 0x00000000 ) /* SA-1101 Control Reg. */
  69. #define _SMCR _SA1101( 0x00140000 ) /* Shared Mem. Control Reg. */
  70. #define _SNPR _SA1101( 0x00140400 ) /* Snoop Reg. */
  71. #if LANGUAGE == C
  72. #define SKCR (*((volatile Word *) SA1101_p2v (_SKCR)))
  73. #define SMCR (*((volatile Word *) SA1101_p2v (_SMCR)))
  74. #define SNPR (*((volatile Word *) SA1101_p2v (_SNPR)))
  75. #define SKCR_PLLEn 0x0001 /* Enable On-Chip PLL */
  76. #define SKCR_BCLKEn 0x0002 /* Enables BCLK */
  77. #define SKCR_Sleep 0x0004 /* Sleep Mode */
  78. #define SKCR_IRefEn 0x0008 /* DAC Iref input enable */
  79. #define SKCR_VCOON 0x0010 /* VCO bias */
  80. #define SKCR_ScanTestEn 0x0020 /* Enables scan test */
  81. #define SKCR_ClockTestEn 0x0040 /* Enables clock test */
  82. #define SMCR_DCAC Fld(2,0) /* Number of column address bits */
  83. #define SMCR_DRAC Fld(2,2) /* Number of row address bits */
  84. #define SMCR_ArbiterBias 0x0008 /* favor video or USB */
  85. #define SMCR_TopVidMem Fld(4,5) /* Top 4 bits of vidmem addr. */
  86. #define SMCR_ColAdrBits( x ) /* col. addr bits 8..11 */ \
  87. (( (x) - 8 ) << FShft (SMCR_DCAC))
  88. #define SMCR_RowAdrBits( x ) /* row addr bits 9..12 */\
  89. (( (x) - 9 ) << FShft (SMCR_DRAC))
  90. #define SNPR_VFBstart Fld(12,0) /* Video frame buffer addr */
  91. #define SNPR_VFBsize Fld(11,12) /* Video frame buffer size */
  92. #define SNPR_WholeBank (1 << 23) /* Whole bank bit */
  93. #define SNPR_BankSelect Fld(2,27) /* Bank select */
  94. #define SNPR_SnoopEn (1 << 31) /* Enable snoop operation */
  95. #define SNPR_Set_VFBsize( x ) /* set frame buffer size (in kb) */ \
  96. ( (x) << FShft (SNPR_VFBsize))
  97. #define SNPR_Select_Bank(x) /* select bank 0 or 1 */ \
  98. (( (x) + 1 ) << FShft (SNPR_BankSelect ))
  99. #endif /* LANGUAGE == C */
  100. /*
  101. * Video Memory Controller
  102. *
  103. * Registers
  104. * VMCCR Configuration register
  105. * VMCAR VMC address register
  106. * VMCDR VMC data register
  107. *
  108. */
  109. #define _VMCCR _SA1101( 0x00100000 ) /* Configuration register */
  110. #define _VMCAR _SA1101( 0x00101000 ) /* VMC address register */
  111. #define _VMCDR _SA1101( 0x00101400 ) /* VMC data register */
  112. #if LANGUAGE == C
  113. #define VMCCR (*((volatile Word *) SA1101_p2v (_VMCCR)))
  114. #define VMCAR (*((volatile Word *) SA1101_p2v (_VMCAR)))
  115. #define VMCDR (*((volatile Word *) SA1101_p2v (_VMCDR)))
  116. #define VMCCR_RefreshEn 0x0000 /* Enable memory refresh */
  117. #define VMCCR_Config 0x0001 /* DRAM size */
  118. #define VMCCR_RefPeriod Fld(2,3) /* Refresh period */
  119. #define VMCCR_StaleDataWait Fld(4,5) /* Stale FIFO data timeout counter */
  120. #define VMCCR_SleepState (1<<9) /* State of interface pins in sleep*/
  121. #define VMCCR_RefTest (1<<10) /* refresh test */
  122. #define VMCCR_RefLow Fld(6,11) /* refresh low counter */
  123. #define VMCCR_RefHigh Fld(7,17) /* refresh high counter */
  124. #define VMCCR_SDTCTest Fld(7,24) /* stale data timeout counter */
  125. #define VMCCR_ForceSelfRef (1<<31) /* Force self refresh */
  126. #endif LANGUAGE == C
  127. /* Update FIFO
  128. *
  129. * Registers
  130. * UFCR Update FIFO Control Register
  131. * UFSR Update FIFO Status Register
  132. * UFLVLR update FIFO level register
  133. * UFDR update FIFO data register
  134. */
  135. #define _UFCR _SA1101(0x00120000) /* Update FIFO Control Reg. */
  136. #define _UFSR _SA1101(0x00120400) /* Update FIFO Status Reg. */
  137. #define _UFLVLR _SA1101(0x00120800) /* Update FIFO level reg. */
  138. #define _UFDR _SA1101(0x00120c00) /* Update FIFO data reg. */
  139. #if LANGUAGE == C
  140. #define UFCR (*((volatile Word *) SA1101_p2v (_UFCR)))
  141. #define UFSR (*((volatile Word *) SA1101_p2v (_UFSR)))
  142. #define UFLVLR (*((volatile Word *) SA1101_p2v (_UFLVLR)))
  143. #define UFDR (*((volatile Word *) SA1101_p2v (_UFDR)))
  144. #define UFCR_FifoThreshhold Fld(7,0) /* Level for FifoGTn flag */
  145. #define UFSR_FifoGTnFlag 0x01 /* FifoGTn flag */#define UFSR_FifoEmpty 0x80 /* FIFO is empty */
  146. #endif /* LANGUAGE == C */
  147. /* System Controller
  148. *
  149. * Registers
  150. * SKPCR Power Control Register
  151. * SKCDR Clock Divider Register
  152. * DACDR1 DAC1 Data register
  153. * DACDR2 DAC2 Data register
  154. */
  155. #define _SKPCR _SA1101(0x00000400)
  156. #define _SKCDR _SA1101(0x00040000)
  157. #define _DACDR1 _SA1101(0x00060000)
  158. #define _DACDR2 _SA1101(0x00060400)
  159. #if LANGUAGE == C
  160. #define SKPCR (*((volatile Word *) SA1101_p2v (_SKPCR)))
  161. #define SKCDR (*((volatile Word *) SA1101_p2v (_SKCDR)))
  162. #define DACDR1 (*((volatile Word *) SA1101_p2v (_DACDR1)))
  163. #define DACDR2 (*((volatile Word *) SA1101_p2v (_DACDR2)))
  164. #define SKPCR_UCLKEn 0x01 /* USB Enable */
  165. #define SKPCR_PCLKEn 0x02 /* PS/2 Enable */
  166. #define SKPCR_ICLKEn 0x04 /* Interrupt Controller Enable */
  167. #define SKPCR_VCLKEn 0x08 /* Video Controller Enable */
  168. #define SKPCR_PICLKEn 0x10 /* parallel port Enable */
  169. #define SKPCR_DCLKEn 0x20 /* DACs Enable */
  170. #define SKPCR_nKPADEn 0x40 /* Multiplexer */
  171. #define SKCDR_PLLMul Fld(7,0) /* PLL Multiplier */
  172. #define SKCDR_VCLKEn Fld(2,7) /* Video controller clock divider */
  173. #define SKDCR_BCLKEn (1<<9) /* BCLK Divider */
  174. #define SKDCR_UTESTCLKEn (1<<10) /* Route USB clock during test mode */
  175. #define SKDCR_DivRValue Fld(6,11) /* Input clock divider for PLL */
  176. #define SKDCR_DivNValue Fld(5,17) /* Output clock divider for PLL */
  177. #define SKDCR_PLLRSH Fld(3,22) /* PLL bandwidth control */
  178. #define SKDCR_ChargePump (1<<25) /* Charge pump control */
  179. #define SKDCR_ClkTestMode (1<<26) /* Clock output test mode */
  180. #define SKDCR_ClkTestEn (1<<27) /* Test clock generator */
  181. #define SKDCR_ClkJitterCntl Fld(3,28) /* video clock jitter compensation */
  182. #define DACDR_DACCount Fld(8,0) /* Count value */
  183. #define DACDR1_DACCount DACDR_DACCount
  184. #define DACDR2_DACCount DACDR_DACCount
  185. #endif /* LANGUAGE == C */
  186. /*
  187. * Parallel Port Interface
  188. *
  189. * Registers
  190. * IEEE_Config IEEE mode selection and programmable attributes
  191. * IEEE_Control Controls the states of IEEE port control outputs
  192. * IEEE_Data Forward transfer data register
  193. * IEEE_Addr Forward transfer address register
  194. * IEEE_Status Port IO signal status register
  195. * IEEE_IntStatus Port interrupts status register
  196. * IEEE_FifoLevels Rx and Tx FIFO interrupt generation levels
  197. * IEEE_InitTime Forward timeout counter initial value
  198. * IEEE_TimerStatus Forward timeout counter current value
  199. * IEEE_FifoReset Reset forward transfer FIFO
  200. * IEEE_ReloadValue Counter reload value
  201. * IEEE_TestControl Control testmode
  202. * IEEE_TestDataIn Test data register
  203. * IEEE_TestDataInEn Enable test data
  204. * IEEE_TestCtrlIn Test control signals
  205. * IEEE_TestCtrlInEn Enable test control signals
  206. * IEEE_TestDataStat Current data bus value
  207. *
  208. */
  209. /*
  210. * The control registers are defined as offsets from a base address
  211. */
  212. #define _IEEE( x ) _SA1101( (x) + __PARALLEL_PORT )
  213. #define _IEEE_Config _IEEE( 0x0000 )
  214. #define _IEEE_Control _IEEE( 0x0400 )
  215. #define _IEEE_Data _IEEE( 0x4000 )
  216. #define _IEEE_Addr _IEEE( 0x0800 )
  217. #define _IEEE_Status _IEEE( 0x0c00 )
  218. #define _IEEE_IntStatus _IEEE( 0x1000 )
  219. #define _IEEE_FifoLevels _IEEE( 0x1400 )