diff options
| author | IngHK <[email protected]> | 2024-03-21 08:30:49 +0100 |
|---|---|---|
| committer | IngHK <[email protected]> | 2024-03-21 08:30:49 +0100 |
| commit | 1bbd658352f5ecbfea13343df20cd02597dc31fd (patch) | |
| tree | f4454789c81f52afed0433d2f448105c5a80ccd4 /src/tusb.c | |
| parent | cb69ed0d0423b8e09ae77307fcc01165ae4c9386 (diff) | |
| parent | 60764de56461edbf1e8bafe4e73fdc97ec3d2e6e (diff) | |
Merge remote-tracking branch 'remotes/hathach/master' into work
Diffstat (limited to 'src/tusb.c')
| -rw-r--r-- | src/tusb.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/tusb.c b/src/tusb.c index 3ef380c83..7c86f1ca5 100644 --- a/src/tusb.c +++ b/src/tusb.c @@ -112,8 +112,7 @@ uint8_t const * tu_desc_find3(uint8_t const* desc, uint8_t const* end, uint8_t b // Endpoint Helper for both Host and Device stack //--------------------------------------------------------------------+ -bool tu_edpt_claim(tu_edpt_state_t* ep_state, osal_mutex_t mutex) -{ +bool tu_edpt_claim(tu_edpt_state_t* ep_state, osal_mutex_t mutex) { (void) mutex; // pre-check to help reducing mutex lock @@ -122,8 +121,7 @@ bool tu_edpt_claim(tu_edpt_state_t* ep_state, osal_mutex_t mutex) // can only claim the endpoint if it is not busy and not claimed yet. bool const available = (ep_state->busy == 0) && (ep_state->claimed == 0); - if (available) - { + if (available) { ep_state->claimed = 1; } @@ -132,16 +130,14 @@ bool tu_edpt_claim(tu_edpt_state_t* ep_state, osal_mutex_t mutex) return available; } -bool tu_edpt_release(tu_edpt_state_t* ep_state, osal_mutex_t mutex) -{ +bool tu_edpt_release(tu_edpt_state_t* ep_state, osal_mutex_t mutex) { (void) mutex; (void) osal_mutex_lock(mutex, OSAL_TIMEOUT_WAIT_FOREVER); // can only release the endpoint if it is claimed and not busy bool const ret = (ep_state->claimed == 1) && (ep_state->busy == 0); - if (ret) - { + if (ret) { ep_state->claimed = 0; } |
