]> granicus.if.org Git - esp-idf/commitdiff
test: Fix some unused identifier warnings
authorAnton Maklakov <anton@espressif.com>
Wed, 5 Dec 2018 12:22:25 +0000 (20:22 +0800)
committerAnton Maklakov <anton@espressif.com>
Mon, 10 Dec 2018 04:34:16 +0000 (12:34 +0800)
components/driver/test/test_i2c.c
components/esp32/test/test_4mpsram.c
components/esp32/test/test_sleep.c
components/esp32/test/test_wifi_lib_git_commit.c
components/freertos/test/test_suspend_scheduler.c
components/freertos/test/test_tasks_snapshot.c

index 07432b002be176eb5af66abe9ab9f04de559baf3..48aea2a4b7e58d6571ed1172208e1e102a1b2710 100644 (file)
 
 static DRAM_ATTR i2c_dev_t *const I2C[I2C_NUM_MAX] = { &I2C0, &I2C1 };
 
-static esp_err_t i2c_master_read_slave(i2c_port_t i2c_num, uint8_t *data_rd, size_t size)
-{
-    if (size == 0) {
-        return ESP_OK;
-    }
-    i2c_cmd_handle_t cmd = i2c_cmd_link_create();
-    i2c_master_start(cmd);
-    i2c_master_write_byte(cmd, ( ESP_SLAVE_ADDR << 1 ) | READ_BIT, ACK_CHECK_EN);
-    if (size > 1) {
-        i2c_master_read(cmd, data_rd, size - 1, ACK_VAL);
-    }
-    i2c_master_read_byte(cmd, data_rd + size - 1, NACK_VAL);
-    i2c_master_stop(cmd);
-    esp_err_t ret = i2c_master_cmd_begin(i2c_num, cmd, 1000 / portTICK_RATE_MS);
-    i2c_cmd_link_delete(cmd);
-    return ret;
-}
-
 static esp_err_t i2c_master_write_slave(i2c_port_t i2c_num, uint8_t *data_wr, size_t size)
 {
     i2c_cmd_handle_t cmd = i2c_cmd_link_create();
index 26e2c8d5e4d5b33a7d89f09b52c4258424b49027..a1cd36023ce50555581d231d25c85ef806c813f8 100644 (file)
@@ -2,9 +2,11 @@
 #include "unity.h"
 #include "esp_log.h"
 #include "driver/spi_common.h"
+#include "sdkconfig.h"
 
 static const char TAG[] = "test_psram";
 
+#ifdef CONFIG_SPIRAM_SUPPORT
 static void test_psram_content()
 {
     const int test_size = 2048;
@@ -32,6 +34,7 @@ static void test_psram_content()
 
     free(test_area);
 }
+#endif
 
 // NOTE: this unit test rely on the config that PSRAM of 8MB is used only when CONFIG_SPIRAM_BNKSWITCH_ENABLE is set
 TEST_CASE("can use spi when not being used by psram", "[psram_4m]")
index f36e7598452294e3de12693ef9514e569c03d252..d2e2d9b2795ca3c1a6cad20d68e56d8c1374aca4 100644 (file)
 #include "rom/rtc.h"
 #include "esp_newlib.h"
 #include "test_utils.h"
+#include "sdkconfig.h"
 
 #define ESP_EXT0_WAKEUP_LEVEL_LOW 0
 #define ESP_EXT0_WAKEUP_LEVEL_HIGH 1
 
 static struct timeval tv_start, tv_stop;
 
-
+#ifndef CONFIG_FREERTOS_UNICORE
 static void deep_sleep_task(void *arg)
 {
     esp_deep_sleep_start();
@@ -40,6 +41,7 @@ static void do_deep_sleep_from_app_cpu()
         ;
     }
 }
+#endif
 
 TEST_CASE("wake up from deep sleep using timer", "[deepsleep][reset=DEEPSLEEP_RESET]")
 {
index 8b5633f9b1873e13a5148dddc987f7b00da51f75..fbf1dea0e5a29257c584e7b985c220f166d7e3fd 100644 (file)
@@ -5,8 +5,6 @@
 #include "esp_log.h"
 #include "esp_wifi_internal.h"
 
-static const char* TAG = "test_wifi_lib_git_commit_id";
-
 TEST_CASE("wifi lib git commit id","[wifi]")
 {    
     TEST_ESP_OK( esp_wifi_internal_git_commit_id_check() );
index 1599ef685c4de1fcf3324c21686930a83c0ee57b..9aef2ce7ec648edd5d798f785cc6bcd12cfce8a9 100644 (file)
@@ -11,6 +11,7 @@
 #include "test_utils.h"
 
 #include "driver/timer.h"
+#include "sdkconfig.h"
 
 static SemaphoreHandle_t isr_semaphore;
 static volatile unsigned isr_count;
@@ -194,6 +195,7 @@ TEST_CASE("Scheduler disabled can wake multiple tasks on resume", "[freertos]")
     }
 }
 
+#ifndef CONFIG_FREERTOS_UNICORE
 static volatile bool sched_suspended;
 static void suspend_scheduler_5ms_task_fn(void *ignore)
 {
@@ -207,7 +209,6 @@ static void suspend_scheduler_5ms_task_fn(void *ignore)
     vTaskDelete(NULL);
 }
 
-#ifndef CONFIG_FREERTOS_UNICORE
 /* If the scheduler is disabled on one CPU (A) with a task blocked on something, and a task
    on B (where scheduler is running) wakes it, then the task on A should be woken on resume.
 */
index c9364cc182ea39d7146ec659486bf07605748bdd..bc42e1a90c6ece495522d96f25152362bdff5f42 100644 (file)
@@ -7,6 +7,7 @@
 #include "freertos/FreeRTOS.h"
 #include "freertos/task.h"
 #include "unity.h"
+#include "sdkconfig.h"
 
 #define TEST_MAX_TASKS_NUM     32
 
@@ -15,16 +16,18 @@ TEST_CASE("Tasks snapshot", "[freertos]")
 {
     TaskSnapshot_t tasks[TEST_MAX_TASKS_NUM];
     UBaseType_t tcb_sz;
+#ifndef CONFIG_FREERTOS_UNICORE
     int other_core_id = xPortGetCoreID() == 0 ? 1 : 0;
+#endif
 
     // uxTaskGetSnapshotAll is supposed to be called when all tasks on both CPUs are 
     // inactive and can not alter FreeRTOS internal tasks lists, e.g. from panic handler
     unsigned state = portENTER_CRITICAL_NESTED();
-#if CONFIG_FREERTOS_UNICORE == 0
+#ifndef CONFIG_FREERTOS_UNICORE
     esp_cpu_stall(other_core_id);
 #endif
     UBaseType_t task_num = uxTaskGetSnapshotAll(tasks, TEST_MAX_TASKS_NUM, &tcb_sz);
-#if CONFIG_FREERTOS_UNICORE == 0
+#ifndef CONFIG_FREERTOS_UNICORE
     esp_cpu_unstall(other_core_id);
 #endif
     portEXIT_CRITICAL_NESTED(state);