blob: b4be48fdbf48ab6c138974ab79b3d968d5cb11ab [file] [log] [blame]
developere0cea0f2021-12-16 16:08:26 +08001/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * System specific functions header file
4 *
5 * Author(s):
6 * laj
7 *
8 * Distributed by:
9 * Silicon Laboratories, Inc
10 *
11 * File Description:
12 * This is the header file for the system specific functions like timer functions.
13 *
14 *
15 */
16
17#ifndef TIMER_INTF_H
18#define TIMER_INTF_H
19
20/** @addtogroup PROSLIC_CUSTOMER_APIS
21 * @{
22 * @defgroup PROSLIC_CUSTOMER_TIMER Customer implemented timer functions
23 * This section has documentation related to timers: delays and timestamps. The void * is a customer
24 * supplied timer data structure that the user specifies in @ref SiVoice_setControlInterfaceTimerObj.
25 * These functions need to be associated with the functions documented in @ref SIVOICE_TIMER
26 *
27 * @note For the majority of implementations, the only function that is required is the delay function.
28 *
29 * @{
30 */
31
32/**
33 * @brief
34 * System time delay function pointer
35 *
36 * @param[in] hTimer - the system timer object
37 * @param[in] timeInMS - number of mSec to suspend the task/thread executing.
38 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
39*/
40
41typedef int (*system_delay_fptr) (void *hTimer, int timeInMs);
42
43/**
44 * @brief
45 * System time elapsed function pointer
46 *
47 * @details
48 * This function combined with @ref system_getTime_fptr function allow one to determine
49 * the time elapsed between the two event times.
50 *
51 * The example pseudo code below shows how one may see this function used in conjunction with
52 * the function pointed by @ref system_getTime_fptr to do some processing while waiting
53 * for a time to expire.
54 *
55 * @code
56 * my_timer_obj time_now;
57 *
58 * getTime(my_prosclic_obj->timer_obj_ptr, (void *)(&time_now));
59 *
60 * Some events occur here...
61 *
62 * do
63 * {
64 * time_elapsed(my_proslic_obj->timer_obj_ptr,(void *)(&time_now), &elapsed_time_mSec);
65 *
66 * Do something here...
67 *
68 * }while(elapsed_time_mSec < Desired delay);
69 *
70 * Change state...
71 *
72 * @endcode
73 *
74 * @param[in] *hTimer - the system timer object
75 * @param[in] *startTime - the time object returned by @ref system_getTime_fptr - the "start time" of the event.
76 * @param[out] *timeInMs - the time in mSec between the "start time" and the current time.
77 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
78 * @sa system_getTime_fptr
79*/
80
81typedef int (*system_timeElapsed_fptr) (void *hTimer, void *startTime,
82 int *timeInMs);
83
84/**
85 * @brief
86 * Retrieve system time in mSec resolution.
87 *
88 * @details
89 * This function combined with @ref system_timeElapsed_fptr function allow one to determine
90 * the time elapsed between the two event times.
91 *
92 * @param[in] *hTimer - the system timer object
93 * @param[in] *time - the time stamp object needed by @ref system_timeElapsed_fptr
94 * @retval int - error from @ref errorCodeType @ref RC_NONE indicates no error.
95 * @sa system_timeElapsed_fptr
96*/
97
98typedef int (*system_getTime_fptr) (void *hTimer, void *time);
99
100/** @}
101 * @} */
102#endif
103