mirror of
https://github.com/espressif/esp-idf.git
synced 2026-06-11 11:42:39 +02:00
unit tests: fix warnings, build with -Werror
- libsodium: silence warnings - unit tests: fix warnings - spiram: fix warnings - ringbuf test: enable by default, reduce delays
This commit is contained in:
@@ -164,7 +164,7 @@ static void uartRxInit(xQueueHandle q)
|
||||
{
|
||||
uint32_t reg_val;
|
||||
|
||||
PIN_PULLUP_DIS(PERIPHS_IO_MUX_U0TXD_U);
|
||||
gpio_pullup_dis(1);
|
||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0RXD_U, FUNC_U0RXD_U0RXD);
|
||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0TXD_U, FUNC_U0TXD_U0TXD);
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Test for multicore FreeRTOS ringbuffer.
|
||||
*/
|
||||
|
||||
#include <esp_types.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include "rom/ets_sys.h"
|
||||
|
||||
@@ -16,11 +16,8 @@
|
||||
#include "soc/uart_reg.h"
|
||||
#include "soc/dport_reg.h"
|
||||
#include "soc/io_mux_reg.h"
|
||||
#include "esp_intr_alloc.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void ets_isr_unmask(uint32_t unmask);
|
||||
|
||||
static RingbufHandle_t rb;
|
||||
typedef enum {
|
||||
@@ -32,6 +29,8 @@ typedef enum {
|
||||
|
||||
static volatile testtype_t testtype;
|
||||
|
||||
intr_handle_t s_intr_handle;
|
||||
|
||||
static void task1(void *arg)
|
||||
{
|
||||
testtype_t oldtest;
|
||||
@@ -50,14 +49,14 @@ static void task1(void *arg)
|
||||
printf("Test %d: Timeout on send!\n", (int)testtype);
|
||||
}
|
||||
if (testtype == TST_MOSTLYEMPTY) {
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
vTaskDelay(300 / portTICK_PERIOD_MS);
|
||||
}
|
||||
}
|
||||
//Send NULL event to stop other side.
|
||||
r = xRingbufferSend(rb, NULL, 0, 10000 / portTICK_PERIOD_MS);
|
||||
}
|
||||
while (oldtest == testtype) {
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
vTaskDelay(300 / portTICK_PERIOD_MS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -85,12 +84,12 @@ static void task2(void *arg)
|
||||
vRingbufferReturnItem(rb, buf);
|
||||
}
|
||||
if (testtype == TST_MOSTLYFILLED) {
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
vTaskDelay(300 / portTICK_PERIOD_MS);
|
||||
}
|
||||
}
|
||||
}
|
||||
while (oldtest == testtype) {
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
vTaskDelay(300 / portTICK_PERIOD_MS);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -138,24 +137,16 @@ static void uartIsrHdl(void *arg)
|
||||
|
||||
static void uartRxInit()
|
||||
{
|
||||
uint32_t reg_val;
|
||||
PIN_PULLUP_DIS(PERIPHS_IO_MUX_U0TXD_U);
|
||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0RXD_U, FUNC_U0RXD_U0RXD);
|
||||
PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0TXD_U, FUNC_U0TXD_U0TXD);
|
||||
|
||||
// reg_val = READ_PERI_REG(UART_CONF1(0));
|
||||
reg_val = (1 << UART_RXFIFO_FULL_THRHD_S);
|
||||
WRITE_PERI_REG(UART_CONF1_REG(0), reg_val);
|
||||
WRITE_PERI_REG(UART_CONF1_REG(0), 1 << UART_RXFIFO_FULL_THRHD_S);
|
||||
CLEAR_PERI_REG_MASK(UART_INT_ENA_REG(0), UART_TXFIFO_EMPTY_INT_ENA | UART_RXFIFO_TOUT_INT_ENA);
|
||||
SET_PERI_REG_MASK(UART_INT_ENA_REG(0), UART_RXFIFO_FULL_INT_ENA);
|
||||
|
||||
printf("Enabling int %d\n", ETS_UART0_INUM);
|
||||
DPORT_REG_SET_FIELD(DPORT_PRO_UART_INTR_MAP_REG, DPORT_PRO_UART_INTR_MAP, ETS_UART0_INUM);
|
||||
DPORT_REG_SET_FIELD(DPORT_PRO_UART1_INTR_MAP_REG, DPORT_PRO_UART1_INTR_MAP, ETS_UART0_INUM);
|
||||
|
||||
xt_set_interrupt_handler(ETS_UART0_INUM, uartIsrHdl, NULL);
|
||||
xt_ints_on(1 << ETS_UART0_INUM);
|
||||
ESP_ERROR_CHECK(esp_intr_alloc(ETS_UART0_INTR_SOURCE, 0, &uartIsrHdl, NULL, &s_intr_handle));
|
||||
}
|
||||
|
||||
static void uartRxDeinit()
|
||||
{
|
||||
esp_intr_free(s_intr_handle);
|
||||
}
|
||||
|
||||
static void testRingbuffer(int type)
|
||||
@@ -166,31 +157,32 @@ static void testRingbuffer(int type)
|
||||
|
||||
testtype = TST_MOSTLYFILLED;
|
||||
|
||||
xTaskCreatePinnedToCore(task1 , "tskone" , 2048, NULL, 3, &th[0], 0);
|
||||
xTaskCreatePinnedToCore(task2 , "tsktwo" , 2048, NULL, 3, &th[1], 0);
|
||||
xTaskCreatePinnedToCore(task1, "tskone", 2048, NULL, 3, &th[0], 0);
|
||||
xTaskCreatePinnedToCore(task2, "tsktwo", 2048, NULL, 3, &th[1], 0);
|
||||
uartRxInit();
|
||||
|
||||
printf("Press 'r' to read an event in isr, any other key to write one.\n");
|
||||
printf("Test: mostlyfilled; putting 10 items in ringbuff ASAP, reading 1 a second\n");
|
||||
vTaskDelay(15000 / portTICK_PERIOD_MS);
|
||||
vTaskDelay(5000 / portTICK_PERIOD_MS);
|
||||
printf("Test: mostlyempty; putting 10 items in ringbuff @ 1/sec, reading as fast as possible\n");
|
||||
testtype = TST_MOSTLYEMPTY;
|
||||
vTaskDelay(15000 / portTICK_PERIOD_MS);
|
||||
vTaskDelay(5000 / portTICK_PERIOD_MS);
|
||||
|
||||
//Shut down all the tasks
|
||||
for (i = 0; i < 2; i++) {
|
||||
vTaskDelete(th[i]);
|
||||
}
|
||||
xt_ints_off(1 << ETS_UART0_INUM);
|
||||
vRingbufferDelete(rb);
|
||||
uartRxDeinit();
|
||||
}
|
||||
|
||||
// TODO: split this thing into separate orthogonal tests
|
||||
TEST_CASE("FreeRTOS ringbuffer test, no splitting items", "[freertos][ignore]")
|
||||
TEST_CASE("FreeRTOS ringbuffer test, no splitting items", "[freertos]")
|
||||
{
|
||||
testRingbuffer(0);
|
||||
}
|
||||
|
||||
TEST_CASE("FreeRTOS ringbuffer test, w/ splitting items", "[freertos][ignore]")
|
||||
TEST_CASE("FreeRTOS ringbuffer test, w/ splitting items", "[freertos]")
|
||||
{
|
||||
testRingbuffer(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user