1 |
608 |
jeremybenn |
/******************** (C) COPYRIGHT 2007 STMicroelectronics ********************
|
2 |
|
|
* File Name : spi_flash.h
|
3 |
|
|
* Author : MCD Application Team
|
4 |
|
|
* Date First Issued : 02/05/2007
|
5 |
|
|
* Description : Header for spi_flash.c file.
|
6 |
|
|
********************************************************************************
|
7 |
|
|
* History:
|
8 |
|
|
* 04/02/2007: V0.2
|
9 |
|
|
* 02/05/2007: V0.1
|
10 |
|
|
********************************************************************************
|
11 |
|
|
* THE PRESENT SOFTWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
|
12 |
|
|
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
|
13 |
|
|
* AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
|
14 |
|
|
* INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
|
15 |
|
|
* CONTENT OF SUCH SOFTWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
|
16 |
|
|
* INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
|
17 |
|
|
*******************************************************************************/
|
18 |
|
|
|
19 |
|
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
20 |
|
|
#ifndef __SPI_FLASH_H
|
21 |
|
|
#define __SPI_FLASH_H
|
22 |
|
|
|
23 |
|
|
/* Includes ------------------------------------------------------------------*/
|
24 |
|
|
#include "stm32f10x_lib.h"
|
25 |
|
|
|
26 |
|
|
/* Exported types ------------------------------------------------------------*/
|
27 |
|
|
/* Exported constants --------------------------------------------------------*/
|
28 |
|
|
#define Low 0x00 /* Chip Select line low */
|
29 |
|
|
#define High 0x01 /* Chip Select line high */
|
30 |
|
|
|
31 |
|
|
/* Exported macro ------------------------------------------------------------*/
|
32 |
|
|
/* Exported functions ------------------------------------------------------- */
|
33 |
|
|
/*----- High layer function -----*/
|
34 |
|
|
void SPI_FLASH_Init(void);
|
35 |
|
|
void SPI_FLASH_SectorErase(u32 SectorAddr);
|
36 |
|
|
void SPI_FLASH_BulkErase(void);
|
37 |
|
|
void SPI_FLASH_PageWrite(u8* pBuffer, u32 WriteAddr, u16 NumByteToWrite);
|
38 |
|
|
void SPI_FLASH_BufferWrite(u8* pBuffer, u32 WriteAddr, u16 NumByteToWrite);
|
39 |
|
|
void SPI_FLASH_BufferRead(u8* pBuffer, u32 ReadAddr, u16 NumByteToRead);
|
40 |
|
|
u32 SPI_FLASH_ReadID(void);
|
41 |
|
|
void SPI_FLASH_StartReadSequence(u32 ReadAddr);
|
42 |
|
|
|
43 |
|
|
/*----- Low layer function -----*/
|
44 |
|
|
u8 SPI_FLASH_ReadByte(void);
|
45 |
|
|
void SPI_FLASH_ChipSelect(u8 State);
|
46 |
|
|
u8 SPI_FLASH_SendByte(u8 byte);
|
47 |
|
|
u16 SPI_FLASH_SendHalfWord(u16 HalfWord);
|
48 |
|
|
void SPI_FLASH_WriteEnable(void);
|
49 |
|
|
void SPI_FLASH_WaitForWriteEnd(void);
|
50 |
|
|
|
51 |
|
|
#endif /* __SPI_FLASH_H */
|
52 |
|
|
|
53 |
|
|
/******************* (C) COPYRIGHT 2007 STMicroelectronics *****END OF FILE****/
|