summaryrefslogtreecommitdiff
path: root/bsp/bouffalo_lab/libraries/bl_mcu_sdk/drivers/lhal/include/bflb_cks.h
blob: eb68b49e7ecf6bba14fdba90e29e3c6effd7dc0f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#ifndef _BFLB_CKS_H
#define _BFLB_CKS_H

#include "bflb_core.h"

/** @addtogroup LHAL
  * @{
  */

/** @addtogroup CKS
  * @{
  */

/** @defgroup CKS_ENDIAN cks endian definition
  * @{
  */
#define CKS_LITTLE_ENDIAN 0
#define CKS_BIG_ENDIAN    1
/**
  * @}
  */

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @brief Reset checksum module.
 *
 * @param [in] dev device handle
 */
void bflb_cks_reset(struct bflb_device_s *dev);

/**
 * @brief Set checksum bitorder.
 *
 * @param [in] dev device handle
 * @param [in] endian cks endian, use @ref CKS_ENDIAN
 */
void bflb_cks_set_endian(struct bflb_device_s *dev, uint8_t endian);

/**
 * @brief Compute data with checksum.
 *
 * @param [in] dev device handle
 * @param [in] data input data buffer
 * @param [in] length data length
 * @return checksum value
 */
uint16_t bflb_cks_compute(struct bflb_device_s *dev, uint8_t *data, uint32_t length);

#ifdef __cplusplus
}
#endif

/**
  * @}
  */

/**
  * @}
  */

#endif