-
Notifications
You must be signed in to change notification settings - Fork 2
/
isp.h
60 lines (50 loc) · 1.7 KB
/
isp.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
51
52
53
54
55
56
57
58
59
60
#ifdef NET_PROG
#ifndef ISP_H
#define ISP_H
#define ISP_READ_SIG (0x30)
#define ISP_READ_LOCK (0x58)
//#define ISP_READ_FUSE (0x50)
//#define ISP_READ_HFUSE (0x58)
#define ATMEL (0x1E) // Signature byte 1 for an Atmel chip
#define ISP_UNKNOWN (0xFF)
#define SIG_BYTE_1 (0x00)
#define SIG_BYTE_2 (0x01)
#define SIG_BYTE_3 (0x02)
// Possible states
#define ISP_QUIESCENT (0)
#define ISP_READY (1)
#define ISP_ERASING (2)
#define ISP_DUMMY (0)
typedef struct { // ISP programming data for specific chip
char name[LONGEST_MICRO];
uint8_t vendor;
uint8_t partFamily;
uint8_t partCode; // Signature bytes
uint16_t sizeOfFlash;
uint16_t flashPageSize;
uint16_t sizeOfEEPROM;
} ISP_chipData;
uint8_t ISPactivate(void);
void ISPquiescent(void);
void ISPchipErase(void);
uint8_t ISP_Ready(void);
uint8_t ISPgetSignature(uint8_t sigid);
uint8_t ISPgetFuseBits(void);
uint8_t ISPgetHFuseBits(void);
uint8_t ISPgetEFuseBits(void);
uint16_t ISPreadFlashHighByte(uint16_t wordAddress);
uint16_t ISPreadFlashLowByte(uint16_t wordAddress);
void ISPloadFlashPageH(uint16_t wordAddress,uint8_t data);
void ISPloadFlashPageL(uint16_t wordAddress,uint8_t data);
void ISPloadFlashPageLH(uint16_t wordAddress,uint8_t dataL,uint8_t dataH);
void ISPwriteFlashPage(uint16_t address);
uint8_t ISPreadEEPROMbyte(uint16_t address);
void ISPwriteEEPROMbyte(uint16_t address,uint8_t data);
void ISPloadEEPROMpage(uint16_t address,uint8_t data);
void ISPwriteEEPROMpage(uint16_t address);
void ISPwriteLockBits(uint8_t data);
void ISPwriteFuseBits(uint8_t data);
void ISPwriteHFuseBits(uint8_t data);
void ISPwriteEFuseBits(uint8_t data);
#endif
#endif