kernels/linux-2.4.0/drivers/ieee1394/ohci1394.c
/* 
 * Determine the length of a packet in the buffer
 * Optimization suggested by Pascal Drolet <pascal.drolet@informission.ca>
 */
Determine the length of a packet in the buffer
Optimization suggested by Pascal Drolet 
Determine the length of a packet in the buffer Optimization suggested by Pascal Drolet
static int packet_length(struct dma_rcv_ctx *d, int idx, quadlet_t *buf_ptr,
int offset)
{
	unsigned char 	tcode;
	int 		length 	= -1;
	tcode = (buf_ptr[0] >> 4) & 0xf;
	if (d->ctx < 2) { 
		length = TCODE_SIZE[tcode];
		if (length == 0) 
			length = block_length(d, idx, buf_ptr, offset) + 20;
	}
	else if (d->ctx==2) { 
		length = (buf_ptr[0]>>16);
		if (length % 4) length += 4 - (length % 4);
		length+=8;
	}
	return length;
}
static int packet_length ( struct dma_rcv_ctx * d , int idx , quadlet_t * buf_ptr , int offset ) { unsigned char tcode ; int length = -1 ; tcode = ( buf_ptr [ 0 ] >> 4 ) & 0xf ; if ( d -> ctx < 2 ) { length = TCODE_SIZE [ tcode ] ; if ( length == 0 ) length = block_length ( d , idx , buf_ptr , offset ) + 20 ; } else if ( d -> ctx == 2 ) { length = ( buf_ptr [ 0 ] >> 16 ) ; if ( length % 4 ) length += 4 - ( length % 4 ) ; length += 8 ; } return length ; }
Determine the length of a packet in the buffer
 Optimization suggested by Pascal Drolet <pascal.drolet@informission.ca>
Determine the length of a packet in the buffer Optimization suggested by Pascal Drolet <pascal . drolet@informission . ca >
/* Let's see what kind of packet is in there */ /* Async Receive Response/Request */ /* Iso receive */ /* Assumption: buffer fill mode with header/trailer */