RTEMS
6.3
Toggle main menu visibility
Loading...
Searching...
No Matches
cpukit
include
rtems
nvdisk.h
Go to the documentation of this file.
1
/* SPDX-License-Identifier: BSD-2-Clause */
2
8
9
/*
10
* Copyright (C) 2007 Chris Johns
11
*
12
* Redistribution and use in source and binary forms, with or without
13
* modification, are permitted provided that the following conditions
14
* are met:
15
* 1. Redistributions of source code must retain the above copyright
16
* notice, this list of conditions and the following disclaimer.
17
* 2. Redistributions in binary form must reproduce the above copyright
18
* notice, this list of conditions and the following disclaimer in the
19
* documentation and/or other materials provided with the distribution.
20
*
21
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
25
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31
* POSSIBILITY OF SUCH DAMAGE.
32
*/
33
44
#if !defined (_RTEMS_NVDISK_H_)
45
#define _RTEMS_NVDISK_H_
46
47
#include <stdint.h>
48
#include <sys/ioctl.h>
49
50
#include <
rtems.h
>
51
52
#ifdef __cplusplus
53
extern
"C"
{
54
#endif
/* __cplusplus */
55
59
#define RTEMS_NVDISK_DEVICE_BASE_NAME "/dev/nvd"
60
80
#define RTEMS_NVDISK_IOCTL_ERASE_DISK _IO('B', 128)
81
#define RTEMS_NVDISK_IOCTL_MONITORING _IO('B', 129)
82
#define RTEMS_NVDISK_IOCTL_INFO_LEVEL _IO('B', 130)
83
#define RTEMS_NVDISK_IOCTL_PRINT_STATUS _IO('B', 131)
84
89
typedef
struct
rtems_nvdisk_monitor_data
90
{
91
uint32_t block_size;
92
uint32_t block_count;
93
uint32_t page_count;
94
uint32_t pages_available;
95
uint32_t pages_used;
96
uint32_t info_level;
97
}
rtems_nvdisk_monitor_data
;
98
102
#define RTEMS_NVDISK_KBYTES(_k) ((_k) * 1024)
103
112
typedef
struct
rtems_nvdisk_driver_handlers
113
{
127
int (*
read
) (uint32_t device, uint32_t flags,
void
* base,
128
uint32_t offset,
void
* buffer,
size_t
size);
129
143
int (*
write
) (uint32_t device, uint32_t flags,
void
* base,
144
uint32_t offset,
const
void
* buffer,
size_t
size);
145
159
int (*
verify
) (uint32_t device, uint32_t flags,
void
* base,
160
uint32_t offset,
const
void
* buffer,
size_t
size);
161
162
}
rtems_nvdisk_driver_handlers
;
163
173
typedef
struct
rtems_nvdisk_device_desc
174
{
175
uint32_t
flags
;
176
void
*
base
;
177
uint32_t
size
;
178
const
rtems_nvdisk_driver_handlers
*
nv_ops
;
179
}
rtems_nvdisk_device_desc
;
180
185
typedef
struct
rtems_nvdisk_config
186
{
187
uint32_t
block_size
;
188
uint32_t
device_count
;
189
const
rtems_nvdisk_device_desc
*
devices
;
190
uint32_t
flags
;
192
uint32_t
info_level
;
193
}
rtems_nvdisk_config
;
194
195
/*
196
* Driver flags.
197
*/
198
204
#define RTEMS_NVDISK_CHECK_PAGES (1 << 0)
205
217
rtems_device_driver
218
rtems_nvdisk_initialize
(
rtems_device_major_number
major,
219
rtems_device_minor_number
minor,
220
void
* arg);
221
226
extern
const
rtems_nvdisk_config
rtems_nvdisk_configuration
[];
227
232
extern
uint32_t
rtems_nvdisk_configuration_size
;
233
234
#ifdef __cplusplus
235
}
236
#endif
/* __cplusplus */
237
238
#endif
rtems_device_driver
rtems_status_code rtems_device_driver
This type shall be used in device driver entry declarations and definitions.
Definition
io.h:90
rtems_device_major_number
uint32_t rtems_device_major_number
This integer type represents the major number of devices.
Definition
io.h:103
rtems_device_minor_number
uint32_t rtems_device_minor_number
This integer type represents the minor number of devices.
Definition
io.h:115
rtems_nvdisk_configuration
const rtems_nvdisk_config rtems_nvdisk_configuration[]
rtems_nvdisk_initialize
rtems_device_driver rtems_nvdisk_initialize(rtems_device_major_number major, rtems_device_minor_number minor, void *arg)
rtems_nvdisk_configuration_size
uint32_t rtems_nvdisk_configuration_size
rtems.h
This header file defines the RTEMS Classic API.
rtems_nvdisk_config
Definition
nvdisk.h:186
rtems_nvdisk_config::block_size
uint32_t block_size
Definition
nvdisk.h:187
rtems_nvdisk_config::info_level
uint32_t info_level
Definition
nvdisk.h:192
rtems_nvdisk_config::device_count
uint32_t device_count
Definition
nvdisk.h:188
rtems_nvdisk_config::flags
uint32_t flags
Definition
nvdisk.h:190
rtems_nvdisk_config::devices
const rtems_nvdisk_device_desc * devices
Definition
nvdisk.h:189
rtems_nvdisk_device_desc
Definition
nvdisk.h:174
rtems_nvdisk_device_desc::nv_ops
const rtems_nvdisk_driver_handlers * nv_ops
Definition
nvdisk.h:178
rtems_nvdisk_device_desc::size
uint32_t size
Definition
nvdisk.h:177
rtems_nvdisk_device_desc::flags
uint32_t flags
Definition
nvdisk.h:175
rtems_nvdisk_device_desc::base
void * base
Definition
nvdisk.h:176
rtems_nvdisk_driver_handlers
Definition
nvdisk.h:113
rtems_nvdisk_driver_handlers::write
int(*) write(uint32_t device, uint32_t flags, void *base, uint32_t offset, const void *buffer, size_t size)
Definition
nvdisk.h:143
rtems_nvdisk_driver_handlers::verify
int(*) verify(uint32_t device, uint32_t flags, void *base, uint32_t offset, const void *buffer, size_t size)
Definition
nvdisk.h:159
rtems_nvdisk_driver_handlers::read
int(*) read(uint32_t device, uint32_t flags, void *base, uint32_t offset, void *buffer, size_t size)
Definition
nvdisk.h:127
rtems_nvdisk_monitor_data
Definition
nvdisk.h:90
Generated by
1.18.0