X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/rsbs2/blobdiff_plain/f9d5c6e0b95e763fb9900e1e7cd5114bc452dfb9..87f4338b452dea4fdebba3eac573bec999642eb9:/bmc/chassis.c diff --git a/bmc/chassis.c b/bmc/chassis.c index fd48866..2259d86 100644 --- a/bmc/chassis.c +++ b/bmc/chassis.c @@ -1,33 +1,110 @@ #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<