RTEMS  5.0.0
flashdisk.h
Go to the documentation of this file.
1 
11 /*
12  * Copyright (C) 2007 Chris Johns
13  *
14  * The license and distribution terms for this file may be
15  * found in the file LICENSE in this distribution or at
16  * http://www.rtems.org/license/LICENSE.
17  */
18 
19 #if !defined (_RTEMS_FLASHDISK_H_)
20 #define _RTEMS_FLASHDISK_H_
21 
22 #include <stdint.h>
23 #include <sys/ioctl.h>
24 
25 #include <rtems.h>
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif /* __cplusplus */
30 
131 #define RTEMS_FLASHDISK_DEVICE_BASE_NAME "/dev/fdd"
132 
133 #define RTEMS_FDISK_IOCTL_ERASE_DISK _IO('B', 128)
134 #define RTEMS_FDISK_IOCTL_COMPACT _IO('B', 129)
135 #define RTEMS_FDISK_IOCTL_ERASE_USED _IO('B', 130)
136 #define RTEMS_FDISK_IOCTL_MONITORING _IO('B', 131)
137 #define RTEMS_FDISK_IOCTL_INFO_LEVEL _IO('B', 132)
138 #define RTEMS_FDISK_IOCTL_PRINT_STATUS _IO('B', 133)
139 
145 {
146  uint32_t block_size;
147  uint32_t block_count;
148  uint32_t unavail_blocks;
149  uint32_t device_count;
150  uint32_t segment_count;
151  uint32_t page_count;
152  uint32_t blocks_used;
153  uint32_t segs_available;
154  uint32_t segs_used;
155  uint32_t segs_failed;
156  uint32_t seg_erases;
157  uint32_t pages_desc;
158  uint32_t pages_active;
159  uint32_t pages_used;
160  uint32_t pages_bad;
161  uint32_t info_level;
163 
175 {
176  uint16_t count;
177  uint16_t segment;
178  uint32_t offset;
179  uint32_t size;
181 
185 #define RTEMS_FDISK_KBYTES(_k) (UINT32_C(1024) * (_k))
186 
191 
201 {
220  int (*read) (const rtems_fdisk_segment_desc* sd,
221  uint32_t device,
222  uint32_t segment,
223  uint32_t offset,
224  void* buffer,
225  uint32_t size);
226 
245  int (*write) (const rtems_fdisk_segment_desc* sd,
246  uint32_t device,
247  uint32_t segment,
248  uint32_t offset,
249  const void* buffer,
250  uint32_t size);
251 
269  int (*blank) (const rtems_fdisk_segment_desc* sd,
270  uint32_t device,
271  uint32_t segment,
272  uint32_t offset,
273  uint32_t size);
274 
293  int (*verify) (const rtems_fdisk_segment_desc* sd,
294  uint32_t device,
295  uint32_t segment,
296  uint32_t offset,
297  const void* buffer,
298  uint32_t size);
299 
313  int (*erase) (const rtems_fdisk_segment_desc* sd,
314  uint32_t device,
315  uint32_t segment);
316 
329  int (*erase_device) (const struct rtems_fdisk_device_desc* dd,
330  uint32_t device);
331 
333 
346 {
347  uint32_t segment_count;
351 
382 {
383  uint32_t block_size;
384  uint32_t device_count;
386  uint32_t flags;
393  uint32_t unavail_blocks;
394 
395  uint32_t compact_segs;
404  uint32_t info_level;
406 
407 /*
408  * Driver flags.
409  */
410 
414 #define RTEMS_FDISK_BACKGROUND_ERASE (1 << 0)
415 
419 #define RTEMS_FDISK_BACKGROUND_COMPACT (1 << 1)
420 
426 #define RTEMS_FDISK_CHECK_PAGES (1 << 2)
427 
432 #define RTEMS_FDISK_BLANK_CHECK_BEFORE_WRITE (1 << 3)
433 
446 rtems_fdisk_initialize (rtems_device_major_number major,
447  rtems_device_minor_number minor,
448  void* arg);
449 
455 
460 extern uint32_t rtems_flashdisk_configuration_size;
461 
464 #ifdef __cplusplus
465 }
466 #endif /* __cplusplus */
467 
468 #endif
const rtems_fdisk_device_desc * devices
Definition: flashdisk.h:385
uint32_t segment_count
Definition: flashdisk.h:347
uint32_t info_level
Definition: flashdisk.h:404
ssize_t read(int fd, void *buffer, size_t count)
Definition: read.c:27
uint32_t device_count
Definition: flashdisk.h:384
rtems_device_driver rtems_fdisk_initialize(rtems_device_major_number major, rtems_device_minor_number minor, void *arg)
RTEMS Flash Disk configuration table used to initialise the driver.
Definition: flashdisk.h:381
ssize_t write(int fd, const void *buffer, size_t count)
Definition: write.c:30
Definition: rtemscompat1.h:15
struct rtems_fdisk_monitor_data rtems_fdisk_monitor_data
Flash Disk Monitoring Data allows a user to obtain the current status of the disk.
rtems_status_code
Classic API Status.
Definition: status.h:43
uint16_t count
Definition: flashdisk.h:176
const rtems_flashdisk_config rtems_flashdisk_configuration[]
External reference to the configuration. Please supply. Support is present in confdefs.h for providing this variable.
struct rtems_fdisk_driver_handlers rtems_fdisk_driver_handlers
Flash Low Level driver handlers.
uint32_t compact_segs
Definition: flashdisk.h:395
uint32_t flags
Definition: flashdisk.h:386
uint32_t unavail_blocks
Definition: flashdisk.h:393
const rtems_fdisk_segment_desc * segments
Definition: flashdisk.h:348
uint32_t offset
Definition: flashdisk.h:178
uint32_t rtems_flashdisk_configuration_size
External reference to the number of configurations. Please supply. Support is present in confdefs...
Flash Segment Descriptor holds, number of continuous segments in the device of this type...
Definition: flashdisk.h:174
Flash Disk Monitoring Data allows a user to obtain the current status of the disk.
Definition: flashdisk.h:144
uint16_t segment
Definition: flashdisk.h:177
unsigned size
Definition: tte.h:74
uint32_t avail_compact_segs
Definition: flashdisk.h:403
struct rtems_flashdisk_config rtems_flashdisk_config
RTEMS Flash Disk configuration table used to initialise the driver.
uint32_t block_size
Definition: flashdisk.h:383
const rtems_fdisk_driver_handlers * flash_ops
Definition: flashdisk.h:349
struct rtems_fdisk_device_desc rtems_fdisk_device_desc
Flash Device Descriptor holds the segments in a device.
Flash Device Descriptor holds the segments in a device.
Definition: flashdisk.h:345
uint32_t size
Definition: flashdisk.h:179
struct rtems_fdisk_segment_desc rtems_fdisk_segment_desc
Flash Segment Descriptor holds, number of continuous segments in the device of this type...
Flash Low Level driver handlers.
Definition: flashdisk.h:200