OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [Common/] [drivers/] [ST/] [STM32F10xFWLib/] [src/] [stm32f10x_crc.c] - Blame information for rev 608

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 608 jeremybenn
/**
2
  ******************************************************************************
3
  * @file  stm32f10x_crc.c
4
  * @author  MCD Application Team
5
  * @version  V3.0.0
6
  * @date  04/06/2009
7
  * @brief  This file provides all the CRC firmware functions.
8
  ******************************************************************************
9
  * @copy
10
  *
11
  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
12
  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
13
  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
14
  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
15
  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
16
  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
17
  *
18
  * <h2><center>&copy; COPYRIGHT 2009 STMicroelectronics</center></h2>
19
  */
20
 
21
/* Includes ------------------------------------------------------------------*/
22
#include "stm32f10x_crc.h"
23
 
24
/** @addtogroup StdPeriph_Driver
25
  * @{
26
  */
27
 
28
/** @defgroup CRC
29
  * @brief CRC driver modules
30
  * @{
31
  */
32
 
33
/** @defgroup CRC_Private_TypesDefinitions
34
  * @{
35
  */
36
 
37
/**
38
  * @}
39
  */
40
 
41
/** @defgroup CRC_Private_Defines
42
  * @{
43
  */
44
 
45
/* CR register bit mask */
46
 
47
#define CR_RESET_Set    ((uint32_t)0x00000001)
48
 
49
/**
50
  * @}
51
  */
52
 
53
/** @defgroup CRC_Private_Macros
54
  * @{
55
  */
56
 
57
/**
58
  * @}
59
  */
60
 
61
/** @defgroup CRC_Private_Variables
62
  * @{
63
  */
64
 
65
/**
66
  * @}
67
  */
68
 
69
/** @defgroup CRC_Private_FunctionPrototypes
70
  * @{
71
  */
72
 
73
/**
74
  * @}
75
  */
76
 
77
/** @defgroup CRC_Private_Functions
78
  * @{
79
  */
80
 
81
/**
82
  * @brief  Resets the CRC Data register (DR).
83
  * @param  None
84
  * @retval : None
85
  */
86
void CRC_ResetDR(void)
87
{
88
  /* Reset CRC generator */
89
  CRC->CR = CR_RESET_Set;
90
}
91
 
92
/**
93
  * @brief  Computes the 32-bit CRC of a given data word(32-bit).
94
  * @param Data: data word(32-bit) to compute its CRC
95
  * @retval : 32-bit CRC
96
  */
97
uint32_t CRC_CalcCRC(uint32_t Data)
98
{
99
  CRC->DR = Data;
100
 
101
  return (CRC->DR);
102
}
103
 
104
/**
105
  * @brief  Computes the 32-bit CRC of a given buffer of data word(32-bit).
106
  * @param pBuffer: pointer to the buffer containing the data to be
107
  *   computed
108
  * @param BufferLength: length of the buffer to be computed
109
  * @retval : 32-bit CRC
110
  */
111
uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength)
112
{
113
  uint32_t index = 0;
114
 
115
  for(index = 0; index < BufferLength; index++)
116
  {
117
    CRC->DR = pBuffer[index];
118
  }
119
  return (CRC->DR);
120
}
121
 
122
/**
123
  * @brief  Returns the current CRC value.
124
  * @param  None
125
  * @retval : 32-bit CRC
126
  */
127
uint32_t CRC_GetCRC(void)
128
{
129
  return (CRC->DR);
130
}
131
 
132
/**
133
  * @brief  Stores a 8-bit data in the Independent Data(ID) register.
134
  * @param IDValue: 8-bit value to be stored in the ID register
135
  * @retval : None
136
  */
137
void CRC_SetIDRegister(uint8_t IDValue)
138
{
139
  CRC->IDR = IDValue;
140
}
141
 
142
/**
143
  * @brief  Returns the 8-bit data stored in the Independent Data(ID) register
144
  * @param  None
145
  * @retval : 8-bit value of the ID register
146
  */
147
uint8_t CRC_GetIDRegister(void)
148
{
149
  return (CRC->IDR);
150
}
151
 
152
/**
153
  * @}
154
  */
155
 
156
/**
157
  * @}
158
  */
159
 
160
/**
161
  * @}
162
  */
163
 
164
/******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.