Loading...
Searching...
No Matches
rtt_arch.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2020 Gunar Schorcht
3 *
4 * This file is subject to the terms and conditions of the GNU Lesser
5 * General Public License v2.1. See the file LICENSE in the top level
6 * directory for more details.
7 */
8
9#pragma once
10
41
42#include "periph/rtt.h"
43
44#ifdef __cplusplus
45extern "C" {
46#endif
47
51#define RTT_HW_COUNTER_MAX ((1ULL << 48) - 1)
52
56typedef struct {
60 void (*init)(void);
61
66 uint64_t (*get_counter)(void);
67
74 void (*set_alarm)(uint32_t alarm, rtt_cb_t cb, void *arg);
75
79 void (*clear_alarm)(void);
80
84 void (*save_counter)(void);
85
91 void (*restore_counter)(bool in_init);
92
96 void (*poweron)(void);
97
101 void (*poweroff)(void);
102
104
110uint64_t rtt_pm_sleep_enter(unsigned mode);
111
116void rtt_pm_sleep_exit(uint32_t cause);
117
118#ifdef __cplusplus
119}
120#endif
121
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:56
void(* save_counter)(void)
Save the counter value before sleep or reboot if necessary.
Definition rtt_arch.h:84
void(* restore_counter)(bool in_init)
Restore the counter value before sleep or reboot.
Definition rtt_arch.h:91
void(* init)(void)
Init the current hardware counter.
Definition rtt_arch.h:60
void(* poweroff)(void)
Disable the RTT hardware counter.
Definition rtt_arch.h:101
uint64_t(* get_counter)(void)
Get the current hardware counter value.
Definition rtt_arch.h:66
void(* set_alarm)(uint32_t alarm, rtt_cb_t cb, void *arg)
Set the hardware alarm.
Definition rtt_arch.h:74
void(* clear_alarm)(void)
Clear the hardware alarm.
Definition rtt_arch.h:79
void(* poweron)(void)
Enable the RTT hardware counter.
Definition rtt_arch.h:96