void ibmpc_host_init(void)
{
- clock_init();
- data_init();
- idle();
+ // initialize reset pin
+ IBMPC_RST_PORT |= (1<<IBMPC_RST_BIT1);
+ IBMPC_RST_DDR |= (1<<IBMPC_RST_BIT1);
+ IBMPC_RST_PORT |= (1<<IBMPC_RST_BIT2);
+ IBMPC_RST_DDR |= (1<<IBMPC_RST_BIT2);
+ inhibit();
IBMPC_INT_INIT();
+ IBMPC_INT_OFF();
+}
+
+void ibmpc_host_enable(void)
+{
IBMPC_INT_ON();
- // POR(150-2000ms) plus BAT(300-500ms) may take 2.5sec([3]p.20)
- //wait_ms(2500);
+ idle();
+}
+
+void ibmpc_host_disable(void)
+{
+ inhibit();
+ IBMPC_INT_OFF();
}
int16_t ibmpc_host_send(uint8_t data)
extern volatile uint8_t ibmpc_error;
void ibmpc_host_init(void);
+void ibmpc_host_enable(void);
+void ibmpc_host_disable(void);
int16_t ibmpc_host_send(uint8_t data);
int16_t ibmpc_host_recv_response(void);
int16_t ibmpc_host_recv(void);
/*
* Clock
*/
-static inline void clock_init(void)
-{
- IBMPC_CLOCK_PORT &= ~(1<<IBMPC_CLOCK_BIT);
- IBMPC_CLOCK_DDR |= (1<<IBMPC_CLOCK_BIT);
-}
-
static inline void clock_lo(void)
{
IBMPC_CLOCK_PORT &= ~(1<<IBMPC_CLOCK_BIT);
/*
* Data
*/
-static inline void data_init(void)
-{
- IBMPC_DATA_DDR &= ~(1<<IBMPC_DATA_BIT);
- IBMPC_DATA_PORT |= (1<<IBMPC_DATA_BIT);
-}
-
static inline void data_lo(void)
{
IBMPC_DATA_PORT &= ~(1<<IBMPC_DATA_BIT);