Browse Source

Merge pull request #165 from FrankBoesing/patch-1

Access Q-bit from c
dds
Paul Stoffregen 8 years ago
parent
commit
61b271f570
1 changed files with 17 additions and 0 deletions
  1. +17
    -0
      utility/dspinst.h

+ 17
- 0
utility/dspinst.h View File

return out; return out;
} }


//get Q from PSR
static inline uint32_t get_q_psr(void) __attribute__((always_inline, unused));
static inline uint32_t get_q_psr(void)
{
uint32_t out;
asm volatile("mrs %0, APSR" : "=r" (out));
return (out & 0x8000000)>>27;
}


//clear Q BIT in PSR
static inline void clr_q_psr(void) __attribute__((always_inline, unused));
static inline void clr_q_psr(void)
{
uint32_t t;
asm volatile("mrs %0,APSR " : "=r" (t));
asm volatile("bfc %0, #27, #1" : "=r" (t));
asm volatile("msr APSR_nzcvq,%0" : "=r" (t));
}


#endif #endif

Loading…
Cancel
Save