-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhexmanager.h
50 lines (46 loc) · 990 Bytes
/
hexmanager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#pragma once
#include <string>
#include <stdio.h>
typedef struct
{
unsigned char RecDataLen;
unsigned int Address;
unsigned int MaxAddress;
unsigned int MinAddress;
unsigned char RecType;
unsigned char* Data;
unsigned char CheckSum;
unsigned int ExtSegAddress;
unsigned int ExtLinAddress;
} hexrecord_t;
// Hex Manager class
class CHexManager
{
public:
std::string HexFilePath;
unsigned int HexTotalLines;
unsigned int HexCurrLineNo;
bool ResetHexFilePointer(void);
bool LoadHexFile(void);
unsigned short GetNextHexRecord(char *HexRec, unsigned int BuffLen);
unsigned short ConvertAsciiToHex(void *VdAscii, void *VdHexRec);
void VerifyFlash(unsigned int* StartAdress, unsigned int* ProgLen, unsigned short* crc);
//Constructor
CHexManager()
{
HexFilePtr = nullptr;
HexTotalLines = 0;
HexCurrLineNo = 0;
}
//Destructor
~CHexManager()
{
// If hex file is open close it.
if(HexFilePtr)
{
fclose(HexFilePtr);
}
}
private:
FILE *HexFilePtr;
};