INOS
|
Public Types | |
enum | EState { eStaIdle = 0 , eStaSetup = 1 , eStaReady = 2 , eStaShutdown = 3 } |
enum | { eCnsGroupIdBits = 2 } |
enum | { eOptNone = 0x00000000 , eOptCategoryDc = 0x000000001 , eOptException = 0x000000002 , eOptExceptionEx = eOptNone } |
enum | { eFlgNone = 0x00000000 , eFlgDelete = 0x000000001 , eFlgNegative = 0x000000002 , eFlgPositive = 0x000000004 } |
enum | { eDcOrder = 20 , eDcCategory = 0xff , eDcCycletime = 0xffffffff , eDcCyclenumber = 0xff , eDcCoreId = 0x3f } |
Public Member Functions | |
CINOSBusHooks (uint8 auGroupId=0) | |
Create bus hooks handler. | |
~CINOSBusHooks () | |
Destroy bus hooks handler. | |
EState | GetState () |
Get hooks handler state. | |
uint32 | Setup (uint8 auCores=1, uint8 auCoreId=0, uint32 auOptions=eOptNone) |
Setup hooks handler with the given number of cores. | |
uint32 | SetupCore (uint8 auCoreId, uint8 auCategories) |
Setup hook core handler. | |
uint32 | SetupCategory (uint8 auCoreId, uint8 auCategory, uint32 auCycletimeNs, uint32 auFlags=CINOSBusHookCategory::eFlgEnabled) |
Setup hook category of given core handler. | |
uint32 | SetupDone (uint16 auHooks) |
Finalysing hooks handler setup with given max. number of hooks. | |
uint32 | Shutdown () |
Shutdown hooks handler. | |
uint32 | EnableCategory (uint8 auCategory) |
Enable given category of all cores. | |
uint32 | EnableCategory (uint8 auCoreId, uint8 auCategory) |
Enable given category of given core. | |
uint32 | DisableCategory (uint8 auCategory) |
Disable given category of all cores. | |
uint32 | DisableCategory (uint8 auCoreId, uint8 auCategory) |
Disable given category of given core. | |
uint32 | RegisterHook (uintid &aoHookId, void *apHandler, CINOSBusHook::EFlags auFlags=CINOSBusHook::eFlgEnabled) |
Register a hook with the given parameters. | |
uint32 | RegisterHook (uintid &aoHookId, void *apHandler, void *apObject, CINOSBusHook::EFlags auFlags=CINOSBusHook::eFlgEnabled) |
Register a hook with the given parameters. | |
uint32 | RegisterHook (uintid &aoHookId, void *apHandler, void *apObject, int32 aiOrder, CINOSBusHook::EFlags auFlags=CINOSBusHook::eFlgEnabled) |
Register a hook with the given parameters. | |
uint32 | RegisterHook (uintid &aoHookId, void *apHandler, void *apObject, int32 aiOrder, uint8 auCategory, CINOSBusHook::EFlags auFlags=CINOSBusHook::eFlgEnabled) |
Register a hook with the given parameters. | |
uint32 | RegisterHook (uintid &aoHookId, void *apHandler, void *apObject, int32 aiOrder, uint8 auCategory, uint32 auCycletime, CINOSBusHook::EFlags auFlags=CINOSBusHook::eFlgEnabled) |
Register a hook with the given parameters. | |
uint32 | RegisterHook (uintid &aoHookId, void *apHandler, void *apObject, int32 aiOrder, uint8 auCategory, uint32 auCycletime, uint8 auCyclenumber, CINOSBusHook::EFlags auFlags=CINOSBusHook::eFlgEnabled) |
Register a hook with the given parameters. | |
uint32 | RegisterHook (uintid &aoHookId, void *apHandler, void *apObject, int32 aiOrder, uint8 auCategory, uint32 auCycletime, uint8 auCyclenumber, uint8 auCoreId, CINOSBusHook::EFlags auFlags=CINOSBusHook::eFlgEnabled) |
Register a hook with the given parameters. | |
uint32 | RegisterHook (CINOSBusHook *apHook) |
Register given hook. | |
uint32 | UnregisterHook (uintid auHookId) |
Unregister given hook. | |
uint32 | UnregisterHook (CINOSBusHook *apHook, uint32 auFlags=eFlgNone) |
Unregister given hook. | |
uint32 | EnableHook (uintid auHookId) |
Enable given hook. | |
uint32 | DisableHook (uintid auHookId) |
Disable given hook. | |
void * | GetHookHandler (uintid auHookId) |
Get hook handler. | |
uint32 | SetHookHandler (uintid auHookId, void *apHandler) |
Set hook handler. | |
uint8 | GetHookCyclenumber (uintid auHookId) |
Get hook cycle number. | |
uint32 | GetHookCycleTime (uintid auHookId) |
Get hook cycle time. | |
uint32 | GetHookCycleTime (uintid auHookId, uint32 &auCycletime) |
Get hook cycle time. | |
uint32 | GetHookCategory (uintid auHookId, uint8 &auCategory) |
Get hook category. | |
uint32 | MoveHooks (uint8 auCoreId, uint8 auSrc, uint8 auDst) |
Move all hooks of given core from one category to an other. | |
uint32 | HandleHooks (uint8 auCategory=0, uint8 auCycle=0, uint32 auFlags=eFlgNone) |
Call all hook handlers of the given category and cycle assigned to the actual core id. | |
Static Public Member Functions | |
static uint32 | GetGroupId (uintid auHookId) |
Get group id from hook id. | |
Protected Member Functions | |
uint32 | RequestId (uintid &aoHookId) |
Request a hook id. | |
uint32 | ReleaseId (uintid auHookId) |
Release given hook id. | |
uint32 | GetIndex (uintid auHookId) |
Return hook index from given hook id. | |
bool | HasHooks (uint32 auNumber) |
Check whether the given number of hooks are still available. | |
uint32 | iHookCheck (void *apHandler, void *apObject, int32 &aiOrder, uint8 &auCategory, uint32 &auCycletime, uint8 &auCyclenumber, uint8 &auCoreId) |
Check if the given hook parameters are valid. | |
uint32 | iHookIdCheck (uintid auHookId, CINOSBusHook *&apHook) |
Check if the given hook id is valid. | |
uint32 | iHookRegister (CINOSBusHook *apHook) |
Internal register given hook. | |
SINOSBusHookNode * | AllocNode () |
Allocate a hook node. | |
void | FreeNode (SINOSBusHookNode *apNode) |
Free given hook node. | |
void | FreeNodes (SINOSBusHookNode *apNode) |
Free list of hook nodes. | |
SINOSBusHookNode * | ListGet (SINOSBusHookNode **apHead) |
Atomically detach list from given head and set head = nullptr. | |
bool | ListSet (SINOSBusHookNode **apHead, SINOSBusHookNode *apList) |
Atomically try to set head of list. | |
void | ListInsert (SINOSBusHookNode *&apHead, SINOSBusHookNode *apNode) |
Insert node into list in ascending order. | |
void | ListDestroy (SINOSBusHookNode **apHead) |
Destroy given nodes list. | |
DECLARE_DYNAMIC (CINOSBusHooks) | |
Protected Attributes | |
EState | m_eState = eStaIdle |
uint32 | m_uOptions = eOptNone |
uint8 | m_uGroupId {} |
uint32 | m_uHookIndexMask {} |
uint32 | m_uHookIdShift {} |
std::atomic< uint32 > | m_uHookIdCnt = {1} |
uint32 | m_uHooksActive {} |
uint32 * | m_pHooksActive {} |
uint32 | m_uHooksMax {} |
std::atomic< int32 > | m_uHooksAct = {0} |
CINOSBusHook ** | m_pHooks {} |
uint8 | m_uCoreIdBase {} |
uint8 | m_uCores {} |
CINOSBusHookCore * | m_pCores {} |
uint32 | m_uCycletimeSlowest {1000000} |
std::atomic< uint32 > | m_uNodesMax = {0} |
std::atomic< int32 > | m_iNodesAct = {0} |
SINOSBusHookNode * | m_pNodes {} |
CINCOObject * | m_pRegister {} |
class CINCOBusHooksMain * | m_pInco {} |
Static Protected Attributes | |
static class CINOSBusHooksHelper * | m_pInstance [DF_INOS_MAX_CORES] |
Friends | |
class | CINOS1ms |
class | CINOSBus |
class | CINOSBusHookCycle |
class | CINOSBusHookExTest |
class | CINCOBusHooksMain |
class | CINCOBusHooks |
class | CINOSHwTarget |
CINOSBusHooks::CINOSBusHooks | ( | uint8 | auGroupId = 0 | ) |
Create bus hooks handler.
[in] | auGroupId | User group id (0..3, marker for all hookid's of this instance) |
|
inlineprotected |
Allocate a hook node.
uint32 CINOSBusHooks::DisableCategory | ( | uint8 | auCategory | ) |
Disable given category of all cores.
[in] | auHookId | Id of hook to be disabled |
uint32 CINOSBusHooks::DisableCategory | ( | uint8 | auCoreId, |
uint8 | auCategory | ||
) |
Disable given category of given core.
[in] | auCoreId | Requested core |
[in] | auHookId | Id of hook to be disabled |
uint32 CINOSBusHooks::DisableHook | ( | uintid | auHookId | ) |
Disable given hook.
[in] | auHookId | Id of hook to be disabled |
uint32 CINOSBusHooks::EnableCategory | ( | uint8 | auCategory | ) |
Enable given category of all cores.
[in] | auCategory | Category to be enabled |
uint32 CINOSBusHooks::EnableCategory | ( | uint8 | auCoreId, |
uint8 | auCategory | ||
) |
Enable given category of given core.
[in] | auCoreId | Requested core |
[in] | auCategory | Category to be enabled |
uint32 CINOSBusHooks::EnableHook | ( | uintid | auHookId | ) |
Enable given hook.
[in] | auHookId | Id of hook to be enabled |
|
inlineprotected |
Free given hook node.
[in] | apNode | Pointer to hook node to be freed |
|
inlineprotected |
Free list of hook nodes.
[in] | apNode | Pointer to list of nodes to be freed |
|
inlinestatic |
Get group id from hook id.
[in] | auHookId | Id of requested hook. |
uint32 CINOSBusHooks::GetHookCategory | ( | uintid | auHookId, |
uint8 & | auCategory | ||
) |
Get hook category.
[in] | auHookId | Id of requested hook. |
[out] | auCategory | Category of hook. |
uint8 CINOSBusHooks::GetHookCyclenumber | ( | uintid | auHookId | ) |
Get hook cycle number.
[in] | auHookId | Id of requested hook |
uint32 CINOSBusHooks::GetHookCycleTime | ( | uintid | auHookId | ) |
Get hook cycle time.
[in] | auHookId | Id of requested hook. |
uint32 CINOSBusHooks::GetHookCycleTime | ( | uintid | auHookId, |
uint32 & | auCycletime | ||
) |
Get hook cycle time.
[in] | auHookId | Id of requested hook. |
[out] | auCycletime | Cycletime of hook. |
void * CINOSBusHooks::GetHookHandler | ( | uintid | auHookId | ) |
Get hook handler.
[in] | auHookId | Id of requested hook |
|
inlineprotected |
Return hook index from given hook id.
[in] | auHookI | Id of hook |
|
inline |
Get hooks handler state.
uint32 CINOSBusHooks::HandleHooks | ( | uint8 | auCategory = 0 , |
uint8 | auCycle = 0 , |
||
uint32 | auFlags = eFlgNone |
||
) |
Call all hook handlers of the given category and cycle assigned to the actual core id.
[in] | auCategory | Requested category |
[in] | auCycle | Requested cycle number |
[in] | auFlags | Additional flags (e.g. eFlgPositive) |
|
inlineprotected |
Check whether the given number of hooks are still available.
[in] | auNumber | Min. number of hooks available |
|
protected |
Check if the given hook parameters are valid.
[in] | apHandler | Pointer to function to be called |
[in] | apObject | Pointer to object instance if apHandler is a class method |
[in] | aiOrder | Requested order, see DF_INOS_BUS_HOOK_ORDER_DEFAULT |
[in] | auCategory | Requested category |
[in] | auCycletime | Requested cycle time |
[in] | auCyclenumber | Requested cycle number |
[in] | auCoreId | Requested core id |
|
protected |
Check if the given hook id is valid.
[in] | auHookId | Id to be checked |
[out] | apHook | Pointer to hook or nullptr if id invalid |
|
protected |
Internal register given hook.
[in] | apHook | Pointer to hook to be registered |
|
protected |
Destroy given nodes list.
[in] | apNode | Pointer to head of list |
|
protected |
Atomically detach list from given head and set head = nullptr.
[in] | apNode | Pointer to head of list |
|
protected |
Insert node into list in ascending order.
[in] | apHead | Pointer to head of list |
[in] | apNode | Pointer to node to be inserted |
|
protected |
Atomically try to set head of list.
[in] | apHead | Pointer to head of list |
[in] | apList | Pointer to head of list to be set |
uint32 CINOSBusHooks::MoveHooks | ( | uint8 | auCoreId, |
uint8 | auSrc, | ||
uint8 | auDst | ||
) |
Move all hooks of given core from one category to an other.
IMPORTANT: The system relies on the fact, that during the move, the hooks of the given categories are not touched (neither registered nor unregistered). Doing so anyway will end up in undefined behaviour!
[in] | auCoreId | Requested core id |
[in] | auSrc | Source category number |
[in] | auDst | Destination category number |
uint32 CINOSBusHooks::RegisterHook | ( | CINOSBusHook * | apHook | ) |
Register given hook.
[in] | apHook | Pointer to hook to be registered |
uint32 CINOSBusHooks::RegisterHook | ( | uintid & | aoHookId, |
void * | apHandler, | ||
CINOSBusHook::EFlags | auFlags = CINOSBusHook::eFlgEnabled |
||
) |
Register a hook with the given parameters.
[out] | aoHookId | Id of registered hook |
[in] | apHandler | Pointer to function to be called |
[in] | auFlags | Requested hook flags (e.g. CINOSBusHook::eFlgEnabled, CINOSBusHook::eFlgSingle) |
uint32 CINOSBusHooks::RegisterHook | ( | uintid & | aoHookId, |
void * | apHandler, | ||
void * | apObject, | ||
CINOSBusHook::EFlags | auFlags = CINOSBusHook::eFlgEnabled |
||
) |
Register a hook with the given parameters.
[out] | aoHookId | Id of registered hook |
[in] | apHandler | Pointer to function to be called |
[in] | apObject | Pointer to object instance if apHandler is a class method |
[in] | auFlags | Requested hook flags (e.g. CINOSBusHook::eFlgEnabled, CINOSBusHook::eFlgSingle) |
uint32 CINOSBusHooks::RegisterHook | ( | uintid & | aoHookId, |
void * | apHandler, | ||
void * | apObject, | ||
int32 | aiOrder, | ||
CINOSBusHook::EFlags | auFlags = CINOSBusHook::eFlgEnabled |
||
) |
Register a hook with the given parameters.
[out] | aoHookId | Id of registered hook |
[in] | apHandler | Pointer to function to be called |
[in] | apObject | Pointer to object instance if apHandler is a class method |
[in] | aiOrder | Requested order, see DF_INOS_BUS_HOOK_ORDER_DEFAULT |
[in] | auFlags | Requested hook flags (e.g. CINOSBusHook::eFlgEnabled, CINOSBusHook::eFlgSingle) |
uint32 CINOSBusHooks::RegisterHook | ( | uintid & | aoHookId, |
void * | apHandler, | ||
void * | apObject, | ||
int32 | aiOrder, | ||
uint8 | auCategory, | ||
CINOSBusHook::EFlags | auFlags = CINOSBusHook::eFlgEnabled |
||
) |
Register a hook with the given parameters.
[out] | aoHookId | Id of registered hook |
[in] | apHandler | Pointer to function to be called |
[in] | apObject | Pointer to object instance if apHandler is a class method |
[in] | aiOrder | Requested order, see DF_INOS_BUS_HOOK_ORDER_DEFAULT |
[in] | auCategory | Requested category |
[in] | auFlags | Requested hook flags (e.g. CINOSBusHook::eFlgEnabled, CINOSBusHook::eFlgSingle) |
uint32 CINOSBusHooks::RegisterHook | ( | uintid & | aoHookId, |
void * | apHandler, | ||
void * | apObject, | ||
int32 | aiOrder, | ||
uint8 | auCategory, | ||
uint32 | auCycletime, | ||
CINOSBusHook::EFlags | auFlags = CINOSBusHook::eFlgEnabled |
||
) |
Register a hook with the given parameters.
[out] | aoHookId | Id of registered hook |
[in] | apHandler | Pointer to function to be called |
[in] | apObject | Pointer to object instance if apHandler is a class method |
[in] | aiOrder | Requested order, see DF_INOS_BUS_HOOK_ORDER_DEFAULT |
[in] | auCategory | Requested category |
[in] | auCycletime | Requested cycle time |
[in] | auFlags | Requested hook flags (e.g. CINOSBusHook::eFlgEnabled, CINOSBusHook::eFlgSingle) |
uint32 CINOSBusHooks::RegisterHook | ( | uintid & | aoHookId, |
void * | apHandler, | ||
void * | apObject, | ||
int32 | aiOrder, | ||
uint8 | auCategory, | ||
uint32 | auCycletime, | ||
uint8 | auCyclenumber, | ||
CINOSBusHook::EFlags | auFlags = CINOSBusHook::eFlgEnabled |
||
) |
Register a hook with the given parameters.
[out] | aoHookId | Id of registered hook |
[in] | apHandler | Pointer to function to be called |
[in] | apObject | Pointer to object instance if apHandler is a class method |
[in] | aiOrder | Requested order, see DF_INOS_BUS_HOOK_ORDER_DEFAULT |
[in] | auCategory | Requested category |
[in] | auCycletime | Requested cycle time |
[in] | auCyclenumber | Requested cycle number |
[in] | auFlags | Requested hook flags (e.g. CINOSBusHook::eFlgEnabled, CINOSBusHook::eFlgSingle) |
uint32 CINOSBusHooks::RegisterHook | ( | uintid & | aoHookId, |
void * | apHandler, | ||
void * | apObject, | ||
int32 | aiOrder, | ||
uint8 | auCategory, | ||
uint32 | auCycletime, | ||
uint8 | auCyclenumber, | ||
uint8 | auCoreId, | ||
CINOSBusHook::EFlags | auFlags = CINOSBusHook::eFlgEnabled |
||
) |
Register a hook with the given parameters.
[out] | aoHookId | Id of registered hook |
[in] | apHandler | Pointer to function to be called |
[in] | apObject | Pointer to object instance if apHandler is a class method |
[in] | aiOrder | Requested order, see DF_INOS_BUS_HOOK_ORDER_DEFAULT |
[in] | auCategory | Requested category |
[in] | auCycletime | Requested cycle time |
[in] | auCyclenumber | Requested cycle number |
[in] | auCoreId | Requested core id |
[in] | auFlags | Requested hook flags (e.g. CINOSBusHook::eFlgEnabled, CINOSBusHook::eFlgSingle) |
|
protected |
Release given hook id.
[in] | auHookId | Id to be released |
|
protected |
Request a hook id.
[out] | aoHookId | Id of hook |
uint32 CINOSBusHooks::SetHookHandler | ( | uintid | auHookId, |
void * | apHandler | ||
) |
Set hook handler.
[in] | auHookId | Id of requested hook |
[in] | apHandler | Pointer to handler to set |
uint32 CINOSBusHooks::Setup | ( | uint8 | auCores = 1 , |
uint8 | auCoreId = 0 , |
||
uint32 | auOptions = eOptNone |
||
) |
Setup hooks handler with the given number of cores.
If we need e.g. a hooks handler witch handles cores 2..5 on a 8 cores system the setup looks like this
Setup(4, 2);
[in] | auCores | Requested number of cores |
[in] | auCoreId | Base core id (virtual core id of first core) |
[in] | auOptions | Additional options |
uint32 CINOSBusHooks::SetupCategory | ( | uint8 | auCoreId, |
uint8 | auCategory, | ||
uint32 | auCycletimeNs, | ||
uint32 | auFlags = CINOSBusHookCategory::eFlgEnabled |
||
) |
Setup hook category of given core handler.
[in] | auCoreId | Number of core to set up |
[in] | auCategory | Number of category to set up |
[in] | auCycletimeNs | Requested cycletime of this category |
[in] | auFlags | Requested category flags (e.g. eFlgEnabled) |
uint32 CINOSBusHooks::SetupCore | ( | uint8 | auCoreId, |
uint8 | auCategories | ||
) |
Setup hook core handler.
[in] | auCoreId | Number of core to set up |
[in] | auCategories | Requested number of categories |
uint32 CINOSBusHooks::SetupDone | ( | uint16 | auHooks | ) |
Finalysing hooks handler setup with given max. number of hooks.
[in] | auHooks | Max. number of hooks the hook handler owns |
uint32 CINOSBusHooks::Shutdown | ( | ) |
Shutdown hooks handler.
uint32 CINOSBusHooks::UnregisterHook | ( | CINOSBusHook * | apHook, |
uint32 | auFlags = eFlgNone |
||
) |
Unregister given hook.
[in] | apHook | Pointer to hook to be unregistered |
[in] | auFlags | Additional flags (e.g. eFlgDelete) |
uint32 CINOSBusHooks::UnregisterHook | ( | uintid | auHookId | ) |
Unregister given hook.
[in] | auHookId | Id of hook to be unregistered |
|
protected |
number of allocated nodes
|
protected |
array of core handlers
|
protected |
array of pointers to hooks
|
protected |
bit field of active hooks
|
protected |
pointer to inco registration of 'hooks'
|
staticprotected |
array of hook helper instances
|
protected |
pool of hook nodes
|
protected |
pointer to inco registration
|
protected |
base core id
|
protected |
max. number of cores
|
protected |
slowest cycletime
|
protected |
group id
|
protected |
hook id counter
|
protected |
id shift
|
protected |
index mask
|
protected |
actual number of registered hooks
|
protected |
size of hooks active
|
protected |
max. number of hooks
|
protected |
overall number of nodes