121 void (*pFunction) (
void* pStart);
161 static const char CpxVersionCode[]=
"2.7.0";
162 static const char CpxVersion[] =
"V2.7.0 from " __TIMESTAMP__;
171 bool Cpx_Start (
size_t nThreadPartitions);
195 bool Cpx_CreateThread (
void (*pFunction) (
void*),
void* pValue,
size_t nStackMaxSize, uint32_t nNice);
204 #define Cpx_GetStaticContextSize(nStaticThreadSize) (nStaticThreadSize >= sizeof (CpxThread) ? (nStaticThreadSize - sizeof (CpxThread)) : 0)
213 #define Cpx_GetStaticThreadSize(nStackMaxSize) (sizeof (CpxThread) + nStackMaxSize)
257 #define Cpx_Sleep(nDelayTickTime) \
259 Cpx_SetSleep (nDelayTickTime); \
294 #define Cpx_GetStackSize() Cpx_GetStackSizeByID (Cpx_GetID ())
308 #define Cpx_GetMaxStackSize() Cpx_GetMaxStackSizeByID (Cpx_GetID ())
327 #define Cpx_GetContexSize() (Cpx_GetContextSizeByID (Cpx_GetID ()))
341 #define Cpx_GetStatus() Cpx_GetStatusByID (Cpx_GetID ())
358 #define Cpx_GetNice() Cpx_GetNiceByID (Cpx_GetID ())
382 #define Cpx_GetLastMomentum() Cpx_GetLastMomentumByID (Cpx_GetID ())
399 #define Cpx_GetLastDutyCycle() Cpx_GetLastDutyCycleByID (Cpx_GetID ())
454 #define Cpx_IsThreadStatic() Cpx_IsThreadStaticByID (Cpx_GetID ())
473 #define Cpx_IsBrokerStatic() Cpx_IsThreadStaticByID (Cpx_GetID ())
498 #define Cpx_GetStaticBrokerSize(nMaxTopics) \
499 (sizeof (CpxSubscriptions) + (sizeof (uint32_t) * ((nMaxTopics <= 1) ? sizeof (uint32_t) : nMaxTopics - 1)))
504 #define Cpx_GetStaticBrokerMaxTopics(nStaticSubsSize) \
505 (nStaticSubsSize <= sizeof (CpxSubscriptions) ? 0 : ((nStaticSubsSize - sizeof (CpxSubscriptions)) / sizeof (uint32_t)) + 1)
545 bool Cpx_PublishTopic (
const char* pszTopic,
size_t length,
size_t nAttribute, uint64_t nValue);
581 bool Cpx_NotifyMessageOne (
const char* pszTag,
size_t nTagLength,
size_t nAttribute, uint64_t nValue);
607 bool Cpx_NotifyMessageAll (
const char* pszTag,
size_t nTagLength,
size_t nAttribute, uint64_t nValue);
617 bool Cpx_Wait (
const char* pszTag,
size_t nTagLength);
741 #define Cpx_NotifyVariableLockOne(nLockID, nStatus) Cpx_NotifyVariableLock (nLockID, nStatus, true)
752 #define Cpx_NotifyVariableLockAll(nLockID, nStatus) Cpx_NotifyVariableLock (nLockID, nStatus, false)
bool Cpx_IsSubscribed(const char *pszTopic, size_t length)
Check if the current thread already subscribe to a topic.
Definition: CorePartition.c:756
bool Cpx_Start(size_t nThreadPartitions)
Start CorePartition thread provisioning.
Definition: CorePartition.c:248
size_t Cpx_GetMaxNumberOfThreads(void)
Get Max Number of total active Threads.
Definition: CorePartition.c:638
size_t Cpx_GetStackSizeByID(size_t nID)
Get Current Thread ID.
Definition: CorePartition.c:581
__THREADL_TYPES
Definition: CorePartition.h:57
@ THREADL_STOPPED
Definition: CorePartition.h:62
@ THREADL_WAITTAG
Definition: CorePartition.h:64
@ THREADL_START
Definition: CorePartition.h:70
@ THREADL_SLEEP
Definition: CorePartition.h:73
@ THREADL_NONE
Definition: CorePartition.h:61
@ THREADL_RUNNING
Definition: CorePartition.h:69
@ THREADL_NOW
Definition: CorePartition.h:71
@ THREADL_LOCK
Definition: CorePartition.h:63
bool Cpx_SharedLock(CpxSmartLock *pLock)
Can act as multiple locks.
Definition: CorePartition.c:1104
bool Cpx_WaitVariableLock(void *nLockID, size_t *pnStatus)
Wait for a Variable Locks notification.
Definition: CorePartition.c:972
size_t Cpx_GetContextSizeByID(size_t nID)
Get Full context size (Contex + stack + Broker)
Definition: CorePartition.c:650
uint32_t Cpx_GetLastDutyCycleByID(size_t nID)
Last Duty Cycle of the current Thread.
Definition: CorePartition.c:610
uint8_t Cpx_GetStatusByID(size_t nID)
Get a thread status for a thread ID.
Definition: CorePartition.c:603
uint8_t CpxStaticBroker
Definition: CorePartition.h:153
size_t Cpx_GetNumberOfThreads(void)
Get Number of assigned Threads.
Definition: CorePartition.c:631
bool Cpx_Wait(const char *pszTag, size_t nTagLength)
Wait for a specific notification from a given TAG.
Definition: CorePartition.c:848
bool Cpx_Lock(CpxSmartLock *pLock)
Do a exclusive Lock and set to Simple lock.
Definition: CorePartition.c:1086
void(* TopicCallback)(void *pContext, const char *pszTopic, size_t nSize, CpxMsgPayload payLoad)
Definition: CorePartition.h:92
size_t Cpx_GetMaxStackSizeByID(size_t nID)
Get total size of stack context page for a Thread ID.
Definition: CorePartition.c:589
bool Cpx_StaticStart(CpxThread **ppStaticThread, size_t nStaticThreadSize)
Start CorePartition thread provisioning.
Definition: CorePartition.c:241
bool Cpx_IsBrokerStaticByID(size_t nID)
Return if a Thread's Broker interface was statically initiated.
Definition: CorePartition.c:683
bool Cpx_TryLock(CpxSmartLock *pLock)
Like Lock() but only locks in case it is unlocked.
Definition: CorePartition.c:1073
bool Cpx_EnableStaticBroker(void *pUserContext, CpxStaticBroker *pStaticBroker, size_t nStaticBrokerSize, TopicCallback callback)
Enable Broker for the current thread.
Definition: CorePartition.c:736
bool Cpx_PublishTopic(const char *pszTopic, size_t length, size_t nAttribute, uint64_t nValue)
Public a tuple Param and Value.
Definition: CorePartition.c:796
size_t Cpx_GetID(void)
Get Current Thread ID.
Definition: CorePartition.c:574
uint32_t Cpx_GetNiceByID(size_t nID)
Current Thread Nice.
Definition: CorePartition.c:596
void * Cpx_GetLockID(void)
Definition: CorePartition.c:1155
bool Cpx_WaitMessage(const char *pszTag, size_t nTagLength, CpxMsgPayload *payload)
Wait for a specific notification from a given TAG and payload.
Definition: CorePartition.c:826
void Cpx_SetNice(uint32_t nNice)
Set Current Thread Nice.
Definition: CorePartition.c:669
bool Cpx_Unlock(CpxSmartLock *pLock)
Unlock exclusive locks.
Definition: CorePartition.c:1136
void * Cpx_GetLockIDByID(size_t nID)
Definition: CorePartition.c:1162
uint8_t CpxStaticThread
Definition: CorePartition.h:152
char Cpx_IsSecureByID(size_t nID)
Return the Secure Status for a thread ID.
bool Cpx_NotifyAll(const char *pszTag, size_t nTagLength)
Notify ALL TAGs assigned as waiting thread.
Definition: CorePartition.c:940
size_t Cpx_GetStructContextSize(void)
Get Thread context size.
Definition: CorePartition.c:645
uint32_t Cpx_GetCurrentTick(void)
Definition: CorePartition.c:118
uint32_t Cpx_GetLastMomentumByID(size_t nID)
Get Current Thread last momentum on switch back.
Definition: CorePartition.c:617
size_t Cpx_WaitingVariableLock(void *nLockID)
Return how much threads are locked waiting for a variable notification.
Definition: CorePartition.c:1038
void Cpx_StackOverflowHandler(void)
Definition: CorePartition.c:135
bool Cpx_IsCoreRunning(void)
Report if there is any running thread.
Definition: CorePartition.c:146
bool Cpx_NotifyMessageOne(const char *pszTag, size_t nTagLength, size_t nAttribute, uint64_t nValue)
Notify ONE TAGs assigned as waiting thread with a Message payload.
Definition: CorePartition.c:927
bool Cpx_SharedUnlock(CpxSmartLock *pLock)
Unlock shared locks.
Definition: CorePartition.c:1119
size_t Cpx_GetNumberOfActiveThreads(void)
Get Number of total active Threads.
Definition: CorePartition.c:624
void Cpx_SleepTicks(uint32_t)
Definition: CorePartition.c:125
bool Cpx_IsThreadStaticByID(size_t nID)
Return if a Threads was statically initiated.
Definition: CorePartition.c:676
bool Cpx_SubscribeTopic(const char *pszTopic, size_t length)
Subscribe for a specific topic.
Definition: CorePartition.c:778
bool Cpx_CreateThread(void(*pFunction)(void *), void *pValue, size_t nStackMaxSize, uint32_t nNice)
Create a non-Isolated context Thread.
Definition: CorePartition.c:324
bool Cpx_CreateStaticThread(void(*pFunction)(void *), void *pValue, CpxStaticThread *pStaticThread, size_t nStaticThreadSize, uint32_t nNice)
Create a Thread using a static Context + virtual stack page.
Definition: CorePartition.c:329
void Cpx_Join(void)
This will start all the threads.
Definition: CorePartition.c:435
void Cpx_SetSleep(uint32_t nDelayTickTime)
Will set the thread sleep parameter before Yield.
Definition: CorePartition.c:559
bool Cpx_EnableBroker(void *pUserContext, uint16_t nMaxTopics, TopicCallback callback)
Enable Broker for the current thread.
Definition: CorePartition.c:744
uint8_t Cpx_Yield(void)
Function to be called inside a thread to change context.
Definition: CorePartition.c:520
bool Cpx_NotifyMessageAll(const char *pszTag, size_t nTagLength, size_t nAttribute, uint64_t nValue)
Notify ALL TAGs assigned as waiting thread with a Message payload.
Definition: CorePartition.c:953
size_t Cpx_NotifyVariableLock(void *nLockID, size_t nStatus, bool bOneOnly)
Notify all/one Variable lock waiting for notification.
Definition: CorePartition.c:1003
bool Cpx_NotifyOne(const char *pszTag, size_t nTagLength)
Notify ONE TAG assigned as waiting thread.
Definition: CorePartition.c:914
bool Cpx_LockInit(CpxSmartLock *pLock)
Init SmartLock variable.
Definition: CorePartition.c:1063
Definition: CorePartition.h:77
size_t nThreadID
Definition: CorePartition.h:78
size_t nAttribute
Definition: CorePartition.h:79
uint64_t nValue
Definition: CorePartition.h:80
Definition: CorePartition.h:84
size_t nSharedLockCount
Definition: CorePartition.h:85
bool bExclusiveLock
Definition: CorePartition.h:86
Definition: CorePartition.h:99
uint16_t nTopicCount
Definition: CorePartition.h:103
void * pContext
Definition: CorePartition.h:101
TopicCallback callback
Definition: CorePartition.h:100
uint16_t nMaxTopics
Definition: CorePartition.h:102
uint32_t nTopicList
Definition: CorePartition.h:104
Definition: CorePartition.h:111
void * pValue
Definition: CorePartition.h:122
uint8_t nThreadController
Definition: CorePartition.h:146
void * pnVariableLockID
Definition: CorePartition.h:142
uint32_t nLastMomentun
Definition: CorePartition.h:130
uint32_t nNice
Definition: CorePartition.h:129
jmp_buf jmpRegisterBuffer
Definition: CorePartition.h:117
uint32_t nSleepTime
Definition: CorePartition.h:141
uint32_t nNotifyUID
Definition: CorePartition.h:137
CpxSubscriptions * pSubscriptions
Definition: CorePartition.h:113
CpxMsgPayload payload
Definition: CorePartition.h:143
size_t nStackMaxSize
Definition: CorePartition.h:126
uint8_t nStatus
Definition: CorePartition.h:147
uint32_t nExecTime
Definition: CorePartition.h:131
size_t nStackSize
Definition: CorePartition.h:127
uint8_t stackPage
Definition: CorePartition.h:148
void * pLastStack
Definition: CorePartition.h:112