openocd: fix SPDX tag format for files .c
[fw/openocd] / contrib / rtos-helpers / uCOS-III-openocd.c
1 // SPDX-License-Identifier: GPL-2.0-or-later
2
3 /*
4  * uC/OS-III does not provide a fixed layout for OS_TCB, which makes it
5  * impossible to determine the appropriate offsets within the structure
6  * unaided. A priori knowledge of offsets based on os_dbg.c is tied to a
7  * specific release and thusly, brittle. The constants defined below
8  * provide the necessary information OpenOCD needs to provide support in
9  * the most robust manner possible.
10  *
11  * This file should be linked along with the project to enable RTOS
12  * support for uC/OS-III.
13  */
14
15 #include <os.h>
16
17 #if OS_CFG_DBG_EN == 0
18 #error "OS_CFG_DBG_EN is required to enable RTOS support for OpenOCD"
19 #endif
20
21 #define OFFSET_OF(type, member) ((CPU_SIZE_T)&(((type *)0)->member))
22
23 #ifdef __GNUC__
24 #define USED __attribute__((used))
25 #else
26 #define USED
27 #endif
28
29 const CPU_SIZE_T USED openocd_OS_TCB_StkPtr_offset = OFFSET_OF(OS_TCB, StkPtr);
30 const CPU_SIZE_T USED openocd_OS_TCB_NamePtr_offset = OFFSET_OF(OS_TCB, NamePtr);
31 const CPU_SIZE_T USED openocd_OS_TCB_TaskState_offset = OFFSET_OF(OS_TCB, TaskState);
32 const CPU_SIZE_T USED openocd_OS_TCB_Prio_offset = OFFSET_OF(OS_TCB, Prio);
33 const CPU_SIZE_T USED openocd_OS_TCB_DbgPrevPtr_offset = OFFSET_OF(OS_TCB, DbgPrevPtr);
34 const CPU_SIZE_T USED openocd_OS_TCB_DbgNextPtr_offset = OFFSET_OF(OS_TCB, DbgNextPtr);