-
Notifications
You must be signed in to change notification settings - Fork 0
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
fault handler attempt #93
Changes from 1 commit
7221a70
16f0718
b9e62be
9721436
9fdee2e
954aeaf
7bd32bf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,45 @@ | ||
#include "fault.h" | ||
|
||
osMessageQueueId_t fault_handle_queue; | ||
|
||
//Function to determine priority base on severity | ||
void priority(void) { | ||
osThreadId_t id; | ||
MSGQUEUE_OBJ_t msg; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So the type of the message that we receive depends on what we are actually queuing, in this case I believe the type is |
||
osStatus_t status; | ||
// Wait until a message is in the queue, send messages when they are in the queue | ||
for(;;) { | ||
status = osMessageQueueGet(fault_handle_queue, &msg, NULL, 0U); // wait for message | ||
id = osThreadGetId(); // Obtain ID of current running thread | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You shouldn't need to get the ID each time |
||
if (status == osOK) { | ||
|
||
// process data | ||
switch (fault_sev_t) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You want to access the severity field of the |
||
case 'DEFCON1': //Higest(1st) Priority | ||
osThreadSetPriority(id, osPriorityHigh); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we need to set the priority here, tbh I would just leave this blank for now apart from the |
||
osThreadSetPriority(id, osPriorityHigh); | ||
break; | ||
case 'DEFCON2': //2nd Highest Priority | ||
osThreadSetPriority(id, osPriorityAboveNormal); | ||
osThreadSetPriority(id, osPriorityAboveNormal); | ||
break; | ||
case 'DEFCON3': //3rd Highest Priority | ||
osThreadSetPriority(id, osPriorityNormal); | ||
osThreadSetPriority(id, osPriorityNormal); | ||
break; | ||
case 'DEFCON4': //Slight Above Lowest Priority | ||
osThreadSetPriority(id, osPriorityBelowNormal); | ||
osThreadSetPriority(id, osPriorityBelowNormal); | ||
break; | ||
case 'DEFCON5': //Lowest Priority | ||
osThreadSetPriority(id, osPriorityLow); | ||
osThreadSetPriority(id, osPriorityLow); | ||
break; | ||
default: //Unable To Identify 'fault_sev_t' | ||
osThreadSetPriority(id, osPriorityIdle); | ||
osThreadSetPriority(id, osPriorityIdle); | ||
break; | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this should be the main "task" which we will assign a priority and tell the kernel to schedule on boot. For references on other tasks, check the functions that start with
vSomething
in monitor.c. These have a thread attribute struct associated with them that we use to initialize in main.c