fix(newlib): Fix application disable intterupt then call newlib internal mutex function

This commit is contained in:
Dong Heng
2018-07-30 19:47:46 +08:00
parent 95d915317b
commit 8e50ff353a
3 changed files with 29 additions and 0 deletions

View File

@ -224,6 +224,13 @@ void esp_mem_trace(const void *ptr, const char *trace, int no);
*/
#define esp_mem_mark_file(ptr) esp_mem_trace((ptr), __FILE__, LINE__)
/*
* @brief check if CPU core interrupt is disable
*
* @return true if interrupt is disable or false
*/
bool interrupt_is_disable(void);
#ifdef __cplusplus
}
#endif

View File

@ -300,6 +300,20 @@ void ResetCcountVal(unsigned int cnt_val)
asm volatile("wsr a2, ccount");
}
/*
* @brief check if CPU core interrupt is disable
*/
bool interrupt_is_disable(void)
{
uint32_t tmp;
__asm__ __volatile__ (
"rsr %0, PS\n"
: "=a"(tmp) : : "memory");
return tmp & 0xFUL ? true : false;
}
_xt_isr_entry isr[16];
char _xt_isr_status = 0;