Subversion Repositories HelenOS

Compare Revisions

Regard whitespace Rev 4326 → Rev 4327

/branches/network/uspace/srv/net/netif/dp8390/dp8390.c
205,6 → 205,58
}
 
/*===========================================================================*
* dp8390_dump *
*===========================================================================*/
void dp8390_dump( dpeth_t * dep )
{
// dpeth_t *dep;
int /*i,*/ isr;
 
// printf("\n");
// for (i= 0, dep = &de_table[0]; i<DE_PORT_NR; i++, dep++)
// {
#if XXX
if (dep->de_mode == DEM_DISABLED)
printf("dp8390 port %d is disabled\n", i);
else if (dep->de_mode == DEM_SINK)
printf("dp8390 port %d is in sink mode\n", i);
#endif
 
if (dep->de_mode != DEM_ENABLED)
// continue;
return;
 
// printf("dp8390 statistics of port %d:\n", i);
 
printf("recvErr :%8ld\t", dep->de_stat.ets_recvErr);
printf("sendErr :%8ld\t", dep->de_stat.ets_sendErr);
printf("OVW :%8ld\n", dep->de_stat.ets_OVW);
 
printf("CRCerr :%8ld\t", dep->de_stat.ets_CRCerr);
printf("frameAll :%8ld\t", dep->de_stat.ets_frameAll);
printf("missedP :%8ld\n", dep->de_stat.ets_missedP);
 
printf("packetR :%8ld\t", dep->de_stat.ets_packetR);
printf("packetT :%8ld\t", dep->de_stat.ets_packetT);
printf("transDef :%8ld\n", dep->de_stat.ets_transDef);
 
printf("collision :%8ld\t", dep->de_stat.ets_collision);
printf("transAb :%8ld\t", dep->de_stat.ets_transAb);
printf("carrSense :%8ld\n", dep->de_stat.ets_carrSense);
 
printf("fifoUnder :%8ld\t", dep->de_stat.ets_fifoUnder);
printf("fifoOver :%8ld\t", dep->de_stat.ets_fifoOver);
printf("CDheartbeat:%8ld\n", dep->de_stat.ets_CDheartbeat);
 
printf("OWC :%8ld\t", dep->de_stat.ets_OWC);
 
isr= inb_reg0(dep, DP_ISR);
printf("dp_isr = 0x%x + 0x%x, de_flags = 0x%x\n", isr,
inb_reg0(dep, DP_ISR), dep->de_flags);
// }
}
 
/*===========================================================================*
* do_init *
*===========================================================================*/
int do_init( dpeth_t * dep, int mode ){
588,10 → 640,11
/*===========================================================================*
* dp_check_ints *
*===========================================================================*/
void dp_check_ints(dep)
void dp_check_ints(dep, isr)
dpeth_t *dep;
int isr;
{
int isr, tsr;
int /*isr,*/ tsr;
int size, sendq_tail;
 
if (!(dep->de_flags & DEF_ENABLED))
599,7 → 652,7
 
for(;;)
{
isr = inb_reg0(dep, DP_ISR);
// isr = inb_reg0(dep, DP_ISR);
if (!isr)
break;
outb_reg0(dep, DP_ISR, isr);
720,6 → 773,7
dep->de_flags |= DEF_STOPPED;
break;
}
isr = inb_reg0(dep, DP_ISR);
}
if ((dep->de_flags & (DEF_READING|DEF_STOPPED)) ==
(DEF_READING|DEF_STOPPED))
1504,8 → 1558,8
if (r < 0)
panic("", "dp8390: send failed:", r);
dep->de_read_s = 0;
*/ dep->de_flags &= ~(DEF_PACK_SEND | DEF_PACK_RECV);
*/ dep->de_read_s = 0;
dep->de_flags &= ~(DEF_PACK_SEND | DEF_PACK_RECV);
}
 
/*===========================================================================*
/branches/network/uspace/srv/net/netif/dp8390/dp8390_drv.h
40,9 → 40,10
 
_PROTOTYPE( int do_init, (dpeth_t *dep, int mode) );
_PROTOTYPE( void do_stop, (dpeth_t *dep) );
_PROTOTYPE( void dp_check_ints, (dpeth_t *dep) );
_PROTOTYPE( void dp_check_ints, (dpeth_t *dep, int isr) );
int do_probe( dpeth_t * dep );
int do_pwrite( dpeth_t * dep, packet_t packet, int from_int );
void dp8390_dump( dpeth_t * dep );
 
#endif
 
/branches/network/uspace/srv/net/netif/dp8390/dp8390_module.c
34,6 → 34,7
*/
 
