CMSIS-Driver_PIC32CM-PL  
Peripheral Library (PLIB) Documentation
 
Loading...
Searching...
No Matches
MCLK Interface

Driver API for MCLK (plib_mclk.h) More...

Typedefs

typedef void(* MCLK_CALLBACK) (void)
 Callback type for clock ready event.
 
typedef uint32_t MCLK_AHB_MODULE
 AHB module bit-mask type used for clock gating.
 
typedef uint32_t MCLK_APBA_MODULE
 APBA module bit-mask type used for clock gating.
 
typedef uint32_t MCLK_APBB_MODULE
 APBB module bit-mask type used for clock gating.
 
typedef uint32_t MCLK_APBC_MODULE
 APBC module bit-mask type used for clock gating.
 

Enumerations

enum  MCLK_CPU_CLOCK_DIVIDER {
  MCLK_CPU_CLK_DIV_1 = 0x01U , MCLK_CPU_CLK_DIV_2 = 0x02U , MCLK_CPU_CLK_DIV_4 = 0x04U , MCLK_CPU_CLK_DIV_8 = 0x08U ,
  MCLK_CPU_CLK_DIV_16 = 0x10U , MCLK_CPU_CLK_DIV_32 = 0x20U , MCLK_CPU_CLK_DIV_64 = 0x40U , MCLK_CPU_CLK_DIV_128 = 0x80U
}
 CPU clock division factors for MCLK. More...
 
enum  MCLK_AHB_MODULE_ENUM
 Convenience AHB module masks. More...
 
enum  MCLK_APBA_MODULE_ENUM
 Convenience APBA module masks. More...
 
enum  MCLK_APBB_MODULE_ENUM
 Convenience APBB module masks. More...
 
enum  MCLK_APBC_MODULE_ENUM
 Convenience APBC module masks. More...
 

Functions

void MCLK_Initialize (void)
 Initializes the MCLK peripheral.
 
uint8_t MCLK_GetCPUClockDivider (void)
 Gets the current CPU clock division factor.
 
void MCLK_SetCPUClockDivider (MCLK_CPU_CLOCK_DIVIDER cpu_div)
 Sets the CPU clock division factor.
 
void MCLK_EnableAHBClock (MCLK_AHB_MODULE module)
 Enables the AHB clock for a specific module.
 
void MCLK_DisableAHBClock (MCLK_AHB_MODULE module)
 Disables the AHB clock for a specific module.
 
void MCLK_EnableAPBAClock (MCLK_APBA_MODULE module)
 Enables the APB clock for a module with APBA bus.
 
void MCLK_EnableAPBBClock (MCLK_APBB_MODULE module)
 Enables the APB clock for a module with APBB bus.
 
void MCLK_EnableAPBCClock (MCLK_APBC_MODULE module)
 Enables the APB clock for a module with APBC bus.
 
void MCLK_DisableAPBAClock (MCLK_APBA_MODULE module)
 Disables the APB clock for a module with APBA bus.
 
void MCLK_DisableAPBBClock (MCLK_APBB_MODULE module)
 Disables the APB clock for a module with APBB bus.
 
void MCLK_DisableAPBCClock (MCLK_APBC_MODULE module)
 Disables the APB clock for a module with APBC bus.
 
bool MCLK_ClockIsReady (void)
 Checks if the clock is ready (CKRDY flag).
 
void MCLK_EnableClockReadyInterrupt (void)
 Enables the Clock Ready interrupt.
 
void MCLK_DisableClockReadyInterrupt (void)
 Disables the Clock Ready interrupt.
 
void MCLK_ClearClockReadyFlag (void)
 Clears the Clock Ready interrupt flag.
 
void MCLK_SetCallbackHandler (MCLK_CALLBACK callback)
 Registers a callback for the Clock Ready event.
 

Description

Driver API for MCLK (plib_mclk.h)

Typedef Documentation

◆ MCLK_AHB_MODULE

typedef uint32_t MCLK_AHB_MODULE

AHB module bit-mask type used for clock gating.

This is a bit-mask type (uint32_t), not an enum type. This ensures the public API does not expose a closed set of peripherals.

How to choose the mask:

  • Preferred: use the convenience values listed in MCLK_AHB_MODULE_ENUM, e.g. MCLK_AHB_DMAC.
  • If you cannot find a peripheral in the convenience list, use the device header mask directly:
    • MCLK_AHBMASK_<PERIPHERAL>_Msk / ...._Msk (exact spelling depends on the device header), OR

Multiple peripherals may be enabled/disabled by bitwise-OR'ing masks.

MCLK_EnableAHBClock(MCLK_AHB_DMAC | MCLK_AHB_HSRAM);
MCLK_EnableAHBClock(MCLK_AHBMASK_FOO_Msk);
void MCLK_EnableAHBClock(MCLK_AHB_MODULE module)
Enables the AHB clock for a specific module.

◆ MCLK_APBA_MODULE

typedef uint32_t MCLK_APBA_MODULE

APBA module bit-mask type used for clock gating.

This is a bit-mask type (uint32_t), not an enum type. This ensures the public API does not expose a closed set of peripherals.

How to choose the mask:

  • Preferred: use the convenience values listed in MCLK_APBA_MODULE_ENUM, e.g. MCLK_APBA_GCLK.
  • If you cannot find a peripheral in the convenience list, use the device header mask directly (exact spelling depends on the device header):
    • MCLK_APBAMASK_<PERIPHERAL>_Msk (or ..._Msk), OR

Multiple peripherals may be enabled/disabled by bitwise-OR'ing masks.

◆ MCLK_APBB_MODULE

typedef uint32_t MCLK_APBB_MODULE

APBB module bit-mask type used for clock gating.

This is a bit-mask type (uint32_t), not an enum type.

