In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "the method of judging the interrupt state of FreeRTOS software timer apollo". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn the "FreeRTOS software timer apollo interrupt state judgment method"!
Problem scenario
In the development, it is found that the FreeRTOS software timer does not work, which is specifically reflected in the fact that the software timer can not be interrupted.
Analyze the problem
It is found that only during the execution of a task, the software timer of FreeRTOS will not work, and other tasks will be executed normally. After troubleshooting, the priority of this task is higher than that of the timer task, and it takes a long time, so that the task can not be cut out.
Solve the problem
Modify timer task priority to the highest priority in FreeRTOSConfig.h to solve the problem
Apollo interrupt state judgment
When I look at the apollo3 code, I find the following function
Void WsfSetOsSpecificEvent (void) {if (xRadioTaskEventObject! = NULL) {BaseType_t xHigherPriorityTaskWoken, xResult; if (xPortIsInsideInterrupt () = = pdTRUE) {/ / Send an event to the main radio task xHigherPriorityTaskWoken = pdFALSE; xResult = xEventGroupSetBitsFromISR (xRadioTaskEventObject, 1, & xHigherPriorityTaskWoken) / / If the radio task is higher-priority than the context we're currently / / running from, we should yield now and run the radio task. / / if (xResult! = pdFAIL) {portYIELD_FROM_ISR (xHigherPriorityTaskWoken);}} else {xResult = xEventGroupSetBits (xRadioTaskEventObject, 1); / If the radio task is higher priority than the context we're currently / / running from, we should yield now and run the radio task. / / if (xResult! = pdFAIL) {portYIELD ();}
This is FreeRTOS sends an event flag group, xPortIsInsideInterrupt this function to determine whether the interrupt, and then call to determine whether to call api at the end of FromISR, let's take a look at the principle
Static portFORCE_INLINE BaseType_t xPortIsInsideInterrupt (void) {uint32_t ulCurrentInterrupt;BaseType_t xReturn; / * Obtain the number of the currently executing interrupt. * / _ _ asm {mrs ulCurrentInterrupt, ipsr} if (ulCurrentInterrupt = = 0) {xReturn = pdFALSE;} else {xReturn = pdTRUE;} return xReturn;}
Read the IPSR register, 0 indicates that there is no interrupt running, and non-0 indicates the running interrupt number, that is, it is in the interrupt, so use the api ending with FromISR
At this point, I believe that everyone on the "FreeRTOS software timer apollo interrupt state judgment method" have a deeper understanding, might as well to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.