/** * @brief Handle when new data received by UART * * @param esp_dte ESP32 Modem DTE object */ static void esp_handle_uart_data(esp_modem_dte_t *esp_dte) { size_t length = 0; uart_get_buffered_data_len(esp_dte->uart_port, &length); length = MIN(ESP_MODEM_LINE_BUFFER_SIZE, length); length = uart_read_bytes(esp_dte->uart_port, esp_dte->buffer, length, portMAX_DELAY); /* pass input data to the lwIP core thread */ if (length) { pppos_input_tcpip(esp_dte->ppp, esp_dte->buffer, length); } }
static void pppos_client_task(void *self_in) { ppp_if_obj_t *self = (ppp_if_obj_t*)self_in; uint8_t buf[256]; while (ulTaskNotifyTake(pdTRUE, 0) == 0) { int err; int len = mp_stream_rw(self->stream, buf, sizeof(buf), &err, 0); if (len > 0) { pppos_input_tcpip(self->pcb, (u8_t*)buf, len); } } self->client_task_handle = NULL; vTaskDelete(NULL); }
static void pppos_rx_thread(void *arg) { u32_t len; u8_t buffer[128]; LWIP_UNUSED_ARG(arg); /* Please read the "PPPoS input path" chapter in the PPP documentation. */ while (1) { len = sio_read(ppp_sio, buffer, sizeof(buffer)); if (len > 0) { /* Pass received raw characters from PPPoS to be decoded through lwIP * TCPIP thread using the TCPIP API. This is thread safe in all cases * but you should avoid passing data byte after byte. */ pppos_input_tcpip(ppp, buffer, len); } } }