]> cvs.zerfleddert.de Git - rsbs2/blobdiff - bmc/chassis.c
Completely working IPMB communication (power up/down, reset)
[rsbs2] / bmc / chassis.c
diff --git a/bmc/chassis.c b/bmc/chassis.c
new file mode 100644 (file)
index 0000000..5bdad1f
--- /dev/null
@@ -0,0 +1,37 @@
+#include <avr/io.h>
+#include <stdio.h>
+
+#include "chassis.h"
+
+#define DEBUG
+
+void chassis_init()
+{
+       DDRB = 0xff;
+       PORTB = 0xff;
+}
+
+void chassis_control(unsigned char action)
+{
+#ifdef DEBUG
+       printf("Chassis control 0x%02x\n", action);
+#endif
+
+       switch(action) {
+               case CHASSIS_ACTION_POWER_DOWN:
+                       PORTB=0xff;
+                       break;
+
+               case CHASSIS_ACTION_POWER_UP:
+                       PORTB=0x00;
+                       break;
+
+               case CHASSIS_ACTION_HARD_RESET:
+                       PORTB=0x55;
+                       break;
+
+               default:
+                       printf("Unimplemented chassis action 0x%02x\n", action);
+                       break;
+       }
+}
Impressum, Datenschutz