X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/rsbs2/blobdiff_plain/7f52e04004f9e6147790d674600e0eed5a5e8448..f9d5c6e0b95e763fb9900e1e7cd5114bc452dfb9:/bmc/bmc.c diff --git a/bmc/bmc.c b/bmc/bmc.c index d7c5cdc..abe86e5 100644 --- a/bmc/bmc.c +++ b/bmc/bmc.c @@ -1,30 +1,42 @@ #include -#include #include +#include +#include #include #include "usart.h" #include "i2c.h" +#include "ipmb.h" +#include "chassis.h" +#include "bmc.h" int main(void) { - DDRB = 0xff; - PORTB = 0xff; + uint8_t old_SREG; + unsigned char buf[12]; + unsigned int len; + chassis_init(); usart_init(); - printf("\n"); - i2c_init(); - printf("Waiting for I2C...\n"); - sei(); - PORTB = 0xff; - while(1) { -#if 1 +#if 0 sleep_mode(); #endif + old_SREG = SREG; + cli(); + if (i2c_done) { + len = i2c_len; + memcpy(buf, (unsigned char*)i2c_databuf, len); + i2c_done = 0x00; + SREG = old_SREG; + + decode_ipmb_pkt(buf, len); + } else { + SREG = old_SREG; + } } return 0;