diff --git a/example/README.md b/example/README.md index 13ccd26..4aca745 100644 --- a/example/README.md +++ b/example/README.md @@ -13,7 +13,7 @@ This example runs on Linux. Clone the [Espressif IoT Development Framework](https://github.com/espressif/esp-idf): ```shell -git clone --recurse-submodules -j6 --branch release/v3.3 git@github.com:espressif/esp-idf.git +git clone --recurse-submodules -j6 --branch release/v4.0 git@github.com:espressif/esp-idf.git ./esp-idf/install.sh ``` diff --git a/script/check-esp32-build b/script/check-esp32-build index 35f5675..8554235 100755 --- a/script/check-esp32-build +++ b/script/check-esp32-build @@ -31,7 +31,7 @@ set -euxo pipefail setup_esp_idf() { - git clone --branch release/v3.3 --recursive https://github.com/espressif/esp-idf.git + git clone --branch release/v4.0 --recursive https://github.com/espressif/esp-idf.git export IDF_PATH="$(pwd)"/esp-idf pip3 install wheel setuptools diff --git a/src/alarm.c b/src/alarm.c index 9a332d9..0fc8b29 100644 --- a/src/alarm.c +++ b/src/alarm.c @@ -37,6 +37,8 @@ #include #include +#include + #include #include #include diff --git a/src/vfs_event.c b/src/vfs_event.c index 220cda6..8c19dbd 100644 --- a/src/vfs_event.c +++ b/src/vfs_event.c @@ -44,24 +44,25 @@ typedef struct Event { int mFd; bool mIsOpen; - bool mCounter; + uint8_t mCounter; _lock_t mLock; } Event; static Event sEvent = { .mFd = -1, .mIsOpen = false, - .mCounter = false, + .mCounter = 0, .mLock = 0, // lazy initialized }; -static SemaphoreHandle_t *sSignalSemaphore = NULL; +static esp_vfs_select_sem_t sSignalSemaphore = {.is_sem_local = false, .sem = NULL}; -static esp_err_t event_start_select(int nfds, - fd_set * readfds, - fd_set * writefds, - fd_set * exceptfds, - SemaphoreHandle_t *signal_sem) +static esp_err_t event_start_select(int nfds, + fd_set * readfds, + fd_set * writefds, + fd_set * exceptfds, + esp_vfs_select_sem_t signal_sem, + void ** end_select_args) { esp_err_t error = ESP_OK; @@ -84,9 +85,10 @@ static esp_err_t event_start_select(int nfds, return error; } -static void event_end_select() +static esp_err_t event_end_select(void *end_select_args) { - sSignalSemaphore = NULL; + memset(&sSignalSemaphore, 0, sizeof sSignalSemaphore); + return ESP_OK; } static int event_open(const char *path, int flags, int mode) @@ -123,7 +125,7 @@ static ssize_t event_write(int fd, const void *data, size_t size) ++sEvent.mCounter; _lock_release_recursive(&sEvent.mLock); - if (sSignalSemaphore != NULL) + if (sSignalSemaphore.sem) { esp_vfs_select_triggered(sSignalSemaphore); }