Struct xosc#

Struct Documentation#

struct xosc#

Controls the crystal oscillator

Public Functions

inline XOSC_CTRL_FREQ_RANGE get_CTRL_FREQ_RANGE() volatile#

Get CTRL’s FREQ_RANGE field.

Frequency range. This resets to 0xAA0 and cannot be changed.

inline void set_CTRL_FREQ_RANGE(XOSC_CTRL_FREQ_RANGE value) volatile#

Set CTRL’s FREQ_RANGE field.

Frequency range. This resets to 0xAA0 and cannot be changed.

inline XOSC_CTRL_ENABLE get_CTRL_ENABLE() volatile#

Get CTRL’s ENABLE field.

On power-up this field is initialised to DISABLE and the chip runs from the ROSC.

If the chip has subsequently been programmed to run from the XOSC then setting this field to DISABLE may lock-up the chip. If this is a concern then run the clk_ref from the ROSC and enable the clk_sys RESUS feature.

The 12-bit code is intended to give some protection against accidental writes. An invalid setting will enable the oscillator.

inline void set_CTRL_ENABLE(XOSC_CTRL_ENABLE value) volatile#

Set CTRL’s ENABLE field.

On power-up this field is initialised to DISABLE and the chip runs from the ROSC.

If the chip has subsequently been programmed to run from the XOSC then setting this field to DISABLE may lock-up the chip. If this is a concern then run the clk_ref from the ROSC and enable the clk_sys RESUS feature.

The 12-bit code is intended to give some protection against accidental writes. An invalid setting will enable the oscillator.

inline void get_CTRL(XOSC_CTRL_FREQ_RANGE &FREQ_RANGE, XOSC_CTRL_ENABLE &ENABLE) volatile#

Get all of CTRL’s bit fields.

(read-write) Crystal Oscillator Control

inline void set_CTRL(XOSC_CTRL_FREQ_RANGE FREQ_RANGE, XOSC_CTRL_ENABLE ENABLE) volatile#

Set all of CTRL’s bit fields.

(read-write) Crystal Oscillator Control

inline XOSC_STATUS_FREQ_RANGE get_STATUS_FREQ_RANGE() volatile#

Get STATUS’s FREQ_RANGE field.

The current frequency range setting, always reads 0

inline bool get_STATUS_ENABLED() volatile#

Get STATUS’s ENABLED bit.

Oscillator is enabled but not necessarily running and stable, resets to 0

inline bool get_STATUS_BADWRITE() volatile#

Get STATUS’s BADWRITE bit.

An invalid value has been written to CTRL_ENABLE or CTRL_FREQ_RANGE or DORMANT

inline void set_STATUS_BADWRITE() volatile#

Set STATUS’s BADWRITE bit.

An invalid value has been written to CTRL_ENABLE or CTRL_FREQ_RANGE or DORMANT

inline void clear_STATUS_BADWRITE() volatile#

Clear STATUS’s BADWRITE bit.

An invalid value has been written to CTRL_ENABLE or CTRL_FREQ_RANGE or DORMANT

inline void toggle_STATUS_BADWRITE() volatile#

Toggle STATUS’s BADWRITE bit.

An invalid value has been written to CTRL_ENABLE or CTRL_FREQ_RANGE or DORMANT

inline bool get_STATUS_STABLE() volatile#

Get STATUS’s STABLE bit.

Oscillator is running and stable

inline void get_STATUS(XOSC_STATUS_FREQ_RANGE &FREQ_RANGE, bool &ENABLED, bool &BADWRITE, bool &STABLE) volatile#

Get all of STATUS’s bit fields.

(read-write) Crystal Oscillator Status

inline uint16_t get_STARTUP_DELAY() volatile#

Get STARTUP’s DELAY field.

in multiples of 256*xtal_period. The reset value of 0xc4 corresponds to approx 50 000 cycles.

inline void set_STARTUP_DELAY(uint16_t value) volatile#

Set STARTUP’s DELAY field.

in multiples of 256*xtal_period. The reset value of 0xc4 corresponds to approx 50 000 cycles.

inline bool get_STARTUP_X4() volatile#

Get STARTUP’s X4 bit.

Multiplies the startup_delay by 4. This is of little value to the user given that the delay can be programmed directly.

inline void set_STARTUP_X4() volatile#

Set STARTUP’s X4 bit.

Multiplies the startup_delay by 4. This is of little value to the user given that the delay can be programmed directly.

inline void clear_STARTUP_X4() volatile#

Clear STARTUP’s X4 bit.

Multiplies the startup_delay by 4. This is of little value to the user given that the delay can be programmed directly.

inline void toggle_STARTUP_X4() volatile#

Toggle STARTUP’s X4 bit.

Multiplies the startup_delay by 4. This is of little value to the user given that the delay can be programmed directly.

inline void get_STARTUP(uint16_t &DELAY, bool &X4) volatile#

Get all of STARTUP’s bit fields.

(read-write) Controls the startup delay

inline void set_STARTUP(uint16_t DELAY, bool X4) volatile#

Set all of STARTUP’s bit fields.

(read-write) Controls the startup delay

inline uint8_t get_COUNT_COUNT() volatile#

Get COUNT’s COUNT field.

inline void set_COUNT_COUNT(uint8_t value) volatile#

Set COUNT’s COUNT field.

Public Members

uint32_t CTRL#

(read-write) Crystal Oscillator Control

uint32_t STATUS#

(read-write) Crystal Oscillator Status

uint32_t DORMANT#

(read-write) Crystal Oscillator pause control

This is used to save power by pausing the XOSC

On power-up this field is initialised to WAKE

An invalid write will also select WAKE

WARNING: stop the PLLs before selecting dormant mode

WARNING: setup the irq before selecting dormant mode

uint32_t STARTUP#

(read-write) Controls the startup delay

const uint32_t reserved_padding0[reserved_padding0_length] = {}#
uint32_t COUNT#

(read-write) A down counter running at the xosc frequency which counts to zero and stops.

To start the counter write a non-zero value.

Can be used for short software pauses when setting up time sensitive hardware.

Public Static Attributes

static constexpr std::size_t size = 32#

xosc’s size in bytes.

static constexpr std::size_t reserved_padding0_length = 3#