| 79 | } |
| 80 | |
| 81 | uint8_t recv_ec_data(void) |
| 82 | { |
| 83 | int timeout; |
| 84 | uint8_t data; |
| 85 | |
| 86 | timeout = 0x7fff; |
| 87 | while (--timeout) { // Wait for OBF = 1 |
| 88 | if (inb(ec_sc) & EC_OBF) |
| 89 | break; |
| 90 | |
| 91 | usleep(10); |
| 92 | if ((timeout & 0xff) == 0) |
| 93 | debug("."); |
| 94 | } |
| 95 | if (!timeout) { |
| 96 | debug("\nTimeout while receiving data from EC!\n"); |
| 97 | // return -1; |
| 98 | } |
| 99 | |
| 100 | data = inb(ec_data); |
| 101 | debug("recv_ec_data: 0x%02x\n", data); |
| 102 | |
| 103 | return data; |
| 104 | } |
| 105 | |
| 106 | uint8_t ec_read(uint8_t addr) |
| 107 | { |
no test coverage detected