1 // THIS HEADER FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT
2 
3 /*
4  * Copyright (c) 2021 Raspberry Pi (Trading) Ltd.
5  *
6  * SPDX-License-Identifier: BSD-3-Clause
7  */
8 
9 #ifndef _HARDWARE_STRUCTS_SYSTICK_H
10 #define _HARDWARE_STRUCTS_SYSTICK_H
11 
12 #include "hardware/address_mapped.h"
13 #include "hardware/regs/m0plus.h"
14 
15 // Reference to datasheet: https://datasheets.raspberrypi.com/rp2040/rp2040-datasheet.pdf#tab-registerlist_m0plus
16 //
17 // The _REG_ macro is intended to help make the register navigable in your IDE (for example, using the "Go to Definition" feature)
18 // _REG_(x) will link to the corresponding register in hardware/regs/m0plus.h.
19 //
20 // Bit-field descriptions are of the form:
21 // BITMASK [BITRANGE]: FIELDNAME (RESETVALUE): DESCRIPTION
22 
23 typedef struct {
24     _REG_(M0PLUS_SYST_CSR_OFFSET) // M0PLUS_SYST_CSR
25     // Use the SysTick Control and Status Register to enable the SysTick features
26     // 0x00010000 [16]    : COUNTFLAG (0): Returns 1 if timer counted to 0 since last time this was read
27     // 0x00000004 [2]     : CLKSOURCE (0): SysTick clock source
28     // 0x00000002 [1]     : TICKINT (0): Enables SysTick exception request:
29     // 0x00000001 [0]     : ENABLE (0): Enable SysTick counter:
30     io_rw_32 csr;
31 
32     _REG_(M0PLUS_SYST_RVR_OFFSET) // M0PLUS_SYST_RVR
33     // Use the SysTick Reload Value Register to specify the start value to load into the current value register when the...
34     // 0x00ffffff [23:0]  : RELOAD (0): Value to load into the SysTick Current Value Register when the counter reaches 0
35     io_rw_32 rvr;
36 
37     _REG_(M0PLUS_SYST_CVR_OFFSET) // M0PLUS_SYST_CVR
38     // Use the SysTick Current Value Register to find the current value in the register
39     // 0x00ffffff [23:0]  : CURRENT (0): Reads return the current value of the SysTick counter
40     io_rw_32 cvr;
41 
42     _REG_(M0PLUS_SYST_CALIB_OFFSET) // M0PLUS_SYST_CALIB
43     // Use the SysTick Calibration Value Register to enable software to scale to any required speed using divide and multiply
44     // 0x80000000 [31]    : NOREF (0): If reads as 1, the Reference clock is not provided - the CLKSOURCE bit of the...
45     // 0x40000000 [30]    : SKEW (0): If reads as 1, the calibration value for 10ms is inexact (due to clock frequency)
46     // 0x00ffffff [23:0]  : TENMS (0): An optional Reload value to be used for 10ms (100Hz) timing, subject to system clock...
47     io_ro_32 calib;
48 } systick_hw_t;
49 
50 #define systick_hw ((systick_hw_t *)(PPB_BASE + M0PLUS_SYST_CSR_OFFSET))
51 
52 #endif
53