1 #ifndef _BFLB_CKS_H 2 #define _BFLB_CKS_H 3 4 #include "bflb_core.h" 5 6 /** @addtogroup LHAL 7 * @{ 8 */ 9 10 /** @addtogroup CKS 11 * @{ 12 */ 13 14 /** @defgroup CKS_ENDIAN cks endian definition 15 * @{ 16 */ 17 #define CKS_LITTLE_ENDIAN 0 18 #define CKS_BIG_ENDIAN 1 19 /** 20 * @} 21 */ 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 /** 28 * @brief Reset checksum module. 29 * 30 * @param [in] dev device handle 31 */ 32 void bflb_cks_reset(struct bflb_device_s *dev); 33 34 /** 35 * @brief Set checksum bitorder. 36 * 37 * @param [in] dev device handle 38 * @param [in] endian cks endian, use @ref CKS_ENDIAN 39 */ 40 void bflb_cks_set_endian(struct bflb_device_s *dev, uint8_t endian); 41 42 /** 43 * @brief Compute data with checksum. 44 * 45 * @param [in] dev device handle 46 * @param [in] data input data buffer 47 * @param [in] length data length 48 * @return checksum value 49 */ 50 uint16_t bflb_cks_compute(struct bflb_device_s *dev, uint8_t *data, uint32_t length); 51 52 #ifdef __cplusplus 53 } 54 #endif 55 56 /** 57 * @} 58 */ 59 60 /** 61 * @} 62 */ 63 64 #endif 65