mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-25 17:58:46 +00:00
Optimize xPortGetCoreID to 2-instruction inline assembly.
This commit is contained in:
@@ -192,8 +192,7 @@ void vPortEndScheduler( void ) PRIVILEGED_FUNCTION;
|
||||
#endif
|
||||
|
||||
/* Multi-core: get current core ID */
|
||||
int xPortGetCoreID( void );
|
||||
|
||||
#define xPortGetCoreID() __extension__({int id; asm volatile("rsr.prid %0; extui %0,%0,13,1":"=r"(id)); id;})
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@@ -322,12 +322,7 @@ STRUCT_END(XtSolFrame)
|
||||
#ifdef __ASSEMBLER__
|
||||
.macro getcoreid reg
|
||||
rsr.prid \reg
|
||||
bbci \reg,1,1f
|
||||
movi \reg,1
|
||||
j 2f
|
||||
1:
|
||||
movi \reg,0
|
||||
2:
|
||||
extui \reg,\reg,13,1
|
||||
.endm
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user