Rev 771 | Rev 1416 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 771 | Rev 1415 | ||
|---|---|---|---|
| Line 1... | Line 1... | ||
| 1 | /* |
1 | /* |
| 2 | * $Id: bios.c |
2 | * $Id: bios.c 1415 2010-01-03 15:52:50Z arune $ |
| 3 | */ |
3 | */ |
| 4 | 4 | ||
| 5 | #include <inttypes.h> |
5 | #include <inttypes.h> |
| 6 | #include <avr/io.h> |
6 | #include <avr/io.h> |
| 7 | #include <avr/interrupt.h> |
7 | #include <avr/interrupt.h> |
| Line 20... | Line 20... | ||
| 20 | #error No NODE_HW_ID in bios.inc, set NODE_HW_ID=<GENERATE_HW> and Ill generate it for you |
20 | #error No NODE_HW_ID in bios.inc, set NODE_HW_ID=<GENERATE_HW> and Ill generate it for you |
| 21 | #endif |
21 | #endif |
| 22 | 22 | ||
| 23 | #if defined(__AVR_ATmega8__) |
23 | #if defined(__AVR_ATmega8__) |
| 24 | #define IVSEL_REG GICR |
24 | #define IVSEL_REG GICR |
| 25 | #elif defined(__AVR_ATmega88__) || defined(__AVR_ATmega168__) |
25 | #elif defined(__AVR_ATmega88__) || defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) |
| 26 | #define IVSEL_REG MCUCR |
26 | #define IVSEL_REG MCUCR |
| 27 | #else |
27 | #else |
| 28 | #error AVR device not supported! |
28 | #error AVR device not supported! |
| 29 | #endif |
29 | #endif |
| 30 | 30 | ||
| Line 92... | Line 92... | ||
| 92 | BIOS_CanCallback(msg); |
92 | BIOS_CanCallback(msg); |
| 93 | } |
93 | } |
| 94 | } |
94 | } |
| 95 | 95 | ||
| 96 | int main(void) { |
96 | int main(void) { |
| - | 97 | // Turn on output |
|
| - | 98 | // DDRB &= ~(1<<PORTB7); |
|
| - | 99 | // PORTB |= (1<<PORTB7); |
|
| - | 100 | ||
| 97 | void (*app_reset)(void) = 0; // Function pointer to jump to application reset vector. |
101 | void (*app_reset)(void) = 0; // Function pointer to jump to application reset vector. |
| 98 | uint8_t bios_state; |
102 | uint8_t bios_state; |
| 99 | uint8_t nmt_type; |
103 | uint8_t nmt_type; |
| 100 | uint8_t pagebuf[SPM_PAGESIZE]; |
104 | uint8_t pagebuf[SPM_PAGESIZE]; |
| 101 | // These unneccessary initializations uses 12 bytes flash, just to make the compiler happy! |
105 | // These unneccessary initializations uses 12 bytes flash, just to make the compiler happy! |