Skip to content

Commit c4e26dd

Browse files
committed
esp8266/uart: Remove obsolete UART rx buffering code.
It's now completely replaced by the ringbuf implementation.
1 parent d46bea9 commit c4e26dd

1 file changed

Lines changed: 0 additions & 38 deletions

File tree

esp8266/uart.c

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,6 @@ extern UartDevice UartDev;
2727
// the uart to which OS messages go; -1 to disable
2828
static int uart_os = UART_OS;
2929

30-
/* unused
31-
// circular buffer for RX buffering
32-
#define RX_BUF_SIZE (256)
33-
static uint16_t rx_buf_in;
34-
static uint16_t rx_buf_out;
35-
static uint8_t rx_buf[RX_BUF_SIZE];
36-
*/
37-
3830
#if MICROPY_REPL_EVENT_DRIVEN
3931
static os_event_t uart_evt_queue[16];
4032
#endif
@@ -94,12 +86,6 @@ static void ICACHE_FLASH_ATTR uart_config(uint8 uart_no) {
9486
WRITE_PERI_REG(UART_INT_CLR(uart_no), 0xffff);
9587
// enable rx_interrupt
9688
SET_PERI_REG_MASK(UART_INT_ENA(uart_no), UART_RXFIFO_FULL_INT_ENA);
97-
98-
/* unused
99-
// init RX buffer
100-
rx_buf_in = 0;
101-
rx_buf_out = 0;
102-
*/
10389
}
10490

10591
/******************************************************************************
@@ -179,7 +165,6 @@ static void uart0_rx_intr_handler(void *para) {
179165
goto read_chars;
180166
} else if (UART_RXFIFO_TOUT_INT_ST == (READ_PERI_REG(UART_INT_ST(uart_no)) & UART_RXFIFO_TOUT_INT_ST)) {
181167
read_chars:
182-
#if 1 //MICROPY_REPL_EVENT_DRIVEN is not available here
183168
ETS_UART_INTR_DISABLE();
184169

185170
while (READ_PERI_REG(UART_STATUS(uart_no)) & (UART_RXFIFO_CNT << UART_RXFIFO_CNT_S)) {
@@ -196,32 +181,9 @@ static void uart0_rx_intr_handler(void *para) {
196181
// Clear pending FIFO interrupts
197182
WRITE_PERI_REG(UART_INT_CLR(UART_REPL), UART_RXFIFO_TOUT_INT_CLR | UART_RXFIFO_FULL_INT_ST);
198183
ETS_UART_INTR_ENABLE();
199-
200-
#else
201-
while (READ_PERI_REG(UART_STATUS(uart_no)) & (UART_RXFIFO_CNT << UART_RXFIFO_CNT_S)) {
202-
uint8 RcvChar = READ_PERI_REG(UART_FIFO(uart_no)) & 0xff;
203-
uint16_t rx_buf_in_next = (rx_buf_in + 1) % RX_BUF_SIZE;
204-
if (rx_buf_in_next != rx_buf_out) {
205-
rx_buf[rx_buf_in] = RcvChar;
206-
rx_buf_in = rx_buf_in_next;
207-
}
208-
}
209-
#endif
210184
}
211185
}
212186

213-
/* unused
214-
int uart0_rx(void) {
215-
if (rx_buf_out != rx_buf_in) {
216-
int chr = rx_buf[rx_buf_out];
217-
rx_buf_out = (rx_buf_out + 1) % RX_BUF_SIZE;
218-
return chr;
219-
} else {
220-
return -1;
221-
}
222-
}
223-
*/
224-
225187
// Waits at most timeout microseconds for at least 1 char to become ready for reading.
226188
// Returns true if something available, false if not.
227189
bool uart_rx_wait(uint32_t timeout_us) {

0 commit comments

Comments
 (0)