include/drivers/dma.h
/**
 * @brief Look-up generic burst index to be used in registers
 *
 * WARNING: This look-up works for most controllers, but *may* not work for
 *          yours.  Ensure your controller expects the most common register
 *          bit values before using this convenience function.  If your
 *          controller does not support these values, you will have to write
 *          your own look-up inside the controller driver.
 *
 * @param burst: number of bytes to be sent in a single burst
 *
 * @retval common DMA index to be placed into registers.
 */
@brief Look-up generic burst index to be used in registers
WARNING: This look-up works for most controllers, but *may* not work for
yours.  Ensure your controller expects the most common register
bit values before using this convenience function.  If your
controller does not support these values, you will have to write
your own look-up inside the controller driver.

@param burst: number of bytes to be sent in a single burst

@retval common DMA index to be placed into registers.
@brief Look - up generic burst index to be used in registers WARNING : This look - up works for most controllers but * may * not work for yours . Ensure your controller expects the most common register bit values before using this convenience function . If your controller does not support these values you will have to write your own look - up inside the controller driver . @param burst : number of bytes to be sent in a single burst @retval common DMA index to be placed into registers .
static inline uint32_t dma_burst_index(uint32_t burst)
{
	if (burst < 1 || burst > 256) {
		return 0; 
	}
	if (!(burst & (burst - 1))) {
		return 0; 
	}
	return find_msb_set(burst);
}
static inline uint32_t dma_burst_index ( uint32_t burst ) { if ( burst < 1 || burst > 256 ) { return 0 ; } if ( ! ( burst & ( burst - 1 ) ) ) { return 0 ; } return find_msb_set ( burst ) ; }
@brief Look-up generic burst index to be used in registers
 WARNING: This look-up works for most controllers, but *may* not work for
          yours.
@brief Look - up generic burst index to be used in registers WARNING : This look - up works for most controllers but * may * not work for yours .
/* Check boundaries (max supported burst length is 256) */ /* Zero is the default (1 burst length) */ /* Ensure burst is a power of 2 */ /* Zero is the default (1 burst length) */ /* Convert to bit pattern for writing to a register */