RTEMS 7.0-rc1
Loading...
Searching...
No Matches
config-parser.h
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/*
4 * Copyright (C) 2023 On-Line Applications Research Corporation (OAR)
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#ifndef _DEV_NOR_CONFIG_FLASH_H
29#define _DEV_NOR_CONFIG_FLASH_H
30
31#include <rtems/rtems/status.h>
32#include <stddef.h>
33#include <stdint.h>
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
54 /* @brief JEDEC ID */
55 uint32_t jedec_id;
56 /* @brief Sector size in bytes */
57 uint32_t sector_size;
58 /* @brief Number of sectors */
59 uint32_t num_sectors;
60 /* @brief Page size in bytes. This will default to 256 if unavailable. */
61 uint16_t page_size;
62 /* @brief This is the size of the flash device */
63 uint64_t device_size;
64 /* @brief Alternative Sector size in bytes. This will be 0 if the alternative
65 * sector size is unsupported or unavailable.
66 */
67 uint32_t alt_sector_size;
68 /* @brief The command byte to erase sectors in the alternative size */
69 uint8_t alt_sector_cmd;
70 /* @brief Number of sectors for the alternative sector size */
71 uint32_t num_alt_sectors;
73
87 uint8_t *cfi_raw,
88 size_t cfi_raw_len,
90);
91
105 uint8_t *sfdp_raw,
106 size_t sfdp_raw_len,
108);
109
120typedef uint8_t *(*rtems_flash_NOR_config_resource_acquire)(
121 void *context,
122 uint32_t offset,
123 size_t length
124);
125
133 void *context,
134 uint8_t *data
135);
136
141 /* @brief The context provided to the acquire and release functions */
142 void *context;
143 /* @brief The function used to acquire a block of data */
145 /* @brief The function used to release a block of data */
148
163);
164
165#ifdef __cplusplus
166}
167#endif
168
171#endif /* _DEV_NOR_CONFIG_FLASH_H */
rtems_status_code
This enumeration provides status codes for directives of the Classic API.
Definition: status.h:85
rtems_status_code rtems_flash_CFI_parse_from_buffer(uint8_t *cfi_raw, size_t cfi_raw_len, rtems_flash_NOR_config_data *data)
This function parses the provided buffer of CFI data into a rtems_flash_NOR_config_data structure.
Definition: config-parser.c:118
void(* rtems_flash_NOR_config_resource_release)(void *context, uint8_t *data)
release data acquired from the NOR chip.
Definition: config-parser.h:132
rtems_status_code rtems_flash_SFDP_parse(rtems_flash_NOR_config_accessor *accessor, rtems_flash_NOR_config_data *data)
This function parses a SFDP configuration space into a rtems_flash_NOR_config_data structure.
Definition: config-parser.c:327
uint8_t *(* rtems_flash_NOR_config_resource_acquire)(void *context, uint32_t offset, size_t length)
acquire data from the NOR chip.
Definition: config-parser.h:120
rtems_status_code rtems_flash_SFDP_parse_from_buffer(uint8_t *sfdp_raw, size_t sfdp_raw_len, rtems_flash_NOR_config_data *data)
This function parses the provided buffer of SFDP data into a rtems_flash_NOR_config_data structure.
Definition: config-parser.c:447
This header file provides the status codes of Classic API directives and support functions.
This struct allows access to the flash data.
Definition: config-parser.h:140
This struct holds the information parsed from the Common Flash Memory Information (CFI) read from a f...
Definition: config-parser.h:53