From 8cdc7528c800a3f10bca3e875e76f6d9661ab88f Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Sat, 7 Dec 2019 17:12:27 +0100 Subject: added net_alloc; fixed cell modem driver --- code/esp32/components/eos/pcm.c | 134 ---------------------------------------- 1 file changed, 134 deletions(-) delete mode 100644 code/esp32/components/eos/pcm.c (limited to 'code/esp32/components/eos/pcm.c') diff --git a/code/esp32/components/eos/pcm.c b/code/esp32/components/eos/pcm.c deleted file mode 100644 index edfcf88..0000000 --- a/code/esp32/components/eos/pcm.c +++ /dev/null @@ -1,134 +0,0 @@ -#include -#include - -#include -#include -#include -#include -#include - -#include "eos.h" -#include "modem.h" - -static i2s_dev_t* I2S[I2S_NUM_MAX] = {&I2S0, &I2S1}; - -#define BUF_SIZE 2048 - -static QueueHandle_t i2s_queue; - -static void i2s_event_task(void *pvParameters) { - size_t size_out; - i2s_event_t event; - // Reserve a buffer and process incoming data - uint8_t *data = (uint8_t *) malloc(BUF_SIZE); - - int first = 1; - uint8_t *data_first = NULL; - - while (1) { - // Waiting for I2S event. - if (xQueueReceive(i2s_queue, (void * )&event, (portTickType)portMAX_DELAY)) { - switch (event.type) { - case I2S_EVENT_RX_DONE: - // Event of I2S receiving data - // printf("*** I2S DATA RECEIVED: %d\n ***", event.size); - i2s_read(I2S_NUM_0, (void *)data, BUF_SIZE, &size_out, 1000 / portTICK_RATE_MS); - if (first) { - if (data_first) { - first = 0; - i2s_write(I2S_NUM_0, (const void *)data_first, BUF_SIZE, &size_out, 1000 / portTICK_RATE_MS); - free(data_first); - data_first = NULL; - } else { - data_first = (uint8_t *) malloc(BUF_SIZE); - memcpy(data_first, data, BUF_SIZE); - } - - } - i2s_write(I2S_NUM_0, (const void *)data, BUF_SIZE, &size_out, 1000 / portTICK_RATE_MS); - break; - case I2S_EVENT_DMA_ERROR: - printf("*** I2S DMA ERROR ***"); - break; - default: - break; - } - } - } - free(data); - vTaskDelete(NULL); -} - -static void i2s_write_task(void *pvParameters) { - uint8_t *data = (uint8_t *) malloc(BUF_SIZE); - memset(data, 0x0, BUF_SIZE); - - int i; - for (i=0; iconf.tx_mono = 1; - I2S[I2S_NUM_0]->conf.rx_mono = 1; - i2s_start(I2S_NUM_0); - - // Create a task to handle i2s event from ISR - xTaskCreate(i2s_event_task, "i2s_event_task", 2048, NULL, EOS_IRQ_PRIORITY_I2S, NULL); - // xTaskCreate(i2s_write_task, "i2s_write_task", 2048, NULL, EOS_IRQ_PRIORITY_I2S, NULL); -} - -ssize_t eos_pcm_write(void *data, size_t size) { - size_t size_out; - - esp_err_t ret = i2s_write(I2S_NUM_0, (const void *)data, size, &size_out, portMAX_DELAY); - if (ret != ESP_OK) return EOS_ERR; - return size_out; -} - -void eos_pcm_call(void) { - const char *s = "ATD0631942317;\r"; - - i2s_zero_dma_buffer(I2S_NUM_0); - eos_modem_write((void *)s, strlen(s)); - vTaskDelay(1000 / portTICK_RATE_MS); - i2s_start(I2S_NUM_0); -} - -- cgit v1.2.3