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 sector, 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 uses memcpy_s (altera_safeclib) to copy 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. |