Line 50... |
Line 50... |
/* clock */
|
/* clock */
|
static void eth_controller_tx_clock( struct eth_device * );
|
static void eth_controller_tx_clock( struct eth_device * );
|
static void eth_controller_rx_clock( struct eth_device * );
|
static void eth_controller_rx_clock( struct eth_device * );
|
/* utility functions */
|
/* utility functions */
|
static int eth_find_controller( unsigned long addr, struct eth_device **eth, unsigned long *reladdr );
|
static int eth_find_controller( unsigned long addr, struct eth_device **eth, unsigned long *reladdr );
|
struct eth_device *eth_find_vapi_device (unsigned long id, unsigned *which);
|
struct eth_device *eth_find_vapi_device (unsigned long id, unsigned long *which);
|
static ssize_t eth_read_rx_file( struct eth_device *, void *, size_t );
|
static ssize_t eth_read_rx_file( struct eth_device *, void *, size_t );
|
static void eth_skip_rx_file( struct eth_device *, off_t );
|
static void eth_skip_rx_file( struct eth_device *, off_t );
|
static void eth_rewind_rx_file( struct eth_device *, off_t );
|
static void eth_rewind_rx_file( struct eth_device *, off_t );
|
static void eth_rx_next_packet( struct eth_device * );
|
static void eth_rx_next_packet( struct eth_device * );
|
static void eth_write_tx_bd_num( struct eth_device *, unsigned long value );
|
static void eth_write_tx_bd_num( struct eth_device *, unsigned long value );
|
Line 312... |
Line 312... |
runtime.sim.cont_run = 0;
|
runtime.sim.cont_run = 0;
|
break;
|
break;
|
}
|
}
|
|
|
/* Packet must be big enough to hold a header */
|
/* Packet must be big enough to hold a header */
|
if ( eth->rx.packet_length < ETH_HLEN ){
|
if ( eth->rx.packet_length < ETHER_HDR_LEN ){
|
debug( 3, "eth_start_rx(): Packet too small\n" );
|
debug( 3, "eth_start_rx(): Packet too small\n" );
|
eth_rx_next_packet( eth );
|
eth_rx_next_packet( eth );
|
|
|
debug (3, "RX - entering state IDLE\n");
|
debug (3, "RX - entering state IDLE\n");
|
eth->rx.state = ETH_RXSTATE_IDLE;
|
eth->rx.state = ETH_RXSTATE_IDLE;
|
Line 547... |
Line 547... |
eth->rxfd = eth->txfd = -1;
|
eth->rxfd = eth->txfd = -1;
|
|
|
if ( (eth->rxfd = open( eth->rxfile, O_RDONLY )) < 0 )
|
if ( (eth->rxfd = open( eth->rxfile, O_RDONLY )) < 0 )
|
fprintf( stderr, "Cannot open Ethernet RX file \"%s\"\n", eth->rxfile );
|
fprintf( stderr, "Cannot open Ethernet RX file \"%s\"\n", eth->rxfile );
|
if ( (eth->txfd = open( eth->txfile,
|
if ( (eth->txfd = open( eth->txfile,
|
O_RDWR | O_CREAT | O_APPEND | O_SYNC,
|
O_RDWR | O_CREAT | O_APPEND
|
|
|
|
#if defined(O_SYNC) /* BSD / Mac OS X manual doesn't know about O_SYNC */
|
|
| O_SYNC
|
|
#endif
|
|
,
|
S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH )) < 0 )
|
S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH )) < 0 )
|
fprintf( stderr, "Cannot open Ethernet TX file \"%s\"\n", eth->txfile );
|
fprintf( stderr, "Cannot open Ethernet TX file \"%s\"\n", eth->txfile );
|
eth->loopback_offset = lseek( eth->txfd, 0, SEEK_END );
|
eth->loopback_offset = lseek( eth->txfd, 0, SEEK_END );
|
|
|
break;
|
break;
|
Line 856... |
Line 861... |
}
|
}
|
|
|
/*
|
/*
|
* Convert VAPI id to controller struct and relative address.
|
* Convert VAPI id to controller struct and relative address.
|
*/
|
*/
|
struct eth_device *eth_find_vapi_device( unsigned long id, unsigned *which )
|
struct eth_device *eth_find_vapi_device( unsigned long id, unsigned long *which )
|
{
|
{
|
unsigned i;
|
unsigned i;
|
|
|
for ( i=0; i<config.nethernets; i++) {
|
for ( i=0; i<config.nethernets; i++) {
|
if ( (id>=eths[i].base_vapi_id) && (id < eths[i].base_vapi_id + ETH_NUM_VAPI_IDS)) {
|
if ( (id>=eths[i].base_vapi_id) && (id < eths[i].base_vapi_id + ETH_NUM_VAPI_IDS)) {
|