You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.6 KiB

4 years ago
//////////////////////////////////////////////////////////////////////////
/// COPYRIGHT NOTICE
/// Copyright (c) 2018, 传控科技
/// All rights reserved.
///
/// @file msp_eeprom
/// @brief msp_eeprom
/// @info
///(本文件实现的功能的详述)
///
/// @version 1.1 CCsens technology
/// @author CC
/// @date 20190106
//
//////////////////////////////////////////////////////////////////////////
#ifndef _msp_eeprom_H_
#define _msp_eeprom_H_
#include "../clib/type.h"
#include "../clib/clib.h"
#include "../ctask/tick.h"
#include "../msp/uart0.h"
4 years ago
/**
* EEPROM
* filter0 + filter1 + len0 + len1 + {data} + crc0 + crc1
*/
#define D_EEP_SECTOR_BLOCK_BUF_SIZE (D_EEP_SECTOR_BLOCK_SIZE - 6)
typedef struct eeprom_block_t
{
U8 filter[2]; //filter
U8 len[2]; //有效数据的个数
U8 buf[D_EEP_SECTOR_BLOCK_BUF_SIZE];
U8 crc[2]; //从filter开始进行整体校验
}EEPROM_BLOCK;
extern struct eeprom_block_t eep_block;
extern U8 L1_eep_read_block(U8 sector, U8 block, U16 blocksize, U8 *buf, U16 *plen);
extern U8 L1_eep_write_block(U8 sector, U8 block, U16 blocksize, const U8 *buf, U16 len, U8 sectorEraseFlag);
extern U8 L1_eep_erase_sector(U8 sector);
///每个扇区512字节
extern void L0_Iap_Erase(vU16 addr);
extern void L0_Iap_Program(vU16 addr, char dat);
extern char L0_Iap_Read(vU16 addr);
extern void L0_Iap_Program_array(vU16 addr,U8 *buf,U8 len);
extern void L0_Iap_Read_array(vU16 addr,U8 *buf,U8 len);
extern void L1_Iap_main(void);
extern void L3_eeprom_fun(U8 *pPara);
#endif// #ifndef _msp_eeprom_H_