lpc_crc.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /**********************************************************************
  2. * $Id$ lpc_crc.h 2011-06-02
  3. *//**
  4. * @file lpc_crc.h
  5. * @brief Contains all macro definitions and function prototypes
  6. * support for CRC firmware library on LPC
  7. * @version 1.0
  8. * @date 02. June. 2011
  9. * @author NXP MCU SW Application Team
  10. *
  11. * Copyright(C) 2011, NXP Semiconductor
  12. * All rights reserved.
  13. *
  14. ***********************************************************************
  15. * Software that is described herein is for illustrative purposes only
  16. * which provides customers with programming information regarding the
  17. * products. This software is supplied "AS IS" without any warranties.
  18. * NXP Semiconductors assumes no responsibility or liability for the
  19. * use of the software, conveys no license or title under any patent,
  20. * copyright, or mask work right to the product. NXP Semiconductors
  21. * reserves the right to make changes in the software without
  22. * notification. NXP Semiconductors also make no representation or
  23. * warranty that such application will be suitable for the specified
  24. * use without further testing or modification.
  25. * Permission to use, copy, modify, and distribute this software and its
  26. * documentation is hereby granted, under NXP Semiconductors'
  27. * relevant copyright in the software, without fee, provided that it
  28. * is used in conjunction with NXP Semiconductors microcontrollers. This
  29. * copyright, permission, and disclaimer notice must appear in all copies of
  30. * this code.
  31. **********************************************************************/
  32. /* Peripheral group ----------------------------------------------------------- */
  33. /** @defgroup CRC CRC (Cyclic Redundancy Check)
  34. * @ingroup LPC_CMSIS_FwLib_Drivers
  35. * @{
  36. */
  37. #ifndef __LPC__CRC_H_
  38. #define __LPC__CRC_H_
  39. /* Includes ------------------------------------------------------------------- */
  40. #include "LPC407x_8x_177x_8x.h"
  41. #include "lpc_types.h"
  42. #ifdef __cplusplus
  43. extern "C"
  44. {
  45. #endif
  46. /* Private macros ------------------------------------------------------------- */
  47. /** @defgroup CRC_Private_Macros CRC Private Macros
  48. * @{
  49. */
  50. /* -------------------------- BIT DEFINITIONS ----------------------------------- */
  51. /*********************************************************************//**
  52. * Macro defines for CRC mode register
  53. **********************************************************************/
  54. #define CRC_BIT_RVS_WR (1<<2)
  55. #define CRC_CMPL_WR (1<<3)
  56. #define CRC_BIT_RVS_SUM (1<<4)
  57. #define CRC_CMPL_SUM (1<<5)
  58. /**
  59. * @}
  60. */
  61. /* Private types ------------------------------------------------------------- */
  62. typedef enum
  63. {
  64. CRC_POLY_CRCCCITT = 0, /** CRC CCITT polynomial */
  65. CRC_POLY_CRC16, /** CRC-16 polynomial */
  66. CRC_POLY_CRC32 /** CRC-32 polynomial */
  67. }CRC_Type;
  68. typedef enum
  69. {
  70. CRC_WR_8BIT = 1, /** 8-bit write: 1-cycle operation */
  71. CRC_WR_16BIT = 2, /** 16-bit write: 2-cycle operation */
  72. CRC_WR_32BIT = 4, /** 32-bit write: 4-cycle operation */
  73. }CRC_WR_SIZE;
  74. /* Public Functions ----------------------------------------------------------- */
  75. /** @defgroup CRC_Public_Functions CRC Public Functions
  76. * @{
  77. */
  78. void CRC_Init(CRC_Type CRCType);
  79. void CRC_Reset(void);
  80. uint32_t CRC_CalcDataChecksum(uint32_t data, CRC_WR_SIZE SizeType);
  81. uint32_t CRC_CalcBlockChecksum(void *blockdata, uint32_t blocksize, CRC_WR_SIZE SizeType);
  82. /**
  83. * @}
  84. */
  85. #ifdef __cplusplus
  86. }
  87. #endif
  88. #endif /* __LPC_CRC_H_ */
  89. /**
  90. * @}
  91. */
  92. /* --------------------------------- End Of File ------------------------------ */