FreeBSD/sys/arm/ti/ti_sdma.c
/**
 *	ti_sdma_intr - interrupt handler for all 4 DMA IRQs
 *	@arg: ignored
 *
 *	Called when any of the four DMA IRQs are triggered.
 *
 *	LOCKING:
 *	DMA registers protected by internal mutex
 *
 *	RETURNS:
 *	nothing
 */
interrupt handler for all 4 DMA IRQs
@arg: ignored

Called when any of the four DMA IRQs are triggered.

DMA registers protected by internal mutex

nothing
interrupt handler for all 4 DMA IRQs @arg : ignored Called when any of the four DMA IRQs are triggered . DMA registers protected by internal mutex nothing
static void
ti_sdma_intr(void *arg)
{
	struct ti_sdma_softc *sc = ti_sdma_sc;
	uint32_t intr;
	uint32_t csr;
	unsigned int ch, j;
	struct ti_sdma_channel* channel;
	TI_SDMA_LOCK(sc);
	for (j = 0; j < NUM_DMA_IRQS; j++) {
		intr = ti_sdma_read_4(sc, DMA4_IRQSTATUS_L(j));
		intr &= ti_sdma_read_4(sc, DMA4_IRQENABLE_L(j));
		if (intr == 0x00000000)
			continue;
		for (ch = 0; ch < NUM_DMA_CHANNELS; ch++) {
			if (intr & (1 << ch)) {
				channel = &sc->sc_channel[ch];
				csr = ti_sdma_read_4(sc, DMA4_CSR(ch));
				if (csr == 0) {
					device_printf(sc->sc_dev, "Spurious DMA IRQ for channel "
					              "%d\n", ch);
					continue;
				}
				if ((sc->sc_active_channels & (1 << ch)) == 0) {
					device_printf(sc->sc_dev, "IRQ %d for a non-activated "
					              "channel %d\n", j, ch);
					continue;
				}
				if (csr & DMA4_CSR_DROP)
					device_printf(sc->sc_dev, "Synchronization event drop "
					              "occurred during the transfer on channel %u\n",
								  ch);
				if (csr & DMA4_CSR_SECURE_ERR)
					device_printf(sc->sc_dev, "Secure transaction error event "
					              "on channel %u\n", ch);
				if (csr & DMA4_CSR_MISALIGNED_ADRS_ERR)
					device_printf(sc->sc_dev, "Misaligned address error event "
					              "on channel %u\n", ch);
				if (csr & DMA4_CSR_TRANS_ERR) {
					device_printf(sc->sc_dev, "Transaction error event on "
					              "channel %u\n", ch);
				}
				ti_sdma_write_4(sc, DMA4_CSR(ch), DMA4_CSR_CLEAR_MASK);
				ti_sdma_write_4(sc, DMA4_IRQSTATUS_L(j), (1 << ch));
				if (channel->callback)
					channel->callback(ch, csr, channel->callback_data);
			}
		}
	}
	TI_SDMA_UNLOCK(sc);
	return;
}
static void ti_sdma_intr ( void * arg ) { struct ti_sdma_softc * sc = ti_sdma_sc ; uint32_t intr ; uint32_t csr ; unsigned int ch , j ; struct ti_sdma_channel * channel ; TI_SDMA_LOCK ( sc ) ; for ( j = 0 ; j < NUM_DMA_IRQS ; j ++ ) { intr = ti_sdma_read_4 ( sc , DMA4_IRQSTATUS_L ( j ) ) ; intr &= ti_sdma_read_4 ( sc , DMA4_IRQENABLE_L ( j ) ) ; if ( intr == 0x00000000 ) continue ; for ( ch = 0 ; ch < NUM_DMA_CHANNELS ; ch ++ ) { if ( intr & ( 1 << ch ) ) { channel = & sc -> sc_channel [ ch ] ; csr = ti_sdma_read_4 ( sc , DMA4_CSR ( ch ) ) ; if ( csr == 0 ) { device_printf ( sc -> sc_dev , " " " \n " , ch ) ; continue ; } if ( ( sc -> sc_active_channels & ( 1 << ch ) ) == 0 ) { device_printf ( sc -> sc_dev , " " " \n " , j , ch ) ; continue ; } if ( csr & DMA4_CSR_DROP ) device_printf ( sc -> sc_dev , " " " \n " , ch ) ; if ( csr & DMA4_CSR_SECURE_ERR ) device_printf ( sc -> sc_dev , " " " \n " , ch ) ; if ( csr & DMA4_CSR_MISALIGNED_ADRS_ERR ) device_printf ( sc -> sc_dev , " " " \n " , ch ) ; if ( csr & DMA4_CSR_TRANS_ERR ) { device_printf ( sc -> sc_dev , " " " \n " , ch ) ; } ti_sdma_write_4 ( sc , DMA4_CSR ( ch ) , DMA4_CSR_CLEAR_MASK ) ; ti_sdma_write_4 ( sc , DMA4_IRQSTATUS_L ( j ) , ( 1 << ch ) ) ; if ( channel -> callback ) channel -> callback ( ch , csr , channel -> callback_data ) ; } } } TI_SDMA_UNLOCK ( sc ) ; return ; }
ti_sdma_intr - interrupt handler for all 4 DMA IRQs
      @arg: ignored
ti_sdma_intr - interrupt handler for all 4 DMA IRQs @arg : ignored
/* Get the flag interrupts (enabled) */ /* Loop through checking the status bits */ /* Read the CSR regsiter and verify we don't have a spurious IRQ */ /* Sanity check this channel is active */ /* Check the status error codes */ /* 
					 * Apparently according to linux code, there is an errata
					 * that says the channel is not disabled upon this error.
					 * They explicitly disable the channel here .. since I
					 * haven't seen the errata, I'm going to ignore for now.
					 */ /* Clear the status flags for the IRQ */ /* Call the callback for the given channel */