FreeBSD/sys/arm/ti/ti_sdma.c
/**
 *	ti_sdma_stop_xfer - stops any currently active transfers
 *	@ch: the channel number to set the endianness of
 *
 *	This function call is effectively a NOP if no transaction is in progress.
 *
 *	LOCKING:
 *	DMA registers protected by internal mutex
 *
 *	RETURNS:
 *	EH_HANDLED or EH_NOT_HANDLED
 */
stops any currently active transfers
@ch: the channel number to set the endianness of

This function call is effectively a NOP if no transaction is in progress.

DMA registers protected by internal mutex


stops any currently active transfers @ch : the channel number to set the endianness of This function call is effectively a NOP if no transaction is in progress . DMA registers protected by internal mutex
int
ti_sdma_stop_xfer(unsigned int ch)
{
	struct ti_sdma_softc *sc = ti_sdma_sc;
	unsigned int j;
	if (sc == NULL)
		return (ENOMEM);
	TI_SDMA_LOCK(sc);
	if ((sc->sc_active_channels & (1 << ch)) == 0) {
		TI_SDMA_UNLOCK(sc);
		return (EINVAL);
	}
	ti_sdma_write_4(sc, DMA4_CICR(ch), 0);
	ti_sdma_write_4(sc, DMA4_CCR(ch), 0);
	ti_sdma_write_4(sc, DMA4_CSR(ch), DMA4_CSR_CLEAR_MASK);
	for (j = 0; j < NUM_DMA_IRQS; j++) {
		ti_sdma_write_4(sc, DMA4_IRQSTATUS_L(j), (1 << ch));
	}
	sc->sc_channel[ch].need_reg_write = 1;
	TI_SDMA_UNLOCK(sc);
	return (0);
}
int ti_sdma_stop_xfer ( unsigned int ch ) { struct ti_sdma_softc * sc = ti_sdma_sc ; unsigned int j ; if ( sc == NULL ) return ( ENOMEM ) ; TI_SDMA_LOCK ( sc ) ; if ( ( sc -> sc_active_channels & ( 1 << ch ) ) == 0 ) { TI_SDMA_UNLOCK ( sc ) ; return ( EINVAL ) ; } ti_sdma_write_4 ( sc , DMA4_CICR ( ch ) , 0 ) ; ti_sdma_write_4 ( sc , DMA4_CCR ( ch ) , 0 ) ; ti_sdma_write_4 ( sc , DMA4_CSR ( ch ) , DMA4_CSR_CLEAR_MASK ) ; for ( j = 0 ; j < NUM_DMA_IRQS ; j ++ ) { ti_sdma_write_4 ( sc , DMA4_IRQSTATUS_L ( j ) , ( 1 << ch ) ) ; } sc -> sc_channel [ ch ] . need_reg_write = 1 ; TI_SDMA_UNLOCK ( sc ) ; return ( 0 ) ; }
ti_sdma_stop_xfer - stops any currently active transfers
      @ch: the channel number to set the endianness of
ti_sdma_stop_xfer - stops any currently active transfers @ch : the channel number to set the endianness of
/* Sanity check */ /* Disable all DMA interrupts for the channel. */ /* Make sure the DMA transfer is stopped. */ /* Clear the CSR register and IRQ status register */ /* Configuration registers need to be re-written on the next xfer */