1 // THIS HEADER FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT
2 
3 /**
4  * Copyright (c) 2024 Raspberry Pi Ltd.
5  *
6  * SPDX-License-Identifier: BSD-3-Clause
7  */
8 #ifndef _HARDWARE_STRUCTS_SYSTICK_H
9 #define _HARDWARE_STRUCTS_SYSTICK_H
10 
11 /**
12  * \file rp2350/systick.h
13  */
14 
15 #include "hardware/address_mapped.h"
16 #include "hardware/regs/m33.h"
17 
18 // Reference to datasheet: https://datasheets.raspberrypi.com/rp2350/rp2350-datasheet.pdf#tab-registerlist_m33
19 //
20 // The _REG_ macro is intended to help make the register navigable in your IDE (for example, using the "Go to Definition" feature)
21 // _REG_(x) will link to the corresponding register in hardware/regs/m33.h.
22 //
23 // Bit-field descriptions are of the form:
24 // BITMASK [BITRANGE] FIELDNAME (RESETVALUE) DESCRIPTION
25 
26 #if defined(__riscv) && PICO_FORBID_ARM_HEADERS_ON_RISCV
27 #error "Arm header included in a RISC-V build with PICO_FORBID_ARM_HEADERS_ON_RISCV=1"
28 #endif
29 
30 typedef struct {
31     _REG_(M33_SYST_CSR_OFFSET) // M33_SYST_CSR
32     // SysTick Control and Status Register
33     // 0x00010000 [16]    COUNTFLAG    (0) Returns 1 if timer counted to 0 since last time this was read
34     // 0x00000004 [2]     CLKSOURCE    (0) SysTick clock source
35     // 0x00000002 [1]     TICKINT      (0) Enables SysTick exception request: +
36     // 0x00000001 [0]     ENABLE       (0) Enable SysTick counter: +
37     io_rw_32 csr;
38 
39     _REG_(M33_SYST_RVR_OFFSET) // M33_SYST_RVR
40     // SysTick Reload Value Register
41     // 0x00ffffff [23:0]  RELOAD       (0x000000) Value to load into the SysTick Current Value Register...
42     io_rw_32 rvr;
43 
44     _REG_(M33_SYST_CVR_OFFSET) // M33_SYST_CVR
45     // SysTick Current Value Register
46     // 0x00ffffff [23:0]  CURRENT      (0x000000) Reads return the current value of the SysTick counter
47     io_rw_32 cvr;
48 
49     _REG_(M33_SYST_CALIB_OFFSET) // M33_SYST_CALIB
50     // SysTick Calibration Value Register
51     // 0x80000000 [31]    NOREF        (0) If reads as 1, the Reference clock is not provided - the...
52     // 0x40000000 [30]    SKEW         (0) If reads as 1, the calibration value for 10ms is inexact...
53     // 0x00ffffff [23:0]  TENMS        (0x000000) An optional Reload value to be used for 10ms (100Hz)...
54     io_ro_32 calib;
55 } systick_hw_t;
56 
57 #define systick_hw ((systick_hw_t *)(PPB_BASE + M33_SYST_CSR_OFFSET))
58 #define systick_ns_hw ((systick_hw_t *)(PPB_NONSEC_BASE + M33_SYST_CSR_OFFSET))
59 static_assert(sizeof (systick_hw_t) == 0x0010, "");
60 
61 #endif // _HARDWARE_STRUCTS_SYSTICK_H
62 
63