mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-05-31 15:41:02 +08:00
Merge branch 'feature/simplify_xtensa_code' into 'master'
Simplify xtensa platform code See merge request sdk/ESP8266_RTOS_SDK!862
This commit is contained in:
@ -20,6 +20,7 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ETS_INT_MASK 0x00003FFF
|
||||
#define ESP_TICKS_MAX UINT32_MAX
|
||||
|
||||
typedef uint32_t esp_tick_t;
|
||||
@ -63,6 +64,70 @@ static inline void soc_restore_local_irq(esp_irqflag_t flag)
|
||||
);
|
||||
}
|
||||
|
||||
static inline void soc_set_ccompare(uint32_t ticks)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"wsr %0, ccompare0\n"
|
||||
:
|
||||
: "a"(ticks)
|
||||
: "memory"
|
||||
);
|
||||
}
|
||||
|
||||
static inline uint32_t soc_get_ccompare(void)
|
||||
{
|
||||
uint32_t ticks;
|
||||
|
||||
__asm__ __volatile__(
|
||||
"rsr %0, ccompare0\n"
|
||||
: "=a"(ticks)
|
||||
:
|
||||
: "memory"
|
||||
);
|
||||
|
||||
return ticks;
|
||||
}
|
||||
|
||||
static inline uint32_t soc_get_ccount(void)
|
||||
{
|
||||
uint32_t ticks;
|
||||
|
||||
__asm__ __volatile__(
|
||||
"rsr %0, ccount\n"
|
||||
: "=a"(ticks)
|
||||
:
|
||||
: "memory"
|
||||
);
|
||||
|
||||
return ticks;
|
||||
}
|
||||
|
||||
static inline void soc_clear_int_mask(uint32_t mask)
|
||||
{
|
||||
__asm__ __volatile__(
|
||||
"wsr %0, intclear\n"
|
||||
:
|
||||
: "a"(mask)
|
||||
: "memory"
|
||||
);
|
||||
}
|
||||
|
||||
static inline uint32_t soc_get_int_mask(void)
|
||||
{
|
||||
uint32_t mask, enable;
|
||||
|
||||
__asm__ __volatile__(
|
||||
"rsr %0, interrupt\n"
|
||||
"rsr %1, intenable\n"
|
||||
"rsync\n"
|
||||
: "=a"(mask), "=a"(enable)
|
||||
:
|
||||
: "memory"
|
||||
);
|
||||
|
||||
return mask & enable & ETS_INT_MASK;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user