Changeset 7a725b13 in mainline for uspace/srv/hw/netif/ne2000/ne2000.c
- Timestamp:
- 2011-01-14T14:23:33Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b65ca41d
- Parents:
- f40a1e2 (diff), 2f60e57d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hw/netif/ne2000/ne2000.c
rf40a1e2 r7a725b13 51 51 #include <net/device.h> 52 52 #include <netif_skel.h> 53 #include <nil_ interface.h>53 #include <nil_remote.h> 54 54 #include "dp8390.h" 55 55 … … 67 67 */ 68 68 #define IRQ_GET_ISR(call) ((int) IPC_GET_ARG2(call)) 69 70 /** Return the TSR from the interrupt call. 71 * 72 * @param[in] call The interrupt call. 73 * 74 */ 75 #define IRQ_GET_TSR(call) ((int) IPC_GET_ARG3(call)) 69 76 70 77 static int irc_service = 0; 71 78 static int irc_phone = -1; 72 79 73 /** DP8390 kernel interrupt command sequence.80 /** NE2000 kernel interrupt command sequence. 74 81 * 75 82 */ 76 83 static irq_cmd_t ne2k_cmds[] = { 77 84 { 85 /* Read Interrupt Status Register */ 78 86 .cmd = CMD_PIO_READ_8, 79 87 .addr = NULL, … … 81 89 }, 82 90 { 91 /* Mask supported interrupt causes */ 83 92 .cmd = CMD_BTEST, 84 .value = 0x7f, 93 .value = (ISR_PRX | ISR_PTX | ISR_RXE | ISR_TXE | ISR_OVW | 94 ISR_CNT | ISR_RDC), 85 95 .srcarg = 2, 86 96 .dstarg = 3, 87 97 }, 88 98 { 99 /* Predicate for accepting the interrupt */ 89 100 .cmd = CMD_PREDICATE, 90 .value = 2,101 .value = 4, 91 102 .srcarg = 3 92 103 }, 93 104 { 105 /* 106 * Mask future interrupts via 107 * Interrupt Mask Register 108 */ 109 .cmd = CMD_PIO_WRITE_8, 110 .addr = NULL, 111 .value = 0 112 }, 113 { 114 /* Acknowledge the current interrupt */ 94 115 .cmd = CMD_PIO_WRITE_A_8, 95 116 .addr = NULL, … … 97 118 }, 98 119 { 120 /* Read Transmit Status Register */ 121 .cmd = CMD_PIO_READ_8, 122 .addr = NULL, 123 .dstarg = 3 124 }, 125 { 99 126 .cmd = CMD_ACCEPT 100 127 } 101 128 }; 102 129 103 /** DP8390 kernel interrupt code.130 /** NE2000 kernel interrupt code. 104 131 * 105 132 */ … … 111 138 /** Handle the interrupt notification. 112 139 * 113 * This is the interrupt notification function. 140 * This is the interrupt notification function. It is quarantied 141 * that there is only a single instance of this notification 142 * function running at one time until the return from the 143 * ne2k_interrupt() function (where the interrupts are unmasked 144 * again). 114 145 * 115 146 * @param[in] iid Interrupt notification identifier. … … 134 165 fibril_rwlock_read_unlock(&netif_globals.lock); 135 166 136 if (ne2k != NULL) 137 ne2k_interrupt(ne2k, IRQ_GET_ISR(*call), nil_phone, device_id); 167 if (ne2k != NULL) { 168 link_t *frames = 169 ne2k_interrupt(ne2k, IRQ_GET_ISR(*call), IRQ_GET_TSR(*call)); 170 171 if (frames != NULL) { 172 while (!list_empty(frames)) { 173 frame_t *frame = 174 list_get_instance(frames->next, frame_t, link); 175 176 list_remove(&frame->link); 177 nil_received_msg(nil_phone, device_id, frame->packet, 178 SERVICE_NONE); 179 free(frame); 180 } 181 182 free(frames); 183 } 184 } 138 185 } 139 186 … … 265 312 266 313 ne2k_cmds[0].addr = ne2k->port + DP_ISR; 267 ne2k_cmds[3].addr = ne2k_cmds[0].addr; 314 ne2k_cmds[3].addr = ne2k->port + DP_IMR; 315 ne2k_cmds[4].addr = ne2k_cmds[0].addr; 316 ne2k_cmds[5].addr = ne2k->port + DP_TSR; 268 317 269 318 int rc = ipc_register_irq(ne2k->irq, device->device_id, … … 278 327 } 279 328 329 change_state(device, NETIF_ACTIVE); 330 280 331 if (irc_service) 281 332 async_msg_1(irc_phone, IRC_ENABLE_INTERRUPT, ne2k->irq); 282 283 change_state(device, NETIF_ACTIVE);284 333 } 285 334 … … 297 346 } 298 347 299 return EOK;348 return device->state; 300 349 } 301 350 … … 349 398 350 399 sysarg_t phonehash; 351 return ipc_connect_to_me(PHONE_NS, SERVICE_ DP8390, 0, 0, &phonehash);400 return ipc_connect_to_me(PHONE_NS, SERVICE_NE2000, 0, 0, &phonehash); 352 401 } 353 402
Note:
See TracChangeset
for help on using the changeset viewer.