[F0] Update CRCto be compatible wih RM0091 Rev. 5

This commit is contained in:
Frantisek Burian 2014-02-05 23:48:33 +01:00
parent fc9a7260c2
commit 9c0ca88c2e
2 changed files with 35 additions and 2 deletions

View File

@ -37,7 +37,13 @@ specific memorymap.h header before including this header file.*/
#include <libopencm3/cm3/common.h>
/* --- CRC registers ------------------------------------------------------- */
/*****************************************************************************/
/* Module definitions */
/*****************************************************************************/
/*****************************************************************************/
/* Register definitions */
/*****************************************************************************/
/* Data register (CRC_DR) */
#define CRC_DR MMIO32(CRC_BASE + 0x00)
@ -48,6 +54,10 @@ specific memorymap.h header before including this header file.*/
/* Control register (CRC_CR) */
#define CRC_CR MMIO32(CRC_BASE + 0x08)
/*****************************************************************************/
/* Register values */
/*****************************************************************************/
/* --- CRC_DR values ------------------------------------------------------- */
/* Bits [31:0]: Data register */
@ -65,7 +75,13 @@ specific memorymap.h header before including this header file.*/
/* RESET bit */
#define CRC_CR_RESET (1 << 0)
/* --- CRC function prototypes --------------------------------------------- */
/*****************************************************************************/
/* API definitions */
/*****************************************************************************/
/*****************************************************************************/
/* API Functions */
/*****************************************************************************/
BEGIN_DECLS

View File

@ -45,11 +45,18 @@
/* Register definitions */
/*****************************************************************************/
/* Initial CRC Value */
#define CRC_INIT MMIO32(CRC_BASE + 0x10)
/* CRC Polynomial */
#define CRC_POL MMIO32(CRC_BASE + 0x14)
/*****************************************************************************/
/* Register values */
/*****************************************************************************/
#define CRC_CR_REV_OUT (1 << 7)
#define CRC_CR_REV_IN_SHIFT 5
#define CRC_CR_REV_IN (3 << CRC_CR_REV_IN_SHIFT)
#define CRC_CR_REV_IN_NONE (0 << CRC_CR_REV_IN_SHIFT)
@ -57,6 +64,16 @@
#define CRC_CR_REV_IN_HALF (2 << CRC_CR_REV_IN_SHIFT)
#define CRC_CR_REV_IN_WORD (3 << CRC_CR_REV_IN_SHIFT)
#define CRC_CR_POLYSIZE_SHIFT 3
#define CRC_CR_POLYSIZE (3 << CRC_CR_POLYSIZE_SHIFT)
#define CRC_CR_POLYSIZE_32BIT (0 << CRC_CR_POLYSIZE_SHIFT)
#define CRC_CR_POLYSIZE_16BIT (1 << CRC_CR_POLYSIZE_SHIFT)
#define CRC_CR_POLYSIZE_8BIT (2 << CRC_CR_POLYSIZE_SHIFT)
#define CRC_CR_POLYSIZE_7BIT (3 << CRC_CR_POLYSIZE_SHIFT)
/* Default polynomial */
#define CRC_POL_DEFAULT 0x04C11DB7
/*****************************************************************************/
/* API definitions */
/*****************************************************************************/