| 184 | |
| 185 | |
| 186 | The Non-Volatile Disk driver supports more than one device per disk. A table of device descriptions describes the devices in a disk and you can have more than one NV disk active at once. |
| 187 | |
| 188 | The NV Disk is suitable for devices that byte or word reprogrammable and retain data over a power loss or target reset. For example battery backed up static RAM or EEPROM type devices. The driver performs no wear levelling as the disk blocks are mapped 1:1 with the devices in the device description table. There is no remapping of blocks. |
| 189 | |
| 190 | A device is describing using the {{{rtems_nvdisk_device_desc</code> structure. It is located in the <file>nvdisk.h</file> header file. The structure is: |
| 191 | |
| 192 | /** |
| 193 | * NV Device Descriptor holds the description of a device that is |
| 194 | * part of the NV disk. |
| 195 | * |
| 196 | * Typically this structure is part of a table of the device which |
| 197 | * is referenced in the nvdisk configuration table. |
| 198 | * The reference is kept in the driver and used all the time to |
| 199 | * manage the nv device, therefore it must always exist. |
| 200 | */ |
| 201 | typedef struct rtems_nvdisk_device_desc |
| 202 | { |
| 203 | uint32_t flags; /**< Private user flags. */ |
| 204 | uint32_t base; /**< Base address of the device. */ |
| 205 | uint32_t size; /**< Size of the device. */ |
| 206 | const rtems_nvdisk_driver_handlers* nv_ops; /**< Device handlers. */ |
| 207 | } rtems_nvdisk_device_desc; |
| 208 | |
| 209 | The {{{flags</code> field provides a private set of flags a specific low level device handlers for a device may need. The {{{base</base> is the base address of the device. Its definition depends on the low level device handlers for a specific device. The {{{size</code> field defines the number of bytes of storage the device provides in bytes. This is the raw number of bytes available to the driver. The {{{nv_ops</code> is a set of handlers for the specific device. |
| 210 | |
| 211 | The NV Disk device requires a set of handlers for each type of device. The handles can manage more than one device in a disk or disks. The handlers are: |
| 212 | |
| 213 | {{{int (*read) (uint32_t device, uint32_t flags, uint32_t base, uint32_t offset, void* buffer, uint32_t size);</code> |
| 214 | |
| 215 | The <tt>nvdisk-sram.h</tt> provides a set of handlers suitable for static RAM. |