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_TICKS_H
9 #define _HARDWARE_STRUCTS_TICKS_H
10 
11 /**
12  * \file rp2350/ticks.h
13  */
14 
15 #include "hardware/address_mapped.h"
16 #include "hardware/regs/ticks.h"
17 
18 // Reference to datasheet: https://datasheets.raspberrypi.com/rp2350/rp2350-datasheet.pdf#tab-registerlist_ticks
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/ticks.h.
22 //
23 // Bit-field descriptions are of the form:
24 // BITMASK [BITRANGE] FIELDNAME (RESETVALUE) DESCRIPTION
25 
26 /*! \brief Tick generator numbers on RP2350 (used as typedef \ref tick_gen_num_t)
27  *  \ingroup hardware_ticks
28  */
29 typedef enum tick_gen_num_rp2350 {
30     TICK_PROC0 = 0,
31     TICK_PROC1 = 1,
32     TICK_TIMER0 = 2,
33     TICK_TIMER1 = 3,
34     TICK_WATCHDOG = 4,
35     TICK_RISCV = 5,
36     TICK_COUNT
37 } tick_gen_num_t;
38 
39 typedef struct {
40     _REG_(TICKS_PROC0_CTRL_OFFSET) // TICKS_PROC0_CTRL
41     // Controls the tick generator
42     // 0x00000002 [1]     RUNNING      (-) Is the tick generator running?
43     // 0x00000001 [0]     ENABLE       (0) start / stop tick generation
44     io_rw_32 ctrl;
45 
46     _REG_(TICKS_PROC0_CYCLES_OFFSET) // TICKS_PROC0_CYCLES
47     // 0x000001ff [8:0]   PROC0_CYCLES (0x000) Total number of clk_tick cycles before the next tick
48     io_rw_32 cycles;
49 
50     _REG_(TICKS_PROC0_COUNT_OFFSET) // TICKS_PROC0_COUNT
51     // 0x000001ff [8:0]   PROC0_COUNT  (-) Count down timer: the remaining number clk_tick cycles...
52     io_ro_32 count;
53 } ticks_slice_hw_t;
54 
55 typedef struct {
56     ticks_slice_hw_t ticks[6];
57 } ticks_hw_t;
58 
59 #define ticks_hw ((ticks_hw_t *)TICKS_BASE)
60 static_assert(sizeof (ticks_hw_t) == 0x0048, "");
61 
62 #endif // _HARDWARE_STRUCTS_TICKS_H
63 
64