diff options
| author | iperry <iperry@749a229e-a60e-11de-b98f-4500b42dc123> | 2009-12-17 02:37:07 +0000 | 
|---|---|---|
| committer | iperry <iperry@749a229e-a60e-11de-b98f-4500b42dc123> | 2009-12-17 02:37:07 +0000 | 
| commit | 32e57dac2e61e79b029593eb4d34d727bcc10678 (patch) | |
| tree | 98d7ff41993576bb150d13d5f63dc744f6812852 /src/stm32lib/examples/SPI/M25P64_FLASH | |
| download | librambutan-32e57dac2e61e79b029593eb4d34d727bcc10678.tar.gz librambutan-32e57dac2e61e79b029593eb4d34d727bcc10678.zip  | |
Initial commit of library code, moved from leaftest repo
git-svn-id: https://leaflabs.googlecode.com/svn/trunk/library@69 749a229e-a60e-11de-b98f-4500b42dc123
Diffstat (limited to 'src/stm32lib/examples/SPI/M25P64_FLASH')
| -rwxr-xr-x | src/stm32lib/examples/SPI/M25P64_FLASH/main.c | 264 | ||||
| -rwxr-xr-x | src/stm32lib/examples/SPI/M25P64_FLASH/platform_config.h | 44 | ||||
| -rwxr-xr-x | src/stm32lib/examples/SPI/M25P64_FLASH/readme.txt | 99 | ||||
| -rwxr-xr-x | src/stm32lib/examples/SPI/M25P64_FLASH/spi_flash.c | 482 | ||||
| -rwxr-xr-x | src/stm32lib/examples/SPI/M25P64_FLASH/spi_flash.h | 68 | ||||
| -rwxr-xr-x | src/stm32lib/examples/SPI/M25P64_FLASH/stm32f10x_conf.h | 170 | ||||
| -rwxr-xr-x | src/stm32lib/examples/SPI/M25P64_FLASH/stm32f10x_it.c | 741 | ||||
| -rwxr-xr-x | src/stm32lib/examples/SPI/M25P64_FLASH/stm32f10x_it.h | 100 | 
8 files changed, 1968 insertions, 0 deletions
diff --git a/src/stm32lib/examples/SPI/M25P64_FLASH/main.c b/src/stm32lib/examples/SPI/M25P64_FLASH/main.c new file mode 100755 index 0000000..b267d3d --- /dev/null +++ b/src/stm32lib/examples/SPI/M25P64_FLASH/main.c @@ -0,0 +1,264 @@ +/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
 +* File Name          : main.c
 +* Author             : MCD Application Team
 +* Version            : V2.0.1
 +* Date               : 06/13/2008
 +* Description        : Main program body
 +********************************************************************************
 +* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
 +* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
 +* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
 +* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
 +* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
 +* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
 +*******************************************************************************/
 +
 +/* Includes ------------------------------------------------------------------*/
 +#include "platform_config.h"
 +#include "spi_flash.h"
 +
 +/* Local includes ------------------------------------------------------------*/
 +/* Private typedef -----------------------------------------------------------*/
 +typedef enum {FAILED = 0, PASSED = !FAILED} TestStatus;
 +
 +/* Private define ------------------------------------------------------------*/
 +#define  FLASH_WriteAddress     0x700000
 +#define  FLASH_ReadAddress      FLASH_WriteAddress
 +#define  FLASH_SectorToErase    FLASH_WriteAddress
 +#define  M25P64_FLASH_ID        0x202017
 +#define  BufferSize (countof(Tx_Buffer)-1)
 +
 +/* Private macro -------------------------------------------------------------*/
 +#define countof(a) (sizeof(a) / sizeof(*(a)))
 +
 +/* Private variables ---------------------------------------------------------*/
 +u8 Tx_Buffer[] = "STM32F10x SPI Firmware Library Example: communication with an M25P64 SPI FLASH";
 +u8 Index, Rx_Buffer[BufferSize];
 +volatile TestStatus TransferStatus1 = FAILED, TransferStatus2 = PASSED;
 +vu32 FLASH_ID = 0;
 +ErrorStatus HSEStartUpStatus;
 +
 +/* Private functions ---------------------------------------------------------*/
 +TestStatus Buffercmp(u8* pBuffer1, u8* pBuffer2, u16 BufferLength);
 +void RCC_Configuration(void);
 +void GPIO_Configuration(void);
 +void NVIC_Configuration(void);
 +
 +
 +/*******************************************************************************
 +* Function Name  : main
 +* Description    : Main program
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +int main(void)
 +{
 +#ifdef DEBUG
 +  debug();
 +#endif
 +
 +  /* System clocks configuration */
 +  RCC_Configuration();
 +
 +  /* NVIC configuration */
 +  NVIC_Configuration();
 +
 +  /* GPIO configuration */
 +  GPIO_Configuration();
 +
 +  /* Initialize the SPI FLASH driver */
 +  SPI_FLASH_Init();
 +
 +  /* Get SPI Flash ID */
 +  FLASH_ID = SPI_FLASH_ReadID();
 +  /* Check the SPI Flash ID */
 +  if (FLASH_ID == M25P64_FLASH_ID)
 +  {
 +    /* OK: Set GPIO_LED pin 6 */
 +    GPIO_WriteBit(GPIO_LED, GPIO_Pin_6, Bit_SET);
 +  }
 +  else
 +  {
 +    /* Error: Set GPIO_LED pin 7 */
 +    GPIO_WriteBit(GPIO_LED, GPIO_Pin_7, Bit_SET);
 +  }
 +
 +  /* Perform a write in the Flash followed by a read of the written data */
 +  /* Erase SPI FLASH Sector to write on */
 +  SPI_FLASH_SectorErase(FLASH_SectorToErase);
 +
 +  /* Write Tx_Buffer data to SPI FLASH memory */
 +  SPI_FLASH_BufferWrite(Tx_Buffer, FLASH_WriteAddress, BufferSize);
 +
 +  /* Read data from SPI FLASH memory */
 +  SPI_FLASH_BufferRead(Rx_Buffer, FLASH_ReadAddress, BufferSize);
 +
 +  /* Check the corectness of written dada */
 +  TransferStatus1 = Buffercmp(Tx_Buffer, Rx_Buffer, BufferSize);
 +  /* TransferStatus1 = PASSED, if the transmitted and received data by SPI1
 +     are the same */
 +  /* TransferStatus1 = FAILED, if the transmitted and received data by SPI1
 +     are different */
 +
 +  /* Perform an erase in the Flash followed by a read of the written data */
 +  /* Erase SPI FLASH Sector to write on */
 +  SPI_FLASH_SectorErase(FLASH_SectorToErase);
 +
 +  /* Read data from SPI FLASH memory */
 +  SPI_FLASH_BufferRead(Rx_Buffer, FLASH_ReadAddress, BufferSize);
 +
 +  /* Check the corectness of erasing operation dada */
 +  for (Index = 0; Index < BufferSize; Index++)
 +  {
 +    if (Rx_Buffer[Index] != 0xFF)
 +    {
 +      TransferStatus2 = FAILED;
 +    }
 +  }
 +  /* TransferStatus2 = PASSED, if the specified sector part is erased */
 +  /* TransferStatus2 = FAILED, if the specified sector part is not well erased  */
 +
 +  while (1)
 +  {}
 +}
 +
 +/*******************************************************************************
 +* Function Name  : RCC_Configuration
 +* Description    : Configures the different system clocks.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void RCC_Configuration(void)
 +{
 +  /* RCC system reset(for debug purpose) */
 +  RCC_DeInit();
 +
 +  /* Enable HSE */
 +  RCC_HSEConfig(RCC_HSE_ON);
 +
 +  /* Wait till HSE is ready */
 +  HSEStartUpStatus = RCC_WaitForHSEStartUp();
 +
 +  if (HSEStartUpStatus == SUCCESS)
 +  {
 +    /* Enable Prefetch Buffer */
 +    FLASH_PrefetchBufferCmd(FLASH_PrefetchBuffer_Enable);
 +
 +    /* Flash 2 wait state */
 +    FLASH_SetLatency(FLASH_Latency_2);
 +
 +    /* HCLK = SYSCLK */
 +    RCC_HCLKConfig(RCC_SYSCLK_Div1);
 +
 +    /* PCLK2 = HCLK */
 +    RCC_PCLK2Config(RCC_HCLK_Div1);
 +
 +    /* PCLK1 = HCLK/2 */
 +    RCC_PCLK1Config(RCC_HCLK_Div2);
 +
 +    /* PLLCLK = 8MHz * 9 = 72 MHz */
 +    RCC_PLLConfig(RCC_PLLSource_HSE_Div1, RCC_PLLMul_9);
 +
 +    /* Enable PLL */
 +    RCC_PLLCmd(ENABLE);
 +
 +    /* Wait till PLL is ready */
 +    while (RCC_GetFlagStatus(RCC_FLAG_PLLRDY) == RESET)
 +    {}
 +
 +    /* Select PLL as system clock source */
 +    RCC_SYSCLKConfig(RCC_SYSCLKSource_PLLCLK);
 +
 +    /* Wait till PLL is used as system clock source */
 +    while (RCC_GetSYSCLKSource() != 0x08)
 +    {}
 +  }
 +
 +  /* Enable GPIO_LED clock */
 +  RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIO_LED, ENABLE);
 +}
 +
 +/*******************************************************************************
 +* Function Name  : GPIO_Configuration
 +* Description    : Configures the different GPIO ports.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void GPIO_Configuration(void)
 +{
 +  GPIO_InitTypeDef GPIO_InitStructure;
 +
 +  /* Configure GPIO LED pin6 and pin7 as Output push-pull --------------------*/
 +  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_6 | GPIO_Pin_7;
 +  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
 +  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
 +  GPIO_Init(GPIO_LED, &GPIO_InitStructure);
 +}
 +
 +/*******************************************************************************
 +* Function Name  : NVIC_Configuration
 +* Description    : Configures Vector Table base location.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void NVIC_Configuration(void)
 +{
 +#ifdef  VECT_TAB_RAM
 +  /* Set the Vector Table base location at 0x20000000 */
 +  NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0);
 +#else  /* VECT_TAB_FLASH  */
 +  /* Set the Vector Table base location at 0x08000000 */
 +  NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0);
 +#endif
 +}
 +
 +/*******************************************************************************
 +* Function Name  : Buffercmp
 +* Description    : Compares two buffers.
 +* Input          : - pBuffer1, pBuffer2: buffers to be compared.
 +*                : - BufferLength: buffer's length
 +* Output         : None
 +* Return         : PASSED: pBuffer1 identical to pBuffer2
 +*                  FAILED: pBuffer1 differs from pBuffer2
 +*******************************************************************************/
 +TestStatus Buffercmp(u8* pBuffer1, u8* pBuffer2, u16 BufferLength)
 +{
 +  while (BufferLength--)
 +  {
 +    if (*pBuffer1 != *pBuffer2)
 +    {
 +      return FAILED;
 +    }
 +
 +    pBuffer1++;
 +    pBuffer2++;
 +  }
 +
 +  return PASSED;
 +}
 +
 +#ifdef  DEBUG
 +/*******************************************************************************
 +* Function Name  : assert_failed
 +* Description    : Reports the name of the source file and the source line number
 +*                  where the assert_param error has occurred.
 +* Input          : - file: pointer to the source file name
 +*                  - line: assert_param error line source number
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void assert_failed(u8* file, u32 line)
 +{
 +  /* User can add his own implementation to report the file name and line number,
 +     ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
 +
 +  /* Infinite loop */
 +  while (1)
 +  {}
 +}
 +#endif
 +/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
 diff --git a/src/stm32lib/examples/SPI/M25P64_FLASH/platform_config.h b/src/stm32lib/examples/SPI/M25P64_FLASH/platform_config.h new file mode 100755 index 0000000..3b73964 --- /dev/null +++ b/src/stm32lib/examples/SPI/M25P64_FLASH/platform_config.h @@ -0,0 +1,44 @@ +/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
 +* File Name          : platform_config.h
 +* Author             : MCD Application Team
 +* Version            : V2.0.1
 +* Date               : 06/13/2008
 +* Description        : Evaluation board specific configuration file.
 +********************************************************************************
 +* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
 +* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
 +* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
 +* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
 +* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
 +* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
 +*******************************************************************************/
 +
 +/* Define to prevent recursive inclusion -------------------------------------*/
 +#ifndef __PLATFORM_CONFIG_H
 +#define __PLATFORM_CONFIG_H
 +
 +/* Includes ------------------------------------------------------------------*/
 +/* Exported types ------------------------------------------------------------*/
 +/* Exported constants --------------------------------------------------------*/
 +/* Uncomment the line corresponding to the STMicroelectronics evaluation board
 +   used to run the example */
 +#if !defined (USE_STM3210B_EVAL) &&  !defined (USE_STM3210E_EVAL)
 +//#define USE_STM3210B_EVAL
 +#define USE_STM3210E_EVAL
 +#endif
 +
 +/* Define the STM32F10x hardware depending on the used evaluation board */
 +#ifdef USE_STM3210B_EVAL
 +  #define GPIO_LED                          GPIOC
 +  #define RCC_APB2Periph_GPIO_LED           RCC_APB2Periph_GPIOC
 +#elif defined USE_STM3210E_EVAL
 +  #define GPIO_LED                          GPIOF
 +  #define RCC_APB2Periph_GPIO_LED           RCC_APB2Periph_GPIOF
 +#endif /* USE_STM3210B_EVAL */
 +
 +/* Exported macro ------------------------------------------------------------*/
 +/* Exported functions ------------------------------------------------------- */
 +
 +#endif /* __PLATFORM_CONFIG_H */
 +
 +/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
 diff --git a/src/stm32lib/examples/SPI/M25P64_FLASH/readme.txt b/src/stm32lib/examples/SPI/M25P64_FLASH/readme.txt new file mode 100755 index 0000000..d29c571 --- /dev/null +++ b/src/stm32lib/examples/SPI/M25P64_FLASH/readme.txt @@ -0,0 +1,99 @@ +/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
 +* File Name          : readme.txt
 +* Author             : MCD Application Team
 +* Version            : V2.0.1
 +* Date               : 06/13/2008
 +* Description        : Description of the SPI M25P64_Flash Example.
 +********************************************************************************
 +* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
 +* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
 +* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
 +* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
 +* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
 +* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
 +*******************************************************************************/
 +
 +Example description
 +===================
 +This example provides a basic example of how to use the SPI firmware library
 +and an associate SPI FLASH driver to communicate with an M25P64 FLASH.
 +
 +The first step consist in reading the SPI Flash ID. A comparison between the ID 
 +read from SPI flash and the expected one is done and a specific GPIO pin is set 
 +in case of success otherwise this GPIO pin is reset.  
 +
 +Using this driver the program performs an erase of the sector to be accessed, a 
 +write of a Tx_Buffer, defined in the main.c file, to the memory followed by a read
 +of the written data. Then data read from the memory stored in the Rx_Buffer are
 +compared with the expected values of the Tx_Buffer. The result of this comparison
 +is stored in the "TransferStatus1" variable.
 +
 +A second erase of the same sector is done at the end, and a test is done to be
 +sure that all the data written there are erased further to the sector erase. All
 +the data location are read and checked with 0xFF value. The result of this test
 +is stored in "TransferStatus2" variable which is FAILED in case of error.
 +
 +The SPI1 is configured as Master with an 8bits data size. A GPIO pin is used
 +as output push-pull to drive the SPI Flash chip select pin.  
 +The FLASH_WriteAddress and the FLASH_ReadAddress where the program start the write 
 +and the read operations are defined in the main.c file. 
 +The system clock is set to 72MHz and SPI1 baudrate to 18 Mbit/s.
 +
 +
 +Directory contents
 +==================
 +platform_config.h    Evaluation board specific configuration file
 +stm32f10x_conf.h     Library Configuration file
 +stm32f10x_it.c       Interrupt handlers
 +stm32f10x_it.h       Header for stm32f10x_it.c
 +main.c               Main program
 +spi_flash.c          SPI FLASH driver
 +spi_flash.h          Header for the spi_flash.c file
 +
 +
 +Hardware environment
 +====================
 +This example runs on STMicroelectronics STM3210B-EVAL and STM3210E-EVAL evaluation
 +boards and can be easily tailored to any other hardware.
 +To select the STMicroelectronics evaluation board used to run the example, uncomment
 +the corresponding line in platform_config.h and spi_flash.h files.
 +
 + + STM3210B-EVAL 
 +    - Use LD1 and LD2 leds connected respectively to PC.06 and PC.07 pins
 + 
 + + STM3210E-EVAL
 +    - Use LD1 and LD2 leds connected respectively to PF.06 and PF.07 pins
 +
 +On the STMicroelectronics STM3210B-EVAL and STM3210E-EVAL evaluation boards, this 
 +SPI Flash is already available and there is no need to any extra hardware connections. 
 +
 +If a different platform is used:
 + - Connect both SPI1 and SPI FLASH pins as following:
 +    - Connect SPI1_NSS (PA.04) pin to SPI Flash chip select (pin1) and use the 
 +        STM3210B-EVAL hardware configuration defines.
 +    - Connect SPI1_SCLK (PA.05) pin to SPI Flash serial clock (pin6).
 +    - Connect SPI1_MISO (PA.06) pin to SPI Flash serial data output (pin2).
 +    - Connect SPI1_MOSI (PA.07) pin to SPI Flash serial data input (pin5).
 +    - Connect SPI Flash Write Protect (pin3) to Vdd
 +    - Connect SPI Flash Hold (pin7) to Vdd
 +    - Connect SPI Flash Vcc (pin8) to Vdd
 +    - Connect SPI Flash Vss (pin4) to Vss
 +
 +
 +How to use it
 +=============
 +In order to make the program work, you must do the following :
 +- Create a project and setup all your toolchain's start-up files
 +- Compile the directory content files and required Library files :
 +  + stm32f10x_lib.c
 +  + stm32f10x_spi.c
 +  + stm32f10x_rcc.c
 +  + stm32f10x_gpio.c
 +  + stm32f10x_nvic.c
 +  + stm32f10x_flash.c
 +    
 +- Link all compiled files and load your image into target memory
 +- Run the example
 +
 +
 +******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE******
 diff --git a/src/stm32lib/examples/SPI/M25P64_FLASH/spi_flash.c b/src/stm32lib/examples/SPI/M25P64_FLASH/spi_flash.c new file mode 100755 index 0000000..e19e7c1 --- /dev/null +++ b/src/stm32lib/examples/SPI/M25P64_FLASH/spi_flash.c @@ -0,0 +1,482 @@ +/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
 +* File Name          : spi_flash.c
 +* Author             : MCD Application Team
 +* Version            : V2.0.1
 +* Date               : 06/13/2008
 +* Description        : This file provides a set of functions needed to manage the
 +*                      communication between SPI peripheral and SPI M25P64 FLASH.
 +********************************************************************************
 +* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
 +* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
 +* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
 +* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
 +* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
 +* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
 +*******************************************************************************/
 +
 +/* Includes ------------------------------------------------------------------*/
 +#include "spi_flash.h"
 +
 +/* Private typedef -----------------------------------------------------------*/
 +#define SPI_FLASH_PageSize    0x1006
 +
 +/* Private define ------------------------------------------------------------*/
 +#define WRITE      0x02  /* Write to Memory instruction */
 +#define WRSR       0x01  /* Write Status Register instruction */
 +#define WREN       0x06  /* Write enable instruction */
 +
 +#define READ       0x03  /* Read from Memory instruction */
 +#define RDSR       0x05  /* Read Status Register instruction  */
 +#define RDID       0x9F  /* Read identification */
 +#define SE         0xD8  /* Sector Erase instruction */
 +#define BE         0xC7  /* Bulk Erase instruction */
 +
 +#define WIP_Flag   0x01  /* Write In Progress (WIP) flag */
 +
 +#define Dummy_Byte 0xA5
 +
 +/* Private macro -------------------------------------------------------------*/
 +/* Private variables ---------------------------------------------------------*/
 +/* Private function prototypes -----------------------------------------------*/
 +/* Private functions ---------------------------------------------------------*/
 +
 +/*******************************************************************************
 +* Function Name  : SPI_FLASH_Init
 +* Description    : Initializes the peripherals used by the SPI FLASH driver.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void SPI_FLASH_Init(void)
 +{
 +  SPI_InitTypeDef  SPI_InitStructure;
 +  GPIO_InitTypeDef GPIO_InitStructure;
 +
 +  /* Enable SPI1 and GPIO clocks */
 +  RCC_APB2PeriphClockCmd(RCC_APB2Periph_SPI1 | RCC_APB2Periph_GPIOA |
 +                         RCC_APB2Periph_GPIO_CS, ENABLE);
 +
 +  /* Configure SPI1 pins: SCK, MISO and MOSI */
 +  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_5 | GPIO_Pin_6 | GPIO_Pin_7;
 +  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
 +  GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
 +  GPIO_Init(GPIOA, &GPIO_InitStructure);
 +
 +  /* Configure I/O for Flash Chip select */
 +  GPIO_InitStructure.GPIO_Pin = GPIO_Pin_CS;
 +  GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
 +  GPIO_Init(GPIO_CS, &GPIO_InitStructure);
 +
 +  /* Deselect the FLASH: Chip Select high */
 +  SPI_FLASH_CS_HIGH();
 +
 +  /* SPI1 configuration */
 +  SPI_InitStructure.SPI_Direction = SPI_Direction_2Lines_FullDuplex;
 +  SPI_InitStructure.SPI_Mode = SPI_Mode_Master;
 +  SPI_InitStructure.SPI_DataSize = SPI_DataSize_8b;
 +  SPI_InitStructure.SPI_CPOL = SPI_CPOL_High;
 +  SPI_InitStructure.SPI_CPHA = SPI_CPHA_2Edge;
 +  SPI_InitStructure.SPI_NSS = SPI_NSS_Soft;
 +  SPI_InitStructure.SPI_BaudRatePrescaler = SPI_BaudRatePrescaler_4;
 +  SPI_InitStructure.SPI_FirstBit = SPI_FirstBit_MSB;
 +  SPI_InitStructure.SPI_CRCPolynomial = 7;
 +  SPI_Init(SPI1, &SPI_InitStructure);
 +
 +  /* Enable SPI1  */
 +  SPI_Cmd(SPI1, ENABLE);
 +}
 +
 +/*******************************************************************************
 +* Function Name  : SPI_FLASH_SectorErase
 +* Description    : Erases the specified FLASH sector.
 +* Input          : SectorAddr: address of the sector to erase.
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void SPI_FLASH_SectorErase(u32 SectorAddr)
 +{
 +  /* Send write enable instruction */
 +  SPI_FLASH_WriteEnable();
 +
 +  /* Sector Erase */
 +  /* Select the FLASH: Chip Select low */
 +  SPI_FLASH_CS_LOW();
 +  /* Send Sector Erase instruction */
 +  SPI_FLASH_SendByte(SE);
 +  /* Send SectorAddr high nibble address byte */
 +  SPI_FLASH_SendByte((SectorAddr & 0xFF0000) >> 16);
 +  /* Send SectorAddr medium nibble address byte */
 +  SPI_FLASH_SendByte((SectorAddr & 0xFF00) >> 8);
 +  /* Send SectorAddr low nibble address byte */
 +  SPI_FLASH_SendByte(SectorAddr & 0xFF);
 +  /* Deselect the FLASH: Chip Select high */
 +  SPI_FLASH_CS_HIGH();
 +
 +  /* Wait the end of Flash writing */
 +  SPI_FLASH_WaitForWriteEnd();
 +}
 +
 +/*******************************************************************************
 +* Function Name  : SPI_FLASH_BulkErase
 +* Description    : Erases the entire FLASH.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void SPI_FLASH_BulkErase(void)
 +{
 +  /* Send write enable instruction */
 +  SPI_FLASH_WriteEnable();
 +
 +  /* Bulk Erase */
 +  /* Select the FLASH: Chip Select low */
 +  SPI_FLASH_CS_LOW();
 +  /* Send Bulk Erase instruction  */
 +  SPI_FLASH_SendByte(BE);
 +  /* Deselect the FLASH: Chip Select high */
 +  SPI_FLASH_CS_HIGH();
 +
 +  /* Wait the end of Flash writing */
 +  SPI_FLASH_WaitForWriteEnd();
 +}
 +
 +/*******************************************************************************
 +* Function Name  : SPI_FLASH_PageWrite
 +* Description    : Writes more than one byte to the FLASH with a single WRITE
 +*                  cycle(Page WRITE sequence). The number of byte can't exceed
 +*                  the FLASH page size.
 +* Input          : - pBuffer : pointer to the buffer  containing the data to be
 +*                    written to the FLASH.
 +*                  - WriteAddr : FLASH's internal address to write to.
 +*                  - NumByteToWrite : number of bytes to write to the FLASH,
 +*                    must be equal or less than "SPI_FLASH_PageSize" value.
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void SPI_FLASH_PageWrite(u8* pBuffer, u32 WriteAddr, u16 NumByteToWrite)
 +{
 +  /* Enable the write access to the FLASH */
 +  SPI_FLASH_WriteEnable();
 +
 +  /* Select the FLASH: Chip Select low */
 +  SPI_FLASH_CS_LOW();
 +  /* Send "Write to Memory " instruction */
 +  SPI_FLASH_SendByte(WRITE);
 +  /* Send WriteAddr high nibble address byte to write to */
 +  SPI_FLASH_SendByte((WriteAddr & 0xFF0000) >> 16);
 +  /* Send WriteAddr medium nibble address byte to write to */
 +  SPI_FLASH_SendByte((WriteAddr & 0xFF00) >> 8);
 +  /* Send WriteAddr low nibble address byte to write to */
 +  SPI_FLASH_SendByte(WriteAddr & 0xFF);
 +
 +  /* while there is data to be written on the FLASH */
 +  while (NumByteToWrite--)
 +  {
 +    /* Send the current byte */
 +    SPI_FLASH_SendByte(*pBuffer);
 +    /* Point on the next byte to be written */
 +    pBuffer++;
 +  }
 +
 +  /* Deselect the FLASH: Chip Select high */
 +  SPI_FLASH_CS_HIGH();
 +
 +  /* Wait the end of Flash writing */
 +  SPI_FLASH_WaitForWriteEnd();
 +}
 +
 +/*******************************************************************************
 +* Function Name  : SPI_FLASH_BufferWrite
 +* Description    : Writes block of data to the FLASH. In this function, the
 +*                  number of WRITE cycles are reduced, using Page WRITE sequence.
 +* Input          : - pBuffer : pointer to the buffer  containing the data to be
 +*                    written to the FLASH.
 +*                  - WriteAddr : FLASH's internal address to write to.
 +*                  - NumByteToWrite : number of bytes to write to the FLASH.
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void SPI_FLASH_BufferWrite(u8* pBuffer, u32 WriteAddr, u16 NumByteToWrite)
 +{
 +  u8 NumOfPage = 0, NumOfSingle = 0, Addr = 0, count = 0, temp = 0;
 +
 +  Addr = WriteAddr % SPI_FLASH_PageSize;
 +  count = SPI_FLASH_PageSize - Addr;
 +  NumOfPage =  NumByteToWrite / SPI_FLASH_PageSize;
 +  NumOfSingle = NumByteToWrite % SPI_FLASH_PageSize;
 +
 +  if (Addr == 0) /* WriteAddr is SPI_FLASH_PageSize aligned  */
 +  {
 +    if (NumOfPage == 0) /* NumByteToWrite < SPI_FLASH_PageSize */
 +    {
 +      SPI_FLASH_PageWrite(pBuffer, WriteAddr, NumByteToWrite);
 +    }
 +    else /* NumByteToWrite > SPI_FLASH_PageSize */
 +    {
 +      while (NumOfPage--)
 +      {
 +        SPI_FLASH_PageWrite(pBuffer, WriteAddr, SPI_FLASH_PageSize);
 +        WriteAddr +=  SPI_FLASH_PageSize;
 +        pBuffer += SPI_FLASH_PageSize;
 +      }
 +
 +      SPI_FLASH_PageWrite(pBuffer, WriteAddr, NumOfSingle);
 +    }
 +  }
 +  else /* WriteAddr is not SPI_FLASH_PageSize aligned  */
 +  {
 +    if (NumOfPage == 0) /* NumByteToWrite < SPI_FLASH_PageSize */
 +    {
 +      if (NumOfSingle > count) /* (NumByteToWrite + WriteAddr) > SPI_FLASH_PageSize */
 +      {
 +        temp = NumOfSingle - count;
 +
 +        SPI_FLASH_PageWrite(pBuffer, WriteAddr, count);
 +        WriteAddr +=  count;
 +        pBuffer += count;
 +
 +        SPI_FLASH_PageWrite(pBuffer, WriteAddr, temp);
 +      }
 +      else
 +      {
 +        SPI_FLASH_PageWrite(pBuffer, WriteAddr, NumByteToWrite);
 +      }
 +    }
 +    else /* NumByteToWrite > SPI_FLASH_PageSize */
 +    {
 +      NumByteToWrite -= count;
 +      NumOfPage =  NumByteToWrite / SPI_FLASH_PageSize;
 +      NumOfSingle = NumByteToWrite % SPI_FLASH_PageSize;
 +
 +      SPI_FLASH_PageWrite(pBuffer, WriteAddr, count);
 +      WriteAddr +=  count;
 +      pBuffer += count;
 +
 +      while (NumOfPage--)
 +      {
 +        SPI_FLASH_PageWrite(pBuffer, WriteAddr, SPI_FLASH_PageSize);
 +        WriteAddr +=  SPI_FLASH_PageSize;
 +        pBuffer += SPI_FLASH_PageSize;
 +      }
 +
 +      if (NumOfSingle != 0)
 +      {
 +        SPI_FLASH_PageWrite(pBuffer, WriteAddr, NumOfSingle);
 +      }
 +    }
 +  }
 +}
 +
 +/*******************************************************************************
 +* Function Name  : SPI_FLASH_BufferRead
 +* Description    : Reads a block of data from the FLASH.
 +* Input          : - pBuffer : pointer to the buffer that receives the data read
 +*                    from the FLASH.
 +*                  - ReadAddr : FLASH's internal address to read from.
 +*                  - NumByteToRead : number of bytes to read from the FLASH.
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void SPI_FLASH_BufferRead(u8* pBuffer, u32 ReadAddr, u16 NumByteToRead)
 +{
 +  /* Select the FLASH: Chip Select low */
 +  SPI_FLASH_CS_LOW();
 +
 +  /* Send "Read from Memory " instruction */
 +  SPI_FLASH_SendByte(READ);
 +
 +  /* Send ReadAddr high nibble address byte to read from */
 +  SPI_FLASH_SendByte((ReadAddr & 0xFF0000) >> 16);
 +  /* Send ReadAddr medium nibble address byte to read from */
 +  SPI_FLASH_SendByte((ReadAddr& 0xFF00) >> 8);
 +  /* Send ReadAddr low nibble address byte to read from */
 +  SPI_FLASH_SendByte(ReadAddr & 0xFF);
 +
 +  while (NumByteToRead--) /* while there is data to be read */
 +  {
 +    /* Read a byte from the FLASH */
 +    *pBuffer = SPI_FLASH_SendByte(Dummy_Byte);
 +    /* Point to the next location where the byte read will be saved */
 +    pBuffer++;
 +  }
 +
 +  /* Deselect the FLASH: Chip Select high */
 +  SPI_FLASH_CS_HIGH();
 +}
 +
 +/*******************************************************************************
 +* Function Name  : SPI_FLASH_ReadID
 +* Description    : Reads FLASH identification.
 +* Input          : None
 +* Output         : None
 +* Return         : FLASH identification
 +*******************************************************************************/
 +u32 SPI_FLASH_ReadID(void)
 +{
 +  u32 Temp = 0, Temp0 = 0, Temp1 = 0, Temp2 = 0;
 +
 +  /* Select the FLASH: Chip Select low */
 +  SPI_FLASH_CS_LOW();
 +
 +  /* Send "RDID " instruction */
 +  SPI_FLASH_SendByte(0x9F);
 +
 +  /* Read a byte from the FLASH */
 +  Temp0 = SPI_FLASH_SendByte(Dummy_Byte);
 +
 +  /* Read a byte from the FLASH */
 +  Temp1 = SPI_FLASH_SendByte(Dummy_Byte);
 +
 +  /* Read a byte from the FLASH */
 +  Temp2 = SPI_FLASH_SendByte(Dummy_Byte);
 +
 +  /* Deselect the FLASH: Chip Select high */
 +  SPI_FLASH_CS_HIGH();
 +
 +  Temp = (Temp0 << 16) | (Temp1 << 8) | Temp2;
 +
 +  return Temp;
 +}
 +
 +/*******************************************************************************
 +* Function Name  : SPI_FLASH_StartReadSequence
 +* Description    : Initiates a read data byte (READ) sequence from the Flash.
 +*                  This is done by driving the /CS line low to select the device,
 +*                  then the READ instruction is transmitted followed by 3 bytes
 +*                  address. This function exit and keep the /CS line low, so the
 +*                  Flash still being selected. With this technique the whole
 +*                  content of the Flash is read with a single READ instruction.
 +* Input          : - ReadAddr : FLASH's internal address to read from.
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void SPI_FLASH_StartReadSequence(u32 ReadAddr)
 +{
 +  /* Select the FLASH: Chip Select low */
 +  SPI_FLASH_CS_LOW();
 +
 +  /* Send "Read from Memory " instruction */
 +  SPI_FLASH_SendByte(READ);
 +
 +  /* Send the 24-bit address of the address to read from -----------------------*/
 +  /* Send ReadAddr high nibble address byte */
 +  SPI_FLASH_SendByte((ReadAddr & 0xFF0000) >> 16);
 +  /* Send ReadAddr medium nibble address byte */
 +  SPI_FLASH_SendByte((ReadAddr& 0xFF00) >> 8);
 +  /* Send ReadAddr low nibble address byte */
 +  SPI_FLASH_SendByte(ReadAddr & 0xFF);
 +}
 +
 +/*******************************************************************************
 +* Function Name  : SPI_FLASH_ReadByte
 +* Description    : Reads a byte from the SPI Flash.
 +*                  This function must be used only if the Start_Read_Sequence
 +*                  function has been previously called.
 +* Input          : None
 +* Output         : None
 +* Return         : Byte Read from the SPI Flash.
 +*******************************************************************************/
 +u8 SPI_FLASH_ReadByte(void)
 +{
 +  return (SPI_FLASH_SendByte(Dummy_Byte));
 +}
 +
 +/*******************************************************************************
 +* Function Name  : SPI_FLASH_SendByte
 +* Description    : Sends a byte through the SPI interface and return the byte
 +*                  received from the SPI bus.
 +* Input          : byte : byte to send.
 +* Output         : None
 +* Return         : The value of the received byte.
 +*******************************************************************************/
 +u8 SPI_FLASH_SendByte(u8 byte)
 +{
 +  /* Loop while DR register in not emplty */
 +  while (SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_TXE) == RESET);
 +
 +  /* Send byte through the SPI1 peripheral */
 +  SPI_I2S_SendData(SPI1, byte);
 +
 +  /* Wait to receive a byte */
 +  while (SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_RXNE) == RESET);
 +
 +  /* Return the byte read from the SPI bus */
 +  return SPI_I2S_ReceiveData(SPI1);
 +}
 +
 +/*******************************************************************************
 +* Function Name  : SPI_FLASH_SendHalfWord
 +* Description    : Sends a Half Word through the SPI interface and return the
 +*                  Half Word received from the SPI bus.
 +* Input          : Half Word : Half Word to send.
 +* Output         : None
 +* Return         : The value of the received Half Word.
 +*******************************************************************************/
 +u16 SPI_FLASH_SendHalfWord(u16 HalfWord)
 +{
 +  /* Loop while DR register in not emplty */
 +  while (SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_TXE) == RESET);
 +
 +  /* Send Half Word through the SPI1 peripheral */
 +  SPI_I2S_SendData(SPI1, HalfWord);
 +
 +  /* Wait to receive a Half Word */
 +  while (SPI_I2S_GetFlagStatus(SPI1, SPI_I2S_FLAG_RXNE) == RESET);
 +
 +  /* Return the Half Word read from the SPI bus */
 +  return SPI_I2S_ReceiveData(SPI1);
 +}
 +
 +/*******************************************************************************
 +* Function Name  : SPI_FLASH_WriteEnable
 +* Description    : Enables the write access to the FLASH.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void SPI_FLASH_WriteEnable(void)
 +{
 +  /* Select the FLASH: Chip Select low */
 +  SPI_FLASH_CS_LOW();
 +
 +  /* Send "Write Enable" instruction */
 +  SPI_FLASH_SendByte(WREN);
 +
 +  /* Deselect the FLASH: Chip Select high */
 +  SPI_FLASH_CS_HIGH();
 +}
 +
 +/*******************************************************************************
 +* Function Name  : SPI_FLASH_WaitForWriteEnd
 +* Description    : Polls the status of the Write In Progress (WIP) flag in the
 +*                  FLASH's status  register  and  loop  until write  opertaion
 +*                  has completed.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void SPI_FLASH_WaitForWriteEnd(void)
 +{
 +  u8 FLASH_Status = 0;
 +
 +  /* Select the FLASH: Chip Select low */
 +  SPI_FLASH_CS_LOW();
 +
 +  /* Send "Read Status Register" instruction */
 +  SPI_FLASH_SendByte(RDSR);
 +
 +  /* Loop as long as the memory is busy with a write cycle */
 +  do
 +  {
 +    /* Send a dummy byte to generate the clock needed by the FLASH
 +    and put the value of the status register in FLASH_Status variable */
 +    FLASH_Status = SPI_FLASH_SendByte(Dummy_Byte);
 +
 +  }
 +  while ((FLASH_Status & WIP_Flag) == SET); /* Write in progress */
 +
 +  /* Deselect the FLASH: Chip Select high */
 +  SPI_FLASH_CS_HIGH();
 +}
 +
 +/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
 diff --git a/src/stm32lib/examples/SPI/M25P64_FLASH/spi_flash.h b/src/stm32lib/examples/SPI/M25P64_FLASH/spi_flash.h new file mode 100755 index 0000000..9b7d569 --- /dev/null +++ b/src/stm32lib/examples/SPI/M25P64_FLASH/spi_flash.h @@ -0,0 +1,68 @@ +/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
 +* File Name          : spi_flash.h
 +* Author             : MCD Application Team
 +* Version            : V2.0.1
 +* Date               : 06/13/2008
 +* Description        : Header for spi_flash.c file.
 +********************************************************************************
 +* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
 +* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
 +* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
 +* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
 +* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
 +* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
 +*******************************************************************************/
 +
 +/* Define to prevent recursive inclusion -------------------------------------*/
 +#ifndef __SPI_FLASH_H
 +#define __SPI_FLASH_H
 +
 +/* Includes ------------------------------------------------------------------*/
 +#include "stm32f10x_lib.h"
 +
 +/* Exported types ------------------------------------------------------------*/
 +/* Exported constants --------------------------------------------------------*/
 +/* Uncomment the line corresponding to the STMicroelectronics evaluation board
 +   used to run the example */
 +#if !defined (USE_STM3210B_EVAL) &&  !defined (USE_STM3210E_EVAL)
 + //#define USE_STM3210B_EVAL
 + #define USE_STM3210E_EVAL
 +#endif
 +
 +#ifdef USE_STM3210B_EVAL
 + #define GPIO_CS                  GPIOA
 + #define RCC_APB2Periph_GPIO_CS   RCC_APB2Periph_GPIOA
 + #define GPIO_Pin_CS              GPIO_Pin_4 
 +#else /* USE_STM3210E_EVAL */
 + #define GPIO_CS                  GPIOB
 + #define RCC_APB2Periph_GPIO_CS   RCC_APB2Periph_GPIOB
 + #define GPIO_Pin_CS              GPIO_Pin_2 
 +#endif
 +
 +/* Exported macro ------------------------------------------------------------*/
 +/* Select SPI FLASH: Chip Select pin low  */
 +#define SPI_FLASH_CS_LOW()       GPIO_ResetBits(GPIO_CS, GPIO_Pin_CS)
 +/* Deselect SPI FLASH: Chip Select pin high */
 +#define SPI_FLASH_CS_HIGH()      GPIO_SetBits(GPIO_CS, GPIO_Pin_CS)
 +
 +/* Exported functions ------------------------------------------------------- */
 +/*----- High layer function -----*/
 +void SPI_FLASH_Init(void);
 +void SPI_FLASH_SectorErase(u32 SectorAddr);
 +void SPI_FLASH_BulkErase(void);
 +void SPI_FLASH_PageWrite(u8* pBuffer, u32 WriteAddr, u16 NumByteToWrite);
 +void SPI_FLASH_BufferWrite(u8* pBuffer, u32 WriteAddr, u16 NumByteToWrite);
 +void SPI_FLASH_BufferRead(u8* pBuffer, u32 ReadAddr, u16 NumByteToRead);
 +u32 SPI_FLASH_ReadID(void);
 +void SPI_FLASH_StartReadSequence(u32 ReadAddr);
 +
 +/*----- Low layer function -----*/
 +u8 SPI_FLASH_ReadByte(void);
 +u8 SPI_FLASH_SendByte(u8 byte);
 +u16 SPI_FLASH_SendHalfWord(u16 HalfWord);
 +void SPI_FLASH_WriteEnable(void);
 +void SPI_FLASH_WaitForWriteEnd(void);
 +
 +#endif /* __SPI_FLASH_H */
 +
 +/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
 diff --git a/src/stm32lib/examples/SPI/M25P64_FLASH/stm32f10x_conf.h b/src/stm32lib/examples/SPI/M25P64_FLASH/stm32f10x_conf.h new file mode 100755 index 0000000..595dede --- /dev/null +++ b/src/stm32lib/examples/SPI/M25P64_FLASH/stm32f10x_conf.h @@ -0,0 +1,170 @@ +/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
 +* File Name          : stm32f10x_conf.h
 +* Author             : MCD Application Team
 +* Version            : V2.0.1
 +* Date               : 06/13/2008
 +* Description        : Library configuration file.
 +********************************************************************************
 +* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
 +* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
 +* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
 +* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
 +* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
 +* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
 +*******************************************************************************/
 +
 +/* Define to prevent recursive inclusion -------------------------------------*/
 +#ifndef __STM32F10x_CONF_H
 +#define __STM32F10x_CONF_H
 +
 +/* Includes ------------------------------------------------------------------*/
 +#include "stm32f10x_type.h"
 +
 +/* Exported types ------------------------------------------------------------*/
 +/* Exported constants --------------------------------------------------------*/
 +/* Uncomment the line below to compile the library in DEBUG mode, this will expanse
 +   the "assert_param" macro in the firmware library code (see "Exported macro"
 +   section below) */
 +/*#define DEBUG    1*/
 +
 +/* Comment the line below to disable the specific peripheral inclusion */
 +/************************************* ADC ************************************/
 +//#define _ADC
 +//#define _ADC1
 +//#define _ADC2
 +//#define _ADC3
 +
 +/************************************* BKP ************************************/
 +//#define _BKP
 +
 +/************************************* CAN ************************************/
 +//#define _CAN
 +
 +/************************************* CRC ************************************/
 +//#define _CRC
 +
 +/************************************* DAC ************************************/
 +//#define _DAC
 +
 +/************************************* DBGMCU *********************************/
 +#define _DBGMCU
 +
 +/************************************* DMA ************************************/
 +//#define _DMA
 +//#define _DMA1_Channel1
 +//#define _DMA1_Channel2
 +//#define _DMA1_Channel3
 +//#define _DMA1_Channel4
 +//#define _DMA1_Channel5
 +//#define _DMA1_Channel6
 +//#define _DMA1_Channel7
 +//#define _DMA2_Channel1
 +//#define _DMA2_Channel2
 +//#define _DMA2_Channel3
 +//#define _DMA2_Channel4
 +//#define _DMA2_Channel5
 +
 +/************************************* EXTI ***********************************/
 +//#define _EXTI
 +
 +/************************************* FLASH and Option Bytes *****************/
 +#define _FLASH
 +/* Uncomment the line below to enable FLASH program/erase/protections functions,
 +   otherwise only FLASH configuration (latency, prefetch, half cycle) functions
 +   are enabled */
 +/* #define _FLASH_PROG */
 +
 +/************************************* FSMC ***********************************/
 +//#define _FSMC
 +
 +/************************************* GPIO ***********************************/
 +#define _GPIO
 +#define _GPIOA
 +#define _GPIOB
 +#define _GPIOC
 +//#define _GPIOD
 +//#define _GPIOE
 +#define _GPIOF
 +//#define _GPIOG
 +#define _AFIO
 +
 +/************************************* I2C ************************************/
 +//#define _I2C
 +//#define _I2C1
 +//#define _I2C2
 +
 +/************************************* IWDG ***********************************/
 +//#define _IWDG
 +
 +/************************************* NVIC ***********************************/
 +#define _NVIC
 +
 +/************************************* PWR ************************************/
 +//#define _PWR
 +
 +/************************************* RCC ************************************/
 +#define _RCC
 +
 +/************************************* RTC ************************************/
 +//#define _RTC
 +
 +/************************************* SDIO ***********************************/
 +//#define _SDIO
 +
 +/************************************* SPI ************************************/
 +#define _SPI
 +#define _SPI1
 +//#define _SPI2
 +//#define _SPI3
 +
 +/************************************* SysTick ********************************/
 +//#define _SysTick
 +
 +/************************************* TIM ************************************/
 +//#define _TIM
 +//#define _TIM1
 +//#define _TIM2
 +//#define _TIM3
 +//#define _TIM4
 +//#define _TIM5
 +//#define _TIM6
 +//#define _TIM7
 +//#define _TIM8
 +
 +/************************************* USART **********************************/
 +//#define _USART
 +//#define _USART1
 +//#define _USART2
 +//#define _USART3
 +//#define _UART4
 +//#define _UART5
 +
 +/************************************* WWDG ***********************************/
 +//#define _WWDG
 +
 +/* In the following line adjust the value of External High Speed oscillator (HSE)
 +   used in your application */
 +#define HSE_Value    ((u32)8000000) /* Value of the External oscillator in Hz*/
 +
 +/* Exported macro ------------------------------------------------------------*/
 +#ifdef  DEBUG
 +/*******************************************************************************
 +* Macro Name     : assert_param
 +* Description    : The assert_param macro is used for function's parameters check.
 +*                  It is used only if the library is compiled in DEBUG mode.
 +* Input          : - expr: If expr is false, it calls assert_failed function
 +*                    which reports the name of the source file and the source
 +*                    line number of the call that failed.
 +*                    If expr is true, it returns no value.
 +* Return         : None
 +*******************************************************************************/
 +#define assert_param(expr) ((expr) ? (void)0 : assert_failed((u8 *)__FILE__, __LINE__))
 +/* Exported functions ------------------------------------------------------- */
 +  void assert_failed(u8* file, u32 line);
 +#else
 +  #define assert_param(expr) ((void)0)
 +#endif /* DEBUG */
 +
 +#endif /* __STM32F10x_CONF_H */
 +
 +/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
 diff --git a/src/stm32lib/examples/SPI/M25P64_FLASH/stm32f10x_it.c b/src/stm32lib/examples/SPI/M25P64_FLASH/stm32f10x_it.c new file mode 100755 index 0000000..704430c --- /dev/null +++ b/src/stm32lib/examples/SPI/M25P64_FLASH/stm32f10x_it.c @@ -0,0 +1,741 @@ +/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
 +* File Name          : stm32f10x_it.c
 +* Author             : MCD Application Team
 +* Version            : V2.0.1
 +* Date               : 06/13/2008
 +* Description        : Main Interrupt Service Routines.
 +*                      This file provides template for all exceptions handler
 +*                      and peripherals interrupt service routine.
 +********************************************************************************
 +* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
 +* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
 +* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
 +* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
 +* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
 +* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
 +*******************************************************************************/
 +
 +/* Includes ------------------------------------------------------------------*/
 +#include "stm32f10x_it.h"
 +
 +/* Private typedef -----------------------------------------------------------*/
 +/* Private define ------------------------------------------------------------*/
 +/* Private macro -------------------------------------------------------------*/
 +/* Private variables ---------------------------------------------------------*/
 +/* Private function prototypes -----------------------------------------------*/
 +/* Private functions ---------------------------------------------------------*/
 +
 +/*******************************************************************************
 +* Function Name  : NMIException
 +* Description    : This function handles NMI exception.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void NMIException(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : HardFaultException
 +* Description    : This function handles Hard Fault exception.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void HardFaultException(void)
 +{
 +  /* Go to infinite loop when Hard Fault exception occurs */
 +  while (1)
 +  {}
 +}
 +
 +/*******************************************************************************
 +* Function Name  : MemManageException
 +* Description    : This function handles Memory Manage exception.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void MemManageException(void)
 +{
 +  /* Go to infinite loop when Memory Manage exception occurs */
 +  while (1)
 +  {}
 +}
 +
 +/*******************************************************************************
 +* Function Name  : BusFaultException
 +* Description    : This function handles Bus Fault exception.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void BusFaultException(void)
 +{
 +  /* Go to infinite loop when Bus Fault exception occurs */
 +  while (1)
 +  {}
 +}
 +
 +/*******************************************************************************
 +* Function Name  : UsageFaultException
 +* Description    : This function handles Usage Fault exception.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void UsageFaultException(void)
 +{
 +  /* Go to infinite loop when Usage Fault exception occurs */
 +  while (1)
 +  {}
 +}
 +
 +/*******************************************************************************
 +* Function Name  : DebugMonitor
 +* Description    : This function handles Debug Monitor exception.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void DebugMonitor(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : SVCHandler
 +* Description    : This function handles SVCall exception.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void SVCHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : PendSVC
 +* Description    : This function handles PendSVC exception.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void PendSVC(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : SysTickHandler
 +* Description    : This function handles SysTick Handler.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void SysTickHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : WWDG_IRQHandler
 +* Description    : This function handles WWDG interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void WWDG_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : PVD_IRQHandler
 +* Description    : This function handles PVD interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void PVD_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : TAMPER_IRQHandler
 +* Description    : This function handles Tamper interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void TAMPER_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : RTC_IRQHandler
 +* Description    : This function handles RTC global interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void RTC_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : FLASH_IRQHandler
 +* Description    : This function handles Flash interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void FLASH_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : RCC_IRQHandler
 +* Description    : This function handles RCC interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void RCC_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : EXTI0_IRQHandler
 +* Description    : This function handles External interrupt Line 0 request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void EXTI0_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : EXTI1_IRQHandler
 +* Description    : This function handles External interrupt Line 1 request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void EXTI1_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : EXTI2_IRQHandler
 +* Description    : This function handles External interrupt Line 2 request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void EXTI2_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : EXTI3_IRQHandler
 +* Description    : This function handles External interrupt Line 3 request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void EXTI3_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : EXTI4_IRQHandler
 +* Description    : This function handles External interrupt Line 4 request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void EXTI4_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : DMA1_Channel1_IRQHandler
 +* Description    : This function handles DMA1 Channel 1 interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void DMA1_Channel1_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : DMA1_Channel2_IRQHandler
 +* Description    : This function handles DMA1 Channel 2 interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void DMA1_Channel2_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : DMA1_Channel3_IRQHandler
 +* Description    : This function handles DMA1 Channel 3 interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void DMA1_Channel3_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : DMA1_Channel4_IRQHandler
 +* Description    : This function handles DMA1 Channel 4 interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void DMA1_Channel4_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : DMA1_Channel5_IRQHandler
 +* Description    : This function handles DMA1 Channel 5 interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void DMA1_Channel5_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : DMA1_Channel6_IRQHandler
 +* Description    : This function handles DMA1 Channel 6 interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void DMA1_Channel6_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : DMA1_Channel7_IRQHandler
 +* Description    : This function handles DMA1 Channel 7 interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void DMA1_Channel7_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : ADC1_2_IRQHandler
 +* Description    : This function handles ADC1 and ADC2 global interrupts requests.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void ADC1_2_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : USB_HP_CAN_TX_IRQHandler
 +* Description    : This function handles USB High Priority or CAN TX interrupts
 +*                  requests.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void USB_HP_CAN_TX_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : USB_LP_CAN_RX0_IRQHandler
 +* Description    : This function handles USB Low Priority or CAN RX0 interrupts
 +*                  requests.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void USB_LP_CAN_RX0_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : CAN_RX1_IRQHandler
 +* Description    : This function handles CAN RX1 interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void CAN_RX1_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : CAN_SCE_IRQHandler
 +* Description    : This function handles CAN SCE interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void CAN_SCE_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : EXTI9_5_IRQHandler
 +* Description    : This function handles External lines 9 to 5 interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void EXTI9_5_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : TIM1_BRK_IRQHandler
 +* Description    : This function handles TIM1 Break interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void TIM1_BRK_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : TIM1_UP_IRQHandler
 +* Description    : This function handles TIM1 overflow and update interrupt
 +*                  request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void TIM1_UP_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : TIM1_TRG_COM_IRQHandler
 +* Description    : This function handles TIM1 Trigger and commutation interrupts
 +*                  requests.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void TIM1_TRG_COM_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : TIM1_CC_IRQHandler
 +* Description    : This function handles TIM1 capture compare interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void TIM1_CC_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : TIM2_IRQHandler
 +* Description    : This function handles TIM2 global interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void TIM2_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : TIM3_IRQHandler
 +* Description    : This function handles TIM3 global interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void TIM3_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : TIM4_IRQHandler
 +* Description    : This function handles TIM4 global interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void TIM4_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : I2C1_EV_IRQHandler
 +* Description    : This function handles I2C1 Event interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void I2C1_EV_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : I2C1_ER_IRQHandler
 +* Description    : This function handles I2C1 Error interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void I2C1_ER_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : I2C2_EV_IRQHandler
 +* Description    : This function handles I2C2 Event interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void I2C2_EV_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : I2C2_ER_IRQHandler
 +* Description    : This function handles I2C2 Error interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void I2C2_ER_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : SPI1_IRQHandler
 +* Description    : This function handles SPI1 global interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void SPI1_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : SPI2_IRQHandler
 +* Description    : This function handles SPI2 global interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void SPI2_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : USART1_IRQHandler
 +* Description    : This function handles USART1 global interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void USART1_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : USART2_IRQHandler
 +* Description    : This function handles USART2 global interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void USART2_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : USART3_IRQHandler
 +* Description    : This function handles USART3 global interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void USART3_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : EXTI15_10_IRQHandler
 +* Description    : This function handles External lines 15 to 10 interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void EXTI15_10_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : RTCAlarm_IRQHandler
 +* Description    : This function handles RTC Alarm interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void RTCAlarm_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : USBWakeUp_IRQHandler
 +* Description    : This function handles USB WakeUp interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void USBWakeUp_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : TIM8_BRK_IRQHandler
 +* Description    : This function handles TIM8 Break interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void TIM8_BRK_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : TIM8_UP_IRQHandler
 +* Description    : This function handles TIM8 overflow and update interrupt
 +*                  request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void TIM8_UP_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : TIM8_TRG_COM_IRQHandler
 +* Description    : This function handles TIM8 Trigger and commutation interrupts
 +*                  requests.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void TIM8_TRG_COM_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : TIM8_CC_IRQHandler
 +* Description    : This function handles TIM8 capture compare interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void TIM8_CC_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : ADC3_IRQHandler
 +* Description    : This function handles ADC3 global interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void ADC3_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : FSMC_IRQHandler
 +* Description    : This function handles FSMC global interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void FSMC_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : SDIO_IRQHandler
 +* Description    : This function handles SDIO global interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void SDIO_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : TIM5_IRQHandler
 +* Description    : This function handles TIM5 global interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void TIM5_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : SPI3_IRQHandler
 +* Description    : This function handles SPI3 global interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void SPI3_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : UART4_IRQHandler
 +* Description    : This function handles UART4 global interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void UART4_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : UART5_IRQHandler
 +* Description    : This function handles UART5 global interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void UART5_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : TIM6_IRQHandler
 +* Description    : This function handles TIM6 global interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void TIM6_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : TIM7_IRQHandler
 +* Description    : This function handles TIM7 global interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void TIM7_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : DMA2_Channel1_IRQHandler
 +* Description    : This function handles DMA2 Channel 1 interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void DMA2_Channel1_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : DMA2_Channel2_IRQHandler
 +* Description    : This function handles DMA2 Channel 2 interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void DMA2_Channel2_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : DMA2_Channel3_IRQHandler
 +* Description    : This function handles DMA2 Channel 3 interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void DMA2_Channel3_IRQHandler(void)
 +{}
 +
 +/*******************************************************************************
 +* Function Name  : DMA2_Channel4_5_IRQHandler
 +* Description    : This function handles DMA2 Channel 4 and DMA2 Channel 5
 +*                  interrupt request.
 +* Input          : None
 +* Output         : None
 +* Return         : None
 +*******************************************************************************/
 +void DMA2_Channel4_5_IRQHandler(void)
 +{}
 +
 +/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
 diff --git a/src/stm32lib/examples/SPI/M25P64_FLASH/stm32f10x_it.h b/src/stm32lib/examples/SPI/M25P64_FLASH/stm32f10x_it.h new file mode 100755 index 0000000..58da1cc --- /dev/null +++ b/src/stm32lib/examples/SPI/M25P64_FLASH/stm32f10x_it.h @@ -0,0 +1,100 @@ +/******************** (C) COPYRIGHT 2008 STMicroelectronics ********************
 +* File Name          : stm32f10x_it.h
 +* Author             : MCD Application Team
 +* Version            : V2.0.1
 +* Date               : 06/13/2008
 +* Description        : This file contains the headers of the interrupt handlers.
 +********************************************************************************
 +* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
 +* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
 +* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
 +* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
 +* CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
 +* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
 +*******************************************************************************/
 +
 +/* Define to prevent recursive inclusion -------------------------------------*/
 +#ifndef __STM32F10x_IT_H
 +#define __STM32F10x_IT_H
 +
 +/* Includes ------------------------------------------------------------------*/
 +#include "stm32f10x_lib.h"
 +
 +/* Exported types ------------------------------------------------------------*/
 +/* Exported constants --------------------------------------------------------*/
 +/* Exported macro ------------------------------------------------------------*/
 +/* Exported functions ------------------------------------------------------- */
 +
 +void NMIException(void);
 +void HardFaultException(void);
 +void MemManageException(void);
 +void BusFaultException(void);
 +void UsageFaultException(void);
 +void DebugMonitor(void);
 +void SVCHandler(void);
 +void PendSVC(void);
 +void SysTickHandler(void);
 +void WWDG_IRQHandler(void);
 +void PVD_IRQHandler(void);
 +void TAMPER_IRQHandler(void);
 +void RTC_IRQHandler(void);
 +void FLASH_IRQHandler(void);
 +void RCC_IRQHandler(void);
 +void EXTI0_IRQHandler(void);
 +void EXTI1_IRQHandler(void);
 +void EXTI2_IRQHandler(void);
 +void EXTI3_IRQHandler(void);
 +void EXTI4_IRQHandler(void);
 +void DMA1_Channel1_IRQHandler(void);
 +void DMA1_Channel2_IRQHandler(void);
 +void DMA1_Channel3_IRQHandler(void);
 +void DMA1_Channel4_IRQHandler(void);
 +void DMA1_Channel5_IRQHandler(void);
 +void DMA1_Channel6_IRQHandler(void);
 +void DMA1_Channel7_IRQHandler(void);
 +void ADC1_2_IRQHandler(void);
 +void USB_HP_CAN_TX_IRQHandler(void);
 +void USB_LP_CAN_RX0_IRQHandler(void);
 +void CAN_RX1_IRQHandler(void);
 +void CAN_SCE_IRQHandler(void);
 +void EXTI9_5_IRQHandler(void);
 +void TIM1_BRK_IRQHandler(void);
 +void TIM1_UP_IRQHandler(void);
 +void TIM1_TRG_COM_IRQHandler(void);
 +void TIM1_CC_IRQHandler(void);
 +void TIM2_IRQHandler(void);
 +void TIM3_IRQHandler(void);
 +void TIM4_IRQHandler(void);
 +void I2C1_EV_IRQHandler(void);
 +void I2C1_ER_IRQHandler(void);
 +void I2C2_EV_IRQHandler(void);
 +void I2C2_ER_IRQHandler(void);
 +void SPI1_IRQHandler(void);
 +void SPI2_IRQHandler(void);
 +void USART1_IRQHandler(void);
 +void USART2_IRQHandler(void);
 +void USART3_IRQHandler(void);
 +void EXTI15_10_IRQHandler(void);
 +void RTCAlarm_IRQHandler(void);
 +void USBWakeUp_IRQHandler(void);
 +void TIM8_BRK_IRQHandler(void);
 +void TIM8_UP_IRQHandler(void);
 +void TIM8_TRG_COM_IRQHandler(void);
 +void TIM8_CC_IRQHandler(void);
 +void ADC3_IRQHandler(void);
 +void FSMC_IRQHandler(void);
 +void SDIO_IRQHandler(void);
 +void TIM5_IRQHandler(void);
 +void SPI3_IRQHandler(void);
 +void UART4_IRQHandler(void);
 +void UART5_IRQHandler(void);
 +void TIM6_IRQHandler(void);
 +void TIM7_IRQHandler(void);
 +void DMA2_Channel1_IRQHandler(void);
 +void DMA2_Channel2_IRQHandler(void);
 +void DMA2_Channel3_IRQHandler(void);
 +void DMA2_Channel4_5_IRQHandler(void);
 +
 +#endif /* __STM32F10x_IT_H */
 +
 +/******************* (C) COPYRIGHT 2008 STMicroelectronics *****END OF FILE****/
  | 
