RTEMS 6.2
Loading...
Searching...
No Matches
flash_sim_flashdev.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
11/*
12 * Copyright (C) 2025 On-Line Applications Research (OAR) Corporation
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions
16 * are met:
17 * 1. Redistributions of source code must retain the above copyright
18 * notice, this list of conditions and the following disclaimer.
19 * 2. Redistributions in binary form must reproduce the above copyright
20 * notice, this list of conditions and the following disclaimer in the
21 * documentation and/or other materials provided with the distribution.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS
24 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
27 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
28 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
29 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
31 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
32 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33 * POSSIBILITY OF SUCH DAMAGE.
34 */
35
36#ifndef NAND_SIM_FLASHDEV_H
37#define NAND_SIM_FLASHDEV_H
38
39#include <dev/flash/flashdev.h>
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
48 uint64_t read_delay_ns;
60 uint64_t total_sectors;
67 void *(*alloc)(size_t size);
72 void (*free)(void *ptr);
73};
74
88);
89
90#ifdef __cplusplus
91}
92#endif
93
94#endif /* NAND_SIM_FLASHDEV_H */
rtems_flashdev * flash_sim_flashdev_init(struct flash_sim_flashdev_attributes *attr)
Initializes a simulated flash device. The flash device is not registered in this call....
Definition: flash_sim_flashdev.c:374
Generic Flash API.
rtems_flashdev_flash_type
Enum for flash type returned from IOCTL call.
Definition: flashdev.h:239
Configuration options for NAND simulation.
Definition: flash_sim_flashdev.h:46
uint64_t write_delay_ns
The minimum delay in nanoseconds for a write operation.
Definition: flash_sim_flashdev.h:50
uint64_t total_sectors
The total number of sectors in the simulated device.
Definition: flash_sim_flashdev.h:60
uint64_t read_delay_ns
The minimum delay in nanoseconds for a read operation.
Definition: flash_sim_flashdev.h:48
uint64_t erase_delay_ns
The minimum delay in nanoseconds for a erase operation.
Definition: flash_sim_flashdev.h:52
uint64_t page_size_bytes
The number of bytes in each page.
Definition: flash_sim_flashdev.h:54
rtems_flashdev_flash_type type
The type of flash that is being simulated.
Definition: flash_sim_flashdev.h:62
void(* free)(void *ptr)
Free function for simulated flash, but not other allocations. free() will be used if NULL.
Definition: flash_sim_flashdev.h:72
uint64_t pages_per_sector
The number of pages in each sector.
Definition: flash_sim_flashdev.h:58
uint64_t page_oob_bytes
The number of spare/out of band (OOB) bytes per page.
Definition: flash_sim_flashdev.h:56
Flash device.
Definition: flashdev.h:358