AM261x MCU+ SDK: cb_xtimer.h Source File

| AM261x MCU+ SDK 26.00.00 |

cb_xtimer.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2023 Texas Instruments Incorporated
3 * Copyright (c) 2023 Excelfore Corporation (https://excelfore.com)
4 *
5 * All rights reserved not granted herein.
6 * Limited License.
7 *
8 * Texas Instruments Incorporated grants a world-wide, royalty-free,
9 * non-exclusive license under copyrights and patents it now or hereafter
10 * owns or controls to make, have made, use, import, offer to sell and sell ("Utilize")
11 * this software subject to the terms herein. With respect to the foregoing patent
12 * license, such license is granted solely to the extent that any such patent is necessary
13 * to Utilize the software alone. The patent license shall not apply to any combinations which
14 * include this software, other than combinations with devices manufactured by or for TI ("TI Devices").
15 * No hardware patent is licensed hereunder.
16 *
17 * Redistributions must preserve existing copyright notices and reproduce this license (including the
18 * above copyright notice and the disclaimer and (if applicable) source code license limitations below)
19 * in the documentation and/or other materials provided with the distribution
20 *
21 * Redistribution and use in binary form, without modification, are permitted provided that the following
22 * conditions are met:
23 *
24 * * No reverse engineering, decompilation, or disassembly of this software is permitted with respect to any
25 * software provided in binary form.
26 * * any redistribution and use are licensed by TI for use only with TI Devices.
27 * * Nothing shall obligate TI to provide you with source code for the software licensed and provided to you in object code.
28 *
29 * If software source code is provided to you, modification and redistribution of the source code are permitted
30 * provided that the following conditions are met:
31 *
32 * * any redistribution and use of the source code, including any resulting derivative works, are licensed by
33 * TI for use only with TI Devices.
34 * * any redistribution and use of any object code compiled from the source code and any resulting derivative
35 * works, are licensed by TI for use only with TI Devices.
36 *
37 * Neither the name of Texas Instruments Incorporated nor the names of its suppliers may be used to endorse or
38 * promote products derived from this software without specific prior written permission.
39 *
40 * DISCLAIMER.
41 *
42 * THIS SOFTWARE IS PROVIDED BY TI AND TI"S LICENSORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
43 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
44 * IN NO EVENT SHALL TI AND TI"S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
45 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
46 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
47 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
48 * POSSIBILITY OF SUCH DAMAGE.
49 */
59 #ifndef CB_XTIMER_H_
60 #define CB_XTIMER_H_
61
62 #include <stdbool.h>
63 #include <stdint.h>
64
68 typedef struct cb_xtimer_man cb_xtimer_man_t;
69
73 typedef struct cb_xtimer cb_xtimer_t;
74
78 typedef struct cb_xtimer_ndata cb_xtimer_ndata_t;
79
83 typedef void (*xtimer_expirecb_t)(cb_xtimer_t *timer, void *exparg);
84
85
94 cb_xtimer_man_t *cb_xtimer_man_create(void);
95
100 void cb_xtimer_man_delete(cb_xtimer_man_t *xtimer_man);
101
112 int cb_xtimer_man_schedule(cb_xtimer_man_t *xtimer_man);
113
119 int cb_xtimer_man_nearest_timeout(cb_xtimer_man_t *xtimer_man);
120
128 cb_xtimer_t *cb_xtimer_create(cb_xtimer_man_t *xtimer_man,
129 xtimer_expirecb_t expirecb, void *exparg);
130
135 void cb_xtimer_delete(cb_xtimer_t *xtimer);
136
144 void cb_xtimer_set_periodic(cb_xtimer_t *xtimer);
145
150 void cb_xtimer_clear_periodic(cb_xtimer_t *xtimer);
151
157 bool cb_xtimer_is_periodic(cb_xtimer_t *xtimer);
158
164 int cb_xtimer_remain_timeout(cb_xtimer_t *xtimer);
165
172 int cb_xtimer_start(cb_xtimer_t *xtimer, uint32_t timeout_us);
173
178 void cb_xtimer_stop(cb_xtimer_t *xtimer);
179
185 bool cb_xtimer_is_running(cb_xtimer_t *xtimer);
186
187 #endif /*CB_XTIMER_H_*/
188
cb_xtimer_remain_timeout
int cb_xtimer_remain_timeout(cb_xtimer_t *xtimer)
Get remaining timeout of a running timer.
cb_xtimer_start
int cb_xtimer_start(cb_xtimer_t *xtimer, uint32_t timeout_us)
Start a timer.
cb_xtimer_man_t
struct cb_xtimer_man cb_xtimer_man_t
Data handle of a timer manager, inside of it is private.
Definition: cb_xtimer.h:68
cb_xtimer_set_periodic
void cb_xtimer_set_periodic(cb_xtimer_t *xtimer)
Set a periodic timer flag.
cb_xtimer_t
struct cb_xtimer cb_xtimer_t
Data handle of a timer, inside of it is private.
Definition: cb_xtimer.h:73
xtimer_expirecb_t
void(* xtimer_expirecb_t)(cb_xtimer_t *timer, void *exparg)
A callback is called when a timer expired.
Definition: cb_xtimer.h:83
cb_xtimer_man_delete
void cb_xtimer_man_delete(cb_xtimer_man_t *xtimer_man)
Delete a timer manager.
cb_xtimer_is_periodic
bool cb_xtimer_is_periodic(cb_xtimer_t *xtimer)
Check if a timer is periodic.
cb_xtimer_clear_periodic
void cb_xtimer_clear_periodic(cb_xtimer_t *xtimer)
Clear periodic timer flag.
cb_xtimer_create
cb_xtimer_t * cb_xtimer_create(cb_xtimer_man_t *xtimer_man, xtimer_expirecb_t expirecb, void *exparg)
Create a timer.
cb_xtimer_stop
void cb_xtimer_stop(cb_xtimer_t *xtimer)
Stop a running timer, the periodic flag is cleared as well.
cb_xtimer_man_nearest_timeout
int cb_xtimer_man_nearest_timeout(cb_xtimer_man_t *xtimer_man)
Get a timeout of nearest timer.
cb_xtimer_man_create
cb_xtimer_man_t * cb_xtimer_man_create(void)
Create a timer manager.
cb_xtimer_delete
void cb_xtimer_delete(cb_xtimer_t *xtimer)
Delete a timer.
cb_xtimer_is_running
bool cb_xtimer_is_running(cb_xtimer_t *xtimer)
Check if a timer is running.
cb_xtimer_ndata_t
struct cb_xtimer_ndata cb_xtimer_ndata_t
Data handle of a timer data, inside of it is private.
Definition: cb_xtimer.h:78
cb_xtimer_man_schedule
int cb_xtimer_man_schedule(cb_xtimer_man_t *xtimer_man)
The timer manager consumes expired timers and schedule for next timer to be expired.