head = tx_buffer_head; | head = tx_buffer_head; | ||||
tail = tx_buffer_tail; | tail = tx_buffer_tail; | ||||
if (head >= tail) return TX_BUFFER_SIZE - head + tail; | |||||
return tail - head; | |||||
if (head >= tail) return TX_BUFFER_SIZE - 1 - head + tail; | |||||
return tail - head - 1; | |||||
} | } | ||||
int serial_available(void) | int serial_available(void) |
head = tx_buffer_head; | head = tx_buffer_head; | ||||
tail = tx_buffer_tail; | tail = tx_buffer_tail; | ||||
if (head >= tail) return TX_BUFFER_SIZE - head + tail; | |||||
return tail - head; | |||||
if (head >= tail) return TX_BUFFER_SIZE - 1 - head + tail; | |||||
return tail - head - 1; | |||||
} | } | ||||
int serial2_available(void) | int serial2_available(void) |
head = tx_buffer_head; | head = tx_buffer_head; | ||||
tail = tx_buffer_tail; | tail = tx_buffer_tail; | ||||
if (head >= tail) return TX_BUFFER_SIZE - head + tail; | |||||
return tail - head; | |||||
if (head >= tail) return TX_BUFFER_SIZE - 1 - head + tail; | |||||
return tail - head - 1; | |||||
} | } | ||||
int serial3_available(void) | int serial3_available(void) |