TI-RTOS Drivers  tidrivers_full_2_20_00_08
ClockP.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015, 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  */
57 #ifndef ti_drivers_ports_ClockP__include
58 #define ti_drivers_ports_ClockP__include
59 
60 #ifdef __cplusplus
61 extern "C" {
62 #endif
63 
64 #include <stdint.h>
65 #include <stdbool.h>
66 #include <stddef.h>
67 
71 typedef struct ClockP_FreqHz {
72  uint32_t hi;
73  uint32_t lo;
75 
79 typedef enum ClockP_Status {
80  ClockP_OK = 0,
83 
91 typedef void *ClockP_Handle;
92 
96 typedef void (*ClockP_Fxn)(uintptr_t arg);
97 
107 typedef struct ClockP_Params {
108  char *name;
112  uintptr_t arg;
113 } ClockP_Params;
114 
127 extern ClockP_Handle ClockP_create(ClockP_Fxn clockFxn,
128  ClockP_Params *params);
129 
139 extern ClockP_Status ClockP_delete(ClockP_Handle handle);
140 
146 extern void ClockP_getCpuFreq(ClockP_FreqHz *freq);
147 
153 extern uint32_t ClockP_getSystemTickPeriod();
154 
163 extern uint32_t ClockP_getSystemTicks();
164 
174 extern void ClockP_Params_init(ClockP_Params *params);
175 
188 extern ClockP_Status ClockP_start(ClockP_Handle handle, uint32_t timeout);
189 
202 extern ClockP_Status ClockP_startFromISR(ClockP_Handle handle, uint32_t timeout);
203 
215 extern ClockP_Status ClockP_stop(ClockP_Handle handle);
216 
226 extern ClockP_Status ClockP_stopFromISR(ClockP_Handle handle);
227 
228 extern ClockP_Status ClockP_timestamp(ClockP_Handle handle);
229 
230 #ifdef __cplusplus
231 }
232 #endif
233 
234 #endif /* ti_drivers_ports_ClockP__include */
uint32_t lo
Definition: ClockP.h:73
ClockP_Handle ClockP_create(ClockP_Fxn clockFxn, ClockP_Params *params)
Function to create a clock object.
Definition: ClockP.h:81
Basic ClockP Parameters.
Definition: ClockP.h:107
ClockP_Status ClockP_stop(ClockP_Handle handle)
Function to stop a clock.
uint32_t ClockP_getSystemTickPeriod()
Get the system tick period in microseconds.
Frequency-in-hertz struct.
Definition: ClockP.h:71
ClockP_Status ClockP_startFromISR(ClockP_Handle handle, uint32_t timeout)
Function to start a clock from an interrupt.
ClockP_Status ClockP_stopFromISR(ClockP_Handle handle)
Function to stop a clock from an interrupt.
ClockP_Status ClockP_start(ClockP_Handle handle, uint32_t timeout)
Function to start a clock.
struct ClockP_FreqHz ClockP_FreqHz
Frequency-in-hertz struct.
Definition: ClockP.h:80
void ClockP_getCpuFreq(ClockP_FreqHz *freq)
Get CPU frequency in Hz.
uintptr_t arg
Definition: ClockP.h:112
ClockP_Status ClockP_timestamp(ClockP_Handle handle)
struct ClockP_Params ClockP_Params
Basic ClockP Parameters.
void(* ClockP_Fxn)(uintptr_t arg)
Prototype for a ClockP function.
Definition: ClockP.h:96
ClockP_Status
Status codes for ClockP APIs.
Definition: ClockP.h:79
char * name
Definition: ClockP.h:108
ClockP_Status ClockP_delete(ClockP_Handle handle)
Function to delete a clock.
void ClockP_Params_init(ClockP_Params *params)
Initialize params structure to default values.
uint32_t hi
Definition: ClockP.h:72
uint32_t ClockP_getSystemTicks()
Get the current tick value.
void * ClockP_Handle
Opaque client reference to an instance of a ClockP.
Definition: ClockP.h:91
Copyright 2016, Texas Instruments Incorporated