36#ifndef _DEV_FLASHDEV_H
37#define _DEV_FLASHDEV_H
66#define RTEMS_FLASHDEV_IOCTL_OBTAIN 0
72#define RTEMS_FLASHDEV_IOCTL_RELEASE 1
80#define RTEMS_FLASHDEV_IOCTL_JEDEC_ID 2
87#define RTEMS_FLASHDEV_IOCTL_ERASE 3
97#define RTEMS_FLASHDEV_IOCTL_REGION_SET 4
103#define RTEMS_FLASHDEV_IOCTL_REGION_UNSET 5
110#define RTEMS_FLASHDEV_IOCTL_TYPE 6
121#define RTEMS_FLASHDEV_IOCTL_PAGEINFO_BY_OFFSET 7
131#define RTEMS_FLASHDEV_IOCTL_PAGEINFO_BY_INDEX 8
138#define RTEMS_FLASHDEV_IOCTL_PAGE_COUNT 9
145#define RTEMS_FLASHDEV_IOCTL_WRITE_BLOCK_SIZE 10
151#define RTEMS_FLASHDEV_MAX_REGIONS 32
441 const char *flash_path
rtems_flashdev * rtems_flashdev_alloc_and_init(size_t size)
Allocate and initialize the flash device.
Definition: flashdev.c:531
rtems_flashdev_flash_type
Enum for flash type returned from IOCTL call.
Definition: flashdev.h:156
int rtems_flashdev_register(rtems_flashdev *flash, const char *flash_path)
Register the flash device.
Definition: flashdev.c:460
void rtems_flashdev_destroy(rtems_flashdev *flash)
Destroys the flash device.
Definition: flashdev.c:508
int rtems_flashdev_init(rtems_flashdev *flash)
Initialize the flash device.
Definition: flashdev.c:524
void rtems_flashdev_destroy_and_free(rtems_flashdev *flash)
Destroys the flash device and frees its memory.
Definition: flashdev.c:513
@ RTEMS_FLASHDEV_NAND
The flash device is NAND flash.
Definition: flashdev.h:164
@ RTEMS_FLASHDEV_NOR
The flash device is NOR flash.
Definition: flashdev.h:160
Page information returned from IOCTL calls.
Definition: flashdev.h:206
off_t location
Offset or index to find page at.
Definition: flashdev.h:210
rtems_flashdev_region page_info
Information returned about the page. Including the base offset and size of page.
Definition: flashdev.h:216
Struct holding region definitions.
Definition: flashdev.h:184
int max_regions
The maximum regions that can be defined at once.
Definition: flashdev.h:188
rtems_flashdev_region * regions
Pointer to array of rtems_flashdev_region of length max_regions.
Definition: flashdev.h:194
uint32_t * bit_allocator
Array of uint32_t acting as bit allocator for regions array.
Definition: flashdev.h:200
General definition for on flash device.
Definition: flashdev.h:170
size_t size
Length of region.
Definition: flashdev.h:178
off_t offset
Base of region.
Definition: flashdev.h:174
Flash device.
Definition: flashdev.h:222
int(* erase)(rtems_flashdev *flash, uintptr_t offset, size_t count)
Call to the device driver to erase the flash device.
Definition: flashdev.h:269
int(* write_block_size)(rtems_flashdev *flashdev, size_t *write_block_size)
Call to device driver to return the minimum write size of the flash device.
Definition: flashdev.h:362
int(* page_info_by_offset)(rtems_flashdev *flash, off_t search_offset, off_t *page_offset, size_t *page_size)
Call to device driver to get size and offset of page at given offset.
Definition: flashdev.h:313
void * driver
Pointer to device driver.
Definition: flashdev.h:379
uint32_t(* jedec_id)(rtems_flashdev *flash)
Call to the device driver to return the JEDEC ID.
Definition: flashdev.h:282
int(* page_info_by_index)(rtems_flashdev *flashdev, off_t search_index, off_t *page_offset, size_t *page_size)
Call to device driver to get size and offset of page at given index.
Definition: flashdev.h:332
rtems_flashdev_region_table * region_table
Region table defining size and memory for region allocations.
Definition: flashdev.h:389
int(* write)(rtems_flashdev *flash, uintptr_t offset, size_t count, const void *buffer)
Call to the device driver to write to the flash device.
Definition: flashdev.h:252
int(* page_count)(rtems_flashdev *flashdev, int *page_count)
Call to device driver to return the number of pages on the flash device.
Definition: flashdev.h:348
void(* destroy)(rtems_flashdev *flashdev)
Destroys the flash device.
Definition: flashdev.h:372
int(* flash_type)(rtems_flashdev *flash, rtems_flashdev_flash_type *type)
Call to the device driver to return the flash type.
Definition: flashdev.h:295
int(* read)(rtems_flashdev *flash, uintptr_t offset, size_t count, void *buffer)
Call to the device driver to read the flash device.
Definition: flashdev.h:234
rtems_recursive_mutex mutex
Mutex to protect the flash device access.
Definition: flashdev.h:384
This header file provides the API of Self-Contained Objects.