include/drivers/dma.h
/**
 * @brief Look-up generic width 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 size: width of bus (in bytes)
 *
 * @retval common DMA index to be placed into registers.
 */
@brief Look-up generic width 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 size: width of bus (in bytes)

@retval common DMA index to be placed into registers.
@brief Look - up generic width 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 size : width of bus ( in bytes ) @retval common DMA index to be placed into registers .
static inline uint32_t dma_width_index(uint32_t size)
{
	if (size < 1 || size > 32) {
		return 0; 
	}
	if (!is_power_of_two(size)) {
		return 0; 
	}
	return find_msb_set(size);
}
static inline uint32_t dma_width_index ( uint32_t size ) { if ( size < 1 || size > 32 ) { return 0 ; } if ( ! is_power_of_two ( size ) ) { return 0 ; } return find_msb_set ( size ) ; }
@brief Look-up generic width index to be used in registers
 WARNING: This look-up works for most controllers, but *may* not work for
          yours.
@brief Look - up generic width index to be used in registers WARNING : This look - up works for most controllers but * may * not work for yours .
/* Check boundaries (max supported width is 32 Bytes) */ /* Zero is the default (8 Bytes) */ /* Ensure size is a power of 2 */ /* Zero is the default (8 Bytes) */ /* Convert to bit pattern for writing to a register */