dvk_bcregisters.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  1. /**************************************************************************//**
  2. * @file
  3. * @brief Board Control register definitions
  4. * @author Energy Micro AS
  5. * @version 2.0.1
  6. ******************************************************************************
  7. * @section License
  8. * <b>(C) Copyright 2012 Energy Micro AS, http://www.energymicro.com</b>
  9. *******************************************************************************
  10. *
  11. * Permission is granted to anyone to use this software for any purpose,
  12. * including commercial applications, and to alter it and redistribute it
  13. * freely, subject to the following restrictions:
  14. *
  15. * 1. The origin of this software must not be misrepresented; you must not
  16. * claim that you wrote the original software.
  17. * 2. Altered source versions must be plainly marked as such, and must not be
  18. * misrepresented as being the original software.
  19. * 3. This notice may not be removed or altered from any source distribution.
  20. * 4. The source and compiled code may only be used on Energy Micro "EFM32"
  21. * microcontrollers and "EFR4" radios.
  22. *
  23. * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Energy Micro AS has no
  24. * obligation to support this Software. Energy Micro AS is providing the
  25. * Software "AS IS", with no express or implied warranties of any kind,
  26. * including, but not limited to, any implied warranties of merchantability
  27. * or fitness for any particular purpose or warranties against infringement
  28. * of any proprietary rights of a third party.
  29. *
  30. * Energy Micro AS will not be liable for any consequential, incidental, or
  31. * special damages, or any other relief, or for any claim by any third party,
  32. * arising from your use of this Software.
  33. *
  34. *****************************************************************************/
  35. #ifndef __DVK_BCREGISTERS_H
  36. #define __DVK_BCREGISTERS_H
  37. /***************************************************************************//**
  38. * @addtogroup BSP
  39. * @{
  40. ******************************************************************************/
  41. #include <stdint.h>
  42. #ifdef __cplusplus
  43. extern "C" {
  44. #endif
  45. /**************************************************************************//**
  46. * Defines FPGA register bank for Energy Micro Development Kit (DVK) board,
  47. * i.e. board control registers
  48. *****************************************************************************/
  49. #define BC_REGISTER_BASE 0x80000000 /**< Board Controller registers base address */
  50. #define BC_SSD2119_BASE 0x84000000 /**< TFT-LCD controller */
  51. #define BC_PSRAM_BASE 0x88000000 /**< PSRAM base address */
  52. #define BC_FLASH_BASE 0x8C000000 /**< External Flash base address */
  53. /**************************************************************************//**
  54. * Defines bit fields for board control registers
  55. *****************************************************************************/
  56. /* Define registers in a similar manner to CMSIS standards */
  57. /** Read/Write board controller register */
  58. #define __IO volatile
  59. /** Board Controller Register definiton */
  60. typedef struct
  61. {
  62. __IO uint16_t RESERVERD0; /**< 0x00 - Reserved */
  63. __IO uint16_t EM; /**< 0x02 - Energy Mode indicator */
  64. __IO uint16_t MAGIC; /**< 0x04 - Should always read 0xEF32 */
  65. __IO uint16_t UIF_LEDS; /**< 0x06 - On board LEDs */
  66. __IO uint16_t UIF_PB; /**< 0x08 - Push button PB0-PB4 status */
  67. __IO uint16_t UIF_DIP; /**< 0x0A - DIP switch status */
  68. __IO uint16_t UIF_JOYSTICK; /**< 0x0C - Joystick presses */
  69. __IO uint16_t UIF_AEM; /**< 0x0E - AEM button */
  70. __IO uint16_t UIF_CTRL; /**< 0x10 - CPLD control register */
  71. __IO uint16_t DISPLAY_CTRL; /**< 0x12 - SSD2119 TFT display control */
  72. __IO uint16_t EBI_CTRL; /**< 0x14 - Extended Address Mode control */
  73. __IO uint16_t ARB_CTRL; /**< 0x16 - Arbiter control, board control or EFM32GG access to display */
  74. __IO uint16_t PERICON; /**< 0x18 - Peripheral Control, on board switches */
  75. __IO uint16_t SPI_DEMUX; /**< 0x1A - SPI DEMUX */
  76. __IO uint16_t RESERVERD1[0x02]; /**< 0x1C - Reserved */
  77. __IO uint16_t ADC_WRITE; /**< 0x20 - AEM ADC SPI interface */
  78. __IO uint16_t ADC_STATUS; /**< 0x22 - AEM ADC SPI interface */
  79. __IO uint16_t ADC_READ; /**< 0x24 - AEM ADC SPI interface */
  80. __IO uint16_t CLKRST; /**< 0x26 - Clock and reset control */
  81. __IO uint16_t HW_VERSION; /**< 0x28 - Hardware version */
  82. __IO uint16_t FW_BUILDNO; /**< 0x2A - Firmware build number */
  83. __IO uint16_t FW_VERSION; /**< 0x2C - Firmware version */
  84. __IO uint16_t SCRATCH_COMMON; /**< 0x2E - Shared register between board controller and EFM32 */
  85. __IO uint16_t SCRATCH_EFM0; /**< 0x30 - EFM32 accessible registers */
  86. __IO uint16_t SCRATCH_EFM1; /**< 0x32 */
  87. __IO uint16_t SCRATCH_EFM2; /**< 0x34 */
  88. __IO uint16_t SCRATCH_EFM3; /**< 0x36 */
  89. __IO uint16_t SCRATCH_BC0; /**< 0x38 - Board Control registers */
  90. __IO uint16_t SCRATCH_BC1; /**< 0x3A */
  91. __IO uint16_t SCRATCH_BC2; /**< 0x3C */
  92. __IO uint16_t SCRATCH_BC3; /**< 0x3E */
  93. __IO uint16_t INTFLAG; /**< 0x40 - Interrupt Status flags */
  94. __IO uint16_t INTEN; /**< 0x42 - Interrupt Enable flags */
  95. __IO uint16_t RESERVERD3[0x1e]; /**< 0x44 - Reserved */
  96. __IO uint16_t BC_MBOX_TXCTRL; /**< 0x80 - BC <-> EFM32 communication channel */
  97. __IO uint16_t BC_MBOX_TXDATA; /**< 0x82 */
  98. __IO uint16_t BC_MBOX_TXSTATUS0; /**< 0x84 */
  99. __IO uint16_t BC_MBOX_TXSTATUS1; /**< 0x86 */
  100. __IO uint16_t RESERVED4[0x0d]; /**< 0xa0 - Reserved */
  101. __IO uint16_t MBOX_TXCTRL; /**< 0xa2 - BC <-> EFM32 communication channel */
  102. __IO uint16_t MBOX_TXDATA; /**< 0xa4 */
  103. __IO uint16_t MBOX_TXSTATUS0; /**< 0xa6 */
  104. __IO uint16_t MBOX_TXSTATUS1; /**< 0xa8 */
  105. __IO uint16_t RESERVED5[0x0b]; /**< 0xaa - Reserved */
  106. __IO uint16_t BUF_CTRL; /**< 0xc0 - Buffer Controller Control */
  107. } BC_TypeDef;
  108. /* Cast into register structure */
  109. #define BC_REGISTER ((BC_TypeDef *) BC_REGISTER_BASE) /**< Register block base */
  110. /* Energy Mode indicator */
  111. #define BC_EM_EM0 (0) /**< Indicate EM0 */
  112. #define BC_EM_EM1 (1) /**< Indicate EM1 */
  113. #define BC_EM_EM2 (2) /**< Indicate EM2 */
  114. #define BC_EM_EM3 (3) /**< Indicate EM3 */
  115. #define BC_EM_EM4 (4) /**< Indicate EM4 */
  116. /* Magic value */
  117. #define BC_MAGIC_VALUE (0xef32) /**< Magic */
  118. /* Push buttons, PB1-PB4 */
  119. #define BC_UIF_PB_MASK (0x000f) /**< Push button mask */
  120. #define BC_UIF_PB1 (1 << 0) /**< Push button PB1 */
  121. #define BC_UIF_PB2 (1 << 1) /**< Push button PB2 */
  122. #define BC_UIF_PB3 (1 << 2) /**< Push button PB3 */
  123. #define BC_UIF_PB4 (1 << 3) /**< Push button PB4 */
  124. /* Dip switch */
  125. #define BC_DIPSWITCH_MASK (0x000f) /**< Dip switch mask */
  126. /* Joystick directions */
  127. #define BC_UIF_JOYSTICK_MASK (0x001f) /**< Joystick mask */
  128. #define BC_UIF_JOYSTICK_DOWN (1 << 0) /**< Joystick down */
  129. #define BC_UIF_JOYSTICK_RIGHT (1 << 1) /**< Joystick right */
  130. #define BC_UIF_JOYSTICK_UP (1 << 2) /**< Joystick up */
  131. #define BC_UIF_JOYSTICK_LEFT (1 << 3) /**< Joystick left */
  132. #define BC_UIF_JOYSTICK_CENTER (1 << 4) /**< Joystick center button */
  133. /* AEM state */
  134. #define BC_UIF_AEM_BC (0) /**< AEM button state, BC controls buttons */
  135. #define BC_UIF_AEM_EFM (1) /**< AEM button state, EFM32 controls buttons */
  136. /* Display control */
  137. #define BC_DISPLAY_CTRL_RESET (1 << 1) /**< Reset */
  138. #define BC_DISPLAY_CTRL_POWER_ENABLE (1 << 0) /**< Display Control Power and Backlight Enable */
  139. #define BC_DISPLAY_CTRL_MODE_SHIFT 2 /**< Bit offset value for Display_Mode setting */
  140. #define BC_DISPLAY_CTRL_MODE_8080 (0 << BC_DISPLAY_CTRL_MODE_SHIFT) /**< Address mapped mode */
  141. #define BC_DISPLAY_CTRL_MODE_GENERIC (1 << BC_DISPLAY_CTRL_MODE_SHIFT) /**< Direct Drive + SPI mode */
  142. /* EBI control - extended address range enable bit */
  143. #define BC_EBI_CTRL_EXTADDR_MASK (0x0001) /**< Enable extended addressing support */
  144. /* Arbiter control - directs access to display controller */
  145. #define BC_ARB_CTRL_SHIFT 0 /**< Bit offset value for ARB_CTRL setting */
  146. #define BC_ARB_CTRL_BC (0 << BC_ARB_CTRL_SHIFT) /**< BC drives display */
  147. #define BC_ARB_CTRL_EBI (1 << BC_ARB_CTRL_SHIFT) /**< EFM32GG EBI drives display, memory mapped or direct drive */
  148. #define BC_ARB_CTRL_SPI (2 << BC_ARB_CTRL_SHIFT) /**< EFM32GG SPI drives display */
  149. /* Interrupt flag registers, INTEN and INTFLAG */
  150. #define BC_INTEN_MASK (0x000f) /**< Interrupt enable mask */
  151. #define BC_INTEN_PB (1 << 0) /**< Push Button Interrupt enable */
  152. #define BC_INTEN_DIP (1 << 1) /**< DIP Switch Interrupt enable */
  153. #define BC_INTEN_JOYSTICK (1 << 2) /**< Joystick Interrupt enable */
  154. #define BC_INTEN_AEM (1 << 3) /**< AEM Interrupt enable */
  155. #define BC_INTEN_ETH (1 << 4) /**< Ethernet Interrupt enable */
  156. #define BC_INTFLAG_MASK (0x000f) /**< Interrupt flag mask */
  157. #define BC_INTFLAG_PB (1 << 0) /**< Push Button interrupt triggered */
  158. #define BC_INTFLAG_DIP (1 << 1) /**< DIP interrupt triggered */
  159. #define BC_INTFLAG_JOYSTICK (1 << 2) /**< Joystick interrupt triggered */
  160. #define BC_INTFLAG_AEM (1 << 3) /**< AEM Interrupt triggered */
  161. #define BC_INTFLAG_ETH (1 << 4) /**< Ethernet Interrupt triggered */
  162. /* Peripheral control registers */
  163. #define BC_PERICON_RS232_SHUTDOWN_SHIFT 13 /**< RS232 enable MUX bit */
  164. #define BC_PERICON_RS232_UART_SHIFT 12 /**< UART enable */
  165. #define BC_PERICON_RS232_LEUART_SHIFT 11 /**< LEUART enable */
  166. #define BC_PERICON_I2C_SHIFT 10 /**< I2C enable */
  167. #define BC_PERICON_I2S_ETH_SEL_SHIFT 9 /**< I2S/ETH/TFT SPI enable */
  168. #define BC_PERICON_I2S_ETH_SHIFT 8 /**< I2S/ETH mux select */
  169. #define BC_PERICON_TRACE_SHIFT 7 /**< ETM Trace enable */
  170. #define BC_PERICON_TOUCH_SHIFT 6 /**< Touch enable */
  171. #define BC_PERICON_AUDIO_IN_SHIFT 5 /**< Audio In enable */
  172. #define BC_PERICON_AUDIO_OUT_SEL_SHIFT 4 /**< Audio Out I2S/DAC select */
  173. #define BC_PERICON_AUDIO_OUT_SHIFT 3 /**< Audio Out enable */
  174. #define BC_PERICON_ANALOG_DIFF_SHIFT 2 /**< Analog Diff enable */
  175. #define BC_PERICON_ANALOG_SE_SHIFT 1 /**< Anallog SE enable */
  176. #define BC_PERICON_SPI_SHIFT 0 /**< Micro-SD SPI enable */
  177. /* SPI DEMUX control */
  178. #define BC_SPI_DEMUX_SLAVE_MASK (0x0003) /**< Mask for SPI MUX bits */
  179. #define BC_SPI_DEMUX_SLAVE_AUDIO (0) /**< SPI interface to I2S Audio */
  180. #define BC_SPI_DEMUX_SLAVE_ETHERNET (1) /**< SPI interface to Ethernet controller */
  181. #define BC_SPI_DEMUX_SLAVE_DISPLAY (2) /**< SPI interface to TFT-LCD-SSD2119 controller */
  182. /* ADC */
  183. #define BC_ADC_STATUS_DONE (0) /**< ADC Status Done */
  184. #define BC_ADC_STATUS_BUSY (1) /**< ADC Status Busy */
  185. /* Clock and Reset Control */
  186. #define BC_CLKRST_FLASH_SHIFT (1 << 1) /**< Flash Reset Control */
  187. #define BC_CLKRST_ETH_SHIFT (1 << 2) /**< Ethernet Reset Control */
  188. /* Hardware version information */
  189. #define BC_HW_VERSION_PCB_MASK (0x07f0) /**< PCB Version mask */
  190. #define BC_HW_VERSION_PCB_SHIFT (4) /**< PCB Version shift */
  191. #define BC_HW_VERSION_BOARD_MASK (0x000f) /**< Board version mask */
  192. #define BC_HW_VERSION_BOARD_SHIFT (0) /**< Board version shift */
  193. /* Firmware version information */
  194. #define BC_FW_VERSION_MAJOR_MASK (0xf000) /**< FW Version major mask */
  195. #define BC_FW_VERSION_MAJOR_SHIFT (12) /**< FW version major shift */
  196. #define BC_FW_VERSION_MINOR_MASK (0x0f00) /**< FW version minor mask */
  197. #define BC_FW_VERSION_MINOR_SHIFT (8) /**< FW version minor shift */
  198. #define BC_FW_VERSION_PATCHLEVEL_MASK (0x00ff) /**< FW Patchlevel mask */
  199. #define BC_FW_VERSION_PATCHLEVEL_SHIFT (0) /**< FW Patchlevel shift */
  200. /* MBOX - BC <-> EFM32 communication */
  201. #define BC_MBOX_TXSTATUS0_FIFOEMPTY (1 << 0) /**< BC/EFM32 communication register */
  202. #define BC_MBOX_TXSTATUS0_FIFOFULL (1 << 1) /**< BC/EFM32 communication register */
  203. #define BC_MBOX_TXSTATUS0_FIFOUNDERFLOW (1 << 4) /**< BC/EFM32 communication register */
  204. #define BC_MBOX_TXSTATUS0_FIFOOVERFLOW (1 << 5) /**< BC/EFM32 communication register */
  205. #define BC_MBOX_TXSTATUS1_WORDCOUNT_MASK (0x07FF) /**< BC/EFM32 communication register */
  206. /* Buffer Controller */
  207. #define BC_BUF_CTRL_CS_ENABLE (1 << 0) /**< BC/EFM32 communication register */
  208. #ifdef __cplusplus
  209. }
  210. #endif
  211. /** @} (end group BSP) */
  212. #endif