Changeset 3a5d238f in mainline
- Timestamp:
- 2010-11-07T21:11:33Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 278b97b1
- Parents:
- 0ab68f6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hw/netif/dp8390/dp8390_module.c
r0ab68f6 r3a5d238f 158 158 159 159 int netif_get_device_stats(device_id_t device_id, device_stats_ref stats){ 160 ERROR_DECLARE;161 162 160 netif_device_t * device; 163 161 eth_stat_t * de_stat; 162 int rc; 164 163 165 164 if(! stats){ 166 165 return EBADMEM; 167 166 } 168 ERROR_PROPAGATE(find_device(device_id, &device)); 167 rc = find_device(device_id, &device); 168 if (rc != EOK) 169 return rc; 169 170 de_stat = &((dpeth_t *) device->specific)->de_stat; 170 171 null_device_stats(stats); … … 185 186 186 187 int netif_get_addr_message(device_id_t device_id, measured_string_ref address){ 187 ERROR_DECLARE; 188 189 netif_device_t * device; 188 netif_device_t * device; 189 int rc; 190 190 191 191 if(! address){ 192 192 return EBADMEM; 193 193 } 194 ERROR_PROPAGATE(find_device(device_id, &device)); 194 rc = find_device(device_id, &device); 195 if (rc != EOK) 196 return rc; 195 197 address->value = (char *) (&((dpeth_t *) device->specific)->de_address); 196 198 address->length = CONVERT_SIZE(ether_addr_t, char, 1); … … 201 203 202 204 int netif_probe_message(device_id_t device_id, int irq, uintptr_t io){ 203 ERROR_DECLARE; 204 205 netif_device_t * device; 206 dpeth_t * dep; 205 netif_device_t * device; 206 dpeth_t * dep; 207 int rc; 207 208 208 209 device = (netif_device_t *) malloc(sizeof(netif_device_t)); … … 224 225 dep->de_mode = DEM_DISABLED; 225 226 //TODO address? 226 if(ERROR_OCCURRED(pio_enable((void *) io, DP8390_IO_SIZE, (void **) &dep->de_base_port))227 || ERROR_OCCURRED(do_probe(dep))){227 rc = pio_enable((void *) io, DP8390_IO_SIZE, (void **) &dep->de_base_port); 228 if (rc != EOK) { 228 229 free(dep); 229 230 free(device); 230 return ERROR_CODE; 231 } 232 if(ERROR_OCCURRED(netif_device_map_add(&netif_globals.device_map, device->device_id, device))){ 231 return rc; 232 } 233 rc = do_probe(dep); 234 if (rc != EOK) { 233 235 free(dep); 234 236 free(device); 235 return ERROR_CODE; 237 return rc; 238 } 239 rc = netif_device_map_add(&netif_globals.device_map, device->device_id, device); 240 if (rc != EOK){ 241 free(dep); 242 free(device); 243 return rc; 236 244 } 237 245 return EOK; … … 239 247 240 248 int netif_send_message(device_id_t device_id, packet_t packet, services_t sender){ 241 ERROR_DECLARE;242 243 249 netif_device_t * device; 244 250 dpeth_t * dep; 245 251 packet_t next; 246 247 ERROR_PROPAGATE(find_device(device_id, &device)); 252 int rc; 253 254 rc = find_device(device_id, &device); 255 if (rc != EOK) 256 return rc; 248 257 if(device->state != NETIF_ACTIVE){ 249 258 netif_pq_release(packet_get_id(packet)); … … 263 272 264 273 int netif_start_message(netif_device_t * device){ 265 ERROR_DECLARE; 266 267 dpeth_t * dep; 274 dpeth_t * dep; 275 int rc; 268 276 269 277 if(device->state != NETIF_ACTIVE){ … … 271 279 dp8390_cmds[0].addr = (void *) (uintptr_t) (dep->de_dp8390_port + DP_ISR); 272 280 dp8390_cmds[2].addr = dp8390_cmds[0].addr; 273 ERROR_PROPAGATE(ipc_register_irq(dep->de_irq, device->device_id, device->device_id, &dp8390_code)); 274 if(ERROR_OCCURRED(do_init(dep, DL_BROAD_REQ))){ 281 rc = ipc_register_irq(dep->de_irq, device->device_id, device->device_id, &dp8390_code); 282 if (rc != EOK) 283 return rc; 284 rc = do_init(dep, DL_BROAD_REQ); 285 if (rc != EOK) { 275 286 ipc_unregister_irq(dep->de_irq, device->device_id); 276 return ERROR_CODE;287 return rc; 277 288 } 278 289 return change_state(device, NETIF_ACTIVE); … … 350 361 int main(int argc, char *argv[]) 351 362 { 352 ERROR_DECLARE;363 int rc; 353 364 354 365 /* Start the module */ 355 if (ERROR_OCCURRED(netif_module_start(netif_client_connection))) 356 return ERROR_CODE; 357 358 return EOK; 366 rc = netif_module_start(netif_client_connection); 367 return rc; 359 368 } 360 369
Note:
See TracChangeset
for help on using the changeset viewer.