1 /**************************************************************************//** 2 * @file ebi_reg.h 3 * @version V1.00 4 * @brief EBI register definition header file 5 * 6 * SPDX-License-Identifier: Apache-2.0 7 * @copyright (C) 2018 Nuvoton Technology Corp. All rights reserved. 8 *****************************************************************************/ 9 #ifndef __EBI_REG_H__ 10 #define __EBI_REG_H__ 11 12 #if defined ( __CC_ARM ) 13 #pragma anon_unions 14 #endif 15 16 /** 17 @addtogroup REGISTER Control Register 18 @{ 19 */ 20 21 /** 22 @addtogroup EBI External Bus Interface Controller(EBI) 23 Memory Mapped Structure for EBI Controller 24 @{ */ 25 26 typedef struct 27 { 28 29 30 /** 31 * @var EBI_T::CTL0 32 * Offset: 0x00 External Bus Interface Bank0 Control Register 33 * --------------------------------------------------------------------------------------------------- 34 * |Bits |Field |Descriptions 35 * | :----: | :----: | :---- | 36 * |[0] |EN |EBI Enable Bit 37 * | | |This bit is the functional enable bit for EBI. 38 * | | |0 = EBI function Disabled. 39 * | | |1 = EBI function Enabled. 40 * |[1] |DW16 |EBI Data Width 16-bit Select 41 * | | |This bit defines if the EBI data width is 8-bit or 16-bit. 42 * | | |0 = EBI data width is 8-bit. 43 * | | |1 = EBI data width is 16-bit. 44 * |[2] |CSPOLINV |Chip Select Pin Polar Inverse 45 * | | |This bit defines the active level of EBI chip select pin (EBI_nCS). 46 * | | |0 = Chip select pin (EBI_nCS) is active low. 47 * | | |1 = Chip select pin (EBI_nCS) is active high. 48 * |[3] |ADSEPEN |EBI Address/Data Bus Separate Mode Enable Bit 49 * | | |0 = Address/Data Bus Separate Mode Disabled. 50 * | | |1 = Address/Data Bus Separate Mode Enabled. 51 * |[4] |CACCESS |Continuous Data Access Mode 52 * | | |When continuous access mode enabled, the tASU, tALE and tLHD cycles are bypass for continuous data transfer request. 53 * | | |0 = Continuous data access mode Disabled. 54 * | | |1 = Continuous data access mode Enabled. 55 * |[10:8] |MCLKDIV |External Output Clock Divider 56 * | | |The frequency of EBI output clock (MCLK) is controlled by MCLKDIV as follow: 57 * | | |000 = HCLK/1. 58 * | | |001 = HCLK/2. 59 * | | |010 = HCLK/4. 60 * | | |011 = HCLK/8. 61 * | | |100 = HCLK/16. 62 * | | |101 = HCLK/32. 63 * | | |110 = HCLK/64. 64 * | | |111 = HCLK/128. 65 * |[18:16] |TALE |Extend Time of ALE 66 * | | |The EBI_ALE high pulse period (tALE) to latch the address can be controlled by TALE. 67 * | | |tALE = (TALE + 1) * EBI_MCLK. 68 * | | |Note: This field is only available in EBI_CTL0 register. 69 * |[24] |WBUFEN |EBI Write Buffer Enable Bit 70 * | | |0 = EBI write buffer Disabled. 71 * | | |1 = EBI write buffer Enabled. 72 * | | |Note: This bit is only available in EBI_CTL0 register. 73 * @var EBI_T::TCTL0 74 * Offset: 0x04 External Bus Interface Bank0 Timing Control Register 75 * --------------------------------------------------------------------------------------------------- 76 * |Bits |Field |Descriptions 77 * | :----: | :----: | :---- | 78 * |[7:3] |TACC |EBI Data Access Time 79 * | | |TACC defines data access time (tACC). 80 * | | |tACC = (TACC + 1) * EBI_MCLK. 81 * |[10:8] |TAHD |EBI Data Access Hold Time 82 * | | |TAHD defines data access hold time (tAHD). 83 * | | |tAHD = (TAHD + 1) * EBI_MCLK. 84 * |[15:12] |W2X |Idle Cycle After Write 85 * | | |This field defines the number of W2X idle cycle. 86 * | | |W2X idle cycle = (W2X * EBI_MCLK). 87 * | | |When write action is finished, W2X idle cycle is inserted and EBI_nCS return to idle state. 88 * |[22] |RAHDOFF |Access Hold Time Disable Control When Read 89 * | | |0 = Data Access Hold Time (tAHD) during EBI reading Enabled. 90 * | | |1 = Data Access Hold Time (tAHD) during EBI reading Disabled. 91 * |[23] |WAHDOFF |Access Hold Time Disable Control When Write 92 * | | |0 = Data Access Hold Time (tAHD) during EBI writing Enabled. 93 * | | |1 = Data Access Hold Time (tAHD) during EBI writing Disabled. 94 * |[27:24] |R2R |Idle Cycle Between Read-to-read 95 * | | |This field defines the number of R2R idle cycle. 96 * | | |R2R idle cycle = (R2R * EBI_MCLK). 97 * | | |When read action is finished and the next action is going to read, R2R idle cycle is inserted and EBI_nCS return to idle state. 98 * @var EBI_T::CTL1 99 * Offset: 0x10 External Bus Interface Bank1 Control Register 100 * --------------------------------------------------------------------------------------------------- 101 * |Bits |Field |Descriptions 102 * | :----: | :----: | :---- | 103 * |[0] |EN |EBI Enable Bit 104 * | | |This bit is the functional enable bit for EBI. 105 * | | |0 = EBI function Disabled. 106 * | | |1 = EBI function Enabled. 107 * |[1] |DW16 |EBI Data Width 16-bit Select 108 * | | |This bit defines if the EBI data width is 8-bit or 16-bit. 109 * | | |0 = EBI data width is 8-bit. 110 * | | |1 = EBI data width is 16-bit. 111 * |[2] |CSPOLINV |Chip Select Pin Polar Inverse 112 * | | |This bit defines the active level of EBI chip select pin (EBI_nCS). 113 * | | |0 = Chip select pin (EBI_nCS) is active low. 114 * | | |1 = Chip select pin (EBI_nCS) is active high. 115 * |[3] |ADSEPEN |EBI Address/Data Bus Separate Mode Enable Bit 116 * | | |0 = Address/Data Bus Separate Mode Disabled. 117 * | | |1 = Address/Data Bus Separate Mode Enabled. 118 * |[4] |CACCESS |Continuous Data Access Mode 119 * | | |When continuous access mode enabled, the tASU, tALE and tLHD cycles are bypass for continuous data transfer request. 120 * | | |0 = Continuous data access mode Disabled. 121 * | | |1 = Continuous data access mode Enabled. 122 * |[10:8] |MCLKDIV |External Output Clock Divider 123 * | | |The frequency of EBI output clock (MCLK) is controlled by MCLKDIV as follow: 124 * | | |000 = HCLK/1. 125 * | | |001 = HCLK/2. 126 * | | |010 = HCLK/4. 127 * | | |011 = HCLK/8. 128 * | | |100 = HCLK/16. 129 * | | |101 = HCLK/32. 130 * | | |110 = HCLK/64. 131 * | | |111 = HCLK/128. 132 * |[18:16] |TALE |Extend Time of ALE 133 * | | |The EBI_ALE high pulse period (tALE) to latch the address can be controlled by TALE. 134 * | | |tALE = (TALE + 1) * EBI_MCLK. 135 * | | |Note: This field is only available in EBI_CTL0 register. 136 * |[24] |WBUFEN |EBI Write Buffer Enable Bit 137 * | | |0 = EBI write buffer Disabled. 138 * | | |1 = EBI write buffer Enabled. 139 * | | |Note: This bit is only available in EBI_CTL0 register. 140 * @var EBI_T::TCTL1 141 * Offset: 0x14 External Bus Interface Bank1 Timing Control Register 142 * --------------------------------------------------------------------------------------------------- 143 * |Bits |Field |Descriptions 144 * | :----: | :----: | :---- | 145 * |[7:3] |TACC |EBI Data Access Time 146 * | | |TACC defines data access time (tACC). 147 * | | |tACC = (TACC + 1) * EBI_MCLK. 148 * |[10:8] |TAHD |EBI Data Access Hold Time 149 * | | |TAHD defines data access hold time (tAHD). 150 * | | |tAHD = (TAHD + 1) * EBI_MCLK. 151 * |[15:12] |W2X |Idle Cycle After Write 152 * | | |This field defines the number of W2X idle cycle. 153 * | | |W2X idle cycle = (W2X * EBI_MCLK). 154 * | | |When write action is finished, W2X idle cycle is inserted and EBI_nCS return to idle state. 155 * |[22] |RAHDOFF |Access Hold Time Disable Control When Read 156 * | | |0 = Data Access Hold Time (tAHD) during EBI reading Enabled. 157 * | | |1 = Data Access Hold Time (tAHD) during EBI reading Disabled. 158 * |[23] |WAHDOFF |Access Hold Time Disable Control When Write 159 * | | |0 = Data Access Hold Time (tAHD) during EBI writing Enabled. 160 * | | |1 = Data Access Hold Time (tAHD) during EBI writing Disabled. 161 * |[27:24] |R2R |Idle Cycle Between Read-to-read 162 * | | |This field defines the number of R2R idle cycle. 163 * | | |R2R idle cycle = (R2R * EBI_MCLK). 164 * | | |When read action is finished and the next action is going to read, R2R idle cycle is inserted and EBI_nCS return to idle state. 165 * @var EBI_T::CTL2 166 * Offset: 0x20 External Bus Interface Bank2 Control Register 167 * --------------------------------------------------------------------------------------------------- 168 * |Bits |Field |Descriptions 169 * | :----: | :----: | :---- | 170 * |[0] |EN |EBI Enable Bit 171 * | | |This bit is the functional enable bit for EBI. 172 * | | |0 = EBI function Disabled. 173 * | | |1 = EBI function Enabled. 174 * |[1] |DW16 |EBI Data Width 16-bit Select 175 * | | |This bit defines if the EBI data width is 8-bit or 16-bit. 176 * | | |0 = EBI data width is 8-bit. 177 * | | |1 = EBI data width is 16-bit. 178 * |[2] |CSPOLINV |Chip Select Pin Polar Inverse 179 * | | |This bit defines the active level of EBI chip select pin (EBI_nCS). 180 * | | |0 = Chip select pin (EBI_nCS) is active low. 181 * | | |1 = Chip select pin (EBI_nCS) is active high. 182 * |[3] |ADSEPEN |EBI Address/Data Bus Separate Mode Enable Bit 183 * | | |0 = Address/Data Bus Separate Mode Disabled. 184 * | | |1 = Address/Data Bus Separate Mode Enabled. 185 * |[4] |CACCESS |Continuous Data Access Mode 186 * | | |When continuous access mode enabled, the tASU, tALE and tLHD cycles are bypass for continuous data transfer request. 187 * | | |0 = Continuous data access mode Disabled. 188 * | | |1 = Continuous data access mode Enabled. 189 * |[10:8] |MCLKDIV |External Output Clock Divider 190 * | | |The frequency of EBI output clock (MCLK) is controlled by MCLKDIV as follow: 191 * | | |000 = HCLK/1. 192 * | | |001 = HCLK/2. 193 * | | |010 = HCLK/4. 194 * | | |011 = HCLK/8. 195 * | | |100 = HCLK/16. 196 * | | |101 = HCLK/32. 197 * | | |110 = HCLK/64. 198 * | | |111 = HCLK/128. 199 * |[18:16] |TALE |Extend Time of ALE 200 * | | |The EBI_ALE high pulse period (tALE) to latch the address can be controlled by TALE. 201 * | | |tALE = (TALE + 1) * EBI_MCLK. 202 * | | |Note: This field is only available in EBI_CTL0 register. 203 * |[24] |WBUFEN |EBI Write Buffer Enable Bit 204 * | | |0 = EBI write buffer Disabled. 205 * | | |1 = EBI write buffer Enabled. 206 * | | |Note: This bit is only available in EBI_CTL0 register. 207 * @var EBI_T::TCTL2 208 * Offset: 0x24 External Bus Interface Bank2 Timing Control Register 209 * --------------------------------------------------------------------------------------------------- 210 * |Bits |Field |Descriptions 211 * | :----: | :----: | :---- | 212 * |[7:3] |TACC |EBI Data Access Time 213 * | | |TACC defines data access time (tACC). 214 * | | |tACC = (TACC + 1) * EBI_MCLK. 215 * |[10:8] |TAHD |EBI Data Access Hold Time 216 * | | |TAHD defines data access hold time (tAHD). 217 * | | |tAHD = (TAHD + 1) * EBI_MCLK. 218 * |[15:12] |W2X |Idle Cycle After Write 219 * | | |This field defines the number of W2X idle cycle. 220 * | | |W2X idle cycle = (W2X * EBI_MCLK). 221 * | | |When write action is finished, W2X idle cycle is inserted and EBI_nCS return to idle state. 222 * |[22] |RAHDOFF |Access Hold Time Disable Control When Read 223 * | | |0 = Data Access Hold Time (tAHD) during EBI reading Enabled. 224 * | | |1 = Data Access Hold Time (tAHD) during EBI reading Disabled. 225 * |[23] |WAHDOFF |Access Hold Time Disable Control When Write 226 * | | |0 = Data Access Hold Time (tAHD) during EBI writing Enabled. 227 * | | |1 = Data Access Hold Time (tAHD) during EBI writing Disabled. 228 * |[27:24] |R2R |Idle Cycle Between Read-to-read 229 * | | |This field defines the number of R2R idle cycle. 230 * | | |R2R idle cycle = (R2R * EBI_MCLK). 231 * | | |When read action is finished and the next action is going to read, R2R idle cycle is inserted and EBI_nCS return to idle state. 232 */ 233 __IO uint32_t CTL0; /*!< [0x0000] External Bus Interface Bank0 Control Register */ 234 __IO uint32_t TCTL0; /*!< [0x0004] External Bus Interface Bank0 Timing Control Register */ 235 __I uint32_t RESERVE0[2]; 236 __IO uint32_t CTL1; /*!< [0x0010] External Bus Interface Bank1 Control Register */ 237 __IO uint32_t TCTL1; /*!< [0x0014] External Bus Interface Bank1 Timing Control Register */ 238 __I uint32_t RESERVE1[2]; 239 __IO uint32_t CTL2; /*!< [0x0020] External Bus Interface Bank2 Control Register */ 240 __IO uint32_t TCTL2; /*!< [0x0024] External Bus Interface Bank2 Timing Control Register */ 241 242 } EBI_T; 243 244 /** 245 @addtogroup EBI_CONST EBI Bit Field Definition 246 Constant Definitions for EBI Controller 247 @{ */ 248 249 #define EBI_CTL_EN_Pos (0) /*!< EBI_T::CTL0: EN Position */ 250 #define EBI_CTL_EN_Msk (0x1ul << EBI_CTL_EN_Pos) /*!< EBI_T::CTL0: EN Mask */ 251 252 #define EBI_CTL_DW16_Pos (1) /*!< EBI_T::CTL0: DW16 Position */ 253 #define EBI_CTL_DW16_Msk (0x1ul << EBI_CTL_DW16_Pos) /*!< EBI_T::CTL0: DW16 Mask */ 254 255 #define EBI_CTL_CSPOLINV_Pos (2) /*!< EBI_T::CTL0: CSPOLINV Position */ 256 #define EBI_CTL_CSPOLINV_Msk (0x1ul << EBI_CTL_CSPOLINV_Pos) /*!< EBI_T::CTL0: CSPOLINV Mask */ 257 258 #define EBI_CTL_ADSEPEN_Pos (3) /*!< EBI_T::CTL0: ADSEPEN Position */ 259 #define EBI_CTL_ADSEPEN_Msk (0x1ul << EBI_CTL_ADSEPEN_Pos) /*!< EBI_T::CTL0: ADSEPEN Mask */ 260 261 #define EBI_CTL_CACCESS_Pos (4) /*!< EBI_T::CTL0: CACCESS Position */ 262 #define EBI_CTL_CACCESS_Msk (0x1ul << EBI_CTL_CACCESS_Pos) /*!< EBI_T::CTL0: CACCESS Mask */ 263 264 #define EBI_CTL_MCLKDIV_Pos (8) /*!< EBI_T::CTL0: MCLKDIV Position */ 265 #define EBI_CTL_MCLKDIV_Msk (0x7ul << EBI_CTL_MCLKDIV_Pos) /*!< EBI_T::CTL0: MCLKDIV Mask */ 266 267 #define EBI_CTL_TALE_Pos (16) /*!< EBI_T::CTL0: TALE Position */ 268 #define EBI_CTL_TALE_Msk (0x7ul << EBI_CTL_TALE_Pos) /*!< EBI_T::CTL0: TALE Mask */ 269 270 #define EBI_CTL_WBUFEN_Pos (24) /*!< EBI_T::CTL0: WBUFEN Position */ 271 #define EBI_CTL_WBUFEN_Msk (0x1ul << EBI_CTL_WBUFEN_Pos) /*!< EBI_T::CTL0: WBUFEN Mask */ 272 273 #define EBI_TCTL_TACC_Pos (3) /*!< EBI_T::TCTL0: TACC Position */ 274 #define EBI_TCTL_TACC_Msk (0x1ful << EBI_TCTL_TACC_Pos) /*!< EBI_T::TCTL0: TACC Mask */ 275 276 #define EBI_TCTL_TAHD_Pos (8) /*!< EBI_T::TCTL0: TAHD Position */ 277 #define EBI_TCTL_TAHD_Msk (0x7ul << EBI_TCTL_TAHD_Pos) /*!< EBI_T::TCTL0: TAHD Mask */ 278 279 #define EBI_TCTL_W2X_Pos (12) /*!< EBI_T::TCTL0: W2X Position */ 280 #define EBI_TCTL_W2X_Msk (0xful << EBI_TCTL_W2X_Pos) /*!< EBI_T::TCTL0: W2X Mask */ 281 282 #define EBI_TCTL_RAHDOFF_Pos (22) /*!< EBI_T::TCTL0: RAHDOFF Position */ 283 #define EBI_TCTL_RAHDOFF_Msk (0x1ul << EBI_TCTL_RAHDOFF_Pos) /*!< EBI_T::TCTL0: RAHDOFF Mask */ 284 285 #define EBI_TCTL_WAHDOFF_Pos (23) /*!< EBI_T::TCTL0: WAHDOFF Position */ 286 #define EBI_TCTL_WAHDOFF_Msk (0x1ul << EBI_TCTL_WAHDOFF_Pos) /*!< EBI_T::TCTL0: WAHDOFF Mask */ 287 288 #define EBI_TCTL_R2R_Pos (24) /*!< EBI_T::TCTL0: R2R Position */ 289 #define EBI_TCTL_R2R_Msk (0xful << EBI_TCTL_R2R_Pos) /*!< EBI_T::TCTL0: R2R Mask */ 290 291 /**@}*/ /* EBI_CONST */ 292 /**@}*/ /* end of EBI register group */ 293 /**@}*/ /* end of REGISTER group */ 294 295 #if defined ( __CC_ARM ) 296 #pragma no_anon_unions 297 #endif 298 299 #endif /* __EBI_REG_H__ */ 300