PDL for FM0+  Version1.0
Peripheral Driverl Library for FM0+
C:/pdl_v10/library/utility/s25fl127s/csio_int_s25fl127s.c File Reference
Include dependency graph for csio_int_s25fl127s.c:

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

Detailed Description

A detailed description is available at Module description

History:

  • 2014-03-17 1.0 Edison Zhang First version.

Definition in file csio_int_s25fl127s.c.


Typedef Documentation

Part of SPI Flash command list.

CSIO information.


Enumeration Type Documentation

Part of SPI Flash command list.

Enumerator:
CmdReadId 
CmdReadStatusReg1 
CmdWriteEnable 
CmdWriteDisable 
CmdBulkErase 
Cmd4kSectorErase 
CmdSectorErase 
CmdPagePgm 
CmdRead 
CmdFastRead 

Definition at line 72 of file csio_int_s25fl127s.c.


Function Documentation

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
u8CmdCommand
u8CmdSizeCommand size
u32AddrFlash address
u8AddrSizeAddress size, can be 3 or 4bytes (3 bytes for S25FL127S)
pu8DataPointer to data array to be read
u32DataSizeData size
Return values:
OkCommand, 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().

Here is the call graph for this function:

Here is the caller graph for this function:

static en_result_t CsioRxReg ( uint8_t  u8Cmd,
uint8_t  u8CmdSize,
uint8_t *  pRegValue,
uint8_t  u8RegSize 
) [static]
static en_result_t CsioTxCmd ( uint8_t  u8Cmd,
uint8_t  u8CmdSize 
) [static]

Write command only to S25FL127S.

Parameters:
u8CmdCommand
u8CmdSizeCommand size
Return values:
OkCommand 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().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
u8CmdCommand
u8CmdSizeCommand size
u32AddrAddress
u8AddrSizeAddress size
Return values:
OkCommand 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().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
u8CmdCommand
u8CmdSizeCommand size
u32AddrFlash address
u8AddrSizeAddress size, can be 3 or 4bytes (3 bytes for S25FL127S)
pu8DataPointer to data array to be sent
u32DataSizeData size
Return values:
OkCommand, 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().

Here is the call graph for this function:

Here is the caller graph for this function:

static void Delay ( uint32_t  u32Cnt) [static]

Time delay.

Definition at line 134 of file csio_int_s25fl127s.c.

Referenced by CsioRxData().

Here is the caller graph for this function:

en_result_t S25fl127s_4kSectorErase ( uint32_t  u32Addr)

Sector erase 4KB sector.

Parameters:
u32AddrThe address within the 4k area
Return values:
OkSector Erase ok
ErrorSector 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.

Here is the call graph for this function:

Chip erase the whole Flash memory.

Return values:
OkChip Erase ok
ErrorChip 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.

Here is the call graph for this function:

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.

Parameters:
u32AddrAddress
pu8DataPointer to data address
u16SizeData size
Return values:
OkPage program OK
ErrorInvalidParameteru16Size > S25FL127S_DEFAULT_PAGE_SIZE pu8Data == NULL
ErrorPage 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.

Here is the call graph for this function:

en_result_t S25fl127s_Read ( uint32_t  u32Addr,
uint8_t *  pu8Data,
uint32_t  u32Size 
)

Read data from S25FL127S.

Parameters:
u32AddrAddress
pu8DataPointer to data address
u32SizeData size
Return values:
OkPage program OK
ErrorInvalidParameterpu8Data == NULL

Definition at line 902 of file csio_int_s25fl127s.c.

References CmdRead, CsioRxData(), ErrorInvalidParameter, and Ok.

Here is the call graph for this function:

en_result_t S25fl127s_ReadId ( uint8_t *  pManufactureId,
uint8_t *  pDeviceId 
)

Read ID from S25FL127S.

Parameters:
pManufactureIdPointer to manufacture ID
pDeviceIdPointer to device ID
Return values:
OkID are read normally

Definition at line 692 of file csio_int_s25fl127s.c.

References CmdReadId, CsioRxData(), and Ok.

Here is the call graph for this function:

en_result_t S25fl127s_SectorErase ( uint32_t  u32Addr)

Sector erase 64kB or 256kB sector.

Parameters:
u32AddrThe address within the 64kB or 256kB area
Return values:
OkSector Erase ok
ErrorSector 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.

Here is the call graph for this function:


Variable Documentation

Definition at line 128 of file csio_int_s25fl127s.c.