FreeBSD/sys/arm/ti/ti_sdma.c
/**
 *	ti_sdma_get_channel_status - returns the status of a given channel
 *	@ch: the channel number to get the status of
 *	@status: upon return will contain the status bitmask, see below for possible
 *	         values.
 *
 *	      DMA_STATUS_DROP
 *	      DMA_STATUS_HALF
 *	      DMA_STATUS_FRAME
 *	      DMA_STATUS_LAST
 *	      DMA_STATUS_BLOCK
 *	      DMA_STATUS_SYNC
 *	      DMA_STATUS_PKT
 *	      DMA_STATUS_TRANS_ERR
 *	      DMA_STATUS_SECURE_ERR
 *	      DMA_STATUS_SUPERVISOR_ERR
 *	      DMA_STATUS_MISALIGNED_ADRS_ERR
 *	      DMA_STATUS_DRAIN_END
 *
 *
 *	LOCKING:
 *	DMA registers protected by internal mutex
 *
 *	RETURNS:
 *	EH_HANDLED or EH_NOT_HANDLED
 */
returns the status of a given channel
@ch: the channel number to get the status of
@status: upon return will contain the status bitmask, see below for possible
values.



DMA registers protected by internal mutex


returns the status of a given channel @ch : the channel number to get the status of @status : upon return will contain the status bitmask see below for possible values . DMA registers protected by internal mutex
int
ti_sdma_get_channel_status(unsigned int ch, uint32_t *status)
{
	struct ti_sdma_softc *sc = ti_sdma_sc;
	uint32_t csr;
	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_UNLOCK(sc);
	csr = ti_sdma_read_4(sc, DMA4_CSR(ch));
	if (status != NULL)
		*status = csr;
	return (0);
}
int ti_sdma_get_channel_status ( unsigned int ch , uint32_t * status ) { struct ti_sdma_softc * sc = ti_sdma_sc ; uint32_t csr ; 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_UNLOCK ( sc ) ; csr = ti_sdma_read_4 ( sc , DMA4_CSR ( ch ) ) ; if ( status != NULL ) * status = csr ; return ( 0 ) ; }
ti_sdma_get_channel_status - returns the status of a given channel
      @ch: the channel number to get the status of
      @status: upon return will contain the status bitmask, see below for possible
               values.
ti_sdma_get_channel_status - returns the status of a given channel @ch : the channel number to get the status of @status : upon return will contain the status bitmask see below for possible values .
/* Sanity check */