|
|
|
|
|
|
|
|
|
|
|
|
|
|
void ps2_host_init(void) |
|
|
void ps2_host_init(void) |
|
|
{ |
|
|
{ |
|
|
#ifdef PS2_INT_ENABLE |
|
|
|
|
|
PS2_INT_ENABLE(); |
|
|
|
|
|
|
|
|
#ifdef PS2_USE_INT |
|
|
|
|
|
PS2_INT_INIT(); |
|
|
|
|
|
PS2_INT_ON(); |
|
|
idle(); |
|
|
idle(); |
|
|
#else |
|
|
#else |
|
|
inhibit(); |
|
|
inhibit(); |
|
|
|
|
|
|
|
|
uint8_t res = 0; |
|
|
uint8_t res = 0; |
|
|
bool parity = true; |
|
|
bool parity = true; |
|
|
ps2_error = PS2_ERR_NONE; |
|
|
ps2_error = PS2_ERR_NONE; |
|
|
#ifdef PS2_INT_DISABLE |
|
|
|
|
|
PS2_INT_DISABLE(); |
|
|
|
|
|
|
|
|
#ifdef PS2_USE_INT |
|
|
|
|
|
PS2_INT_OFF(); |
|
|
#endif |
|
|
#endif |
|
|
/* terminate a transmission if we have */ |
|
|
/* terminate a transmission if we have */ |
|
|
inhibit(); |
|
|
inhibit(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
res = ps2_host_recv_response(); |
|
|
res = ps2_host_recv_response(); |
|
|
ERROR: |
|
|
ERROR: |
|
|
#ifdef PS2_INT_ENABLE |
|
|
|
|
|
PS2_INT_ENABLE(); |
|
|
|
|
|
|
|
|
#ifdef PS2_USE_INT |
|
|
|
|
|
PS2_INT_ON(); |
|
|
idle(); |
|
|
idle(); |
|
|
#else |
|
|
#else |
|
|
inhibit(); |
|
|
inhibit(); |
|
|
|
|
|
|
|
|
return data; |
|
|
return data; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#ifndef PS2_INT_VECT |
|
|
|
|
|
|
|
|
#ifndef PS2_USE_INT |
|
|
uint8_t ps2_host_recv(void) |
|
|
uint8_t ps2_host_recv(void) |
|
|
{ |
|
|
{ |
|
|
return ps2_host_recv_response(); |
|
|
return ps2_host_recv_response(); |