From 048197ad519fd3bc1d05a15a7d4fb0a87270c635 Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Sat, 17 Mar 2018 02:17:22 +0100 Subject: i2s start/stop fixed properly --- code/ecp/Makefile.fe310 | 8 ++++---- code/fe310/eos/i2s.c | 41 ++++++++++++++++++++++++++++++++--------- code/fe310/eos/i2s.h | 4 ++-- 3 files changed, 38 insertions(+), 15 deletions(-) (limited to 'code') diff --git a/code/ecp/Makefile.fe310 b/code/ecp/Makefile.fe310 index 9070dd6..aae7793 100644 --- a/code/ecp/Makefile.fe310 +++ b/code/ecp/Makefile.fe310 @@ -4,10 +4,10 @@ htable= vconn=vconn rbuf_obj= -FE310_HOME=/opt/my/freedom-e-sdk +FE310_HOME = /opt/my/freedom-e-sdk -CC=$(FE310_HOME)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-gcc -AR=$(FE310_HOME)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-ar +CC = $(FE310_HOME)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-gcc +AR = $(FE310_HOME)/work/build/riscv-gnu-toolchain/riscv64-unknown-elf/prefix/bin/riscv64-unknown-elf-ar -CFLAGS_PL=-O3 -fno-builtin-printf -march=rv32imac -mabi=ilp32 -mcmodel=medany -I$(FE310_HOME)/bsp/include -I$(FE310_HOME)/bsp/drivers -I$(FE310_HOME)/bsp/env -I$(FE310_HOME)/bsp/env/freedom-e300-hifive1 -DECP_WITH_VCONN=1 -DECP_DEBUG=1 +CFLAGS_PL = -DECP_WITH_VCONN=1 -DECP_DEBUG=1 -O3 -fno-builtin-printf -march=rv32imac -mabi=ilp32 -mcmodel=medany -I$(FE310_HOME)/bsp/include -I$(FE310_HOME)/bsp/drivers -I$(FE310_HOME)/bsp/env -I$(FE310_HOME)/bsp/env/freedom-e300-hifive1 # LDFLAGS_PL=-lm -pthread \ No newline at end of file diff --git a/code/fe310/eos/i2s.c b/code/fe310/eos/i2s.c index 47be820..b771495 100644 --- a/code/fe310/eos/i2s.c +++ b/code/fe310/eos/i2s.c @@ -22,8 +22,8 @@ uint32_t _eos_i2s_mic_wm = 0; uint32_t _eos_i2s_spk_wm = 0; uint32_t _eos_i2s_mic_volume = 3; uint32_t _eos_i2s_spk_volume = 3; -uint32_t _eos_i2s_mic_rd = 1; -uint32_t _eos_i2s_spk_wr = 1; +uint32_t _eos_i2s_mic_rd = 0; +uint32_t _eos_i2s_spk_wr = 0; static eos_evt_fptr_t evt_handler[I2S_MAX_HANDLER]; static void _abuf_init(EOSABuf *buf, uint8_t *array, uint16_t size) { @@ -121,30 +121,44 @@ void eos_i2s_init(void) { I2S_PWM_REG_WS(PWM_CMP1) = (_eos_i2s_ck_period + 1) * 32; I2S_PWM_REG_WS(PWM_CMP2) = (_eos_i2s_ck_period + 1) * 62; - eos_intr_set(I2S_IRQ_SD_ID, I2S_IRQ_SD_PRIORITY, NULL); - eos_intr_set(I2S_IRQ_CK_ID, I2S_IRQ_CK_PRIORITY, NULL); - eos_intr_set(I2S_IRQ_WS_ID, I2S_IRQ_WS_PRIORITY, NULL); - eos_intr_set(I2S_IRQ_CI_ID, I2S_IRQ_CI_PRIORITY, NULL); - + eos_intr_set(I2S_IRQ_SD_ID, 0, NULL); + eos_intr_set(I2S_IRQ_CK_ID, 0, NULL); + eos_intr_set(I2S_IRQ_WS_ID, 0, NULL); + eos_intr_set(I2S_IRQ_CI_ID, 0, NULL); for (i=0; i