]> cvs.zerfleddert.de Git - rsbs2/blob - bmc/bmc.c
99427f6580713ccbda8093a75b24e6b49897c206
[rsbs2] / bmc / bmc.c
1 #include <avr/io.h>
2 #include <avr/interrupt.h>
3 #include <string.h>
4 #include <stdio.h>
5 #include "usart.h"
6 #include "i2c.h"
7 #include "ipmb.h"
8 #include "chassis.h"
9 #include "bmc.h"
10
11 int main(void)
12 {
13 uint8_t old_SREG;
14 unsigned char buf[12];
15 unsigned int len;
16
17 chassis_init();
18 usart_init();
19 printf("\n");
20
21 i2c_init();
22
23 printf("Waiting for I2C...\n");
24
25 sei();
26
27 while(1) {
28 #if 0
29 sleep_mode();
30 #endif
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 }
43 }
44
45 return 0;
46 }
Impressum, Datenschutz