/* Initialize a specific IRQ and register the handler. 
This function set vector mode, trigger mode and polarity, interrupt level and priority, assign handler for specific IRQn.  */
int32_t ECLIC_Register_IRQ(IRQn_Type IRQn, uint8_t shv, ECLIC_TRIGGER_Type trig_mode, uint8_t lvl, uint8_t priority, void *handler)
/* Initialize a specific IRQ and register the handler. 
This function set vector mode, trigger mode and polarity, interrupt level and priority, assign handler for specific IRQn.  */
int32_t ECLIC_Register_IRQ(IRQn_Type IRQn, uint8_t shv, ECLIC_TRIGGER_Type trig_mode, uint8_t lvl, uint8_t priority, void *handler)
{
    if ((IRQn > SOC_INT_MAX) || (shv > ECLIC_VECTOR_INTERRUPT) \
        || (trig_mode > ECLIC_NEGTIVE_EDGE_TRIGGER)) {
        return -1;
    }
    ECLIC_SetShvIRQ(IRQn, shv);
    ECLIC_SetTrigIRQ(IRQn, trig_mode);
    ECLIC_SetLevelIRQ(IRQn, lvl);
    ECLIC_SetPriorityIRQ(IRQn, priority);
    if (handler != NULL) {
        ECLIC_SetVector(IRQn, (rv_csr_t)handler);
    }
    ECLIC_EnableIRQ(IRQn);
    return 0;
}
/** @}