You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
1.5 KiB
C
66 lines
1.5 KiB
C
7 months ago
|
/*
|
||
|
* FRAMBuffer.h
|
||
|
*
|
||
|
* Author: Aleksey Gerasimenko
|
||
|
* gerasimenko.aleksey.n@gmail.com
|
||
|
*/
|
||
|
|
||
|
#include <stdint.h>
|
||
|
|
||
|
|
||
|
#include "SYSCTRL/TypeControl.h"
|
||
|
#include "SYSCTRL/SystemConfigurator.h"
|
||
|
|
||
|
#ifndef FRAM_FRAMBUFFER_H_
|
||
|
#define FRAM_FRAMBUFFER_H_
|
||
|
|
||
|
namespace FRAM
|
||
|
{
|
||
|
|
||
|
|
||
|
struct FRAMHeader
|
||
|
{
|
||
|
int16_t class_id;
|
||
|
int16_t part_id;
|
||
|
int16_t software_version;
|
||
|
int16_t size_of_fram_data;
|
||
|
FRAMHeader():
|
||
|
class_id(0x0FFFF),
|
||
|
part_id(0x0FFFF),
|
||
|
software_version(0x0FFFF),
|
||
|
size_of_fram_data(0x0FFFF)
|
||
|
{}
|
||
|
};//FRAMHeader
|
||
|
|
||
|
struct FRAMFooter
|
||
|
{
|
||
|
int16_t foot;
|
||
|
FRAMFooter():
|
||
|
foot(0x0FFFF)
|
||
|
{}
|
||
|
};//FRAMFooter
|
||
|
|
||
|
|
||
|
class FRAMBuffer
|
||
|
{
|
||
|
private:
|
||
|
FRAMHeader m_header;
|
||
|
SYSCTRL::SystemControlConfiguration m_config;
|
||
|
FRAMFooter m_footer;
|
||
|
public:
|
||
|
FRAMBuffer();
|
||
|
public:
|
||
|
void update(const FRAM::FRAMHeader& header, const SYSCTRL::SystemControlConfiguration& config, const FRAM::FRAMFooter& footer);
|
||
|
bool verify_header_and_footer(const FRAM::FRAMHeader& header, const FRAM::FRAMFooter& footer);
|
||
|
void extract(FRAM::FRAMHeader& header, SYSCTRL::SystemControlConfiguration& config, FRAM::FRAMFooter& footer);
|
||
|
void extract_header(FRAMHeader& header);
|
||
|
FRAM::FRAMHeader get_header();
|
||
|
void extract_footer(FRAMFooter& footer);
|
||
|
FRAM::FRAMFooter get_footer();
|
||
|
void extract_system_configuration(SYSCTRL::SystemControlConfiguration& config);
|
||
|
};
|
||
|
|
||
|
} /* namespace FRAM */
|
||
|
|
||
|
#endif /* FRAM_FRAMBUFFER_H_ */
|