AT25DFx SerialFlash driver implementation.
Copyright (c) 2013-2018 Microchip Technology Inc. and its subsidiaries.
Data Structures | |
struct | at25dfx_command |
SerialFlash command container. More... | |
Macros | |
#define | AT25DFX_COMMAND_MAX_SIZE (1 + 3 + 2) |
Maximum length of a SerialFlash command. More... | |
#define | AT25DFX_PAGE_SIZE 256 |
AT25DFx page size in bytes. More... | |
Enumerations | |
enum | at25dfx_command_opcode { AT25DFX_COMMAND_PROGRAM_PAGE = 0x02, AT25DFX_COMMAND_READ_STATUS = 0x05, AT25DFX_COMMAND_READ_ARRAY = 0x0b, AT25DFX_COMMAND_READ_DEVICE_ID = 0x9f, AT25DFX_COMMAND_WRITE_ENABLE = 0x06, AT25DFX_COMMAND_WRITE_DISABLE = 0x04, AT25DFX_COMMAND_ERASE_CHIP = 0xc7, AT25DFX_COMMAND_ERASE_BLOCK_4KB = 0x20, AT25DFX_COMMAND_ERASE_BLOCK_32KB = 0x52, AT25DFX_COMMAND_ERASE_BLOCK_64KB = 0xd8, AT25DFX_COMMAND_WRITE_STATUS = 0x01, AT25DFX_COMMAND_PROTECT_SECTOR = 0x36, AT25DFX_COMMAND_UNPROTECT_SECTOR = 0x39, AT25DFX_COMMAND_READ_PROTECT_SECTOR = 0x3c, AT25DFX_COMMAND_SLEEP = 0xb9, AT25DFX_COMMAND_WAKE = 0xab } |
SerialFlash command opcodes. More... | |
enum | at25dfx_status_field { AT25DFX_STATUS_BUSY = (1 << 0), AT25DFX_STATUS_ERROR = (1 << 5), AT25DFX_STATUS_GLOBAL_PROTECT = (0x0f << 2) } |
SerialFlash status bits. More... | |
#define AT25DFX_COMMAND_MAX_SIZE (1 + 3 + 2) |
Maximum length of a SerialFlash command.
Referenced by _at25dfx_chip_issue_read_command_wait(), and _at25dfx_chip_issue_write_command_wait().
#define AT25DFX_PAGE_SIZE 256 |
AT25DFx page size in bytes.
Referenced by at25dfx_chip_write_buffer().
SerialFlash command opcodes.
enum at25dfx_status_field |
|
inlinestatic |
Deselect the chip.
This function deselects the specified chip by driving its CS line high.
[in] | chip | Address of SerialFlash chip instance to operate on. |
References port_pin_set_output_level().
Referenced by _at25dfx_chip_get_nonbusy_status(), _at25dfx_chip_issue_read_command_wait(), and _at25dfx_chip_issue_write_command_wait().
|
inlinestatic |
Issue command to enable writing.
This function issues the command that enables operations which change the SerialFlash content or operation, i.e., programming, erasing and protecting or unprotecting sectors.
[in] | chip | Address of SerialFlash chip instance to operate on. |
References _at25dfx_chip_issue_write_command_wait(), at25dfx_command::address, AT25DFX_COMMAND_WRITE_ENABLE, at25dfx_command::command_size, at25dfx_command::data, at25dfx_command::length, NULL, at25dfx_command::opcode, and at25dfx_command::tx.
Referenced by at25dfx_chip_erase(), at25dfx_chip_erase_block(), at25dfx_chip_set_global_sector_protect(), at25dfx_chip_set_sector_protect(), and at25dfx_chip_write_buffer().
|
inlinestatic |
Select the chip.
This function selects the specified chip by driving its CS line low.
[in] | chip | Address of SerialFlash chip instance to operate on. |
References port_pin_set_output_level().
Referenced by _at25dfx_chip_get_nonbusy_status(), _at25dfx_chip_issue_read_command_wait(), and _at25dfx_chip_issue_write_command_wait().
|
inlinestatic |
Get the device ID of a specific SerialFlash type.
[in] | type | Type of SerialFlash. |
References Assert, AT25DFX_021, AT25DFX_041A, AT25DFX_041B, AT25DFX_081, AT25DFX_081A, AT25DFX_161, AT25DFX_321A, AT25DFX_512B, AT25DFX_641, AT25DFX_L161, and AT25DFX_Q161.
Referenced by at25dfx_chip_check_presence().
|
inlinestatic |
Get the storage size of a specific SerialFlash type.
[in] | type | Type of SerialFlash. |
References Assert, AT25DFX_021, AT25DFX_041A, AT25DFX_041B, AT25DFX_081, AT25DFX_081A, AT25DFX_161, AT25DFX_321A, AT25DFX_512B, AT25DFX_641, AT25DFX_L161, and AT25DFX_Q161.
Referenced by at25dfx_chip_erase_block(), at25dfx_chip_get_sector_protect(), at25dfx_chip_read_buffer(), at25dfx_chip_set_sector_protect(), and at25dfx_chip_write_buffer().