bsp_bcp.h

Go to the documentation of this file.
00001 /**************************************************************************/
00035 #ifndef __BSP_BCP_H
00036 #define __BSP_BCP_H
00037 #include <stdint.h>
00038 
00039 #ifdef __cplusplus
00040 extern "C" {
00041 #endif
00042 
00043 /***************************************************************************/
00048 /* BCP Packet Types */
00049 #define BSP_BCP_INVALID          0   
00051 #define BSP_BCP_FIRST            1   
00053 #define BSP_BCP_ACK              5   
00054 #define BSP_BCP_ECHO_REQ         10  
00055 #define BSP_BCP_ECHO_REPLY       11  
00056 #define BSP_BCP_CURRENT_REQ      14  
00057 #define BSP_BCP_CURRENT_REPLY    16  
00058 #define BSP_BCP_VOLTAGE_REQ      18  
00059 #define BSP_BCP_VOLTAGE_REPLY    20  
00060 #define BSP_BCP_ENERGYMODE       22  
00061 #define BSP_BCP_STDOUT           24  
00062 #define BSP_BCP_STDERR           26  
00063 #define BSP_BCP_TEST             32  
00064 #define BSP_BCP_TEST_REPLY       33  
00066 #define BSP_BCP_LAST             100 
00068 #define BSP_BCP_MAGIC            0xF1 
00073 #if ( ( BSP_BCP_VERSION == 1 ) || DOXY_DOC_ONLY )
00074 
00075 #ifdef DOXY_DOC_ONLY
00076                                     /* Hack for doxygen doc ! */
00077 #define BSP_BCP_PACKET_SIZe      30 
00078 #else
00079 #define BSP_BCP_PACKET_SIZE      30 
00080 #endif
00081 
00083 typedef struct
00084 {
00085   uint8_t magic;                      
00086   uint8_t type;                       
00087   uint8_t payloadLength;              
00088   uint8_t data[BSP_BCP_PACKET_SIZE];  
00089 #ifdef DOXY_DOC_ONLY
00090 } BCP_Packet_;                        /* Hack for doxygen doc ! */
00091 #else
00092 } BCP_Packet;
00093 #endif
00094 #endif
00095 
00096 
00097 
00098 
00099 #if ( ( BSP_BCP_VERSION == 2 ) || DOXY_DOC_ONLY )
00100 
00101 #define BSP_BCP_PACKET_SIZE      132  
00104 typedef struct
00105 {
00106   uint8_t magic;                      
00107   uint8_t type;                       
00108   uint8_t payloadLength;              
00109   uint8_t reserved;                   
00110   uint8_t data[BSP_BCP_PACKET_SIZE];  
00111 } BCP_Packet;
00112 
00114 typedef struct
00115 {
00116   uint8_t magic;                    
00117   uint8_t type;                     
00118   uint8_t payloadLength;            
00119   uint8_t reserved;                 
00120 } BCP_PacketHeader;
00121 #endif
00122 
00123 
00124 
00125 
00126 #if ( ( BSP_BCP_VERSION != 1 ) && ( BSP_BCP_VERSION != 2 ) )
00127 #error "BSP BCP Board Controller communications protocol version error."
00128 #endif
00129 
00130 #if ( BSP_BCP_PACKET_SIZE >= 255 )
00131 #error "BSP BCP Board Controller communications packets must be less than 255 bytes in size!"
00132 #endif
00133 
00136 #ifdef __cplusplus
00137 }
00138 #endif
00139 
00140 #endif  /* __BSP_BCP_H */