Azure Sphere MT3620 M4 API Reference Manual
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
os_hal_gpt.h
1 /*
2  * (C) 2005-2020 MediaTek Inc. All rights reserved.
3  *
4  * Copyright Statement:
5  *
6  * This MT3620 driver software/firmware and related documentation
7  * ("MediaTek Software") are protected under relevant copyright laws.
8  * The information contained herein is confidential and proprietary to
9  * MediaTek Inc. ("MediaTek"). You may only use, reproduce, modify, or
10  * distribute (as applicable) MediaTek Software if you have agreed to and been
11  * bound by this Statement and the applicable license agreement with MediaTek
12  * ("License Agreement") and been granted explicit permission to do so within
13  * the License Agreement ("Permitted User"). If you are not a Permitted User,
14  * please cease any access or use of MediaTek Software immediately.
15  *
16  * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
17  * THAT MEDIATEK SOFTWARE RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE
18  * PROVIDED TO RECEIVER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS
19  * ANY AND ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
21  * NONINFRINGEMENT. NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH
22  * RESPECT TO THE SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY,
23  * INCORPORATED IN, OR SUPPLIED WITH MEDIATEK SOFTWARE, AND RECEIVER AGREES TO
24  * LOOK ONLY TO SUCH THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO.
25  * RECEIVER EXPRESSLY ACKNOWLEDGES THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO
26  * OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES CONTAINED IN MEDIATEK
27  * SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE
28  * RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
29  * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S
30  * ENTIRE AND CUMULATIVE LIABILITY WITH RESPECT TO MEDIATEK SOFTWARE RELEASED
31  * HEREUNDER WILL BE ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY
32  * RECEIVER TO MEDIATEK DURING THE PRECEDING TWELVE (12) MONTHS FOR SUCH
33  * MEDIATEK SOFTWARE AT ISSUE.
34  */
35 
36 #ifndef __OS_HAL_GPT_H__
37 #define __OS_HAL_GPT_H__
38 
39 #include "mhal_gpt.h"
40 
125 typedef enum {
127  OS_HAL_GPT0 = GPT0,
129  OS_HAL_GPT1 = GPT1,
131  OS_HAL_GPT2 = GPT2,
133  OS_HAL_GPT3 = GPT3,
135  OS_HAL_GPT4 = GPT4,
138 } GPT_ID;
139 
152 struct os_gpt_int {
154  void (*gpt_cb_hdl)(void *);
158  void *gpt_cb_data;
159 };
160 
170 #ifdef __cplusplus
171 extern "C" {
172 #endif
173 
181 int mtk_os_hal_gpt_start(enum gpt_num timer_id);
182 
190 int mtk_os_hal_gpt_stop(enum gpt_num timer_id);
191 
198 unsigned int mtk_os_hal_gpt_get_cur_count(enum gpt_num timer_id);
199 
207 int mtk_os_hal_gpt_restart(enum gpt_num timer_id);
208 
218 int mtk_os_hal_gpt_reset_timer(enum gpt_num timer_id,
219  unsigned int count_val,
220  bool auto_repeat);
221 
234 int mtk_os_hal_gpt_config(enum gpt_num timer_id,
235  unsigned char speed_32us,
236  struct os_gpt_int *gpt_int);
237 
246 void mtk_os_hal_gpt_register_irq(void);
247 
257 void mtk_os_hal_gpt_init(void);
258 
259 #ifdef __cplusplus
260 }
261 #endif
262 
272 #endif /* __OS_HAL_GPT_H__ */
void mtk_os_hal_gpt_register_irq(void)
Register GPT irq.
Use GPT4 as timer.
Definition: os_hal_gpt.h:135
void mtk_os_hal_gpt_init(void)
Init GPT device.
int mtk_os_hal_gpt_config(enum gpt_num timer_id, unsigned char speed_32us, struct os_gpt_int *gpt_int)
Config GPT timer.
void * gpt_cb_data
The pointer of GPT interrupt callback data, which will be passed into user interrupt handle...
Definition: os_hal_gpt.h:158
int mtk_os_hal_gpt_start(enum gpt_num timer_id)
Start GPT timer count.
The maximum GPT number (invalid)
Definition: os_hal_gpt.h:137
int mtk_os_hal_gpt_stop(enum gpt_num timer_id)
Stop GPT timer count.
Use GPT3 as timer.
Definition: os_hal_gpt.h:133
int mtk_os_hal_gpt_reset_timer(enum gpt_num timer_id, unsigned int count_val, bool auto_repeat)
Reset GPT timer mode (only works for interrupt-based timer).
gpt_num
GPT timer ID enum definition.
Definition: mhal_gpt.h:157
unsigned int mtk_os_hal_gpt_get_cur_count(enum gpt_num timer_id)
Get GPT timer counter value.
Definition: os_hal_gpt.h:152
void(* gpt_cb_hdl)(void *)
The user interrupt handle of GPT.
Definition: os_hal_gpt.h:154
Use GPT0 as timer.
Definition: os_hal_gpt.h:127
Use GPT1 as timer.
Definition: os_hal_gpt.h:129
GPT_ID
Definition: os_hal_gpt.h:125
int mtk_os_hal_gpt_restart(enum gpt_num timer_id)
Restart GPT timer count.
Use GPT2 as timer.
Definition: os_hal_gpt.h:131