epi.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. //*****************************************************************************
  2. //
  3. // epi.h - Prototypes and macros for the EPI module.
  4. //
  5. // Copyright (c) 2008-2009 Luminary Micro, Inc. All rights reserved.
  6. // Software License Agreement
  7. //
  8. // Luminary Micro, Inc. (LMI) is supplying this software for use solely and
  9. // exclusively on LMI's microcontroller products.
  10. //
  11. // The software is owned by LMI and/or its suppliers, and is protected under
  12. // applicable copyright laws. All rights are reserved. You may not combine
  13. // this software with "viral" open-source software in order to form a larger
  14. // program. Any use in violation of the foregoing restrictions may subject
  15. // the user to criminal sanctions under applicable laws, as well as to civil
  16. // liability for the breach of the terms and conditions of this license.
  17. //
  18. // THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
  19. // OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
  20. // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
  21. // LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
  22. // CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
  23. //
  24. // This is part of revision 4694 of the Stellaris Peripheral Driver Library.
  25. //
  26. //*****************************************************************************
  27. #ifndef __EPI_H__
  28. #define __EPI_H__
  29. //*****************************************************************************
  30. //
  31. // If building with a C++ compiler, make all of the definitions in this header
  32. // have a C binding.
  33. //
  34. //*****************************************************************************
  35. #ifdef __cplusplus
  36. extern "C"
  37. {
  38. #endif
  39. //*****************************************************************************
  40. //
  41. // Values that can be passed to EPIModeSet()
  42. //
  43. //*****************************************************************************
  44. #define EPI_MODE_NONE 0x00000010
  45. #define EPI_MODE_SDRAM 0x00000011
  46. #define EPI_MODE_HB8 0x00000012
  47. #define EPI_MODE_DISABLE 0x00000000
  48. //*****************************************************************************
  49. //
  50. // Values that can be passed to EPIConfigSDRAMSet()
  51. //
  52. //*****************************************************************************
  53. #define EPI_SDRAM_CORE_FREQ_0_15 0x00000000
  54. #define EPI_SDRAM_CORE_FREQ_15_30 0x40000000
  55. #define EPI_SDRAM_CORE_FREQ_30_50 0x80000000
  56. #define EPI_SDRAM_CORE_FREQ_50_100 0xC0000000
  57. #define EPI_SDRAM_LOW_POWER 0x00000200
  58. #define EPI_SDRAM_FULL_POWER 0x00000000
  59. #define EPI_SDRAM_SIZE_64MBIT 0x00000000
  60. #define EPI_SDRAM_SIZE_128MBIT 0x00000001
  61. #define EPI_SDRAM_SIZE_256MBIT 0x00000002
  62. #define EPI_SDRAM_SIZE_512MBIT 0x00000003
  63. //*****************************************************************************
  64. //
  65. // Values that can be passed to EPIConfigNoModeSet()
  66. //
  67. //*****************************************************************************
  68. #define EPI_NONMODE_CLKPIN 0x80000000
  69. #define EPI_NONMODE_CLKSTOP 0x40000000
  70. #define EPI_NONMODE_CLKENA 0x10000000
  71. #define EPI_NONMODE_FRAMEPIN 0x08000000
  72. #define EPI_NONMODE_FRAME50 0x04000000
  73. #define EPI_NONMODE_READWRITE 0x00200000
  74. #define EPI_NONMODE_WRITE2CYCLE 0x00080000
  75. #define EPI_NONMODE_READ2CYCLE 0x00040000
  76. #define EPI_NONMODE_ASIZE_NONE 0x00000000
  77. #define EPI_NONMODE_ASIZE_4 0x00000010
  78. #define EPI_NONMODE_ASIZE_12 0x00000020
  79. #define EPI_NONMODE_ASIZE_20 0x00000030
  80. #define EPI_NONMODE_DSIZE_8 0x00000000
  81. #define EPI_NONMODE_DSIZE_16 0x00000001
  82. #define EPI_NONMODE_DSIZE_24 0x00000002
  83. #define EPI_NONMODE_DSIZE_32 0x00000003
  84. //*****************************************************************************
  85. //
  86. // Values that can be passed to EPIConfigHB8ModeSet()
  87. //
  88. //*****************************************************************************
  89. #define EPI_HB8_USE_TXEMPTY 0x00800000
  90. #define EPI_HB8_USE_RXFULL 0x00400000
  91. #define EPI_HB8_WRHIGH 0x00200000
  92. #define EPI_HB8_RDHIGH 0x00100000
  93. #define EPI_HB8_WRWAIT_0 0x00000000
  94. #define EPI_HB8_WRWAIT_1 0x00000040
  95. #define EPI_HB8_WRWAIT_2 0x00000080
  96. #define EPI_HB8_WRWAIT_3 0x000000C0
  97. #define EPI_HB8_RDWAIT_0 0x00000000
  98. #define EPI_HB8_RDWAIT_1 0x00000010
  99. #define EPI_HB8_RDWAIT_2 0x00000020
  100. #define EPI_HB8_RDWAIT_3 0x00000030
  101. #define EPI_HB8_MODE_ADMUX 0x00000000
  102. #define EPI_HB8_MODE_ADDEMUX 0x00000001
  103. #define EPI_HB8_MODE_SRAM 0x00000002
  104. #define EPI_HB8_MODE_FIFO 0x00000003
  105. //*****************************************************************************
  106. //
  107. // Values that can be passed to EPIConfigSDRAMSet()
  108. //
  109. //*****************************************************************************
  110. #define EPI_ADDR_PER_SIZE_256B 0x00000000
  111. #define EPI_ADDR_PER_SIZE_64KB 0x00000040
  112. #define EPI_ADDR_PER_SIZE_16MB 0x00000080
  113. #define EPI_ADDR_PER_SIZE_512MB 0x000000C0
  114. #define EPI_ADDR_PER_BASE_NONE 0x00000000
  115. #define EPI_ADDR_PER_BASE_A 0x00000010
  116. #define EPI_ADDR_PER_BASE_C 0x00000020
  117. #define EPI_ADDR_RAM_SIZE_256B 0x00000000
  118. #define EPI_ADDR_RAM_SIZE_64KB 0x00000004
  119. #define EPI_ADDR_RAM_SIZE_16MB 0x00000008
  120. #define EPI_ADDR_RAM_SIZE_512MB 0x0000000C
  121. #define EPI_ADDR_RAM_BASE_NONE 0x00000000
  122. #define EPI_ADDR_RAM_BASE_6 0x00000001
  123. #define EPI_ADDR_RAM_BASE_8 0x00000002
  124. //*****************************************************************************
  125. //
  126. // Values that can be passed to EPINonBlockingReadConfigure()
  127. //
  128. //*****************************************************************************
  129. #define EPI_NBCONFIG_SIZE_8 1
  130. #define EPI_NBCONFIG_SIZE_16 2
  131. #define EPI_NBCONFIG_SIZE_32 3
  132. //*****************************************************************************
  133. //
  134. // Values that can be passed to EPIFIFOConfig()
  135. //
  136. //*****************************************************************************
  137. #define EPI_FIFO_CONFIG_WTFULLERR 0x00020000
  138. #define EPI_FIFO_CONFIG_RSTALLERR 0x00010000
  139. #define EPI_FIFO_CONFIG_TX_EMPTY 0x00000000
  140. #define EPI_FIFO_CONFIG_TX_1_4 0x00000020
  141. #define EPI_FIFO_CONFIG_TX_1_2 0x00000030
  142. #define EPI_FIFO_CONFIG_TX_3_4 0x00000040
  143. #define EPI_FIFO_CONFIG_RX_1_8 0x00000001
  144. #define EPI_FIFO_CONFIG_RX_1_4 0x00000002
  145. #define EPI_FIFO_CONFIG_RX_1_2 0x00000003
  146. #define EPI_FIFO_CONFIG_RX_3_4 0x00000004
  147. #define EPI_FIFO_CONFIG_RX_7_8 0x00000005
  148. #define EPI_FIFO_CONFIG_RX_FULL 0x00000006
  149. //*****************************************************************************
  150. //
  151. // Values that can be passed to EPIIntEnable(), EPIIntDisable(), or returned
  152. // as flags from EPIIntStatus()
  153. //
  154. //*****************************************************************************
  155. #define EPI_INT_TXREQ 0x00000004
  156. #define EPI_INT_RXREQ 0x00000002
  157. #define EPI_INT_ERR 0x00000001
  158. //*****************************************************************************
  159. //
  160. // Values that can be passed to EPIIntErrorClear(), or returned as flags from
  161. // EPIIntErrorStatus()
  162. //
  163. //*****************************************************************************
  164. #define EPI_INT_ERR_WTFULL 0x00000004
  165. #define EPI_INT_ERR_RSTALL 0x00000002
  166. #define EPI_INT_ERR_TIMEOUT 0x00000001
  167. //*****************************************************************************
  168. //
  169. // API Function prototypes
  170. //
  171. //*****************************************************************************
  172. void EPIModeSet(unsigned long ulBase, unsigned long ulMode);
  173. void EPIDividerSet(unsigned long ulBase, unsigned long ulDivider);
  174. void EPIConfigSDRAMSet(unsigned long ulBase, unsigned long ulConfig,
  175. unsigned long ulRefresh);
  176. void EPIConfigNoModeSet(unsigned long ulBase, unsigned long ulConfig,
  177. unsigned long ulFrameCount, unsigned long ulMaxWait);
  178. void EPIConfigHB8Set(unsigned long ulBase, unsigned long ulConfig,
  179. unsigned long ulMaxWait);
  180. void EPIAddressMapSet(unsigned long ulBase, unsigned long ulMap);
  181. void EPINonBlockingReadConfigure(unsigned long ulBase, unsigned long ulChannel,
  182. unsigned long ulDataSize, unsigned long ulAddress);
  183. void EPINonBlockingReadStart(unsigned long ulBase, unsigned long ulChannel,
  184. unsigned long ulCount);
  185. void EPINonBlockingReadStop(unsigned long ulBase, unsigned long ulChannel);
  186. unsigned long EPINonBlockingReadCount(unsigned long ulBase,
  187. unsigned long ulChannel);
  188. unsigned long EPINonBlockingReadAvail(unsigned long ulBase);
  189. unsigned long EPINonBlockingReadGet32(unsigned long ulBase,
  190. unsigned long ulCount,
  191. unsigned long *pulBuf);
  192. unsigned long EPINonBlockingReadGet16(unsigned long ulBase,
  193. unsigned long ulCount,
  194. unsigned short *pusBuf);
  195. unsigned long EPINonBlockingReadGet8(unsigned long ulBase,
  196. unsigned long ulCount,
  197. unsigned char *pucBuf);
  198. void EPIFIFOConfig(unsigned long ulBase, unsigned long ulConfig);
  199. unsigned long EPINonBlockingWriteCount(unsigned long ulBase);
  200. void EPIIntEnable(unsigned long ulBase, unsigned long ulIntFlags);
  201. void EPIIntDisable(unsigned long ulBase, unsigned long ulIntFlags);
  202. unsigned long EPIIntStatus(unsigned long ulBase, tBoolean bMasked);
  203. unsigned long EPIIntErrorStatus(unsigned long ulBase);
  204. void EPIIntErrorClear(unsigned long ulBase, unsigned long ulErrFlags);
  205. void EPIIntRegister(unsigned long ulBase, void (*pfnHandler)(void));
  206. void EPIIntUnregister(unsigned long ulBase);
  207. //*****************************************************************************
  208. //
  209. // Mark the end of the C bindings section for C++ compilers.
  210. //
  211. //*****************************************************************************
  212. #ifdef __cplusplus
  213. }
  214. #endif
  215. #endif // __EPI_H__