Storage Controller
概述
Storage Controller 模块为其他 core 提供数据掉电保存功能。
功能特性
提供其他 core 数据掉电保存功能。
资源依赖
依赖 KV 模块
依赖 IPC 提供核间通信
依赖 semaphore 提供同步
实现原理
如图所示,slave core 在使用 storage API 时,先将参数打包通过 IPC,发送到 master core,然后 slave core 处于等待信号量状态,master core 在 IPC handle 中获取相关信息发送到 share task high 处理,share task 处理完成 后,将信息通过 IPC 回复到 slave core,slave core 得到返回值后释放信号量
用法流程
初始化
storage_init()写数据
storage_write()读数据
storage_read()
API 介绍
Functions
-
void storage_init(void)
This function is init storage.
备注
This function should be called after ipc init.
-
uint32_t storage_read(uint32_t module_id, uint32_t id, void *buf, uint32_t *p_len)
This function is to read storage.
- 参数:
module_id -- is the module base kv id.
id -- is the storage id.
buf -- is the pointer of the buffer.
p_len -- is the pointer of the length and will return length obtained from kv when ok.
- 返回:
uint32_t RET_OK for success else error.
-
uint32_t storage_write(uint32_t module_id, uint32_t id, void *buf, uint32_t length)
This function is to write storage.
- 参数:
module_id -- is the module base kv id.
id -- is the storage id.
buf -- is the pointer of the buffer.
length -- is the pointer of the length.
- 返回:
uint32_t RET_OK for success else error.