STM32F10x_StdPeriph_Examples/CRC/main.c

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    Examples/CRC/main.c 
00004   * @author  MCD Application Team
00005   * @version V3.4.0
00006   * @date    10/15/2010
00007   * @brief   Main program body.
00008   ******************************************************************************
00009   * @copy
00010   *
00011   * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
00012   * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
00013   * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
00014   * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
00015   * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
00016   * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
00017   *
00018   * <h2><center>&copy; COPYRIGHT 2010 STMicroelectronics</center></h2>
00019   */ 
00020 
00021 /* Includes ------------------------------------------------------------------*/
00022 #include "stm32f10x.h"
00023 
00024 /** @addtogroup STM32F10x_StdPeriph_Examples
00025   * @{
00026   */
00027 
00028 /** @addtogroup CRC_Example
00029   * @{
00030   */ 
00031 
00032 /* Private typedef -----------------------------------------------------------*/
00033 /* Private define ------------------------------------------------------------*/
00034 #define BUFFER_SIZE    114
00035 
00036 /* Private macro -------------------------------------------------------------*/
00037 /* Private variables ---------------------------------------------------------*/
00038 static const uint32_t DataBuffer[BUFFER_SIZE] =
00039   {
00040     0x00001021, 0x20423063, 0x408450a5, 0x60c670e7, 0x9129a14a, 0xb16bc18c,
00041     0xd1ade1ce, 0xf1ef1231, 0x32732252, 0x52b54294, 0x72f762d6, 0x93398318,
00042     0xa35ad3bd, 0xc39cf3ff, 0xe3de2462, 0x34430420, 0x64e674c7, 0x44a45485,
00043     0xa56ab54b, 0x85289509, 0xf5cfc5ac, 0xd58d3653, 0x26721611, 0x063076d7,
00044     0x569546b4, 0xb75ba77a, 0x97198738, 0xf7dfe7fe, 0xc7bc48c4, 0x58e56886,
00045     0x78a70840, 0x18612802, 0xc9ccd9ed, 0xe98ef9af, 0x89489969, 0xa90ab92b,
00046     0x4ad47ab7, 0x6a961a71, 0x0a503a33, 0x2a12dbfd, 0xfbbfeb9e, 0x9b798b58,
00047     0xbb3bab1a, 0x6ca67c87, 0x5cc52c22, 0x3c030c60, 0x1c41edae, 0xfd8fcdec,
00048     0xad2abd0b, 0x8d689d49, 0x7e976eb6, 0x5ed54ef4, 0x2e321e51, 0x0e70ff9f,
00049     0xefbedfdd, 0xcffcbf1b, 0x9f598f78, 0x918881a9, 0xb1caa1eb, 0xd10cc12d,
00050     0xe16f1080, 0x00a130c2, 0x20e35004, 0x40257046, 0x83b99398, 0xa3fbb3da,
00051     0xc33dd31c, 0xe37ff35e, 0x129022f3, 0x32d24235, 0x52146277, 0x7256b5ea,
00052     0x95a88589, 0xf56ee54f, 0xd52cc50d, 0x34e224c3, 0x04817466, 0x64475424,
00053     0x4405a7db, 0xb7fa8799, 0xe75ff77e, 0xc71dd73c, 0x26d336f2, 0x069116b0,
00054     0x76764615, 0x5634d94c, 0xc96df90e, 0xe92f99c8, 0xb98aa9ab, 0x58444865,
00055     0x78066827, 0x18c008e1, 0x28a3cb7d, 0xdb5ceb3f, 0xfb1e8bf9, 0x9bd8abbb,
00056     0x4a755a54, 0x6a377a16, 0x0af11ad0, 0x2ab33a92, 0xed0fdd6c, 0xcd4dbdaa,
00057     0xad8b9de8, 0x8dc97c26, 0x5c644c45, 0x3ca22c83, 0x1ce00cc1, 0xef1fff3e,
00058     0xdf7caf9b, 0xbfba8fd9, 0x9ff86e17, 0x7e364e55, 0x2e933eb2, 0x0ed11ef0
00059   };
00060 
00061 __IO uint32_t CRCValue = 0;
00062 
00063 /* Private function prototypes -----------------------------------------------*/
00064 void Delay(__IO uint32_t nCount);
00065 
00066 /* Private functions ---------------------------------------------------------*/
00067 
00068 /**
00069   * @brief  Main program.
00070   * @param  None
00071   * @retval None
00072   */
00073 int main(void)
00074 {
00075   /*!< At this stage the microcontroller clock setting is already configured, 
00076        this is done through SystemInit() function which is called from startup
00077        file (startup_stm32f10x_xx.s) before to branch to application main.
00078        To reconfigure the default setting of SystemInit() function, refer to
00079        system_stm32f10x.c file
00080      */     
00081        
00082   /* Enable CRC clock */
00083   RCC_AHBPeriphClockCmd(RCC_AHBPeriph_CRC, ENABLE);
00084 
00085   /* Compute the CRC of "DataBuffer" */
00086   CRCValue = CRC_CalcBlockCRC((uint32_t *)DataBuffer, BUFFER_SIZE);
00087 
00088   while (1)
00089   {
00090   }
00091 }
00092 
00093 /**
00094   * @brief  Inserts a delay time.
00095   * @param  nCount: specifies the delay time length.
00096   * @retval None
00097   */
00098 void Delay(__IO uint32_t nCount)
00099 {
00100   for(; nCount != 0; nCount--);
00101 }
00102 
00103 #ifdef  USE_FULL_ASSERT
00104 
00105 /**
00106   * @brief  Reports the name of the source file and the source line number
00107   *         where the assert_param error has occurred.
00108   * @param  file: pointer to the source file name
00109   * @param  line: assert_param error line source number
00110   * @retval None
00111   */
00112 void assert_failed(uint8_t* file, uint32_t line)
00113 { 
00114   /* User can add his own implementation to report the file name and line number,
00115      ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
00116 
00117   /* Infinite loop */
00118   while (1)
00119   {
00120   }
00121 }
00122 #endif
00123 
00124 /**
00125   * @}
00126   */ 
00127 
00128 /**
00129   * @}
00130   */ 
00131 
00132 /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/
STM32F10x Standard Peripherals Library: Footer

 

 

 

      For complete documentation on STM32(CORTEX M3) 32-bit Microcontrollers platform visit  www.st.com/STM32