How to choose the mask:

  • Preferred: use the convenience values listed in MCLK_APBB_MODULE_ENUM.
  • Otherwise use the CMSIS device header mask directly, e.g. MCLK_APBBMASK_<PERIPHERAL>_Msk / ..._Msk (device-header dependent).

◆ MCLK_APBC_MODULE

typedef uint32_t MCLK_APBC_MODULE

APBC module bit-mask type used for clock gating.

This is a bit-mask type (uint32_t), not an enum type.

How to choose the mask:

  • Preferred: use the convenience values listed in MCLK_APBC_MODULE_ENUM.
  • Otherwise use the CMSIS device header mask directly, e.g. MCLK_APBCMASK_<PERIPHERAL>_Msk / ..._Msk (device-header dependent).

◆ MCLK_CALLBACK

typedef void(* MCLK_CALLBACK) (void)

Callback type for clock ready event.

Enumeration Type Documentation

◆ MCLK_AHB_MODULE_ENUM

Convenience AHB module masks.

These are provided as enumerators for discoverability in IDEs, but the API parameter type remains MCLK_AHB_MODULE (a uint32_t mask).

◆ MCLK_APBA_MODULE_ENUM

Convenience APBA module masks.

These are provided as enumerators for discoverability in IDEs, but the API parameter type remains MCLK_APBA_MODULE (a uint32_t mask).

◆ MCLK_APBB_MODULE_ENUM

Convenience APBB module masks.

◆ MCLK_APBC_MODULE_ENUM

Convenience APBC module masks.

◆ MCLK_CPU_CLOCK_DIVIDER

CPU clock division factors for MCLK.

Enumerator
MCLK_CPU_CLK_DIV_1 
MCLK_CPU_CLK_DIV_2 
MCLK_CPU_CLK_DIV_4 
MCLK_CPU_CLK_DIV_8 
MCLK_CPU_CLK_DIV_16 
MCLK_CPU_CLK_DIV_32 
MCLK_CPU_CLK_DIV_64 
MCLK_CPU_CLK_DIV_128 

Function Documentation

◆ MCLK_ClearClockReadyFlag()

void MCLK_ClearClockReadyFlag ( void )

Clears the Clock Ready interrupt flag.

Parameters
None.
Returns
None.

◆ MCLK_ClockIsReady()

bool MCLK_ClockIsReady ( void )

Checks if the clock is ready (CKRDY flag).

Parameters
None.
Returns
true if the clock is ready, false otherwise.

◆ MCLK_DisableAHBClock()

void MCLK_DisableAHBClock ( MCLK_AHB_MODULE module)

Disables the AHB clock for a specific module.

Parameters
moduleThe AHB module to disable the clock for.
Returns
None.

◆ MCLK_DisableAPBAClock()

void MCLK_DisableAPBAClock ( MCLK_APBA_MODULE module)

Disables the APB clock for a module with APBA bus.

Parameters
moduleThe APBA module to disable the clock for.
Returns
None.

◆ MCLK_DisableAPBBClock()

void MCLK_DisableAPBBClock ( MCLK_APBB_MODULE module)

Disables the APB clock for a module with APBB bus.

Parameters
moduleThe APBB module to disable the clock for.
Returns
None.

◆ MCLK_DisableAPBCClock()

void MCLK_DisableAPBCClock ( MCLK_APBC_MODULE module)

Disables the APB clock for a module with APBC bus.

Parameters
moduleThe APBC module to disable the clock for.
Returns
None.

◆ MCLK_DisableClockReadyInterrupt()

void MCLK_DisableClockReadyInterrupt ( void )

Disables the Clock Ready interrupt.

Parameters
None.
Returns
None.

◆ MCLK_EnableAHBClock()

void MCLK_EnableAHBClock ( MCLK_AHB_MODULE module)

Enables the AHB clock for a specific module.

Parameters
moduleThe AHB module to enable the clock for.
Returns
None.

◆ MCLK_EnableAPBAClock()

void MCLK_EnableAPBAClock ( MCLK_APBA_MODULE module)

Enables the APB clock for a module with APBA bus.

Parameters
moduleThe APBA module to enable the clock for.
Returns
None.

◆ MCLK_EnableAPBBClock()

void MCLK_EnableAPBBClock ( MCLK_APBB_MODULE module)

Enables the APB clock for a module with APBB bus.

Parameters
moduleThe APBB module to enable the clock for.
Returns
None.

◆ MCLK_EnableAPBCClock()

void MCLK_EnableAPBCClock ( MCLK_APBC_MODULE module)

Enables the APB clock for a module with APBC bus.

Parameters
moduleThe APBC module to enable the clock for.
Returns
None.

◆ MCLK_EnableClockReadyInterrupt()

void MCLK_EnableClockReadyInterrupt ( void )

Enables the Clock Ready interrupt.

Parameters
None.
Returns
None.

◆ MCLK_GetCPUClockDivider()

uint8_t MCLK_GetCPUClockDivider ( void )

Gets the current CPU clock division factor.

Parameters
None.
Returns
Current CPU clock division factor.

◆ MCLK_Initialize()

void MCLK_Initialize ( void )

Initializes the MCLK peripheral.

Parameters
None.
Returns
None.

◆ MCLK_SetCallbackHandler()

void MCLK_SetCallbackHandler ( MCLK_CALLBACK callback)

Registers a callback for the Clock Ready event.

Parameters
callbackFunction pointer to the callback to be registered.
Returns
None.

◆ MCLK_SetCPUClockDivider()

void MCLK_SetCPUClockDivider ( MCLK_CPU_CLOCK_DIVIDER cpu_div)

Sets the CPU clock division factor.

Parameters
divDivision factor to set for the CPU clock.
Returns
None.