Loading...
Searching...
No Matches
rtt_arch.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2020 Gunar Schorcht
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
38
39#include "periph/rtt.h"
40
41#ifdef __cplusplus
42extern "C" {
43#endif
44
48#define RTT_HW_COUNTER_MAX ((1ULL << 48) - 1)
49
53typedef struct {
57 void (*init)(void);
58
63 uint64_t (*get_counter)(void);
64
71 void (*set_alarm)(uint32_t alarm, rtt_cb_t cb, void *arg);
72
76 void (*clear_alarm)(void);
77
81 void (*save_counter)(void);
82
88 void (*restore_counter)(bool in_init);
89
93 void (*poweron)(void);
94
98 void (*poweroff)(void);
99
101
107uint64_t rtt_pm_sleep_enter(unsigned mode);
108
113void rtt_pm_sleep_exit(uint32_t cause);
114
115#ifdef __cplusplus
116}
117#endif
118
void(* rtt_cb_t)(void *arg)
Signature for the alarm callback.
Definition rtt.h:169
Low-level RTT (Real Time Timer) peripheral driver interface definitions.
void rtt_pm_sleep_exit(uint32_t cause)
Called after the power management left light sleep mode.
uint64_t rtt_pm_sleep_enter(unsigned mode)
Called before the power management enters a light or deep sleep mode.
RTT hardware abstraction layer driver.
Definition rtt_arch.h:53
void(* save_counter)(void)
Save the counter value before sleep or reboot if necessary.
Definition rtt_arch.h:81
void(* restore_counter)(bool in_init)
Restore the counter value before sleep or reboot.
Definition rtt_arch.h:88
void(* init)(void)
Init the current hardware counter.
Definition rtt_arch.h:57
void(* poweroff)(void)
Disable the RTT hardware counter.
Definition rtt_arch.h:98
uint64_t(* get_counter)(void)
Get the current hardware counter value.
Definition rtt_arch.h:63
void(* set_alarm)(uint32_t alarm, rtt_cb_t cb, void *arg)
Set the hardware alarm.
Definition rtt_arch.h:71
void(* clear_alarm)(void)
Clear the hardware alarm.
Definition rtt_arch.h:76
void(* poweron)(void)
Enable the RTT hardware counter.
Definition rtt_arch.h:93