test_ulp_as.c 841 B

12345678910111213141516171819202122232425
  1. #include <unistd.h>
  2. #include "unity.h"
  3. #include "soc/rtc_cntl_reg.h"
  4. #include "esp32/ulp.h"
  5. #include "ulp_test_app.h"
  6. extern const uint8_t ulp_test_app_bin_start[] asm("_binary_ulp_test_app_bin_start");
  7. extern const uint8_t ulp_test_app_bin_end[] asm("_binary_ulp_test_app_bin_end");
  8. TEST_CASE("jumps condition", "[ulp]")
  9. {
  10. esp_err_t err = ulp_load_binary(0, ulp_test_app_bin_start,
  11. (ulp_test_app_bin_end - ulp_test_app_bin_start) / sizeof(uint32_t));
  12. TEST_ESP_OK(err);
  13. REG_CLR_BIT(RTC_CNTL_INT_RAW_REG, RTC_CNTL_ULP_CP_INT_RAW);
  14. TEST_ESP_OK(ulp_run(&ulp_test_jumps - RTC_SLOW_MEM));
  15. usleep(10000);
  16. TEST_ASSERT_NOT_EQUAL(0, REG_GET_BIT(RTC_CNTL_INT_RAW_REG, RTC_CNTL_ULP_CP_INT_RAW));
  17. TEST_ASSERT_EQUAL(0, ulp_jumps_fail & UINT16_MAX);
  18. TEST_ASSERT_EQUAL(1, ulp_jumps_pass & UINT16_MAX);
  19. }