Browse Source

Fixes for Teensy LC

Needed for Blocksize=128.
Blocksize 128 is needed for the waveplayer
dds
Frank Bösing 3 years ago
parent
commit
516252a640
2 changed files with 20 additions and 17 deletions
  1. +1
    -1
      analyze_fft256.cpp
  2. +19
    -16
      utility/dspinst.h

+ 1
- 1
analyze_fft256.cpp View File



block = receiveReadOnly(); block = receiveReadOnly();
if (!block) return; if (!block) return;
#if AUDIO_BLOCK_SAMPLES == 128
#if AUDIO_BLOCK_SAMPLES == 128 && defined (__ARM_ARCH_7EM__)
if (!prevblock) { if (!prevblock) {
prevblock = block; prevblock = block;
return; return;

+ 19
- 16
utility/dspinst.h View File

return out; return out;
} }
*/ */
#if defined (__ARM_ARCH_7EM__)
// computes (((a[31:16] + b[31:16]) << 16) | (a[15:0 + b[15:0])) (saturates) // computes (((a[31:16] + b[31:16]) << 16) | (a[15:0 + b[15:0])) (saturates)
static inline uint32_t signed_add_16_and_16(uint32_t a, uint32_t b) __attribute__((always_inline, unused)); static inline uint32_t signed_add_16_and_16(uint32_t a, uint32_t b) __attribute__((always_inline, unused));
static inline uint32_t signed_add_16_and_16(uint32_t a, uint32_t b) static inline uint32_t signed_add_16_and_16(uint32_t a, uint32_t b)
return out; return out;
} }


// Multiply two S.31 fractional integers, and return the 32 most significant
// bits after a shift left by the constant z.
// This comes from rockbox.org

static inline int32_t FRACMUL_SHL(int32_t x, int32_t y, int z)
{
int32_t t, t2;
asm ("smull %[t], %[t2], %[a], %[b]\n\t"
"mov %[t2], %[t2], asl %[c]\n\t"
"orr %[t], %[t2], %[t], lsr %[d]\n\t"
: [t] "=&r" (t), [t2] "=&r" (t2)
: [a] "r" (x), [b] "r" (y),
[c] "Mr" ((z) + 1), [d] "Mr" (31 - (z)));
return t;
}

#endif

//get Q from PSR //get Q from PSR
static inline uint32_t get_q_psr(void) __attribute__((always_inline, unused)); static inline uint32_t get_q_psr(void) __attribute__((always_inline, unused));
static inline uint32_t get_q_psr(void) static inline uint32_t get_q_psr(void)
"msr APSR_nzcvq,%0\n" : [t] "=&r" (t)::"cc"); "msr APSR_nzcvq,%0\n" : [t] "=&r" (t)::"cc");
} }


// Multiply two S.31 fractional integers, and return the 32 most significant
// bits after a shift left by the constant z.
// This comes from rockbox.org

static inline int32_t FRACMUL_SHL(int32_t x, int32_t y, int z)
{
int32_t t, t2;
asm ("smull %[t], %[t2], %[a], %[b]\n\t"
"mov %[t2], %[t2], asl %[c]\n\t"
"orr %[t], %[t2], %[t], lsr %[d]\n\t"
: [t] "=&r" (t), [t2] "=&r" (t2)
: [a] "r" (x), [b] "r" (y),
[c] "Mr" ((z) + 1), [d] "Mr" (31 - (z)));
return t;
}


#endif #endif

Loading…
Cancel
Save