diff --git a/doc/张鑫源泛读报告.docx b/doc/张鑫源泛读报告.docx new file mode 100644 index 0000000..e296fdb Binary files /dev/null and b/doc/张鑫源泛读报告.docx differ diff --git a/doc/蔡伦_LiteOS阅读泛读报告.docx b/doc/蔡伦_LiteOS阅读泛读报告.docx deleted file mode 100644 index e69de29..0000000 diff --git a/src/kernel/include/los_ld_elflib.h b/src/kernel/include/los_ld_elflib.h index 9a8a543..2ce398c 100644 --- a/src/kernel/include/los_ld_elflib.h +++ b/src/kernel/include/los_ld_elflib.h @@ -54,7 +54,7 @@ enum LOAD_STRATEGY { ZIP, NOZIP }; - +/*һö͵Ķ壬ΪLOAD_STRATEGYԱZIPNOZIP*/ /** * @ingroup los_dynload * Define the structure of the parameters used for dynamic. @@ -64,7 +64,9 @@ enum LOAD_STRATEGY { typedef struct tagDynloadParam { enum LOAD_STRATEGY enLoadStrategy; } DYNLOAD_PARAM_S; - +/*ṹ洢̬صIJϢ +enLoadStrategyԱʾزԣZIPNOZIPͨʹṹ壬 +ԽزΪݸصĺģ顣*/ /** * @ingroup los_dynload * @brief Register the dynamic parameters. @@ -84,7 +86,8 @@ typedef struct tagDynloadParam { * @since Huawei LiteOS V100R001C00 */ extern VOID LOS_DynParamReg(DYNLOAD_PARAM_S *dynloadParam); - +/*ͨLOS_DynParamRegһָDYNLOAD_PARAM_SͶָ룬 +Խ̬صIJϢעᵽصϵͳģС*/ /** * @ingroup los_dynload * @brief Load a shared object file. @@ -136,7 +139,7 @@ extern VOID *LOS_MemLoad(const CHAR *elfFileName, UINT32 fileNameLen, const CHAR *elfFileBuf, UINT32 bufLen); #endif /* LOSCFG_DYNLOAD_DYN_FROM_MEM */ #endif /* LOSCFG_KERNEL_DYNLOAD_DYN */ - +/*δʹָ#ifdef#endifڲͬı뻷ѡǷö̬عܡ*/ #ifdef LOSCFG_KERNEL_DYNLOAD_REL /** * @ingroup los_dynload @@ -160,7 +163,9 @@ extern VOID *LOS_MemLoad(const CHAR *elfFileName, UINT32 fileNameLen, */ extern VOID *LOS_ObjLoad(CHAR *elfFileName); #endif /* LOSCFG_KERNEL_DYNLOAD_REL */ - +/*궨LOSCFG_KERNEL_DYNLOAD_REL壬 +ʾ˶̬ӿضλܣʱLOS_ObjLoadΪⲿ +һַָͣCHARָΪһVOID͵ָ롣*/ /** * @ingroup los_dynload * @brief Unload a module. @@ -182,7 +187,8 @@ extern VOID *LOS_ObjLoad(CHAR *elfFileName); * @since Huawei LiteOS V100R001C00 */ extern INT32 LOS_ModuleUnload(VOID *handle); - +/*ͨLOS_ModuleUnloadһ̬ľ +жظö̬ⲢͷԴ*/ /** * @ingroup los_dynload * @brief Destroy a dynamic loader. @@ -203,7 +209,9 @@ extern INT32 LOS_ModuleUnload(VOID *handle); * @since Huawei LiteOS V100R001C00 */ extern VOID LOS_LdDestroy(VOID); +/*δһⲿLOS_LdDestroyúûвͷֵ +ͨLOS_LdDestroyٶ̬LoaderͷԴ*/ /** * @ingroup los_dynload * @brief Search for a symbol address. @@ -250,7 +258,8 @@ extern VOID *LOS_FindSymByName(VOID *handle, CHAR *name); * @since Huawei LiteOS V100R001C00 */ extern INT32 LOS_PathAdd(CHAR *path); - +/*ͨLOS_PathAddһ·Խ·ӵ̬·С +ڶ̬ӿʱϵͳᰴһ˳̬*/ /** * @ingroup los_dynload * @brief Set the memory pool address used by dynload @@ -273,7 +282,9 @@ extern INT32 LOS_PathAdd(CHAR *path); * @since Huawei LiteOS V200R002C00 */ extern BOOL LOS_DynMemPoolSet(VOID *memPool); - +/*ͨLOS_DynMemPoolSetһڴָ룬 +ö̬ڴأڼغִж̬ӿʱڴ档̬ӿ +Ҫʱڴ洢ݺִд룬Ҫṩһʵڴء*/ #ifdef __cplusplus #if __cplusplus } diff --git a/src/kernel/include/los_list.h b/src/kernel/include/los_list.h index b9f253d..3bbc961 100644 --- a/src/kernel/include/los_list.h +++ b/src/kernel/include/los_list.h @@ -50,6 +50,10 @@ typedef struct LOS_DL_LIST { struct LOS_DL_LIST *pstPrev; /**< Current node's pointer to the previous node */ struct LOS_DL_LIST *pstNext; /**< Current node's pointer to the next node */ } LOS_DL_LIST; +/*ֽṹͨʵ˫ݽṹ +ͨÿڵǶLOS_DL_LISTṹ壬 +Խڵγ +*/ /** * @ingroup los_list @@ -74,7 +78,11 @@ LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListInit(LOS_DL_LIST *list) list->pstNext = list; list->pstPrev = list; } +/*δ붨һ̬LOS_ListInit +úһָLOS_DL_LISTṹָlistΪûзֵ +ǽʼΪգͷڵpstNextpstPrevָ +붼ָͷڵ㱾ʾûڵ㡣*/ /** * @ingroup los_list * @brief Point to the next node of the current node. @@ -93,7 +101,12 @@ LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListInit(LOS_DL_LIST *list) * @since Huawei LiteOS V100R001C00 */ #define LOS_DL_LIST_FIRST(object) ((object)->pstNext) +/*δ붨һLOS_DL_LIST_FIRST(object) +һָLOS_DL_LISTṹָobjectΪ +objectָĽڵһڵָ룬еĵһڵ㡣 +Ƿػȡеĵһڵ㣬ͨչ +ֱӷͷڵһڵ㡣*/ /** * @ingroup los_list * @brief Point to the previous node of the current node. @@ -112,7 +125,10 @@ LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListInit(LOS_DL_LIST *list) * @since Huawei LiteOS V100R001C00 */ #define LOS_DL_LIST_LAST(object) ((object)->pstPrev) - +/*δһ궨壬ڻȡ˫ָڵǰһڵ㡣 +IJ object һָ˫ڵָ룬 +pstPrev Ǹýڵָǰһڵָ롣 +úĹǷָڵǰһڵָ롣*/ /** * @ingroup los_list * @brief Insert a new node to a doubly linked list. @@ -138,7 +154,13 @@ LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListAdd(LOS_DL_LIST *list, LOS_DL_ list->pstNext->pstPrev = node; list->pstNext = node; } +/*ú½ڵ뵽ͷ岽£ +½ڵ next ָָͷһڵ㡣 +½ڵ prev ָָͷ +ԭͷһڵ prev ָָ½ڵ㡣 +ͷ next ָָ½ڵ㡣 +ͨЩ裬½ڵͱɹӵͷ*/ /** * @ingroup los_list * @brief Insert a node to a doubly linked list. @@ -161,7 +183,10 @@ LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListTailInsert(LOS_DL_LIST *list, { LOS_ListAdd(list->pstPrev, node); } - +/*ڸúУʹ˺궨 LOS_DL_LIST ʾڵ㣬 +ʹ STATIC INLINE ؼߴִЧʡ +ʵַdz򵥣ֻ˫IJ LOS_ListAdd +½ڵӵͷǰһڵ㼴ɡ*/ /** * @ingroup los_list * @brief Insert a node to a doubly linked list. @@ -210,7 +235,12 @@ LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListDelete(LOS_DL_LIST *node) node->pstNext = NULL; node->pstPrev = NULL; } +/*úʵַdz򵥣岽£ +ѱɾڵ next ڵ prev ָָɾڵ prev ڵ㡣 +ѱɾڵ prev ڵ next ָָɾڵ next ڵ㡣 +ձɾڵ next ָ prev ָ롣 +ͨЩ裬ָĽڵʹбɹɾˡ*/ /** * @ingroup los_list * @brief Identify whether a specified doubly linked list is empty or not. @@ -233,7 +263,12 @@ LITE_OS_SEC_ALW_INLINE STATIC INLINE BOOL LOS_ListEmpty(LOS_DL_LIST *list) { return (BOOL)(list->pstNext == list); } +/*岽£ +жͷ pstNext ָǷͷ +ȣ TRUEʾΪգ +ȣ FALSEʾΪգ +ͨЩ裬жǷΪա*/ /** * @ingroup los_list * @brief Obtain the offset of a structure member relative to the structure start address. @@ -256,7 +291,10 @@ LITE_OS_SEC_ALW_INLINE STATIC INLINE BOOL LOS_ListEmpty(LOS_DL_LIST *list) /* Obsolete API, please use LOS_OFF_SET_OF instead */ #define OFFSET_OF_FIELD(type, field) LOS_OFF_SET_OF(type, field) - +/*ЩǰԱڱдʱԷػȡṹԱƫ +ͨ£ṹԱƫڳнڴ +ݽṹָͳԱƫ +ԻȡóԱĵַ޸ĸóԱֵ*/ /** * @ingroup los_list * @brief Obtain the pointer to a structure that contains a doubly linked list. @@ -309,7 +347,12 @@ LITE_OS_SEC_ALW_INLINE STATIC INLINE BOOL LOS_ListEmpty(LOS_DL_LIST *list) for (item = LOS_DL_LIST_ENTRY((list)->pstNext, type, member); \ &(item)->member != (list); \ item = LOS_DL_LIST_ENTRY((item)->member.pstNext, type, member)) +/*ʵͨ for ѭʵı岽£ +ʹ LOS_DL_LIST_ENTRY ȡͷڵָ룬丳ֵ item Ӷʼʼλá +ж &(item)->member != (list)ĩβʱͷʱѭ +ѭڣִжԵǰڵIJʹ LOS_DL_LIST_ENTRY ȡһڵָ룬Ӷʵ˳ +ͨЩ裬Էر˫еÿڵ㣬ÿڵִӦIJ*/ /** * @ingroup los_list * @brief Traverse a doubly linked list which is included in a given type structure. And @@ -343,7 +386,13 @@ LITE_OS_SEC_ALW_INLINE STATIC INLINE BOOL LOS_ListEmpty(LOS_DL_LIST *list) next = LOS_DL_LIST_ENTRY((item)->member.pstNext, type, member); \ &(item)->member != (list); \ item = next, next = LOS_DL_LIST_ENTRY((item)->member.pstNext, type, member)) +/*úĹǰ˳еÿڵ㣬ÿڵִָIJ +itemʾǰĽڵ +nextʾһڵָ +listʾͷ +typeʾڵڵĽṹ +memberʾڵڽṹеijԱ*/ /** * @ingroup los_list * @brief Iterate over a doubly linked list of given type, and call hook for any extra procedures every time. @@ -370,7 +419,13 @@ LITE_OS_SEC_ALW_INLINE STATIC INLINE BOOL LOS_ListEmpty(LOS_DL_LIST *list) for (item = LOS_DL_LIST_ENTRY((list)->pstNext, type, member), hook; \ &(item)->member != (list); \ item = LOS_DL_LIST_ENTRY((item)->member.pstNext, type, member), hook) +/*úĹǰ˳еÿڵ㣬ÿڵ֮ǰִָĹӺ +itemʾǰĽڵ +listʾͷ +typeʾڵڵĽṹ +memberʾڵڽṹеijԱ +hookʾҪִеĹӺ*/ /** * @ingroup los_list * @brief Delete a specified node from a doubly linked list and reinitialize the node. @@ -396,7 +451,7 @@ LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListDelInit(LOS_DL_LIST *list) list->pstPrev->pstNext = list->pstNext; LOS_ListInit(list); } - +/**/ /** * @ingroup los_list * @brief Traverse a doubly linked list. @@ -423,7 +478,12 @@ LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListDelInit(LOS_DL_LIST *list) for (item = (list)->pstNext; \ (item) != (list); \ item = (item)->pstNext) +/*ʵͨ for ѭʵı岽£ +ѭʼ֣ item ʼΪͷڵһڵ㣬 (list)->pstNext +ѭУж (item) != (list) item ͷʱĩβʱѭ +ÿѭ֮󣬽 item Ϊһڵָ룬 (item)->pstNext +ͨЩ裬Էر˫еÿڵ㣬ѭڶÿڵִָIJ*/ /** * @ingroup los_list * @brief Traverse a doubly linked list safe against removal of list entry. @@ -475,7 +535,7 @@ LITE_OS_SEC_ALW_INLINE STATIC INLINE VOID LOS_ListDelInit(LOS_DL_LIST *list) * @since Huawei LiteOS V100R001C00 */ #define LOS_DL_LIST_HEAD(list) LOS_DL_LIST list = { &(list), &(list) } - +/*ͨ꣬Էضͳʼһ˫ͷڵ㣬Ϊĺṩ˱*/ #ifdef __cplusplus #if __cplusplus } diff --git a/src/kernel/include/los_lms.h b/src/kernel/include/los_lms.h index de4ac96..6463dc9 100644 --- a/src/kernel/include/los_lms.h +++ b/src/kernel/include/los_lms.h @@ -51,18 +51,30 @@ extern "C" { #define memmove_s KasanMemmoveSec #define strcat_s KasanStrcatSec #define strcpy_s KasanStrcpySec +/*ʹ#defineԤָ¶׼⺯ơּͨڵԻĿģṩЩԶʵ֡ +ƬУmemcpymemmovestrcatstrcpy¶ΪKasanMemcpy +KasanMemmoveKasanStrcatKasanStrcpyƵأmemcpy_smemmove_sstrcat_sstrcpy_s +¶ΪKasanMemcpySecKasanMemmoveSecKasanStrcatSecKasanStrcpySec*/ // End: Kernel Address Sanitizer(KASAN) for LiteOS VOID *KasanMemcpy(VOID *__restrict dest, const VOID *__restrict src, size_t copyAmount); VOID *KasanMemmove(VOID *dest, const VOID *src, size_t len); CHAR *KasanStrcat(CHAR *s, const CHAR *append); CHAR *KasanStrcpy(CHAR *dest, const CHAR *src); - +/*KasanMemcpyڱ׼еmemcpyڴиһݡܻڴʼ顣 +KasanMemmoveڱ׼еmemmoveڴƶһݡͬܰڴʼ顣 +KasanStrcatڱ׼еstrcatڽһַӵһַĩβܰڴʼ顣 +KasanStrcpyڱ׼еstrcpyڽһַƵһַͬܰڴʼ顣*/ errno_t KasanMemcpySec(VOID *dest, size_t destMax, const VOID *src, size_t copyAmount); errno_t KasanMemmoveSec(VOID *dest, size_t destMax, const VOID *src, size_t len); errno_t KasanStrcatSec(CHAR *s, size_t destMax, const CHAR *append); errno_t KasanStrcpySec(CHAR *dest, size_t destMax, const CHAR *src); +/*Ҫڴַڴ濽 destMax ͨʾĿ껺󳤶ȣԷֹȰȫ⡣ +KasanMemcpySecڱ׼еmemcpyڴиһݡĿ껺СIJԱ֤ᷢ +KasanMemmoveSecڱ׼еmemmoveڴƶһݡͬĿ껺СIJ +KasanStrcatSecڱ׼еstrcatڽһַӵһַĩβĿ껺СIJԱ֤ᷢ +KasanStrcpySecڱ׼еstrcpyڽһַƵһַͬĿ껺СIJ*/ #endif /* LOSCFG_KERNEL_LMS */ #ifdef __cplusplus diff --git a/src/kernel/include/los_lockdep.h b/src/kernel/include/los_lockdep.h index 848ce53..ce768a9 100644 --- a/src/kernel/include/los_lockdep.h +++ b/src/kernel/include/los_lockdep.h @@ -55,20 +55,33 @@ enum LockDepErrType { /* overflow, needs expand */ LOCKDEP_ERR_OVERFLOW, }; +/*һö LockDepErrTypeڱʾԼпܷIJͬ͡ǸöͶĸȡֵ京壺 +LOCKDEP_SUCCESSԼɹûзִ +LOCKDEP_ERR_DOUBLE_LOCKظĴ󡣱ʾij߳жζͬһ˼ +LOCKDEP_ERR_DEAD_LOCKĴ󡣱ʾڲ֮ͬ߳ѭϵķ +LOCKDEP_ERR_UNLOCK_WITHOUT_LOCKδĴ󡣱ʾij߳г˽֮߳ǰδԶӦй +LOCKDEP_ERR_OVERFLOW󡣱ʾöҪչΪǰȡֵѾ޷*/ typedef struct { VOID *lockPtr; VOID *lockAddr; UINT64 waitTime; UINT64 holdTime; } HeldLocks; - +/*ṹҪԷ͵Թм¼ǰ̳߳еϢͨ¼ЩϢ +ԶʹмغͷԱ㷢DZڵ⡣ +lockPtrʾеָ롣һ VOID* ͵ָ룬ָͨ򱻳еڴַ +lockAddrʾеĵַһ VOID* ͵ָ룬ָͨڴַ +waitTimeʾȴʱ䡣һ UINT64 ͵ıͨʾڻȡ֮ǰǰ̵߳ȴʱ䡣 +holdTimeʾиʱ䡣һ UINT64 ͵ıͨʾǰ߳Ѿиʱ䡣*/ typedef struct { VOID *waitLock; INT32 lockDepth; HeldLocks heldLocks[MAX_LOCK_DEPTH]; } LockDep; - +/*ṹҪԷ͵Թм¼ǰ̵߳ϵ +ͨ¼ǰ߳ڵȴеԼÿεϸϢ +ԶʹмغͷԱ㷢DZڵ⡣*/ /** * @ingroup los_lockdep * @@ -88,7 +101,8 @@ typedef struct { * @since Huawei LiteOS V200R003C00 */ extern VOID OsLockDepCheckIn(const SPIN_LOCK_S *lock); - +/*Ϊ OsLockDepCheckInΪ const SPIN_LOCK_S* lockΪ VOIDúǽָ + lock ӵԼУڽԵķ͵ԡ*/ /** * @ingroup los_lockdep * @@ -128,7 +142,8 @@ extern VOID OsLockDepRecord(SPIN_LOCK_S *lock); * @since Huawei LiteOS V200R003C00 */ extern VOID OsLockDepCheckOut(SPIN_LOCK_S *lock); - +/*Ϊ OsLockDepCheckOutΪ SPIN_LOCK_S* lockΪ VOIDú +ǴԼƳָ lockڽԸԷ͵ԡ*/ /** * @ingroup los_lockdep * diff --git a/src/kernel/include/los_lowpower.h b/src/kernel/include/los_lowpower.h index fceebf6..936b791 100644 --- a/src/kernel/include/los_lowpower.h +++ b/src/kernel/include/los_lowpower.h @@ -57,7 +57,14 @@ typedef enum LOS_INTERMIT_MODE { LOS_INTERMIT_SHUTDOWN, /**< Shutdown mode */ LOS_INTERMIT_MAX, } LosIntermitMode; +/*һö LOS_INTERMIT_MODE Ķ壬˼öٳ +LOS_INTERMIT_NONEʾûжģʽ +LOS_INTERMIT_LIGHT_SLEEPʾ˯ģʽ +LOS_INTERMIT_DEEP_SLEEPʾ˯ģʽ +LOS_INTERMIT_STANDBYʾģʽ +LOS_INTERMIT_SHUTDOWNʾػģʽ +LOS_INTERMIT_MAXö͵ֵڸö͵ķΧ*/ /** * @ingroup los_lowpower * @@ -70,7 +77,13 @@ typedef enum LOS_FREQ_MODE { LOS_SYS_FREQ_LOW, /**< Low freq */ LOS_SYS_FREQ_MAX, } LosFreqMode; +/*һö LOS_FREQ_MODE Ķ壬˼öٳ +LOS_SYS_FREQ_SUPERʾƵģʽ +LOS_SYS_FREQ_HIGHʾƵģʽ +LOS_SYS_FREQ_NORMALʾƵģʽ +LOS_SYS_FREQ_LOWʾƵģʽ +LOS_SYS_FREQ_MAXö͵ֵڸö͵ķΧ*/ typedef UINT32 (*LowpowerExternalVoterHandle)(VOID); STATIC INLINE BOOL FreqHigher(LosFreqMode freq1, LosFreqMode freq2) @@ -96,7 +109,19 @@ typedef struct { UINT32 (*getSleepMode)(VOID); /**< Get sleep mode interface, the retval type is LosIntermitMode */ VOID (*setSleepMode)(UINT32 mode); /**< Set sleep mode interface, the param type is LosIntermitMode */ } PowerMgrOps; +/*һṹ PowerMgrOps Ķ壬˶ָԱ +processԴܵڽӿ +wakeupFromResetӾлѵĻָӿ +resumeFromInterruptжлѵĻָӿ +changeFreqϵͳƵʵڽӿڣΪ LosFreqMode +deepSleepVoteBegin˯ͶƱǽӿ +deepSleepVoteEnd˯ͶƱȡӿ +deepSleepVoteDelay˯ͶƱӳٽӿڣΪӳٵʱ +registerExternalVoterעⲿͶƱ߽ӿڣΪһָ룬ֵΪ UINT32 +getDeepSleepVoteCountȡ˯ͶƱӿڣ UINT32 +getSleepModeȡ˯ģʽӿڣֵΪ LosIntermitMode +setSleepMode˯ģʽӿڣΪ UINT32ʾ LosIntermitMode*/ /** * @ingroup los_lowpower * @brief System main frequency tuning. @@ -115,7 +140,9 @@ typedef struct { * @since Huawei LiteOS V200R005C10 */ extern VOID LOS_PowerMgrChangeFreq(LosFreqMode freq); - +/*һⲿexternĺ LOS_PowerMgrChangeFreq +һ LosFreqMode ͵IJ freqڸıϵͳĹƵʡ +ݺͲܿϵͳлͬĹƵģʽ*/ /** * @ingroup los_lowpower * @brief Vote to enter deep sleep. @@ -153,7 +180,8 @@ extern VOID LOS_PowerMgrDeepSleepVoteBegin(VOID); * @since Huawei LiteOS V200R005C10 */ extern VOID LOS_PowerMgrDeepSleepVoteEnd(VOID); - +/*һⲿexternĺ LOS_PowerMgrDeepSleepVoteEndûκβΪ VOIDݺ +ܿڽ˯ͶƱȡ֮ǰе˯ͶƱ*/ /** * @ingroup los_lowpower * @brief Sleep delay vote. @@ -172,7 +200,8 @@ extern VOID LOS_PowerMgrDeepSleepVoteEnd(VOID); * @since Huawei LiteOS V200R005C10 */ extern VOID LOS_PowerMgrSleepDelay(UINT32 tick); - +/*һⲿexternĺ LOS_PowerMgrSleepDelayһ UINT32 ͵IJ tick +ϵͳ˯ӳ٣ָһʱΪ˯ӳ١*/ /** * @ingroup los_lowpower * @brief Register the external voter. @@ -191,7 +220,9 @@ extern VOID LOS_PowerMgrSleepDelay(UINT32 tick); * @since Huawei LiteOS V200R005C10 */ extern VOID LOS_PowerMgrRegisterExtVoter(UINT32 (*)(VOID)); - +/*һⲿexternĺ LOS_PowerMgrRegisterExtVoter +һָΪúָָһκβ UINT32 ͵ĺݺܿעⲿͶƱ +ṩĺָעΪⲿͶƱߵĴ*/ /** * @ingroup los_lowpower * @brief Get the sleep mode. @@ -250,7 +281,9 @@ extern UINT32 LOS_PowerMgrGetDeepSleepVoteCount(VOID); * @since Huawei LiteOS V200R005C10 */ extern VOID LOS_LowpowerInit(const PowerMgrOps *pmOps); - +/*һⲿexternĺ LOS_LowpowerInit +һ const PowerMgrOps * ͵ָ pmOpsڳʼ͹ģʽµϵͳݺܿϵͳʱʼ͹صIJͲ +Աܹ͹״̬ȷָϵͳ*/ /** * @ingroup los_lowpower * @brief Define the lowpower framework process function type. @@ -269,7 +302,10 @@ extern VOID LOS_LowpowerInit(const PowerMgrOps *pmOps); * @since Huawei LiteOS V200R005C10 */ typedef VOID (*LowPowerHookFn)(VOID); - +/*һͶ䣬һΪ LowPowerHookFn ĺָ͡ +úָָһκβ VOID ĺ +͵ĺָͨע͹ģʽµĹӺ +Աڽ˳͹ģʽʱִضIJ*/ /** * @ingroup los_lowpower * @brief Register a hook to enter lowpower framework process. @@ -288,7 +324,10 @@ typedef VOID (*LowPowerHookFn)(VOID); * @since Huawei LiteOS V200R005C10 */ extern VOID LOS_LowpowerHookReg(LowPowerHookFn hook); - +/*һⲿexternĺ LOS_LowpowerHookReg +һ LowPowerHookFn ͵IJ hookע͹ģʽµĹӺ +ݺܿϵͳע͹ģʽµĹӺ +Աڽ˳͹ģʽʱִضIJ*/ /** * @ingroup los_lowpower * @brief Define the lowpower framework wakup function type. @@ -307,7 +346,10 @@ extern VOID LOS_LowpowerHookReg(LowPowerHookFn hook); * @since Huawei LiteOS V200R005C10 */ typedef VOID (*IntWakeupHookFn)(HWI_HANDLE_T hwiNum); - +/*һͶ䣬һΪ IntWakeupHookFn ĺָ͡ +úָָһ HWI_HANDLE_T Ͳ VOID ĺ +͵ĺָͨעжϻѵĹӺԱضжϻ¼ʱִضIJ +*/ /** * @ingroup los_lowpower * @brief Register a hook to wakeup from interrupt. @@ -326,7 +368,11 @@ typedef VOID (*IntWakeupHookFn)(HWI_HANDLE_T hwiNum); * @since Huawei LiteOS V200R005C10 */ extern VOID LOS_IntWakeupHookReg(IntWakeupHookFn hook); - +/*һⲿexternĺ LOS_IntWakeupHookReg +һ IntWakeupHookFn ͵IJ hookעжϻѵĹӺ +ݺܿϵͳעжϻѵĹӺ +Աضжϻ¼ʱִضIJ +*/ #ifdef __cplusplus #if __cplusplus } diff --git a/src/kernel/include/los_lowpower_impl.h b/src/kernel/include/los_lowpower_impl.h index c319ad2..4a8be8d 100644 --- a/src/kernel/include/los_lowpower_impl.h +++ b/src/kernel/include/los_lowpower_impl.h @@ -59,7 +59,22 @@ typedef struct { UINT32 (*getSleepMode)(VOID); /**< Get sleep mode */ VOID (*setSleepMode)(UINT32 mode); /**< Set sleep mode */ } PowerMgrRunOps; +/*˵ýṹºָԱ +changeFreqϵͳƵʡ +enterLightSleep˯ߣlight sleepģʽ +enterDeepSleep˯ߣdeep sleepģʽ +setWakeUpTimerûѶʱ +withdrawWakeUpTimerѶʱ +getSleepTimeȡ˯ʱ䡣 +selectSleepModeѡ˯ģʽIJԺ +preConfigṩҪڽ˯ǰеԤá +postConfigṩҪڻѺеĺá +contextSaveġ +contextRestoreָġ +getDeepSleepVoteCountȡ˯ͶƱ +getSleepModeȡǰ˯ģʽ +setSleepMode˯ģʽ*/ /** * @ingroup los_lowpower * @@ -70,7 +85,11 @@ typedef struct { UINT32 minDeepSleepTicks; /**< Min deep sleep ticks */ UINT32 maxDeepSleepTicks; /**< Max deep sleep ticks */ } PowerMgrConfig; - +/*minLightSleepTicksС˯ߣlight sleepʱ +minDeepSleepTicksС˯ߣdeep sleepʱ +maxDeepSleepTicks˯ߣdeep sleepʱ +ЩԱùĹģزԿϵͳ벻ͬ˯ģʽ +С˯ʱĺ÷Ҫĺʹóȷ*/ /** * @ingroup los_lowpower * @@ -88,7 +107,16 @@ typedef struct { VOID (*otherCoreResume)(VOID); /**< Other core Resume for multi-core scenes */ VOID (*resumeFromReset)(VOID); /**< Resume from image */ } PowerMgrDeepSleepOps; - +/*couldDeepSleepϵͳǷԽ˯״̬ +systemWakeupϵͳ +suspendPreConfigṩҪڽ˯ǰеͣԤá +suspendDevice˯ǰͣ豸 +rollback˯ʧܣع +resumeDevice˯״ָָ̬豸 +resumePostConfigṩҪڴ˯״̬лָеĻָá +resumeCallBackָص +otherCoreResume˳£ĵĻָ +resumeFromResetӳлָ*/ /** * @ingroup los_lowpower * @@ -99,7 +127,10 @@ typedef struct { PowerMgrDeepSleepOps deepSleepOps; /**< power manager deep sleep operations */ PowerMgrConfig config; /**< power manager config */ } PowerMgrParameter; - +/*runOpsΪ PowerMgrRunOps Ľṹϵͳ״̬µĹĹϡ +deepSleepOpsΪ PowerMgrDeepSleepOps Ľṹϵͳ˯״̬µĹĹϡ +configΪ PowerMgrConfig ĽṹùĹģزϵͳ벻ͬ˯ģʽ +ͨЩṹϵ PowerMgrParameter ṹУʵֶϵͳ״̬˯״̬µĹĹͳһá*/ /** * @ingroup los_lowpower * @brief Init the power manager framework. diff --git a/src/kernel/include/los_membox.h b/src/kernel/include/los_membox.h index a2bf88d..8e0d4e7 100644 --- a/src/kernel/include/los_membox.h +++ b/src/kernel/include/los_membox.h @@ -75,7 +75,17 @@ extern "C" { * Head size of each node in staic memory pool */ #define OS_MEMBOX_NODE_HEAD_SIZE sizeof(LOS_MEMBOX_NODE) + /*LOS_MEMBOX_ALLIGNED(memAddr) ڶڴַж + memAddr ǿתΪ UINTPTR ͣȻ sizeof(UINTPTR) - + 1ٽаλȡ ~(sizeof(UINTPTR) - 1) аλ㡣 + ȷַ sizeof(UINTPTR) ֽڶ롣 +OS_MEMBOX_NEXT(addr, blkSize) ڻȡ̬ڴһڵĵַ + addr ǿתΪ UINT8* ͣȻ blkSizeõһڵĵַ + +OS_MEMBOX_NODE_HEAD_SIZE 궨˾̬ڴÿڵͷС LOS_MEMBOX_NODE ĴС + +Щھ̬ڴصʵ˸ãڼ͹ڴڵĵַʹС*/ /** * @ingroup los_membox * @brief Obtain the size of the static memory pool. @@ -98,7 +108,10 @@ extern "C" { */ #define LOS_MEMBOX_SIZE(blkSize, blkNum) \ (sizeof(LOS_MEMBOX_INFO) + (LOS_MEMBOX_ALLIGNED((blkSize) + OS_MEMBOX_NODE_HEAD_SIZE) * (blkNum))) + /*úʹ LOS_MEMBOX_ALLIGNED (blkSize) + OS_MEMBOX_NODE_HEAD_SIZE жȷÿڴ鶼սڵС롣Ȼ󽫶ĴС blkNum sizeof(LOS_MEMBOX_INFO)õ̬ڴصܴС +Уsizeof(LOS_MEMBOX_INFO) ʾ̬ڴصԪϢͷС +ڴʼַڴСڴϢ*/ /** * @ingroup los_membox * Structure of a free node in a static memory pool @@ -124,7 +137,11 @@ typedef struct { } LOS_MEMBOX_INFO; typedef LOS_MEMBOX_INFO OS_MEMBOX_S; +/*LOS_MEMBOX_INFO̬ڴصԪϢṹ塣˾̬ڴصʼַ +ڴСڴϢͬʱ uwBlkCnt ¼ѷڴijԱ + stFreeList ڼ¼ڴ LOSCFG_KERNEL_MEMBOX_STATIC 궨ʱã +OS_MEMBOX_S LOS_MEMBOX_INFO ṹȼ۵ı*/ /** * @ingroup los_membox * @brief Initialize a static memory pool. @@ -153,7 +170,8 @@ typedef LOS_MEMBOX_INFO OS_MEMBOX_S; * @since Huawei LiteOS V100R001C00 */ extern UINT32 LOS_MemboxInit(VOID *pool, UINT32 poolSize, UINT32 blkSize); - +/*úʹṩڴʼַʹСʼ̬ڴأָÿڴĴС +ڳʼɺ󣬸ڴؽԱڷڴ顣*/ /** * @ingroup los_membox * @brief Request a static memory block. @@ -202,7 +220,7 @@ extern VOID *LOS_MemboxAlloc(VOID *pool); * @since Huawei LiteOS V100R001C00 */ extern UINT32 LOS_MemboxFree(VOID *pool, VOID *box); - +/*øúͷ box ָڴ飬¼뵽ڴصĿڴУԱ´ηʹá*/ /** * @ingroup los_membox * @brief Clear a static memory block. @@ -226,7 +244,8 @@ extern UINT32 LOS_MemboxFree(VOID *pool, VOID *box); * @since Huawei LiteOS V100R001C00 */ extern VOID LOS_MemboxClr(VOID *pool, VOID *box); - +/*øúὫ box ָڴ㣬ʹΪʼ״̬ +úͨʹڴ֮ǰеľݣԺӰ졣*/ /** * @ingroup los_membox * @brief show static memory pool information. @@ -277,7 +296,9 @@ extern VOID LOS_ShowBox(VOID *pool); * @since Huawei LiteOS V100R001C00 */ extern UINT32 LOS_MemboxStatisticsGet(const VOID *boxMem, UINT32 *maxBlk, UINT32 *blkCnt, UINT32 *blkSize); - +/*øúȡ̬ڴصͳϢɷڴ +ѷڴԼÿڴĴСָͨظߡ +ЩͳϢڼغ͵ڴصʹ*/ #ifdef __cplusplus #if __cplusplus } diff --git a/src/kernel/include/los_memory.h b/src/kernel/include/los_memory.h index 9859d7f..ad3cdae 100644 --- a/src/kernel/include/los_memory.h +++ b/src/kernel/include/los_memory.h @@ -155,7 +155,12 @@ extern UINTPTR g_excInteractMemSize; * @since Huawei LiteOS V100R001C00 */ extern VOID *LOS_MemMalloc(VOID *pool, UINT32 size, UINT32 moduleId); - +/*poolָڴʼַָ롣 +sizeҪڴС +moduleIdڴģ ID +øúָڴзСΪ size ڴ飬ַظߡ +ڴ޷㹻ڴ飬򷵻 NULL ָʾʧܡ +ڴģ ID moduleId ָͨڹڴʹ*/ /** * @ingroup los_memory * @brief Allocate aligned memory. @@ -185,7 +190,10 @@ extern VOID *LOS_MemMalloc(VOID *pool, UINT32 size, UINT32 moduleId); * @since Huawei LiteOS V100R001C00 */ extern VOID *LOS_MemMallocAlign(VOID *pool, UINT32 size, UINT32 boundary, UINT32 moduleId); - +/*øúָڴаָĶ߽磨boundaryСΪ size ڴ飬ַظߡ +߽ʾڴʼַڴʼַƫ boundary ı +ڴ޷㹻Ķڴ飬򷵻 NULL ָʾʧܡ +ڴģ ID moduleId ָͨڹڴʹ*/ /** * @ingroup los_memory * @brief Free dynamic memory. @@ -212,7 +220,9 @@ extern VOID *LOS_MemMallocAlign(VOID *pool, UINT32 size, UINT32 boundary, UINT32 * @since Huawei LiteOS V100R001C00 */ extern UINT32 LOS_MemMfree(VOID *pool, VOID *ptr, UINT32 moduleId); +/*øúͷ ptr ָڴ飬黹ָڴءͬʱͨ moduleId ָҪͷŵڴģ IDԱصڴ +ڵøú֮ǰҪȷҪͷŵڴȷʵ֮ǰͨ LOS_MemMalloc LOS_MemMallocAlign õģδظͷšܻᵼڴͳ쳣Ϊ*/ /** * @ingroup los_memory * @brief Re-allocate a memory block. @@ -324,7 +334,14 @@ typedef struct { UINT32 uwUsageWaterLine; /**< this structure member is defined only when LOSCFG_MEM_TASK_STAT is defined. */ #endif } LOS_MEM_POOL_STATUS; - +/*uwTotalUsedSizeڴʹõܴСλֽڣ +uwTotalFreeSizeڴδʹõܴСλֽڣ +uwMaxFreeNodeSizeڴĿڴСλֽڣ +uwUsedNodeNumڴʹõڴ +uwFreeNodeNumڴδʹõڴ +uwUsageWaterLine LOSCFG_MEM_TASK_STAT ʱЧڴصʹˮλߣʾڴйдﵽʹ +ͨʹøýṹ壬Իȡڴصϸ״̬ϢʹõܴСδʹõܴСõڴСԼصڴ +У LOSCFG_MEM_TASK_STATԻȡڴصʹˮλߡ*/ /** * @ingroup los_memory * @brief Initialize dynamic memory. @@ -353,7 +370,8 @@ typedef struct { * @since Huawei LiteOS V100R001C00 */ extern UINT32 LOS_MemInit(VOID *pool, UINT32 size); - +/*øúָڴؽгʼʹ߱ڷ͹ڴ +ڳʼɺ󣬸ڴؿԱڶ̬ͷڴ顣*/ /** * @ingroup los_memory * @brief Allocate dynamic memory. @@ -380,7 +398,8 @@ extern UINT32 LOS_MemInit(VOID *pool, UINT32 size); * @since Huawei LiteOS V100R001C00 */ extern VOID *LOS_MemAlloc(VOID *pool, UINT32 size); - +/*ͨúԶ̬شڴлȡһָСڴ飬ʱڴ󡣷ڴԸʵҪжд +ڲҪʱͨӦڴͷźͷźͻա*/ /** * @ingroup los_memory * @brief Free dynamic memory. @@ -444,7 +463,7 @@ extern UINT32 LOS_MemFree(VOID *pool, VOID *ptr); * @since Huawei LiteOS V100R001C00 */ extern VOID *LOS_MemRealloc(VOID *pool, VOID *ptr, UINT32 size); - +//ͨúԶ̬صѷڴĴСʱ̬仯ڴ /** * @ingroup los_memory * @brief Allocate aligned memory. @@ -472,7 +491,9 @@ extern VOID *LOS_MemRealloc(VOID *pool, VOID *ptr, UINT32 size); * @since Huawei LiteOS V100R001C00 */ extern VOID *LOS_MemAllocAlign(VOID *pool, UINT32 size, UINT32 boundary); - +/*ͨúԶ̬شڴлȡһָСҪڴ飬 +ʱڴ󡣷ڴԸʵҪжд +ڲҪʱͨӦڴͷźͷźͻա*/ /** * @ingroup los_memory * @brief Get the size of memory pool's size. @@ -613,7 +634,9 @@ extern UINTPTR LOS_MemLastUsedGet(VOID *pool); * @since Huawei LiteOS V100R001C00 */ extern UINT32 LOS_MemInfoGet(VOID *pool, LOS_MEM_POOL_STATUS *poolStatus); +/*øúȡָڴص״̬Ϣ䱣浽ָ LOS_MEM_POOL_STATUS ṹСȡɹ LOS_OK򷵻ش롣 +ͨúԻȡǰڴصʹõʣϢԱڽڴŻ*/ /** * @ingroup los_memory * @brief Get the number of free node in every size. @@ -658,6 +681,10 @@ extern UINT32 LOS_MemFreeNodeShow(VOID *pool); extern UINT32 LOS_MemIntegrityCheck(VOID *pool); #ifdef LOSCFG_BASE_MEM_NODE_SIZE_CHECK +/*øúָڴؽԼ飬ȷڴзڴû𻵻Խ⡣ͨ LOS_OK򷵻ش롣 + +ڴлһĺ궨 #ifdef LOSCFG_BASE_MEM_NODE_SIZE_CHECKжǷ˻ڴڵСļ顣ú궨Ϊ棬 +ִӦĴ߼Ըòִ롣*/ /** * @ingroup los_memory * @brief Check the size of the specified memory node. @@ -690,7 +717,9 @@ extern UINT32 LOS_MemIntegrityCheck(VOID *pool); * @since Huawei LiteOS V100R001C00 */ extern UINT32 LOS_MemNodeSizeCheck(VOID *pool, VOID *ptr, UINT32 *totalSize, UINT32 *availSize); +/*øúָڴиڴڵĴСܴСͿôСֱ𱣴浽ָıСɹ LOS_OK򷵻ش롣 +ʹøúԻָڴڵܴСͿôСϢڶ̬ڴڵ㡢ڴԼŻڴʹ÷dzá*/ /** * @ingroup los_memory * @brief Set the memory check level. diff --git a/src/kernel/include/los_mux.h b/src/kernel/include/los_mux.h index 73c5b27..8ef776e 100644 --- a/src/kernel/include/los_mux.h +++ b/src/kernel/include/los_mux.h @@ -54,7 +54,10 @@ extern "C" { * Solution: Decrease the number of mutexes defined by LOSCFG_BASE_IPC_MUX_LIMIT. */ #define LOS_ERRNO_MUX_NO_MEMORY LOS_ERRNO_OS_ERROR(LOS_MOD_MUX, 0x00) +/*δ붨һΪ LOS_ERRNO_MUX_NO_MEMORY ĺ꣬ڱʾڴʧܵĴ롣 +LOS_ERRNO_OS_ERROR һ꣬ɾģʹĴֵLOS_MOD_MUX ʾģǻģ飬 +0x00 Ǹôڸģеľֵ*/ /** * @ingroup los_mux * Mutex error code: The mutex is not usable. @@ -64,7 +67,7 @@ extern "C" { * Solution: Check whether the mutex ID and the mutex state are applicable for the current operation. */ #define LOS_ERRNO_MUX_INVALID LOS_ERRNO_OS_ERROR(LOS_MOD_MUX, 0x01) - +//LOS_ERRNO_OS_ERROR һ꣬ɾģʹĴֵLOS_MOD_MUX ʾģǻģ飬0x01 Ǹôڸģеľֵ /** * @ingroup los_mux * Mutex error code: Null pointer. @@ -74,7 +77,8 @@ extern "C" { * Solution: Check whether the input parameter is usable. */ #define LOS_ERRNO_MUX_PTR_NULL LOS_ERRNO_OS_ERROR(LOS_MOD_MUX, 0x02) - +//δ붨һΪ LOS_ERRNO_MUX_PTR_NULL ĺ꣬ڱʾָΪյĴ롣 +//LOS_ERRNO_OS_ERROR һ꣬ɾģʹĴֵLOS_MOD_MUX ʾģǻģ飬0x02 Ǹôڸģеľֵ /** * @ingroup los_mux * Mutex error code: No mutex is available and the mutex request fails. @@ -84,7 +88,9 @@ extern "C" { * Solution: Increase the number of mutexes defined by LOSCFG_BASE_IPC_MUX_LIMIT. */ #define LOS_ERRNO_MUX_ALL_BUSY LOS_ERRNO_OS_ERROR(LOS_MOD_MUX, 0x03) +/*δ붨һΪ LOS_ERRNO_MUX_ALL_BUSY ĺ꣬ڱʾȫռõĴ롣 +LOS_ERRNO_OS_ERROR һ꣬ɾģʹĴֵLOS_MOD_MUX ʾģǻģ飬0x03 Ǹôڸģеľֵ*/ /** * @ingroup los_mux * Mutex error code: The mutex fails to be locked in non-blocking mode because it is locked by another thread. @@ -94,7 +100,9 @@ extern "C" { * Solution: Lock the mutex after it is unlocked by the thread that owns it, or set a waiting time. */ #define LOS_ERRNO_MUX_UNAVAILABLE LOS_ERRNO_OS_ERROR(LOS_MOD_MUX, 0x04) +/*δ붨һΪ LOS_ERRNO_MUX_UNAVAILABLE ĺ꣬ڱʾõĴ롣 +LOS_ERRNO_OS_ERROR һ꣬ɾģʹĴֵLOS_MOD_MUX ʾģǻģ飬0x04 Ǹôڸģеľֵ*/ /** * @ingroup los_mux * Mutex error code: The mutex is being locked during an interrupt. @@ -104,7 +112,9 @@ extern "C" { * Solution: Check whether the mutex is being locked during an interrupt. */ #define LOS_ERRNO_MUX_PEND_INTERR LOS_ERRNO_OS_ERROR(LOS_MOD_MUX, 0x05) + /*δ붨һΪ LOS_ERRNO_MUX_PEND_INTERR ĺ꣬ڱʾȴʱжϴĴ롣 +LOS_ERRNO_OS_ERROR һ꣬ɾģʹĴֵLOS_MOD_MUX ʾģǻģ飬0x05 Ǹôڸģеľֵ*/ /** * @ingroup los_mux * Mutex error code: A thread locks a mutex after waiting for the mutex to be unlocked by another thread @@ -116,7 +126,9 @@ extern "C" { * thread will not wait for the mutex to become available. */ #define LOS_ERRNO_MUX_PEND_IN_LOCK LOS_ERRNO_OS_ERROR(LOS_MOD_MUX, 0x06) +/*δ붨һΪ LOS_ERRNO_MUX_PEND_IN_LOCK ĺ꣬ڱʾڻϵȴʱĴ롣 +LOS_ERRNO_OS_ERROR һ꣬ɾģʹĴֵLOS_MOD_MUX ʾģǻģ飬0x06 Ǹôڸģеľֵ*/ /** * @ingroup los_mux * Mutex error code: The mutex locking times out. @@ -126,7 +138,7 @@ extern "C" { * Solution: Increase the waiting time or set the waiting time to LOS_WAIT_FOREVER (forever-blocking mode). */ #define LOS_ERRNO_MUX_TIMEOUT LOS_ERRNO_OS_ERROR(LOS_MOD_MUX, 0x07) - +//LOS_ERRNO_OS_ERROR һ꣬ɾģʹĴֵLOS_MOD_MUX ʾģǻģ飬0x07 Ǹôڸģеľֵ /** * @ingroup los_mux * The error code is not in use temporarily. @@ -175,7 +187,9 @@ extern "C" { * @deprecated This error code is obsolete since LiteOS 5.0.0. */ #define LOS_ERRNO_MUX_PEND_IN_SYSTEM_TASK LOS_ERRNO_OS_ERROR(LOS_MOD_MUX, 0x0C) +/* LOS_ERRNO_OS_ERROR һ꺯ɴ롣ú꺯ģźʹ롣ģΪ LOS_MOD_MUXΪ 0x0C +ͨ궨壬Էʶ𲢴ϵͳʹûźʱĴ*/ /** * @ingroup los_mux * @brief Create a mutex. @@ -261,7 +275,14 @@ extern UINT32 LOS_MuxDelete(UINT32 muxHandle); * @since Huawei LiteOS V100R001C00 */ extern UINT32 LOS_MuxPend(UINT32 muxHandle, UINT32 timeout); +/*˵ + +muxHandleźźɹ󷵻صֵ +timeoutȴźijʱʱ䣬λΪϵͳʱӽġΪ0ʾõȴ +ֵ˵ + LOS_OK ʾɹȡź +شʾȡźʧܣڴIJЧ߳ʱԭ¡*/ /** * @ingroup los_mux * @brief Release a mutex. diff --git a/src/kernel/include/los_perf.h b/src/kernel/include/los_perf.h index b026162..b075948 100644 --- a/src/kernel/include/los_perf.h +++ b/src/kernel/include/los_perf.h @@ -75,7 +75,12 @@ enum PerfStatus { PERF_STARTED, /**< perf is started */ PERF_STOPED, /**< perf is stopped */ }; +/*ö PerfStatus öٳ +PERF_UNINITʾܼδʼ״̬ +PERF_STARTEDʾܼѾʼ״̬ +PERF_STOPEDʾܼѾֹͣ״̬ +ͨʹöͣԷرʾжܼصĵǰ״̬*/ /** * @ingroup los_perf * Define the type of the perf sample data buffer water mark hook function. @@ -182,7 +187,13 @@ enum PerfEventType { PERF_EVENT_TYPE_MAX }; +/*ö PerfEventType ĸöٳ +PERF_EVENT_TYPE_HWʾӲ¼ͣڱʾͨӲ¼ +PERF_EVENT_TYPE_TIMEDʾʱ¼ͣڱʾ߾ȶʱʱ¼ +PERF_EVENT_TYPE_SWʾ¼ͣڱʾ¼ +PERF_EVENT_TYPE_RAWʾԭʼ¼ͣڱʾӲ¼ڶӦļܹͷļйö PmuEventType Ķ塣 +ͨʹöͣԷرʾֲͬ͵¼ڴнд͹*/ /** * @ingroup los_perf * Common hardware pmu events @@ -199,7 +210,17 @@ enum PmuHwId { PERF_COUNT_HW_MAX, }; - +/*ö PmuHwId ˶öٳÿһӲ¼ + +PERF_COUNT_HW_CPU_CYCLESʾ CPU ѭ¼ +PERF_COUNT_HW_INSTRUCTIONSʾִָ¼ +PERF_COUNT_HW_DCACHE_REFERENCESʾݻ¼ +PERF_COUNT_HW_DCACHE_MISSESʾݻȱʧ¼ +PERF_COUNT_HW_ICACHE_REFERENCESʾָ¼ +PERF_COUNT_HW_ICACHE_MISSESʾָȱʧ¼ +PERF_COUNT_HW_BRANCH_INSTRUCTIONSʾָ֧¼ +PERF_COUNT_HW_BRANCH_MISSESʾ֧ȱʧ¼ +ͨʹö͵ijָҪصӲ¼ڴнúͳơ*/ /** * @ingroup los_perf * Common hrtimer timed events @@ -220,7 +241,13 @@ enum PmuSwId { PERF_COUNT_SW_MAX, }; +/*ö PmuSwId ˶öٳÿһ¼ +PERF_COUNT_SW_TASK_SWITCHʾл¼ +PERF_COUNT_SW_IRQ_RESPONSEʾжӦ¼ +PERF_COUNT_SW_MEM_ALLOCʾڴ¼ +PERF_COUNT_SW_MUX_PENDʾ¼ +ͨʹö͵ijָҪص¼ڴнúͳơ*/ /** * @ingroup los_perf * perf sample data types @@ -235,7 +262,16 @@ enum PerfSampleType { PERF_RECORD_IP = 1U << 5, /**< record instruction pointer */ PERF_RECORD_CALLCHAIN = 1U << 6, /**< record backtrace */ }; - +/*ö PerfSampleType ˶öٳÿһIJͣ + +PERF_RECORD_CPU¼ǰ CPU ID +PERF_RECORD_TID¼ǰ ID +PERF_RECORD_TYPE¼¼͡ +PERF_RECORD_PERIOD¼¼ڡ +PERF_RECORD_TIMESTAMP¼ʱ +PERF_RECORD_IP¼ָָ롣 +PERF_RECORD_CALLCHAIN¼Ϣ +ͨʹö͵ijԷرʾֲͬ͵ܲݣڴнд͹*/ /** * @ingroup los_perf * perf configuration sub event information @@ -253,7 +289,12 @@ typedef struct { BOOL predivided; /**< whether to prescaler (once every 64 counts), which only take effect on cpu cycle hardware event */ } PerfEventConfig; - +/*typeʾ¼ͣһ UINT32 ͵ֵӦ PerfEventType ö١ +eventsһ飬ڴ洢¼ϢÿԪضԱ +eventIdʾض¼ıʶһ UINT32 ͵ֵ +periodʾ¼ڣÿٴ¼ʱ¼һһ UINT32 ͵ֵ +eventsNrʾܹ¼һ UINT32 ͵ֵ +predividedʾǷԤƵÿ64һΣCPUѭӲ¼Чһ BOOL ͵ֵڱʾǷԤƵ*/ /** * @ingroup los_perf * perf configuration main information @@ -279,7 +320,17 @@ extern VOID OsPerfHook(UINT32 event); #else #define LOS_PERF(EVENT) #endif +/*PerfConfigAttr ṹ³Ա + +eventsCfgʾ¼Ϣһ PerfEventConfig ṹ͵ֵ +taskIdsʾ ID Ĺбһ UINT32 ͵飬Դ洢 PERF_MAX_FILTER_TSKS ID +taskIdsNrʾ ID һ UINT32 ͵ֵ +sampleTypeʾҪͣһ UINT32 ͵ֵӦ PerfSampleType ö١ +needSampleʾǷҪݣһ BOOL ͵ֵ +taskFilterEnableʾǷһ BOOL ͵ֵ +OsPerfHook ڴ¼Ļصһ UINT32 ͵IJ eventʾ¼͡ +LOS_PERF 궨ڴ¼ϵͳ LOSCFG_KERNEL_PERF LOSCFG_PERF_SW_PMU ꣬ OsPerfHook úΪղ*/ /** * @ingroup los_perf * @brief Init perf. diff --git a/src/kernel/include/los_printf.h b/src/kernel/include/los_printf.h index 67fa9cf..adc7ca7 100644 --- a/src/kernel/include/los_printf.h +++ b/src/kernel/include/los_printf.h @@ -46,7 +46,14 @@ extern "C" { #ifdef LOSCFG_SHELL_LK extern void LOS_LkPrint(int level, const char *func, int line, const char *fmt, ...); #endif +/*LOS_LkPrint ² +levelʾӡϢļһ +funcʾӡϢĺһַָָ롣 +lineʾӡϢڵкţһ +fmtʾӡϢĸʽַһַָָ롣 +...ʾɱбڸݸʽַӡӦϢݡ +úڲϵͳдӡϢԸݲͬļ͸ʽӡͬϢڵԻ¼ʱϢʵֿط塣*/ /** * @ingroup los_printf * log print level definition, LOS_EMG_LEVEL is set to 0, it means the log is emergency. @@ -97,7 +104,14 @@ extern void LOS_LkPrint(int level, const char *func, int line, const char *fmt, #endif typedef VOID (*pf_OUTPUT)(const CHAR *fmt, ...); +/*δ붨һΪ PRINT_LEVEL ĺԼһΪ pf_OUTPUT ĺָ͡ +PRINT_LEVEL жǷΪ LOS_DEBUG_LEVEL LOS_ERR_LEVEL + + LOSCFG_SHELL_LK 壬 PRINT_LEVEL Ϊ LOS_DEBUG_LEVEL + PRINT_LEVEL Ϊ LOS_ERR_LEVEL +pf_OUTPUT һָָͣһֵΪ VOID ĺ +úһʽַ fmt Ϳɱб ...úָͿָӦָʹúĵÿָͨС*/ /** * @ingroup los_printf * @brief Format and print data. @@ -153,7 +167,15 @@ extern void dprintf(const char *fmt, ...); #endif #endif #endif +/* PRINT_DEBUG δʱͨж PRINT_LEVEL ǷС LOS_DEBUG_LEVELǣ PRINT_DEBUG 궨Ϊղ򣬽һ롣 + + LOSCFG_SHELL_LK ʱPRINT_DEBUG 걻Ϊ LOS_LkPrint + [DEBUG] ־ϢеһΪ־ LOS_DEBUG_LEVEL +ڶΪǰ __FUNCTION__Ϊǰк __LINE__ +ĸΪʽַ fmtĿɱб ... +ڲʽַռλֵ +PRINT_DEBUG 걻Ϊ [DEBUG] ־Ϣ̨*/ /** * @ingroup los_printf * @brief Format and print information log. @@ -187,7 +209,15 @@ extern void dprintf(const char *fmt, ...); #endif #endif #endif +/* PRINT_INFO δʱͨж PRINT_LEVEL ǷС LOS_INFO_LEVEL +ǣ PRINT_INFO 궨Ϊղ򣬽һ롣 + LOSCFG_SHELL_LK ʱPRINT_INFO 걻Ϊ LOS_LkPrint + [INFO] ־ϢеһΪ־ LOS_INFO_LEVEL +ڶΪǰ __FUNCTION__Ϊǰк __LINE__ +ĸΪʽַ fmtĿɱб ... ڲʽַռλֵ + +PRINT_INFO 걻Ϊ [INFO] ־Ϣ̨*/ /** * @ingroup los_printf * @brief Format and print warning log. @@ -221,7 +251,14 @@ extern void dprintf(const char *fmt, ...); #endif #endif #endif +/* PRINT_WARN δʱͨж PRINT_LEVEL ǷС LOS_WARN_LEVELǣ PRINT_WARN 궨Ϊղ򣬽һ롣 + + LOSCFG_SHELL_LK ʱPRINT_WARN 걻Ϊ LOS_LkPrint + [WARN] ־ϢеһΪ־ LOS_WARN_LEVEL +ڶΪǰ __FUNCTION__Ϊǰк __LINE__ +ĸΪʽַ fmtĿɱб ... ڲʽַռλֵ +PRINT_WARN 걻Ϊ [WARN] ־Ϣ̨*/ /** * @ingroup los_printf * @brief Format and print error log. @@ -255,7 +292,14 @@ extern void dprintf(const char *fmt, ...); #endif #endif #endif +/* PRINT_ERR δʱͨж PRINT_LEVEL ǷС LOS_ERR_LEVELǣ PRINT_ERR 궨Ϊղ򣬽һ롣 + LOSCFG_SHELL_LK ʱPRINT_ERR 걻Ϊ LOS_LkPrint + [ERR] ־ϢеһΪ־ LOS_ERR_LEVEL +ڶΪǰ __FUNCTION__Ϊǰк __LINE__ +ĸΪʽַ fmtĿɱб ... ڲʽַռλֵ + +PRINT_ERR 걻Ϊ [ERR] ־Ϣ̨*/ /** * @ingroup los_printf * @brief Format and print common log. @@ -287,7 +331,16 @@ extern void dprintf(const char *fmt, ...); #endif #endif #endif +/*δ붨һΪ PRINTK ĺꡣ + + PRINTK δʱͨж PRINT_LEVEL ǷС LOS_COMMOM_LEVELǣ PRINTK 궨Ϊղ򣬽һ롣 + LOSCFG_SHELL_LK ʱPRINTK 걻Ϊ LOS_LkPrint + [COMM] ־ϢеһΪ־ LOS_COMMOM_LEVEL +ڶΪǰ __FUNCTION__Ϊǰк __LINE__ +ĸΪʽַ fmtĿɱб ... ڲʽַռλֵ + +PRINTK 걻Ϊʽַ̨*/ /** * @ingroup los_printf * @brief Format and print emergency log. @@ -317,7 +370,11 @@ extern void dprintf(const char *fmt, ...); } while (0) #endif #endif +/*δ붨һΪ PRINT_EMG ĺꡣ + + PRINT_EMG δʱͨж PRINT_LEVEL ǷС LOS_EMG_LEVELǣ PRINT_EMG 궨Ϊղ򣬽һ롣 + PRINT_LEVEL ڵ LOS_EMG_LEVEL ʱPRINT_EMG 걻Ϊ [EMG] ־Ϣ̨*/ /** * @ingroup los_printf * @brief Format and print log. diff --git a/src/kernel/include/los_queue.h b/src/kernel/include/los_queue.h index 093ef2e..a4ffe5e 100644 --- a/src/kernel/include/los_queue.h +++ b/src/kernel/include/los_queue.h @@ -55,7 +55,9 @@ extern "C" { * @deprecated This error code is obsolete since LiteOS 5.0.0. */ #define LOS_ERRNO_QUEUE_MAXNUM_ZERO LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x00) +/*Ķʹ LOS_ERRNO_OS_ERROR ָ꣬˲ LOS_MOD_QUE 0x00Ʋ⣬LOS_MOD_QUE DZʾصģ顣 +úһ룬ڱʾеΪĴĴֵط塣*/ /** * @ingroup los_queue * Queue error code: The queue block memory fails to be initialized. @@ -66,7 +68,11 @@ extern "C" { * number of queue resources. */ #define LOS_ERRNO_QUEUE_NO_MEMORY LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x01) +/*δ붨һΪ LOS_ERRNO_QUEUE_NO_MEMORY ĺ꣬ڱʾзڴʧʱĴ롣 +Ķʹ LOS_ERRNO_OS_ERROR ָ꣬˲ LOS_MOD_QUE 0x01Ʋ⣬LOS_MOD_QUE DZʾصģ顣 + +úһ룬ڱʾзڴʧܵĴĴֵط塣*/ /** * @ingroup los_queue * Queue error code: The memory for queue creation fails to be requested. @@ -77,7 +83,11 @@ extern "C" { * the number of nodes in the queue to be created. */ #define LOS_ERRNO_QUEUE_CREATE_NO_MEMORY LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x02) +/*δ붨һΪ LOS_ERRNO_QUEUE_CREATE_NO_MEMORY ĺ꣬ڱʾʱڴʧܵĴ롣 + +úʹ LOS_ERRNO_OS_ERROR ָ꣬˲ LOS_MOD_QUE 0x02Ʋ⣬LOS_MOD_QUE DZʾصģ顣 +ˣúһ룬ڱʾʱڴʧܵĴĴֵط塣*/ /** * @ingroup los_queue * Queue error code: The size of the biggest message in the created queue is too big. @@ -87,6 +97,9 @@ extern "C" { * Solution: Change the size of the biggest message in the created queue. */ #define LOS_ERRNO_QUEUE_SIZE_TOO_BIG LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x03) + /*Ķʹ LOS_ERRNO_OS_ERROR ָ꣬˲ LOS_MOD_QUE 0x00Ʋ⣬LOS_MOD_QUE DZʾصģ顣 + + úһ룬ڱʾеΪĴĴֵط塣*/ /** * @ingroup los_queue @@ -97,6 +110,11 @@ extern "C" { * Solution: Increase the configured number of resources for queues. */ #define LOS_ERRNO_QUEUE_CB_UNAVAILABLE LOS_ERRNO_OS_ERROR(LOS_MOD_QUE, 0x04) + /*δ붨һΪ LOS_ERRNO_QUEUE_NO_MEMORY ĺ꣬ڱʾзڴʧʱĴ롣 + + Ķʹ LOS_ERRNO_OS_ERROR ָ꣬˲ LOS_MOD_QUE 0x01Ʋ⣬LOS_MOD_QUE DZʾصģ顣 + + úһ룬ڱʾзڴʧܵĴĴֵط塣*/ /** * @ingroup los_queue @@ -356,6 +374,21 @@ typedef struct tagQueueInfo { } QUEUE_INFO_S; #ifdef LOSCFG_QUEUE_STATIC_ALLOCATION +/*δ붨һṹ QUEUE_INFO_SУQueueϢ + +Ա£ + +uwQueueID ID +usQueueLenгȣнڵ +usQueueSizeÿڵĴС +usQueueHeadͷڵλãһ±ꡣ +usQueueTailβڵλãһ±ꡣ +usWritableCntдԴ +usReadableCntɶȡԴ +uwWaitReadTaskȴȡϢһ 64 λ޷ÿλʾһ IDˣԱʾ 64 ID 63 +uwWaitWriteTaskȴдϢͬ uwWaitReadTask +uwWaitMemTaskȴڴͬ uwWaitReadTask + LOSCFG_QUEUE_STATIC_ALLOCATION 壬ṹڶ̬ڴʱá*/ /** * @ingroup los_queue * @brief Create a message queue. @@ -397,7 +430,16 @@ extern UINT32 LOS_QueueCreateStatic(const CHAR *queueName, VOID *queueMem, UINT16 memSize); #endif +/*úھ̬һУQueue£ +queueNameеƣΪ const CHAR* +lenеijȣнڵΪ UINT16 +queueIdָһ UINT32 ͵ָ룬ڴ洢õĶ ID +flagsеı־Ϊ UINT32 +maxMsgSizeÿڵϢСΪ UINT16 +queueMemָԤĶڴָ룬Ϊ VOID* +memSizeԤĶڴĴСΪ UINT16 +úԤľ̬ڴռϴһУضе ID*/ /** * @ingroup los_queue * @brief Create a message queue. @@ -431,7 +473,14 @@ extern UINT32 LOS_QueueCreate(const CHAR *queueName, UINT32 *queueId, UINT32 flags, UINT16 maxMsgSize); +/*úڶ̬һУQueue£ +queueNameеƣΪ const CHAR* +lenеijȣнڵΪ UINT16 +queueIdָһ UINT32 ͵ָ룬ڴ洢õĶ ID +flagsеı־Ϊ UINT32 +maxMsgSizeÿڵϢСΪ UINT16 +úʱ̬ڴռһУضе ID*/ /** * @ingroup los_queue * @brief Read a queue. @@ -481,7 +530,7 @@ extern UINT32 LOS_QueueReadCopy(UINT32 queueId, VOID *bufferAddr, UINT32 *bufferSize, UINT32 timeout); - +/*úǴӶжȡݣݸƵָĻСûݿɶݳʱʱȴݿɶڳʱʱȻûݿɶ򷵻ش롣*/ /** * @ingroup los_queue * @brief Write data into a queue. @@ -529,7 +578,13 @@ extern UINT32 LOS_QueueWriteCopy(UINT32 queueId, VOID *bufferAddr, UINT32 bufferSize, UINT32 timeout); +/*úָĶдݣ£ +queueIdҪдݵĶ IDΪ UINT32 +bufferAddrָдݵĻַΪ VOID* +bufferSizeдݵĴСΪ UINT32 +timeoutдݵijʱʱ䣬λΪ TickΪ 0ʾȴءΪ LOS_WAIT_FOREVERʾһֱȴֱпռдΪֹΪ UINT32 +úдݣݳʱʱȴռд룬ڳʱʱȻûпռд룬򷵻ش롣*/ /** * @ingroup los_queue * @brief Read a queue. @@ -581,7 +636,13 @@ extern UINT32 LOS_QueueRead(UINT32 queueId, VOID *bufferAddr, UINT32 bufferSize, UINT32 timeout); +/*úڴָĶжȡݣ£ +queueIdҪȡݵĶ IDΪ UINT32 +bufferAddrָ洢ȡݵĻַΪ VOID* +bufferSizeָĴСȡݴСΪ UINT32 +timeoutȡݵijʱʱ䣬λΪ TickΪ 0ʾȴءΪ LOS_WAIT_FOREVERʾһֱȴֱݿɶΪֹΪ UINT32 +úǴӶжȡݲ洢ָĻСû㹻ݿɶݳʱʱȴݿɶڳʱʱȻû㹻ݿɶ򷵻ش롣*/ /** * @ingroup los_queue * @brief Write data into a queue. @@ -630,7 +691,13 @@ extern UINT32 LOS_QueueWrite(UINT32 queueId, VOID *bufferAddr, UINT32 bufferSize, UINT32 timeout); +/*úָĶдݣ£ +queueIdҪдݵĶ IDΪ UINT32 +bufferAddrָдݵĻַΪ VOID* +bufferSizeдݵĴСΪ UINT32 +timeoutдݵijʱʱ䣬λΪ TickΪ 0ʾȴءΪ LOS_WAIT_FOREVERʾһֱȴֱпռдΪֹΪ UINT32 +úдݣݳʱʱȴռд룬ڳʱʱȻûпռд룬򷵻ش롣*/ /** * @ingroup los_queue * @brief Write data into a queue header. @@ -679,7 +746,13 @@ extern UINT32 LOS_QueueWriteHead(UINT32 queueId, VOID *bufferAddr, UINT32 bufferSize, UINT32 timeout); +/*úָеĶдݣ£ +queueIdҪдݵĶ IDΪ UINT32 +bufferAddrָдݵĻַΪ VOID* +bufferSizeдݵĴСΪ UINT32 +timeoutдݵijʱʱ䣬λΪ TickΪ 0ʾȴءΪ LOS_WAIT_FOREVERʾһֱȴֱпռдΪֹΪ UINT32 +úеĶдݣݳʱʱȴռд룬ڳʱʱȻûпռд룬򷵻ش롣дݵ׿ܻᵼ¶ԭݱ*/ /** * @ingroup los_queue * @brief Write data into a queue header. diff --git a/src/kernel/include/los_ringbuf.h b/src/kernel/include/los_ringbuf.h index b56971d..4f362af 100644 --- a/src/kernel/include/los_ringbuf.h +++ b/src/kernel/include/los_ringbuf.h @@ -51,7 +51,14 @@ typedef enum { RBUF_UNINIT, /**< Ringbuf is not inited. */ RBUF_INITED /**< Ringbuf is inited. */ } RingbufStatus; +/*δ붨һΪ RingbufStatus öͣʾλ״̬ +öͰöֵ + +RBUF_UNINITʾλδʼ +RBUF_INITEDʾλѾʼ +ͨʹöͣԷرʶжϻλ״̬ +ʹûλʱԸݲͬ״̬ӦIJ*/ /** * @ingroup los_ringbuf * Ringbuf information structure. @@ -66,7 +73,18 @@ typedef struct { RingbufStatus status; /**< Ringbuf status */ CHAR *fifo; /**< Buf to store data */ } Ringbuf; +/*δ붨һΪ Ringbuf Ľṹ壬ڱʾλԺ״̬ + +ýṹ³Ա +startIdxλĶȡ +endIdxλд +sizeλܴС +remainλʣÿռС +lockڶȡд +statusλ״̬Ϊ RingbufStatus ö͡ +fifoڴ洢ݵĻ +ͨṹ壬ԷعλԺ״̬Ӧݶд*/ /** * @ingroup los_ringbuf * @brief Init a ringbuf. @@ -89,7 +107,8 @@ typedef struct { * @since Huawei LiteOS V200R005C00 */ extern UINT32 LOS_RingbufInit(Ringbuf *ringbuf, CHAR *fifo, UINT32 size); - +/*úǸݸIJʼλ󣬲ҪԴͨԽһѾ Ringbuf +ṹָĻóʼ״̬ԡ*/ /** * @ingroup los_ringbuf * @brief Reset a ringbuf. @@ -131,7 +150,9 @@ extern VOID LOS_RingbufReset(Ringbuf *ringbuf); * @since Huawei LiteOS V200R005C00 */ extern UINT32 LOS_RingbufWrite(Ringbuf *ringbuf, const CHAR *buf, UINT32 size); +/*úǽָСݴԴд뵽Ŀ껷λСд»λдҪѭݡλĿռ䲻ȫݣֻд벿ݡ +ͨԷؽд뵽λУʵݵѭ洢͸ǡ*/ /** * @ingroup los_ringbuf * @brief Read data from ringbuf. @@ -153,7 +174,9 @@ extern UINT32 LOS_RingbufWrite(Ringbuf *ringbuf, const CHAR *buf, UINT32 size); * @since Huawei LiteOS V200R005C00 */ extern UINT32 LOS_RingbufRead(Ringbuf *ringbuf, CHAR *buf, UINT32 size); +/*úǴָСжȡݣ洢Ŀ껺ȡ»λĶȡҪѭȡݡλеݲȫȡֻȡݡ +ͨԷشӻλжȡݣʵݵѭȡ͸ǡ*/ /** * @ingroup los_ringbuf * @brief Get a ringbuf's used size.