-
Notifications
You must be signed in to change notification settings - Fork 3
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
Support for Zephyr kernel objects #5
base: main
Are you sure you want to change the base?
Commits on Oct 22, 2024
-
zephyr: sys::sync: move semaphores into their own module
In preparation for adding more synchronization primitives, move the Semaphore implementation into its own module. There is enough stuff associated with each primitive that it can be confusing if they are not in their own modules. Signed-off-by: David Brown <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for bacd922 - Browse repository at this point
Copy the full SHA bacd922View commit details -
zephyr: kobj_define: Add sys Mutex and sys Condvar
Add support for declaring static instances and arrays of the sys Mutex and sys Condvar. Signed-off-by: David Brown <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for c0434a2 - Browse repository at this point
Copy the full SHA c0434a2View commit details -
zephyr: sys: sync: Mutex: Implement Send/Sync
Although it is tradition in Rust to have types such as Semaphores and Mutexes not implement Sync, these primitives, built as thing wrappers become fairly useless. Sharing them would require `Arc`, which requires alloc. Presumably someone wanting to use lower level primitives would also not likely be wanting to use allocation. For the most part, these primtives have as their real purpose to be used in the implementation of the higher level synchronization primtives, such as sync::Mutex. unlock is unsafe because it is required to only call unlock on the same thread that locked. Signed-off-by: David Brown <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 4d4ee9b - Browse repository at this point
Copy the full SHA 4d4ee9bView commit details -
samples: philosophers: Add sysmutex version
Add a version of the philosopher's demo that is built around sys::Mutex, in it's simplest use case. Signed-off-by: David Brown <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 2731deb - Browse repository at this point
Copy the full SHA 2731debView commit details -
zephyr: sync: Create Mutex/Condvar
Create higher-level Mutex and Condvar types that are similar to std::sync::Mutex and std::sync::Condvar. The main difference is that the only current constructor for this requires the sys Mutex and sys Condvar from the sys versions that are statically allocated. Signed-off-by: David Brown <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 102478e - Browse repository at this point
Copy the full SHA 102478eView commit details -
samples: philosophers: Add sync using Mutex/Condvar
Build a syncer that coordinates the forks using a single Mutex/Condvar pair, where the Mutex protects the data, and Condvar is used to coordinate. This is a common paradigm for shared synchronization. Signed-off-by: David Brown <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 2a8a82d - Browse repository at this point
Copy the full SHA 2a8a82dView commit details -
zephyr: sys: Create queue type based on k_queue
A simple wrapper around Zephyr's k_queue. Signed-off-by: David Brown <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 1c8d82a - Browse repository at this point
Copy the full SHA 1c8d82aView commit details -
zephyr: sync: channel: Create unbounded channels
Create an implementation of bounded channels, in the spirit of crossbeam-channel. Currently, only the bounded channels are supported, an as we don't yet support recovery from panic, ther is no poisoning. As the underlying Zephyr queues don't support deallocation, drop is also a no-op. Signed-off-by: David Brown <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 9187024 - Browse repository at this point
Copy the full SHA 9187024View commit details -
samples: philosophers: Add implementation for channels
Add a synchronizer for forks based on sending messages over channels to a worker thread. Signed-off-by: David Brown <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 1e62073 - Browse repository at this point
Copy the full SHA 1e62073View commit details -
samples: philosophers: Add statistics
Rather than just printing a bunch of information out as the various philosopher threads dine, use some data protected within a Mutex to collect statistics, and print those out periodically. Signed-off-by: David Brown <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 099aaa7 - Browse repository at this point
Copy the full SHA 099aaa7View commit details -
zephyr: Remove 'unsafe' from sys::Mutex::unlock
Although this function has constraints on how it can be used (the thread that calls unlock must also have called lock). However, according to the documentation, it detects this, and returns an error. As such, the wrapper in Rust does not need to be `unsafe` but can merely reflect that error code in the `Result` that it returns. Signed-off-by: David Brown <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 2413a53 - Browse repository at this point
Copy the full SHA 2413a53View commit details -
zephyr: sync: Remove unsafe block from unlock
Now that `sys::Mutex::unlock` has lost its `unsafe`, we don't need an unsafe block for it. Signed-off-by: David Brown <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 2717d8b - Browse repository at this point
Copy the full SHA 2717d8bView commit details -
zephyr: object: Make StaticKernelObject::new unsafe
This function returns initialized memory, and is therefore inherently unsafe. Added some commentary about how it is used safely. Signed-off-by: David Brown <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 93448bf - Browse repository at this point
Copy the full SHA 93448bfView commit details -
zephyr: object: Reorder declarations
Move the Wrapped trait above the StaticKernelObject so that the traits are immediately declared after the type the apply to. Signed-off-by: David Brown <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 058740f - Browse repository at this point
Copy the full SHA 058740fView commit details -
zephyr: sys: sync: Remove Clone from Mutex and Semaphore
Although these, in their current state, are safe to Clone, having these semantics will make it difficult for us to later add these types that are allocated from a pool. Uses that currently expect to clone can generally wrap these in an Arc, to allow for the sharing. Signed-off-by: David Brown <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 43c0c8a - Browse repository at this point
Copy the full SHA 43c0c8aView commit details
Commits on Oct 24, 2024
-
zephry: object: Create Fixed concept
The `Fixed` type encapsulates something that can either be a statically allocated object or a dynamically allocated one. It is conditional on `CONFIG_RUST_ALLOC`, and if that is not defined, will just end up represented as the underlying static pointer.
Configuration menu - View commit details
-
Copy full SHA for d513613 - Browse repository at this point
Copy the full SHA d513613View commit details -
zephyr: sys: sync: sempahore: Add dynamic support
Add support for dynamically allocated Semaphores. These can be freely allocated, but are not usable from userspace.
Configuration menu - View commit details
-
Copy full SHA for d8dc4fe - Browse repository at this point
Copy the full SHA d8dc4feView commit details -
samples: philosophers: Add dynamic semaphore example
Add a sample that implements the forks using dynamically allocate semaphores. Signed-off-by: David Brown <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for 8be9b79 - Browse repository at this point
Copy the full SHA 8be9b79View commit details