]> cvs.zerfleddert.de Git - rsbs2/blobdiff - bmc/bmc.c
Completely working IPMB communication (power up/down, reset)
[rsbs2] / bmc / bmc.c
index 525785ec48cf81e3a6dc8d5f836fd902648d0624..99427f6580713ccbda8093a75b24e6b49897c206 100644 (file)
--- a/bmc/bmc.c
+++ b/bmc/bmc.c
@@ -1,16 +1,20 @@
 #include <avr/io.h>
-#include <avr/sleep.h>
 #include <avr/interrupt.h>
+#include <string.h>
 #include <stdio.h>
 #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");
 
@@ -21,9 +25,21 @@ int main(void)
        sei();
 
        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;
Impressum, Datenschutz