PSDK QNX API Guide
ClockP.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2021, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
54 #ifndef ti_osal_ClockP__include
55 #define ti_osal_ClockP__include
56 
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60 
61 #include <stdint.h>
62 #include <stdbool.h>
63 #include <stddef.h>
64 
74 typedef int32_t ClockP_Status;
76 #define ClockP_OK ((int32_t) 0)
78 #define ClockP_FAILURE ((int32_t) (-1))
79 /* @} */
80 
90 typedef uint8_t ClockP_RunMode;
92 #define ClockP_RunMode_ONESHOT ((uint8_t) 0U)
94 #define ClockP_RunMode_CONTINUOUS ((uint8_t) 1U)
95 /* @} */
96 
106 typedef uint8_t ClockP_StartMode;
108  #define ClockP_StartMode_USER ((uint8_t) 0U)
110 #define ClockP_StartMode_AUTO ((uint8_t) 1U)
111 /* @} */
112 
119 typedef void *ClockP_Handle;
120 
127 typedef struct ClockP_Params_s
128 {
129  void *pErrBlk;
130  uint8_t startMode;
131  uint32_t period;
132  uint8_t runMode;
133  void *arg;
134 } ClockP_Params;
135 
141 extern void ClockP_Params_init(ClockP_Params *params);
142 
148 typedef void (*ClockP_FxnCallback)(void *args);
149 
160  const ClockP_Params *params);
161 
172 
183 
194 
195 #ifdef __cplusplus
196 }
197 #endif
198 
199 #endif /* ti_osal_ClockP__include */
200 /* @} */
void * ClockP_Handle
Opaque client reference to an instance of a ClockP.
Definition: ClockP.h:119
ClockP_Status ClockP_delete(ClockP_Handle handle)
Function to delete a clock.
ClockP_Status ClockP_stop(ClockP_Handle handle)
Function to stop a clock.
void * arg
Definition: ClockP.h:133
void * pErrBlk
Definition: ClockP.h:129
uint8_t ClockP_RunMode
This enumerator defines the Timer runtime modes.
Definition: ClockP.h:90
void ClockP_Params_init(ClockP_Params *params)
Initialize params structure to default values.
uint8_t startMode
Definition: ClockP.h:130
uint8_t runMode
Definition: ClockP.h:132
int32_t ClockP_Status
Status codes for ClockP APIs.
Definition: ClockP.h:74
ClockP_Status ClockP_start(ClockP_Handle handle)
Function to start a clock.
void(* ClockP_FxnCallback)(void *args)
Callback that is called when the clock expires.
Definition: ClockP.h:148
uint8_t ClockP_StartMode
This enumerator defines the Timer start modes.
Definition: ClockP.h:106
ClockP_Handle ClockP_create(ClockP_FxnCallback clockfxn, const ClockP_Params *params)
Function to create a clock.
uint32_t period
Definition: ClockP.h:131
Basic ClockP Parameters.
Definition: ClockP.h:128