1 /**************************************************************************//**
\r
3 * @brief Board Controller Communications Protocol (BCP) definitions
\r
5 ******************************************************************************
\r
7 * <b>(C) Copyright 2014 Silicon Labs, http://www.silabs.com</b>
\r
8 *******************************************************************************
\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
14 ******************************************************************************/
\r
22 #include "bspconfig.h"
\r
28 /***************************************************************************//**
\r
29 * @addtogroup BSP_STK API for STK's and WSTK's
\r
31 ******************************************************************************/
\r
33 /* BCP Packet Types */
\r
34 #define BSP_BCP_INVALID 0 /**< Invalid packet received */
\r
36 #define BSP_BCP_FIRST 1 /**< Smallest numerical value of message type */
\r
38 #define BSP_BCP_ACK 5 /**< Generic ACK for one way packages */
\r
39 #define BSP_BCP_ECHO_REQ 10 /**< EFM32 BC alive request */
\r
40 #define BSP_BCP_ECHO_REPLY 11 /**< BC alive response */
\r
41 #define BSP_BCP_CURRENT_REQ 14 /**< EFM32 Request AEM current */
\r
42 #define BSP_BCP_CURRENT_REPLY 16 /**< BC Response AEM current */
\r
43 #define BSP_BCP_VOLTAGE_REQ 18 /**< EFM32 Request AEM voltage */
\r
44 #define BSP_BCP_VOLTAGE_REPLY 20 /**< BC Response AEM voltage */
\r
45 #define BSP_BCP_ENERGYMODE 22 /**< EFM32 Report Energy Mode (for AEM) */
\r
46 #define BSP_BCP_STDOUT 24 /**< Debug packet (not used) */
\r
47 #define BSP_BCP_STDERR 26 /**< Debug packet (not used) */
\r
48 #define BSP_BCP_TEST 32 /**< Reserved type for test */
\r
49 #define BSP_BCP_TEST_REPLY 33 /**< Reserved type for test (reply) */
\r
50 #define BSP_BCP_NET_REQUEST 64 /**< Net gateway request packet */
\r
51 #define BSP_BCP_NET_REPLY 65 /**< Net gateway reply packet */
\r
53 #define BSP_BCP_LAST 100 /**< Last defined message type */
\r
55 #define BSP_BCP_MAGIC 0xF1 /**< Magic byte to indicate start of packet */
\r
60 #if ( ( BSP_BCP_VERSION == 1 ) || DOXY_DOC_ONLY )
\r
62 #ifdef DOXY_DOC_ONLY
\r
63 /* Hack for doxygen doc ! */
\r
64 #define BSP_BCP_PACKET_SIZe 30 /**< Max packet size for version 1 of the protocol. */
\r
66 #define BSP_BCP_PACKET_SIZE 30 /**< Max packet size for version 1 of the protocol. */
\r
69 /** @brief BCP Packet Structure - Board controller communication protocol version 1. */
\r
72 uint8_t magic; /**< Magic - start of packet - must be BSP_BCP_MAGIC */
\r
73 uint8_t type; /**< Type of packet */
\r
74 uint8_t payloadLength; /**< Length of data segment >=0 and <=BSP_BCP_PACKET_SIZE */
\r
75 uint8_t data[BSP_BCP_PACKET_SIZE]; /**< BCP Packet Data payload */
\r
76 #ifdef DOXY_DOC_ONLY
\r
77 } BCP_Packet_; /* Hack for doxygen doc ! */
\r
86 #if ( ( BSP_BCP_VERSION == 2 ) || DOXY_DOC_ONLY )
\r
88 #define BSP_BCP_PACKET_SIZE 132 /**< Max packet size for version 2 of the protocol. */
\r
90 /** @brief BCP Packet Structure - Board controller communication protocol version 2. */
\r
93 uint8_t magic; /**< Magic - start of packet - must be BSP_BCP_MAGIC */
\r
94 uint8_t type; /**< Type - packet type */
\r
95 uint8_t payloadLength; /**< Length of data segment >=0 and <=BSP_BCP_PACKET_SIZE */
\r
96 uint8_t reserved; /**< Reserved for future expansion */
\r
97 uint8_t data[BSP_BCP_PACKET_SIZE]; /**< BCP Packet Data payload */
\r
100 /** @brief BCP Packet Header definition */
\r
103 uint8_t magic; /**< Magic - start of packet - must be BSP_BCP_MAGIC */
\r
104 uint8_t type; /**< Type - packet type */
\r
105 uint8_t payloadLength; /**< Length of data segment >=0 and <=BSP_BCP_PACKET_SIZE */
\r
106 uint8_t reserved; /**< Reserved for future expansion */
\r
107 } BCP_PacketHeader;
\r
113 #if ( ( BSP_BCP_VERSION != 1 ) && ( BSP_BCP_VERSION != 2 ) )
\r
114 #error "BSP BCP Board Controller communications protocol version error."
\r
117 #if ( BSP_BCP_PACKET_SIZE >= 255 )
\r
118 #error "BSP BCP Board Controller communications packets must be less than 255 bytes in size!"
\r
121 /** @} (end group BSP_STK) */
\r
127 #endif /* __BSP_BCP_H */
\r