RTEMS CPU Kit with SuperCore  4.11.3
nvdisk.h
Go to the documentation of this file.
1 
7 /*
8  * Copyright (C) 2007 Chris Johns
9  *
10  * The license and distribution terms for this file may be
11  * found in the file LICENSE in this distribution or at
12  * http://www.rtems.org/license/LICENSE.
13  */
14 
25 #if !defined (_RTEMS_NVDISK_H_)
26 #define _RTEMS_NVDISK_H_
27 
28 #include <stdint.h>
29 #include <sys/ioctl.h>
30 
31 #include <rtems.h>
32 
36 #define RTEMS_NVDISK_DEVICE_BASE_NAME "/dev/nvd"
37 
57 #define RTEMS_NVDISK_IOCTL_ERASE_DISK _IO('B', 128)
58 #define RTEMS_NVDISK_IOCTL_MONITORING _IO('B', 129)
59 #define RTEMS_NVDISK_IOCTL_INFO_LEVEL _IO('B', 130)
60 #define RTEMS_NVDISK_IOCTL_PRINT_STATUS _IO('B', 131)
61 
67 {
68  uint32_t block_size;
69  uint32_t block_count;
70  uint32_t page_count;
71  uint32_t pages_available;
72  uint32_t pages_used;
73  uint32_t info_level;
75 
79 #define RTEMS_NVDISK_KBYTES(_k) ((_k) * 1024)
80 
90 {
104  int (*read) (uint32_t device, uint32_t flags, void* base,
105  uint32_t offset, void* buffer, size_t size);
106 
120  int (*write) (uint32_t device, uint32_t flags, void* base,
121  uint32_t offset, const void* buffer, size_t size);
122 
136  int (*verify) (uint32_t device, uint32_t flags, void* base,
137  uint32_t offset, const void* buffer, size_t size);
138 
140 
151 {
152  uint32_t flags;
153  void* base;
154  uint32_t size;
157 
162 typedef struct rtems_nvdisk_config
163 {
164  uint32_t block_size;
165  uint32_t device_count;
167  uint32_t flags;
169  uint32_t info_level;
171 
172 /*
173  * Driver flags.
174  */
175 
181 #define RTEMS_NVDISK_CHECK_PAGES (1 << 0)
182 
195 rtems_nvdisk_initialize (rtems_device_major_number major,
196  rtems_device_minor_number minor,
197  void* arg);
198 
203 extern const rtems_nvdisk_config rtems_nvdisk_configuration[];
204 
209 extern uint32_t rtems_nvdisk_configuration_size;
210 
211 #endif
ssize_t read(int fd, void *buffer, size_t count)
POSIX 1003.1b 6.4.1 - Read From a File.
Definition: read.c:27
uint32_t rtems_nvdisk_configuration_size
External reference to the number of configurations.
uint32_t flags
Private user flags.
Definition: nvdisk.h:152
void * base
Base address of the device.
Definition: nvdisk.h:153
uint32_t size
Size of the device.
Definition: nvdisk.h:154
NV Low Level driver handlers.
Definition: nvdisk.h:89
ssize_t write(int fd, const void *buffer, size_t count)
POSIX 1003.1b 6.4.2 - Write to a File.
Definition: write.c:30
struct rtems_nvdisk_driver_handlers rtems_nvdisk_driver_handlers
NV Low Level driver handlers.
RTEMS Non-Volatile Disk configuration table used to initialise the driver.
Definition: nvdisk.h:162
NV Device Descriptor holds the description of a device that is part of the NV disk.
Definition: nvdisk.h:150
const rtems_nvdisk_device_desc * devices
The device descriptions.
Definition: nvdisk.h:166
rtems_status_code
Classic API Status.
Definition: status.h:46
NV Disk Monitoring Data allows a user to obtain the current status of the disk.
Definition: nvdisk.h:66
uint32_t block_size
The block size.
Definition: nvdisk.h:164
struct rtems_nvdisk_device_desc rtems_nvdisk_device_desc
NV Device Descriptor holds the description of a device that is part of the NV disk.
uint32_t device_count
The number of devices.
Definition: nvdisk.h:165
struct rtems_nvdisk_config rtems_nvdisk_config
RTEMS Non-Volatile Disk configuration table used to initialise the driver.
rtems_device_driver rtems_nvdisk_initialize(rtems_device_major_number major, rtems_device_minor_number minor, void *arg)
Non-volatile disk device driver initialization.
Definition: nvdisk.c:765
struct rtems_nvdisk_monitor_data rtems_nvdisk_monitor_data
NV Disk Monitoring Data allows a user to obtain the current status of the disk.
uint32_t info_level
Default info level.
Definition: nvdisk.h:169
const rtems_nvdisk_driver_handlers * nv_ops
Device handlers.
Definition: nvdisk.h:155
uint32_t flags
Set of flags to control driver.
Definition: nvdisk.h:167