6953e8aa4a975dc445246054269e86c9f3044538
[pub/USBasp.git] / firmware / usbasp.h
1 /*
2 * usbasp.c - part of USBasp
3 *
4 * Autor..........: Thomas Fischl <tfischl@gmx.de>
5 * Description....: Definitions and macros for usbasp
6 * Licence........: GNU GPL v2 (see Readme.txt)
7 * Creation Date..: 2009-02-28
8 * Last change....: 2009-02-28
9 */
10
11 #ifndef USBASP_H_
12 #define USBASP_H_
13
14 /* USB function call identifiers */
15 #define USBASP_FUNC_CONNECT 1
16 #define USBASP_FUNC_DISCONNECT 2
17 #define USBASP_FUNC_TRANSMIT 3
18 #define USBASP_FUNC_READFLASH 4
19 #define USBASP_FUNC_ENABLEPROG 5
20 #define USBASP_FUNC_WRITEFLASH 6
21 #define USBASP_FUNC_READEEPROM 7
22 #define USBASP_FUNC_WRITEEEPROM 8
23 #define USBASP_FUNC_SETLONGADDRESS 9
24 #define USBASP_FUNC_SETISPSCK 10
25
26 /* programming state */
27 #define PROG_STATE_IDLE 0
28 #define PROG_STATE_WRITEFLASH 1
29 #define PROG_STATE_READFLASH 2
30 #define PROG_STATE_READEEPROM 3
31 #define PROG_STATE_WRITEEEPROM 4
32
33 /* Block mode flags */
34 #define PROG_BLOCKFLAG_FIRST 1
35 #define PROG_BLOCKFLAG_LAST 2
36
37 /* ISP SCK speed identifiers */
38 #define USBASP_ISP_SCK_AUTO 0
39 #define USBASP_ISP_SCK_0_5 1 /* 500 Hz */
40 #define USBASP_ISP_SCK_1 2 /* 1 kHz */
41 #define USBASP_ISP_SCK_2 3 /* 2 kHz */
42 #define USBASP_ISP_SCK_4 4 /* 4 kHz */
43 #define USBASP_ISP_SCK_8 5 /* 8 kHz */
44 #define USBASP_ISP_SCK_16 6 /* 16 kHz */
45 #define USBASP_ISP_SCK_32 7 /* 32 kHz */
46 #define USBASP_ISP_SCK_93_75 8 /* 93.75 kHz */
47 #define USBASP_ISP_SCK_187_5 9 /* 187.5 kHz */
48 #define USBASP_ISP_SCK_375 10 /* 375 kHz */
49 #define USBASP_ISP_SCK_750 11 /* 750 kHz */
50 #define USBASP_ISP_SCK_1500 12 /* 1.5 MHz */
51
52 /* macros for gpio functions */
53 #define ledRedOn() PORTC &= ~(1 << PC1)
54 #define ledRedOff() PORTC |= (1 << PC1)
55 #define ledGreenOn() PORTC &= ~(1 << PC0)
56 #define ledGreenOff() PORTC |= (1 << PC0)
57
58 #endif /* USBASP_H_ */