mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2025-10-19 08:22:23 +00:00
Consolidating M4-specific saturation flag code.
This commit is contained in:
@@ -30,6 +30,21 @@
|
||||
|
||||
namespace lpc43xx {
|
||||
|
||||
#if defined(LPC43XX_M4)
|
||||
namespace m4 {
|
||||
|
||||
static inline bool flag_saturation() {
|
||||
return __get_APSR() & (1U << 27);
|
||||
}
|
||||
|
||||
static inline void clear_flag_saturation() {
|
||||
uint32_t flags = 1;
|
||||
__asm volatile ("MSR APSR_nzcvqg, %0" : : "r" (flags));
|
||||
}
|
||||
|
||||
} /* namespace m4 */
|
||||
#endif
|
||||
|
||||
namespace creg {
|
||||
|
||||
static_assert(offsetof(LPC_CREG_Type, CREG0) == 0x004, "CREG0 offset wrong");
|
||||
|
@@ -26,15 +26,6 @@
|
||||
|
||||
#include <hal.h>
|
||||
|
||||
static inline bool m4_flag_saturation() {
|
||||
return __get_APSR() & (1U << 27);
|
||||
}
|
||||
|
||||
static inline void clear_m4_flag_saturation() {
|
||||
uint32_t flags = 1;
|
||||
__asm volatile ("MSR APSR_nzcvqg, %0" : : "r" (flags));
|
||||
}
|
||||
|
||||
static inline complex32_t multiply_conjugate_s16_s32(const complex16_t::rep_type a, const complex16_t::rep_type b) {
|
||||
// conjugate: conj(a + bj) = a - bj
|
||||
// multiply: (a + bj) * (c + dj) = (ac - bd) + (bc + ad)j
|
||||
|
Reference in New Issue
Block a user