/ * @brief Convert dividend to prescaler logarithmic value. Only works for even * numbers equal to 2^n * @param[in] div Unscaled dividend, * @return Base 2 logarithm of input, as used by fixed prescalers ******************************************************************************/
| 117 | * @return Base 2 logarithm of input, as used by fixed prescalers |
| 118 | ******************************************************************************/ |
| 119 | __STATIC_INLINE uint32_t CMU_DivToLog2(CMU_ClkDiv_TypeDef div) |
| 120 | { |
| 121 | uint32_t log2; |
| 122 | |
| 123 | /* Prescalers take argument of 32768 or less */ |
| 124 | EFM_ASSERT((div>0) && (div <= 32768)); |
| 125 | |
| 126 | /* Count leading zeroes and "reverse" result, Cortex-M3 intrinsic */ |
| 127 | log2 = (31 - __CLZ(div)); |
| 128 | |
| 129 | return log2; |
| 130 | } |
| 131 | |
| 132 | |
| 133 | /***************************************************************************//** |
no test coverage detected