Microchip® Advanced Software Framework

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
System Clock internals

System clock management is fairly straightforward apart from one thing: Enabling and disabling bus bridges. When all peripherals on a given bus are disabled, the bridge to the bus may be disabled. Only the PBA and PBB busses support this, and it is not practical to disable the PBA bridge as it includes the PM and SCIF modules, so turning it off would make it impossible to turn anything back on again.

The system clock implementation keeps track of a reference count for PBB. When the reference count is zero, the bus bridge is disabled, otherwise it is enabled.

Functions

void sysclk_priv_disable_module (uint32_t bus_id, uint32_t module_index)
 Disable a maskable module clock. More...
 
void sysclk_priv_enable_module (uint32_t bus_id, uint32_t module_index)
 Enable a maskable module clock. More...
 

Initial module clock masks

These are the mask values written to the xxxMASK registers during initialization if the user has overridden the default behavior of all clocks left enabled. These values assume that:

  • Debugging should be possible
  • The program may be running from flash
  • The PM should be available to unmask other clocks
  • All on-chip RAM should be available
  • SCIF, BPM, BSCIF and GPIO are made permanently available for now; this may change in the future.
#define SYSCLK_INIT_MINIMAL_CPUMASK   0
 Initial value of CPUMASK. More...
 
#define SYSCLK_INIT_MINIMAL_HSBMASK
 Initial value of HSBMASK. More...
 
#define SYSCLK_INIT_MINIMAL_PBAMASK   0
 Initial value of PBAMASK. More...
 
#define SYSCLK_INIT_MINIMAL_PBBMASK   (1 << SYSCLK_HFLASHC_REGS)
 Initial value of PBBMASK. More...
 
#define SYSCLK_INIT_MINIMAL_PBCMASK
 Initial value of PBCMASK. More...
 
#define SYSCLK_INIT_MINIMAL_PBDMASK
 Initial value of PBDMASK. More...
 

#define SYSCLK_INIT_MINIMAL_CPUMASK   0

Initial value of CPUMASK.

Referenced by sysclk_init().

#define SYSCLK_INIT_MINIMAL_HSBMASK
Value:
| (1 << SYSCLK_PBB_BRIDGE) \
| (1 << SYSCLK_PBC_BRIDGE) \
#define SYSCLK_HFLASHC_DATA
Flash data interface.
Definition: sam4l/sysclk.h:166
#define SYSCLK_PBC_BRIDGE
HSB&lt;-&gt;PBC bridge.
Definition: sam4l/sysclk.h:178
#define SYSCLK_PBD_BRIDGE
HSB&lt;-&gt;PBD bridge.
Definition: sam4l/sysclk.h:180
#define SYSCLK_PBB_BRIDGE
HSB&lt;-&gt;PBB bridge.
Definition: sam4l/sysclk.h:176

Initial value of HSBMASK.

Referenced by sysclk_init().

#define SYSCLK_INIT_MINIMAL_PBAMASK   0

Initial value of PBAMASK.

Referenced by sysclk_init().

#define SYSCLK_INIT_MINIMAL_PBBMASK   (1 << SYSCLK_HFLASHC_REGS)

Initial value of PBBMASK.

Referenced by sysclk_init().

#define SYSCLK_INIT_MINIMAL_PBCMASK
Value:
((1 << SYSCLK_PM) \
| (1 << SYSCLK_GPIO) \
| (1 << SYSCLK_SCIF))
#define SYSCLK_PM
PM configuration.
Definition: sam4l/sysclk.h:257
#define SYSCLK_SCIF
System Control Interface.
Definition: sam4l/sysclk.h:261
#define SYSCLK_GPIO
General-Purpose I/O.
Definition: sam4l/sysclk.h:265

Initial value of PBCMASK.

Referenced by sysclk_init().

#define SYSCLK_INIT_MINIMAL_PBDMASK
Value:
((1 << SYSCLK_BPM) \
| (1 << SYSCLK_BSCIF))
#define SYSCLK_BSCIF
BSCIF configuration.
Definition: sam4l/sysclk.h:273
#define SYSCLK_BPM
BPM configuration.
Definition: sam4l/sysclk.h:271

Initial value of PBDMASK.

Referenced by sysclk_init().

void sysclk_priv_disable_module ( uint32_t  bus_id,
uint32_t  module_index 
)

Disable a maskable module clock.

Parameters
bus_idBus index, given by the PM_CLK_GRP_xxx definitions.
module_indexIndex of the module to be disabled. This is the bit number in the corresponding xxxMASK register.

References cpu_irq_restore(), and cpu_irq_save().

Referenced by sysclk_disable_cpu_module(), sysclk_disable_hsb_module(), sysclk_disable_pba_module(), sysclk_disable_pbb_module(), sysclk_disable_pbc_module(), and sysclk_disable_pbd_module().

void sysclk_priv_enable_module ( uint32_t  bus_id,
uint32_t  module_index 
)

Enable a maskable module clock.

Parameters
bus_idBus index, given by the PM_CLK_GRP_xxx definitions.
module_indexIndex of the module to be enabled. This is the bit number in the corresponding xxxMASK register.

References cpu_irq_restore(), and cpu_irq_save().

Referenced by sysclk_enable_cpu_module(), sysclk_enable_hsb_module(), sysclk_enable_pba_module(), sysclk_enable_pbb_module(), sysclk_enable_pbc_module(), and sysclk_enable_pbd_module().