Changes in uspace/drv/platform/icp/icp.c [a416d070:75fe97b] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/platform/icp/icp.c
ra416d070 r75fe97b 39 39 #include <stdio.h> 40 40 #include <errno.h> 41 #include <irc.h>42 41 #include <stdbool.h> 43 42 #include <stdlib.h> … … 54 53 icp_kbd_irq = 3, 55 54 icp_mouse_base = 0x19000000, 56 icp_mouse_irq = 4, 57 icp_ic_base = 0x14000000 55 icp_mouse_irq = 4 58 56 }; 59 57 … … 109 107 }; 110 108 111 static hw_resource_t icp_ic_res[] = {112 {113 .type = MEM_RANGE,114 .res.mem_range = {115 .address = icp_ic_base,116 .size = 40,117 .relative = false,118 .endianness = LITTLE_ENDIAN119 }120 }121 };122 123 109 static pio_window_t icp_pio_window = { 124 110 .mem = { … … 142 128 }; 143 129 144 static icp_fun_t icp_ic_fun_proto = {145 .hw_resources = {146 sizeof(icp_ic_res) / sizeof(icp_ic_res[0]),147 icp_ic_res148 },149 };150 151 130 /** Obtain function soft-state from DDF function node */ 152 131 static icp_fun_t *icp_fun(ddf_fun_t *fnode) … … 163 142 } 164 143 165 static bool icp_fun_owns_interrupt(icp_fun_t *fun, int irq) 166 { 167 const hw_resource_list_t *res = &fun->hw_resources; 168 169 /* Check that specified irq really belongs to the function */ 170 for (size_t i = 0; i < res->count; ++i) { 171 if (res->resources[i].type == INTERRUPT && 172 res->resources[i].res.interrupt.irq == irq) { 173 return true; 174 } 175 } 176 144 static bool icp_enable_interrupt(ddf_fun_t *fun) 145 { 146 /* TODO */ 177 147 return false; 178 }179 180 static int icp_fun_enable_interrupt(ddf_fun_t *fnode, int irq)181 {182 icp_fun_t *fun = icp_fun(fnode);183 184 if (!icp_fun_owns_interrupt(fun, irq))185 return EINVAL;186 187 return irc_enable_interrupt(irq);188 }189 190 static int icp_fun_disable_interrupt(ddf_fun_t *fnode, int irq)191 {192 icp_fun_t *fun = icp_fun(fnode);193 194 if (!icp_fun_owns_interrupt(fun, irq))195 return EINVAL;196 197 return irc_disable_interrupt(irq);198 }199 200 static int icp_fun_clear_interrupt(ddf_fun_t *fnode, int irq)201 {202 icp_fun_t *fun = icp_fun(fnode);203 204 if (!icp_fun_owns_interrupt(fun, irq))205 return EINVAL;206 207 return irc_clear_interrupt(irq);208 148 } 209 149 … … 215 155 static hw_res_ops_t icp_hw_res_ops = { 216 156 .get_resource_list = &icp_get_resources, 217 .enable_interrupt = &icp_fun_enable_interrupt, 218 .disable_interrupt = &icp_fun_disable_interrupt, 219 .clear_interrupt = &icp_fun_clear_interrupt 157 .enable_interrupt = &icp_enable_interrupt, 220 158 }; 221 159 … … 287 225 return rc; 288 226 289 rc = icp_add_fun(dev, "intctl", "integratorcp/intctl",290 &icp_ic_fun_proto);291 if (rc != EOK)292 return rc;293 294 227 return EOK; 295 228 }
Note:
See TracChangeset
for help on using the changeset viewer.