summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/uart_buffering.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/common/uart_buffering.c b/common/uart_buffering.c
index 6eb8241355..e3b7e73fbd 100644
--- a/common/uart_buffering.c
+++ b/common/uart_buffering.c
@@ -28,6 +28,10 @@
#define TX_BUF_DIFF(i, j) (((i) - (j)) & (CONFIG_UART_TX_BUF_SIZE - 1))
#define RX_BUF_DIFF(i, j) (((i) - (j)) & (CONFIG_UART_RX_BUF_SIZE - 1))
+/* Check if both UART TX/RX buffer sizes are power of two. */
+BUILD_ASSERT((CONFIG_UART_TX_BUF_SIZE & (CONFIG_UART_TX_BUF_SIZE - 1)) == 0);
+BUILD_ASSERT((CONFIG_UART_RX_BUF_SIZE & (CONFIG_UART_RX_BUF_SIZE - 1)) == 0);
+
/*
* Interval between rechecking the receive DMA head pointer, after a character
* of input has been detected by the normal tick task. There will be
@@ -500,4 +504,3 @@ int uart_console_read_buffer(uint8_t type,
return EC_RES_SUCCESS;
}
-