77 lines
2.1 KiB
C
77 lines
2.1 KiB
C
/**
|
|
* @file fal_execution.h
|
|
* @author xxx
|
|
* @date 2023-12-29 11:28:33
|
|
* @brief
|
|
* @copyright Copyright (c) 2024 by xxx, All Rights Reserved.
|
|
*/
|
|
|
|
/**
|
|
* 2024-01-04 模块开发完成,测试通过
|
|
*/
|
|
#ifndef _FAL_EXECUTION_
|
|
#define _FAL_EXECUTION_
|
|
#include <string.h>
|
|
#include <fal.h>
|
|
#include "flashdb.h"
|
|
|
|
typedef enum
|
|
{
|
|
KEY_CALIBPARA_PARAM,
|
|
KEY_DEVICE,
|
|
KEY_HART_DEVICE_VARIABLE_PARAM,
|
|
KEY_HART_DEVICE_VARIABLE_USER_PARAM,
|
|
KEY_REAL_TIME_DATA,
|
|
KEY_MODE_PARAM, // 模式参数:控制算法自定义参数
|
|
KEY_MAX,
|
|
} fal_key_e;
|
|
|
|
typedef enum
|
|
{
|
|
FAL_EXECUTION_EEPROM_M95_1,
|
|
FAL_EXECUTION_EEPROM_M95_2,
|
|
FAL_EXECUTION_EEPROM_FM24,
|
|
|
|
FAL_EXECUTION_MAX,
|
|
} fal_execution_e;
|
|
|
|
typedef struct
|
|
{
|
|
fal_execution_e eeprom_index;
|
|
struct fdb_kvdb kvdb;
|
|
struct fdb_tsdb tsdb;
|
|
|
|
struct fdb_default_kv kv;
|
|
struct
|
|
{
|
|
int (*read)(uint32_t read_addr, uint8_t *data, uint16_t length);
|
|
int (*write)(uint32_t read_addr, uint8_t *data, uint16_t length);
|
|
} ops;
|
|
} fal_execution_t;
|
|
|
|
typedef union
|
|
{
|
|
uint8_t data;
|
|
struct
|
|
{
|
|
uint8_t M95_1 : 1;
|
|
uint8_t M95_2 : 1;
|
|
uint8_t FM24 : 1;
|
|
} bits;
|
|
} fal_execution_status_u; // eeprom状态
|
|
|
|
typedef struct
|
|
{
|
|
fal_execution_status_u init;
|
|
fal_execution_status_u read;
|
|
fal_execution_status_u write;
|
|
} fal_execution_status_t;
|
|
|
|
void fal_execution_init(void); ///< fal执行初始化
|
|
void fal_execution_clear(fal_execution_e index); ///< fal执行清除
|
|
BOOL fal_execution_status_get(fal_execution_e index); ///< 获取fal执行状态
|
|
BOOL fal_execution_kv_read(const fal_key_e key, const uint8_t *data, uint16_t length); ///< 读取fal执行kv
|
|
BOOL fal_execution_kv_write(const fal_key_e key, const uint8_t *const data, const uint16_t length); ///< 写入fal执行kv
|
|
void fal_execution_inspection(uint16_t cycle); ///< fal执行检查
|
|
#endif
|