1.9.1. Driver API
Prototype: | intel_gsfi_get_info (alt_flash_fd *fd, flash_region **info, int *number_of_regions |
Include: | <intel_generic_serial_flash_interface_top.h> |
Parameter: |
|
Return: | Return 0 or otherwise return
|
Description: | Provide information about the flash devices. Returns the flash memory offset, flash memory size, number of flash device, number of sectors, and sector size values. |
Prototype: | intel_gsfi_read (alt_flash_dev *flash_info, int offset, void *dest_addr, int length) |
Include: | <intel_generic_serial_flash_interface_top.h> |
Parameter: |
|
Return: | Return 0 for success and otherwise return:
|
Description: | Read data from selected address. This function copies data in the flash and passes it to the destination buffer. |
Prototype: | intel_gsfi_erase_block (alt_flash_dev *flash_info, int block_offset) |
Include: | <intel_generic_serial_flash_interface_top.h> |
Parameter: |
|
Return: | Return 0 for success and otherwise return:
|
Description: | Erase a single flash sector. |
Prototype: | intel_gsfi_write_block (alt_flash_dev *flash_info, int block_offset, int data_offset, const void *data, int length) |
Include: | <intel_generic_serial_flash_interface_top.h> |
Parameter: |
|
Return: | Return 0 for success and otherwise:
|
Description: | Write one block/sector of data to the flash. The length of the write cannot spill into the adjacent sector, the function assumes the address is empty, otherwise you should erase it first. |
Prototype: | intel_gsfi_write (alt_flash_dev *flash_info, int offset, const void *src_addr, int length) |
Include: | <intel_generic_serial_flash_interface_top.h> |
Parameter: |
|
Return: | Return 0 for success and otherwise:
|
Description: | Program the data into the flash at the selected address. This function automatically erases the block as needed. |
Prototype: | intel_gsfi_lock (alt_flash_dev *flash_info, alt_u32 sectors_to_lock) |
Include: | <intel_generic_serial_flash_interface_top.h> |
Parameter: |
|
Return: | Return 0 for success and otherwise:
|
Description: | Perform block protection on a range of the flash sectors. The protected flash sectors cannot be written or erased. Refer to the flash device datasheet for the protected area definitions. |
Prototype: | intel_gsfi_chip_select (intel_gsfi_dev *flash_info, int flash_device) |
Include: | <intel_generic_serial_flash_interface_top.h> |
Parameter: |
|
Return: | Return 0 for success and otherwise:
|
Description: | Select the flash device. |
Prototype: | intel_gsfi_config (intel_gsfi_dev *flash_info, gsfi_config *setting) |
Include: | <intel_generic_serial_flash_interface_top.h> |
Parameter: |
|
Return: | Return 0 for success and otherwise:
|
Description: | Configure: |
10 Refer to the respective registers in 1.5 Register Map for the input range.
11 Enable this feature by asserting to 1, otherwise disable with 0.