X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/rsbs2/blobdiff_plain/da7751cb0539c2ecb03ff66d05904626052e06e3..5bece6bf8c66ade0960290b6fe75623da7968e09:/bmc/chassis.c diff --git a/bmc/chassis.c b/bmc/chassis.c index 5bdad1f..29541f2 100644 --- a/bmc/chassis.c +++ b/bmc/chassis.c @@ -1,37 +1,147 @@ #include +#include #include +#include "config.h" #include "chassis.h" -#define DEBUG +#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<