RTEMS  5.1
Data Structures | Macros | Typedefs | Functions | Variables
nvdisk.h File Reference

Non-volatile Disk Block Device Implementation. More...

#include <stdint.h>
#include <sys/ioctl.h>
#include <rtems.h>

Go to the source code of this file.

Data Structures

struct  rtems_nvdisk_monitor_data
 
struct  rtems_nvdisk_driver_handlers
 
struct  rtems_nvdisk_device_desc
 
struct  rtems_nvdisk_config
 

Macros

#define RTEMS_NVDISK_DEVICE_BASE_NAME   "/dev/nvd"
 
#define RTEMS_NVDISK_IOCTL_ERASE_DISK   _IO('B', 128)
 
#define RTEMS_NVDISK_IOCTL_MONITORING   _IO('B', 129)
 
#define RTEMS_NVDISK_IOCTL_INFO_LEVEL   _IO('B', 130)
 
#define RTEMS_NVDISK_IOCTL_PRINT_STATUS   _IO('B', 131)
 
#define RTEMS_NVDISK_KBYTES(_k)   ((_k) * 1024)
 
#define RTEMS_NVDISK_CHECK_PAGES   (1 << 0)
 

Typedefs

typedef struct rtems_nvdisk_monitor_data rtems_nvdisk_monitor_data
 
typedef struct rtems_nvdisk_driver_handlers rtems_nvdisk_driver_handlers
 
typedef struct rtems_nvdisk_device_desc rtems_nvdisk_device_desc
 
typedef struct rtems_nvdisk_config rtems_nvdisk_config
 

Functions

rtems_device_driver rtems_nvdisk_initialize (rtems_device_major_number major, rtems_device_minor_number minor, void *arg)
 

Variables

const rtems_nvdisk_config rtems_nvdisk_configuration []
 
uint32_t rtems_nvdisk_configuration_size
 

Detailed Description

Non-volatile Disk Block Device Implementation.

Macro Definition Documentation

◆ RTEMS_NVDISK_CHECK_PAGES

#define RTEMS_NVDISK_CHECK_PAGES   (1 << 0)

Check the pages during initialisation to see which pages are valid and which are not. This could slow down initialising the disk driver.

◆ RTEMS_NVDISK_DEVICE_BASE_NAME

#define RTEMS_NVDISK_DEVICE_BASE_NAME   "/dev/nvd"

The Non-volatile disk provides a simple directly mapped disk driver with checksums for each. It is designed to provied a disk that can survive a restart. Examples are EEPROM devices which have byte writeable locations, or a battery backed up RAM disk.

The low level driver provides the physical access to the hardware.The base name of the nv disks.

◆ RTEMS_NVDISK_IOCTL_ERASE_DISK

#define RTEMS_NVDISK_IOCTL_ERASE_DISK   _IO('B', 128)

NV disk specific ioctl request types. To use open the device and issue the ioctl call.

int fd = open ("/dev/nvdisk0", O_WRONLY, 0);
if (fd < 0)
{
printf ("driver open failed: %s\n", strerror (errno));
exit (1);
}
if (ioctl (fd, RTEMS_NVDISK_IOCTL_ERASE_DISK) < 0)
{
printf ("driver erase failed: %s\n", strerror (errno));
exit (1);
}
close (fd);

◆ RTEMS_NVDISK_KBYTES

#define RTEMS_NVDISK_KBYTES (   _k)    ((_k) * 1024)

Return the number of kilo-bytes.

Typedef Documentation

◆ rtems_nvdisk_config

RTEMS Non-Volatile Disk configuration table used to initialise the driver.

◆ rtems_nvdisk_device_desc

NV Device Descriptor holds the description of a device that is part of the NV disk.

Typically this structure is part of a table of the device which is referenced in the nvdisk configuration table. The reference is kept in the driver and used all the time to manage the nv device, therefore it must always exist.

◆ rtems_nvdisk_driver_handlers

NV Low Level driver handlers.

Typically this structure is part of a table of handlers in the device which is referenced in the nvdisk configuration table. The reference is kept in the driver and used all the time to manage the nv device, therefore it must always exist.

◆ rtems_nvdisk_monitor_data

NV Disk Monitoring Data allows a user to obtain the current status of the disk.

Function Documentation

◆ rtems_nvdisk_initialize()

rtems_device_driver rtems_nvdisk_initialize ( rtems_device_major_number  major,
rtems_device_minor_number  minor,
void *  arg 
)

Non-volatile disk device driver initialization. Place in a table as the initialisation entry and remainder of the entries are the RTEMS block device generic handlers.

Parameters
majorNV disk major device number.
minorMinor device number, not applicable.
argInitialization argument, not applicable.
Returns
The rtems_device_driver is actually just rtems_status_code.

Variable Documentation

◆ rtems_nvdisk_configuration

const rtems_nvdisk_config rtems_nvdisk_configuration[]

External reference to the configuration. Please supply. Support is present in confdefs.h for providing this variable.

◆ rtems_nvdisk_configuration_size

uint32_t rtems_nvdisk_configuration_size

External reference to the number of configurations. Please supply. Support is present in confdefs.h for providing this variable.