RTEMS 6.3
Loading...
Searching...
No Matches
flashdisk.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
12
13/*
14 * Copyright (C) 2007 Chris Johns
15 *
16 * Redistribution and use in source and binary forms, with or without
17 * modification, are permitted provided that the following conditions
18 * are met:
19 * 1. Redistributions of source code must retain the above copyright
20 * notice, this list of conditions and the following disclaimer.
21 * 2. Redistributions in binary form must reproduce the above copyright
22 * notice, this list of conditions and the following disclaimer in the
23 * documentation and/or other materials provided with the distribution.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
29 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 * POSSIBILITY OF SUCH DAMAGE.
36 */
37
38#if !defined (_RTEMS_FLASHDISK_H_)
39#define _RTEMS_FLASHDISK_H_
40
41#include <stdint.h>
42#include <sys/ioctl.h>
43
44#include <rtems.h>
45
46#ifdef __cplusplus
47extern "C" {
48#endif /* __cplusplus */
49
146
150#define RTEMS_FLASHDISK_DEVICE_BASE_NAME "/dev/fdd"
151
152#define RTEMS_FDISK_IOCTL_ERASE_DISK _IO('B', 128)
153#define RTEMS_FDISK_IOCTL_COMPACT _IO('B', 129)
154#define RTEMS_FDISK_IOCTL_ERASE_USED _IO('B', 130)
155#define RTEMS_FDISK_IOCTL_MONITORING _IO('B', 131)
156#define RTEMS_FDISK_IOCTL_INFO_LEVEL _IO('B', 132)
157#define RTEMS_FDISK_IOCTL_PRINT_STATUS _IO('B', 133)
158
164{
165 uint32_t block_size;
166 uint32_t block_count;
167 uint32_t unavail_blocks;
168 uint32_t device_count;
169 uint32_t segment_count;
170 uint32_t page_count;
171 uint32_t blocks_used;
172 uint32_t segs_available;
173 uint32_t segs_used;
174 uint32_t segs_failed;
175 uint32_t seg_erases;
176 uint32_t pages_desc;
177 uint32_t pages_active;
178 uint32_t pages_used;
179 uint32_t pages_bad;
180 uint32_t info_level;
182
194{
195 uint16_t count;
196 uint16_t segment;
197 uint32_t offset;
198 uint32_t size;
200
204#define RTEMS_FDISK_KBYTES(_k) (UINT32_C(1024) * (_k))
205
210
220{
240 uint32_t device,
241 uint32_t segment,
242 uint32_t offset,
243 void* buffer,
244 uint32_t size);
245
265 uint32_t device,
266 uint32_t segment,
267 uint32_t offset,
268 const void* buffer,
269 uint32_t size);
270
289 uint32_t device,
290 uint32_t segment,
291 uint32_t offset,
292 uint32_t size);
293
313 uint32_t device,
314 uint32_t segment,
315 uint32_t offset,
316 const void* buffer,
317 uint32_t size);
318
333 uint32_t device,
334 uint32_t segment);
335
348 int (*erase_device) (const struct rtems_fdisk_device_desc* dd,
349 uint32_t device);
350
352
370
425
426/*
427 * Driver flags.
428 */
429
433#define RTEMS_FDISK_BACKGROUND_ERASE (1 << 0)
434
438#define RTEMS_FDISK_BACKGROUND_COMPACT (1 << 1)
439
445#define RTEMS_FDISK_CHECK_PAGES (1 << 2)
446
451#define RTEMS_FDISK_BLANK_CHECK_BEFORE_WRITE (1 << 3)
452
467 void* arg);
468
474
480
482
483#ifdef __cplusplus
484}
485#endif /* __cplusplus */
486
487#endif
rtems_status_code rtems_device_driver
This type shall be used in device driver entry declarations and definitions.
Definition io.h:90
uint32_t rtems_device_major_number
This integer type represents the major number of devices.
Definition io.h:103
uint32_t rtems_device_minor_number
This integer type represents the minor number of devices.
Definition io.h:115
rtems_device_driver rtems_fdisk_initialize(rtems_device_major_number major, rtems_device_minor_number minor, void *arg)
const rtems_flashdisk_config rtems_flashdisk_configuration[]
External reference to the configuration. Please supply. Support is present in confdefs....
uint32_t rtems_flashdisk_configuration_size
External reference to the number of configurations. Please supply. Support is present in confdefs....
This header file defines the RTEMS Classic API.
Flash Device Descriptor holds the segments in a device.
Definition flashdisk.h:365
const rtems_fdisk_driver_handlers * flash_ops
Definition flashdisk.h:368
const rtems_fdisk_segment_desc * segments
Definition flashdisk.h:367
uint32_t segment_count
Definition flashdisk.h:366
Flash Low Level driver handlers.
Definition flashdisk.h:220
int(*) erase(const rtems_fdisk_segment_desc *sd, uint32_t device, uint32_t segment)
Definition flashdisk.h:332
int(*) blank(const rtems_fdisk_segment_desc *sd, uint32_t device, uint32_t segment, uint32_t offset, uint32_t size)
Definition flashdisk.h:288
int(*) write(const rtems_fdisk_segment_desc *sd, uint32_t device, uint32_t segment, uint32_t offset, const void *buffer, uint32_t size)
Definition flashdisk.h:264
int(*) verify(const rtems_fdisk_segment_desc *sd, uint32_t device, uint32_t segment, uint32_t offset, const void *buffer, uint32_t size)
Definition flashdisk.h:312
int(*) erase_device(const struct rtems_fdisk_device_desc *dd, uint32_t device)
Definition flashdisk.h:348
int(*) read(const rtems_fdisk_segment_desc *sd, uint32_t device, uint32_t segment, uint32_t offset, void *buffer, uint32_t size)
Definition flashdisk.h:239
Flash Disk Monitoring Data allows a user to obtain the current status of the disk.
Definition flashdisk.h:164
Flash Segment Descriptor holds, number of continuous segments in the device of this type,...
Definition flashdisk.h:194
uint32_t size
Definition flashdisk.h:198
uint16_t segment
Definition flashdisk.h:196
uint32_t offset
Definition flashdisk.h:197
uint16_t count
Definition flashdisk.h:195
RTEMS Flash Disk configuration table used to initialise the driver.
Definition flashdisk.h:401
uint32_t flags
Definition flashdisk.h:405
uint32_t avail_compact_segs
Definition flashdisk.h:422
uint32_t info_level
Definition flashdisk.h:423
uint32_t block_size
Definition flashdisk.h:402
const rtems_fdisk_device_desc * devices
Definition flashdisk.h:404
uint32_t compact_segs
Definition flashdisk.h:414
uint32_t device_count
Definition flashdisk.h:403
uint32_t unavail_blocks
Definition flashdisk.h:412