Skip to content
Snippets Groups Projects
Unverified Commit 0c138b89 authored by CNLohr's avatar CNLohr Committed by GitHub
Browse files

Merge pull request #257 from mrx23dot/isr_asm

added __isenabled_irq __get_cpu_sp, minor linting
parents 2fa932a6 b3a4ef4a
No related branches found
No related tags found
No related merge requests found
......@@ -4563,6 +4563,45 @@ RV_STATIC_INLINE void __disable_irq()
__asm volatile ("csrw mstatus, %0" : : "r" (result) );
}
/*********************************************************************
* @fn __isenabled_irq
*
* @brief Is Global Interrupt enabled
*
* @return 1: yes, 0: no
*/
RV_STATIC_INLINE uint8_t __isenabled_irq(void)
{
uint32_t result;
__asm volatile(
#if __GNUC__ > 10
".option arch, +zicsr\n"
#endif
"csrr %0," "mstatus": "=r"(result));
return (result & 0x08) != 0u;
}
/*********************************************************************
* @fn __get_cpu_sp
*
* @brief Get stack pointer
*
* @return stack pointer
*/
RV_STATIC_INLINE uint32_t __get_cpu_sp(void);
RV_STATIC_INLINE uint32_t __get_cpu_sp(void)
{
uint32_t result;
__asm volatile(
#if __GNUC__ > 10
".option arch, +zicsr\n"
#endif
"mv %0, sp" : "=r"(result));
return result;
}
/*********************************************************************
* @fn __NOP
*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment