]> cvs.zerfleddert.de Git - rsbs2/blame - bmc/bmc.c
IPMI power/reset via rsbs2.pl
[rsbs2] / bmc / bmc.c
CommitLineData
d6f38d0d 1#include <avr/io.h>
99e4226b 2#include <avr/interrupt.h>
f9d5c6e0 3#include <avr/sleep.h>
da7751cb 4#include <string.h>
d6f38d0d
MG
5#include <stdio.h>
6#include "usart.h"
99e4226b 7#include "i2c.h"
da7751cb
MG
8#include "ipmb.h"
9#include "chassis.h"
77ad1a84
MG
10#include "bmc.h"
11
18037a5a 12#undef SLEEP_MODE
8efcc40e 13
d6f38d0d
MG
14int main(void)
15{
45320371 16 unsigned char buf[24];
da7751cb 17 unsigned int len;
d6f38d0d 18
da7751cb 19 chassis_init();
d6f38d0d 20 usart_init();
99e4226b
MG
21 i2c_init();
22
8efcc40e
MG
23 set_sleep_mode(SLEEP_MODE_IDLE);
24
99e4226b 25 sei();
d6f38d0d 26
d6f38d0d 27 while(1) {
da7751cb 28 cli();
8efcc40e 29 while (i2c_done) {
da7751cb
MG
30 len = i2c_len;
31 memcpy(buf, (unsigned char*)i2c_databuf, len);
32 i2c_done = 0x00;
8efcc40e 33 sei();
da7751cb
MG
34
35 decode_ipmb_pkt(buf, len);
8efcc40e
MG
36
37 cli();
da7751cb 38 }
8efcc40e
MG
39
40#ifdef SLEEP_MODE
41 sleep_enable();
42#endif
43 sei();
44#ifdef SLEEP_MODE
45 sleep_cpu();
46 sleep_disable();
47#endif
d6f38d0d
MG
48 }
49
50 return 0;
51}
Impressum, Datenschutz