/
FreeRTOSCallback.cpp
135 lines (114 loc) · 4.03 KB
/
FreeRTOSCallback.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/*-
* $Copyright$
-*/
#include <phisch/log.h>
#if defined(__cplusplus)
extern "C" {
#endif /* defined(__cplusplus) */
#if !defined(HOSTBUILD)
#include <FreeRTOS.h>
#include <task.h>
#include <queue.h>
#include <semphr.h>
#else
void taskDISABLE_INTERRUPTS(void);
typedef unsigned xTaskHandle;
#endif /* defined(HOSTBUILD) */
void
vAssertCalled(const char * /* p_file */, unsigned int /* p_line */) {
taskDISABLE_INTERRUPTS();
for( ;; );
};
void
vApplicationStackOverflowHook(xTaskHandle pxTask, signed char *pcTaskName) {
(void) pcTaskName;
(void) pxTask;
PHISCH_LOG("STACK OVERFLOW in Task '%s'\r\n", pcTaskName);
/* 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. */
taskDISABLE_INTERRUPTS();
for( ;; );
}
void
vApplicationMallocFailedHook(void) {
/* vApplicationMallocFailedHook() will only be called if
configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h. It is a hook
function that will get called if a call to pvPortMalloc() fails.
pvPortMalloc() is called internally by the kernel whenever a task, queue,
timer or semaphore is created. It is also called by various parts of the
demo application. If heap_1.c or heap_2.c are used, then the size of the
heap available to pvPortMalloc() is defined by configTOTAL_HEAP_SIZE in
FreeRTOSConfig.h, and the xPortGetFreeHeapSize() API function can be used
to query the size of free heap space that remains (although it does not
provide information on how the remaining heap might be fragmented). */
taskDISABLE_INTERRUPTS();
for( ;; );
}
void
vApplicationIdleHook(void) {
/*
* From http://www.freertos.org/a00016.html (Sep 3rd, 2014):
*
* The idle task can optionally call an application defined hook (or callback)
* function - the idle hook. The idle task runs at the very lowest priority, so
* such an idle hook function will only get executed when there are no tasks of
* higher priority that are able to run. This makes the idle hook function an
* ideal place to put the processor into a low power state - providing an
* automatic power saving whenever there is no processing to be performed.
*
* The idle hook will only get called if configUSE_IDLE_HOOK is set to 1 within
* FreeRTOSConfig.h. When this is set the application must provide the hook
* function with the following prototype:
*
* void vApplicationIdleHook( void );
*
* The idle hook is called repeatedly as long as the idle task is running. It is
* paramount that the idle hook function does not call any API functions that
* could cause it to block. Also, if the application makes use of the
* vTaskDelete() API function then the idle task hook must be allowed to
* periodically return (this is because the idle task is responsible for
* cleaning up the resources that were allocated by the RTOS kernel to the task
* that has been deleted).
*/
}
void
vApplicationTickHook(void) {
/*
* From http://www.freertos.org/a00016.html (Sep 3rd, 2014):
*
* The tick interrupt can optionally call an application defined hook (or
* callback) function - the tick hook. The tick hook provides a convenient place
* to implement timer functionality.
*
* The tick hook will only get called if configUSE_TICK_HOOK is set to 1 within
* FreeRTOSConfig.h. When this is set the application must provide the hook
* function with the following prototype:
*
* void vApplicationTickHook( void );
*
* vApplicationTickHook() executes from within an ISR so must be very short, not
* use much stack, and not call any API functions that don't end in "FromISR" or
* "FROM_ISR".
*
* See the demo application file crhook.c for an example of how to use a tick
* hook.
*/
}
#if defined(HOSTBUILD)
void
vTaskDelete(void) {
}
void
vTaskStartScheduler(void) {
}
void
xTaskGenericNotifyFromISR(void) {
}
void
xTaskNotifyWait(void) {
}
#endif /* defined(HOSTBUILD) */
#if defined(__cplusplus)
} /* extern "C" */
#endif /* defined(__cplusplus) */