Line data Source code
1 : /********************************************************************************
2 : * Copyright (c) 2024 Accenture
3 : *
4 : * This program and the accompanying materials are made available under the
5 : * terms of the Apache License Version 2.0 which is available at
6 : * https://www.apache.org/licenses/LICENSE-2.0
7 : *
8 : * SPDX-License-Identifier: Apache-2.0
9 : ********************************************************************************/
10 :
11 : #include "async/Hook.h"
12 :
13 : #include "FreeRTOSConfig.h"
14 : #include "async/AsyncBinding.h"
15 : #include "freertos_tasks_c_additions.h"
16 :
17 : namespace
18 : {
19 : using AdapterType = ::async::AsyncBindingType::AdapterType;
20 : using ContextHookType = ::async::AsyncBindingType::ContextHookType;
21 : } // namespace
22 :
23 : extern "C"
24 : {
25 1 : void asyncInitialized() { AdapterType::runningHook(); }
26 :
27 0 : void const* asyncGetTaskConfig(size_t const taskIdx) { return AdapterType::getTaskConfig(taskIdx); }
28 :
29 1 : void asyncEnterTask(size_t const taskIdx) { ContextHookType::enterTask(taskIdx); }
30 :
31 1 : void asyncLeaveTask(size_t const taskIdx) { ContextHookType::leaveTask(taskIdx); }
32 :
33 1 : void asyncEnterIsrGroup(size_t const isrGroupIdx)
34 : {
35 1 : AdapterType::enterIsr();
36 1 : ContextHookType::enterIsrGroup(isrGroupIdx);
37 1 : }
38 :
39 1 : void asyncLeaveIsrGroup(size_t const isrGroupIdx)
40 : {
41 1 : ContextHookType::leaveIsrGroup(isrGroupIdx);
42 1 : AdapterType::leaveIsr();
43 1 : }
44 :
45 : #if ASYNC_CONFIG_TICK_HOOK
46 2 : uint32_t asyncTickHook()
47 : {
48 2 : AdapterType::enterIsr();
49 2 : ::async::AsyncBindingType::TickHookType::handleTick();
50 2 : return AdapterType::leaveIsrNoYield() ? 1U : 0U;
51 : }
52 : #endif // ASYNC_CONFIG_TICK_HOOK
53 :
54 : } // extern "C"
|