Re: Which kernel source is best?
Brought to you by:
aeb,
bencollins
From: Andreas M. <am...@iv...> - 2000-10-06 13:06:50
|
Hi Damien, On Fri, Oct 06, 2000 at 01:06:21PM +0200, Damien Douxchamps wrote: > Just a thought: the user manual of some Sony cameras says you have to > wait at least 2ms between CSR accesses (up to 10ms for some registers). > If this value depends on the camera, this means we should somehow probe > for that delay. But how? Probing for that should no longer be neccessary, because the device should return an ACK BUSY when requests are coming in to fast. Here is what I do in gscanbus now: ---------- snip ---------- /* Mask and shift macros */ #define RAW1394_MASK_ACK(x) ((x) >> 16) #define RAW1394_MASK_RCODE(x) ((x) & 0xffff) /* Ack codes */ #define ACK_COMPLETE 0x1 #define ACK_PENDING 0x2 #define ACK_BUSY_X 0x4 #define ACK_BUSY_A 0x5 #define ACK_BUSY_B 0x6 #define ACK_DATA_ERROR 0xd #define ACK_TYPE_ERROR 0xe #define ACK_LOCAL 0x10 /* Return codes */ #define RCODE_COMPLETE 0x0 #define RCODE_CONFLICT_ERROR 0x4 #define RCODE_DATA_ERROR 0x5 #define RCODE_TYPE_ERROR 0x6 #define RCODE_ADDRESS_ERROR 0x7 int cooked1394_read(raw1394handle_t handle, nodeid_t node, nodeaddr_t addr, size_t length, quadlet_t *buffer) { int retval, ackcode, rcode; while(1) { retval = raw1394_read(handle, node, addr, length, buffer); if( retval < 0 ) return retval; ackcode = RAW1394_MASK_ACK(retval); rcode = RAW1394_MASK_RCODE(retval); if( ackcode == ACK_BUSY_X || ackcode == ACK_BUSY_A || ackcode == ACK_BUSY_B ) { usleep(100); } else { break; } } if( ackcode != ACK_PENDING && ackcode != ACK_COMPLETE && ackcode != ACK_LOCAL) return -1; return retval; } ---------- snap ---------- The write function is left as an exercise to the reader. ;^) Can someone please comment if this is correct? -- Andreas Micklei IVISTAR Kommunikationssysteme AG Ehrenbergstr. 19 / 10245 Berlin http://www.ivistar.de |