]>
Commit | Line | Data |
---|---|---|
d6f38d0d | 1 | #include <avr/io.h> |
99e4226b | 2 | #include <avr/interrupt.h> |
f9d5c6e0 | 3 | #include <avr/sleep.h> |
da7751cb | 4 | #include <string.h> |
d6f38d0d MG |
5 | #include <stdio.h> |
6 | #include "usart.h" | |
99e4226b | 7 | #include "i2c.h" |
da7751cb MG |
8 | #include "ipmb.h" |
9 | #include "chassis.h" | |
77ad1a84 MG |
10 | #include "bmc.h" |
11 | ||
d6f38d0d MG |
12 | int main(void) |
13 | { | |
da7751cb MG |
14 | uint8_t old_SREG; |
15 | unsigned char buf[12]; | |
16 | unsigned int len; | |
d6f38d0d | 17 | |
da7751cb | 18 | chassis_init(); |
d6f38d0d | 19 | usart_init(); |
99e4226b MG |
20 | i2c_init(); |
21 | ||
22 | sei(); | |
d6f38d0d | 23 | |
d6f38d0d | 24 | while(1) { |
da7751cb | 25 | #if 0 |
7f52e040 MG |
26 | sleep_mode(); |
27 | #endif | |
da7751cb MG |
28 | old_SREG = SREG; |
29 | cli(); | |
30 | if (i2c_done) { | |
31 | len = i2c_len; | |
32 | memcpy(buf, (unsigned char*)i2c_databuf, len); | |
33 | i2c_done = 0x00; | |
34 | SREG = old_SREG; | |
35 | ||
36 | decode_ipmb_pkt(buf, len); | |
37 | } else { | |
38 | SREG = old_SREG; | |
39 | } | |
d6f38d0d MG |
40 | } |
41 | ||
42 | return 0; | |
43 | } |