stm32_eval_spi_flash.h

Go to the documentation of this file.
00001 /**
00002   ******************************************************************************
00003   * @file    stm32_eval_spi_flash.h
00004   * @author  MCD Application Team
00005   * @version V4.3.0
00006   * @date    10/15/2010
00007   * @brief   This file contains all the functions prototypes for the stm32_eval_spi_flash
00008   *          firmware driver.
00009   ******************************************************************************
00010   * @copy
00011   *
00012   * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
00013   * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
00014   * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
00015   * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
00016   * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
00017   * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
00018   *
00019   * <h2><center>&copy; COPYRIGHT 2010 STMicroelectronics</center></h2>
00020   */ 
00021 
00022 /* Define to prevent recursive inclusion -------------------------------------*/
00023 #ifndef __STM32_EVAL_SPI_FLASH_H
00024 #define __STM32_EVAL_SPI_FLASH_H
00025 
00026 #ifdef __cplusplus
00027  extern "C" {
00028 #endif
00029 
00030 /* Includes ------------------------------------------------------------------*/
00031 #include "stm32_eval.h"
00032 
00033 /** @addtogroup Utilities
00034   * @{
00035   */
00036   
00037 /** @addtogroup STM32_EVAL
00038   * @{
00039   */ 
00040 
00041 /** @addtogroup Common
00042   * @{
00043   */
00044   
00045 /** @addtogroup STM32_EVAL_SPI_FLASH
00046   * @{
00047   */  
00048 
00049 /** @defgroup STM32_EVAL_SPI_FLASH_Exported_Types
00050   * @{
00051   */ 
00052 /**
00053   * @}
00054   */
00055   
00056 /** @defgroup STM32_EVAL_SPI_FLASH_Exported_Constants
00057   * @{
00058   */
00059 /**
00060   * @brief  M25P SPI Flash supported commands
00061   */  
00062 #define sFLASH_CMD_WRITE          0x02  /*!< Write to Memory instruction */
00063 #define sFLASH_CMD_WRSR           0x01  /*!< Write Status Register instruction */
00064 #define sFLASH_CMD_WREN           0x06  /*!< Write enable instruction */
00065 #define sFLASH_CMD_READ           0x03  /*!< Read from Memory instruction */
00066 #define sFLASH_CMD_RDSR           0x05  /*!< Read Status Register instruction  */
00067 #define sFLASH_CMD_RDID           0x9F  /*!< Read identification */
00068 #define sFLASH_CMD_SE             0xD8  /*!< Sector Erase instruction */
00069 #define sFLASH_CMD_BE             0xC7  /*!< Bulk Erase instruction */
00070 
00071 #define sFLASH_WIP_FLAG           0x01  /*!< Write In Progress (WIP) flag */
00072 
00073 #define sFLASH_DUMMY_BYTE         0xA5
00074 #define sFLASH_SPI_PAGESIZE       0x100
00075 
00076 #define sFLASH_M25P128_ID         0x202018
00077 #define sFLASH_M25P64_ID          0x202017
00078   
00079 /**
00080   * @}
00081   */ 
00082   
00083 /** @defgroup STM32_EVAL_SPI_FLASH_Exported_Macros
00084   * @{
00085   */
00086 /**
00087   * @brief  Select sFLASH: Chip Select pin low
00088   */
00089 #define sFLASH_CS_LOW()       GPIO_ResetBits(sFLASH_CS_GPIO_PORT, sFLASH_CS_PIN)
00090 /**
00091   * @brief  Deselect sFLASH: Chip Select pin high
00092   */
00093 #define sFLASH_CS_HIGH()      GPIO_SetBits(sFLASH_CS_GPIO_PORT, sFLASH_CS_PIN)   
00094 /**
00095   * @}
00096   */ 
00097   
00098 
00099 
00100 /** @defgroup STM32_EVAL_SPI_FLASH_Exported_Functions
00101   * @{
00102   */
00103 /**
00104   * @brief  High layer functions
00105   */
00106 void sFLASH_DeInit(void);
00107 void sFLASH_Init(void);
00108 void sFLASH_EraseSector(uint32_t SectorAddr);
00109 void sFLASH_EraseBulk(void);
00110 void sFLASH_WritePage(uint8_t* pBuffer, uint32_t WriteAddr, uint16_t NumByteToWrite);
00111 void sFLASH_WriteBuffer(uint8_t* pBuffer, uint32_t WriteAddr, uint16_t NumByteToWrite);
00112 void sFLASH_ReadBuffer(uint8_t* pBuffer, uint32_t ReadAddr, uint16_t NumByteToRead);
00113 uint32_t sFLASH_ReadID(void);
00114 void sFLASH_StartReadSequence(uint32_t ReadAddr);
00115 
00116 /**
00117   * @brief  Low layer functions
00118   */
00119 uint8_t sFLASH_ReadByte(void);
00120 uint8_t sFLASH_SendByte(uint8_t byte);
00121 uint16_t sFLASH_SendHalfWord(uint16_t HalfWord);
00122 void sFLASH_WriteEnable(void);
00123 void sFLASH_WaitForWriteEnd(void);
00124 
00125 #ifdef __cplusplus
00126 }
00127 #endif
00128 
00129 #endif /* __STM32_EVAL_SPI_FLASH_H */
00130 /**
00131   * @}
00132   */
00133 
00134 /**
00135   * @}
00136   */
00137 
00138 /**
00139   * @}
00140   */
00141 
00142 /**
00143   * @}
00144   */ 
00145 
00146 /**
00147   * @}
00148   */  
00149 
00150 /******************* (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