Module imxrt_hal::ccm::clock_gate

source ·
Expand description

Functions for reading and manipulating clock gates.

Use these functions to acquire Locators to peripheral clock gates. Once you have a locator, use set to change the gate, and get to read the gate.

Some locator-returning functions require a constant N, representing the Nth peripheral (the ‘4’ in GPIO4). An invalid N for a given peripheral generates a compile-time error.

use imxrt_hal as hal;
use imxrt_ral as ral;

use hal::ccm::clock_gate;

let mut ccm = unsafe { ral::ccm::CCM::instance() };
// OK: GPT1 is valid.
let setting = clock_gate::gpt_serial::<1>().get(&ccm);
// ERROR: GPT33 is NOT a real peripheral.
let setting = clock_gate::gpt_serial::<33>().get(&ccm);

Aggregate clock gates

The module exposes collections of aggregate clock gates. It forms collections based on the root clock. The ordering of clock gates within these collections are unspecified.

Additionally, the size of each collection may vary by chip. Since the collections are const, their size is known at compile time.

use imxrt_hal as hal;
use imxrt_ral as ral;

use hal::ccm::clock_gate;

let mut ccm = unsafe { ral::ccm::CCM::instance() };

// Turn on all clock gates downstream of the IPG clock.
clock_gate::IPG_CLOCK_GATES.iter().for_each(|clock_gate| {
    clock_gate.set(&mut ccm, clock_gate::ON);
});

Structs

Enums

Constants

Functions

  • Returns the ADC clock gate locators.
  • Returns the DMA clock gate locator.
  • Returns the FlexIO clock gate locator.
  • Returns the FlexPWM clock gate locator.
  • Returns the GPIO clock gate locator.
  • Returns the GPT serial clock gate locator.
  • Returns the GPT serial clock gate locator.
  • Returns the LPI2C clock gate locator.
  • Returns the LPSPI clock gate locator.
  • Returns the LPUART clock gate locator.
  • Returns the PIT clock gate locator.
  • Returns the SNVS HP clock gate locator.
  • Returns the SNVS LP clock gate locator.
  • Returns the TRNG clock gate locator.
  • Returns the USB clock gate locator.