Generic Flash API to wrap specific device drivers.
More...
Generic Flash API to wrap specific device drivers.
◆ RTEMS_FLASHDEV_IOCTL_ERASE
#define RTEMS_FLASHDEV_IOCTL_ERASE 3 |
Erases flash device.
- Parameters
-
[in] | erase_args | Pointer to rtems_flashdev_region struct containing offset and size of erase to be performed. |
◆ RTEMS_FLASHDEV_IOCTL_JEDEC_ID
#define RTEMS_FLASHDEV_IOCTL_JEDEC_ID 2 |
Returns the JEDEC ID of the flash device. This IOCTL call is informational only.
- Parameters
-
[out] | jedec_id | Pointer to uint32_t in which the JEDEC ID is returned in. |
◆ RTEMS_FLASHDEV_IOCTL_OBTAIN
#define RTEMS_FLASHDEV_IOCTL_OBTAIN 0 |
Obtains the flash device.
This command has no argument.
◆ RTEMS_FLASHDEV_IOCTL_PAGE_COUNT
#define RTEMS_FLASHDEV_IOCTL_PAGE_COUNT 9 |
Get the number of pages in flash device.
- Parameters
-
[out] | count | Integer containing the number of pages. |
◆ RTEMS_FLASHDEV_IOCTL_PAGEINFO_BY_INDEX
#define RTEMS_FLASHDEV_IOCTL_PAGEINFO_BY_INDEX 8 |
Get the size and address of nth flash page where n is index passed in.
The index ignores the region limiting.
- Parameters
-
◆ RTEMS_FLASHDEV_IOCTL_PAGEINFO_BY_OFFSET
#define RTEMS_FLASHDEV_IOCTL_PAGEINFO_BY_OFFSET 7 |
Get the size and address of flash page at given offset.
The offset ignores the region limiting. To find page of region limited offset add the base of the region to the desired offset.
- Parameters
-
◆ RTEMS_FLASHDEV_IOCTL_REGION_SET
#define RTEMS_FLASHDEV_IOCTL_REGION_SET 4 |
Set a region that limits read, write and erase calls to within it. Regions are file descriptor specific and limited to a single region per file descriptor and 32 regions total per flash device. Regions can be changed or updated by calling this IOCTL again.
- Parameters
-
◆ RTEMS_FLASHDEV_IOCTL_REGION_UNSET
#define RTEMS_FLASHDEV_IOCTL_REGION_UNSET 5 |
Removes the set region on the file descriptor.
This command has no argument.
◆ RTEMS_FLASHDEV_IOCTL_RELEASE
#define RTEMS_FLASHDEV_IOCTL_RELEASE 1 |
Releases the flash device.
This command has no argument.
◆ RTEMS_FLASHDEV_IOCTL_TYPE
#define RTEMS_FLASHDEV_IOCTL_TYPE 6 |
Returns the type of flash device (e.g. NOR or NAND).
- Parameters
-
[out] | flash_type | Pointer to integer which is set to the flash type macro value. |
◆ RTEMS_FLASHDEV_IOCTL_WRITE_BLOCK_SIZE
#define RTEMS_FLASHDEV_IOCTL_WRITE_BLOCK_SIZE 10 |
Get the minimum write size supported by the driver.
- Parameters
-
[out] | count | Integer containing the minimum write size. |
◆ rtems_flashdev_flash_type
Enum for flash type returned from IOCTL call.
Enumerator |
---|
RTEMS_FLASHDEV_NOR | The flash device is NOR flash.
|
RTEMS_FLASHDEV_NAND | The flash device is NAND flash.
|
◆ rtems_flashdev_alloc_and_init()
Allocate and initialize the flash device.
After a successful allocation and initialization of the flash device it must be destroyed via rtems_flashdev_destroy_and_free().
- Parameters
-
[in] | size | The number of bytes to allocate. |
- Return values
-
NULL | Failed to set up flash device. |
non-NULL | The new flash device. |
◆ rtems_flashdev_destroy()
Destroys the flash device.
- Parameters
-
[in] | flash | The flash device. |
◆ rtems_flashdev_destroy_and_free()
Destroys the flash device and frees its memory.
- Parameters
-
[in] | flash | The flash device. |
◆ rtems_flashdev_init()
Initialize the flash device.
After a successful initialization of the flash device it must be destroyed via rtems_flashdev_destory().
After initialization and before registration read, write, erase, jedec_id and flash_type functions need to be set in the flashdev.
- Parameters
-
[in] | flash | The flash device to initialize. |
- Return values
-
1 | Failed to set up flash device. |
0 | Successful set up of flash device. |
◆ rtems_flashdev_register()
int rtems_flashdev_register |
( |
rtems_flashdev * |
flash, |
|
|
const char * |
flash_path |
|
) |
| |
Register the flash device.
This function always claims ownership of the flash device.
After initialization and before registration read, write, erase, jedec_id and flash_type functions need to be set in the flashdev.
- Parameters
-
[in] | flash | The flash device. |
[in] | flash_path | The path to the flash device file. |
- Return values
-
0 | Successful operation. |
non-zero | Failed operation. |