| 1 |
/* |
| 2 |
* Cisco router simulation platform. |
| 3 |
* Copyright (c) 2007 Christophe Fillot ([email protected]) |
| 4 |
* |
| 5 |
* Dummy module for c7200 jacket card. |
| 6 |
*/ |
| 7 |
|
| 8 |
#include <stdio.h> |
| 9 |
#include <stdlib.h> |
| 10 |
#include <string.h> |
| 11 |
#include <stdarg.h> |
| 12 |
#include <unistd.h> |
| 13 |
#include <time.h> |
| 14 |
#include <errno.h> |
| 15 |
#include <assert.h> |
| 16 |
|
| 17 |
#include "utils.h" |
| 18 |
#include "net.h" |
| 19 |
#include "net_io.h" |
| 20 |
#include "ptask.h" |
| 21 |
#include "dev_c7200.h" |
| 22 |
|
| 23 |
/* |
| 24 |
* dev_c7200_jcpa_init() |
| 25 |
* |
| 26 |
* Add a c7200 jacket card into slot 0. |
| 27 |
*/ |
| 28 |
static int dev_c7200_jcpa_init(vm_instance_t *vm,struct cisco_card *card) |
| 29 |
{ |
| 30 |
u_int slot = card->slot_id; |
| 31 |
|
| 32 |
if (slot != 0) { |
| 33 |
vm_error(vm,"cannot put C7200-JC-PA in PA bay %u!\n",slot); |
| 34 |
return(-1); |
| 35 |
} |
| 36 |
|
| 37 |
/* Set the EEPROM */ |
| 38 |
cisco_card_set_eeprom(vm,card,cisco_eeprom_find_pa("C7200-JC-PA")); |
| 39 |
c7200_set_slot_eeprom(VM_C7200(vm),slot,&card->eeprom); |
| 40 |
|
| 41 |
/* Store dummy info... */ |
| 42 |
card->drv_info = card; |
| 43 |
return(0); |
| 44 |
} |
| 45 |
|
| 46 |
/* Remove a jacket card from the specified slot */ |
| 47 |
static int dev_c7200_jcpa_shutdown(vm_instance_t *vm,struct cisco_card *card) |
| 48 |
{ |
| 49 |
/* Remove the PA EEPROM */ |
| 50 |
cisco_card_unset_eeprom(card); |
| 51 |
c7200_set_slot_eeprom(VM_C7200(vm),card->slot_id,NULL); |
| 52 |
return(0); |
| 53 |
} |
| 54 |
|
| 55 |
/* Bind a Network IO descriptor */ |
| 56 |
static int dev_c7200_jcpa_set_nio(vm_instance_t *vm,struct cisco_card *card, |
| 57 |
u_int port_id,netio_desc_t *nio) |
| 58 |
{ |
| 59 |
/* network handling is done by slot 7 */ |
| 60 |
return(0); |
| 61 |
} |
| 62 |
|
| 63 |
/* Unbind a Network IO descriptor */ |
| 64 |
static int dev_c7200_jcpa_unset_nio(vm_instance_t *vm,struct cisco_card *card, |
| 65 |
u_int port_id) |
| 66 |
{ |
| 67 |
/* network handling is done by slot 7 */ |
| 68 |
return(0); |
| 69 |
} |
| 70 |
|
| 71 |
/* Jacket card driver */ |
| 72 |
struct cisco_card_driver dev_c7200_jcpa_driver = { |
| 73 |
"C7200-JC-PA", 1, 0, |
| 74 |
dev_c7200_jcpa_init, |
| 75 |
dev_c7200_jcpa_shutdown, |
| 76 |
NULL, |
| 77 |
dev_c7200_jcpa_set_nio, |
| 78 |
dev_c7200_jcpa_unset_nio, |
| 79 |
NULL, |
| 80 |
}; |