comparison rathaxes_correctly_use_chunk_and_template_sequences_parameters_in_e1000.patch @ 64:8dc1a3bf372a

WIP e1000 sample
author Louis Opter <louis@lse.epitech.net>
date Sat, 18 Feb 2012 13:36:07 +0100
parents b820c4604946
children e77a4126576c 901af221334b
comparison
equal deleted inserted replaced
63:b820c4604946 64:8dc1a3bf372a
1 # HG changeset patch 1 # HG changeset patch
2 # Parent 293f1b3181e2a2339e31d7cdb0637a019b96d3cc 2 # Parent e24ae3e49b73a2b799765d863f69f0c956ea2c54
3 # User Louis Opter <louis@lse.epitech.net>, David Pineau <dav.pineau@gmail.com> 3 # User Louis Opter <louis@lse.epitech.net>, David Pineau <dav.pineau@gmail.com>
4 rathaxes: correctly use chunk and template sequences parameters in the e1000 sample 4 rathaxes: correctly use chunk and template sequences parameters in the e1000 sample
5 5
6 diff --git a/rathaxes/samples/e1000/e1000.blt b/rathaxes/samples/e1000/e1000.blt 6 diff --git a/rathaxes/samples/e1000/e1000.blt b/rathaxes/samples/e1000/e1000.blt
7 --- a/rathaxes/samples/e1000/e1000.blt 7 --- a/rathaxes/samples/e1000/e1000.blt
53 + /* 53 + /*
54 + * We could have used an init function here but since we can't init 54 + * We could have used an init function here but since we can't init
55 + * all the fields at once (see, ioaddr) and cannot call a C 55 + * all the fields at once (see, ioaddr) and cannot call a C
56 + * function within a placeholder (${}), it wasn't really worth it. 56 + * function within a placeholder (${}), it wasn't really worth it.
57 + */ 57 + */
58 + ${rtx_ether_ctx}->bars = pci_select_bars(${pdev}, IORESOURCE_MEM); 58 + ${rtx_ether_ctx}->hw_ctx.bars = pci_select_bars(${pdev}, IORESOURCE_MEM);
59 + ${rtx_ether_ctx}->irq = ${pdev}->irq; 59 + ${rtx_ether_ctx}->hw_ctx.irq = ${pdev}->irq;
60 + 60 +
61 + if (pci_enable_device_mem(${pdev})) 61 + if (pci_enable_device_mem(${pdev}))
62 { 62 {
63 ${Log::info("e1000::create: pci_enable_device_mem failed")}; 63 ${Log::info("e1000::create: pci_enable_device_mem failed")};
64 } 64 }
289 + ${self}->pci_dev = ${pci_dev}; 289 + ${self}->pci_dev = ${pci_dev};
290 + ${self}->net_dev = ${net_dev}; 290 + ${self}->net_dev = ${net_dev};
291 } 291 }
292 292
293 map 293 map
294 @@ -45,7 +63,7 @@ 294 @@ -45,10 +63,10 @@
295 { 295 {
296 static int rtx_ethernet_open(struct net_device *dev) 296 static int rtx_ethernet_open(struct net_device *dev)
297 { 297 {
298 - struct rtx_ethernet_dev* rtx_ether_dev = netdev_priv(dev); 298 - struct rtx_ethernet_dev* rtx_ether_dev = netdev_priv(dev);
299 + struct rtx_ethernet_dev* rtx_ether_dev = netdev_priv(dev); 299 + struct rtx_ethernet_dev* rtx_ether_dev = netdev_priv(dev);
300 struct rtx_e1000_ctx* ctx = &rtx_ether_dev->hw_ctx; 300 struct rtx_e1000_ctx* ctx = &rtx_ether_dev->hw_ctx;
301 301
302 ${pointcut ::IMPLEMENTATION}; 302 - ${pointcut ::IMPLEMENTATION};
303 + ${pointcut ::IMPLEMENTATION(local.rtx_ethernet_dev)};
304
305 return 0;
306 }
303 @@ -121,7 +139,7 @@ 307 @@ -121,7 +139,7 @@
304 } 308 }
305 } 309 }
306 310
307 - template sequence Ethernet::init(PCI::Device pdev) 311 - template sequence Ethernet::init(PCI::Device pdev)
398 - chunk PCI::pci_remove_hook() 402 - chunk PCI::pci_remove_hook()
399 + chunk PCI::pci_remove_hook(/* PCI::Device */ pdev) 403 + chunk PCI::pci_remove_hook(/* PCI::Device */ pdev)
400 { 404 {
401 - struct net_device *net_dev = pci_get_drvdata(pdev); 405 - struct net_device *net_dev = pci_get_drvdata(pdev);
402 + /* workaround for cnorm unstrict */ 406 + /* workaround for cnorm unstrict */
403 + typedef int ${Ethernet::device}; 407 + typedef int ${Ethernet::Device};
404 408
405 - ${pointcut Ethernet::destroy_device}; 409 - ${pointcut Ethernet::destroy_device};
406 + struct net_device *net_dev = pci_get_drvdata(${pdev}); 410 + struct net_device *net_dev = pci_get_drvdata(${pdev});
407 + ${Ethernet::device} rtx_ether_ctx = netdev_priv(net_dev); 411 + ${Ethernet::Device} rtx_ether_ctx = netdev_priv(net_dev);
408 + 412 +
409 + ${pointcut Ethernet::destroy_device(pdev, local.rtx_ether_ctx)}; 413 + ${pointcut Ethernet::destroy_device(pdev, local.rtx_ether_ctx)};
410 414
411 unregister_netdev(net_dev); 415 unregister_netdev(net_dev);
412 - /* 416 - /*