hsw-nbt 1.2.0
OPTIGA Authenticate NBT Host Library for C
ifx-timer.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) 2024-2026 Infineon Technologies AG
2// SPDX-License-Identifier: MIT
3
8#ifndef IFX_TIMER_H
9#define IFX_TIMER_H
10
11#include <stdbool.h>
12#include <stdint.h>
13
14#include "infineon/ifx-error.h"
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
23#define LIB_TIMER UINT8_C(0x02)
24
28#define IFX_TIMER_SET UINT8_C(0x01)
29
33#define IFX_TIMER_JOIN UINT8_C(0x02)
34
42#define IFX_TIMER_NOT_SET 0x01u
43
47typedef struct
48{
55 void *_start;
56
62 uint64_t _duration;
64
74ifx_status_t ifx_timer_set(ifx_timer_t *timer, uint64_t time_us);
75
87
97
111
112#ifdef __cplusplus
113}
114#endif
115
116#endif // IFX_TIMER_H
Infineon specific error code creation and parsing.
uint32_t ifx_status_t
Custom return code type used by all Infineon host software libraries.
Definition ifx-error.h:91
Generic struct for joinable timers.
Definition ifx-timer.h:48
ifx_status_t ifx_timer_join(const ifx_timer_t *timer)
Waits for Timer to finish.
uint64_t _duration
Private member for duration of timer in [us].
Definition ifx-timer.h:62
void * _start
Private member for start of timer as void* to be as generic as possible.
Definition ifx-timer.h:55
void ifx_timer_destroy(ifx_timer_t *timer)
Frees memory associated with Timer object (but not object itself).
ifx_status_t ifx_timer_set(ifx_timer_t *timer, uint64_t time_us)
Sets Timer for given amount of [us].
bool ifx_timer_has_elapsed(const ifx_timer_t *timer)
Checks if Timer has elapsed.