Ignore:
Timestamp:
2017-10-14T22:49:18Z (7 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
75911d24
Parents:
ce732e74
Message:

Let leaf drivers enable/disable/clear interrupts via hw_res instead of directly using irc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/drv/generic/remote_hw_res.c

    rce732e74 rd51838f  
    4545static void remote_hw_res_enable_interrupt(ddf_fun_t *, void *, ipc_callid_t,
    4646    ipc_call_t *);
     47static void remote_hw_res_disable_interrupt(ddf_fun_t *, void *, ipc_callid_t,
     48    ipc_call_t *);
     49static void remote_hw_res_clear_interrupt(ddf_fun_t *, void *, ipc_callid_t,
     50    ipc_call_t *);
    4751static void remote_hw_res_dma_channel_setup(ddf_fun_t *, void *, ipc_callid_t,
    4852    ipc_call_t *);
     
    5357        [HW_RES_GET_RESOURCE_LIST] = &remote_hw_res_get_resource_list,
    5458        [HW_RES_ENABLE_INTERRUPT] = &remote_hw_res_enable_interrupt,
     59        [HW_RES_DISABLE_INTERRUPT] = &remote_hw_res_disable_interrupt,
     60        [HW_RES_CLEAR_INTERRUPT] = &remote_hw_res_clear_interrupt,
    5561        [HW_RES_DMA_CHANNEL_SETUP] = &remote_hw_res_dma_channel_setup,
    5662        [HW_RES_DMA_CHANNEL_REMAIN] = &remote_hw_res_dma_channel_remain,
     
    6874       
    6975        if (hw_res_ops->enable_interrupt == NULL) {
     76                async_answer_0(callid, ENOTSUP);
     77                return;
     78        }
     79       
     80        const int irq = DEV_IPC_GET_ARG1(*call);
     81        const int ret = hw_res_ops->enable_interrupt(fun, irq);
     82        async_answer_0(callid, ret);
     83}
     84
     85static void remote_hw_res_disable_interrupt(ddf_fun_t *fun, void *ops,
     86    ipc_callid_t callid, ipc_call_t *call)
     87{
     88        hw_res_ops_t *hw_res_ops = (hw_res_ops_t *) ops;
     89       
     90        if (hw_res_ops->disable_interrupt == NULL) {
     91                async_answer_0(callid, ENOTSUP);
     92                return;
     93        }
     94       
     95        const int irq = DEV_IPC_GET_ARG1(*call);
     96        const int ret = hw_res_ops->disable_interrupt(fun, irq);
     97        async_answer_0(callid, ret);
     98}
     99
     100static void remote_hw_res_clear_interrupt(ddf_fun_t *fun, void *ops,
     101    ipc_callid_t callid, ipc_call_t *call)
     102{
     103        hw_res_ops_t *hw_res_ops = (hw_res_ops_t *) ops;
     104       
     105        if (hw_res_ops->clear_interrupt == NULL) {
    70106                async_answer_0(callid, ENOTSUP);
    71107                return;
Note: See TracChangeset for help on using the changeset viewer.