Very early cut of xua_lite app. Builds (4 threads + I2C) but not functional

This commit is contained in:
Ed Clarke
2018-10-25 17:52:13 +01:00
parent 0b15179219
commit 770c11b3f0
9 changed files with 779 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
#include "i2s.h"
#include "i2c.h"
#include "gpio.h"
#include "xua.h"
[[distributable]]
void AudioHub(server i2s_frame_callback_if i2s,
chanend c_aud,
client i2c_master_if i2c,
client output_gpio_if dac_reset)
{
int32_t samples[8] = {0}; // Array used for looping back samples
while (1) {
select {
case i2s.init(i2s_config_t &?i2s_config, tdm_config_t &?tdm_config):
i2s_config.mode = I2S_MODE_I2S;
i2s_config.mclk_bclk_ratio = (MCLK_48/DEFAULT_FREQ)/64;
// Set CODECs in reset
dac_reset.output(0);
// Allow reset to assert
delay_milliseconds(1);
// Take CODECs out of reset
dac_reset.output(1);
//reset_codecs(i2c);
break;
case i2s.receive(size_t n_chans, int32_t in_samps[n_chans]):
for (int i = 0; i < n_chans; i++) samples[i] = in_samps[i]; // copy samples
break;
case i2s.send(size_t n_chans, int32_t out_samps[n_chans]):
for (int i = 0; i < n_chans; i++) out_samps[i] = samples[i]; // copy samples
break;
case i2s.restart_check() -> i2s_restart_t restart:
restart = I2S_NO_RESTART; // Keep on looping
break;
}
}
}