Choco OS  V.0.16.9.0
Join to the chocolate world
oc_thread.h
Go to the documentation of this file.
1 
28 #ifndef INC_KERNEL_OC_THREAD_H_
29 #define INC_KERNEL_OC_THREAD_H_
30 
31 #include <stdbool.h>
32 #include <stdint.h>
33 #include <oc_ktime.h>
34 #include <oc_memman.h>
35 #include <oc_list.h>
36 #include <oc_memory.h>
37 
43 #define _________________________________________TYPES_SECTION______________________________________________________________________________
44 
47 typedef struct Thread_t * oC_Thread_t;
48 
49 typedef uint32_t oC_Thread_Priority_t;
50 
51 typedef void (*oC_Thread_Function_t)( void * UserParameter );
52 
53 typedef enum
54 {
55  oC_Thread_Unblock_WhenEqual ,
56  oC_Thread_Unblock_WhenNotEqual ,
57  oC_Thread_Unblock_WhenSmaller ,
58  oC_Thread_Unblock_WhenGreater ,
59  oC_Thread_Unblock_WhenSmallerOrEqual ,
60  oC_Thread_Unblock_WhenGreaterOrEqual
61 } oC_Thread_Unblock_t;
62 
63 typedef enum
64 {
65  oC_Thread_UnblockMask_None = 0 ,
66  oC_Thread_UnblockMask_All = 0xFFFFFFFFULL
67 }oC_Thread_UnblockMask_t;
68 
69 typedef bool (*oC_Thread_RevertFunction_t)( oC_Thread_t Thread , void * Object , uint32_t Parameter );
70 typedef void (*oC_Thread_FinishedFunction_t)( oC_Thread_t Thread , void * Parameter );
71 
72 #undef _________________________________________TYPES_SECTION______________________________________________________________________________
73 
80 #define _________________________________________FUNCTIONS_SECTION__________________________________________________________________________
81 
84 extern oC_Thread_t oC_Thread_New ( oC_Thread_Priority_t Priority , oC_Int_t StackSize , void * Process , const char * Name , oC_Thread_Function_t Function , void * Parameter );
85 extern bool oC_Thread_IsOwnedByStack ( oC_Thread_t Thread , const void * Address , bool * outAddressInRedZone );
86 extern oC_Thread_t oC_Thread_CloneWithNewStack ( oC_Thread_t Thread , oC_MemorySize_t NewStackSize );
87 extern bool oC_Thread_Delete ( oC_Thread_t * Thread );
88 extern bool oC_Thread_IsCorrect ( oC_Thread_t Thread );
89 extern bool oC_Thread_IsActive ( oC_Thread_t Thread );
90 extern bool oC_Thread_SetBlocked ( oC_Thread_t Thread , uint32_t * BlockingFlag , oC_Thread_Unblock_t Unblock , uint32_t StateToUnblock , oC_Thread_UnblockMask_t UnblockMask , oC_Time_t Timeout );
91 extern bool oC_Thread_SetUnblocked ( oC_Thread_t Thread );
92 extern bool oC_Thread_IsBlocked ( oC_Thread_t Thread );
93 extern bool oC_Thread_IsBlockedBy ( oC_Thread_t Thread , uint32_t * BlockingFlag );
94 extern bool oC_Thread_Run ( oC_Thread_t Thread );
95 extern bool oC_Thread_Cancel ( oC_Thread_t * Thread );
96 extern void * oC_Thread_GetContext ( oC_Thread_t Thread );
97 extern oC_Thread_Priority_t oC_Thread_GetPriority ( oC_Thread_t Thread );
98 extern void * oC_Thread_GetParameter ( oC_Thread_t Thread );
99 extern const char * oC_Thread_GetName ( oC_Thread_t Thread );
100 extern bool oC_Thread_Sleep ( oC_Thread_t Thread , oC_Time_t Time );
101 extern oC_Time_t oC_Thread_GetExecutionTime ( oC_Thread_t Thread );
102 extern bool oC_Thread_AddToExecutionTime( oC_Thread_t Thread , oC_Time_t Time );
103 extern uint64_t oC_Thread_GetLastExecutionTick(oC_Thread_t Thread );
104 extern bool oC_Thread_SetLastExecutionTick(oC_Thread_t Thread , uint64_t Tick );
105 extern oC_UInt_t oC_Thread_GetStackSize ( oC_Thread_t Thread );
106 extern oC_Int_t oC_Thread_GetFreeStackSize ( oC_Thread_t Thread , bool Current );
107 extern bool oC_Thread_SaveToRevert ( oC_Thread_t Thread , oC_Thread_RevertFunction_t Function, void * Object , uint32_t Parameter );
108 extern bool oC_Thread_RemoveFromRevert ( oC_Thread_t Thread , oC_Thread_RevertFunction_t Function, void * Object );
109 extern bool oC_Thread_SetFinishedFunction( oC_Thread_t Thread , oC_Thread_FinishedFunction_t Function, void * Parameter );
110 
111 #undef _________________________________________FUNCTIONS_SECTION__________________________________________________________________________
112 
114 #endif /* INC_KERNEL_OC_THREAD_H_ */
The file with interface for the GPIO driver.
oC_Int_t StackSize
!< Tick of last execution
Definition: oc_thread.c:79
oC_Process_t Process
!< Control value for checking if object is correct
Definition: oc_thread.c:63
oC_Thread_Unblock_t Unblock
!< Mask with bits important for unblocking
Definition: oc_thread.c:75
The file with list library.
uint32_t StateToUnblock
!< Reference to the flag of the blocked context
Definition: oc_thread.c:73
oC_Thread_Function_t Function
!< Size of the stack
Definition: oc_thread.c:80
oC_Thread_Priority_t Priority
!< Process owner
Definition: oc_thread.c:64
The file with memory manager interface.
void * Parameter
!< Main function to execute
Definition: oc_thread.c:81
bool oC_Thread_IsOwnedByStack(oC_Thread_t Thread, const void *Address, bool *outAddressInRedZone)
checks if the given address is owned by the thread stack
Definition: oc_thread.c:272
uint32_t UnblockMask
!< State to unblock thread
Definition: oc_thread.c:74
const char * Name
!< Priority of this thread
Definition: oc_thread.c:65
The file with interface of kernel time module.