emc_001.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357
  1. /*
  2. * @brief EMC Registers and control functions
  3. *
  4. * @note
  5. * Copyright(C) NXP Semiconductors, 2012
  6. * All rights reserved.
  7. *
  8. * @par
  9. * Software that is described herein is for illustrative purposes only
  10. * which provides customers with programming information regarding the
  11. * LPC products. This software is supplied "AS IS" without any warranties of
  12. * any kind, and NXP Semiconductors and its licensor disclaim any and
  13. * all warranties, express or implied, including all implied warranties of
  14. * merchantability, fitness for a particular purpose and non-infringement of
  15. * intellectual property rights. NXP Semiconductors assumes no responsibility
  16. * or liability for the use of the software, conveys no license or rights under any
  17. * patent, copyright, mask work right, or any other intellectual property rights in
  18. * or to any products. NXP Semiconductors reserves the right to make changes
  19. * in the software without notification. NXP Semiconductors also makes no
  20. * representation or warranty that such application will be suitable for the
  21. * specified use without further testing or modification.
  22. *
  23. * @par
  24. * Permission to use, copy, modify, and distribute this software and its
  25. * documentation is hereby granted, under NXP Semiconductors' and its
  26. * licensor's relevant copyrights in the software, without fee, provided that it
  27. * is used in conjunction with NXP Semiconductors microcontrollers. This
  28. * copyright, permission, and disclaimer notice must appear in all copies of
  29. * this code.
  30. */
  31. #ifndef __EMC_001_H_
  32. #define __EMC_001_H_
  33. #include "sys_config.h"
  34. #include "cmsis.h"
  35. #ifdef __cplusplus
  36. extern "C" {
  37. #endif
  38. /** @defgroup IP_EMC_001 IP: EMC register block and driver
  39. * @ingroup IP_Drivers
  40. * External Memory Controller
  41. * @{
  42. */
  43. /**
  44. * @brief External Memory Controller (EMC) register block structure
  45. */
  46. typedef struct { /*!< EMC Structure */
  47. __IO uint32_t CONTROL; /*!< Controls operation of the memory controller. */
  48. __I uint32_t STATUS; /*!< Provides EMC status information. */
  49. __IO uint32_t CONFIG; /*!< Configures operation of the memory controller. */
  50. __I uint32_t RESERVED0[5];
  51. __IO uint32_t DYNAMICCONTROL; /*!< Controls dynamic memory operation. */
  52. __IO uint32_t DYNAMICREFRESH; /*!< Configures dynamic memory refresh operation. */
  53. __IO uint32_t DYNAMICREADCONFIG; /*!< Configures the dynamic memory read strategy. */
  54. __I uint32_t RESERVED1;
  55. __IO uint32_t DYNAMICRP; /*!< Selects the precharge command period. */
  56. __IO uint32_t DYNAMICRAS; /*!< Selects the active to precharge command period. */
  57. __IO uint32_t DYNAMICSREX; /*!< Selects the self-refresh exit time. */
  58. __IO uint32_t DYNAMICAPR; /*!< Selects the last-data-out to active command time. */
  59. __IO uint32_t DYNAMICDAL; /*!< Selects the data-in to active command time. */
  60. __IO uint32_t DYNAMICWR; /*!< Selects the write recovery time. */
  61. __IO uint32_t DYNAMICRC; /*!< Selects the active to active command period. */
  62. __IO uint32_t DYNAMICRFC; /*!< Selects the auto-refresh period. */
  63. __IO uint32_t DYNAMICXSR; /*!< Selects the exit self-refresh to active command time. */
  64. __IO uint32_t DYNAMICRRD; /*!< Selects the active bank A to active bank B latency. */
  65. __IO uint32_t DYNAMICMRD; /*!< Selects the load mode register to active command time. */
  66. __I uint32_t RESERVED2[9];
  67. __IO uint32_t STATICEXTENDEDWAIT; /*!< Selects time for long static memory read and write transfers. */
  68. __I uint32_t RESERVED3[31];
  69. __IO uint32_t DYNAMICCONFIG0; /*!< Selects the configuration information for dynamic memory chip select n. */
  70. __IO uint32_t DYNAMICRASCAS0; /*!< Selects the RAS and CAS latencies for dynamic memory chip select n. */
  71. __I uint32_t RESERVED4[6];
  72. __IO uint32_t DYNAMICCONFIG1; /*!< Selects the configuration information for dynamic memory chip select n. */
  73. __IO uint32_t DYNAMICRASCAS1; /*!< Selects the RAS and CAS latencies for dynamic memory chip select n. */
  74. __I uint32_t RESERVED5[6];
  75. __IO uint32_t DYNAMICCONFIG2; /*!< Selects the configuration information for dynamic memory chip select n. */
  76. __IO uint32_t DYNAMICRASCAS2; /*!< Selects the RAS and CAS latencies for dynamic memory chip select n. */
  77. __I uint32_t RESERVED6[6];
  78. __IO uint32_t DYNAMICCONFIG3; /*!< Selects the configuration information for dynamic memory chip select n. */
  79. __IO uint32_t DYNAMICRASCAS3; /*!< Selects the RAS and CAS latencies for dynamic memory chip select n. */
  80. __I uint32_t RESERVED7[38];
  81. __IO uint32_t STATICCONFIG0; /*!< Selects the memory configuration for static chip select n. */
  82. __IO uint32_t STATICWAITWEN0; /*!< Selects the delay from chip select n to write enable. */
  83. __IO uint32_t STATICWAITOEN0; /*!< Selects the delay from chip select n or address change, whichever is later, to output enable. */
  84. __IO uint32_t STATICWAITRD0; /*!< Selects the delay from chip select n to a read access. */
  85. __IO uint32_t STATICWAITPAG0; /*!< Selects the delay for asynchronous page mode sequential accesses for chip select n. */
  86. __IO uint32_t STATICWAITWR0; /*!< Selects the delay from chip select n to a write access. */
  87. __IO uint32_t STATICWAITTURN0; /*!< Selects bus turnaround cycles */
  88. __I uint32_t RESERVED8;
  89. __IO uint32_t STATICCONFIG1; /*!< Selects the memory configuration for static chip select n. */
  90. __IO uint32_t STATICWAITWEN1; /*!< Selects the delay from chip select n to write enable. */
  91. __IO uint32_t STATICWAITOEN1; /*!< Selects the delay from chip select n or address change, whichever is later, to output enable. */
  92. __IO uint32_t STATICWAITRD1; /*!< Selects the delay from chip select n to a read access. */
  93. __IO uint32_t STATICWAITPAG1; /*!< Selects the delay for asynchronous page mode sequential accesses for chip select n. */
  94. __IO uint32_t STATICWAITWR1; /*!< Selects the delay from chip select n to a write access. */
  95. __IO uint32_t STATICWAITTURN1; /*!< Selects bus turnaround cycles */
  96. __I uint32_t RESERVED9;
  97. __IO uint32_t STATICCONFIG2; /*!< Selects the memory configuration for static chip select n. */
  98. __IO uint32_t STATICWAITWEN2; /*!< Selects the delay from chip select n to write enable. */
  99. __IO uint32_t STATICWAITOEN2; /*!< Selects the delay from chip select n or address change, whichever is later, to output enable. */
  100. __IO uint32_t STATICWAITRD2; /*!< Selects the delay from chip select n to a read access. */
  101. __IO uint32_t STATICWAITPAG2; /*!< Selects the delay for asynchronous page mode sequential accesses for chip select n. */
  102. __IO uint32_t STATICWAITWR2; /*!< Selects the delay from chip select n to a write access. */
  103. __IO uint32_t STATICWAITTURN2; /*!< Selects bus turnaround cycles */
  104. __I uint32_t RESERVED10;
  105. __IO uint32_t STATICCONFIG3; /*!< Selects the memory configuration for static chip select n. */
  106. __IO uint32_t STATICWAITWEN3; /*!< Selects the delay from chip select n to write enable. */
  107. __IO uint32_t STATICWAITOEN3; /*!< Selects the delay from chip select n or address change, whichever is later, to output enable. */
  108. __IO uint32_t STATICWAITRD3; /*!< Selects the delay from chip select n to a read access. */
  109. __IO uint32_t STATICWAITPAG3; /*!< Selects the delay for asynchronous page mode sequential accesses for chip select n. */
  110. __IO uint32_t STATICWAITWR3; /*!< Selects the delay from chip select n to a write access. */
  111. __IO uint32_t STATICWAITTURN3; /*!< Selects bus turnaround cycles */
  112. } IP_EMC_001_Type;
  113. /**
  114. * @brief EMC register support bitfields and mask
  115. */
  116. /* Reserve for extending support to ARM9 or nextgen LPC */
  117. #define EMC_SUPPORT_ONLY_PL172 /*!< Reserve for extending support to ARM9 or nextgen LPC */
  118. #define EMC_CONFIG_ENDIAN_LITTLE (0) /*!< Value for EMC to operate in Little Endian Mode */
  119. #define EMC_CONFIG_ENDIAN_BIG (1) /*!< Value for EMC to operate in Big Endian Mode */
  120. #define EMC_CONFIG_BUFFER_ENABLE (1 << 19) /*!< EMC Buffer enable bit in EMC Dynamic Configuration register */
  121. #define EMC_CONFIG_WRITE_PROTECT (1 << 20) /*!< EMC Write protect bit in EMC Dynamic Configuration register */
  122. /* Dynamic Memory Configuration Register Bit Definitions */
  123. #define EMC_DYN_CONFIG_MD_BIT (3) /*!< Memory device bit in EMC Dynamic Configuration register */
  124. #define EMC_DYN_CONFIG_MD_SDRAM (0 << EMC_DYN_CONFIG_MD_BIT) /*!< Select device as SDRAM in EMC Dynamic Configuration register */
  125. #define EMC_DYN_CONFIG_MD_LPSDRAM (1 << EMC_DYN_CONFIG_MD_BIT) /*!< Select device as LPSDRAM in EMC Dynamic Configuration register */
  126. #define EMC_DYN_CONFIG_LPSDRAM_BIT (12) /*!< LPSDRAM bit in EMC Dynamic Configuration register */
  127. #define EMC_DYN_CONFIG_LPSDRAM (1 << EMC_DYN_CONFIG_LPSDRAM_BIT) /*!< LPSDRAM value in EMC Dynamic Configuration register */
  128. #define EMC_DYN_CONFIG_DEV_SIZE_BIT (9) /*!< Device Size starting bit in EMC Dynamic Configuration register */
  129. #define EMC_DYN_CONFIG_DEV_SIZE_16Mb (0x00 << EMC_DYN_CONFIG_DEV_SIZE_BIT) /*!< 16Mb Device Size value in EMC Dynamic Configuration register */
  130. #define EMC_DYN_CONFIG_DEV_SIZE_64Mb (0x01 << EMC_DYN_CONFIG_DEV_SIZE_BIT) /*!< 64Mb Device Size value in EMC Dynamic Configuration register */
  131. #define EMC_DYN_CONFIG_DEV_SIZE_128Mb (0x02 << EMC_DYN_CONFIG_DEV_SIZE_BIT) /*!< 128Mb Device Size value in EMC Dynamic Configuration register */
  132. #define EMC_DYN_CONFIG_DEV_SIZE_256Mb (0x03 << EMC_DYN_CONFIG_DEV_SIZE_BIT) /*!< 256Mb Device Size value in EMC Dynamic Configuration register */
  133. #define EMC_DYN_CONFIG_DEV_SIZE_512Mb (0x04 << EMC_DYN_CONFIG_DEV_SIZE_BIT) /*!< 512Mb Device Size value in EMC Dynamic Configuration register */
  134. #define EMC_DYN_CONFIG_DEV_BUS_BIT (7) /*!< Device bus width starting bit in EMC Dynamic Configuration register */
  135. #define EMC_DYN_CONFIG_DEV_BUS_8 (0x00 << EMC_DYN_CONFIG_DEV_BUS_BIT) /*!< Device 8-bit bus width value in EMC Dynamic Configuration register */
  136. #define EMC_DYN_CONFIG_DEV_BUS_16 (0x01 << EMC_DYN_CONFIG_DEV_BUS_BIT) /*!< Device 16-bit bus width value in EMC Dynamic Configuration register */
  137. #define EMC_DYN_CONFIG_DEV_BUS_32 (0x02 << EMC_DYN_CONFIG_DEV_BUS_BIT) /*!< Device 32-bit bus width value in EMC Dynamic Configuration register */
  138. #define EMC_DYN_CONFIG_DATA_BUS_WIDTH_BIT (14) /*!< Device data bus width starting bit in EMC Dynamic Configuration register */
  139. #define EMC_DYN_CONFIG_DATA_BUS_16 (0x00 << EMC_DYN_CONFIG_DATA_BUS_WIDTH_BIT) /*!< Device 16-bit data bus width value in EMC Dynamic Configuration register */
  140. #define EMC_DYN_CONFIG_DATA_BUS_32 (0x01 << EMC_DYN_CONFIG_DATA_BUS_WIDTH_BIT) /*!< Device 32-bit bus width value in EMC Dynamic Configuration register */
  141. /*!< Memory configuration values in EMC Dynamic Configuration Register */
  142. #define EMC_DYN_CONFIG_2Mx8_2BANKS_11ROWS_9COLS ((0x0 << 9) | (0x0 << 7)) /*!< Value for Memory configuration - 2Mx8 2 Banks 11 Rows 9 Columns */
  143. #define EMC_DYN_CONFIG_1Mx16_2BANKS_11ROWS_8COLS ((0x0 << 9) | (0x1 << 7)) /*!< Value for Memory configuration - 1Mx16 2 Banks 11 Rows 8 Columns */
  144. #define EMC_DYN_CONFIG_8Mx8_4BANKS_12ROWS_9COLS ((0x1 << 9) | (0x0 << 7)) /*!< Value for Memory configuration - 8Mx8 4 Banks 12 Rows 9 Columns */
  145. #define EMC_DYN_CONFIG_4Mx16_4BANKS_12ROWS_8COLS ((0x1 << 9) | (0x1 << 7)) /*!< Value for Memory configuration - 4Mx16 4 Banks 12 Rows 8 Columns */
  146. #define EMC_DYN_CONFIG_2Mx32_4BANKS_11ROWS_8COLS ((0x1 << 9) | (0x2 << 7)) /*!< Value for Memory configuration - 2Mx32 4 Banks 11 Rows 8 Columns */
  147. #define EMC_DYN_CONFIG_16Mx8_4BANKS_12ROWS_10COLS ((0x2 << 9) | (0x0 << 7)) /*!< Value for Memory configuration - 16Mx8 4 Banks 12 Rows 10 Columns */
  148. #define EMC_DYN_CONFIG_8Mx16_4BANKS_12ROWS_9COLS ((0x2 << 9) | (0x1 << 7)) /*!< Value for Memory configuration - 8Mx16 4 Banks 12 Rows 9 Columns */
  149. #define EMC_DYN_CONFIG_4Mx32_4BANKS_12ROWS_8COLS ((0x2 << 9) | (0x2 << 7)) /*!< Value for Memory configuration - 4Mx32 4 Banks 12 Rows 8 Columns */
  150. #define EMC_DYN_CONFIG_32Mx8_4BANKS_13ROWS_10COLS ((0x3 << 9) | (0x0 << 7)) /*!< Value for Memory configuration - 32Mx8 4 Banks 13 Rows 10 Columns */
  151. #define EMC_DYN_CONFIG_16Mx16_4BANKS_13ROWS_9COLS ((0x3 << 9) | (0x1 << 7)) /*!< Value for Memory configuration - 16Mx16 4 Banks 13 Rows 8 Columns */
  152. #define EMC_DYN_CONFIG_8Mx32_4BANKS_13ROWS_8COLS ((0x3 << 9) | (0x2 << 7)) /*!< Value for Memory configuration - 8Mx32 4 Banks 13 Rows 8 Columns */
  153. #define EMC_DYN_CONFIG_64Mx8_4BANKS_13ROWS_11COLS ((0x4 << 9) | (0x0 << 7)) /*!< Value for Memory configuration - 64Mx8 4 Banks 13 Rows 11 Columns */
  154. #define EMC_DYN_CONFIG_32Mx16_4BANKS_13ROWS_10COLS ((0x4 << 9) | (0x1 << 7)) /*!< Value for Memory configuration - 32Mx16 4 Banks 13 Rows 10 Columns */
  155. /*!< Dynamic Memory Mode Register Bit Definition */
  156. #define EMC_DYN_MODE_BURST_LEN_BIT (0) /*!< Starting bit No. of Burst Length in Dynamic Memory Mode Register */
  157. #define EMC_DYN_MODE_BURST_LEN_1 (0) /*!< Value to set Burst Length to 1 in Dynamic Memory Mode Register */
  158. #define EMC_DYN_MODE_BURST_LEN_2 (1) /*!< Value to set Burst Length to 2 in Dynamic Memory Mode Register */
  159. #define EMC_DYN_MODE_BURST_LEN_4 (2) /*!< Value to set Burst Length to 4 in Dynamic Memory Mode Register */
  160. #define EMC_DYN_MODE_BURST_LEN_8 (3) /*!< Value to set Burst Length to 8 in Dynamic Memory Mode Register */
  161. #define EMC_DYN_MODE_BURST_LEN_FULL (7) /*!< Value to set Burst Length to Full in Dynamic Memory Mode Register */
  162. #define EMC_DYN_MODE_BURST_TYPE_BIT (3) /*!< Burst Type bit in Dynamic Memory Mode Register */
  163. #define EMC_DYN_MODE_BURST_TYPE_SEQUENTIAL (0 << EMC_DYN_MODE_BURST_TYPE_BIT) /*!< Burst Type Sequential in Dynamic Memory Mode Register */
  164. #define EMC_DYN_MODE_BURST_TYPE_INTERLEAVE (1 << EMC_DYN_MODE_BURST_TYPE_BIT) /*!< Burst Type Interleaved in Dynamic Memory Mode Register */
  165. /*!< CAS Latency in Dynamic Mode Register */
  166. #define EMC_DYN_MODE_CAS_BIT (4) /*!< CAS latency starting bit in Dynamic Memory Mode register */
  167. #define EMC_DYN_MODE_CAS_1 (1 << EMC_DYN_MODE_CAS_BIT) /*!< value for CAS latency of 1 cycle */
  168. #define EMC_DYN_MODE_CAS_2 (2 << EMC_DYN_MODE_CAS_BIT) /*!< value for CAS latency of 2 cycle */
  169. #define EMC_DYN_MODE_CAS_3 (3 << EMC_DYN_MODE_CAS_BIT) /*!< value for CAS latency of 3 cycle */
  170. /*!< Operation Mode in Dynamic Mode register */
  171. #define EMC_DYN_MODE_OPMODE_BIT (7) /*!< Dynamic Mode Operation bit */
  172. #define EMC_DYN_MODE_OPMODE_STANDARD (0 << EMC_DYN_MODE_OPMODE_BIT) /*!< Value for Dynamic standard operation Mode */
  173. /*!< Write Burst Mode in Dynamic Mode register */
  174. #define EMC_DYN_MODE_WBMODE_BIT (9) /*!< Write Burst Mode bit */
  175. #define EMC_DYN_MODE_WBMODE_PROGRAMMED (0 << EMC_DYN_MODE_WBMODE_BIT) /*!< Write Burst Mode programmed */
  176. #define EMC_DYN_MODE_WBMODE_SINGLE_LOC (1 << EMC_DYN_MODE_WBMODE_BIT) /*!< Write Burst Mode Single LOC */
  177. /*!< Dynamic Memory Control Register Bit Definitions */
  178. #define EMC_DYN_CONTROL_DEEPSLEEP_BIT (13) /*!< Deep sleep Mode bit */
  179. #define EMC_DYN_CONTROL_ENABLE (0x03) /*!< Control Enable value */
  180. /*!< Static Memory Configuration Register Bit Definitions */
  181. #define EMC_STATIC_CONFIG_MEM_WIDTH_8 (0) /*!< Static Memory Configuration - 8-bit width */
  182. #define EMC_STATIC_CONFIG_MEM_WIDTH_16 (1) /*!< Static Memory Configuration - 16-bit width */
  183. #define EMC_STATIC_CONFIG_MEM_WIDTH_32 (2) /*!< Static Memory Configuration - 32-bit width */
  184. #define EMC_STATIC_CONFIG_PAGE_MODE_BIT (3) /*!< Page Mode bit No */
  185. #define EMC_STATIC_CONFIG_PAGE_MODE_ENABLE (1 << EMC_STATIC_CONFIG_PAGE_MODE_BIT) /*!< Value to enable Page Mode */
  186. #define EMC_STATIC_CONFIG_CS_POL_BIT (6) /*!< Chip Select bit No */
  187. #define EMC_STATIC_CONFIG_CS_POL_ACTIVE_HIGH (1 << EMC_STATIC_CONFIG_CS_POL_BIT) /*!< Chip Select polarity - Active High */
  188. #define EMC_STATIC_CONFIG_CS_POL_ACTIVE_LOW (0 << EMC_STATIC_CONFIG_CS_POL_BIT) /*!< Chip Select polarity - Active Low */
  189. #define EMC_STATIC_CONFIG_BLS_BIT (7) /*!< BLS Configuration bit No */
  190. #define EMC_STATIC_CONFIG_BLS_HIGH (1 << EMC_STATIC_CONFIG_BLS_BIT) /*!< BLS High Configuration value */
  191. #define EMC_STATIC_CONFIG_BLS_LOW (0 << EMC_STATIC_CONFIG_BLS_BIT) /*!< BLS Low Configuration value */
  192. #define EMC_STATIC_CONFIG_EW_BIT (8) /*!< Ext Wait bit No */
  193. #define EMC_STATIC_CONFIG_EW_ENABLE (1 << EMC_STATIC_CONFIG_EW_BIT) /*!< Ext Wait Enabled value */
  194. #define EMC_STATIC_CONFIG_EW_DISABLE (0 << EMC_STATIC_CONFIG_EW_BIT) /*!< Ext Wait Diabled value */
  195. /*!< Q24.8 Fixed Point Helper */
  196. #define Q24_8_FP(x) ((x) * 256)
  197. #define EMC_NANOSECOND(x) Q24_8_FP(x)
  198. #define EMC_CLOCK(x) Q24_8_FP(-(x))
  199. /**
  200. * @brief EMC Dynamic Device Configuration structure used for IP drivers
  201. */
  202. typedef struct {
  203. uint32_t BaseAddr; /*!< Base Address */
  204. uint8_t RAS; /*!< RAS value */
  205. uint32_t ModeRegister; /*!< Mode Register value */
  206. uint32_t DynConfig; /*!< Dynamic Configuration value */
  207. } IP_EMC_DYN_DEVICE_CONFIG_Type;
  208. /**
  209. * @brief EMC Dynamic Configure Struct
  210. */
  211. typedef struct {
  212. int32_t RefreshPeriod; /*!< Refresh period */
  213. uint32_t ReadConfig; /*!< Clock*/
  214. int32_t tRP; /*!< Precharge Command Period */
  215. int32_t tRAS; /*!< Active to Precharge Command Period */
  216. int32_t tSREX; /*!< Self Refresh Exit Time */
  217. int32_t tAPR; /*!< Last Data Out to Active Time */
  218. int32_t tDAL; /*!< Data In to Active Command Time */
  219. int32_t tWR; /*!< Write Recovery Time */
  220. int32_t tRC; /*!< Active to Active Command Period */
  221. int32_t tRFC; /*!< Auto-refresh Period */
  222. int32_t tXSR; /*!< Exit Selt Refresh */
  223. int32_t tRRD; /*!< Active Bank A to Active Bank B Time */
  224. int32_t tMRD; /*!< Load Mode register command to Active Command */
  225. IP_EMC_DYN_DEVICE_CONFIG_Type DevConfig[4]; /*!< Device Configuration array */
  226. } IP_EMC_DYN_CONFIG_Type;
  227. /**
  228. * @brief EMC Static Configure Structure
  229. */
  230. typedef struct {
  231. uint8_t ChipSelect; /*!< Chip select */
  232. uint32_t Config; /*!< Configuration value */
  233. int32_t WaitWen; /*!< Write Enable Wait */
  234. int32_t WaitOen; /*!< Output Enable Wait */
  235. int32_t WaitRd; /*!< Read Wait */
  236. int32_t WaitPage; /*!< Page Access Wait */
  237. int32_t WaitWr; /*!< Write Wait */
  238. int32_t WaitTurn; /*!< Turn around wait */
  239. } IP_EMC_STATIC_CONFIG_Type;
  240. /**
  241. * @brief Initializes the Dynamic Controller
  242. * @param pEMC : Pointer to EMC peripheral
  243. * @param Dynamic_Config : Dynamic Memory Configure Struct
  244. * @param EMC_Clock : Frequency of EMC Clock Out
  245. * @return None
  246. * Initializes the Dynamic Controller according to the specified parameters
  247. * in the IP_EMC_DYN_CONFIG_Type
  248. */
  249. void IP_EMC_Dynamic_Init(IP_EMC_001_Type *pEMC, IP_EMC_DYN_CONFIG_Type *Dynamic_Config, uint32_t EMC_Clock);
  250. /**
  251. * @brief Set Deep Sleep Mode for Dynamic Memory Controller
  252. * @param pEMC : Pointer to EMC peripheral
  253. * @param Enable : 1 = enter DeepSleep Mode, 0 = Normal Mode
  254. * @return None
  255. */
  256. void IP_EMC_Dynamic_DeepSleepMode(IP_EMC_001_Type *pEMC, uint32_t Enable);
  257. /**
  258. * @brief Enable Dynamic Memory Controller
  259. * @param pEMC : Pointer to EMC peripheral
  260. * @param Enable : 1 = Enable Dynamic Memory Controller, 0 = Disable
  261. * @return None
  262. */
  263. void IP_EMC_Dynamic_Enable(IP_EMC_001_Type *pEMC, uint8_t Enable);
  264. /**
  265. * @brief Initializes the Static Controller according to the specified
  266. * parameters in the IP_EMC_STATIC_CONFIG_Type
  267. * @param pEMC : Pointer to EMC peripheral
  268. * @param Static_Config : Static Memory Configure Struct
  269. * @param EMC_Clock : Frequency of EMC Clock Out
  270. * @return None
  271. */
  272. void IP_EMC_Static_Init(IP_EMC_001_Type *pEMC, IP_EMC_STATIC_CONFIG_Type *Static_Config, uint32_t EMC_Clock);
  273. /**
  274. * @brief Mirror CS1 to CS0 and DYCS0
  275. * @param pEMC : Pointer to EMC peripheral
  276. * @param Enable : 1 = Mirror, 0 = Normal Memory Map
  277. * @return None
  278. */
  279. void IP_EMC_Mirror(IP_EMC_001_Type *pEMC, uint32_t Enable);
  280. /**
  281. * @brief Enable EMC
  282. * @param pEMC : Pointer to EMC peripheral
  283. * @param Enable : 1 = Enable, 0 = Disable
  284. * @return None
  285. */
  286. void IP_EMC_Enable(IP_EMC_001_Type *pEMC, uint32_t Enable);
  287. /**
  288. * @brief Set EMC LowPower Mode
  289. * @param pEMC : Pointer to EMC peripheral
  290. * @param Enable : 1 = Enable, 0 = Disable
  291. * @return None
  292. */
  293. void IP_EMC_LowPowerMode(IP_EMC_001_Type *pEMC, uint32_t Enable);
  294. /**
  295. * @brief Initialize EMC
  296. * @param pEMC : Pointer to EMC peripheral
  297. * @param Enable : 1 = Enable, 0 = Disable
  298. * @param ClockRatio : clock out ratio, 0 = 1:1, 1 = 1:2
  299. * @param EndianMode : Endian Mode, 0 = Little, 1 = Big
  300. * @return None
  301. */
  302. void IP_EMC_Init(IP_EMC_001_Type *pEMC, uint32_t Enable, uint32_t ClockRatio, uint32_t EndianMode);
  303. /**
  304. * @brief Set Static Memory Extended Wait in Clock
  305. * @param pEMC : Pointer to EMC peripheral
  306. * @param Wait16Clks : Number of '16 clock' delay cycles
  307. * @return None
  308. */
  309. void IP_EMC_SetStaticExtendedWait(IP_EMC_001_Type *pEMC, uint32_t Wait16Clks);
  310. /**
  311. * @}
  312. */
  313. #ifdef __cplusplus
  314. }
  315. #endif
  316. #endif /* __EMC_001_H_ */