Line data Source code
1 : // Copyright 2024 Accenture.
2 :
3 : #include "async/Hook.h"
4 :
5 : #include "FreeRTOSConfig.h"
6 : #include "async/AsyncBinding.h"
7 : #include "freertos_tasks_c_additions.h"
8 :
9 : namespace
10 : {
11 : using AdapterType = ::async::AsyncBindingType::AdapterType;
12 : using ContextHookType = ::async::AsyncBindingType::ContextHookType;
13 : } // namespace
14 :
15 : extern "C"
16 : {
17 1 : void asyncInitialized() { AdapterType::runningHook(); }
18 :
19 0 : void const* asyncGetTaskConfig(size_t const taskIdx) { return AdapterType::getTaskConfig(taskIdx); }
20 :
21 1 : void asyncEnterTask(size_t const taskIdx) { ContextHookType::enterTask(taskIdx); }
22 :
23 1 : void asyncLeaveTask(size_t const taskIdx) { ContextHookType::leaveTask(taskIdx); }
24 :
25 1 : void asyncEnterIsrGroup(size_t const isrGroupIdx)
26 : {
27 1 : AdapterType::enterIsr();
28 1 : ContextHookType::enterIsrGroup(isrGroupIdx);
29 1 : }
30 :
31 1 : void asyncLeaveIsrGroup(size_t const isrGroupIdx)
32 : {
33 1 : ContextHookType::leaveIsrGroup(isrGroupIdx);
34 1 : AdapterType::leaveIsr();
35 1 : }
36 :
37 : #if ASYNC_CONFIG_TICK_HOOK
38 2 : uint32_t asyncTickHook()
39 : {
40 2 : AdapterType::enterIsr();
41 2 : ::async::AsyncBindingType::TickHookType::handleTick();
42 2 : return AdapterType::leaveIsrNoYield() ? 1U : 0U;
43 : }
44 : #endif // ASYNC_CONFIG_TICK_HOOK
45 :
46 : } // extern "C"
|