1 // Copyright 2015-2021 Espressif Systems (Shanghai) PTE LTD
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #pragma once
16 
17 /**
18  * This file will be included in `tasks.c` file, thus, it must NOT be included
19  * by any (other) file.
20  * The functions below only consist in getters for the static variables in
21  * `tasks.c` file.
22  * The only source files that should call these functions are the ones in
23  * `/additions` directory.
24  */
25 
26 #if ( configENABLE_TASK_SNAPSHOT == 1 )
27 
pxTCBGetSize(void)28 	UBaseType_t pxTCBGetSize ( void )
29 	{
30 		return sizeof(TCB_t);
31 	}
32 
pxTCBGetStateListItem(void * pxTCB)33 	ListItem_t*	pxTCBGetStateListItem ( void *pxTCB )
34 	{
35 		return &(((TCB_t*)pxTCB)->xStateListItem);
36 	}
37 
pxTCBGetStartOfStack(void * pxTCB)38 	StackType_t* pxTCBGetStartOfStack ( void *pxTCB )
39 	{
40 		return (StackType_t*) ((TCB_t*)pxTCB)->pxStack;
41 	}
42 
pxTCBGetTopOfStack(void * pxTCB)43 	StackType_t* pxTCBGetTopOfStack ( void *pxTCB )
44 	{
45 		return (StackType_t*) ((TCB_t*)pxTCB)->pxTopOfStack;
46 	}
47 
pxTCBGetEndOfStack(void * pxTCB)48 	StackType_t* pxTCBGetEndOfStack ( void *pxTCB )
49 	{
50 		return (StackType_t*) ((TCB_t*)pxTCB)->pxEndOfStack;
51 	}
52 
53 
pxListGetReadyTask(UBaseType_t idx)54 	List_t* pxListGetReadyTask ( UBaseType_t idx )
55 	{
56 		return &( pxReadyTasksLists[idx] );
57 	}
58 
pxListGetReadyPendingTask(UBaseType_t idx)59 	List_t* pxListGetReadyPendingTask ( UBaseType_t idx )
60 	{
61 		return &( xPendingReadyList[idx] );
62 	}
63 
pxGetDelayedTaskList(void)64 	List_t* pxGetDelayedTaskList ( void ) {
65 		return pxDelayedTaskList;
66 	}
67 
pxGetOverflowDelayedTaskList(void)68 	List_t* pxGetOverflowDelayedTaskList ( void ) {
69 		return pxOverflowDelayedTaskList;
70 	}
71 
pxGetTasksWaitingTermination(void)72 	List_t* pxGetTasksWaitingTermination ( void ) {
73 		return &xTasksWaitingTermination;
74 	}
75 
pxGetSuspendedTaskList(void)76 	List_t* pxGetSuspendedTaskList ( void ) {
77 		return &xSuspendedTaskList;
78 	}
79 
80 #endif
81