Skip to content

Commit

Permalink
cpu/msp430: use SR alias instead of r2
Browse files Browse the repository at this point in the history
The register r2 is the status register, which has the SR alias. Using
SR is a lot more readable than r2.
  • Loading branch information
maribu committed Apr 25, 2024
1 parent 4c0d6f8 commit 6aed440
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cpu/msp430/include/irq_arch.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ __attribute__((always_inline)) static inline unsigned int irq_disable(void)
{
unsigned int state;
__asm__ volatile(
"mov.w r2, %[state]" "\n\t"
"bic %[gie], r2" "\n\t"
"mov.w SR, %[state]" "\n\t"
"bic %[gie], SR" "\n\t"
"nop" "\n\t"
"and %[gie], %[state]" "\n\t"
: [state] "=r"(state)
Expand All @@ -60,9 +60,9 @@ __attribute__((always_inline)) static inline unsigned int irq_enable(void)
{
unsigned int state;
__asm__ volatile(
"mov.w r2, %[state]" "\n\t"
"mov.w SR, %[state]" "\n\t"
"nop" "\n\t"
"bis %[gie], r2" "\n\t"
"bis %[gie], SR" "\n\t"
"nop" "\n\t"
"and %[gie], %[state]" "\n\t"
: [state] "=r"(state)
Expand All @@ -76,7 +76,7 @@ __attribute__((always_inline)) static inline unsigned int irq_enable(void)
__attribute__((always_inline)) static inline void irq_restore(unsigned int state)
{
__asm__ volatile(
"bis %[state], r2" "\n\t"
"bis %[state], SR" "\n\t"
"nop" "\n\t"
: /* no outputs */
: [state] "r"(state)
Expand All @@ -93,7 +93,7 @@ __attribute__((always_inline)) static inline bool irq_is_enabled(void)
{
unsigned int state;
__asm__ volatile(
"mov.w r2,%[state]" "\n\t"
"mov.w SR,%[state]" "\n\t"
: [state] "=r"(state)
: /* no inputs */
: "memory"
Expand Down

0 comments on commit 6aed440

Please sign in to comment.