[Linux1394-cvslog] rev 527 - trunk
Brought to you by:
aeb,
bencollins
From: SVN U. <hog...@us...> - 2002-07-17 18:42:43
|
Author: hogsberg Date: Wed, 17 Jul 2002 14:42:20 -0400 New Revision: 527 Modified: trunk/amdtp.c Log: Fix bug in start-on-cycle logic. Modified: trunk/amdtp.c ============================================================================== --- trunk/amdtp.c (original) +++ trunk/amdtp.c Wed Jul 17 14:42:29 2002 @@ -333,18 +333,23 @@ static void stream_start_dma(struct stream *s, struct packet_list *pl) { - u32 syt, cycle_count; + u32 syt_cycle, cycle_count, start_cycle; cycle_count = reg_read(s->host->host->hostdata, OHCI1394_IsochronousCycleTimer) >> 12; - syt = be16_to_cpu(pl->packets[0].payload->syt) & 0x0f; - cycle_count = (cycle_count & ~0x0f) + 32 + syt; - if ((cycle_count & 0x1fff) >= 8000) - cycle_count = cycle_count - 8000 + 0x2000; + syt_cycle = (pl->last_cycle_count - PACKET_LIST_SIZE + 1) & 0x0f; + + /* We program the DMA controller to start transmission at + * least 17 cycles from now - this happens when the lower four + * bits of cycle_count is 0x0f and syt_cycle is 0, in this + * case the start cycle is cycle_count - 15 + 32. */ + start_cycle = (cycle_count & ~0x0f) + 32 + syt_cycle; + if ((start_cycle & 0x1fff) >= 8000) + start_cycle = start_cycle - 8000 + 0x2000; ohci1394_start_it_ctx(s->host->ohci, s->iso_context, pl->packets[0].db_bus, 3, - cycle_count & 0x7fff); + start_cycle & 0x7fff); } static void stream_put_dma_packet_list(struct stream *s, @@ -744,13 +749,12 @@ s->cycle_offset.integer) & 0xffff; fraction_add(&s->cycle_offset, &s->cycle_offset, &s->ticks_per_syt_offset); - if (s->cycle_offset.integer >= 3072) { - /* This next addition should be modulo 8000 - * (0x1f40), but we only use the lower 4 bits - * of cycle_count, so we dont need the modulo. */ - atomic_add(s->cycle_offset.integer / 3072, &s->cycle_count); - s->cycle_offset.integer %= 3072; - } + + /* This next addition should be modulo 8000 (0x1f40), + * but we only use the lower 4 bits of cycle_count, so + * we dont need the modulo. */ + atomic_add(s->cycle_offset.integer / 3072, &s->cycle_count); + s->cycle_offset.integer %= 3072; } else syt = 0xffff; @@ -891,7 +895,7 @@ static int stream_configure(struct stream *s, int cmd, struct amdtp_ioctl *cfg) { - const int transfer_delay = 3000; + const int transfer_delay = 9000; if (cfg->format <= AMDTP_FORMAT_IEC958_AC3) s->format = cfg->format; |