Rev Author Line No. Line
3471 miho 1 /*
2 * isp.h - part of USBasp
3 *
4 * Autor..........: Thomas Fischl <tfischl@gmx.de>
5 * Description....: Provides functions for communication/programming
6 * over ISP interface
7 * Licence........: GNU GPL v2 (see Readme.txt)
8 * Creation Date..: 2005-02-23
9 * Last change....: 2009-02-28
10 */
11  
12 #ifndef __isp_h_included__
13 #define __isp_h_included__
14  
15 #ifndef uchar
16 #define uchar unsigned char
17 #endif
18  
19 #define ISP_OUT PORTB
20 #define ISP_IN PINB
21 #define ISP_DDR DDRB
22 #define ISP_RST PB2
23 #define ISP_MOSI PB3
24 #define ISP_MISO PB4
25 #define ISP_SCK PB5
26  
27 /* Prepare connection to target device */
28 void ispConnect();
29  
30 /* Close connection to target device */
31 void ispDisconnect();
32  
33 /* read an write a byte from isp using software (slow) */
34 uchar ispTransmit_sw(uchar send_byte);
35  
36 /* read an write a byte from isp using hardware (fast) */
37 uchar ispTransmit_hw(uchar send_byte);
38  
39 /* enter programming mode */
40 uchar ispEnterProgrammingMode();
41  
42 /* read byte from eeprom at given address */
43 uchar ispReadEEPROM(unsigned int address);
44  
45 /* write byte to flash at given address */
46 uchar ispWriteFlash(unsigned long address, uchar data, uchar pollmode);
47  
48 uchar ispFlushPage(unsigned long address, uchar pollvalue);
49  
50 /* read byte from flash at given address */
51 uchar ispReadFlash(unsigned long address);
52  
53 /* write byte to eeprom at given address */
54 uchar ispWriteEEPROM(unsigned int address, uchar data);
55  
56 /* pointer to sw or hw transmit function */
57 uchar (*ispTransmit)(uchar);
58  
59 /* set SCK speed. call before ispConnect! */
60 void ispSetSCKOption(uchar sckoption);
61  
62 /* load extended address byte */
63 void ispLoadExtendedAddressByte(unsigned long address);
64  
65 #endif /* __isp_h_included__ */