Changes in uspace/drv/nic/ne2k/ne2k.c [9571230:80099c19] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/nic/ne2k/ne2k.c
r9571230 r80099c19 64 64 #define NE2K(device) ((ne2k_t *) nic_get_specific(DRIVER_DATA(device))) 65 65 66 static irq_pio_range_t ne2k_ranges_prototype[] = {67 {68 .base = 0,69 .size = NE2K_IO_SIZE,70 }71 };72 73 66 /** NE2000 kernel interrupt command sequence. 74 67 * … … 129 122 130 123 if (ne2k->code.cmdcount == 0) { 131 irq_pio_range_t *ne2k_ranges; 132 irq_cmd_t *ne2k_cmds; 133 134 ne2k_ranges = malloc(sizeof(ne2k_ranges_prototype)); 135 if (!ne2k_ranges) 136 return ENOMEM; 137 memcpy(ne2k_ranges, ne2k_ranges_prototype, 138 sizeof(ne2k_ranges_prototype)); 139 ne2k_ranges[0].base = (uintptr_t) ne2k->base_port; 140 141 ne2k_cmds = malloc(sizeof(ne2k_cmds_prototype)); 142 if (!ne2k_cmds) { 143 free(ne2k_ranges); 124 irq_cmd_t *ne2k_cmds = malloc(sizeof(ne2k_cmds_prototype)); 125 if (ne2k_cmds == NULL) { 144 126 return ENOMEM; 145 127 } 146 memcpy(ne2k_cmds, ne2k_cmds_prototype, 147 sizeof(ne2k_cmds_prototype)); 148 ne2k_cmds[0].addr = ne2k->base_port + DP_ISR; 149 ne2k_cmds[3].addr = ne2k->base_port + DP_IMR; 128 memcpy(ne2k_cmds, ne2k_cmds_prototype, sizeof (ne2k_cmds_prototype)); 129 ne2k_cmds[0].addr = ne2k->port + DP_ISR; 130 ne2k_cmds[3].addr = ne2k->port + DP_IMR; 150 131 ne2k_cmds[4].addr = ne2k_cmds[0].addr; 151 ne2k_cmds[5].addr = ne2k->base_port + DP_TSR; 152 153 ne2k->code.rangecount = sizeof(ne2k_ranges_prototype) / 154 sizeof(irq_pio_range_t); 155 ne2k->code.ranges = ne2k_ranges; 156 157 ne2k->code.cmdcount = sizeof(ne2k_cmds_prototype) / 158 sizeof(irq_cmd_t); 132 ne2k_cmds[5].addr = ne2k->port + DP_TSR; 133 134 ne2k->code.cmdcount = sizeof(ne2k_cmds_prototype) / sizeof(irq_cmd_t); 159 135 ne2k->code.cmds = ne2k_cmds; 160 136 } … … 172 148 ne2k_t *ne2k = NE2K(dev); 173 149 if (ne2k) { 174 free(ne2k->code.ranges);175 150 free(ne2k->code.cmds); 176 151 } … … 361 336 } 362 337 363 static int ne2k_ dev_add(ddf_dev_t *dev)338 static int ne2k_add_device(ddf_dev_t *dev) 364 339 { 365 340 /* Allocate driver data for the device. */ … … 368 343 return ENOMEM; 369 344 370 nic_set_ send_frame_handler(nic_data, ne2k_send);345 nic_set_write_packet_handler(nic_data, ne2k_send); 371 346 nic_set_state_change_handlers(nic_data, 372 347 ne2k_on_activating, NULL, ne2k_on_stopping); … … 416 391 417 392 static driver_ops_t ne2k_driver_ops = { 418 . dev_add = ne2k_dev_add393 .add_device = ne2k_add_device 419 394 }; 420 395
Note:
See TracChangeset
for help on using the changeset viewer.