diff options
Diffstat (limited to 'applications/threadx_demo')
-rw-r--r-- | applications/threadx_demo/main.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/applications/threadx_demo/main.cpp b/applications/threadx_demo/main.cpp index bf65085..cbf1661 100644 --- a/applications/threadx_demo/main.cpp +++ b/applications/threadx_demo/main.cpp @@ -144,22 +144,24 @@ void *ethosu_mutex_create(void) { return (void *)mutex; } -void ethosu_mutex_lock(void *mutex) { +int ethosu_mutex_lock(void *mutex) { UINT status; status = tx_mutex_get(reinterpret_cast<TX_MUTEX *>(mutex), TX_WAIT_FOREVER); if (status != TX_SUCCESS) { printf("mutex get failed, error - %d\n", status); + return -1; } - return; + return 0; } -void ethosu_mutex_unlock(void *mutex) { +int ethosu_mutex_unlock(void *mutex) { UINT status; status = tx_mutex_put(reinterpret_cast<TX_MUTEX *>(mutex)); if (status != TX_SUCCESS) { printf("mutex put failed, error - %d\n", status); + return -1; } - return; + return 0; } void *ethosu_semaphore_create(void) { @@ -176,28 +178,30 @@ void *ethosu_semaphore_create(void) { return (void *)semaphore; } -void ethosu_semaphore_take(void *sem) { +int ethosu_semaphore_take(void *sem) { UINT status; status = tx_semaphore_get(reinterpret_cast<TX_SEMAPHORE *>(sem), TX_WAIT_FOREVER); if (status != TX_SUCCESS) { printf("Semaphore get/take, error - %d\n", status); + return -1; } - return; + return 0; } -void ethosu_semaphore_give(void *sem) { +int ethosu_semaphore_give(void *sem) { UINT status; status = tx_semaphore_put(reinterpret_cast<TX_SEMAPHORE *>(sem)); if (status != TX_SUCCESS) { printf("Semaphore put/give, error - %d\n", status); + return -1; } - return; + return 0; } } |