INOS
cinosbushooks.h
Go to the documentation of this file.
1//******************************************************************************
26//******************************************************************************
27#ifndef INC_CINOSBUSHOOKS_H
28#define INC_CINOSBUSHOOKS_H
29//------------------------------------------------------------------------------
30// includes
31//------------------------------------------------------------------------------
32//
33// system
34#include <inos.h>
35//
36// C++
37#include <map>
38//
39// project
40//
41//------------------------------------------------------------------------------
42// defines
43//------------------------------------------------------------------------------
44
45// --- inos bus hook priorities ------------------------------------------------
46//
47#define DF_INOS_BUS_HOOK_ORDER_PRE_AXIS -20
48#define DF_INOS_BUS_HOOK_ORDER_AXIS_PRE_MAP -10
49#define DF_INOS_BUS_HOOK_ORDER_AXIS_MAP 0
50#define DF_INOS_BUS_HOOK_ORDER_CONTROL 0
51#define DF_INOS_BUS_HOOK_ORDER_AXIS_PST_MAP 10
52#define DF_INOS_BUS_HOOK_ORDER_PST_AXIS 20
53#define DF_INOS_BUS_HOOK_ORDER_DEFAULT 20
54
55//------------------------------------------------------------------------------
56// class definition
57//------------------------------------------------------------------------------
58//
60{
61 // public member functions
62 public :
65 CINOSBusHook (uint8 auCoreId, uint8 auCategory,
66 uint8 auCyclenumber, int32 aiOrder, uint32 auCycletime,
67 void* apHandler, void* apObject, uint32 auFlags);
68
71 virtual ~CINOSBusHook ();
72
75 enum EFlags {
76 eFlgNone = 0x00000000,
77 eFlgEnabled = 0x00000001,
78 eFlgSingle = 0x00000002,
79 eFlgNoException = 0x00000004,
80 eFlgDeletePending = 0x40000000,
81 eFlgDynamic = 0x80000000,
82 };
83
86 uintid GetId()
87 { return m_uId; }
88
91 uint32 Enable();
92
95 uint32 Disable();
96
99 virtual CINOSBusHook* Clone();
100
101 //--- internals --------------------------------------------------------
102
103 friend class CINOSBusHooks;
104 friend class CINCOBusHook;
105 friend class CINCOBusHooks;
106
107 // protected members
108 protected :
109 /* hook flags */
110 uint32 m_uFlags;
111 /* hook id */
112 uintid m_uId;
113 /* core id */
114 uint8 m_uCoreId;
115 /* category */
116 uint8 m_uCategory;
117 /* base cycle number */
118 uint8 m_uCyclenumber;
119 /* this hook is registered in this number of cycles */
120 int8 m_iCycles;
121 /* hook order */
122 int32 m_iOrder;
123 /* hook cycletime */
124 uint32 m_uCycletime;
125 /* pointer to hook handler */
126 void* m_pHandler;
127 /* pointer to hook handler object (if any) */
128 void* m_pObject;
129 /* hook ticks */
130 uint32 m_uTicks;
131
132 // dynamic object handling
134};
135
136//------------------------------------------------------------------------------
137//
139{
140 // public member functions
141 public :
144 CINOSBusHookEx (uint8 auCoreId, uint8 auCategory,
145 uint8 auCyclenumber, int32 aiOrder, uint32 auCycletime,
146 void* apHandler, void* apObject, uint32 auFlags, uint32 auInterval,
147 uint32 auCount = 0);
148
151 virtual ~CINOSBusHookEx ();
152
157 void SetIntervalCmd(uint32 auInterval)
158 {
159 m_uInterval = auInterval ? auInterval : 1;
160 m_uIntervalAct = m_uInterval;
161 };
162
168 { return m_uInterval; };
169
174 uint32 GetIntervalAct() const
175 { return m_uIntervalAct; };
176
179 virtual void Action();
180
183 virtual void Call();
184
187 virtual CINOSBusHook* Clone();
188
189 //--- internals --------------------------------------------------------
190
191 // protected members
192 protected :
193 /* hook commanded interval */
194 uint32 m_uInterval;
195 /* hook actual interval */
196 uint32 m_uIntervalAct{};
197 /* hook count (0 -> endless) */
198 uint32 m_uCount{};
199 /* pointer to original hook handler */
200 void* m_pOrgHandler;
201 /* pointer to original hook handler object (if any) */
202 void* m_pOrgObject;
203
204 // dynamic object handling
206};
207
208//------------------------------------------------------------------------------
209//
211{
212 /* pointer to next node in list */
213 SINOSBusHookNode* m_pNext;
214 /* id of hook this node represents */
215 uintid m_uHookId;
216 /* order of hook this node represents */
217 int32 m_iOrder;
218 /*
219 * Ensure the size of a cache line to get 'load reserve' and 'store conditional'
220 * mechanism running.
221 */
222 uint32 m_uAlign[
224 sizeof(m_pNext)-
225 sizeof(m_uHookId)-
226 sizeof(m_iOrder))>>2
227 ];
228};
229
230//------------------------------------------------------------------------------
231//
233{
234 // public member functions
235 public :
236
240
244
247 uint32 Setup();
248
254 uint32 SetupDone(uint16 auHooks);
255
261 uint32 Shutdown(class CINOSBusHooks* apParent);
262
263 //--- internals --------------------------------------------------------
264
265 friend class CINOSBusHooks;
266 friend class CINCOBusHooksSequence;
267
268 // private members
269 private :
274 void GetHookIdMap(std::map<uintid,uintid>& aHooks);
275
276 // protected members
277 protected :
282
283 /* cycle ticks */
284 uint32 m_uTicks{};
285
287 class CINCOBusHooksSequence* m_pInco{};
288
289 /*
290 * Ensure the size of a cache line to get 'load reserve' and 'store conditional'
291 * mechanism running.
292 */
293 uint32 m_uAlign[
295 sizeof(m_pSequence)-
296 sizeof(m_pInsert)-
297 sizeof(m_uTicks)-
298 sizeof(m_pInco))>>2
299 ];
300
301 // dynamic object handling
303};
304
305//------------------------------------------------------------------------------
306//
308{
309 // public member functions
310 public :
311
315
319
322 enum EFlags {
323 eFlgNone = 0x00000000,
324 eFlgEnabled = 0x00000001,
325 };
326
332 uint32 Setup(uint32 auCycletime, uint32 auFlags);
333
339 uint32 SetupDone(uint16 auHooks);
340
346 uint32 Shutdown(class CINOSBusHooks* apParent);
347
350 uint32 Enable();
351
354 uint32 Disable();
355
361 bool IsCyclenumberValid(uint8 auCyclenumber);
362
368 bool IsCycletimeValid(uint32 auCycletimeNs);
369
370 //--- internals --------------------------------------------------------
371
372 friend class CINOSBusHooks;
373 friend class CINOSBusHookCore;
374
375 // protected members
376 protected :
377 /* category flags */
378 uint32 m_uFlags{};
379 /* category cycletime [ns] */
380 uint32 m_uCycletimeNs{};
382 uint32 m_uCycles{};
385
386 // dynamic object handling
388};
389
390//------------------------------------------------------------------------------
391//
393{
394 // public member functions
395 public :
396
400
404
410 uint32 Setup(uint8 auCategories);
411
419 uint32 SetupCategory(uint8 auCategory, uint32 auCycletimeNs, uint32 auFlags);
420
426 uint32 SetupDone(uint16 auHooks);
427
433 uint32 Shutdown(class CINOSBusHooks* apParent);
434
440 bool IsCategoryValid(uint8 auCategory);
441
447 bool IsCategoryEnabled(uint8 auCategory);
448
449 //--- internals --------------------------------------------------------
450
451 friend class CINOSBusHooks;
452
453 // protected members
454 protected :
459
460 // dynamic object handling
462};
463
464//------------------------------------------------------------------------------
465//
467{
468 //--- user interface ---------------------------------------------------
469
470 // public member functions
471 public :
472
473 /* hook handler states */
474 enum EState {
475 eStaIdle = 0,
476 eStaSetup = 1,
477 eStaReady = 2,
478 eStaShutdown = 3,
479 };
480
481 /* hooks constants */
482 enum {
484 };
485
486 /* hooks options */
487 enum {
488 eOptNone = 0x00000000,
489 eOptCategoryDc = 0x000000001,
490 eOptException = 0x000000002,
491 #if defined(INOS_CPP_EXCEPTION_SUPPORT)
493 #else
494 eOptExceptionEx = eOptNone,
495 #endif
496 #if defined(INOS_TESTING)
497 eOptDeleteImmediate = 0x80000000,
498 #endif
499 };
500
501 /* hooks flags */
502 enum {
503 eFlgNone = 0x00000000,
504 eFlgDelete = 0x000000001,
505 eFlgNegative = 0x000000002,
506 eFlgPositive = 0x000000004,
507 };
508
509 /* hook don't care values */
510 enum {
511 eDcOrder = 20,
512 eDcCategory = 0xff,
513 eDcCycletime = 0xffffffff,
514 eDcCyclenumber = 0xff,
515 eDcCoreId = 0x3f,
516 };
517
522 CINOSBusHooks (uint8 auGroupId = 0);
523
527
532 EState GetState()
533 { return m_eState; };
534
547 uint32 Setup(uint8 auCores = 1, uint8 auCoreId = 0, uint32 auOptions = eOptNone);
548
555 uint32 SetupCore(uint8 auCoreId, uint8 auCategories);
556
565 uint32 SetupCategory(uint8 auCoreId, uint8 auCategory, uint32 auCycletimeNs, uint32 auFlags = CINOSBusHookCategory::eFlgEnabled);
566
572 uint32 SetupDone(uint16 auHooks);
573
578 uint32 Shutdown();
579
585 uint32 EnableCategory(uint8 auCategory);
586
593 uint32 EnableCategory(uint8 auCoreId, uint8 auCategory);
594
600 uint32 DisableCategory(uint8 auCategory);
601
608 uint32 DisableCategory(uint8 auCoreId, uint8 auCategory);
609
617 uint32 RegisterHook(uintid& aoHookId, void* apHandler, CINOSBusHook::EFlags auFlags = CINOSBusHook::eFlgEnabled);
618
627 uint32 RegisterHook(uintid& aoHookId, void* apHandler, void* apObject, CINOSBusHook::EFlags auFlags = CINOSBusHook::eFlgEnabled);
628
638 uint32 RegisterHook(uintid& aoHookId, void* apHandler, void* apObject, int32 aiOrder, CINOSBusHook::EFlags auFlags = CINOSBusHook::eFlgEnabled);
639
650 uint32 RegisterHook(uintid& aoHookId, void* apHandler, void* apObject, int32 aiOrder, uint8 auCategory, CINOSBusHook::EFlags auFlags = CINOSBusHook::eFlgEnabled);
651
663 uint32 RegisterHook(uintid& aoHookId, void* apHandler, void* apObject, int32 aiOrder, uint8 auCategory, uint32 auCycletime, CINOSBusHook::EFlags auFlags = CINOSBusHook::eFlgEnabled);
664
677 uint32 RegisterHook(uintid& aoHookId, void* apHandler, void* apObject, int32 aiOrder, uint8 auCategory, uint32 auCycletime, uint8 auCyclenumber, CINOSBusHook::EFlags auFlags = CINOSBusHook::eFlgEnabled);
678
692 uint32 RegisterHook(uintid& aoHookId, void* apHandler, void* apObject, int32 aiOrder, uint8 auCategory, uint32 auCycletime, uint8 auCyclenumber, uint8 auCoreId, CINOSBusHook::EFlags auFlags = CINOSBusHook::eFlgEnabled);
693
699 uint32 RegisterHook(CINOSBusHook* apHook);
700
706 uint32 UnregisterHook(uintid auHookId);
707
714 uint32 UnregisterHook(CINOSBusHook* apHook, uint32 auFlags = eFlgNone);
715
721 uint32 EnableHook(uintid auHookId);
722
728 uint32 DisableHook(uintid auHookId);
729
735 void* GetHookHandler(uintid auHookId);
736
743 uint32 SetHookHandler(uintid auHookId, void* apHandler);
744
750 uint8 GetHookCyclenumber(uintid auHookId);
751
756 uint32 GetHookCycleTime(uintid auHookId);
757
763 uint32 GetHookCycleTime(uintid auHookId, uint32& auCycletime);
764
770 uint32 GetHookCategory(uintid auHookId, uint8& auCategory);
771
783 uint32 MoveHooks(uint8 auCoreId, uint8 auSrc, uint8 auDst);
784
793 uint32 HandleHooks(uint8 auCategory = 0, uint8 auCycle = 0, uint32 auFlags = eFlgNone);
794
799 static uint32 GetGroupId(uintid auHookId)
800 {
801 // mask it out
802 return ((uint32) auHookId)>>(32-eCnsGroupIdBits);
803 }
804
805 //--- internals --------------------------------------------------------
806
807 friend class CINOS1ms;
808 friend class CINOSBus;
809 friend class CINOSBusHookCycle;
810 friend class CINOSBusHookExTest;
811 friend class CINCOBusHooksMain;
812 friend class CINCOBusHooks;
813 friend class CINOSHwTarget;
814
815 // protected methods
816 protected :
817
823 uint32 RequestId(uintid& aoHookId);
824
830 uint32 ReleaseId(uintid auHookId);
831
837 uint32 GetIndex(uintid auHookId)
838 {
839 return auHookId & m_uHookIndexMask;
840 }
841
847 bool HasHooks(uint32 auNumber)
848 { return (m_uHooksAct + auNumber) <= m_uHooksMax; };
849
861 uint32 iHookCheck(void* apHandler, void* apObject, int32& aiOrder, uint8& auCategory, uint32& auCycletime, uint8& auCyclenumber, uint8& auCoreId);
862
869 uint32 iHookIdCheck(uintid auHookId, CINOSBusHook*& apHook);
870
877
883 {
884 #if defined(INOS_DESKTOP)
885 // locals
886 SINOSBusHookNode* node;
887 // enter critical section
888 uint32 uMsr = INOSDisableInterrupts();
889 // parts back to pool
890 node = m_pNodes;
891 m_pNodes = (SINOSBusHookNode*) *((uintptr*) node);
892 // exit critical section
893 INOSEnableInterrupts(uMsr);
894 #else
895 // locals
896 SINOSBusHookNode* next;
897 SINOSBusHookNode* node;
898 uintptr p = (uintptr) &m_pNodes;
899 #if defined(INOS_CPU_CORTEXA9)
900 // locals
901 uint32 res;
902 // try to alloc node
903 asm volatile (
904 " dsb" "\n\t"
905 "0: ldrex %0,[%2]" "\n\t"
906 " cmp %0,#0" "\n\t"
907 " beq 1f" "\n\t"
908 " ldr %1,[%0]" "\n\t"
909 " strex %3,%1,[%2]" "\n\t"
910 " cmp %3,#0" "\n\t"
911 " bne 0b" "\n\t"
912 "1: isb" "\n\t"
913 : "=r" (node), "=r" (next), "=r" (p), "=&r" (res)
914 : "2" (p));
915 #elif defined(INOS_CPU_CORTEXA72)
916 // locals
917 uint32 res;
918 // try to alloc node
919 asm volatile (
920 "0: ldaxr %0,[%2]" "\n\t"
921 " cmp %0,#0" "\n\t"
922 " beq 1f" "\n\t"
923 " ldr %1,[%0]" "\n\t"
924 " stlxr %w3,%1,[%2]" "\n\t"
925 " cmp %w3,#0" "\n\t"
926 " bne 0b" "\n\t"
927 "1: isb" "\n\t"
928 : "=r" (node), "=r" (next), "=r" (p), "=&r" (res)
929 : "2" (p));
930 #else
931 // try to alloc node
932 asm volatile (
933 " sync" "\n\t"
934 "0: lwarx %0, 0, %2" "\n\t"
935 " cmpwi %0, 0" "\n\t"
936 " beq 1f" "\n\t"
937 " lwz %1, 0(%0)" "\n\t"
938 " stwcx. %1, 0, %2" "\n\t"
939 " bne- 0b" "\n\t"
940 "1: isync" "\n\t"
941 : "=r" (node), "=r" (next), "=r" (p)
942 : "2" (p));
943 #endif
944 #endif
945
946 // inc number of allocated nodes
947 if (node) m_iNodesAct++;
948 // return result
949 return node;
950 }
951
957 {
958 #if defined(INOS_DESKTOP)
959 // enter critical section
960 uint32 uMsr = INOSDisableInterrupts();
961 // parts back to pool
962 apNode->m_pNext = m_pNodes;
963 m_pNodes = apNode;
964 // exit critical section
965 INOSEnableInterrupts(uMsr);
966 #else
967 // locals
968 SINOSBusHookNode* node = nullptr;
969 uintptr p = (uintptr) &m_pNodes;
970 #if defined(INOS_CPU_CORTEXA9)
971 // locals
972 uint32 res;
973 // try to alloc part
974 asm volatile (
975 " dsb" "\n\t"
976 "0: ldrex %0,[%2]" "\n\t"
977 " str %4,[%3]" "\n\t"
978 " strex %1,%3,[%2]" "\n\t"
979 " cmp %1,#0" "\n\t"
980 " bne 0b" "\n\t"
981 " isb" "\n\t"
982 : "=r" (node), "=&r" (res)
983 : "r" (p), "r" (apNode), "0" (node));
984 #elif defined(INOS_CPU_CORTEXA72)
985 // locals
986 uint32 res;
987 // try to alloc part
988 asm volatile (
989 "0: ldaxr %0,[%2]" "\n\t"
990 " str %4,[%3,#0]" "\n\t"
991 " stlxr %w1,%3,[%2]" "\n\t"
992 " cmp %w1,#0" "\n\t"
993 " bne 0b" "\n\t"
994 " isb" "\n\t"
995 : "=r" (node), "=&r" (res)
996 : "r" (p), "r" (apNode), "0" (node));
997 #else
998 // try to alloc part
999 asm volatile (
1000 " sync" "\n\t"
1001 "0: lwarx %0, 0, %1" "\n\t"
1002 " stw %4, 0(%3)" "\n\t"
1003 " stwcx. %2, 0, %1" "\n\t"
1004 " bne- 0b" "\n\t"
1005 " isync" "\n\t"
1006 : "=r" (node)
1007 : "r" (p), "r" (apNode), "r" (apNode), "0" (node));
1008 #endif
1009 #endif
1010
1011 // dec number of allocated nodes
1012 m_iNodesAct--;
1013 }
1014
1020 {
1021 // something to free ?
1022 if (nullptr == apNode) {
1023 // no
1024 return;
1025 }
1026
1027 // locals
1028 int32 iCount = 1;
1029 SINOSBusHookNode* lst = apNode;
1030 // count number of nodes
1031 while (lst->m_pNext){
1032 lst = lst->m_pNext;
1033 iCount++;
1034 }
1035
1036 #if defined(INOS_DESKTOP)
1037 // enter critical section
1038 uint32 uMsr = INOSDisableInterrupts();
1039 // parts back to pool
1040 lst->m_pNext = m_pNodes;
1041 m_pNodes = apNode;
1042 // exit critical section
1043 INOSEnableInterrupts(uMsr);
1044 #else
1045 // locals
1046 SINOSBusHookNode* node = nullptr;
1047 uintptr p = (uintptr) &m_pNodes;
1048 #if defined(INOS_CPU_CORTEXA9)
1049 // locals
1050 uint32 res;
1051 // try to alloc part
1052 asm volatile (
1053 " dsb" "\n\t"
1054 "0: ldrex %0,[%2]" "\n\t"
1055 " str %5,[%4]" "\n\t"
1056 " strex %1,%3,[%2]" "\n\t"
1057 " cmp %1,#0" "\n\t"
1058 " bne 0b" "\n\t"
1059 " isb" "\n\t"
1060 : "=r" (node), "=&r" (res)
1061 : "r" (p), "r" (apNode), "r" (lst), "0" (node));
1062 #elif defined(INOS_CPU_CORTEXA72)
1063 // locals
1064 uint32 res;
1065 // try to alloc part
1066 asm volatile (
1067 "0: ldaxr %0,[%2]" "\n\t"
1068 " str %5,[%4]" "\n\t"
1069 " stlxr %w1,%3,[%2]" "\n\t"
1070 " cmp %w1,#0" "\n\t"
1071 " bne 0b" "\n\t"
1072 " isb" "\n\t"
1073 : "=r" (node), "=&r" (res)
1074 : "r" (p), "r" (apNode), "r" (lst), "0" (node));
1075 #else
1076 // try to alloc part
1077 asm volatile (
1078 " sync" "\n\t"
1079 "0: lwarx %0, 0, %1" "\n\t"
1080 " stw %4, 0(%3)" "\n\t"
1081 " stwcx. %2, 0, %1" "\n\t"
1082 " bne- 0b" "\n\t"
1083 " isync" "\n\t"
1084 : "=r" (node)
1085 : "r" (p), "r" (apNode), "r" (lst), "0" (node));
1086 #endif
1087 #endif
1088
1089 // dec number of allocated nodes
1090 m_iNodesAct -= iCount;
1091 }
1092
1099
1107
1115
1121
1122 //--- testing ---------------------------------------------------------
1123
1124 // private members
1125 private :
1126
1131 uint32 GetNodes()
1132 { return m_uNodesMax; }
1133
1138 int32 GetNodesAllocated()
1139 { return m_iNodesAct; }
1140
1148 SINOSBusHookNode* GetHookListInsert(uint8 auCoreId, uint8 auCategory, uint8 auCycle)
1149 { return m_pCores[auCoreId].m_pCategories[auCategory].m_pCycles[auCycle].m_pInsert; }
1150
1158 SINOSBusHookNode* GetHookListSequence(uint8 auCoreId, uint8 auCategory, uint8 auCycle)
1159 { return m_pCores[auCoreId].m_pCategories[auCategory].m_pCycles[auCycle].m_pSequence; }
1160
1165 CINCOObject* GetRegister(const char* apName);
1166
1171 void GetHookIdMap(std::map<uintid,uintid>& aHooks);
1172
1175 static void Create();
1176
1177 #if defined(INOS_TESTING) or defined(INOS_TESTING_BASE_SUPPORT)
1178 friend class CINOSTestManager;
1181 static void WaitIdle();
1182 #endif
1183
1184 // protected members
1185 protected :
1186 /* hook handler state */
1187 EState m_eState = eStaIdle;
1188 /* hook handler options */
1189 uint32 m_uOptions = eOptNone;
1190
1192 uint8 m_uGroupId{};
1198 std::atomic<uint32> m_uHookIdCnt = {1};
1204 uint32 m_uHooksMax{};
1206 std::atomic<int32> m_uHooksAct = {0};
1209
1213 uint8 m_uCores{};
1217 uint32 m_uCycletimeSlowest{1000000};
1218
1220 std::atomic<uint32> m_uNodesMax = {0};
1222 std::atomic<int32> m_iNodesAct = {0};
1225
1226 #if defined(INOS_CPU_CORTEXA9)
1228 uint8 m_uActCore{};
1230 uint8 m_uActCategory{};
1232 uint8 m_uActCycle{};
1233 #endif
1234
1236 CINCOObject* m_pRegister{};
1238 class CINCOBusHooksMain* m_pInco{};
1239
1241 static class CINOSBusHooksHelper* m_pInstance[DF_INOS_MAX_CORES];
1242
1243 // dynamic object handling
1245};
1246
1247//------------------------------------------------------------------------------
1248// end of file
1249//------------------------------------------------------------------------------
1250
1251#endif // INC_CINOSBUSHOOKS_H
#define DECLARE_DYNAMIC(aClass)
Definition cinospartitionmemory.h:328
Definition inos_1ms.h:225
Definition cinosbushooks.h:308
uint32 Enable()
Enable category.
uint32 Setup(uint32 auCycletime, uint32 auFlags)
Setup hook category with given cycle time.
uint32 SetupDone(uint16 auHooks)
Finalysing hook category setup with given max. number of hooks.
EFlags
Category flags.
Definition cinosbushooks.h:322
uint32 Disable()
Disable category.
bool IsCyclenumberValid(uint8 auCyclenumber)
Check whether the given cycle number is in a valid range.
~CINOSBusHookCategory()
Destroy bus hook category handler.
CINOSBusHookCategory()
Create bus hook category handler.
uint32 m_uCycles
Definition cinosbushooks.h:382
CINOSBusHookCycle * m_pCycles
Definition cinosbushooks.h:384
bool IsCycletimeValid(uint32 auCycletimeNs)
Check whether the given cycle time is valid.
uint32 Shutdown(class CINOSBusHooks *apParent)
Shutdown hook category.
Definition cinosbushooks.h:393
uint32 Setup(uint8 auCategories)
Setup hook core with the given number of categories.
CINOSBusHookCore()
Create bus hook core handler.
uint32 SetupDone(uint16 auHooks)
Finalysing hook core setup with given max. number of hooks.
~CINOSBusHookCore()
Destroy bus hook core handler.
uint32 Shutdown(class CINOSBusHooks *apParent)
Shutdown hook core handler.
bool IsCategoryValid(uint8 auCategory)
Check whether the given category number is valid.
CINOSBusHookCategory * m_pCategories
Definition cinosbushooks.h:458
bool IsCategoryEnabled(uint8 auCategory)
Check whether the given category number is enabled.
uint32 m_uCategories
Definition cinosbushooks.h:456
uint32 SetupCategory(uint8 auCategory, uint32 auCycletimeNs, uint32 auFlags)
Setup hook category.
Definition cinosbushooks.h:233
uint32 Shutdown(class CINOSBusHooks *apParent)
Shutdown hook cycle.
~CINOSBusHookCycle()
Destroy bus hook cycle handler.
uint32 Setup()
Setup hook cycle.
class CINCOBusHooksSequence * m_pInco
Definition cinosbushooks.h:287
SINOSBusHookNode * m_pSequence
Definition cinosbushooks.h:279
uint32 SetupDone(uint16 auHooks)
Finalysing hook cycle setup with given max. number of hooks.
SINOSBusHookNode * m_pInsert
Definition cinosbushooks.h:281
CINOSBusHookCycle()
Create bus hook cycle handler.
Definition cinosbushooks.h:139
void SetIntervalCmd(uint32 auInterval)
Set hook interval.
Definition cinosbushooks.h:157
CINOSBusHookEx(uint8 auCoreId, uint8 auCategory, uint8 auCyclenumber, int32 aiOrder, uint32 auCycletime, void *apHandler, void *apObject, uint32 auFlags, uint32 auInterval, uint32 auCount=0)
Create extended bus hook.
virtual ~CINOSBusHookEx()
Destroy extended bus hook.
virtual void Action()
Base hook handler.
uint32 GetIntervalAct() const
Get actual hook interval counter.
Definition cinosbushooks.h:174
virtual void Call()
Base hook caller.
virtual CINOSBusHook * Clone()
Clone hook.
uint32 GetIntervalCmd()
Get commanded hook interval.
Definition cinosbushooks.h:167
Definition cinosbushooks.h:60
virtual CINOSBusHook * Clone()
Clone hook.
uint32 Disable()
Disable hook.
EFlags
Hook flags.
Definition cinosbushooks.h:75
@ eFlgNoException
do not throw an exception in case of a failure
Definition cinosbushooks.h:79
uint32 Enable()
Enable hook.
CINOSBusHook(uint8 auCoreId, uint8 auCategory, uint8 auCyclenumber, int32 aiOrder, uint32 auCycletime, void *apHandler, void *apObject, uint32 auFlags)
Create bus hook.
uintid GetId()
Get id.
Definition cinosbushooks.h:86
virtual ~CINOSBusHook()
Destroy bus hook.
Definition cinosbushooks.h:467
uint8 m_uCoreIdBase
Definition cinosbushooks.h:1211
std::atomic< uint32 > m_uNodesMax
Definition cinosbushooks.h:1220
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 SetupCore(uint8 auCoreId, uint8 auCategories)
Setup hook core handler.
uint32 Shutdown()
Shutdown hooks handler.
uint32 EnableCategory(uint8 auCategory)
Enable given category of all cores.
CINCOObject * m_pRegister
Definition cinosbushooks.h:1236
uint32 Setup(uint8 auCores=1, uint8 auCoreId=0, uint32 auOptions=eOptNone)
Setup hooks handler with the given number of cores.
uint8 GetHookCyclenumber(uintid auHookId)
Get hook cycle number.
uint32 RegisterHook(uintid &aoHookId, void *apHandler, void *apObject, int32 aiOrder, CINOSBusHook::EFlags auFlags=CINOSBusHook::eFlgEnabled)
Register a hook with the given parameters.
CINOSBusHookCore * m_pCores
Definition cinosbushooks.h:1215
uint32 MoveHooks(uint8 auCoreId, uint8 auSrc, uint8 auDst)
Move all hooks of given core from one category to an other.
EState GetState()
Get hooks handler state.
Definition cinosbushooks.h:532
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 SetHookHandler(uintid auHookId, void *apHandler)
Set hook handler.
uint8 m_uGroupId
Definition cinosbushooks.h:1192
uint8 m_uCores
Definition cinosbushooks.h:1213
std::atomic< int32 > m_uHooksAct
Definition cinosbushooks.h:1206
bool HasHooks(uint32 auNumber)
Check whether the given number of hooks are still available.
Definition cinosbushooks.h:847
uint32 EnableCategory(uint8 auCoreId, uint8 auCategory)
Enable given category of given core.
std::atomic< int32 > m_iNodesAct
Definition cinosbushooks.h:1222
uint32 RegisterHook(uintid &aoHookId, void *apHandler, void *apObject, int32 aiOrder, uint8 auCategory, CINOSBusHook::EFlags auFlags=CINOSBusHook::eFlgEnabled)
Register a hook with the given parameters.
@ eOptCategoryDc
use 'don't care category' if the requested is not available
Definition cinosbushooks.h:489
@ eOptExceptionEx
return always a value because exception handling not available
Definition cinosbushooks.h:494
@ eOptException
throw an exception in case of an error (instead of a return value)
Definition cinosbushooks.h:490
SINOSBusHookNode * ListGet(SINOSBusHookNode **apHead)
Atomically detach list from given head and set head = nullptr.
uint32 m_uHooksMax
Definition cinosbushooks.h:1204
uint32 iHookRegister(CINOSBusHook *apHook)
Internal register given hook.
void ListDestroy(SINOSBusHookNode **apHead)
Destroy given nodes list.
std::atomic< uint32 > m_uHookIdCnt
Definition cinosbushooks.h:1198
@ eCnsGroupIdBits
number of group id bits
Definition cinosbushooks.h:483
uint32 EnableHook(uintid auHookId)
Enable given hook.
void ListInsert(SINOSBusHookNode *&apHead, SINOSBusHookNode *apNode)
Insert node into list in ascending order.
uint32 UnregisterHook(CINOSBusHook *apHook, uint32 auFlags=eFlgNone)
Unregister given hook.
uint32 DisableCategory(uint8 auCoreId, uint8 auCategory)
Disable given category of given core.
void FreeNodes(SINOSBusHookNode *apNode)
Free list of hook nodes.
Definition cinosbushooks.h:1019
void FreeNode(SINOSBusHookNode *apNode)
Free given hook node.
Definition cinosbushooks.h:956
uint32 RegisterHook(uintid &aoHookId, void *apHandler, void *apObject, CINOSBusHook::EFlags auFlags=CINOSBusHook::eFlgEnabled)
Register a hook with the given parameters.
SINOSBusHookNode * m_pNodes
Definition cinosbushooks.h:1224
static uint32 GetGroupId(uintid auHookId)
Get group id from hook id.
Definition cinosbushooks.h:799
uint32 m_uCycletimeSlowest
Definition cinosbushooks.h:1217
uint32 iHookIdCheck(uintid auHookId, CINOSBusHook *&apHook)
Check if the given hook id is valid.
uint32 RegisterHook(CINOSBusHook *apHook)
Register given hook.
uint32 GetHookCycleTime(uintid auHookId, uint32 &auCycletime)
Get hook cycle time.
uint32 GetIndex(uintid auHookId)
Return hook index from given hook id.
Definition cinosbushooks.h:837
uint32 SetupCategory(uint8 auCoreId, uint8 auCategory, uint32 auCycletimeNs, uint32 auFlags=CINOSBusHookCategory::eFlgEnabled)
Setup hook category of given core handler.
uint32 DisableHook(uintid auHookId)
Disable given hook.
uint32 * m_pHooksActive
Definition cinosbushooks.h:1202
uint32 m_uHookIdShift
Definition cinosbushooks.h:1196
bool ListSet(SINOSBusHookNode **apHead, SINOSBusHookNode *apList)
Atomically try to set head of list.
CINOSBusHooks(uint8 auGroupId=0)
Create bus hooks handler.
uint32 SetupDone(uint16 auHooks)
Finalysing hooks handler setup with given max. number of hooks.
SINOSBusHookNode * AllocNode()
Allocate a hook node.
Definition cinosbushooks.h:882
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.
uint32 RequestId(uintid &aoHookId)
Request a hook id.
uint32 DisableCategory(uint8 auCategory)
Disable given category of all cores.
void * GetHookHandler(uintid auHookId)
Get hook handler.
uint32 RegisterHook(uintid &aoHookId, void *apHandler, CINOSBusHook::EFlags auFlags=CINOSBusHook::eFlgEnabled)
Register a hook with the given parameters.
class CINCOBusHooksMain * m_pInco
Definition cinosbushooks.h:1238
uint32 GetHookCategory(uintid auHookId, uint8 &auCategory)
Get hook category.
uint32 iHookCheck(void *apHandler, void *apObject, int32 &aiOrder, uint8 &auCategory, uint32 &auCycletime, uint8 &auCyclenumber, uint8 &auCoreId)
Check if the given hook parameters are valid.
CINOSBusHook ** m_pHooks
Definition cinosbushooks.h:1208
uint32 ReleaseId(uintid auHookId)
Release given hook id.
uint32 GetHookCycleTime(uintid auHookId)
Get hook cycle time.
uint32 UnregisterHook(uintid auHookId)
Unregister given hook.
uint32 m_uHookIndexMask
Definition cinosbushooks.h:1194
uint32 m_uHooksActive
Definition cinosbushooks.h:1200
~CINOSBusHooks()
Destroy bus hooks handler.
static class CINOSBusHooksHelper * m_pInstance[DF_INOS_MAX_CORES]
Definition cinosbushooks.h:1241
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.
Definition cinosbus.h:600
#define DF_INOS_CPU_CACHE_LINE_SIZE
Definition inosdefine.h:94
#define DF_INOS_MAX_CORES
Definition inosdefine.h:164
Definition cinosbushooks.h:211