Loading...
Searching...
No Matches
rosc.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2026 Raspberry Pi (Trading) Ltd.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef _HARDWARE_ROSC_H_
8#define _HARDWARE_ROSC_H_
9
10#include "pico.h"
11#include "hardware/structs/rosc.h"
12
13#ifdef __cplusplus
14extern "C" {
15#endif
16
28
33void rosc_disable(void);
34
44void rosc_set_dormant(void);
45
51void rosc_restart(void);
52
60uint rosc_measure_freq_khz(void);
61
62// ROSC BADWRITE is not reliable, see RP2040-E10
63// inline static void rosc_clear_bad_write(void) {
64// hw_clear_bits(&rosc_hw->status, ROSC_STATUS_BADWRITE_BITS);
65// }
66
67// inline static bool rosc_write_okay(void) {
68// return !(rosc_hw->status & ROSC_STATUS_BADWRITE_BITS);
69// }
70
80inline static void rosc_write(io_rw_32 *addr, uint32_t value) {
81 // rosc_clear_bad_write();
82 // assert(rosc_write_okay());
83 *addr = value;
84 // assert(rosc_write_okay());
85};
86
87#ifdef __cplusplus
88}
89#endif
90
91#endif
void rosc_disable(void)
Disable the Ring Oscillator.
Definition rosc.c:18
void rosc_set_dormant(void)
Put Ring Oscillator in to dormant mode.
Definition rosc.c:27
static void rosc_write(io_rw_32 *addr, uint32_t value)
Checked write to a Ring Oscillator register.
Definition rosc.h:80
void rosc_restart(void)
Re-enable the ring oscillator so that the processor cores can wake up after sleep/dormant mode.
Definition rosc.c:34
uint rosc_measure_freq_khz(void)
Measure the frequency of the Ring Oscillator.
Definition rosc.c:14