Re: [PATCH v4 19/20] rust: time: add arch_timer_get_rate wrapper

From: Andreas Hindborg

Date: Mon Apr 27 2026 - 03:44:34 EST


"Deborah Brouwer" <deborah.brouwer@xxxxxxxxxxxxx> writes:

> Provide a safe Rust wrapper for arch_timer_get_rate().
>
> The underlying C helper returns 0 when the ARM architectural timer
> is not available or not yet initialized. Map this to Option<u32> to
> make the absence of a valid rate explicit to Rust callers.
>
> This allows Rust drivers to query the system timer frequency and
> select appropriate time sources when programming hardware timeouts.
>
> Signed-off-by: Deborah Brouwer <deborah.brouwer@xxxxxxxxxxxxx>

Looks good to me, but it is weird that this is defined for non-arm targets.

Even if this is available for all architectures in C code, would it make
sense to gate it on the target being Arm in Rust?


Best regards,
Andreas Hindborg