blob: f9d53b16760041818e6321eeadee6e6934e763df [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001/*******************************************************************************
2 * Copyright (C) 2007, ZTE Corporation.
3 *
4 * File Name: drvs_rtt.h
5 * File Mark:
6 * Description:
7 * Others:
8 * Version: 1.0
9 * Author: wangxia
10 * Date: 2010-4-29
11 * History 1:
12 * Date:
13 * Version:
14 * Author:
15 * Modification:
16 * History 2:
17 ********************************************************************************/
18
19#ifndef _DRVS_RTT_H
20#define _DRVS_RTT_H
21
22
23/****************************************************************************
24* Include files
25****************************************************************************/
26#include "os_ose.h"
27
28/****************************************************************************
29* Macros
30****************************************************************************/
31#define RTT_INT_LEVEL_USER_0 0x5
32#define RTT_INT_LEVEL_USER_1 0x5
33#define RTT_INT_LEVEL_USER_2 0x5
34#define RTT_INT_LEVEL_USER_3 0x5
35#define RTT_INT_LEVEL_USER_4 0x5
36#define RTT_INT_LEVEL_USER_COMMON 0x7
37
38/*The RTT Clock resolution on creation. RTT Clock is available only for predefined users.
39 The resolution can be modified at runtime using RTT_set_clock_resolution
40 */
41#define RTT_DEFAULT_CLOCK_RESOLUTION rtt_clock_100_microseconds
42
43/****************************************************************************
44* Types
45****************************************************************************/
46 typedef enum
47 {
48 rtt_uicc, /* Reserved timer : GPT0T1 */
49 rtt_free1, /* Reserved timer : GPT0T0 */
50 rtt_meas, /* Reserved timer : GPT1T0 */
51 rtt_mmci, /* Reserved timer : GPT1T1 */
52 rtt_free2, /* Reserved timer : GPT1T2 */
53 rtt_common = 5, /* Reserved timer : GPT0T2 */
54 rtt_with_clock = 15, /* !!! use MSB special exception for turning of powersave !!!*/
55 rtt_max_nof_timers = 40
56 } rtt_timer_user_id_enum;
57
58 typedef enum
59 {
60 rtt_one_shot,
61 rtt_repetitive,
62 rtt_one_shot_timer_with_clock,
63 rtt_repetitive_timer_with_clock
64 } rtt_timer_mode_enum;
65
66 typedef enum
67 {
68 rtt_clock_1_microsecond,
69 rtt_clock_10_microseconds,
70 rtt_clock_100_microseconds,
71 rtt_clock_5_milliseconds,
72 rtt_clock_10_milliseconds,
73 rtt_clock_100_milliseconds
74 }rtt_clock_resolution_type;
75
76 /*---------------------------------------------*/
77 /* Typedefinition . */
78 /*---------------------------------------------*/
79 typedef struct
80 {
81 VOID (*timeout_func)(VOID ); /* Callback function on timeout */
82 VOID *arg; /* Argument list to the above callback function */
83 rtt_timer_user_id_enum user_id;
84 rtt_timer_mode_enum timer_mode;
85 UINT32 created;
86 UINT32 started;
87 UINT32 duration;
88 UINT32 restart_duration;
89 UINT32 hw_timer_id;
90 UINT32 process_id;
91 } rtt_timer_list_type;
92 /* end of UICC_Driver_2007_11_2_dcm */
93
94 typedef struct
95 {
96 unsigned int creation_time[2]; //64 bit creation timestamp
97 unsigned int scaled_creation_time; //scaled to current resolution
98 unsigned long resolution;
99 }rtt_clock_data_type;
100
101
102/****************************************************************************
103* Constants
104****************************************************************************/
105
106/****************************************************************************
107* Global Variables
108****************************************************************************/
109
110/****************************************************************************
111* Function Prototypes
112****************************************************************************/
113
114/*******************************************************************************
115 * Function: RTT_create_timer
116 * Description:
117 * Parameters:
118 * Input:
119 *
120 * Output:
121 *
122 * Returns:
123 *
124 *
125 * Others:
126 ********************************************************************************/
127extern rtt_timer_list_type *RTT_create_timer(VOID (*timeout_func)(VOID ),
128 VOID *arg,
129 rtt_timer_user_id_enum user_id,
130 rtt_timer_mode_enum timer_mode);
131
132/*******************************************************************************
133 * Function: RTT_remove_timer
134 * Description:
135 * Parameters:
136 * Input:
137 *
138 * Output:
139 *
140 * Returns:
141 *
142 *
143 * Others:
144 ********************************************************************************/
145extern SINT32 RTT_remove_timer(rtt_timer_list_type *timer);
146
147
148/*******************************************************************************
149 * Function: RTT_start_timer
150 * Description:
151 * Parameters:
152 * Input:
153 *
154 * Output:
155 *
156 * Returns:
157 *
158 *
159 * Others:
160 ********************************************************************************/
161extern SINT32 RTT_start_timer(rtt_timer_list_type *timer, UINT32 duration);
162
163
164/*******************************************************************************
165 * Function: RTT_stop_timer
166 * Description:
167 * Parameters:
168 * Input:
169 *
170 * Output:
171 *
172 * Returns:
173 *
174 *
175 * Others:
176 ********************************************************************************/
177extern SINT32 RTT_stop_timer(volatile rtt_timer_list_type * volatile timer);
178#endif/*_DRVS_RTT_H*/
179