|
23 | 23 | #define ADC_PRIORITY 12
|
24 | 24 | #define CAN_PRIORITY 12
|
25 | 25 | #define CANFD_PRIORITY 12
|
| 26 | +#define I2S_PRIORITY 12 |
26 | 27 | #define FIRST_INT_SLOT_FREE 0
|
27 | 28 |
|
28 | 29 | IRQManager::IRQManager() : last_interrupt_index{0} {
|
@@ -930,6 +931,41 @@ bool IRQManager::addPeripheral(Peripheral_t p, void *cfg) {
|
930 | 931 | }
|
931 | 932 | }
|
932 | 933 | #endif
|
| 934 | + |
| 935 | +#if I2S_HOWMANY > 0 |
| 936 | + /* ********************************************************************** |
| 937 | + I2S |
| 938 | + ********************************************************************** */ |
| 939 | + else if(p == IRQ_I2S && cfg != NULL) { |
| 940 | + i2s_cfg_t *i2s_cfg = (i2s_cfg_t *)cfg; |
| 941 | + |
| 942 | + if(i2s_cfg->txi_irq == FSP_INVALID_VECTOR) { |
| 943 | + i2s_cfg->txi_irq = (IRQn_Type)last_interrupt_index; |
| 944 | + i2s_cfg->txi_ipl = I2S_PRIORITY; |
| 945 | + *(irq_ptr + last_interrupt_index) = (uint32_t)ssi_txi_isr; |
| 946 | + R_ICU->IELSR[last_interrupt_index] = BSP_PRV_IELS_ENUM(EVENT_SSI0_TXI); |
| 947 | + R_FSP_IsrContextSet(i2s_cfg->txi_irq, (void*)i2s_cfg->p_context); |
| 948 | + last_interrupt_index++; |
| 949 | + } |
| 950 | + if(i2s_cfg->rxi_irq == FSP_INVALID_VECTOR) { |
| 951 | + i2s_cfg->rxi_irq = (IRQn_Type)last_interrupt_index; |
| 952 | + i2s_cfg->rxi_ipl = I2S_PRIORITY; |
| 953 | + *(irq_ptr + last_interrupt_index) = (uint32_t)ssi_rxi_isr; |
| 954 | + R_ICU->IELSR[last_interrupt_index] = BSP_PRV_IELS_ENUM(EVENT_SSI0_RXI); |
| 955 | + R_FSP_IsrContextSet(i2s_cfg->rxi_irq, (void*)i2s_cfg->p_context); |
| 956 | + last_interrupt_index++; |
| 957 | + } |
| 958 | + if(i2s_cfg->int_irq == FSP_INVALID_VECTOR) { |
| 959 | + i2s_cfg->int_irq = (IRQn_Type)last_interrupt_index; |
| 960 | + i2s_cfg->idle_err_ipl = I2S_PRIORITY; |
| 961 | + *(irq_ptr + last_interrupt_index) = (uint32_t)ssi_int_isr; |
| 962 | + R_ICU->IELSR[last_interrupt_index] = BSP_PRV_IELS_ENUM(EVENT_SSI0_INT); |
| 963 | + R_FSP_IsrContextSet(i2s_cfg->int_irq, (void*)i2s_cfg->p_context); |
| 964 | + last_interrupt_index++; |
| 965 | + } |
| 966 | + } |
| 967 | +#endif |
| 968 | + |
933 | 969 | else {
|
934 | 970 | rv = false;
|
935 | 971 | }
|
|
0 commit comments