summaryrefslogtreecommitdiff
path: root/fw/fe310/eos/soc/i2s.c
diff options
context:
space:
mode:
Diffstat (limited to 'fw/fe310/eos/soc/i2s.c')
-rw-r--r--fw/fe310/eos/soc/i2s.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/fw/fe310/eos/soc/i2s.c b/fw/fe310/eos/soc/i2s.c
index 8bd5600..52c7a8b 100644
--- a/fw/fe310/eos/soc/i2s.c
+++ b/fw/fe310/eos/soc/i2s.c
@@ -31,8 +31,8 @@
#define EOS_ABUF_IDX_MASK(IDX, SIZE) ((IDX) & ((SIZE) - 1))
-static eos_i2s_handler_t i2s_mic_handler = NULL;
-static eos_i2s_handler_t i2s_spk_handler = NULL;
+static eos_evt_simple_handler_t i2s_mic_handler = NULL;
+static eos_evt_simple_handler_t i2s_spk_handler = NULL;
static uint32_t i2s_clk_period;
static uint8_t i2s_mic_volume = 0; /* 0 - 8 */
static uint8_t i2s_spk_volume = 16; /* 0 - 16 */
@@ -93,11 +93,11 @@ static int _sbuf_push(uint16_t sample) {
return EOS_OK;
}
-static void i2s_handle_evt(unsigned char type, unsigned char *buffer, uint16_t len) {
+static void i2s_handle_evt(unsigned char type, EOSMessage *msg, uint16_t len) {
switch(type & ~EOS_EVT_MASK) {
case EOS_I2S_ETYPE_MIC:
if (i2s_mic_handler) {
- i2s_mic_handler(type);
+ i2s_mic_handler(type & ~EOS_EVT_MASK);
clear_csr(mstatus, MSTATUS_MIE);
_eos_i2s_drvr[I2S_MIC_EVT] = 1;
set_csr(mstatus, MSTATUS_MIE);
@@ -106,7 +106,7 @@ static void i2s_handle_evt(unsigned char type, unsigned char *buffer, uint16_t l
case EOS_I2S_ETYPE_SPK:
if (i2s_spk_handler) {
- i2s_spk_handler(type);
+ i2s_spk_handler(type & ~EOS_EVT_MASK);
clear_csr(mstatus, MSTATUS_MIE);
_eos_i2s_drvr[I2S_SPK_EVT] = 1;
set_csr(mstatus, MSTATUS_MIE);
@@ -114,7 +114,7 @@ static void i2s_handle_evt(unsigned char type, unsigned char *buffer, uint16_t l
break;
default:
- eos_evtq_bad_handler(type, buffer, len);
+ eos_evtq_bad_handler(type, msg, len);
break;
}
}
@@ -281,7 +281,7 @@ int eos_i2s_set_lsgain(int gain) {
return eos_egpio_set_val(EGPIO_PIN_LSGAIN_SEL, gain);
}
-void eos_i2s_mic_set_handler(eos_i2s_handler_t handler, uint16_t wm) {
+void eos_i2s_mic_set_handler(eos_evt_simple_handler_t handler, uint16_t wm) {
clear_csr(mstatus, MSTATUS_MIE);
if ((i2s_mic_handler == NULL) && handler) _eos_i2s_drvr[I2S_MIC_EVT] = 1;
if (i2s_mic_handler && (handler == NULL)) _eos_i2s_drvr[I2S_MIC_EVT] = 0;
@@ -355,7 +355,7 @@ void eos_i2s_mic_set_vol(int vol) {
set_csr(mstatus, MSTATUS_MIE);
}
-void eos_i2s_spk_set_handler(eos_i2s_handler_t handler, uint16_t wm) {
+void eos_i2s_spk_set_handler(eos_evt_simple_handler_t handler, uint16_t wm) {
clear_csr(mstatus, MSTATUS_MIE);
if ((i2s_spk_handler == NULL) && handler) _eos_i2s_drvr[I2S_SPK_EVT] = 1;
if (i2s_spk_handler && (handler == NULL)) _eos_i2s_drvr[I2S_SPK_EVT] = 0;