summaryrefslogtreecommitdiff
path: root/libhw_cr/rp2040_include/libhw/rp2040_hwtimer.h
blob: 40e4172be8eb1a324fa589ce5d734585eb8d3b4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/* libhw/rp2040_hwtimer.h - <libhw/generic/alarmclock.h> implementation for the RP2040's hardware timer
 *
 * Copyright (C) 2024-2025  Luke T. Shumaker <lukeshu@lukeshu.com>
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

#ifndef _LIBHW_RP2040_HWTIMER_H_
#define _LIBHW_RP2040_HWTIMER_H_

#include <libhw/generic/alarmclock.h>

/**
 * The RP2040 has one system "timer" with 4 alarm interrupts.
 */
enum rp2040_hwalarm_instance {
	RP2040_HWALARM_0 = 0,
	RP2040_HWALARM_1 = 1,
	RP2040_HWALARM_2 = 2,
	RP2040_HWALARM_3 = 3,
	_RP2040_HWALARM_NUM,
};

lo_interface alarmclock rp2040_hwtimer(enum rp2040_hwalarm_instance alarm_num);

#endif /* _LIBHW_RP2040_HWTIMER_H_ */