X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/rsbs2/blobdiff_plain/f9d5c6e0b95e763fb9900e1e7cd5114bc452dfb9..920420f7c4af55e877e94d13d1d0ef4631ff8f32:/bmc/chassis.c diff --git a/bmc/chassis.c b/bmc/chassis.c index fd48866..29541f2 100644 --- a/bmc/chassis.c +++ b/bmc/chassis.c @@ -1,33 +1,120 @@ #include +#include #include +#include "config.h" #include "chassis.h" +#ifdef __AVR_ATmega16__ +#define CHASSISPORT B +#define POWER_PIN 0 +#define RESET_PIN 1 +#define ACTIVE_LOW +#else +#error "Please add chassis power/reset-PIN information for this chip" +#endif + +#define __CPORT(port) PORT##port +#define _CPORT(port) __CPORT(port) +#define CPORT _CPORT(CHASSISPORT) + +#define __CDDR(port) DDR##port +#define _CDDR(port) __CDDR(port) +#define CDDR _CDDR(CHASSISPORT) + +static volatile int power_cnt = 0; +static volatile int reset_cnt = 0; +static volatile int power_cycle = 0; + +static void chassis_set_pins(uint8_t pins, uint8_t state); + void chassis_init() { - DDRB = 0xff; - PORTB = 0xff; + chassis_set_pins((1<