ibmpc: Add intruppt disable and enable function
This commit is contained in:
parent
cb026d74a5
commit
b2fb5b715c
2 changed files with 20 additions and 17 deletions
|
|
@ -70,13 +70,26 @@ volatile uint8_t ibmpc_error = IBMPC_ERR_NONE;
|
|||
|
||||
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)
|
||||
|
|
|
|||
|
|
@ -89,6 +89,8 @@ extern volatile uint8_t ibmpc_protocol;
|
|||
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);
|
||||
|
|
@ -102,12 +104,6 @@ void ibmpc_host_set_led(uint8_t usb_led);
|
|||
/*
|
||||
* 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);
|
||||
|
|
@ -132,12 +128,6 @@ static inline bool clock_in(void)
|
|||
/*
|
||||
* 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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue