]> cvs.zerfleddert.de Git - rsbs2/blobdiff - bmc/bmc.c
module configs now need .conf
[rsbs2] / bmc / bmc.c
index abe86e53751053c279eac5c38bc97006d8750375..e3690a47b5eef72f953e745e0cc88248bacb36af 100644 (file)
--- a/bmc/bmc.c
+++ b/bmc/bmc.c
@@ -9,34 +9,41 @@
 #include "chassis.h"
 #include "bmc.h"
 
+#undef SLEEP_MODE
+
 int main(void)
 {
-       uint8_t old_SREG;
-       unsigned char buf[12];
+       unsigned char buf[24];
        unsigned int len;
 
+       set_sleep_mode(SLEEP_MODE_IDLE);
+
        chassis_init();
        usart_init();
-       i2c_init();
-
        sei();
+       i2c_init();
 
        while(1) {
-#if 0
-               sleep_mode();
-#endif
-               old_SREG = SREG;
                cli();
-               if (i2c_done) {
+               while (i2c_done) {
                        len = i2c_len;
                        memcpy(buf, (unsigned char*)i2c_databuf, len);
                        i2c_done = 0x00;
-                       SREG = old_SREG;
+                       sei();
 
                        decode_ipmb_pkt(buf, len);
-               } else {
-                       SREG = old_SREG;
+
+                       cli();
                }
+
+#ifdef SLEEP_MODE
+               sleep_enable();
+#endif
+               sei();
+#ifdef SLEEP_MODE
+               sleep_cpu();
+               sleep_disable();
+#endif
        }
 
        return 0;
Impressum, Datenschutz