142 EOrderReadyList =0x88u, // Per-CPU ready list lock |
142 EOrderReadyList =0x88u, // Per-CPU ready list lock |
143 EOrderThreadGroup =0x90u, // Thread group locks |
143 EOrderThreadGroup =0x90u, // Thread group locks |
144 EOrderThread =0x91u, // Thread locks |
144 EOrderThread =0x91u, // Thread locks |
145 EOrderFastMutex =0x98u, // Fast mutex locks |
145 EOrderFastMutex =0x98u, // Fast mutex locks |
146 EOrderEventHandlerTied =0x9Cu, // Event handler tied lock |
146 EOrderEventHandlerTied =0x9Cu, // Event handler tied lock |
|
147 EOrderEnumerate =0x9Du, // Thread/Group enumeration lists |
147 EOrderGenericPreHigh0 =0x9Eu, // Device driver spin locks, high range |
148 EOrderGenericPreHigh0 =0x9Eu, // Device driver spin locks, high range |
148 EOrderGenericPreHigh1 =0x9Fu, // Device driver spin locks, high range |
149 EOrderGenericPreHigh1 =0x9Fu, // Device driver spin locks, high range |
149 |
150 |
150 EOrderNone =0xFFu // No order check required (e.g. for dynamic ordering) |
151 EOrderNone =0xFFu // No order check required (e.g. for dynamic ordering) |
151 }; |
152 }; |
808 TLinAddr iPreprocessHandler; // used for handle lookups |
809 TLinAddr iPreprocessHandler; // used for handle lookups |
809 SSlowExecEntry iEntries[1]; // first entry is for call number 0 |
810 SSlowExecEntry iEntries[1]; // first entry is for call number 0 |
810 }; |
811 }; |
811 |
812 |
812 // Thread iAttributes Constants |
813 // Thread iAttributes Constants |
813 const TUint8 KThreadAttImplicitSystemLock=1; /**< @internalComponent */ |
814 const TUint8 KThreadAttImplicitSystemLock=1; /**< @internalComponent */ |
814 const TUint8 KThreadAttAddressSpace=2; /**< @internalComponent */ |
815 const TUint8 KThreadAttAddressSpace=2; /**< @internalComponent */ |
815 const TUint8 KThreadAttLoggable=4; /**< @internalComponent */ |
816 const TUint8 KThreadAttLoggable=4; /**< @internalComponent */ |
816 |
817 |
817 |
818 |
818 // Thread CPU |
819 // Thread CPU |
819 const TUint32 KCpuAffinityAny=0xffffffffu; /**< @internalComponent */ |
820 const TUint32 KCpuAffinityAny=0xffffffffu; /**< @internalComponent */ |
|
821 const TUint32 KCpuAffinityPref=0x40000000u; /**< @internalComponent */ |
|
822 const TUint32 KCpuAffinityTransient=0x20000000u; /**< @internalComponent */ |
820 |
823 |
821 /** Information needed for creating a nanothread. |
824 /** Information needed for creating a nanothread. |
822 |
825 |
823 @publishedPartner |
826 @publishedPartner |
824 @prototype |
827 @prototype |
847 @prototype |
850 @prototype |
848 */ |
851 */ |
849 struct SNThreadGroupCreateInfo |
852 struct SNThreadGroupCreateInfo |
850 { |
853 { |
851 TUint32 iCpuAffinity; |
854 TUint32 iCpuAffinity; |
|
855 TDfc* iDestructionDfc; |
852 }; |
856 }; |
853 |
857 |
854 /** Constant for use with NKern:: functions which release a fast mutex as well |
858 /** Constant for use with NKern:: functions which release a fast mutex as well |
855 as performing some other operations. |
859 as performing some other operations. |
856 |
860 |
857 @publishedPartner |
861 @publishedPartner |
858 @released |
862 @released |
859 */ |
863 */ |
860 #define SYSTEM_LOCK (NFastMutex*)0 |
864 #define SYSTEM_LOCK (NFastMutex*)0 |
861 |
865 |
862 |
|
863 /** Idle handler function |
866 /** Idle handler function |
864 Pointer to a function which is called whenever a CPU goes idle |
867 Pointer to a function which is called whenever a CPU goes idle |
865 |
868 |
866 @param aPtr The iPtr stored in the SCpuIdleHandler structure |
869 @param aPtr The iPtr stored in the SCpuIdleHandler structure |
867 @param aStage If positive, the number of processors still active |
870 @param aStage Bits 0-7 give a bitmask of CPUs now active, i.e. 0 means all processors now idle |
868 If zero, indicates all processors are now idle |
871 Bit 31 set indicates that the current core can now be powered down |
869 -1 indicates that postamble processing is required after waking up |
872 Bit 30 set indicates that other cores still remain to be retired |
870 |
873 Bit 29 set indicates that postamble processing is required after waking up |
871 @publishedPartner |
874 @param aU Points to some per-CPU uncached memory used for handshaking during power down/power up |
872 @prototype |
875 |
873 */ |
876 @internalComponent |
874 typedef void (*TCpuIdleHandlerFn)(TAny* aPtr, TInt aStage); |
877 */ |
|
878 typedef void (*TCpuIdleHandlerFn)(TAny* aPtr, TUint32 aStage, volatile TAny* aU); |
875 |
879 |
876 /** Idle handler structure |
880 /** Idle handler structure |
877 |
881 |
878 @publishedPartner |
882 @internalComponent |
879 @prototype |
|
880 */ |
883 */ |
881 struct SCpuIdleHandler |
884 struct SCpuIdleHandler |
882 { |
885 { |
|
886 /** |
|
887 Defined flag bits in aStage parameter |
|
888 */ |
|
889 enum |
|
890 { |
|
891 EActiveCpuMask=0xFFu, |
|
892 EPostamble=1u<<29, // postamble needed |
|
893 EMore=1u<<30, // more cores still to be retired |
|
894 ERetire=1u<<31, // this core can now be retired |
|
895 }; |
|
896 |
883 TCpuIdleHandlerFn iHandler; |
897 TCpuIdleHandlerFn iHandler; |
884 TAny* iPtr; |
898 TAny* iPtr; |
885 volatile TBool iPostambleRequired; |
899 volatile TBool iPostambleRequired; |
886 }; |
900 }; |
887 |
901 |
986 IMPORT_C static TBool ThreadForceResume(NThread* aThread, NFastMutex* aMutex); |
1000 IMPORT_C static TBool ThreadForceResume(NThread* aThread, NFastMutex* aMutex); |
987 IMPORT_C static void ThreadRelease(NThread* aThread, TInt aReturnValue); |
1001 IMPORT_C static void ThreadRelease(NThread* aThread, TInt aReturnValue); |
988 IMPORT_C static void ThreadRelease(NThread* aThread, TInt aReturnValue, NFastMutex* aMutex); |
1002 IMPORT_C static void ThreadRelease(NThread* aThread, TInt aReturnValue, NFastMutex* aMutex); |
989 IMPORT_C static void ThreadSetPriority(NThread* aThread, TInt aPriority); |
1003 IMPORT_C static void ThreadSetPriority(NThread* aThread, TInt aPriority); |
990 IMPORT_C static void ThreadSetPriority(NThread* aThread, TInt aPriority, NFastMutex* aMutex); |
1004 IMPORT_C static void ThreadSetPriority(NThread* aThread, TInt aPriority, NFastMutex* aMutex); |
|
1005 static void ThreadSetNominalPriority(NThread* aThread, TInt aPriority); |
991 IMPORT_C static void ThreadRequestSignal(NThread* aThread); |
1006 IMPORT_C static void ThreadRequestSignal(NThread* aThread); |
992 IMPORT_C static void ThreadRequestSignal(NThread* aThread, NFastMutex* aMutex); |
1007 IMPORT_C static void ThreadRequestSignal(NThread* aThread, NFastMutex* aMutex); |
993 IMPORT_C static void ThreadRequestSignal(NThread* aThread, TInt aCount); |
1008 IMPORT_C static void ThreadRequestSignal(NThread* aThread, TInt aCount); |
994 IMPORT_C static void ThreadKill(NThread* aThread); |
1009 IMPORT_C static void ThreadKill(NThread* aThread); |
995 IMPORT_C static void ThreadKill(NThread* aThread, NFastMutex* aMutex); |
1010 IMPORT_C static void ThreadKill(NThread* aThread, NFastMutex* aMutex); |
1011 IMPORT_C static TUint64 ThreadCpuTime(NThread* aThread); /**< @internalComponent */ |
1026 IMPORT_C static TUint64 ThreadCpuTime(NThread* aThread); /**< @internalComponent */ |
1012 IMPORT_C static TUint32 CpuTimeMeasFreq(); /**< @internalComponent */ |
1027 IMPORT_C static TUint32 CpuTimeMeasFreq(); /**< @internalComponent */ |
1013 static TInt QueueUserModeCallback(NThreadBase* aThread, TUserModeCallback* aCallback); /**< @internalComponent */ |
1028 static TInt QueueUserModeCallback(NThreadBase* aThread, TUserModeCallback* aCallback); /**< @internalComponent */ |
1014 static void MoveUserModeCallbacks(NThreadBase* aSrcThread, NThreadBase* aDestThread); /**< @internalComponent */ |
1029 static void MoveUserModeCallbacks(NThreadBase* aSrcThread, NThreadBase* aDestThread); /**< @internalComponent */ |
1015 static void CancelUserModeCallbacks(); /**< @internalComponent */ |
1030 static void CancelUserModeCallbacks(); /**< @internalComponent */ |
|
1031 static void JumpTo(TInt aCpu); /**< @internalComponent */ |
1016 |
1032 |
1017 // Thread Groups |
1033 // Thread Groups |
1018 IMPORT_C static TInt GroupCreate(NThreadGroup* aGroup, SNThreadGroupCreateInfo& aInfo); |
1034 IMPORT_C static TInt GroupCreate(NThreadGroup* aGroup, SNThreadGroupCreateInfo& aInfo); |
1019 IMPORT_C static void GroupDestroy(NThreadGroup* aGroup); |
1035 IMPORT_C static void GroupDestroy(NThreadGroup* aGroup); |
1020 IMPORT_C static NThreadGroup* CurrentGroup(); |
1036 IMPORT_C static NThreadGroup* CurrentGroup(); |
1102 |
1118 |
1103 // Miscellaneous |
1119 // Miscellaneous |
1104 IMPORT_C static NThread* CurrentThread(); |
1120 IMPORT_C static NThread* CurrentThread(); |
1105 IMPORT_C static TInt CurrentCpu(); /**< @internalComponent */ |
1121 IMPORT_C static TInt CurrentCpu(); /**< @internalComponent */ |
1106 IMPORT_C static TInt NumberOfCpus(); /**< @internalComponent */ |
1122 IMPORT_C static TInt NumberOfCpus(); /**< @internalComponent */ |
|
1123 IMPORT_C static void SetNumberOfActiveCpus(TInt aNumber); |
1107 IMPORT_C static void LockSystem(); |
1124 IMPORT_C static void LockSystem(); |
1108 IMPORT_C static void UnlockSystem(); |
1125 IMPORT_C static void UnlockSystem(); |
1109 IMPORT_C static TBool FlashSystem(); |
1126 IMPORT_C static TBool FlashSystem(); |
1110 IMPORT_C static void WaitForAnyRequest(); |
1127 IMPORT_C static void WaitForAnyRequest(); |
1111 IMPORT_C static void Sleep(TUint32 aTime); |
1128 IMPORT_C static void Sleep(TUint32 aTime); |
1128 static void Init0(TAny* aVariantData); |
1145 static void Init0(TAny* aVariantData); |
1129 static void Init(NThread* aThread, SNThreadCreateInfo& aInfo); |
1146 static void Init(NThread* aThread, SNThreadCreateInfo& aInfo); |
1130 static TInt BootAP(volatile SAPBootInfo* aInfo); |
1147 static TInt BootAP(volatile SAPBootInfo* aInfo); |
1131 IMPORT_C static TBool KernelLocked(TInt aCount=0); /**< @internalTechnology */ |
1148 IMPORT_C static TBool KernelLocked(TInt aCount=0); /**< @internalTechnology */ |
1132 IMPORT_C static NFastMutex* HeldFastMutex(); /**< @internalTechnology */ |
1149 IMPORT_C static NFastMutex* HeldFastMutex(); /**< @internalTechnology */ |
1133 static void Idle(); |
1150 static void Idle(); |
|
1151 static void DoIdle(); |
1134 IMPORT_C static SCpuIdleHandler* CpuIdleHandler(); /**< @internalTechnology */ |
1152 IMPORT_C static SCpuIdleHandler* CpuIdleHandler(); /**< @internalTechnology */ |
1135 static void NotifyCrash(const TAny* a0, TInt a1); /**< @internalTechnology */ |
1153 static void NotifyCrash(const TAny* a0, TInt a1); /**< @internalTechnology */ |
1136 IMPORT_C static TBool Crashed(); |
1154 IMPORT_C static TBool Crashed(); |
1137 static TUint32 IdleGenerationCount(); |
1155 static TUint32 IdleGenerationCount(); |
1138 |
1156 |