From 72e3dc1e214f7f4f05087f42fd08eb4a87408be6 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Fri, 15 Jun 2012 16:20:46 -0700 Subject: [PATCH] TX sample generation loop that outputs an eight-sample sine wave. (1.25MHz assuming 10MHz codec clock.) --- firmware/sgpio/sgpio.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/firmware/sgpio/sgpio.c b/firmware/sgpio/sgpio.c index d7b8c6ba..c270592c 100644 --- a/firmware/sgpio/sgpio.c +++ b/firmware/sgpio/sgpio.c @@ -194,8 +194,23 @@ void configure_sgpio_test_tx() { (1L << SGPIO_SLICE_A) ; - // Enable codec data stream. - SGPIO_GPIO_OUTREG &= ~(1L << 10); + // LSB goes out first, samples are 0x + volatile uint32_t buffer[] = { + 0xda808080, + 0xda80ff80, + 0x26808080, + 0x26800180, + }; + uint32_t i = 0; + + // Enable codec data stream. + SGPIO_GPIO_OUTREG &= ~(1L << 10); + + while(true) { + while(SGPIO_STATUS_1 == 0); + SGPIO_REG_SS(SGPIO_SLICE_A) = buffer[(i++) & 3]; + SGPIO_CLR_STATUS_1 = 1; + } } void configure_sgpio_test_rx() {