![]() |
PDL for FM0+
Version1.0
Peripheral Driverl Library for FM0+
|
#include "csio_int_s25fl127s.h"
Go to the source code of this file.
Data Structures | |
struct | stc_csio_info |
CSIO information. More... | |
Typedefs | |
typedef enum en_flash_cmd | en_flash_cmd_t |
Part of SPI Flash command list. | |
typedef struct stc_csio_info | stc_csio_info_t |
CSIO information. | |
Enumerations | |
enum | en_flash_cmd { CmdReadId = 0x90u, CmdReadStatusReg1 = 0x05u, CmdWriteEnable = 0x06u, CmdWriteDisable = 0x04u, CmdBulkErase = 0x60u, Cmd4kSectorErase = 0x20u, CmdSectorErase = 0xD8u, CmdPagePgm = 0x02u, CmdRead = 0x03u, CmdFastRead = 0x0Bu } |
Part of SPI Flash command list. More... | |
Functions | |
static void | Delay (uint32_t u32Cnt) |
Time delay. | |
static void | CsioMasterTxIntCallback (void) |
CSIO master transfer interrupt callback function. | |
static void | CsioMasterRxIntCallback (void) |
CSIO Master receive interrupt callback function. | |
static en_result_t | CsioTxData (uint8_t u8Cmd, uint8_t u8CmdSize, uint32_t u32Addr, uint8_t u8AddrSize, uint8_t *pu8Data, uint32_t u32DataSize) |
Write command, address, data to S25FL127S. | |
static en_result_t | CsioRxData (uint8_t u8Cmd, uint8_t u8CmdSize, uint32_t u32Addr, uint8_t u8AddrSize, uint8_t *pu8Data, uint32_t u32DataSize) |
Read data from S25FL127S. | |
static en_result_t | CsioRxReg (uint8_t u8Cmd, uint8_t u8CmdSize, uint8_t *pRegValue, uint8_t u8RegSize) |
Read register from S25FL127S. | |
static en_result_t | CsioTxCmd (uint8_t u8Cmd, uint8_t u8CmdSize) |
Write command only to S25FL127S. | |
static en_result_t | CsioTxCmdAddr (uint8_t u8Cmd, uint8_t u8CmdSize, uint32_t u32Addr, uint8_t u8AddrSize) |
Write command and address only to S25FL127S. | |
en_result_t | S25fl127s_Init (void) |
Initialize S25FL127S. | |
en_result_t | S25fl127s_ReadId (uint8_t *pManufactureId, uint8_t *pDeviceId) |
Read ID from S25FL127S. | |
en_result_t | S25fl127s_BulkErase (void) |
Chip erase the whole Flash memory. | |
en_result_t | S25fl127s_4kSectorErase (uint32_t u32Addr) |
Sector erase 4KB sector. | |
en_result_t | S25fl127s_SectorErase (uint32_t u32Addr) |
Sector erase 64kB or 256kB sector. | |
en_result_t | S25fl127s_PageProgram (uint32_t u32Addr, uint8_t *pu8Data, uint16_t u16Size) |
Page program S25FL127S. | |
en_result_t | S25fl127s_Read (uint32_t u32Addr, uint8_t *pu8Data, uint32_t u32Size) |
Read data from S25FL127S. | |
Variables | |
stc_csio_int_sel_t | stcCsio1IntSel |
stc_csio_int_cb_t | stcCsio1IntCb |
stc_csio_info_t | stcCsioInfo |
A detailed description is available at Module description
History:
Definition in file csio_int_s25fl127s.c.
typedef enum en_flash_cmd en_flash_cmd_t |
Part of SPI Flash command list.
typedef struct stc_csio_info stc_csio_info_t |
CSIO information.
enum en_flash_cmd |
Part of SPI Flash command list.
CmdReadId | |
CmdReadStatusReg1 | |
CmdWriteEnable | |
CmdWriteDisable | |
CmdBulkErase | |
Cmd4kSectorErase | |
CmdSectorErase | |
CmdPagePgm | |
CmdRead | |
CmdFastRead |
Definition at line 72 of file csio_int_s25fl127s.c.
static void CsioMasterRxIntCallback | ( | void | ) | [static] |
CSIO Master receive interrupt callback function.
Definition at line 169 of file csio_int_s25fl127s.c.
References stc_csio_info::bRwSyncFlag, stc_csio_info::bRxFinish, stc_csio_int_sel::bRxInt, FLASH_CSIO_CH, Mfs_Csio_DisableInt(), Mfs_Csio_ReceiveData(), PDL_ZERO_STRUCT, stc_csio_info::pu8RxData, TRUE, stc_csio_info::u32Cnt, and stc_csio_info::u8RxSize.
Referenced by CsioRxData(), and CsioRxReg().
static void CsioMasterTxIntCallback | ( | void | ) | [static] |
CSIO master transfer interrupt callback function.
Definition at line 143 of file csio_int_s25fl127s.c.
References stc_csio_info::bRwSyncFlag, stc_csio_info::bTxFinish, stc_csio_int_sel::bTxInt, FALSE, FLASH_CSIO_CH, Mfs_Csio_DisableInt(), Mfs_Csio_SendData(), PDL_ZERO_STRUCT, stc_csio_info::pu8TxData, TRUE, stc_csio_info::u32Cnt, and stc_csio_info::u8TxSize.
Referenced by CsioRxData(), CsioRxReg(), CsioTxCmd(), CsioTxCmdAddr(), and CsioTxData().
static en_result_t CsioRxData | ( | uint8_t | u8Cmd, |
uint8_t | u8CmdSize, | ||
uint32_t | u32Addr, | ||
uint8_t | u8AddrSize, | ||
uint8_t * | pu8Data, | ||
uint32_t | u32DataSize | ||
) | [static] |
Read data from S25FL127S.
u8Cmd | Command |
u8CmdSize | Command size |
u32Addr | Flash address |
u8AddrSize | Address size, can be 3 or 4bytes (3 bytes for S25FL127S) |
pu8Data | Pointer to data array to be read |
u32DataSize | Data size |
Ok | Command, address, data are sent normally |
Definition at line 327 of file csio_int_s25fl127s.c.
References stc_csio_info::bRxFinish, stc_csio_int_sel::bRxInt, stc_csio_info::bTxFinish, stc_csio_int_sel::bTxInt, CsioMasterRxIntCallback(), CsioMasterTxIntCallback(), CsioRx, CsioTx, CsioTxEmpty, CsioTxIdle, CsPinScs0, Delay(), FALSE, FLASH_CSIO_CH, Mfs_Csio_DisableFunc(), Mfs_Csio_EnableFunc(), Mfs_Csio_EnableInt(), Mfs_Csio_GetStatus(), Mfs_Csio_SendData(), Mfs_Csio_SetCsHoldStatus(), Mfs_Csio_SetCsTransferByteCount(), Ok, PDL_ZERO_STRUCT, stc_csio_int_cb::pfnRxIntCb, stc_csio_int_cb::pfnTxIntCb, stc_csio_info::pu8RxData, stc_csio_info::pu8TxData, TRUE, stc_csio_info::u32Cnt, stc_csio_info::u8RxSize, and stc_csio_info::u8TxSize.
Referenced by S25fl127s_Read(), and S25fl127s_ReadId().
static en_result_t CsioRxReg | ( | uint8_t | u8Cmd, |
uint8_t | u8CmdSize, | ||
uint8_t * | pRegValue, | ||
uint8_t | u8RegSize | ||
) | [static] |
Read register from S25FL127S.
u8Cmd | Command |
u8CmdSize | Command size |
pRegValue | Poitner to register value |
u8RegSize | Read times |
Ok | Command, address, data are sent normally |
Definition at line 469 of file csio_int_s25fl127s.c.
References stc_csio_info::bRxFinish, stc_csio_int_sel::bRxInt, stc_csio_info::bTxFinish, stc_csio_int_sel::bTxInt, CsioMasterRxIntCallback(), CsioMasterTxIntCallback(), CsioRx, CsioTx, CsioTxEmpty, CsPinScs0, FALSE, FLASH_CSIO_CH, Mfs_Csio_DisableFunc(), Mfs_Csio_EnableFunc(), Mfs_Csio_EnableInt(), Mfs_Csio_GetStatus(), Mfs_Csio_SendData(), Mfs_Csio_SetCsTransferByteCount(), Ok, PDL_ZERO_STRUCT, stc_csio_int_cb::pfnRxIntCb, stc_csio_int_cb::pfnTxIntCb, stc_csio_info::pu8RxData, stc_csio_info::pu8TxData, TRUE, stc_csio_info::u32Cnt, stc_csio_info::u8RxSize, and stc_csio_info::u8TxSize.
Referenced by S25fl127s_4kSectorErase(), S25fl127s_BulkErase(), S25fl127s_PageProgram(), and S25fl127s_SectorErase().
static en_result_t CsioTxCmd | ( | uint8_t | u8Cmd, |
uint8_t | u8CmdSize | ||
) | [static] |
Write command only to S25FL127S.
u8Cmd | Command |
u8CmdSize | Command size |
Ok | Command are writen normally |
Definition at line 535 of file csio_int_s25fl127s.c.
References stc_csio_info::bTxFinish, stc_csio_int_sel::bTxInt, CsioMasterTxIntCallback(), CsioTx, CsioTxIdle, CsPinScs0, FALSE, FLASH_CSIO_CH, Mfs_Csio_DisableFunc(), Mfs_Csio_EnableFunc(), Mfs_Csio_EnableInt(), Mfs_Csio_GetStatus(), Mfs_Csio_SetCsTransferByteCount(), Ok, PDL_ZERO_STRUCT, stc_csio_int_cb::pfnTxIntCb, stc_csio_info::pu8TxData, TRUE, stc_csio_info::u32Cnt, and stc_csio_info::u8TxSize.
Referenced by S25fl127s_4kSectorErase(), S25fl127s_BulkErase(), S25fl127s_PageProgram(), and S25fl127s_SectorErase().
static en_result_t CsioTxCmdAddr | ( | uint8_t | u8Cmd, |
uint8_t | u8CmdSize, | ||
uint32_t | u32Addr, | ||
uint8_t | u8AddrSize | ||
) | [static] |
Write command and address only to S25FL127S.
u8Cmd | Command |
u8CmdSize | Command size |
u32Addr | Address |
u8AddrSize | Address size |
Ok | Command and address are writen normally |
Definition at line 578 of file csio_int_s25fl127s.c.
References stc_csio_info::bTxFinish, stc_csio_int_sel::bTxInt, CsioMasterTxIntCallback(), CsioTx, CsioTxIdle, CsPinScs0, FALSE, FLASH_CSIO_CH, Mfs_Csio_DisableFunc(), Mfs_Csio_EnableFunc(), Mfs_Csio_EnableInt(), Mfs_Csio_GetStatus(), Mfs_Csio_SetCsTransferByteCount(), Ok, PDL_ZERO_STRUCT, stc_csio_int_cb::pfnTxIntCb, stc_csio_info::pu8TxData, TRUE, stc_csio_info::u32Cnt, and stc_csio_info::u8TxSize.
Referenced by S25fl127s_4kSectorErase(), and S25fl127s_SectorErase().
static en_result_t CsioTxData | ( | uint8_t | u8Cmd, |
uint8_t | u8CmdSize, | ||
uint32_t | u32Addr, | ||
uint8_t | u8AddrSize, | ||
uint8_t * | pu8Data, | ||
uint32_t | u32DataSize | ||
) | [static] |
Write command, address, data to S25FL127S.
u8Cmd | Command |
u8CmdSize | Command size |
u32Addr | Flash address |
u8AddrSize | Address size, can be 3 or 4bytes (3 bytes for S25FL127S) |
pu8Data | Pointer to data array to be sent |
u32DataSize | Data size |
Ok | Command, address, data are Writen normally |
Definition at line 204 of file csio_int_s25fl127s.c.
References stc_csio_info::bTxFinish, stc_csio_int_sel::bTxInt, CsioMasterTxIntCallback(), CsioTx, CsioTxIdle, CsPinScs0, FALSE, FLASH_CSIO_CH, Mfs_Csio_DisableFunc(), Mfs_Csio_EnableFunc(), Mfs_Csio_EnableInt(), Mfs_Csio_GetStatus(), Mfs_Csio_SetCsHoldStatus(), Mfs_Csio_SetCsTransferByteCount(), Ok, PDL_ZERO_STRUCT, stc_csio_int_cb::pfnTxIntCb, stc_csio_info::pu8TxData, TRUE, stc_csio_info::u32Cnt, and stc_csio_info::u8TxSize.
Referenced by S25fl127s_PageProgram().
static void Delay | ( | uint32_t | u32Cnt | ) | [static] |
Time delay.
Definition at line 134 of file csio_int_s25fl127s.c.
Referenced by CsioRxData().
en_result_t S25fl127s_4kSectorErase | ( | uint32_t | u32Addr | ) |
Sector erase 4KB sector.
u32Addr | The address within the 4k area |
Ok | Sector Erase ok |
Error | Sector erase error occurs |
Definition at line 755 of file csio_int_s25fl127s.c.
References Cmd4kSectorErase, CmdReadStatusReg1, CmdWriteDisable, CmdWriteEnable, CsioRxReg(), CsioTxCmd(), CsioTxCmdAddr(), Error, FALSE, Ok, and TRUE.
en_result_t S25fl127s_BulkErase | ( | void | ) |
Chip erase the whole Flash memory.
Ok | Chip Erase ok |
Error | Chip erase error occurs |
Definition at line 711 of file csio_int_s25fl127s.c.
References CmdBulkErase, CmdReadStatusReg1, CmdWriteDisable, CmdWriteEnable, CsioRxReg(), CsioTxCmd(), Error, FALSE, Ok, and TRUE.
en_result_t S25fl127s_Init | ( | void | ) |
Initialize S25FL127S.
Definition at line 632 of file csio_int_s25fl127s.c.
References stc_csio_cs::bActiveHold, stc_mfs_csio_config::bEnableFifo, stc_mfs_csio_config::bEnChipSelection, stc_mfs_csio_config::bEnSyncTransfer, stc_mfs_csio_config::bInvertClk, stc_csio_cs::bScs0En, stc_csio_cs::bScs1En, stc_csio_cs::bScs2En, stc_csio_cs::bScs3En, CsClkNoDiv, CsioActNormalMode, CsioDataMsbFirst, CsioEightBits, CsioMaster, CsioSyncWaitZero, CsLowActive, CsPinScs0, stc_mfs_csio_config::enActMode, stc_mfs_csio_config::enBitDirection, stc_csio_cs::enClkDiv, stc_csio_cs::enCsEndPin, stc_csio_cs::enCsStartPin, stc_mfs_csio_config::enDataLength, stc_csio_cs::enLevel, stc_mfs_csio_config::enMsMode, stc_mfs_csio_config::enSyncWaitTime, Error, FALSE, FLASH_CSIO_CH, InitCsioIo, Mfs_Csio_Init(), Ok, PDL_ZERO_STRUCT, stc_mfs_csio_config::stcCsConfig, TRUE, stc_csio_cs::u16CsDeselectTime, stc_mfs_csio_config::u32BaudRate, stc_csio_cs::u8CsHoldDelayTime, stc_csio_cs::u8CsSetupDelayTime, stc_csio_cs::u8Scs0TransferByteCnt, stc_csio_cs::u8Scs1TransferByteCnt, stc_csio_cs::u8Scs2TransferByteCnt, and stc_csio_cs::u8Scs3TransferByteCnt.
en_result_t S25fl127s_PageProgram | ( | uint32_t | u32Addr, |
uint8_t * | pu8Data, | ||
uint16_t | u16Size | ||
) |
Page program S25FL127S.
The default page size is 256Byte, 256bytes or less can be progammed with this function. The page buffer size can also be set to 512Byte via status register 2, but it is not considered here.
u32Addr | Address |
pu8Data | Pointer to data address |
u16Size | Data size |
Ok | Page program OK |
ErrorInvalidParameter | u16Size > S25FL127S_DEFAULT_PAGE_SIZE pu8Data == NULL |
Error | Page program error |
Definition at line 851 of file csio_int_s25fl127s.c.
References CmdPagePgm, CmdReadStatusReg1, CmdWriteDisable, CmdWriteEnable, CsioRxReg(), CsioTxCmd(), CsioTxData(), Error, ErrorInvalidParameter, FALSE, Ok, S25FL127S_DEFAULT_PAGE_SIZE, and TRUE.
en_result_t S25fl127s_Read | ( | uint32_t | u32Addr, |
uint8_t * | pu8Data, | ||
uint32_t | u32Size | ||
) |
Read data from S25FL127S.
u32Addr | Address |
pu8Data | Pointer to data address |
u32Size | Data size |
Ok | Page program OK |
ErrorInvalidParameter | pu8Data == NULL |
Definition at line 902 of file csio_int_s25fl127s.c.
References CmdRead, CsioRxData(), ErrorInvalidParameter, and Ok.
en_result_t S25fl127s_ReadId | ( | uint8_t * | pManufactureId, |
uint8_t * | pDeviceId | ||
) |
Read ID from S25FL127S.
pManufactureId | Pointer to manufacture ID |
pDeviceId | Pointer to device ID |
Ok | ID are read normally |
Definition at line 692 of file csio_int_s25fl127s.c.
References CmdReadId, CsioRxData(), and Ok.
en_result_t S25fl127s_SectorErase | ( | uint32_t | u32Addr | ) |
Sector erase 64kB or 256kB sector.
u32Addr | The address within the 64kB or 256kB area |
Ok | Sector Erase ok |
Error | Sector erase error occurs |
Definition at line 799 of file csio_int_s25fl127s.c.
References CmdReadStatusReg1, CmdSectorErase, CmdWriteDisable, CmdWriteEnable, CsioRxReg(), CsioTxCmd(), CsioTxCmdAddr(), Error, FALSE, Ok, and TRUE.
Definition at line 127 of file csio_int_s25fl127s.c.
Definition at line 126 of file csio_int_s25fl127s.c.
Definition at line 128 of file csio_int_s25fl127s.c.