]>
Commit | Line | Data |
---|---|---|
1 | #include <avr/io.h> | |
2 | #include <avr/interrupt.h> | |
3 | #include <avr/sleep.h> | |
4 | #include <string.h> | |
5 | #include <stdio.h> | |
6 | #include "usart.h" | |
7 | #include "i2c.h" | |
8 | #include "ipmb.h" | |
9 | #include "chassis.h" | |
10 | #include "bmc.h" | |
11 | ||
12 | int main(void) | |
13 | { | |
14 | uint8_t old_SREG; | |
15 | unsigned char buf[12]; | |
16 | unsigned int len; | |
17 | ||
18 | chassis_init(); | |
19 | usart_init(); | |
20 | i2c_init(); | |
21 | ||
22 | sei(); | |
23 | ||
24 | while(1) { | |
25 | #if 0 | |
26 | sleep_mode(); | |
27 | #endif | |
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 | } | |
40 | } | |
41 | ||
42 | return 0; | |
43 | } |