Question: It needs C language codes not the explanation, as someone before did only the explanation Question3 A Real Time Operating System (RTOS) is often used

It needs C language codes not the explanation, as someone before did only the explanation

Question3 A Real Time Operating System (RTOS) is often used for embedded systems to simplify complex designs while maintaining reliability. A RTOS usually allows for multiple task priarity levels and is preemptive. An example application using the CMSIS-RTOS framework is shown in the following code fragment osThreadId nyTask01Handle osThreadId nyTask02Handle sMutexId myMutex01Handlei / Mutex for common resource int 32 t Counter0 Common resource used by both tasks void StartTask01 (void constargunent) int 32_t while (1) osMutexkait (myMutex01Handle, osWaitForever) LocalCounter ++Counteri Increment and make local copy osMutexRelease (myMutex01Handle) void StartTask02 (void constargunent) while (1) osMutexkait (myMutex01Handle, osWaitForever) LocalCounter-Counteri / Decrement and make local copy osMutexRelease (myMutex01Handle) void main) osKernelinitialize osMutexDef (myMutex01) myMutex01 Handle = osMutexc reate (osMutex (myMutex01)) ; osThreadDef (myTask01, StartTask01, osPriorityNormal, , 256) nyTask01HandleosThreadCreate (osThread (nyTask01),NULL) osThreadDef (myTask02, StartTask02, osPriorityNormal, , 256) nyTask02HandleosThreadCreate (osThread (nyTask02),NULL) osKernelstart D The following questions relate to the code fragment above Page 8 of l2 ELEC3730 Digital and Computer Electronics 2 Practice Esamination a) If the common resource was also required by an Interrupt Service Routine (ISR), could the following code fragment be used inside the ISR? osMutexWait (nyMutex01Handle oskaitForever) LocalCounter--Counter: 1/ Decroment and make local copy osMutexRelease (nyMutex01 Handle) Provide an explanation for your answer b) Explain how the example application could be modified so that only one task procedure is required, yet still achieve the same outcome, with one task incrementing the common resource and the other task decrementing the common resource. No code is required, just an explanation Question3 A Real Time Operating System (RTOS) is often used for embedded systems to simplify complex designs while maintaining reliability. A RTOS usually allows for multiple task priarity levels and is preemptive. An example application using the CMSIS-RTOS framework is shown in the following code fragment osThreadId nyTask01Handle osThreadId nyTask02Handle sMutexId myMutex01Handlei / Mutex for common resource int 32 t Counter0 Common resource used by both tasks void StartTask01 (void constargunent) int 32_t while (1) osMutexkait (myMutex01Handle, osWaitForever) LocalCounter ++Counteri Increment and make local copy osMutexRelease (myMutex01Handle) void StartTask02 (void constargunent) while (1) osMutexkait (myMutex01Handle, osWaitForever) LocalCounter-Counteri / Decrement and make local copy osMutexRelease (myMutex01Handle) void main) osKernelinitialize osMutexDef (myMutex01) myMutex01 Handle = osMutexc reate (osMutex (myMutex01)) ; osThreadDef (myTask01, StartTask01, osPriorityNormal, , 256) nyTask01HandleosThreadCreate (osThread (nyTask01),NULL) osThreadDef (myTask02, StartTask02, osPriorityNormal, , 256) nyTask02HandleosThreadCreate (osThread (nyTask02),NULL) osKernelstart D The following questions relate to the code fragment above Page 8 of l2 ELEC3730 Digital and Computer Electronics 2 Practice Esamination a) If the common resource was also required by an Interrupt Service Routine (ISR), could the following code fragment be used inside the ISR? osMutexWait (nyMutex01Handle oskaitForever) LocalCounter--Counter: 1/ Decroment and make local copy osMutexRelease (nyMutex01 Handle) Provide an explanation for your answer b) Explain how the example application could be modified so that only one task procedure is required, yet still achieve the same outcome, with one task incrementing the common resource and the other task decrementing the common resource. No code is required, just an explanation

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!