2019-09-16 06:07 AM
In 'STM32G0xx_HAL_Driver\Src\stm32g0xx_hal_dma.c', Line 1032, 'hdma->DMAmuxChannelStatusMask = 1UL << (channel_number & 0x1cU)' , why the channel number is anded with 0x1C? shouldn't that be anded with 0x7f?
2019-09-16 06:30 AM
> shouldn't that be anded with 0x7f?
Even without looking up the HAL code (more than to know that DMAmuxChannelStatusMask is uint32_t) or register definitions in RM, I guess no: why would you want to shift to left the "1" in a 32-bit value by 127 bits? Shifting it up to 28 bits seems more reasonable (:
2019-09-16 10:45 AM
I mean that Channel number is from 0 to 6. the bits of the flag registers are also 0 to 6 respectively. the (channel_number & 0x1cU) has already change the primary position that the data should be shifted.
In fact, I think the whole sentence could be "'hdma->DMAmuxChannelStatusMask = 1UL << (channel_number )".