Subversion Repositories HomeAutomation

Rev

Rev 270 | Details | Compare with Previous | Last modification | View Log | SVN | RSS feed

Rev Author Line No. Line
270 johboh 1
#ifndef __HEXFILE_H
2
#define __HEXFILE_H
3
 
4
#include <tchar.h>
5
#include <windows.h>
6
#include <stdio.h>
7
#include <fstream>
8
#include <iostream>
9
#include <math.h>
10
using namespace std;
11
 
12
#define USER_RESET_ADDR 0x1000
13
#define BUFFER_SIZE 5200000
14
#define LINE_MAX_SIZE 1024
15
#define ERROR_BUFFER_SIZE 256
16
#define FILE_PATH_SIZE 256
17
 
18
class HexFile
19
{
20
public:
21
	bool isValid(void);
22
	HexFile();
23
	~HexFile();
24
	bool loadHex(char filepath[],bool isMC18);
25
	unsigned long getAddrUpper(void);
26
	unsigned long getAddrLower(void);
27
	unsigned long getLength(void);
28
	unsigned char getByte(unsigned long addr);
29
	char lastError[ERROR_BUFFER_SIZE];
30
	char filepath[FILE_PATH_SIZE];
31
protected:
32
	unsigned long hexToLong(char *str,unsigned int start,unsigned int length);
33
	unsigned char buff[BUFFER_SIZE];
34
	unsigned long addrUpper;
35
	unsigned long addrLower;
36
	unsigned long length;
37
};
38
 
39
#endif