bsp.h

Go to the documentation of this file.
00001 /***************************************************************************/
00018 #ifndef __BSP_H
00019 #define __BSP_H
00020 
00021 #include <stdbool.h>
00022 #include "bspconfig.h"
00023 #if defined( BSP_STK )
00024 #include "em_usart.h"
00025 #endif
00026 
00027 #ifdef __cplusplus
00028 extern "C" {
00029 #endif
00030  
00033 #define BSP_STATUS_OK                 0     
00034 #define BSP_STATUS_ILLEGAL_PARAM      (-1)  
00035 #define BSP_STATUS_NOT_IMPLEMENTED    (-2)  
00036 #define BSP_STATUS_UNSUPPORTED_MODE   (-3)  
00038 /* Initialization flag bitmasks for BSP_Init(). */
00039 #define BSP_INIT_DK_SPI     0x01  
00040 #define BSP_INIT_DK_EBI     0x02  
00041 #define BSP_INIT_BCC        0x04  
00045 #if defined( BSP_DK )
00046  
00049 typedef enum
00050 {
00051   BSP_Display_EBI,          
00052   BSP_Display_SPI,          
00053   BSP_Display_BC,           
00054   BSP_Display_PowerEnable,  
00055   BSP_Display_PowerDisable, 
00056   BSP_Display_ResetAssert,  
00057   BSP_Display_ResetRelease, 
00058   BSP_Display_Mode8080,     
00059   BSP_Display_ModeGeneric,  
00060 } BSP_Display_TypeDef;
00061 
00063 typedef enum
00064 {
00065   BSP_BusControl_Undefined=0, 
00066   BSP_BusControl_OFF,         
00067   BSP_BusControl_DIRECT,      
00068   BSP_BusControl_SPI,         
00069   BSP_BusControl_EBI,         
00070 } BSP_BusControl_TypeDef;
00071 
00072 #if defined( BSP_DK_3200 )                        /* Gxxx_DK */
00073 
00075 typedef enum
00076 {
00077   BSP_ACCEL          = BC_PERCTRL_ACCEL,          
00078   BSP_AMBIENT        = BC_PERCTRL_AMBIENT,        
00079   BSP_POTMETER       = BC_PERCTRL_POTMETER,       
00080   BSP_RS232A         = BC_PERCTRL_RS232A,         
00081   BSP_RS232B         = BC_PERCTRL_RS232B,         
00082   BSP_SPI            = BC_PERCTRL_SPI,            
00083   BSP_I2C            = BC_PERCTRL_I2C,            
00084   BSP_IRDA           = BC_PERCTRL_IRDA,           
00085   BSP_ANALOG_SE      = BC_PERCTRL_ANALOG_SE,      
00086   BSP_ANALOG_DIFF    = BC_PERCTRL_ANALOG_DIFF,    
00087   BSP_AUDIO_OUT      = BC_PERCTRL_AUDIO_OUT,      
00088   BSP_AUDIO_IN       = BC_PERCTRL_AUDIO_IN,       
00089   BSP_ACCEL_GSEL     = BC_PERCTRL_ACCEL_GSEL,     
00090   BSP_ACCEL_SELFTEST = BC_PERCTRL_ACCEL_SELFTEST, 
00091   BSP_RS232_SHUTDOWN = BC_PERCTRL_RS232_SHUTDOWN, 
00092   BSP_IRDA_SHUTDOWN  = BC_PERCTRL_IRDA_SHUTDOWN   
00093 #ifdef DOXY_DOC_ONLY
00094 } BSP_Peripheral_Typedef;                         /* Hack for doxygen doc ! */
00095 #else
00096 } BSP_Peripheral_TypeDef;
00097 #endif
00098 #endif /* BSP_DK_3200 */
00099 
00100 #if defined( BSP_DK_3201 )                        /* DK3x50 DK's */
00101 
00103 typedef enum
00104 {
00105   BSP_RS232_SHUTDOWN, 
00106   BSP_RS232_UART,     
00107   BSP_RS232_LEUART,   
00108   BSP_I2C,            
00109   BSP_ETH,            
00110   BSP_I2S,            
00111   BSP_TRACE,          
00112   BSP_TOUCH,          
00113   BSP_AUDIO_IN,       
00114   BSP_AUDIO_OUT,      
00115   BSP_ANALOG_DIFF,    
00116   BSP_ANALOG_SE,      
00117   BSP_MICROSD,        
00118   BSP_TFT,            
00119 } BSP_Peripheral_TypeDef;
00120 #endif  /* BSP_DK_3201 */
00121 
00123 #endif  /* BSP_DK */
00124 
00125 /************************** The BSP API *******************************/
00126 
00127 int             BSP_Disable                 ( void );
00128 int             BSP_Init                    ( uint32_t flags );
00129 int             BSP_LedClear                ( int ledNo );
00130 int             BSP_LedGet                  ( int ledNo );
00131 int             BSP_LedSet                  ( int ledNo );
00132 uint32_t        BSP_LedsGet                 ( void );
00133 int             BSP_LedsInit                ( void );
00134 int             BSP_LedsSet                 ( uint32_t leds );
00135 int             BSP_LedToggle               ( int ledNo );
00136 
00137 
00138 #if defined( BSP_DK )
00139 BSP_BusControl_TypeDef BSP_BusControlModeGet( void );
00140 int             BSP_BusControlModeSet       ( BSP_BusControl_TypeDef mode );
00141 uint32_t        BSP_DipSwitchGet            ( void );
00142 int             BSP_DisplayControl          ( BSP_Display_TypeDef option );
00143 int             BSP_EbiExtendedAddressRange ( bool enable );
00144 int             BSP_EnergyModeSet           ( uint16_t energyMode );
00145 int             BSP_InterruptDisable        ( uint16_t flags );
00146 int             BSP_InterruptEnable         ( uint16_t flags );
00147 int             BSP_InterruptFlagsClear     ( uint16_t flags );
00148 int             BSP_InterruptFlagsSet       ( uint16_t flags );
00149 uint16_t        BSP_InterruptFlagsGet       ( void );
00150 uint16_t        BSP_JoystickGet             ( void );
00151 int             BSP_McuBoard_DeInit         ( void );
00152 int             BSP_McuBoard_Init           ( void );
00153 int             BSP_McuBoard_UsbStatusLedEnable ( bool enable );
00154 bool            BSP_McuBoard_UsbVbusOcFlagGet   ( void );
00155 int             BSP_McuBoard_UsbVbusPowerEnable ( bool enable );
00156 int             BSP_PeripheralAccess        ( BSP_Peripheral_TypeDef perf, bool enable );
00157 uint16_t        BSP_PushButtonsGet          ( void );
00158 uint16_t        BSP_RegisterRead            ( volatile uint16_t *addr );
00159 int             BSP_RegisterWrite           ( volatile uint16_t *addr, uint16_t data );
00160 #endif
00161 
00162 #if defined( BSP_STK )
00163 int             BSP_BccDeInit               ( void );
00164 int             BSP_BccInit                 ( void );
00165 bool            BSP_BccPacketReceive        ( BCP_Packet *pkt );
00166 int             BSP_BccPacketSend           ( BCP_Packet *pkt );
00167 void            BSP_BccPinsEnable           ( bool enable );
00168 float           BSP_CurrentGet              ( void );
00169 int             BSP_EbiDeInit               ( void );
00170 int             BSP_EbiInit                 ( void );
00171 float           BSP_VoltageGet              ( void );
00172 #endif
00173 
00174 #ifdef __cplusplus
00175 }
00176 #endif
00177 
00178 #endif  /* __BSP_H */