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 36 #ifndef __DVK_BCREGISTERS_H 37 #define __DVK_BCREGISTERS_H 38 39 /***************************************************************************//** 40 * @addtogroup BSP 41 * @{ 42 ******************************************************************************/ 43 44 #include <stdint.h> 45 46 /**************************************************************************//** 47 * Defines FPGA register bank for Energy Micro Development Kit (DVK) board, 48 * i.e. board control registers 49 *****************************************************************************/ 50 #define BC_FLASH_BASE 0x80000000 /**< FLASH memory base address */ 51 #define BC_SRAM_BASE 0x84000000 /**< SRAM base address */ 52 #define BC_SSD2119_BASE 0x88000000 /**< TFT Controller base address */ 53 #define BC_REGISTER_BASE 0x8c000000 /**< Board Controller registers base address */ 54 55 #define BC_CFG ((volatile uint16_t *)(BC_REGISTER_BASE + sizeof(uint16_t) * 0x00)) /**< CFG */ 56 #define BC_EM ((volatile uint16_t *)(BC_REGISTER_BASE + sizeof(uint16_t) * 0x01)) /**< EM */ 57 #define BC_MAGIC ((volatile uint16_t *)(BC_REGISTER_BASE + sizeof(uint16_t) * 0x02)) /**< MAGIC */ 58 #define BC_LED ((volatile uint16_t *)(BC_REGISTER_BASE + sizeof(uint16_t) * 0x03)) /**< LEDs */ 59 #define BC_PUSHBUTTON ((volatile uint16_t *)(BC_REGISTER_BASE + sizeof(uint16_t) * 0x04)) /**< Push Buttons */ 60 #define BC_DIPSWITCH ((volatile uint16_t *)(BC_REGISTER_BASE + sizeof(uint16_t) * 0x05)) /**< Dip switches */ 61 #define BC_JOYSTICK ((volatile uint16_t *)(BC_REGISTER_BASE + sizeof(uint16_t) * 0x06)) /**< Joystick */ 62 #define BC_AEM ((volatile uint16_t *)(BC_REGISTER_BASE + sizeof(uint16_t) * 0x07)) /**< AEM push button status */ 63 #define BC_DISPLAY_CTRL ((volatile uint16_t *)(BC_REGISTER_BASE + sizeof(uint16_t) * 0x08)) /**< Display Control */ 64 #define BC_EBI_CFG ((volatile uint16_t *)(BC_REGISTER_BASE + sizeof(uint16_t) * 0x09)) /**< EBI config */ 65 #define BC_BUS_CFG ((volatile uint16_t *)(BC_REGISTER_BASE + sizeof(uint16_t) * 0x0a)) /**< BUS config */ 66 #define BC_PERCTRL ((volatile uint16_t *)(BC_REGISTER_BASE + sizeof(uint16_t) * 0x0c)) /**< Peripheral Control */ 67 #define BC_AEMSTATE ((volatile uint16_t *)(BC_REGISTER_BASE + sizeof(uint16_t) * 0x0d)) /**< AEM state of push button switch */ 68 #define BC_SPI_CFG ((volatile uint16_t *)(BC_REGISTER_BASE + sizeof(uint16_t) * 0x0e)) /**< SPI config */ 69 #define BC_RESET ((volatile uint16_t *)(BC_REGISTER_BASE + sizeof(uint16_t) * 0x0f)) /**< Reset */ 70 #define BC_ADC_START ((volatile uint16_t *)(BC_REGISTER_BASE + sizeof(uint16_t) * 0x10)) /**< ADC start */ 71 #define BC_ADC_STATUS ((volatile uint16_t *)(BC_REGISTER_BASE + sizeof(uint16_t) * 0x11)) /**< ADC status */ 72 #define BC_ADC_DATA ((volatile uint16_t *)(BC_REGISTER_BASE + sizeof(uint16_t) * 0x12)) /**< ADC data */ 73 #define BC_HW_VERSION ((volatile uint16_t *)(BC_REGISTER_BASE + sizeof(uint16_t) * 0x14)) /**< HW version */ 74 #define BC_FW_BUILDNO ((volatile uint16_t *)(BC_REGISTER_BASE + sizeof(uint16_t) * 0x15)) /**< FW build number */ 75 #define BC_FW_VERSION ((volatile uint16_t *)(BC_REGISTER_BASE + sizeof(uint16_t) * 0x16)) /**< FW version */ 76 #define BC_SCRATCH_COMMON ((volatile uint16_t *)(BC_REGISTER_BASE + sizeof(uint16_t) * 0x17)) /**< Scratch common */ 77 #define BC_SCRATCH_EFM0 ((volatile uint16_t *)(BC_REGISTER_BASE + sizeof(uint16_t) * 0x18)) /**< Scratch EFM0 */ 78 #define BC_SCRATCH_EFM1 ((volatile uint16_t *)(BC_REGISTER_BASE + sizeof(uint16_t) * 0x19)) /**< Scratch EFM1 */ 79 #define BC_SCRATCH_EFM2 ((volatile uint16_t *)(BC_REGISTER_BASE + sizeof(uint16_t) * 0x1A)) /**< Scratch EFM2 */ 80 #define BC_SCRATCH_EFM3 ((volatile uint16_t *)(BC_REGISTER_BASE + sizeof(uint16_t) * 0x1B)) /**< Scratch EFM3 */ 81 #define BC_SCRATCH_BC0 ((volatile uint16_t *)(BC_REGISTER_BASE + sizeof(uint16_t) * 0x1C)) /**< Scratch BC0 */ 82 #define BC_SCRATCH_BC1 ((volatile uint16_t *)(BC_REGISTER_BASE + sizeof(uint16_t) * 0x1D)) /**< Scratch BC1 */ 83 #define BC_SCRATCH_BC2 ((volatile uint16_t *)(BC_REGISTER_BASE + sizeof(uint16_t) * 0x1E)) /**< Scratch BC2 */ 84 #define BC_SCRATCH_BC3 ((volatile uint16_t *)(BC_REGISTER_BASE + sizeof(uint16_t) * 0x1f)) /**< Scratch BC3 */ 85 #define BC_INTFLAG ((volatile uint16_t *)(BC_REGISTER_BASE + sizeof(uint16_t) * 0x20)) /**< Interrupt flag */ 86 #define BC_INTEN ((volatile uint16_t *)(BC_REGISTER_BASE + sizeof(uint16_t) * 0x21)) /**< Interrupt enable */ 87 88 /**************************************************************************//** 89 * Defines bit fields for board control registers 90 *****************************************************************************/ 91 92 #define BC_CFG_SPI (0) /**< SPI mode */ 93 #define BC_CFG_EBI (1) /**< EBI mode */ 94 95 #define BC_EM_EM0 (0) /**< Indicate EM0 */ 96 #define BC_EM_EM1 (1) /**< Indicate EM1 */ 97 #define BC_EM_EM2 (2) /**< Indicate EM2 */ 98 #define BC_EM_EM3 (3) /**< Indicate EM3 */ 99 #define BC_EM_EM4 (4) /**< Indicate EM4 */ 100 101 #define BC_MAGIC_VALUE (0xef32) /**< Magic */ 102 103 #define BC_PUSHBUTTON_MASK (0x000f) /**< Push button mask */ 104 #define BC_PUSHBUTTON_SW1 (1 << 0) /**< Push button SW1 */ 105 #define BC_PUSHBUTTON_SW2 (1 << 1) /**< Push button SW2 */ 106 #define BC_PUSHBUTTON_SW3 (1 << 2) /**< Push button SW3 */ 107 #define BC_PUSHBUTTON_SW4 (1 << 3) /**< Push button SW4 */ 108 109 #define BC_DIPSWITCH_MASK (0x00ff) /**< Dip switch mask */ 110 111 #define BC_JOYSTICK_MASK (0x001f) /**< Joystick mask */ 112 #define BC_JOYSTICK_DOWN (1 << 0) /**< Joystick down */ 113 #define BC_JOYSTICK_RIGHT (1 << 1) /**< Joystick right */ 114 #define BC_JOYSTICK_UP (1 << 2) /**< Joystick up */ 115 #define BC_JOYSTICK_LEFT (1 << 3) /**< Joystick left */ 116 #define BC_JOYSTICK_CENTER (1 << 4) /**< Joystick center button */ 117 118 #define BC_DISPCTRL_RESET (1 << 0) /**< Reset */ 119 #define BC_DISPCTRL_POWER_ENABLE (1 << 1) /**< Display Control Power Enable */ 120 121 #define BC_EBI_CFG_MASK (0x0003) /**< EBI Config */ 122 #define BC_EBI_CFG_16X16 (0) /**< 16x16 address/data mode */ 123 #define BC_EBI_CFG_8X8 (1) /**< 8x8 address/data mode */ 124 #define BC_EBI_CFG_24X8 (2) /**< 24x8 address/data mode */ 125 126 #define BC_BUS_CFG_MASK (0x0003) /**< Bus config */ 127 #define BC_BUS_CFG_FSMC (0) /**< Kit Board Controller owns bus */ 128 #define BC_BUS_CFG_EBI (1) /**< EBI drives bus */ 129 #define BC_BUS_CFG_SPI (2) /**< SPI drives bus */ 130 131 #define BC_PERCTRL_ACCEL (1 << 0) /**< Accelerometer enable */ 132 #define BC_PERCTRL_AMBIENT (1 << 1) /**< Ambient light sensor enable */ 133 #define BC_PERCTRL_POTMETER (1 << 2) /**< Potentiometer enable */ 134 #define BC_PERCTRL_RS232A (1 << 3) /**< RS232A enable */ 135 #define BC_PERCTRL_RS232B (1 << 4) /**< RS232B enable */ 136 #define BC_PERCTRL_SPI (1 << 5) /**< SPI enable */ 137 #define BC_PERCTRL_I2C (1 << 6) /**< I2C enable */ 138 #define BC_PERCTRL_IRDA (1 << 7) /**< IRDA enable */ 139 #define BC_PERCTRL_ANALOG_SE (1 << 8) /**< Analog SE enable */ 140 #define BC_PERCTRL_ANALOG_DIFF (1 << 9) /**< Analog Diff enable */ 141 #define BC_PERCTRL_AUDIO_OUT (1 << 10) /**< Audio Out enable */ 142 #define BC_PERCTRL_AUDIO_IN (1 << 11) /**< Audio In enable */ 143 #define BC_PERCTRL_ACCEL_GSEL (1 << 12) /**< Accel Gsel enable */ 144 #define BC_PERCTRL_ACCEL_SELFTEST (1 << 13) /**< Accel Self test enable */ 145 #define BC_PERCTRL_RS232_SHUTDOWN (1 << 14) /**< RS232 shutdown */ 146 #define BC_PERCTRL_IRDA_SHUTDOWN (1 << 15) /**< IRDA shutdown */ 147 148 #define BC_AEMSTATE_BC (0) /**< AEM button state, BC controls buttons */ 149 #define BC_AEMSTATE_EFM (1) /**< AEM button state, EFM32 controls buttons */ 150 151 #define BC_SPI_CFG_FLASH (0) /**< SPI Flash config */ 152 #define BC_SPI_CFG_MICROSD (1) /**< SPI MicroSD config */ 153 154 #define BC_RESET_FLASH (1 << 0) /**< Reset Flash */ 155 #define BC_RESET_EFM (1 << 1) /**< Reset EFM */ 156 157 #define BC_ADC_START_MASK (0x00ff) /**< ADC Start mask */ 158 159 #define BC_ADC_STATUS_DONE (0) /**< ADC Status Done */ 160 #define BC_ADC_STATUS_BUSY (1) /**< ADC Status Busy */ 161 162 #define BC_HW_VERSION_PCB_MASK (0x07f0) /**< PCB Version mask */ 163 #define BC_HW_VERSION_PCB_SHIFT (4) /**< PCB Version shift */ 164 #define BC_HW_VERSION_BOARD_MASK (0x000f) /**< Board version mask */ 165 #define BC_HW_VERSION_BOARD_SHIFT (0) /**< Board version shift */ 166 167 #define BC_HW_FW_VERSION_MAJOR_MASK (0xf000) /**< FW Version major mask */ 168 #define BC_HW_FW_VERSION_MAJOR_SHIFT (12) /**< FW version major shift */ 169 #define BC_HW_FW_VERSION_MINOR_MASK (0x0f00) /**< FW version minor mask */ 170 #define BC_HW_FW_VERSION_MINOR_SHIFT (8) /**< FW version minor shift */ 171 #define BC_HW_FW_VERSION_PATCHLEVEL_MASK (0x00ff) /**< FW Patchlevel mask */ 172 #define BC_HW_FW_VERSION_PATCHLEVEL_SHIFT (0) /**< FW Patchlevel shift */ 173 174 #define BC_INTEN_MASK (0x000f) /**< Interrupt enable mask */ 175 #define BC_INTEN_PB (1 << 0) /**< Push Button Interrupt enable */ 176 #define BC_INTEN_DIP (1 << 1) /**< DIP Switch Interrupt enable */ 177 #define BC_INTEN_JOYSTICK (1 << 2) /**< Joystick Interrupt enable */ 178 #define BC_INTEN_AEM (1 << 3) /**< AEM Interrupt enable */ 179 180 #define BC_INTFLAG_MASK (0x000f) /**< Interrupt flag mask */ 181 #define BC_INTFLAG_PB (1 << 0) /**< Push Button interrupt triggered */ 182 #define BC_INTFLAG_DIP (1 << 1) /**< DIP interrupt triggered */ 183 #define BC_INTFLAG_JOYSTICK (1 << 2) /**< Joystick interrupt triggered */ 184 #define BC_INTFLAG_AEM (1 << 3) /**< AEM interrupt triggered */ 185 186 #endif 187 188 /** @} (end group BSP) */ 189