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