XFusion API v1.3.0
载入中...
搜索中...
未找到
xf_fal.c 文件参考
#include "xf_utils.h"
#include "xf_fal.h"
xf_fal.c 的引用(Include)关系图:

浏览源代码.

宏定义

#define TAG   "xf_fal"
 
#define sp_fal()   (sp_fal_ctx)
 
#define XF_FAL_CTX_MUTEX_TRY_INIT()
 
#define XF_FAL_CTX_MUTEX_TRY_DEINIT()
 
#define XF_FAL_CTX_TRYLOCK__RETURN_ON_FAILURE(_ret)
 
#define XF_FAL_CTX_TRYLOCK__ANYWAY()
 
#define XF_FAL_CTX_UNLOCK()
 
#define XF_FAL_CTX_MUTEX_TRY_INIT()
 
#define XF_FAL_CTX_MUTEX_TRY_DEINIT()
 
#define XF_FAL_CTX_TRYLOCK__RETURN_ON_FAILURE(_ret)
 
#define XF_FAL_CTX_TRYLOCK__ANYWAY()
 
#define XF_FAL_CTX_UNLOCK()
 

函数

xf_err_t xf_fal_register_flash_device (const xf_fal_flash_dev_t *p_dev)
 注册一个 flash 设备到 xf_fal 中。
 
xf_err_t xf_fal_register_partition_table (const xf_fal_partition_t *p_table, size_t table_len)
 注册一个分区表到 xf_fal 中。
 
xf_err_t xf_fal_unregister_flash_device (const xf_fal_flash_dev_t *p_dev)
 从 xf_fal 中注销一个 flash 设备。
 
xf_err_t xf_fal_unregister_partition_table (const xf_fal_partition_t *p_table)
 从 xf_fal 中注销一个分区表。
 
bool xf_fal_check_register_state (void)
 检查 xf_fal 注册状态。
 
const xf_fal_ctx_txf_fal_get_ctx (void)
 获取 xf_fal 上下文。
 
xf_err_t xf_fal_init (void)
 初始化 FAL.
 
xf_err_t xf_fal_deinit (void)
 反初始化 FAL.
 
const xf_fal_flash_dev_txf_fal_flash_device_find (const char *name)
 根据 flash 名称查找 flash 设备。
 
const xf_fal_flash_dev_txf_fal_flash_device_find_by_part (const xf_fal_partition_t *part)
 通过给定分区查找 flash 设备。
 
const xf_fal_partition_txf_fal_partition_find (const char *name)
 根据分区名称查找分区句柄。
 
xf_err_t xf_fal_partition_read (const xf_fal_partition_t *part, size_t src_offset, void *dst, size_t size)
 从指定分区读取数据。
 
xf_err_t xf_fal_partition_write (const xf_fal_partition_t *part, size_t dst_offset, const void *src, size_t size)
 将数据写入指定分区。
 
xf_err_t xf_fal_partition_erase (const xf_fal_partition_t *part, size_t offset, size_t size)
 擦除指定分区数据。
 
xf_err_t xf_fal_partition_erase_all (const xf_fal_partition_t *part)
 擦除指定分区所有数据。
 
void xf_fal_show_part_table (void)
 打印分区表信息。
 
xf_err_t xf_fal_check_and_update_cache (void)
 更新分区表中的分区与关联的 flash 设备的缓存。
 

变量

static xf_fal_ctx_t s_fal_ctx = {0}
 
static xf_fal_ctx_tsp_fal_ctx = &s_fal_ctx
 

详细描述

作者
cangyu (sky.k.nosp@m.irto.nosp@m.@qq.c.nosp@m.om)
版本
0.1
日期
2024-10-18

在文件 xf_fal.c 中定义.

宏定义说明

◆ TAG

#define TAG   "xf_fal"

在文件 xf_fal.c19 行定义.

◆ sp_fal

#define sp_fal ( )    (sp_fal_ctx)

在文件 xf_fal.c29 行定义.

◆ XF_FAL_CTX_MUTEX_TRY_INIT [1/2]

#define XF_FAL_CTX_MUTEX_TRY_INIT ( )
值:
do { \
if (NULL == sp_fal()->mutex) { \
xf_lock_init(&sp_fal()->mutex); \
} \
} while (0)
static xf_osal_mutex_t mutex
Definition xf_main.c:35
#define sp_fal()
Definition xf_fal.c:29

在文件 xf_fal.c33 行定义.

◆ XF_FAL_CTX_MUTEX_TRY_DEINIT [1/2]

#define XF_FAL_CTX_MUTEX_TRY_DEINIT ( )
值:
do { \
if (NULL != sp_fal()->mutex) { \
xf_lock_destroy(sp_fal()->mutex); \
sp_fal()->mutex = NULL; \
} \
} while (0)

在文件 xf_fal.c40 行定义.

◆ XF_FAL_CTX_TRYLOCK__RETURN_ON_FAILURE [1/2]

#define XF_FAL_CTX_TRYLOCK__RETURN_ON_FAILURE (   _ret)
值:
do { \
if (sp_fal()->mutex) { \
return _ret; \
} \
break; \
} \
if (true == sp_fal()->is_lock) { \
return _ret; \
} \
sp_fal()->is_lock = true; \
} while (0)
#define XF_LOCK_FAIL
int xf_lock_trylock(xf_lock_t lock)
尝试上锁.
Definition xf_lock.c:64

在文件 xf_fal.c48 行定义.

◆ XF_FAL_CTX_TRYLOCK__ANYWAY [1/2]

#define XF_FAL_CTX_TRYLOCK__ANYWAY ( )
值:
do { \
if (sp_fal()->mutex) { \
xf_lock_trylock(sp_fal()->mutex); \
break; \
} \
sp_fal()->is_lock = true; \
} while (0)

在文件 xf_fal.c62 行定义.

◆ XF_FAL_CTX_UNLOCK [1/2]

#define XF_FAL_CTX_UNLOCK ( )
值:
do { \
if (sp_fal()->mutex) { \
xf_lock_unlock(sp_fal()->mutex); \
break; \
} \
sp_fal()->is_lock = false; \
} while (0);

在文件 xf_fal.c71 行定义.

◆ XF_FAL_CTX_MUTEX_TRY_INIT [2/2]

#define XF_FAL_CTX_MUTEX_TRY_INIT ( )

在文件 xf_fal.c33 行定义.

◆ XF_FAL_CTX_MUTEX_TRY_DEINIT [2/2]

#define XF_FAL_CTX_MUTEX_TRY_DEINIT ( )

在文件 xf_fal.c40 行定义.

◆ XF_FAL_CTX_TRYLOCK__RETURN_ON_FAILURE [2/2]

#define XF_FAL_CTX_TRYLOCK__RETURN_ON_FAILURE (   _ret)

在文件 xf_fal.c48 行定义.

◆ XF_FAL_CTX_TRYLOCK__ANYWAY [2/2]

#define XF_FAL_CTX_TRYLOCK__ANYWAY ( )

在文件 xf_fal.c62 行定义.

◆ XF_FAL_CTX_UNLOCK [2/2]

#define XF_FAL_CTX_UNLOCK ( )

在文件 xf_fal.c71 行定义.

变量说明

◆ s_fal_ctx

xf_fal_ctx_t s_fal_ctx = {0}
static

在文件 xf_fal.c27 行定义.

◆ sp_fal_ctx

xf_fal_ctx_t* sp_fal_ctx = &s_fal_ctx
static

在文件 xf_fal.c28 行定义.