1
0
forked from fsfw/fsfw

renamed system context to call context

to avoid conflicts with ISIS library, I don't want to fiddle with
it if we don't have source code
This commit is contained in:
2020-03-02 01:00:17 +01:00
parent fa38a37604
commit d0e8eb386c
7 changed files with 106 additions and 14 deletions

View File

@ -88,7 +88,7 @@ ReturnValue_t BinarySemaphore::giveBinarySemaphoreFromISR(SemaphoreHandle_t sema
if (returncode == pdPASS) {
if(*higherPriorityTaskWoken == pdPASS) {
// Request context switch
TaskManagement::requestContextSwitch(SystemContext::isr_context);
TaskManagement::requestContextSwitch(CallContext::isr);
}
return HasReturnvaluesIF::RETURN_OK;
} else {

View File

@ -6,7 +6,7 @@
// As a first step towards this, introduces system context variable which needs to be switched manually
// Haven't found function to find system context.
MessageQueue::MessageQueue(size_t message_depth, size_t max_message_size) :
defaultDestination(0),lastPartner(0), callContext(SystemContext::task_context) {
defaultDestination(0),lastPartner(0), callContext(CallContext::task) {
handle = xQueueCreate(message_depth, max_message_size);
if (handle == NULL) {
error << "MessageQueue creation failed" << std::endl;
@ -19,7 +19,7 @@ MessageQueue::~MessageQueue() {
}
}
void MessageQueue::switchSystemContext(SystemContext callContext) {
void MessageQueue::switchSystemContext(CallContext callContext) {
this->callContext = callContext;
}
@ -53,10 +53,10 @@ ReturnValue_t MessageQueue::sendMessageFrom(MessageQueueId_t sendTo,
ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo,
MessageQueueMessage *message, MessageQueueId_t sentFrom,
bool ignoreFault, SystemContext callContext) {
bool ignoreFault, CallContext callContext) {
message->setSender(sentFrom);
BaseType_t result;
if(callContext == SystemContext::task_context) {
if(callContext == CallContext::task) {
result = xQueueSendToBack(reinterpret_cast<void*>(sendTo),
reinterpret_cast<const void*>(message->getBuffer()), 0);
}

View File

@ -58,7 +58,7 @@ public:
*/
virtual ~MessageQueue();
void switchSystemContext(SystemContext callContext);
void switchSystemContext(CallContext callContext);
/**
* @brief This operation sends a message to the given destination.
@ -168,7 +168,7 @@ protected:
*/
static ReturnValue_t sendMessageFromMessageQueue(MessageQueueId_t sendTo,
MessageQueueMessage* message, MessageQueueId_t sentFrom = NO_QUEUE,
bool ignoreFault=false, SystemContext callContex = SystemContext::task_context);
bool ignoreFault=false, CallContext callContex = CallContext::task);
static ReturnValue_t handleSendResult(BaseType_t result, bool ignoreFault);
@ -177,7 +177,7 @@ private:
QueueHandle_t handle;
MessageQueueId_t defaultDestination;
MessageQueueId_t lastPartner;
SystemContext callContext; //!< Stores the current system context
CallContext callContext; //!< Stores the current system context
};
#endif /* MESSAGEQUEUE_H_ */

View File

@ -13,8 +13,8 @@ void TaskManagement::requestContextSwitchFromTask() {
vTaskDelay(0);
}
void TaskManagement::requestContextSwitch(SystemContext callContext = SystemContext::task_context) {
if(callContext == SystemContext::isr_context) {
void TaskManagement::requestContextSwitch(CallContext callContext = CallContext::task) {
if(callContext == CallContext::isr) {
// This function depends on the partmacro.h definition for the specific device
portYIELD_FROM_ISR();
} else {

View File

@ -12,9 +12,10 @@
* within an ISR or from a regular task. This is required because FreeRTOS
* has different functions for handling semaphores and messages from within an ISR and task.
*/
enum SystemContext {
task_context = 0x00,//!< task_context
isr_context = 0xFF //!< isr_context
enum CallContext {
task = 0x00,//!< task_context
isr = 0xFF //!< isr_context
};
class TaskManagement {
@ -25,7 +26,7 @@ public:
* This can be used if sending to the queue from an ISR caused a task to unblock
* and a context switch is required.
*/
static void requestContextSwitch(SystemContext callContext);
static void requestContextSwitch(CallContext callContext);
/**
* If task preemption in FreeRTOS is disabled, a context switch