PebbleOS
Loading...
Searching...
No Matches
Functions
QSPI flash

Generic QSPI NOR flash driver, used by the part drivers to implement Low-level flash driver. More...

Functions

void qspi_flash_init (QSPIFlash *dev, QSPIFlashPart *part, bool coredump_mode)
 Initialize a QSPI flash device.
 
bool qspi_flash_is_in_coredump_mode (QSPIFlash *dev)
 Check whether the device was initialized in core dump mode.
 
bool qspi_flash_check_whoami (QSPIFlash *dev)
 Check the JEDEC ID against the part description.
 
status_t qspi_flash_is_erase_complete (QSPIFlash *dev)
 Check whether an erase has completed.
 
status_t qspi_flash_erase_begin (QSPIFlash *dev, uint32_t addr, bool is_subsector)
 Start an erase.
 
status_t qspi_flash_erase_suspend (QSPIFlash *dev, uint32_t addr)
 Suspend an in-progress erase.
 
void qspi_flash_erase_resume (QSPIFlash *dev, uint32_t addr)
 Resume a suspended erase.
 
void qspi_flash_read_blocking (QSPIFlash *dev, uint32_t addr, void *buffer, uint32_t length)
 Read data, blocking.
 
int qspi_flash_write_page_begin (QSPIFlash *dev, const void *buffer, uint32_t addr, uint32_t length)
 Start writing up to a page.
 
status_t qspi_flash_get_write_status (QSPIFlash *dev)
 Poll the status of a page write.
 
void qspi_flash_set_lower_power_mode (QSPIFlash *dev, bool active)
 Enter or leave deep power-down.
 
status_t qspi_flash_blank_check (QSPIFlash *dev, uint32_t addr, bool is_subsector)
 Check whether a sector or subsector is blank.
 
status_t qspi_flash_write_protection_enable (QSPIFlash *dev)
 Enable write and erase protection.
 
status_t qspi_flash_lock_sector (QSPIFlash *dev, uint32_t addr)
 Lock a sector against writes and erases.
 
status_t qspi_flash_unlock_all (QSPIFlash *dev)
 Unlock all sectors, with the block_unlock_all instruction.
 
status_t qspi_flash_read_security_register (QSPIFlash *dev, uint32_t addr, uint8_t *val)
 Read a byte from a security register.
 
status_t qspi_flash_security_register_is_locked (QSPIFlash *dev, uint32_t address, bool *locked)
 Check whether a security register is locked.
 
status_t qspi_flash_erase_security_register (QSPIFlash *dev, uint32_t addr)
 Erase a security register.
 
status_t qspi_flash_write_security_register (QSPIFlash *dev, uint32_t addr, uint8_t val)
 Write a byte to a security register.
 
const FlashSecurityRegisters * qspi_flash_security_registers_info (QSPIFlash *dev)
 Get the security register layout.
 

Detailed Description

Generic QSPI NOR flash driver, used by the part drivers to implement Low-level flash driver.

Function Documentation

◆ qspi_flash_blank_check()

status_t qspi_flash_blank_check ( QSPIFlash *  dev,
uint32_t  addr,
bool  is_subsector 
)

Check whether a sector or subsector is blank.

Parameters
devDevice.
addrAddress within the sector or subsector.
is_subsectorCheck a subsector instead of a sector.
Returns
As flash_impl_blank_check_sector().

◆ qspi_flash_check_whoami()

bool qspi_flash_check_whoami ( QSPIFlash *  dev)

Check the JEDEC ID against the part description.

Parameters
devDevice.
Returns
true if it matches.

◆ qspi_flash_erase_begin()

status_t qspi_flash_erase_begin ( QSPIFlash *  dev,
uint32_t  addr,
bool  is_subsector 
)

Start an erase.

Parameters
devDevice.
addrAddress of the sector or subsector.
is_subsectorErase a subsector instead of a sector.
Returns
S_SUCCESS or an error.

◆ qspi_flash_erase_resume()

void qspi_flash_erase_resume ( QSPIFlash *  dev,
uint32_t  addr 
)

Resume a suspended erase.

Parameters
devDevice.
addrAddress of the erase.

◆ qspi_flash_erase_security_register()

status_t qspi_flash_erase_security_register ( QSPIFlash *  dev,
uint32_t  addr 
)

Erase a security register.

Parameters
devDevice.
addrSecurity register address.
Returns
As flash_impl_erase_security_register().

◆ qspi_flash_erase_suspend()

