| PDL for FM0+ Version1.0 Peripheral Driverl Library for FM0+

- Main Page
- Modules
- Data Structures
- Files

- File List
- Globals

Defines | Functions
C:/pdl_v10/library/utility/s25fl127s/csio_int_s25fl127s.h File Reference
`#include "pdl_user.h"`
`#include "mfs\mfs.h"`
`#include "gpio\gpio.h"`
Include dependency graph for csio_int_s25fl127s.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

## Defines
#define | InitCsioIo(void) {SetPinFunc_SIN1_1(); SetPinFunc_SOT1_1();SetPinFunc_SCK1_1();SetPinFunc_SCS10_1();}
| < CSIO function initialization
#define | FLASH_CSIO_CH &CSIO1
| Flash default page size.
#define | S25FL127S_DEFAULT_PAGE_SIZE (256u)
## Functions
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.

## Detailed Description

S25FL127S driver header file

The S25fl127S is tested in the example, make following pin connection first.

--------------------------------------------------------- | MCU S25fl127S | |--------------------------------------------------------- | Pin Name Pin Count Pin Name | | SCS10_1 1 CS# (pull-up) | | SIN1_1 2 SO/IO1 (pull-up) | | - 3 WP#/IO2 (pull-up) | | GND 4 GND | | SOT1_1 5 SI/IO0 (pull-up) | | SCK1_1 6 CLK (pull-up) | | - 7 HOLD#/IO3/RESET# (pull-up)| | VCC 8 VCC | ---------------------------------------------------------

This driver provides basic operation APIs to access to S25FL127S, based on default memory map as following: -------- 0x00FFFFFF | ... | -------- | 64k | -------- 0x00010000 | ... | -------- | 4k | -------- 0x00000000

The memory map can be configured to other types, which is not implemented and considered in this driver file.

History:

- 2014-03-10 1.0 Edison Zhang First release version.

Definition in file csio_int_s25fl127s.h.

## Define Documentation

#define FLASH_CSIO_CH &CSIO1

Flash default page size.

Definition at line 138 of file csio_int_s25fl127s.h.

Referenced by CsioMasterRxIntCallback(), CsioMasterTxIntCallback(), CsioRxData(), CsioRxReg(), CsioTxCmd(), CsioTxCmdAddr(), CsioTxData(), and S25fl127s_Init().

#define InitCsioIo | ( |  | void | ) | {SetPinFunc_SIN1_1(); SetPinFunc_SOT1_1();SetPinFunc_SCK1_1();SetPinFunc_SCS10_1();}

< CSIO function initialization

CSIO channel used for S25FL127S

Definition at line 133 of file csio_int_s25fl127s.h.

Referenced by S25fl127s_Init().

#define S25FL127S_DEFAULT_PAGE_SIZE (256u)

Definition at line 141 of file csio_int_s25fl127s.h.

Referenced by S25fl127s_PageProgram().

## Function Documentation

en_result_t S25fl127s_4kSectorErase | ( | uint32_t | u32Addr | ) |

Sector erase 4KB sector.

Parameters:

  u32Addr | The address within the 4k area

Return values:

  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.

Here is the call graph for this function:

en_result_t S25fl127s_BulkErase | ( | void |  | ) |

Chip erase the whole Flash memory.

Return values:

  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.

Here is the call graph for this function:

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.

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:

  u32Addr | Address
  pu8Data | Pointer to data address
  u16Size | Data size

Return values:

  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.

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:

  u32Addr | Address
  pu8Data | Pointer to data address
  u32Size | Data size

Return values:

  Ok | Page program OK
  ErrorInvalidParameter | pu8Data == 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:

  pManufactureId | Pointer to manufacture ID
  pDeviceId | Pointer to device ID

Return values:

  Ok | ID 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:

  u32Addr | The address within the 64kB or 256kB area

Return values:

  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.

Here is the call graph for this function: