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

fix(Examples): RF Test RTOS Scheduling Work Around #1011

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions Examples/MAX32655/Bluetooth/RF_Test/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,8 @@ uint8_t processEscSequence(uint8_t *seq)
*
* \brief adds latest command to command history buffer
*
* \param q pointer to the circular buffer holding command history
* \param cmd pointer to the command string to be added
* \param q pointer to the circular buffer holding command history
* \param cmd pointer to the command string to be added
*
* \return None.
*/
Expand All @@ -271,9 +271,9 @@ void cmdHistoryAdd(queue_t *q, const uint8_t *cmd)
* \fn updateQueuePointer.
*
* \brief Updates an internal marker pointing to historical command to be printed, based on up/down arrow
*
* \param q pointer to the circular buffer holding command history
*
*
* \param q pointer to the circular buffer holding command history
*
* \param upArrow flag used to upated the queuePoniter delimiting which command to print
*
* \return None.
Expand Down Expand Up @@ -393,9 +393,9 @@ void prompt(void)
* \fn printHint
*
* \brief Prints the help string of any command matching the current inputbuffer
*
*
* \param buff pointer to the inputbuffer
*
*
* \return None.
*/
/*************************************************************************************************/
Expand Down Expand Up @@ -694,17 +694,25 @@ void txTestTask(void *pvParameters)
snprintf(str, sizeof(str), "%s%s", str, (const char *)getPhyStr(phy));
APP_TRACE_INFO1("%s", str);

//Prevent FreeRTOS from context switching until the LL is finished
vTaskSuspendAll();

/* stat test */
if (testConfig.testType == BLE_TX_TEST) {
res = LlEnhancedTxTest(testConfig.channel, packetLen, packetType, phy, 0);
} else {
res = LlEnhancedRxTest(testConfig.channel, phy, 0, 0);
}
xTaskResumeAll(); //Restore scheduler

APP_TRACE_INFO2("result = %u %s", res, res == LL_SUCCESS ? "(SUCCESS)" : "(FAIL)");
/* if duration value was given then let the test run that amount of time and end */
if (testConfig.duration_ms) {
vTaskDelay(testConfig.duration_ms);
//Prevent FreeRTOS from context switching until the LL is finished
vTaskSuspendAll();
LlEndTest(NULL);
xTaskResumeAll(); //Restore scheduler
xSemaphoreGive(rfTestMutex);
}
pausePrompt = false;
Expand Down
22 changes: 15 additions & 7 deletions Examples/MAX32665/Bluetooth/RF_Test/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ uint8_t processEscSequence(uint8_t *seq)
*
* \brief adds latest command to command history buffer
*
* \param q pointer to the circular buffer holding command history
* \param cmd pointer to the command string to be added
* \param q pointer to the circular buffer holding command history
* \param cmd pointer to the command string to be added
*
* \return None.
*/
Expand All @@ -274,9 +274,9 @@ void cmdHistoryAdd(queue_t *q, const uint8_t *cmd)
* \fn updateQueuePointer.
*
* \brief Updates an internal marker pointing to historical command to be printed, based on up/down arrow
*
* \param q pointer to the circular buffer holding command history
*
*
* \param q pointer to the circular buffer holding command history
*
* \param upArrow flag used to upated the queuePoniter delimiting which command to print
*
* \return None.
Expand Down Expand Up @@ -396,9 +396,9 @@ void prompt(void)
* \fn printHint
*
* \brief Prints the help string of any command matching the current inputbuffer
*
*
* \param buff pointer to the inputbuffer
*
*
* \return None.
*/
/*************************************************************************************************/
Expand Down Expand Up @@ -695,17 +695,25 @@ void txTestTask(void *pvParameters)
snprintf(str, sizeof(str), "%s%s", str, (const char *)getPhyStr(phy));
APP_TRACE_INFO1("%s", str);

//Prevent FreeRTOS from context switching until the LL is finished
vTaskSuspendAll();

/* stat test */
if (testConfig.testType == BLE_TX_TEST) {
res = LlEnhancedTxTest(testConfig.channel, packetLen, packetType, phy, 0);
} else {
res = LlEnhancedRxTest(testConfig.channel, phy, 0, 0);
}
xTaskResumeAll(); //Restore scheduler

APP_TRACE_INFO2("result = %u %s", res, res == LL_SUCCESS ? "(SUCCESS)" : "(FAIL)");
/* if duration value was given then let the test run that amount of time and end */
if (testConfig.duration_ms) {
vTaskDelay(testConfig.duration_ms);
//Prevent FreeRTOS from context switching until the LL is finished
vTaskSuspendAll();
LlEndTest(NULL);
xTaskResumeAll(); //Restore scheduler
xSemaphoreGive(rfTestMutex);
}
pausePrompt = false;
Expand Down
22 changes: 15 additions & 7 deletions Examples/MAX32690/Bluetooth/RF_Test/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ uint8_t processEscSequence(uint8_t *seq)
*
* \brief adds latest command to command history buffer
*
* \param q pointer to the circular buffer holding command history
* \param cmd pointer to the command string to be added
* \param q pointer to the circular buffer holding command history
* \param cmd pointer to the command string to be added
*
* \return None.
*/
Expand All @@ -274,9 +274,9 @@ void cmdHistoryAdd(queue_t *q, const uint8_t *cmd)
* \fn updateQueuePointer.
*
* \brief Updates an internal marker pointing to historical command to be printed, based on up/down arrow
*
* \param q pointer to the circular buffer holding command history
*
*
* \param q pointer to the circular buffer holding command history
*
* \param upArrow flag used to upated the queuePoniter delimiting which command to print
*
* \return None.
Expand Down Expand Up @@ -396,9 +396,9 @@ void prompt(void)
* \fn printHint
*
* \brief Prints the help string of any command matching the current inputbuffer
*
*
* \param buff pointer to the inputbuffer
*
*
* \return None.
*/
/*************************************************************************************************/
Expand Down Expand Up @@ -695,17 +695,25 @@ void txTestTask(void *pvParameters)
snprintf(str, sizeof(str), "%s%s", str, (const char *)getPhyStr(phy));
APP_TRACE_INFO1("%s", str);

//Prevent FreeRTOS from context switching until the LL is finished
vTaskSuspendAll();

/* stat test */
if (testConfig.testType == BLE_TX_TEST) {
res = LlEnhancedTxTest(testConfig.channel, packetLen, packetType, phy, 0);
} else {
res = LlEnhancedRxTest(testConfig.channel, phy, 0, 0);
}
xTaskResumeAll(); //Restore scheduler

APP_TRACE_INFO2("result = %u %s", res, res == LL_SUCCESS ? "(SUCCESS)" : "(FAIL)");
/* if duration value was given then let the test run that amount of time and end */
if (testConfig.duration_ms) {
vTaskDelay(testConfig.duration_ms);
//Prevent FreeRTOS from context switching until the LL is finished
vTaskSuspendAll();
LlEndTest(NULL);
xTaskResumeAll(); //Restore scheduler
xSemaphoreGive(rfTestMutex);
}
pausePrompt = false;
Expand Down
Loading