|
| 1 | +/****************************************************************************** |
| 2 | + * # License |
| 3 | + * <b>Copyright 2024 Silicon Laboratories Inc. www.silabs.com</b> |
| 4 | + ****************************************************************************** |
| 5 | + * The licensor of this software is Silicon Laboratories Inc. Your use of this |
| 6 | + * software is governed by the terms of Silicon Labs Master Software License |
| 7 | + * Agreement (MSLA) available at |
| 8 | + * www.silabs.com/about-us/legal/master-software-license-agreement. This |
| 9 | + * software is distributed to you in Source Code format and is governed by the |
| 10 | + * sections of the MSLA applicable to Source Code. |
| 11 | + * |
| 12 | + *****************************************************************************/ |
| 13 | + |
| 14 | +/** |
| 15 | + * @defgroup zwave_crc16_transport CRC16 Transport |
| 16 | + * @ingroup zwave_transports |
| 17 | + * @brief Transport for CRC16 |
| 18 | + * |
| 19 | + * @{ |
| 20 | + */ |
| 21 | + |
| 22 | +#ifndef ZWAVE_CRC_16_TRANSPORT_H |
| 23 | +#define ZWAVE_CRC_16_TRANSPORT_H |
| 24 | + |
| 25 | +#include "sl_status.h" |
| 26 | +#include "zwave_node_id_definitions.h" |
| 27 | + |
| 28 | +// We allow to encapsulate the maximum minus our encapsulation command overhead |
| 29 | +#define CRC_16_ENCAPSULATION_HEADER 2 |
| 30 | +#define CRC_16_ENCAPSULATION_FOOTER 2 |
| 31 | +#define CRC_16_ENCAPSULATION_OVERHEAD (CRC_16_ENCAPSULATION_HEADER + CRC_16_ENCAPSULATION_FOOTER) |
| 32 | + |
| 33 | +#define CRC_16_ENCAPSULATED_COMMAND_MAXIMUM_SIZE \ |
| 34 | + (ZWAVE_MAX_FRAME_SIZE - CRC_16_ENCAPSULATION_OVERHEAD) |
| 35 | + |
| 36 | +typedef struct zwave_crc16_encapsulation_frame { |
| 37 | + uint8_t command_class; /* The command class */ |
| 38 | + uint8_t command; /* The command */ |
| 39 | + uint8_t encapsulated_command |
| 40 | + [CRC_16_ENCAPSULATED_COMMAND_MAXIMUM_SIZE]; /* The checksum will be appended to the command*/ |
| 41 | +/* Encapsulated command */ |
| 42 | +} zwave_crc16_encapsulation_frame_t; |
| 43 | + |
| 44 | +#ifdef __cplusplus |
| 45 | +extern "C" { |
| 46 | +#endif |
| 47 | + |
| 48 | +/** |
| 49 | + * @brief Initialize the CRC16 Transport |
| 50 | + * * |
| 51 | + * @returns SL_STATUS_OK if successful |
| 52 | + * @returns SL_STATUS_FAIL if an error occurred |
| 53 | + */ |
| 54 | +sl_status_t zwave_crc16_transport_init(void); |
| 55 | + |
| 56 | +#ifdef __cplusplus |
| 57 | +} |
| 58 | +#endif |
| 59 | + |
| 60 | +#endif //ZWAVE_CRC_16_TRANSPORT_H |
| 61 | +/** @} end zwave_crc16_transport */ |
0 commit comments