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