/**
 * \file    drv_crc.h
 * \brief   Hardware CRC operations
 *
 * \par     Copyright (c) 2018 UWE Technologies Corp., Ltd. All Rights Reserved.
 * \author  James
 * \date    2018-10-27
 * \version 
 * 
 * \history 
 *  Date        Note
 *  2018-10-27  Original Creation
 * 
 */
 
#ifndef __DRV_CRC_H_
#define __DRV_CRC_H_

#include "types.h"

/** \brief CRC8, x^8 + x^5 + x^4 + x^3 + 1
 *
 * \param buf   The pointer of input data buffer
 * \param len   Length of the data buffer
 * \return      CRC result
 */
u8_t drv_crc8(const u8_t *buf, int len);
u8_t drv_crc8_msb(u8_t init, const u8_t *buf, int len);

/** \brief CRC16, x^16 + x^15 + x^2 + 1
 *
 * \param buf   The pointer of input data buffer
 * \param len   Length of the data buffer
 * \return      CRC result
 */
u16_t drv_crc16(const u8_t *buf, int len);

/** \brief CRC32, x^32 + x^26 + x^23 + x^22 + x^16 + x^12 + x^11 + x^10 + x^8 + x^7 + x^5 + x^4 + x^2 + x^1 + 1
 *
 * \param crc   CRC initial value
 * \param buf   The pointer of input data buffer
 * \param len   Length of the data buffer
 * \return      CRC result
 */
u32_t drv_crc32(u32_t crc, const void *buf, int len);

/** \brief CRC16, x^16 + x^15 + x^2 + 1
 * \param init  init data
 * \param buf   The pointer of input data buffer
 * \param len   Length of the data buffer
 * \return      CRC result
 */

u16_t drv_crc16_8005_add(u32_t crc,const u8_t *buf, int len);


#endif /* #ifndef __DRV_CRC_H_ */


