Peripheral clock control — Details
The HAL provides macros which may be used to enable or disable
peripheral clocks. Effectively this indicates whether the
peripheral is powered on (enabled) or powered down (disabled), and
so may be used to ensure unused peripherals are turned off to save
macro will enforce the maximum frequency limitations for
particular peripheral blocks, and will return the frequency of the
clock used for the enabled peripheral. Such frequency information
may be useful to device drivers if clock divider configuration is
It is important to remember that before a peripheral can be used, it must be enabled. It is safe to re-enable a peripheral that is already enabled, although usually a device driver will only do so once in its initialisation. eCos will automatically initialise some peripheral blocks where it needs to use the associated peripherals (such as memory controllers and some (but usually not all) PIO banks), and in eCos-supplied device drivers which are included in the eCos configuration. However this should not be relied on - it is always safest to enable the peripheral clocks anyway just in case. Finally, remember that each PIO bank must be enabled separately.
Each peripheral has a unique ID defined by the HAL, and these
values are used as the
pid parameter to the
enable and disable macros.
|2018-07-06||eCosPro Non-Commercial Public License|