Files
CCU621M/BSP/flash_file_mgr/card_flash_impl.h
T

47 lines
1.2 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* @file card_flash_impl.h
* @brief 卡号白名单:EEPROM 管理信息 + 外部 SPI Flash 槽位存储(与 fault_flash_impl 同类策略)
*
* 对外业务接口见 `app_fatfs/fatfs_card.h`card_init / card_add / card_find 等)。
* 本头文件提供介质层结构说明,便于调试或扩展。
*/
#ifndef CARD_FLASH_IMPL_H
#define CARD_FLASH_IMPL_H
#ifdef __cplusplus
extern "C" {
#endif
#include "main.h"
#include "publicdata/type.h"
#define CARD_MNG_HEAD 0x5AA8u
/** EEPROM 中的卡管理块(地址 EEPROM_ADDR_CARD_MNG */
typedef struct
{
U16_T u16_head;
U16_T u16_cardCnt;
U16_T u16_reserved;
} S_CARD_MNG;
/**
* Flash 单槽有效载荷 46 字节(槽位总占用 481 字节 RECORD_HEADER + 46 + 1 字节 CRC 低 8 位)
* - amount_milli:金额,单位 0.001 元(与 API 中 balance「分」换算:毫元 = 分 * 10)
* - rsv[8]:前 4 字节 create_time,后 4 字节 last_use_timeUnix 秒,小端),与 CardInfo 时间字段对应
*/
typedef struct __attribute__((packed))
{
U8_T card_num[32];
U32_T amount_milli;
U16_T status;
U8_T rsv[8];
} CARD_FLASH_BODY_T;
#ifdef __cplusplus
}
#endif
#endif /* CARD_FLASH_IMPL_H */