Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename semaphore and mutex shim functions according to FreeRTOS API #56

Merged
merged 1 commit into from
Mar 22, 2023

Conversation

agerasev
Copy link
Contributor

Shim functions related to semaphores and mutexes affected:

  • Changed function postfixes from *_mutex to *_semaphore (except mutex creation functions) to match FreeRTOS API names.
  • Changed types from QueueHandle_t to SemaphoreHandle_t and from FreeRtosQueueHandle to FreeRtosSemaphoreHandle.
  • Renamed arguments from mutex to semaphore.

@schteve
Copy link
Collaborator

schteve commented Mar 22, 2023

Looks great! Glad to see a lot more alignment with the FreeRTOS API. Thanks!

As an idea for the future, one thing I noticed is that the existing code in the shim layer returns 0 or 1 as a proxy for a boolean. I wonder if there's opportunity to change those to bool. It seems based on this PR that bool is effectively the FFI type for itself, which is why there's nothing in ffi for it. I'm not 100% sure, but I'm having a hard time imagining a situation where this could cause any problems. Although, on second glance the 0 and 1 values are (at least sometimes) reversed - where 0 means success and 1 means failure. So we'd have to be careful to get the logic correct.

As a further idea for the future, it looks like these two functions are missing from the shim layer. We might want to add them someday. There are also FromISR variants for them.

  • xSemaphoreGetMutexHolder()
  • uxSemaphoreGetCount()

@schteve schteve merged commit 9e09e5f into lobaro:master Mar 22, 2023
@schteve schteve linked an issue Mar 23, 2023 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use FreeRtosSemaphoreHandle for semaphore functions
2 participants