1
0

epi.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. //*****************************************************************************
  2. //
  3. // epi.h - Prototypes and macros for the EPI module.
  4. //
  5. // Copyright (c) 2008-2011 Texas Instruments Incorporated. All rights reserved.
  6. // Software License Agreement
  7. //
  8. // Texas Instruments (TI) is supplying this software for use solely and
  9. // exclusively on TI's microcontroller products. The software is owned by
  10. // TI and/or its suppliers, and is protected under applicable copyright
  11. // laws. You may not combine this software with "viral" open-source
  12. // software in order to form a larger program.
  13. //
  14. // THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
  15. // NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
  16. // NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  17. // A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
  18. // CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
  19. // DAMAGES, FOR ANY REASON WHATSOEVER.
  20. //
  21. // This is part of revision 8264 of the Stellaris Peripheral Driver Library.
  22. //
  23. //*****************************************************************************
  24. #ifndef __EPI_H__
  25. #define __EPI_H__
  26. //*****************************************************************************
  27. //
  28. // If building with a C++ compiler, make all of the definitions in this header
  29. // have a C binding.
  30. //
  31. //*****************************************************************************
  32. #ifdef __cplusplus
  33. extern "C"
  34. {
  35. #endif
  36. //*****************************************************************************
  37. //
  38. // Values that can be passed to EPIModeSet()
  39. //
  40. //*****************************************************************************
  41. #define EPI_MODE_GENERAL 0x00000010
  42. #define EPI_MODE_SDRAM 0x00000011
  43. #define EPI_MODE_HB8 0x00000012
  44. #define EPI_MODE_HB16 0x00000013
  45. #define EPI_MODE_DISABLE 0x00000000
  46. //*****************************************************************************
  47. //
  48. // Values that can be passed to EPIConfigSDRAMSet()
  49. //
  50. //*****************************************************************************
  51. #define EPI_SDRAM_CORE_FREQ_0_15 0x00000000
  52. #define EPI_SDRAM_CORE_FREQ_15_30 0x40000000
  53. #define EPI_SDRAM_CORE_FREQ_30_50 0x80000000
  54. #define EPI_SDRAM_CORE_FREQ_50_100 0xC0000000
  55. #define EPI_SDRAM_LOW_POWER 0x00000200
  56. #define EPI_SDRAM_FULL_POWER 0x00000000
  57. #define EPI_SDRAM_SIZE_64MBIT 0x00000000
  58. #define EPI_SDRAM_SIZE_128MBIT 0x00000001
  59. #define EPI_SDRAM_SIZE_256MBIT 0x00000002
  60. #define EPI_SDRAM_SIZE_512MBIT 0x00000003
  61. //*****************************************************************************
  62. //
  63. // Values that can be passed to EPIConfigGPModeSet()
  64. //
  65. //*****************************************************************************
  66. #define EPI_GPMODE_CLKPIN 0x80000000
  67. #define EPI_GPMODE_CLKGATE 0x40000000
  68. #define EPI_GPMODE_RDYEN 0x10000000
  69. #define EPI_GPMODE_FRAMEPIN 0x08000000
  70. #define EPI_GPMODE_FRAME50 0x04000000
  71. #define EPI_GPMODE_READWRITE 0x00200000
  72. #define EPI_GPMODE_WRITE2CYCLE 0x00080000
  73. #define EPI_GPMODE_READ2CYCLE 0x00040000
  74. #define EPI_GPMODE_ASIZE_NONE 0x00000000
  75. #define EPI_GPMODE_ASIZE_4 0x00000010
  76. #define EPI_GPMODE_ASIZE_12 0x00000020
  77. #define EPI_GPMODE_ASIZE_20 0x00000030
  78. #define EPI_GPMODE_DSIZE_8 0x00000000
  79. #define EPI_GPMODE_DSIZE_16 0x00000001
  80. #define EPI_GPMODE_DSIZE_24 0x00000002
  81. #define EPI_GPMODE_DSIZE_32 0x00000003
  82. #define EPI_GPMODE_WORD_ACCESS 0x00000100
  83. //*****************************************************************************
  84. //
  85. // Values that can be passed to EPIConfigHB8ModeSet()
  86. //
  87. //*****************************************************************************
  88. #define EPI_HB8_USE_TXEMPTY 0x00800000
  89. #define EPI_HB8_USE_RXFULL 0x00400000
  90. #define EPI_HB8_WRHIGH 0x00200000
  91. #define EPI_HB8_RDHIGH 0x00100000
  92. #define EPI_HB8_WRWAIT_0 0x00000000
  93. #define EPI_HB8_WRWAIT_1 0x00000040
  94. #define EPI_HB8_WRWAIT_2 0x00000080
  95. #define EPI_HB8_WRWAIT_3 0x000000C0
  96. #define EPI_HB8_RDWAIT_0 0x00000000
  97. #define EPI_HB8_RDWAIT_1 0x00000010
  98. #define EPI_HB8_RDWAIT_2 0x00000020
  99. #define EPI_HB8_RDWAIT_3 0x00000030
  100. #define EPI_HB8_MODE_ADMUX 0x00000000
  101. #define EPI_HB8_MODE_ADDEMUX 0x00000001
  102. #define EPI_HB8_MODE_SRAM 0x00000002
  103. #define EPI_HB8_MODE_FIFO 0x00000003
  104. #define EPI_HB8_WORD_ACCESS 0x00000100
  105. #define EPI_HB8_CSCFG_ALE 0x00000000
  106. #define EPI_HB8_CSCFG_CS 0x00000200
  107. #define EPI_HB8_CSCFG_DUAL_CS 0x00000400
  108. #define EPI_HB8_CSCFG_ALE_DUAL_CS 0x00000600
  109. #define EPI_HB8_CSBAUD_DUAL 0x00000800
  110. #define EPI_HB8_CSCFG_MASK 0x00000600
  111. //*****************************************************************************
  112. //
  113. // Values that can be passed to EPIConfigHB16ModeSet()
  114. //
  115. //*****************************************************************************
  116. #define EPI_HB16_USE_TXEMPTY 0x00800000
  117. #define EPI_HB16_USE_RXFULL 0x00400000
  118. #define EPI_HB16_WRHIGH 0x00200000
  119. #define EPI_HB16_RDHIGH 0x00100000
  120. #define EPI_HB16_WRWAIT_0 0x00000000
  121. #define EPI_HB16_WRWAIT_1 0x00000040
  122. #define EPI_HB16_WRWAIT_2 0x00000080
  123. #define EPI_HB16_WRWAIT_3 0x000000C0
  124. #define EPI_HB16_RDWAIT_0 0x00000000
  125. #define EPI_HB16_RDWAIT_1 0x00000010
  126. #define EPI_HB16_RDWAIT_2 0x00000020
  127. #define EPI_HB16_RDWAIT_3 0x00000030
  128. #define EPI_HB16_MODE_ADMUX 0x00000000
  129. #define EPI_HB16_MODE_ADDEMUX 0x00000001
  130. #define EPI_HB16_MODE_SRAM 0x00000002
  131. #define EPI_HB16_MODE_FIFO 0x00000003
  132. #define EPI_HB16_BSEL 0x00000004
  133. #define EPI_HB16_WORD_ACCESS 0x00000100
  134. #define EPI_HB16_CSCFG_ALE 0x00000000
  135. #define EPI_HB16_CSCFG_CS 0x00000200
  136. #define EPI_HB16_CSCFG_DUAL_CS 0x00000400
  137. #define EPI_HB16_CSCFG_ALE_DUAL_CS 0x00000600
  138. #define EPI_HB16_CSBAUD_DUAL 0x00000800
  139. #define EPI_HB16_CSCFG_MASK 0x00000600
  140. //*****************************************************************************
  141. //
  142. // Values that can be passed to EPIConfigSDRAMSet()
  143. //
  144. //*****************************************************************************
  145. #define EPI_ADDR_PER_SIZE_256B 0x00000000
  146. #define EPI_ADDR_PER_SIZE_64KB 0x00000040
  147. #define EPI_ADDR_PER_SIZE_16MB 0x00000080
  148. #define EPI_ADDR_PER_SIZE_256MB 0x000000C0
  149. #define EPI_ADDR_PER_BASE_NONE 0x00000000
  150. #define EPI_ADDR_PER_BASE_A 0x00000010
  151. #define EPI_ADDR_PER_BASE_C 0x00000020
  152. #define EPI_ADDR_RAM_SIZE_256B 0x00000000
  153. #define EPI_ADDR_RAM_SIZE_64KB 0x00000004
  154. #define EPI_ADDR_RAM_SIZE_16MB 0x00000008
  155. #define EPI_ADDR_RAM_SIZE_256MB 0x0000000C
  156. #define EPI_ADDR_RAM_BASE_NONE 0x00000000
  157. #define EPI_ADDR_RAM_BASE_6 0x00000001
  158. #define EPI_ADDR_RAM_BASE_8 0x00000002
  159. //*****************************************************************************
  160. //
  161. // Values that can be passed to EPINonBlockingReadConfigure()
  162. //
  163. //*****************************************************************************
  164. #define EPI_NBCONFIG_SIZE_8 1
  165. #define EPI_NBCONFIG_SIZE_16 2
  166. #define EPI_NBCONFIG_SIZE_32 3
  167. //*****************************************************************************
  168. //
  169. // Values that can be passed to EPIFIFOConfig()
  170. //
  171. //*****************************************************************************
  172. #define EPI_FIFO_CONFIG_WTFULLERR 0x00020000
  173. #define EPI_FIFO_CONFIG_RSTALLERR 0x00010000
  174. #define EPI_FIFO_CONFIG_TX_EMPTY 0x00000000
  175. #define EPI_FIFO_CONFIG_TX_1_4 0x00000020
  176. #define EPI_FIFO_CONFIG_TX_1_2 0x00000030
  177. #define EPI_FIFO_CONFIG_TX_3_4 0x00000040
  178. #define EPI_FIFO_CONFIG_RX_1_8 0x00000001
  179. #define EPI_FIFO_CONFIG_RX_1_4 0x00000002
  180. #define EPI_FIFO_CONFIG_RX_1_2 0x00000003
  181. #define EPI_FIFO_CONFIG_RX_3_4 0x00000004
  182. #define EPI_FIFO_CONFIG_RX_7_8 0x00000005
  183. #define EPI_FIFO_CONFIG_RX_FULL 0x00000006
  184. //*****************************************************************************
  185. //
  186. // Values that can be passed to EPIIntEnable(), EPIIntDisable(), or returned
  187. // as flags from EPIIntStatus()
  188. //
  189. //*****************************************************************************
  190. #define EPI_INT_TXREQ 0x00000004
  191. #define EPI_INT_RXREQ 0x00000002
  192. #define EPI_INT_ERR 0x00000001
  193. //*****************************************************************************
  194. //
  195. // Values that can be passed to EPIIntErrorClear(), or returned as flags from
  196. // EPIIntErrorStatus()
  197. //
  198. //*****************************************************************************
  199. #define EPI_INT_ERR_WTFULL 0x00000004
  200. #define EPI_INT_ERR_RSTALL 0x00000002
  201. #define EPI_INT_ERR_TIMEOUT 0x00000001
  202. //*****************************************************************************
  203. //
  204. // API Function prototypes
  205. //
  206. //*****************************************************************************
  207. extern void EPIModeSet(unsigned long ulBase, unsigned long ulMode);
  208. extern void EPIDividerSet(unsigned long ulBase, unsigned long ulDivider);
  209. extern void EPIConfigSDRAMSet(unsigned long ulBase, unsigned long ulConfig,
  210. unsigned long ulRefresh);
  211. extern void EPIConfigGPModeSet(unsigned long ulBase, unsigned long ulConfig,
  212. unsigned long ulFrameCount,
  213. unsigned long ulMaxWait);
  214. extern void EPIConfigHB8Set(unsigned long ulBase, unsigned long ulConfig,
  215. unsigned long ulMaxWait);
  216. extern void EPIConfigHB16Set(unsigned long ulBase, unsigned long ulConfig,
  217. unsigned long ulMaxWait);
  218. extern void EPIAddressMapSet(unsigned long ulBase, unsigned long ulMap);
  219. extern void EPINonBlockingReadConfigure(unsigned long ulBase,
  220. unsigned long ulChannel,
  221. unsigned long ulDataSize,
  222. unsigned long ulAddress);
  223. extern void EPINonBlockingReadStart(unsigned long ulBase,
  224. unsigned long ulChannel,
  225. unsigned long ulCount);
  226. extern void EPINonBlockingReadStop(unsigned long ulBase,
  227. unsigned long ulChannel);
  228. extern unsigned long EPINonBlockingReadCount(unsigned long ulBase,
  229. unsigned long ulChannel);
  230. extern unsigned long EPINonBlockingReadAvail(unsigned long ulBase);
  231. extern unsigned long EPINonBlockingReadGet32(unsigned long ulBase,
  232. unsigned long ulCount,
  233. unsigned long *pulBuf);
  234. extern unsigned long EPINonBlockingReadGet16(unsigned long ulBase,
  235. unsigned long ulCount,
  236. unsigned short *pusBuf);
  237. extern unsigned long EPINonBlockingReadGet8(unsigned long ulBase,
  238. unsigned long ulCount,
  239. unsigned char *pucBuf);
  240. extern void EPIFIFOConfig(unsigned long ulBase, unsigned long ulConfig);
  241. extern unsigned long EPIWriteFIFOCountGet(unsigned long ulBase);
  242. extern void EPIIntEnable(unsigned long ulBase, unsigned long ulIntFlags);
  243. extern void EPIIntDisable(unsigned long ulBase, unsigned long ulIntFlags);
  244. extern unsigned long EPIIntStatus(unsigned long ulBase, tBoolean bMasked);
  245. extern unsigned long EPIIntErrorStatus(unsigned long ulBase);
  246. extern void EPIIntErrorClear(unsigned long ulBase, unsigned long ulErrFlags);
  247. extern void EPIIntRegister(unsigned long ulBase, void (*pfnHandler)(void));
  248. extern void EPIIntUnregister(unsigned long ulBase);
  249. //*****************************************************************************
  250. //
  251. // Several EPI APIs and labels have been renamed, with the original definition
  252. // name being deprecated. These defines provide backward compatibility.
  253. //
  254. //*****************************************************************************
  255. #ifndef DEPRECATED
  256. #define EPI_MODE_NONE EPI_MODE_GENERAL
  257. #define EPI_NONMODE_CLKPIN EPI_GPMODE_CLKPIN
  258. #define EPI_NONMODE_CLKSTOP EPI_GPMODE_CLKGATE
  259. #define EPI_NONMODE_CLKENA EPI_GPMODE_RDYEN
  260. #define EPI_NONMODE_FRAMEPIN EPI_GPMODE_FRAMEPIN
  261. #define EPI_NONMODE_FRAME50 EPI_GPMODE_FRAME50
  262. #define EPI_NONMODE_READWRITE EPI_GPMODE_READWRITE
  263. #define EPI_NONMODE_WRITE2CYCLE EPI_GPMODE_WRITE2CYCLE
  264. #define EPI_NONMODE_READ2CYCLE EPI_GPMODE_READ2CYCLE
  265. #define EPI_NONMODE_ASIZE_NONE EPI_GPMODE_ASIZE_NONE
  266. #define EPI_NONMODE_ASIZE_4 EPI_GPMODE_ASIZE_4
  267. #define EPI_NONMODE_ASIZE_12 EPI_GPMODE_ASIZE_12
  268. #define EPI_NONMODE_ASIZE_20 EPI_GPMODE_ASIZE_20
  269. #define EPI_NONMODE_DSIZE_8 EPI_GPMODE_DSIZE_8
  270. #define EPI_NONMODE_DSIZE_16 EPI_GPMODE_DSIZE_16
  271. #define EPI_NONMODE_DSIZE_24 EPI_GPMODE_DSIZE_24
  272. #define EPI_NONMODE_DSIZE_32 EPI_GPMODE_DSIZE_32
  273. #define EPI_NONMODE_WORD_ACCESS EPI_GPMODE_WORD_ACCESS
  274. #define EPINonBlockingWriteCount(a) EPIWriteFIFOCountGet(a)
  275. #define EPIConfigNoModeSet(a, b, c, d) EPIConfigGPModeSet((a), (b), (c), (d))
  276. #endif
  277. //*****************************************************************************
  278. //
  279. // Mark the end of the C bindings section for C++ compilers.
  280. //
  281. //*****************************************************************************
  282. #ifdef __cplusplus
  283. }
  284. #endif
  285. #endif // __EPI_H__