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