EFR32 Mighty Gecko 1 Software Documentation  efr32mg1-doc-5.1.2
bsp.h
Go to the documentation of this file.
1 /***************************************************************************/
18 #ifndef __BSP_H
19 #define __BSP_H
20 
21 #include <stdbool.h>
22 #include "bspconfig.h"
23 #if defined( BSP_STK ) || defined( BSP_WSTK )
24 #include "em_usart.h"
25 #endif
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 /***************************************************************************/
40 /***************************************************************************/
45 #define BSP_STATUS_OK 0
46 #define BSP_STATUS_ILLEGAL_PARAM (-1)
47 #define BSP_STATUS_NOT_IMPLEMENTED (-2)
48 #define BSP_STATUS_UNSUPPORTED_MODE (-3)
49 #define BSP_STATUS_IOEXP_FAILURE (-4)
51 /* Initialization flag bitmasks for BSP_Init(). */
52 #define BSP_INIT_DK_SPI 0x01
53 #define BSP_INIT_DK_EBI 0x02
54 #define BSP_INIT_BCC 0x04
55 #define BSP_INIT_IOEXP 0x08
59 #if defined( BSP_DK )
60 
63 typedef enum
64 {
75 
77 typedef enum
78 {
85 
86 #if defined( BSP_DK_BRD3200 ) /* Gxxx_DK */
87 
89 typedef enum
90 {
91  BSP_ACCEL = BC_PERCTRL_ACCEL,
92  BSP_AMBIENT = BC_PERCTRL_AMBIENT,
93  BSP_POTMETER = BC_PERCTRL_POTMETER,
94  BSP_RS232A = BC_PERCTRL_RS232A,
95  BSP_RS232B = BC_PERCTRL_RS232B,
96  BSP_SPI = BC_PERCTRL_SPI,
98  BSP_IRDA = BC_PERCTRL_IRDA,
103  BSP_ACCEL_GSEL = BC_PERCTRL_ACCEL_GSEL,
104  BSP_ACCEL_SELFTEST = BC_PERCTRL_ACCEL_SELFTEST,
106  BSP_IRDA_SHUTDOWN = BC_PERCTRL_IRDA_SHUTDOWN
107 #ifdef DOXY_DOC_ONLY
108 } BSP_Peripheral_Typedef; /* Hack for doxygen doc ! */
109 #else
111 #endif
112 #endif /* BSP_DK_BRD3200 */
113 
114 #if defined( BSP_DK_BRD3201 ) /* DK3x50 DK's */
115 
117 typedef enum
118 {
134 #endif /* BSP_DK_BRD3201 */
135 
137 #endif /* BSP_DK */
138 
139 #if defined( BSP_STK )
140 
143 typedef enum
144 {
150 
152 #endif /* BSP_STK */
153 
154 /************************** The BSP API *******************************/
155 /***************************************************************************/
160 int BSP_Disable ( void );
161 int BSP_Init ( uint32_t flags );
162 int BSP_LedClear ( int ledNo );
163 int BSP_LedGet ( int ledNo );
164 int BSP_LedSet ( int ledNo );
165 uint32_t BSP_LedsGet ( void );
166 int BSP_LedsInit ( void );
167 int BSP_LedsSet ( uint32_t leds );
168 int BSP_LedToggle ( int ledNo );
169 int BSP_PeripheralAccess ( BSP_Peripheral_TypeDef perf, bool enable ); /* endgroup BSPCOMMON */
171 
172 
173 #if defined( BSP_DK )
174 /***************************************************************************/
180 uint32_t BSP_DipSwitchGet ( void );
182 int BSP_EbiExtendedAddressRange ( bool enable );
183 int BSP_EnergyModeSet ( uint16_t energyMode );
184 int BSP_InterruptDisable ( uint16_t flags );
185 int BSP_InterruptEnable ( uint16_t flags );
186 int BSP_InterruptFlagsClear ( uint16_t flags );
187 int BSP_InterruptFlagsSet ( uint16_t flags );
188 uint16_t BSP_InterruptFlagsGet ( void );
189 uint16_t BSP_JoystickGet ( void );
190 int BSP_McuBoard_DeInit ( void );
191 int BSP_McuBoard_Init ( void );
192 int BSP_McuBoard_UsbStatusLedEnable ( bool enable );
193 bool BSP_McuBoard_UsbVbusOcFlagGet ( void );
194 int BSP_McuBoard_UsbVbusPowerEnable ( bool enable );
195 uint16_t BSP_PushButtonsGet ( void );
196 uint16_t BSP_RegisterRead ( volatile uint16_t *addr );
197 int BSP_RegisterWrite ( volatile uint16_t *addr, uint16_t data ); /* endgroup BSP_DK */
199 #endif
200 
201 #if defined( BSP_STK ) || defined( BSP_WSTK )
202 /***************************************************************************/
206 int BSP_BccDeInit ( void );
207 int BSP_BccInit ( void );
208 bool BSP_BccPacketReceive ( BCP_Packet *pkt );
209 int BSP_BccPacketSend ( BCP_Packet *pkt );
210 void BSP_BccPinsEnable ( bool enable );
211 float BSP_CurrentGet ( void );
212 int BSP_EbiDeInit ( void );
213 int BSP_EbiInit ( void );
214 float BSP_VoltageGet ( void );
215 uint32_t BSP_IOExpGetDeviceId ( void );
216  /* endgroup BSP_STK */
218 #endif
219  /* endgroup BSP */
221 
222 #ifdef __cplusplus
223 }
224 #endif
225 
226 #endif /* __BSP_H */
int BSP_McuBoard_Init(void)
Enable MCU plugin board peripherals.
uint16_t BSP_PushButtonsGet(void)
Get status of the pushbutton switches on the DK.
Definition: bsp_dk_3201.c:677
#define BC_PERCTRL_ACCEL
#define BC_PERCTRL_AUDIO_OUT
int BSP_EnergyModeSet(uint16_t energyMode)
Inform board controller about current energy mode.
Definition: bsp_dk_3201.c:344
float BSP_CurrentGet(void)
Request AEM (Advanced Energy Monitoring) current from board controller.
Definition: bsp_stk.c:317
int BSP_BusControlModeSet(BSP_BusControl_TypeDef mode)
Configure Board Controller bus decode logic.
Definition: bsp_dk_3201.c:187
BCP Packet Structure - Board controller communication protocol version 2.
Definition: bsp_bcp.h:95
#define BC_PERCTRL_AUDIO_IN
#define BC_PERCTRL_AMBIENT
Definition: bsp.h:132
Definition: bsp.h:124
Definition: bsp.h:123
Universal synchronous/asynchronous receiver/transmitter (USART/UART) peripheral API.
int BSP_InterruptEnable(uint16_t flags)
Enable interrupts from board controller.
Definition: bsp_dk_3201.c:376
int BSP_InterruptFlagsSet(uint16_t flags)
Set board controller interrupt flags.
Definition: bsp_dk_3201.c:419
int BSP_LedsInit(void)
Initialize LED drivers.
Definition: bsp_dk_leds.c:37
int BSP_McuBoard_UsbVbusPowerEnable(bool enable)
Enable MCU plugin board VBUS power switch.
uint16_t BSP_RegisterRead(volatile uint16_t *addr)
Read from a board controller register.
Definition: bsp_dk_3201.c:687
int BSP_InterruptDisable(uint16_t flags)
Disable interrupts from board controller.
Definition: bsp_dk_3201.c:357
Definition: bsp.h:122
int BSP_LedsSet(uint32_t leds)
Update all LED's.
Definition: bsp_dk_leds.c:60
bool BSP_McuBoard_UsbVbusOcFlagGet(void)
Get state MCU plugin board VBUS overcurrent flag.
#define BC_PERCTRL_ACCEL_GSEL
void BSP_BccPinsEnable(bool enable)
Enable GPIO pins for the USART/LEUART used for board communication.
Definition: bsp_bcc.c:230
int BSP_InterruptFlagsClear(uint16_t flags)
Clear board controller interrupt flags.
Definition: bsp_dk_3201.c:394
Definition: bsp.h:126
BSP_BusControl_TypeDef
Definition: bsp.h:77
int BSP_EbiExtendedAddressRange(bool enable)
Extended the EBI addressing range by enabling address lines A16-A22. On Gxxx_DK's this functions is a...
Definition: bsp_dk_3201.c:323
int BSP_BccInit(void)
Initialize board controller communication support (BCC) functionality.
Definition: bsp_bcc.c:89
#define BC_PERCTRL_ACCEL_SELFTEST
int BSP_LedSet(int ledNo)
Turn on a single LED.
Definition: bsp_dk_leds.c:111
int BSP_LedToggle(int ledNo)
Toggle a single LED.
Definition: bsp_dk_leds.c:131
int BSP_McuBoard_DeInit(void)
Disable MCU plugin board peripherals.
uint32_t BSP_LedsGet(void)
Get status of all LED's.
Definition: bsp_dk_leds.c:48
uint32_t BSP_DipSwitchGet(void)
Get status of the DIP switches on the DK.
Definition: bsp_dk_3201.c:238
int BSP_BccPacketSend(BCP_Packet *pkt)
Send a packet to the board controller.
Definition: bsp_bcc.c:195
uint16_t BSP_InterruptFlagsGet(void)
Get board controller interrupt flags.
Definition: bsp_dk_3201.c:430
BSP_Peripheral_TypeDef
Definition: bsp.h:117
#define BC_PERCTRL_SPI
int BSP_Init(uint32_t flags)
Initialize board support package functionality.
Definition: bsp_dk_3201.c:127
float BSP_VoltageGet(void)
Request AEM (Advanced Energy Monitoring) voltage from board controller.
Definition: bsp_stk.c:349
int BSP_EbiDeInit(void)
Deinitialize the EBI interface for accessing the onboard nandflash.
Definition: bsp_stk.c:161
BSP_Display_TypeDef
Definition: bsp.h:63
#define BC_PERCTRL_IRDA_SHUTDOWN
#define BC_PERCTRL_POTMETER
int BSP_PeripheralAccess(BSP_Peripheral_TypeDef perf, bool enable)
DK Peripheral Access Control Enable or disable access to on-board peripherals through switches and SP...
Definition: bsp_dk_3201.c:461
#define BC_PERCTRL_IRDA
#define BC_PERCTRL_RS232B
int BSP_RegisterWrite(volatile uint16_t *addr, uint16_t data)
Write to a board controller register.
Definition: bsp_dk_3201.c:704
int BSP_LedGet(int ledNo)
Get current status of a single LED.
Definition: bsp_dk_leds.c:93
int BSP_EbiInit(void)
Initialize the EBI interface for accessing the onboard nandflash.
Definition: bsp_stk.c:68
#define BC_PERCTRL_RS232_SHUTDOWN
int BSP_LedClear(int ledNo)
Turn off a single LED.
Definition: bsp_dk_leds.c:72
int BSP_Disable(void)
Deinitialize board support package functionality. Reverse actions performed by BSP_Init(). This function is a dummy on STK's.
Definition: bsp_dk_3201.c:97
#define BC_PERCTRL_RS232A
BSP_BusControl_TypeDef BSP_BusControlModeGet(void)
Get current board controller bus decode logic configuration.
Definition: bsp_dk_3201.c:173
#define BC_PERCTRL_I2C
int BSP_DisplayControl(BSP_Display_TypeDef option)
Configure display control.
Definition: bsp_dk_3201.c:251
#define BC_PERCTRL_ANALOG_SE
bool BSP_BccPacketReceive(BCP_Packet *pkt)
Get a packet from the board controller.
Definition: bsp_bcc.c:137
int BSP_McuBoard_UsbStatusLedEnable(bool enable)
Set state of MCU plugin board USB status LED.
int BSP_BccDeInit(void)
Deinitialize board controller communication support (BCC) functionality. Reverse actions performed by...
Definition: bsp_bcc.c:61
#define BC_PERCTRL_ANALOG_DIFF
uint32_t BSP_IOExpGetDeviceId(void)
Get IO Expander Device id.
Definition: bsp_stk.c:177
uint16_t BSP_JoystickGet(void)
Get status of joystick on the DK.
Definition: bsp_dk_3201.c:440
Definition: bsp.h:125