diff options
author | Uros Majstorovic <majstor@majstor.org> | 2019-11-24 18:25:18 +0100 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2019-11-24 18:25:18 +0100 |
commit | 22a79e03a60bed3df7ba24015564c4b48bb811cb (patch) | |
tree | 51c5ec4bf4fbf52e13af34d08df71c5218e22317 /code/fe310/eos/i2s.c | |
parent | 3eb69c840d1f42d6584834406bd2fb9413a8293a (diff) |
fixed evt msg get; cleanup
Diffstat (limited to 'code/fe310/eos/i2s.c')
-rw-r--r-- | code/fe310/eos/i2s.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/code/fe310/eos/i2s.c b/code/fe310/eos/i2s.c index 3d3e007..3cc0619 100644 --- a/code/fe310/eos/i2s.c +++ b/code/fe310/eos/i2s.c @@ -3,6 +3,7 @@ #include "encoding.h" #include "platform.h" +#include "prci_driver.h" #include "eos.h" #include "interrupt.h" @@ -117,7 +118,10 @@ void eos_i2s_init(void) { } void eos_i2s_start(uint32_t sample_rate, unsigned char fmt) { - uint32_t ck_period = (get_cpu_freq() / (sample_rate * 64)) & ~I2S_PWM_SCALE_CK_MASK;; + // Ignore the first run (for icache reasons) + uint32_t cpu_freq = PRCI_measure_mcycle_freq(3000, RTC_FREQ); + cpu_freq = PRCI_measure_mcycle_freq(3000, RTC_FREQ); + uint32_t ck_period = (cpu_freq / (sample_rate * 64)) & ~I2S_PWM_SCALE_CK_MASK;; GPIO_REG(GPIO_INPUT_EN) &= ~(1 << I2S_PIN_CK); GPIO_REG(GPIO_OUTPUT_EN) |= (1 << I2S_PIN_CK); |