Beginning EJTAG (MIPS) support with an empty app.
[goodfet] / firmware / include / avr.h
1 /*! \file avr.h
2   \author Travis Goodspeed
3   \brief AVR SPI Programmer
4 */
5
6 #include "spi.h"
7
8 //! Setup the AVR pins.
9 void avrsetup();
10
11 //! Initialized an attached AVR.
12 void avrconnect();
13
14 //! Enable AVR programming mode.
15 void avr_prgen();
16 //! Read AVR device code.
17 u8 avr_sig(u8 i);
18 //! Erase an AVR device
19 void avr_erase();
20 //! Read lock bits.
21 u8 avr_lockbits();
22 //! Write lock bits.
23 void avr_setlock(u8 bits);
24
25 //! Read a byte of Flash
26 u8 avr_peekflash(u16 adr);
27
28 //! Read a byte of EEPROM.
29 u8 avr_peekeeprom(u16 adr);
30 //! Read a byte of EEPROM.
31 u8 avr_pokeeeprom(u16 adr, u8 val);
32
33 //! Is the AVR ready or busy?
34 u8 avr_isready();
35
36 //Command codes.
37 //! Performa  chip erase.
38 #define AVR_ERASE 0xF0
39 //! Fetch RDY/!BSY byte.
40 #define AVR_RDYBSY 0xF1
41
42 //! Read Program Memory
43 #define AVR_PEEKPGM 0x80
44 //! Read EEPROM
45 #define AVR_PEEKEEPROM 0x81
46 //! Write EEPROM
47 #define AVR_POKEEEPROM 0x91
48 //! Read lock bits.
49 #define AVR_PEEKLOCK 0x82
50 //! Write lock its.
51 #define AVR_POKELOCK 0x92
52 //! Read signature.
53 #define AVR_PEEKSIG 0x83
54 //! Read fuse bits.
55 #define AVR_READFUSES 0x84
56 //! Read calibration byte.
57 #define AVR_READCAL 0x85