Changeset d51838f in mainline for uspace/drv/bus/isa/isa.c
- Timestamp:
- 2017-10-14T22:49:18Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 75911d24
- Parents:
- ce732e74
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/isa/isa.c
rce732e74 rd51838f 115 115 } 116 116 117 static int isa_fun_enable_interrupt(ddf_fun_t *fnode, int irq) 118 { 119 isa_fun_t *fun = isa_fun(fnode); 117 static bool isa_fun_owns_interrupt(isa_fun_t *fun, int irq) 118 { 120 119 const hw_resource_list_t *res = &fun->hw_resources; 121 bool found;122 120 123 121 /* Check that specified irq really belongs to the function */ 124 found = false;125 122 for (size_t i = 0; i < res->count; ++i) { 126 123 if (res->resources[i].type == INTERRUPT && 127 124 res->resources[i].res.interrupt.irq == irq) { 128 found = true; 129 break; 130 } 131 } 132 133 if (!found) 125 return true; 126 } 127 } 128 129 return false; 130 } 131 132 static int isa_fun_enable_interrupt(ddf_fun_t *fnode, int irq) 133 { 134 isa_fun_t *fun = isa_fun(fnode); 135 136 if (!isa_fun_owns_interrupt(fun, irq)) 134 137 return EINVAL; 135 138 136 139 return irc_enable_interrupt(irq); 140 } 141 142 static int isa_fun_disable_interrupt(ddf_fun_t *fnode, int irq) 143 { 144 isa_fun_t *fun = isa_fun(fnode); 145 146 if (!isa_fun_owns_interrupt(fun, irq)) 147 return EINVAL; 148 149 return irc_disable_interrupt(irq); 150 } 151 152 static int isa_fun_clear_interrupt(ddf_fun_t *fnode, int irq) 153 { 154 isa_fun_t *fun = isa_fun(fnode); 155 156 if (!isa_fun_owns_interrupt(fun, irq)) 157 return EINVAL; 158 159 return irc_clear_interrupt(irq); 137 160 } 138 161 … … 185 208 .get_resource_list = isa_fun_get_resources, 186 209 .enable_interrupt = isa_fun_enable_interrupt, 210 .disable_interrupt = isa_fun_disable_interrupt, 211 .clear_interrupt = isa_fun_clear_interrupt, 187 212 .dma_channel_setup = isa_fun_setup_dma, 188 213 .dma_channel_remain = isa_fun_remain_dma,
Note:
See TracChangeset
for help on using the changeset viewer.