status_t qspi_flash_erase_suspend ( QSPIFlash *  dev,
uint32_t  addr 
)

Suspend an in-progress erase.

Parameters
devDevice.
addrAddress of the erase.
Returns
As flash_impl_erase_suspend().

◆ qspi_flash_get_write_status()

status_t qspi_flash_get_write_status ( QSPIFlash *  dev)

Poll the status of a page write.

Parameters
devDevice.
Returns
As flash_impl_get_write_status().

◆ qspi_flash_init()

void qspi_flash_init ( QSPIFlash *  dev,
QSPIFlashPart *  part,
bool  coredump_mode 
)

Initialize a QSPI flash device.

Resets the part and configures the controller for its read and write modes.

Parameters
devDevice.
partPart description.
coredump_modeDo not rely on OS services, because a core dump is in progress.

◆ qspi_flash_is_erase_complete()

status_t qspi_flash_is_erase_complete ( QSPIFlash *  dev)

Check whether an erase has completed.

Parameters
devDevice.
Returns
Erase status, as flash_impl_get_erase_status().

◆ qspi_flash_is_in_coredump_mode()

bool qspi_flash_is_in_coredump_mode ( QSPIFlash *  dev)

Check whether the device was initialized in core dump mode.

Parameters
devDevice.
Returns
true in core dump mode.

◆ qspi_flash_lock_sector()

status_t qspi_flash_lock_sector ( QSPIFlash *  dev,
uint32_t  addr 
)

Lock a sector against writes and erases.

Uses the block_lock instruction, with block_lock.lock_data if block_lock.has_lock_data, and checks block_lock_status against block_lock.locked_check.

Parameters
devDevice.
addrSector address.
Returns
S_SUCCESS or an error.

◆ qspi_flash_read_blocking()

void qspi_flash_read_blocking ( QSPIFlash *  dev,
uint32_t  addr,
void *  buffer,
uint32_t  length 
)

Read data, blocking.

Parameters
devDevice.
addrFlash address.
[out]bufferBuffer receiving the data.
lengthNumber of bytes to read.

◆ qspi_flash_read_security_register()

status_t qspi_flash_read_security_register ( QSPIFlash *  dev,
uint32_t  addr,
uint8_t *  val 
)

Read a byte from a security register.

Parameters
devDevice.
addrSecurity register address.
[out]valByte read.
Returns
As flash_impl_read_security_register().

◆ qspi_flash_security_register_is_locked()

status_t qspi_flash_security_register_is_locked ( QSPIFlash *  dev,
uint32_t  address,
bool *  locked 
)

Check whether a security register is locked.

Parameters
devDevice.
addressSecurity register address.
[out]lockedtrue if locked.
Returns
As flash_impl_security_register_is_locked().

◆ qspi_flash_security_registers_info()

const FlashSecurityRegisters * qspi_flash_security_registers_info ( QSPIFlash *  dev)

Get the security register layout.

Parameters
devDevice.
Returns
Security register information.

◆ qspi_flash_set_lower_power_mode()

void qspi_flash_set_lower_power_mode ( QSPIFlash *  dev,
bool  active 
)

Enter or leave deep power-down.

Parameters
devDevice.
activetrue to enter deep power-down.

◆ qspi_flash_unlock_all()

status_t qspi_flash_unlock_all ( QSPIFlash *  dev)

Unlock all sectors, with the block_unlock_all instruction.

Parameters
devDevice.
Returns
S_SUCCESS or an error.

◆ qspi_flash_write_page_begin()

int qspi_flash_write_page_begin ( QSPIFlash *  dev,
const void *  buffer,
uint32_t  addr,
uint32_t  length 
)

Start writing up to a page.

Parameters
devDevice.
bufferData to write.
addrFlash address.
lengthNumber of bytes available in buffer.
Returns
As flash_impl_write_page_begin().

◆ qspi_flash_write_protection_enable()

status_t qspi_flash_write_protection_enable ( QSPIFlash *  dev)

Enable write and erase protection.

Uses the write_protection_enable instruction and checks the result of read_protection_status against block_lock.protection_enabled_mask.

Parameters
devDevice.
Returns
S_SUCCESS, S_NO_ACTION_REQUIRED if unsupported, or an error.

◆ qspi_flash_write_security_register()

status_t qspi_flash_write_security_register ( QSPIFlash *  dev,
uint32_t  addr,
uint8_t  val 
)

Write a byte to a security register.

Parameters
devDevice.
addrSecurity register address.
valByte to write.
Returns
As flash_impl_write_security_register().