void dumpEP(unsigned epNum){ struct endpointDetails_t const *ep = connections+epNum ; write( DEFUART, "------> ep details\r\n" ); write( DEFUART, "cb 0x" ); writeHex( DEFUART, (unsigned)ep->rx_callback ); write( DEFUART, "\r\n" ); write( DEFUART, "dat 0x" ); writeHex( DEFUART, (unsigned)ep->rx_data ); write( DEFUART, "\r\n" ); write( DEFUART, "rxop 0x" ); writeHex( DEFUART, (unsigned)ep->rx_opaque ); write( DEFUART, "\r\n" ); write( DEFUART, "ping 0x" ); writeHexChar( DEFUART, ep->pingPong ); write( DEFUART, "\r\n" ); write( DEFUART, "txAdd 0x" ); writeHexChar( DEFUART, ep->txAdd ); write( DEFUART, "\r\n" ); write( DEFUART, "txTake 0x" ); writeHexChar( DEFUART, ep->txTake ); write( DEFUART, "\r\n" ); write( DEFUART, "txState 0x" ); writeHexChar( DEFUART, ep->txState ); write( DEFUART, "\r\n" ); unsigned i = ep->txTake ; while( i != ep->txAdd ){ write( DEFUART, "[" ); writeHexChar( DEFUART, i ); write( DEFUART, "] == \n " ); struct transmitRequest_t const *tx = ep->txQueue+i ; write( DEFUART, "flags 0x" ); writeHexChar( DEFUART, tx->flags ); write( DEFUART, "\r\n " ); write( DEFUART, "start 0x" ); writeHex( DEFUART, (unsigned)tx->txStart ); write( DEFUART, "\r\n " ); if( tx->txStart ){ dump_sg( tx->txStart ); } write( DEFUART, "next 0x" ); writeHex( DEFUART, (unsigned)tx->txNext ); write( DEFUART, "\r\n " ); if( tx->txNext && ( tx->txNext != tx->txStart ) ){ dump_sg( tx->txStart ); } write( DEFUART, "cb 0x" ); writeHex( DEFUART, (unsigned)tx->callback ); write( DEFUART, "\r\n " ); write( DEFUART, "op 0x" ); writeHex( DEFUART, (unsigned)tx->opaque ); write( DEFUART, "\r\n" ); i++ ; if( i >= MAXTX_ENTRIES ){ i = 0 ; } } }
void scsidbg_dump_cmd( scsi_ureq_t *u ) { int i; dump_cmd_name( u ); printm("%5d [ ", u->size ); for( i=0; i<u->cdb_len; i++ ) printm("%02x ", u->cdb[i] ); while( i++ < 12 ) printm("-- " ); printm("] "); if( !u->scsi_status ) printm( C_GREEN "OK\n" C_NORMAL ); else { if( u->sb_actlen >= 14) dump_sense( (u->sb[2] & 0xf) << 16 | (u->sb[12] << 8) | u->sb[13] ); else printm( C_RED "[STATUS %x]\n" C_NORMAL, u->scsi_status ); } if( !u->scsi_status && u->act_size ) dump_sg( u, 31, u->is_write ? "OUT" : "IN " ); }
static void transmitComplete( unsigned char epNum ) { if( 0 )// != epNum ) NODEBUGMSG( "TXCOMP\r\n" ); struct endpointDetails_t *const ep = &connections[epNum]; struct transmitRequest_t *tx = (ep->txTake != ep->txAdd) ? ep->txQueue + ep->txTake : 0 ; struct transmitRequest_t *firstTx = tx ; int completed = 0 ; ep->txState = EPTX_IDLE ; if( tx && tx->txNext && SG_END(tx->txNext) ){ if( tx->flags & NEEDNULLTX ){ DEBUGMSG( "NULL tx\r\n" ); tx->flags &= ~NEEDNULLTX ; } else { if( tx->callback ) tx->callback( tx->opaque, epNum, tx->txStart ); memset( tx, 0, sizeof(*tx) ); // kill pointers ep->txTake++ ; if( ep->txTake > MAXTX_ENTRIES ) ep->txTake = 0 ; } } // done with previous request tx = (ep->txTake != ep->txAdd) ? ep->txQueue + ep->txTake : 0 ; if( 0 ){ // tx DEBUGMSG( "multi-tx 0x" ); DEBUGHEX( sg_len(tx->txStart) ); DEBUGMSG( " bytes\r\n" ); dump_sg( tx->txStart ); } if( tx ){ if( firstTx == tx ) continueTransmit(epNum,tx); else { UDP_CLEAREPFLAGS(UDP->UDP_CSR+epNum, AT91C_UDP_TXCOMP); DEBUGMSG( "nextTx 0x" ); DEBUGHEX( sg_len(tx->txStart) ); DEBUGMSG("\r\n"); startTransmit(epNum,tx); completed = 1 ; } } else { assert(ep->txTake == ep->txAdd); } if( !completed ) UDP_CLEAREPFLAGS(UDP->UDP_CSR+epNum, AT91C_UDP_TXCOMP); }