Revision 78
fixed ack reading issue. added statemachine, still not working
mouse.c | ||
---|---|---|
81 | 81 |
int (mouse_issue_cmd)(uint32_t cmd) { |
82 | 82 |
int ret; |
83 | 83 |
uint8_t ack = 0; |
84 |
if ((ret = kbc_issue_cmd(MOUSE_WRITE_B))) return ret; |
|
85 |
if ((ret = kbc_issue_arg(cmd))) return ret; |
|
86 |
if ((ret = mouse_read_ack(&ack))) return ret; |
|
87 |
if (ack == ACK_OK) return SUCCESS; |
|
88 |
if (ack == ACK_ERROR) return INVALID_COMMAND; |
|
89 |
return OTHER_ERROR; |
|
84 |
for (unsigned int i = 0; i < KBC_NUM_TRIES; i++) { |
|
85 |
if ((ret = kbc_issue_cmd(MOUSE_WRITE_B))) return ret; |
|
86 |
if ((ret = kbc_issue_arg(cmd))) return ret; |
|
87 |
if ((ret = mouse_read_ack(&ack))) return ret; |
|
88 |
|
|
89 |
if (ack == ACK_OK) return SUCCESS; |
|
90 |
if (ack == ACK_ERROR) return INVALID_COMMAND; |
|
91 |
tickdelay(micros_to_ticks(DELAY)); |
|
92 |
} |
|
93 |
return TIMEOUT_ERROR; |
|
90 | 94 |
} |
91 | 95 |
|
92 | 96 |
int (mouse_read_byte)(uint8_t *byte) { |
Also available in: Unified diff