#include <assert.h>
#include <async.h>
#include <ddi.h>
#include <errno.h>
#include <malloc.h>
70,14 → 71,14
},
{
.cmd = CMD_PREDICATE,
.value = 2,
.value = 1,
.srcarg = 2
},
{ .cmd = CMD_PIO_WRITE_8,
/* { .cmd = CMD_PIO_WRITE_8,
.addr = NULL,
.srcarg = 2
.value = 0
},
{
*/ {
.cmd = CMD_ACCEPT
}
};
141,7 → 142,6
 
void irq_handler( ipc_callid_t iid, ipc_call_t * call )
{
// int irq;
device_ref device;
dpeth_t * dep;
packet_t received;
148,35 → 148,31
device_id_t device_id;
int phone;
 
// async_serialize_start();
device_id = IRQ_GET_DEVICE( call );
// printf( "device %d - irq %x\n", device_id, IPC_GET_ISR( call ));
rwlock_write_lock( & netif_globals.lock );
if( find_device( device_id, & device ) != EOK ){
rwlock_write_unlock( & netif_globals.lock );
// async_serialize_end()
return;
}
dep = ( dpeth_t * ) device->specific;
// printf( "dev %d, irq %x\n\n", device->device_id, IPC_GET_ISR( call ));
if ( dep->de_mode != DEM_ENABLED){
// continue;
rwlock_write_unlock( & netif_globals.lock );
// async_serialize_end()
return;
}
assert( dep->de_flags & DEF_ENABLED);
// irq= dep.de_irq;
// assert(irq >= 0 && irq < NR_IRQ_VECTORS);
// if ( dep->de_int_pending || 1)
// {
dep->de_int_pending= 0;
dp_check_ints( dep );
// do_int(dep);
/* r= sys_irqenable(&dep->de_hook);
if (r != OK)
{
panic("DP8390",
"unable enable interrupts", r);
}
*/// }
printf( "I%d -%d\n", device_id, IPC_GET_ISR( call ));
/* putchar( 'I' );
putchar( '0' + device_id );
putchar( '-' );
putchar( '0' + IPC_GET_ISR( call ) / 100 );
putchar( '0' + ( IPC_GET_ISR( call ) % 100 ) / 10 );
putchar( '0' + IPC_GET_ISR( call ) % 10 );
putchar( '\n' );
*/ dp_check_ints( dep, IPC_GET_ISR( call ));
if( dep->received_queue ){
received = dep->received_queue;
phone = device->nil_phone;
187,6 → 183,7
rwlock_write_unlock( & netif_globals.lock );
}
ipc_answer_0( iid, EOK );
// async_serialize_end()
}
 
int netif_probe_auto_message( void ){
236,12 → 233,13
dpeth_t * dep;
packet_t next;
 
ERROR_PROPAGATE( find_device( device_id, & device ));
dep = ( dpeth_t * ) device->specific;
// TODO remove debug dump:
uint8_t * data;
data = packet_get_data( packet );
printf( "Sending packet:\n\tid\t= %d\n\tlength\t= %d\n\tdata\t= %.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX\n\t\t%.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX:%.2hhX %.2hhX %.2hhX %.2hhX\n", packet_get_id( packet ), packet_get_data_length( packet ), data[ 0 ], data[ 1 ], data[ 2 ], data[ 3 ], data[ 4 ], data[ 5 ], data[ 6 ], data[ 7 ], data[ 8 ], data[ 9 ], data[ 10 ], data[ 11 ], data[ 12 ], data[ 13 ], data[ 14 ], data[ 15 ], data[ 16 ], data[ 17 ], data[ 18 ], data[ 19 ], data[ 20 ], data[ 21 ], data[ 22 ], data[ 23 ], data[ 24 ], data[ 25 ], data[ 26 ], data[ 27 ], data[ 28 ], data[ 29 ], data[ 30 ], data[ 31 ], data[ 32 ], data[ 33 ], data[ 34 ], data[ 35 ], data[ 36 ], data[ 37 ], data[ 38 ], data[ 39 ], data[ 40 ], data[ 41 ], data[ 42 ], data[ 43 ], data[ 44 ], data[ 45 ], data[ 46 ], data[ 47 ], data[ 48 ], data[ 49 ], data[ 50 ], data[ 51 ], data[ 52 ], data[ 53 ], data[ 54 ], data[ 55 ], data[ 56 ], data[ 57 ], data[ 58 ], data[ 59 ] );
 
ERROR_PROPAGATE( find_device( device_id, & device ));
dep = ( dpeth_t * ) device->specific;
// process packet queue
do{
next = pq_detach( packet );
250,6 → 248,7
}
packet = next;
}while( packet );
dp8390_dump( dep );
return EOK;
}