bsp_bcp.h

Go to the documentation of this file.
00001 /**************************************************************************/
00018 #ifndef __BSP_BCP_H
00019 #define __BSP_BCP_H
00020 #include <stdint.h>
00021 
00022 #include "bspconfig.h"
00023 
00024 #ifdef __cplusplus
00025 extern "C" {
00026 #endif
00027 
00028 /***************************************************************************/
00033 /* BCP Packet Types */
00034 #define BSP_BCP_INVALID          0   
00036 #define BSP_BCP_FIRST            1   
00038 #define BSP_BCP_ACK              5   
00039 #define BSP_BCP_ECHO_REQ         10  
00040 #define BSP_BCP_ECHO_REPLY       11  
00041 #define BSP_BCP_CURRENT_REQ      14  
00042 #define BSP_BCP_CURRENT_REPLY    16  
00043 #define BSP_BCP_VOLTAGE_REQ      18  
00044 #define BSP_BCP_VOLTAGE_REPLY    20  
00045 #define BSP_BCP_ENERGYMODE       22  
00046 #define BSP_BCP_STDOUT           24  
00047 #define BSP_BCP_STDERR           26  
00048 #define BSP_BCP_TEST             32  
00049 #define BSP_BCP_TEST_REPLY       33  
00050 #define BSP_BCP_NET_REQUEST      64  
00051 #define BSP_BCP_NET_REPLY        65  
00053 #define BSP_BCP_LAST             100 
00055 #define BSP_BCP_MAGIC            0xF1 
00060 #if ( ( BSP_BCP_VERSION == 1 ) || DOXY_DOC_ONLY )
00061 
00062 #ifdef DOXY_DOC_ONLY
00063                                     /* Hack for doxygen doc ! */
00064 #define BSP_BCP_PACKET_SIZe      30 
00065 #else
00066 #define BSP_BCP_PACKET_SIZE      30 
00067 #endif
00068 
00070 typedef struct
00071 {
00072   uint8_t magic;                      
00073   uint8_t type;                       
00074   uint8_t payloadLength;              
00075   uint8_t data[BSP_BCP_PACKET_SIZE];  
00076 #ifdef DOXY_DOC_ONLY
00077 } BCP_Packet_;                        /* Hack for doxygen doc ! */
00078 #else
00079 } BCP_Packet;
00080 #endif
00081 #endif
00082 
00083 
00084 
00085 
00086 #if ( ( BSP_BCP_VERSION == 2 ) || DOXY_DOC_ONLY )
00087 
00088 #define BSP_BCP_PACKET_SIZE      132  
00091 typedef struct
00092 {
00093   uint8_t magic;                      
00094   uint8_t type;                       
00095   uint8_t payloadLength;              
00096   uint8_t reserved;                   
00097   uint8_t data[BSP_BCP_PACKET_SIZE];  
00098 } BCP_Packet;
00099 
00101 typedef struct
00102 {
00103   uint8_t magic;                    
00104   uint8_t type;                     
00105   uint8_t payloadLength;            
00106   uint8_t reserved;                 
00107 } BCP_PacketHeader;
00108 #endif
00109 
00110 
00111 
00112 
00113 #if ( ( BSP_BCP_VERSION != 1 ) && ( BSP_BCP_VERSION != 2 ) )
00114 #error "BSP BCP Board Controller communications protocol version error."
00115 #endif
00116 
00117 #if ( BSP_BCP_PACKET_SIZE >= 255 )
00118 #error "BSP BCP Board Controller communications packets must be less than 255 bytes in size!"
00119 #endif
00120 
00123 #ifdef __cplusplus
00124 }
00125 #endif
00126 
00127 #endif  /* __BSP_BCP_H */