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

FWT-124 FWT-149 We have made changes to ouR TOS #109

Open
wants to merge 103 commits into
base: main
Choose a base branch
from

Conversation

aclowmclaughlin
Copy link
Contributor

@aclowmclaughlin aclowmclaughlin commented Oct 19, 2024

Authors: Rue & Diego
Implemented ThreadX conversion layer. Now, inside the core::rtos namespace, we have c++ objects that wrap the functionality of threadx's c structs. This means that hopefully, those working with RTOS in the future will never have to touch threadx directly. They will never have to sully their bright, beautiful minds with *shudder* complicated c pointer stuff.
Implemented:
BytePools
Threads
EventFlags
Mutexes
Queues
Semaphores

General Structure:
All of the threadx objects inherit from an initializable abstract class that basically just means they need to have an initialize function that registers them with the threadx kernel. This is important because we want to create the c++ objects before we start the kernel, but we have to register them with the kernel after the kernel has started, while the kernel is running.

Unimplemented:
Notification functions; some of the data types have notification functions, but due to c function pointer and c++ object member function weirdness it is difficult to create wrapper functions for these notification functions. The general framework for these notification functions is build into Initializable but is unimplemented for now.

Wrapper Classes:
In addition to our threadx wrappers, we are working towards thread-safe wrapper classes for our own common communication protocols. UARTTX (name courtesy of Diego), our thread-safe UART implementation, works on the surface exactly like normal UART, but actually buffers outputs and works with threadx to ensure thread safety. Plans are in place to create another wrapper like this for CAN and CANopen, possibly. Other communication protocols may be added in the event they become necessary.

…onversionLayer' into feature/aclowmclaughlin/threadxConversionLayer

# Conflicts:
#	src/rtos/BytePool.cpp
…tePool pure abstract class that serves to hide the templated BytePool class when passing it into methods
…pposed to be, and added override keyword to all the inheritors of it.
…e convention. Switched the names of BytePool and BytePoolBase to more accurately reflect the inheritance structure. Created an enum for ThreadX error return values and switched Semaphore, Queue, and Mutex return values to that appropriate enum type.
…onversionLayer' into feature/aclowmclaughlin/threadxConversionLayer

# Conflicts:
#	src/rtos/Threadx.cpp
Copy link
Contributor

@mjmagee991 mjmagee991 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some thoughts

CMakeLists.txt Show resolved Hide resolved
include/core/rtos/UARTTX.hpp Outdated Show resolved Hide resolved
include/core/io/UART.hpp Outdated Show resolved Hide resolved
include/core/rtos/BytePool.hpp Outdated Show resolved Hide resolved
include/core/rtos/BytePool.hpp Show resolved Hide resolved
samples/rtos/threadx-demo/main.cpp Outdated Show resolved Hide resolved
samples/rtos/threadx-demo/main.cpp Show resolved Hide resolved
* Struct that holds the arguments for the controller thread
*/
typedef struct controller_thread_args {
rtos::Queue* queue;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you name this queue better? I don't really understand what it's for. Also, each member here should have a comment just like you would have in a class

samples/rtos/threadx-demo/main.cpp Outdated Show resolved Hide resolved
samples/rtos/threadx-demo/main.cpp Outdated Show resolved Hide resolved
@mjh9585
Copy link
Contributor

mjh9585 commented Nov 4, 2024

Also don't forget to set the HAL timebase source to another timer before starting the kernel incase something (most the low level drivers) needs to wait for a period of time and doesn't call the TX_wait method.

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.

4 participants