Skip to content
This repository has been archived by the owner on Apr 13, 2021. It is now read-only.

Commit

Permalink
The USART code still has some small bug causing a few characters of t…
Browse files Browse the repository at this point in the history
…he message to get garbled very infrequently, this commit fails to fix that but I think is still the desired behaviour (otherwise memcpy is called the second time with zero length)
  • Loading branch information
fnoble committed Feb 1, 2012
1 parent 3cdcefa commit b0f3a65
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/hw/usart.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void usart_write_dma(u8 *data, u8 n)
usart_fifo_wr = (usart_fifo_wr + n) % USART_BUFFER_LEN;
__asm__("CPSIE i;");

if (wr + n < USART_BUFFER_LEN)
if (wr + n <= USART_BUFFER_LEN)
memcpy(&usart_fifo[wr], data, n);
else {
/* Deal with case where write wraps the circular buffer. */
Expand Down

0 comments on commit b0f3a65

Please sign in to comment.