|
|
@@ -65,6 +65,14 @@ static void timer_test(int flags)
|
|
|
printf("Interrupts allocated: %d\r\n", esp_intr_get_intno(inth[i]));
|
|
|
}
|
|
|
|
|
|
+ if ((flags & ESP_INTR_FLAG_SHARED)) {
|
|
|
+ /* Check that the allocated interrupts are acutally shared */
|
|
|
+ int intr_num = esp_intr_get_intno(inth[0]);
|
|
|
+ for (int i = 0; i < SOC_TIMER_GROUP_TOTAL_TIMERS; i++) {
|
|
|
+ TEST_ASSERT_EQUAL(intr_num, esp_intr_get_intno(inth[i]));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
|
|
printf("Timer values after 1 sec:");
|
|
|
for (int i = 0; i < SOC_TIMER_GROUP_TOTAL_TIMERS; i++) {
|
|
|
@@ -109,6 +117,27 @@ TEST_CASE("Intr_alloc test, shared ints", "[intr_alloc]")
|
|
|
timer_test(ESP_INTR_FLAG_SHARED);
|
|
|
}
|
|
|
|
|
|
+void static test_isr(void*arg)
|
|
|
+{
|
|
|
+ /* ISR should never be called */
|
|
|
+ abort();
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+TEST_CASE("Allocate previously freed interrupt, with different flags", "[intr_alloc]")
|
|
|
+{
|
|
|
+ intr_handle_t intr;
|
|
|
+ int test_intr_source = ETS_GPIO_INTR_SOURCE;
|
|
|
+ int isr_flags = ESP_INTR_FLAG_LEVEL2;
|
|
|
+
|
|
|
+ TEST_ESP_OK(esp_intr_alloc(test_intr_source, isr_flags, test_isr, NULL, &intr));
|
|
|
+ TEST_ESP_OK(esp_intr_free(intr));
|
|
|
+
|
|
|
+ isr_flags = ESP_INTR_FLAG_LEVEL3;
|
|
|
+ TEST_ESP_OK(esp_intr_alloc(test_intr_source, isr_flags, test_isr, NULL, &intr));
|
|
|
+ TEST_ESP_OK(esp_intr_free(intr));
|
|
|
+}
|
|
|
+
|
|
|
typedef struct {
|
|
|
bool flag1;
|
|
|
bool flag2;
|