/[dynamips]/upstream/dynamips-0.2.8-RC1/dev_c2691_serial.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /upstream/dynamips-0.2.8-RC1/dev_c2691_serial.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

upstream/dynamips-0.2.7/dev_c2691_serial.c revision 10 by dpavlin, Sat Oct 6 16:29:14 2007 UTC upstream/dynamips-0.2.8-RC1/dev_c2691_serial.c revision 11 by dpavlin, Sat Oct 6 16:33:40 2007 UTC
# Line 30  Line 30 
30   *   *
31   * Add a NM-4T network module into specified slot.   * Add a NM-4T network module into specified slot.
32   */   */
33  int dev_c2691_nm_4t_init(c2691_t *router,char *name,u_int nm_bay)  int dev_c2691_nm_4t_init(vm_instance_t *vm,struct cisco_card *card)
34  {  {
35     struct mueslix_data *data;     struct mueslix_data *data;
36       u_int slot = card->slot_id;
37    
38       /* Set the PCI bus */
39       card->pci_bus = vm->slots_pci_bus[slot];
40    
41     /* Set the EEPROM */     /* Set the EEPROM */
42     c2691_nm_set_eeprom(router,nm_bay,cisco_eeprom_find_nm("NM-4T"));     cisco_card_set_eeprom(vm,card,cisco_eeprom_find_nm("NM-4T"));
43       c2691_set_slot_eeprom(VM_C2691(vm),slot,&card->eeprom);
44    
45     /* Create the Mueslix chip */     /* Create the Mueslix chip */
46     data = dev_mueslix_init(router->vm,name,0,     data = dev_mueslix_init(vm,card->dev_name,0,card->pci_bus,6,
47                             router->nm_bay[nm_bay].pci_map,                             c2691_net_irq_for_slot_port(slot,0));
                            6,c2691_net_irq_for_slot_port(nm_bay,0));  
48    
49     if (!data) return(-1);     if (!data) return(-1);
50    
51     /* Store device info into the router structure */     /* Store device info into the router structure */
52     return(c2691_nm_set_drvinfo(router,nm_bay,data));     card->drv_info = data;
53       return(0);
54  }  }
55    
56  /* Remove a NM-4T from the specified slot */  /* Remove a NM-4T from the specified slot */
57  int dev_c2691_nm_4t_shutdown(c2691_t *router,u_int nm_bay)  int dev_c2691_nm_4t_shutdown(vm_instance_t *vm,struct cisco_card *card)
58  {  {
59     struct c2691_nm_bay *bay;     /* Remove the NM EEPROM */
60       cisco_card_unset_eeprom(card);
61     if (!(bay = c2691_nm_get_info(router,nm_bay)))     c2691_set_slot_eeprom(VM_C2691(vm),card->slot_id,NULL);
       return(-1);  
62    
63     c2691_nm_unset_eeprom(router,nm_bay);     /* Remove the mueslix driver */
64     dev_mueslix_remove(bay->drv_info);     dev_mueslix_remove(card->drv_info);
65     return(0);     return(0);
66  }  }
67    
68  /* Bind a Network IO descriptor to a specific port */  /* Bind a Network IO descriptor to a specific port */
69  int dev_c2691_nm_4t_set_nio(c2691_t *router,u_int nm_bay,u_int port_id,  int dev_c2691_nm_4t_set_nio(vm_instance_t *vm,struct cisco_card *card,
70                              netio_desc_t *nio)                              u_int port_id,netio_desc_t *nio)
71  {  {
72     struct mueslix_data *data;     struct mueslix_data *d = card->drv_info;
73    
74     if ((port_id >= MUESLIX_NR_CHANNELS) ||     if (!d || (port_id >= MUESLIX_NR_CHANNELS))
        !(data = c2691_nm_get_drvinfo(router,nm_bay)))  
75        return(-1);        return(-1);
76    
77     return(dev_mueslix_set_nio(data,port_id,nio));     return(dev_mueslix_set_nio(d,port_id,nio));
78  }  }
79    
80  /* Unbind a Network IO descriptor to a specific port */  /* Unbind a Network IO descriptor to a specific port */
81  int dev_c2691_nm_4t_unset_nio(c2691_t *router,u_int nm_bay,u_int port_id)  int dev_c2691_nm_4t_unset_nio(vm_instance_t *vm,struct cisco_card *card,
82                                  u_int port_id)
83  {  {
84     struct mueslix_data *d;     struct mueslix_data *d = card->drv_info;
85    
86     if ((port_id >= MUESLIX_NR_CHANNELS) ||     if (!d || (port_id >= MUESLIX_NR_CHANNELS))
        !(d = c2691_nm_get_drvinfo(router,nm_bay)))  
87        return(-1);        return(-1);
88        
89     return(dev_mueslix_unset_nio(d,port_id));     return(dev_mueslix_unset_nio(d,port_id));
90  }  }
91    
92  /* NM-4T driver */  /* NM-4T driver */
93  struct c2691_nm_driver dev_c2691_nm_4t_driver = {  struct cisco_card_driver dev_c2691_nm_4t_driver = {
94     "NM-4T", 1, 0,     "NM-4T", 1, 0,
95     dev_c2691_nm_4t_init,     dev_c2691_nm_4t_init,
96     dev_c2691_nm_4t_shutdown,     dev_c2691_nm_4t_shutdown,
97       NULL,
98     dev_c2691_nm_4t_set_nio,     dev_c2691_nm_4t_set_nio,
99     dev_c2691_nm_4t_unset_nio,     dev_c2691_nm_4t_unset_nio,
100     NULL,     NULL,

Legend:
Removed from v.10  
changed lines
  Added in v.11

  ViewVC Help
Powered by ViewVC 1.1.26