6 #ifdef __AVR_ATmega16__
12 #error "Please add chassis power/reset-PIN information for this chip"
15 #define __CPORT(port) PORT##port
16 #define _CPORT(port) __CPORT(port)
17 #define CPORT _CPORT(CHASSISPORT)
19 #define __CDDR(port) DDR##port
20 #define _CDDR(port) __CDDR(port)
21 #define CDDR _CDDR(CHASSISPORT)
23 static void chassis_set_pins(uint8_t pins
, uint8_t state
);
27 chassis_set_pins((1<<POWER_PIN
) | (1<<RESET_PIN
), 0);
28 CDDR
|= ((1<<POWER_PIN
) | (1<<RESET_PIN
));
31 static void chassis_set_pins(uint8_t pins
, uint8_t state
)
44 static void chassis_power(int msec
)
48 chassis_set_pins((1<<POWER_PIN
), 1);
51 for(i
= 0; i
< (msec
<<2); i
++);
53 chassis_set_pins((1<<POWER_PIN
), 0);
56 static void chassis_reset(int msec
)
60 chassis_set_pins((1<<RESET_PIN
), 1);
63 for(i
= 0; i
< (msec
<<2); i
++);
65 chassis_set_pins((1<<RESET_PIN
), 0);
68 void chassis_control(unsigned char action
)
71 printf("Chassis control 0x%02x\n", action
);
75 case CHASSIS_ACTION_POWER_DOWN
:
79 case CHASSIS_ACTION_POWER_UP
:
83 case CHASSIS_ACTION_HARD_RESET
:
89 printf("Unimplemented chassis action 0x%02x\n", action
);