131 lines
3.2 KiB
C
131 lines
3.2 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_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;
|
|
|
|
/**
|
|
* @brief Initializes the fal_execution module.
|
|
*/
|
|
void fal_execution_init(void);
|
|
|
|
/**
|
|
* @brief Clears the status of a specific fal_execution.
|
|
*
|
|
* @param index The index of the fal_execution to clear.
|
|
*/
|
|
void fal_execution_clear(fal_execution_e index);
|
|
|
|
/**
|
|
* @brief Gets the status of a specific fal_execution.
|
|
*
|
|
* @param index The index of the fal_execution to get the status from.
|
|
* @return The status of the fal_execution.
|
|
*/
|
|
BOOL fal_execution_status_get(fal_execution_e index);
|
|
|
|
/**
|
|
* @brief Sets the status of a specific fal_execution.
|
|
*
|
|
* @param index The index of the fal_execution to set the status for.
|
|
* @param status The status to set for the fal_execution.
|
|
*/
|
|
void fal_execution_status_set(fal_execution_e index, BOOL status);
|
|
|
|
/**
|
|
* @brief Reads data from a specific fal_execution key-value pair.
|
|
*
|
|
* @param key The key of the fal_execution key-value pair to read from.
|
|
* @param data The buffer to store the read data.
|
|
* @param length The length of the data to read.
|
|
* @return TRUE if the read operation is successful, FALSE otherwise.
|
|
*/
|
|
BOOL fal_execution_kv_read(const fal_key_e key, const uint8_t *data, uint16_t length);
|
|
|
|
/**
|
|
* @brief Writes data to a specific fal_execution key-value pair.
|
|
*
|
|
* @param key The key of the fal_execution key-value pair to write to.
|
|
* @param data The data to write.
|
|
* @param length The length of the data to write.
|
|
* @return TRUE if the write operation is successful, FALSE otherwise.
|
|
*/
|
|
BOOL fal_execution_kv_write(const fal_key_e key, const uint8_t *const data, const uint16_t length);
|
|
|
|
/**
|
|
* @brief Performs inspection for a specific fal_execution.
|
|
*
|
|
* @param cycle The cycle number for the inspection.
|
|
*/
|
|
void fal_execution_inspection(uint16_t cycle);
|
|
|
|
/**
|
|
* @brief Gets the current time from the flashlight module.
|
|
*
|
|
* @return The current time from the flashlight module.
|
|
*/
|
|
fdb_time_t fal_execution_get_time(void);
|
|
#endif
|