summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--code/fe310/eos/evt_def.h2
-rw-r--r--code/fe310/eos/i2s.c6
-rw-r--r--code/fe310/eos/i2s.h5
-rw-r--r--code/fe310/eos/trap_entry.S4
4 files changed, 11 insertions, 6 deletions
diff --git a/code/fe310/eos/evt_def.h b/code/fe310/eos/evt_def.h
index afd8a69..16c4255 100644
--- a/code/fe310/eos/evt_def.h
+++ b/code/fe310/eos/evt_def.h
@@ -1,5 +1,5 @@
#define EOS_EVT_TIMER 0x10
-#define EOS_EVT_AUDIO 0x20
+#define EOS_EVT_I2S 0x20
#define EOS_EVT_NET 0x30
#define EOS_EVT_SPI 0x40
#define EOS_EVT_UART 0x50
diff --git a/code/fe310/eos/i2s.c b/code/fe310/eos/i2s.c
index 83fd148..c8216ff 100644
--- a/code/fe310/eos/i2s.c
+++ b/code/fe310/eos/i2s.c
@@ -93,13 +93,13 @@ static uint16_t _abuf_len(EOSABuf *buf) {
static void i2s_handle_evt(unsigned char type, unsigned char *buffer, uint16_t len) {
switch(type & ~EOS_EVT_MASK) {
- case I2S_ETYPE_MIC:
+ case EOS_I2S_ETYPE_MIC:
if (i2s_mic_handler) i2s_mic_handler(type);
clear_csr(mstatus, MSTATUS_MIE);
_eos_i2s_mic_evt_enable = 1;
set_csr(mstatus, MSTATUS_MIE);
break;
- case I2S_ETYPE_SPK:
+ case EOS_I2S_ETYPE_SPK:
if (i2s_spk_handler) i2s_spk_handler(type);
clear_csr(mstatus, MSTATUS_MIE);
_eos_i2s_spk_evt_enable = 1;
@@ -135,7 +135,7 @@ static void _spk_vol_set(uint8_t vol) {
extern void _eos_i2s_start_pwm(void);
void eos_i2s_init(void) {
- eos_evtq_set_handler(EOS_EVT_AUDIO, i2s_handle_evt);
+ eos_evtq_set_handler(EOS_EVT_I2S, i2s_handle_evt);
GPIO_REG(GPIO_INPUT_EN) &= ~(1 << I2S_PIN_CK);
GPIO_REG(GPIO_OUTPUT_EN) |= (1 << I2S_PIN_CK);
diff --git a/code/fe310/eos/i2s.h b/code/fe310/eos/i2s.h
index 81d13f4..744958e 100644
--- a/code/fe310/eos/i2s.h
+++ b/code/fe310/eos/i2s.h
@@ -3,6 +3,11 @@
#define EOS_I2S_FMT_ALAW 0
#define EOS_I2S_FMT_PCM16 1
+/* should match i2s_def.h definitions */
+#define EOS_I2S_ETYPE_MIC 1
+#define EOS_I2S_ETYPE_SPK 2
+
+
typedef struct EOSABuf {
uint16_t idx_r;
uint16_t idx_w;
diff --git a/code/fe310/eos/trap_entry.S b/code/fe310/eos/trap_entry.S
index 4172570..c24236b 100644
--- a/code/fe310/eos/trap_entry.S
+++ b/code/fe310/eos/trap_entry.S
@@ -156,7 +156,7 @@ i2s_abuf_pop:
# push to event queue
jal x22, evtq_push
beqz x21, i2s_decode
- li x18, (EOS_EVT_AUDIO | I2S_ETYPE_SPK)
+ li x18, (EOS_EVT_I2S | I2S_ETYPE_SPK)
sb x18, MSGQ_ITEM_OFF_TYPE(x21)
i2s_decode:
@@ -349,7 +349,7 @@ i2s_abuf_push:
# push to event queue
jal x22, evtq_push
beqz x21, i2s_handle_sd_exit
- li x18, (EOS_EVT_AUDIO | I2S_ETYPE_MIC)
+ li x18, (EOS_EVT_I2S | I2S_ETYPE_MIC)
sb x18, MSGQ_ITEM_OFF_TYPE(x21)
i2s_handle_sd_exit: