MG32F10x Standard Peripherals Firmware Library

SPI/SPIM2_SPI_FLASH/drv_spi_flash.h
1 /* Define to prevent recursive inclusion -------------------------------------*/
2 #ifndef __DRV_SPI_FLASH_H__
3 #define __DRV_SPI_FLASH_H__
4
5 /* Includes ------------------------------------------------------------------*/
6 #include "mg32f10x.h"
7
8 /* Exported types ------------------------------------------------------------*/
9 /* Exported constants --------------------------------------------------------*/
10 /* Exported macro ------------------------------------------------------------*/
11 /* Exported functions --------------------------------------------------------*/
12
13 void SpiFlash_Init(void);
14 uint32_t SpiFlash_ReadIdentification(void);
15 uint16_t SpiFlash_ReadMidDid(void);
16 void SpiFlash_ReadUniqueID(uint8_t* uid_buf, uint32_t length);
17 uint8_t SpiFlash_ReadStatusReg1(void);
18 uint8_t SpiFlash_ReadStatusReg2(void);
19 uint8_t SpiFlash_ReadStatusReg3(void);
20 void SpiFlash_WaitReady(void);
21 void SpiFlash_WriteEnable(void);
22 void SpiFlash_WriteStatusReg(uint16_t value);
23 void SpiFlash_WriteStatusReg1(uint8_t value);
24 void SpiFlash_WriteStatusReg2(uint8_t value);
25 void SpiFlash_ReadData(uint32_t address, uint8_t* buffer, uint32_t length);
26 void SpiFlash_FastRead(uint32_t address, uint8_t* buffer, uint32_t length);
27 void SpiFlash_ChipErase(void);
28 void SpiFlash_SectorErase(uint32_t address);
29 void SpiFlash_PageProgram(uint32_t address, const uint8_t* buffer, uint16_t length);
30
31 void SpiFlash_WriteBuffer(uint32_t address, const uint8_t* buffer, uint32_t length);
32
33
34 #endif /* __DRV_SPI_FLASH_H__ */