]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_EFM32_Gecko_Starter_Kit_Simplicity_Studio/Source/SilLabs_Code/kits/bsp/bsp.h
a8616e4a672985afce500e89ff5ece72e1637e42
[freertos] / FreeRTOS / Demo / CORTEX_EFM32_Gecko_Starter_Kit_Simplicity_Studio / Source / SilLabs_Code / kits / bsp / bsp.h
1 /***************************************************************************//**\r
2  * @file\r
3  * @brief Board support package API definitions.\r
4  * @version 4.0.0\r
5  *******************************************************************************\r
6  * @section License\r
7  * <b>(C) Copyright 2014 Silicon Labs, http://www.silabs.com</b>\r
8  *******************************************************************************\r
9  *\r
10  * This file is licensed under the Silabs License Agreement. See the file\r
11  * "Silabs_License_Agreement.txt" for details. Before using this software for\r
12  * any purpose, you must agree to the terms of that agreement.\r
13  *\r
14  ******************************************************************************/\r
15 \r
16 \r
17 \r
18 #ifndef __BSP_H\r
19 #define __BSP_H\r
20 \r
21 #include <stdbool.h>\r
22 #include "bspconfig.h"\r
23 #if defined( BSP_STK ) || defined( BSP_WSTK )\r
24 #include "em_usart.h"\r
25 #endif\r
26 \r
27 #ifdef __cplusplus\r
28 extern "C" {\r
29 #endif\r
30 \r
31 /** @addtogroup BSPCOMMON API common for all kits */ /** @{ */\r
32 \r
33 #define BSP_STATUS_OK                 0     /**< BSP API return code, no errors. */\r
34 #define BSP_STATUS_ILLEGAL_PARAM      (-1)  /**< BSP API return code, illegal input parameter. */\r
35 #define BSP_STATUS_NOT_IMPLEMENTED    (-2)  /**< BSP API return code, function not implemented (dummy). */\r
36 #define BSP_STATUS_UNSUPPORTED_MODE   (-3)  /**< BSP API return code, unsupported BSP mode. */\r
37 \r
38 /* Initialization flag bitmasks for BSP_Init(). */\r
39 #define BSP_INIT_DK_SPI     0x01  /**< Mode flag for @ref BSP_Init(), init DK in SPI mode (DK3x50 only). */\r
40 #define BSP_INIT_DK_EBI     0x02  /**< Mode flag for @ref BSP_Init(), init DK in EBI mode (DK3x50 only). */\r
41 #define BSP_INIT_BCC        0x04  /**< Mode flag for @ref BSP_Init(), init board controller communication. */\r
42 \r
43 /** @} */\r
44 \r
45 #if defined( BSP_DK )\r
46 /** @addtogroup BSP_DK API for DK's */ /** @{ */\r
47 \r
48 /** Display Control */\r
49 typedef enum\r
50 {\r
51   BSP_Display_EBI,          /**< SSD2119 TFT controller driven by EFM32 EBI interface */\r
52   BSP_Display_SPI,          /**< SSD2119 TFT controller driven by EFM32 SPI interface */\r
53   BSP_Display_BC,           /**< SSD2119 TFT controller driven by board controller (AEM) */\r
54   BSP_Display_PowerEnable,  /**< SSD2119 Enable power  */\r
55   BSP_Display_PowerDisable, /**< SSD2119 Disable power  */\r
56   BSP_Display_ResetAssert,  /**< Hold SSD2119 in reset */\r
57   BSP_Display_ResetRelease, /**< Release SSD2119 in reset */\r
58   BSP_Display_Mode8080,     /**< Configure SSD2119 for 8080 mode of operation  */\r
59   BSP_Display_ModeGeneric,  /**< Configure SSD2119 for Generic+SPI mode of operation */\r
60 } BSP_Display_TypeDef;\r
61 \r
62 /** Bus control access mode */\r
63 typedef enum\r
64 {\r
65   BSP_BusControl_Undefined=0, /**< Board control mode unknown (not set) */\r
66   BSP_BusControl_OFF,         /**< Board control disable */\r
67   BSP_BusControl_DIRECT,      /**< GPIO direct drive (n/a) */\r
68   BSP_BusControl_SPI,         /**< Configure Board controller for SPI mode */\r
69   BSP_BusControl_EBI,         /**< Configure Board controller for EBI mode */\r
70 } BSP_BusControl_TypeDef;\r
71 \r
72 #if defined( BSP_DK_3200 )                        /* Gxxx_DK */\r
73 \r
74 /** Peripherals control structure for Gxxx_DK's. */\r
75 typedef enum\r
76 {\r
77   BSP_ACCEL          = BC_PERCTRL_ACCEL,          /**< Accelerometer */\r
78   BSP_AMBIENT        = BC_PERCTRL_AMBIENT,        /**< Light sensor */\r
79   BSP_POTMETER       = BC_PERCTRL_POTMETER,       /**< Potentiometer */\r
80   BSP_RS232A         = BC_PERCTRL_RS232A,         /**< Serial port A */\r
81   BSP_RS232B         = BC_PERCTRL_RS232B,         /**< Serial port B */\r
82   BSP_SPI            = BC_PERCTRL_SPI,            /**< SPI interface */\r
83   BSP_I2C            = BC_PERCTRL_I2C,            /**< I2C interface */\r
84   BSP_IRDA           = BC_PERCTRL_IRDA,           /**< IrDA interface */\r
85   BSP_ANALOG_SE      = BC_PERCTRL_ANALOG_SE,      /**< Single ended analog input */\r
86   BSP_ANALOG_DIFF    = BC_PERCTRL_ANALOG_DIFF,    /**< Differential analog input */\r
87   BSP_AUDIO_OUT      = BC_PERCTRL_AUDIO_OUT,      /**< Audio Out */\r
88   BSP_AUDIO_IN       = BC_PERCTRL_AUDIO_IN,       /**< Audio In */\r
89   BSP_ACCEL_GSEL     = BC_PERCTRL_ACCEL_GSEL,     /**< Accelerometer range select */\r
90   BSP_ACCEL_SELFTEST = BC_PERCTRL_ACCEL_SELFTEST, /**< Accelerometer selftest mode */\r
91   BSP_RS232_SHUTDOWN = BC_PERCTRL_RS232_SHUTDOWN, /**< Disable RS232 */\r
92   BSP_IRDA_SHUTDOWN  = BC_PERCTRL_IRDA_SHUTDOWN   /**< Disable IrDA */\r
93 #ifdef DOXY_DOC_ONLY\r
94 } BSP_Peripheral_Typedef;                         /* Hack for doxygen doc ! */\r
95 #else\r
96 } BSP_Peripheral_TypeDef;\r
97 #endif\r
98 #endif /* BSP_DK_3200 */\r
99 \r
100 #if defined( BSP_DK_3201 )                        /* DK3x50 DK's */\r
101 \r
102 /** Peripherals control structure for DK3x50 DK's. */\r
103 typedef enum\r
104 {\r
105   BSP_RS232_SHUTDOWN, /**< Disable RS232 */\r
106   BSP_RS232_UART,     /**< UART control of RS232 */\r
107   BSP_RS232_LEUART,   /**< LEUART control of RS232 */\r
108   BSP_I2C,            /**< I2C interface */\r
109   BSP_ETH,            /**< Ethernet */\r
110   BSP_I2S,            /**< Audio I2S */\r
111   BSP_TRACE,          /**< ETM Trace */\r
112   BSP_TOUCH,          /**< Display touch interface */\r
113   BSP_AUDIO_IN,       /**< Audio In */\r
114   BSP_AUDIO_OUT,      /**< Audio Out */\r
115   BSP_ANALOG_DIFF,    /**< Differential analog input */\r
116   BSP_ANALOG_SE,      /**< Single ended analog input */\r
117   BSP_MICROSD,        /**< MicroSD SPI interace */\r
118   BSP_TFT,            /**< SSD2119 TFT controller */\r
119 } BSP_Peripheral_TypeDef;\r
120 #endif  /* BSP_DK_3201 */\r
121 \r
122 /** @} */\r
123 #endif  /* BSP_DK */\r
124 \r
125 /************************** The BSP API *******************************/\r
126 \r
127 int             BSP_Disable                 ( void );\r
128 int             BSP_Init                    ( uint32_t flags );\r
129 int             BSP_LedClear                ( int ledNo );\r
130 int             BSP_LedGet                  ( int ledNo );\r
131 int             BSP_LedSet                  ( int ledNo );\r
132 uint32_t        BSP_LedsGet                 ( void );\r
133 int             BSP_LedsInit                ( void );\r
134 int             BSP_LedsSet                 ( uint32_t leds );\r
135 int             BSP_LedToggle               ( int ledNo );\r
136 \r
137 \r
138 #if defined( BSP_DK )\r
139 BSP_BusControl_TypeDef BSP_BusControlModeGet( void );\r
140 int             BSP_BusControlModeSet       ( BSP_BusControl_TypeDef mode );\r
141 uint32_t        BSP_DipSwitchGet            ( void );\r
142 int             BSP_DisplayControl          ( BSP_Display_TypeDef option );\r
143 int             BSP_EbiExtendedAddressRange ( bool enable );\r
144 int             BSP_EnergyModeSet           ( uint16_t energyMode );\r
145 int             BSP_InterruptDisable        ( uint16_t flags );\r
146 int             BSP_InterruptEnable         ( uint16_t flags );\r
147 int             BSP_InterruptFlagsClear     ( uint16_t flags );\r
148 int             BSP_InterruptFlagsSet       ( uint16_t flags );\r
149 uint16_t        BSP_InterruptFlagsGet       ( void );\r
150 uint16_t        BSP_JoystickGet             ( void );\r
151 int             BSP_McuBoard_DeInit         ( void );\r
152 int             BSP_McuBoard_Init           ( void );\r
153 int             BSP_McuBoard_UsbStatusLedEnable ( bool enable );\r
154 bool            BSP_McuBoard_UsbVbusOcFlagGet   ( void );\r
155 int             BSP_McuBoard_UsbVbusPowerEnable ( bool enable );\r
156 int             BSP_PeripheralAccess        ( BSP_Peripheral_TypeDef perf, bool enable );\r
157 uint16_t        BSP_PushButtonsGet          ( void );\r
158 uint16_t        BSP_RegisterRead            ( volatile uint16_t *addr );\r
159 int             BSP_RegisterWrite           ( volatile uint16_t *addr, uint16_t data );\r
160 #endif\r
161 \r
162 #if defined( BSP_STK ) || defined( BSP_WSTK )\r
163 int             BSP_BccDeInit               ( void );\r
164 int             BSP_BccInit                 ( void );\r
165 bool            BSP_BccPacketReceive        ( BCP_Packet *pkt );\r
166 int             BSP_BccPacketSend           ( BCP_Packet *pkt );\r
167 void            BSP_BccPinsEnable           ( bool enable );\r
168 float           BSP_CurrentGet              ( void );\r
169 int             BSP_EbiDeInit               ( void );\r
170 int             BSP_EbiInit                 ( void );\r
171 float           BSP_VoltageGet              ( void );\r
172 #endif\r
173 \r
174 #ifdef __cplusplus\r
175 }\r
176 #endif\r
177 \r
178 #endif  /* __BSP_H */\r