]> git.zerfleddert.de Git - rsbs2/blob - bmc/bmc.c
a7217efb263fad6b886eb9df13351024f4e30417
[rsbs2] / bmc / bmc.c
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 #define SLEEP_MODE
13
14 int main(void)
15 {
16 unsigned char buf[24];
17 unsigned int len;
18
19 chassis_init();
20 usart_init();
21 i2c_init();
22
23 set_sleep_mode(SLEEP_MODE_IDLE);
24
25 sei();
26
27 while(1) {
28 cli();
29 while (i2c_done) {
30 len = i2c_len;
31 memcpy(buf, (unsigned char*)i2c_databuf, len);
32 i2c_done = 0x00;
33 sei();
34
35 decode_ipmb_pkt(buf, len);
36
37 cli();
38 }
39
40 #ifdef SLEEP_MODE
41 sleep_enable();
42 #endif
43 sei();
44 #ifdef SLEEP_MODE
45 sleep_cpu();
46 sleep_disable();
47 #endif
48 }
49
50 return 0;
51 }
Impressum, Datenschutz