XFusion API
v1.3.0
载入中...
搜索中...
未找到
xf_fal_types.h
浏览该文件的文档.
1
12
#ifndef __XF_FAL_TYPES_H__
13
#define __XF_FAL_TYPES_H__
14
15
/* ==================== [Includes] ========================================== */
16
17
#include "
xf_fal_config_internal.h
"
18
#include "xf_utils.h"
19
20
#ifdef __cplusplus
21
extern
"C"
{
22
#endif
23
24
/* ==================== [Defines] =========================================== */
25
26
#define XF_FAL_SW_VERSION "1.1.0"
27
28
/* ==================== [Typedefs] ========================================== */
29
45
typedef
struct
_xf_fal_flash_ops_t
{
49
xf_err_t
(*
init
)(void);
53
xf_err_t
(*
deinit
)(void);
73
xf_err_t
(*
read
)(
size_t
src_offset,
void
*dst,
size_t
size);
93
xf_err_t
(*
write
)(
size_t
dst_offset,
const
void
*src,
size_t
size);
105
xf_err_t
(*
erase
)(
size_t
offset,
size_t
size);
106
}
xf_fal_flash_ops_t
;
107
124
typedef
struct
_xf_fal_flash_dev_t
{
125
char
*
name
;
126
uint32_t
addr
;
127
size_t
len
;
131
size_t
sector_size
;
136
size_t
page_size
;
141
size_t
io_size
;
145
xf_fal_flash_ops_t
ops
;
146
}
xf_fal_flash_dev_t
;
147
155
typedef
struct
_xf_fal_partition_t
{
156
char
*
name
;
157
char
*
flash_name
;
166
size_t
offset
;
173
size_t
len
;
174
}
xf_fal_partition_t
;
175
191
typedef
struct
_xf_fal_cache_t
{
195
const
xf_fal_partition_t
*
partition
;
199
const
xf_fal_flash_dev_t
*
flash_dev
;
200
}
xf_fal_cache_t
;
201
205
typedef
struct
_xf_fal_ctx_t
{
209
volatile
uint8_t
is_init
;
210
211
#if XF_FAL_LOCK_IS_ENABLE
215
volatile
uint8_t is_lock;
219
xf_lock_t
mutex
;
220
#endif
221
230
const
xf_fal_flash_dev_t
*
flash_device_table
[
XF_FAL_FLASH_DEVICE_NUM
];
231
239
const
xf_fal_partition_t
*
partition_table
[
XF_FAL_PARTITION_TABLE_NUM
];
247
size_t
partition_table_len
[
XF_FAL_PARTITION_TABLE_NUM
];
248
257
xf_fal_cache_t
cache
[
XF_FAL_CACHE_NUM
];
261
volatile
size_t
cached_num
;
262
}
xf_fal_ctx_t
;
263
269
/* ==================== [Global Prototypes] ================================= */
270
271
/* ==================== [Macros] ============================================ */
272
273
#ifdef __cplusplus
274
}
/* extern "C" */
275
#endif
276
277
#endif
// __XF_FAL_TYPES_H__
xf_fal_partition_t
struct _xf_fal_partition_t xf_fal_partition_t
flash 分区结构体。
xf_fal_flash_dev_t
struct _xf_fal_flash_dev_t xf_fal_flash_dev_t
flash 设备结构体。
xf_err_t
int32_t xf_err_t
整形错误类型。 错误码具体值见 xf_err_code_t.
Definition
xf_err.h:69
xf_lock_t
void * xf_lock_t
lock 句柄.
Definition
xf_lock_types.h:40
mutex
static xf_osal_mutex_t mutex
Definition
xf_main.c:35
_xf_fal_cache_t
xf_fal 分区缓存。
Definition
xf_fal_types.h:191
_xf_fal_cache_t::flash_dev
const xf_fal_flash_dev_t * flash_dev
分区对应的 flash 设备对象。
Definition
xf_fal_types.h:199
_xf_fal_cache_t::partition
const xf_fal_partition_t * partition
指向分区信息。
Definition
xf_fal_types.h:195
_xf_fal_ctx_t
xf_fal 对象上下文结构体。
Definition
xf_fal_types.h:205
_xf_fal_ctx_t::cache
xf_fal_cache_t cache[XF_FAL_CACHE_NUM]
缓存"分区和 flash 设备关系"的缓存表(数组)指针。
Definition
xf_fal_types.h:257
_xf_fal_ctx_t::flash_device_table
const xf_fal_flash_dev_t * flash_device_table[XF_FAL_FLASH_DEVICE_NUM]
flash 设备表(数组)指针。
Definition
xf_fal_types.h:230
_xf_fal_ctx_t::is_init
volatile uint8_t is_init
用于判断 xf_fal 是否已初始化。
Definition
xf_fal_types.h:209
_xf_fal_ctx_t::partition_table
const xf_fal_partition_t * partition_table[XF_FAL_PARTITION_TABLE_NUM]
分区表(数组)的数组。
Definition
xf_fal_types.h:239
_xf_fal_ctx_t::partition_table_len
size_t partition_table_len[XF_FAL_PARTITION_TABLE_NUM]
分区表(数组)表长(分区表内所有分区的总个数)数组。
Definition
xf_fal_types.h:247
_xf_fal_ctx_t::cached_num
volatile size_t cached_num
已缓存的个数。
Definition
xf_fal_types.h:261
_xf_fal_flash_dev_t
flash 设备结构体。
Definition
xf_fal_types.h:124
_xf_fal_flash_dev_t::io_size
size_t io_size
最小读写单元大小,读写时需要以此大小为单位读写,单位: byte.
Definition
xf_fal_types.h:141
_xf_fal_flash_dev_t::name
char * name
Definition
xf_fal_types.h:125
_xf_fal_flash_dev_t::len
size_t len
Definition
xf_fal_types.h:127
_xf_fal_flash_dev_t::ops
xf_fal_flash_ops_t ops
flash 操作集,见 xf_fal_flash_ops_t .
Definition
xf_fal_types.h:145
_xf_fal_flash_dev_t::addr
uint32_t addr
Definition
xf_fal_types.h:126
_xf_fal_flash_dev_t::sector_size
size_t sector_size
扇区大小。扇区大小是最小擦除大小。单位: byte.
Definition
xf_fal_types.h:131
_xf_fal_flash_dev_t::page_size
size_t page_size
页大小。页大小是单次写入时无需等待的最大大小。单位: byte. 通常为 256 字节。
Definition
xf_fal_types.h:136
_xf_fal_flash_ops_t
flash 操作集。
Definition
xf_fal_types.h:45
_xf_fal_flash_ops_t::write
xf_err_t(* write)(size_t dst_offset, const void *src, size_t size)
写数据到 flash 的指定偏移地址。
Definition
xf_fal_types.h:93
_xf_fal_flash_ops_t::read
xf_err_t(* read)(size_t src_offset, void *dst, size_t size)
从 flash 的指定偏移地址读取数据。
Definition
xf_fal_types.h:73
_xf_fal_flash_ops_t::deinit
xf_err_t(* deinit)(void)
反初始化 flash 设备。
Definition
xf_fal_types.h:53
_xf_fal_flash_ops_t::init
xf_err_t(* init)(void)
初始化 flash 设备。
Definition
xf_fal_types.h:49
_xf_fal_flash_ops_t::erase
xf_err_t(* erase)(size_t offset, size_t size)
擦除 flash 的指定偏移地址指定长度。
Definition
xf_fal_types.h:105
_xf_fal_partition_t
flash 分区结构体。
Definition
xf_fal_types.h:155
_xf_fal_partition_t::flash_name
char * flash_name
Definition
xf_fal_types.h:157
_xf_fal_partition_t::name
char * name
Definition
xf_fal_types.h:156
_xf_fal_partition_t::len
size_t len
flash 设备上的该分区长度。
Definition
xf_fal_types.h:173
_xf_fal_partition_t::offset
size_t offset
flash 设备上的该分区偏移地址。
Definition
xf_fal_types.h:166
xf_fal_config_internal.h
xf_fal 内部配置。
XF_FAL_CACHE_NUM
#define XF_FAL_CACHE_NUM
Definition
xf_fal_config_internal.h:46
XF_FAL_FLASH_DEVICE_NUM
#define XF_FAL_FLASH_DEVICE_NUM
Definition
xf_fal_config_internal.h:34
XF_FAL_PARTITION_TABLE_NUM
#define XF_FAL_PARTITION_TABLE_NUM
Definition
xf_fal_config_internal.h:38
xf_fal_ctx_t
struct _xf_fal_ctx_t xf_fal_ctx_t
xf_fal 对象上下文结构体。
xf_fal_flash_ops_t
struct _xf_fal_flash_ops_t xf_fal_flash_ops_t
flash 操作集。
xf_fal_cache_t
struct _xf_fal_cache_t xf_fal_cache_t
xf_fal 分区缓存。
components
xf_fal
xf_fal
src
xf_fal_types.h
生成于 2025年 一月 21日 星期二 17:25:09 , 为 XFusion API使用
1.9.8