kernels/linux-2.4.0/drivers/ieee1394/ohci1394.c
/*
 * This function fills the AT FIFO with the (eventual) pending packets
 * and runs or wake up the AT DMA prg if necessary.
 * The function MUST be called with the d->lock held.
 */
This function fills the AT FIFO with the (eventual) pending packets
and runs or wake up the AT DMA prg if necessary.
The function MUST be called with the d->lock held.
This function fills the AT FIFO with the ( eventual ) pending packets and runs or wake up the AT DMA prg if necessary . The function MUST be called with the d - > lock held .
static int dma_trm_flush(struct ti_ohci *ohci, struct dma_trm_ctx *d)
{
	int idx,z;
	if (d->pending_first == NULL || d->free_prgs == 0) 
		return 0;
	idx = d->prg_ind;
	z = (d->pending_first->data_size) ? 3 : 2;
	while (d->free_prgs>0 && d->pending_first) {
		insert_packet(ohci, d, d->pending_first);
		d->pending_first = d->pending_first->xnext;
	}
	if (d->pending_first == NULL) 
		d->pending_last = NULL;
	else
		PRINT(KERN_INFO, ohci->id, 
		      "AT DMA FIFO ctx=%d full... waiting",d->ctx);
	if (!(reg_read(ohci, d->ctrlSet) & 0x8000)) {
		DBGMSG(ohci->id,"Starting AT DMA ctx=%d",d->ctx);
		reg_write(ohci, d->cmdPtr, d->prg_bus[idx]|z);
		run_context(ohci, d->ctrlSet, NULL);
	}
	else {
		DBGMSG(ohci->id,"Waking AT DMA ctx=%d",d->ctx);
		if (!(reg_read(ohci, d->ctrlSet) & 0x400))
			reg_write(ohci, d->ctrlSet, 0x1000);
	}
	return 1;
}
static int dma_trm_flush ( struct ti_ohci * ohci , struct dma_trm_ctx * d ) { int idx , z ; if ( d -> pending_first == NULL || d -> free_prgs == 0 ) return 0 ; idx = d -> prg_ind ; z = ( d -> pending_first -> data_size ) ? 3 : 2 ; while ( d -> free_prgs > 0 && d -> pending_first ) { insert_packet ( ohci , d , d -> pending_first ) ; d -> pending_first = d -> pending_first -> xnext ; } if ( d -> pending_first == NULL ) d -> pending_last = NULL ; else PRINT ( KERN_INFO , ohci -> id , " " , d -> ctx ) ; if ( ! ( reg_read ( ohci , d -> ctrlSet ) & 0x8000 ) ) { DBGMSG ( ohci -> id , " " , d -> ctx ) ; reg_write ( ohci , d -> cmdPtr , d -> prg_bus [ idx ] | z ) ; run_context ( ohci , d -> ctrlSet , NULL ) ; } else { DBGMSG ( ohci -> id , " " , d -> ctx ) ; if ( ! ( reg_read ( ohci , d -> ctrlSet ) & 0x400 ) ) reg_write ( ohci , d -> ctrlSet , 0x1000 ) ; } return 1 ; }
This function fills the AT FIFO with the (eventual) pending packets
 and runs or wake up the AT DMA prg if necessary.
This function fills the AT FIFO with the ( eventual ) pending packets and runs or wake up the AT DMA prg if necessary .
/* insert the packets into the at dma fifo */ /* Is the context running ? (should be unless it is 
	   the first packet to be sent in this context) */ /* wake up the dma context if necessary */