2024-06-03 18:59:42 +08:00
|
|
|
#include "common.hpp"
|
2024-06-03 16:27:41 +08:00
|
|
|
|
|
|
|
void vApplicationMallocFailedHook(void)
|
|
|
|
{
|
|
|
|
/* Called if a call to pvPortMalloc() fails because there is insufficient
|
|
|
|
free memory available in the FreeRTOS heap. pvPortMalloc() is called
|
|
|
|
internally by FreeRTOS API functions that create tasks, queues, software
|
|
|
|
timers, and semaphores. The size of the FreeRTOS heap is set by the
|
|
|
|
configTOTAL_HEAP_SIZE configuration constant in FreeRTOSConfig.h. */
|
|
|
|
|
|
|
|
/* Force an assert. */
|
|
|
|
configASSERT((volatile void *)NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*-----------------------------------------------------------*/
|
|
|
|
|
|
|
|
void vApplicationStackOverflowHook(TaskHandle_t pxTask, char *pcTaskName)
|
|
|
|
{
|
|
|
|
(void)pcTaskName;
|
|
|
|
(void)pxTask;
|
|
|
|
|
|
|
|
/* Run time stack overflow checking is performed if
|
|
|
|
configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook
|
|
|
|
function is called if a stack overflow is detected. */
|
|
|
|
|
|
|
|
/* Force an assert. */
|
|
|
|
configASSERT((volatile void *)NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
void vApplicationTickHook(void)
|
|
|
|
{
|
|
|
|
#if mainCREATE_SIMPLE_BLINKY_DEMO_ONLY == 0
|
|
|
|
{
|
|
|
|
/* The full demo includes a software timer demo/test that requires
|
|
|
|
prodding periodically from the tick interrupt. */
|
|
|
|
/*完整的演示包括软件定时器演示/测试,需要
|
2024-06-04 09:54:09 +08:00
|
|
|
从滴答声中断中周期性地发出提示 */
|
2024-06-03 16:27:41 +08:00
|
|
|
#if (mainENABLE_TIMER_DEMO == 1)
|
|
|
|
vTimerPeriodicISRTests();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Call the periodic queue overwrite from ISR demo. */
|
2024-06-04 09:54:09 +08:00
|
|
|
/*调用ISR演示中的周期性队列覆盖 */
|
2024-06-03 16:27:41 +08:00
|
|
|
#if (mainENABLE_QUEUE_OVERWRITE == 1)
|
|
|
|
vQueueOverwritePeriodicISRDemo();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Call the periodic event group from ISR demo. */
|
2024-06-04 09:54:09 +08:00
|
|
|
/*从ISR演示中调用定期事件组 */
|
2024-06-03 16:27:41 +08:00
|
|
|
#if (mainENABLE_EVENT_GROUP == 1)
|
|
|
|
vPeriodicEventGroupsProcessing();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Call the code that uses a mutex from an ISR. */
|
2024-06-04 09:54:09 +08:00
|
|
|
/*从ISR调用使用互斥的代码 */
|
2024-06-03 16:27:41 +08:00
|
|
|
#if (mainENABLE_INTERRUPT_SEMAPHORE == 1)
|
|
|
|
vInterruptSemaphorePeriodicTest();
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Call the code that 'gives' a task notification from an ISR. */
|
2024-06-04 09:54:09 +08:00
|
|
|
/*调用从ISR“发出”任务通知的代码 */
|
2024-06-03 16:27:41 +08:00
|
|
|
#if (mainENABLE_TASK_NOTIFY == 1)
|
|
|
|
xNotifyTaskFromISR();
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2024-06-03 18:59:42 +08:00
|
|
|
void _printTaskStackHighWaterMark(const char *task_name)
|
2024-06-03 16:27:41 +08:00
|
|
|
{
|
|
|
|
TaskHandle_t currentTask = xTaskGetCurrentTaskHandle();
|
2024-06-04 09:54:09 +08:00
|
|
|
if (currentTask != NULL) {
|
2024-06-03 18:59:42 +08:00
|
|
|
printf("%s TASK STACK HIGH WATER MARK: %ld\n", task_name, uxTaskGetStackHighWaterMark(currentTask));
|
2024-06-04 09:54:09 +08:00
|
|
|
} else {
|
2024-06-03 16:27:41 +08:00
|
|
|
printf("FAILED TO GET CURRENT TASK HANDLE.\n");
|
|
|
|
}
|
|
|
|
}
|