MT7687 API Reference  LinkIt SDK v4
hal_eint.h
1 /* Copyright Statement:
2  *
3  * (C) 2005-2016 MediaTek Inc. All rights reserved.
4  *
5  * This software/firmware and related documentation ("MediaTek Software") are
6  * protected under relevant copyright laws. The information contained herein
7  * is confidential and proprietary to MediaTek Inc. ("MediaTek") and/or its licensors.
8  * Without the prior written permission of MediaTek and/or its licensors,
9  * any reproduction, modification, use or disclosure of MediaTek Software,
10  * and information contained herein, in whole or in part, shall be strictly prohibited.
11  * You may only use, reproduce, modify, or distribute (as applicable) MediaTek Software
12  * if you have agreed to and been bound by the applicable license agreement with
13  * MediaTek ("License Agreement") and been granted explicit permission to do so within
14  * the License Agreement ("Permitted User"). If you are not a Permitted User,
15  * please cease any access or use of MediaTek Software immediately.
16  * BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
17  * THAT MEDIATEK SOFTWARE RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES
18  * ARE PROVIDED TO RECEIVER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
19  * WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
20  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
21  * NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
22  * SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
23  * SUPPLIED WITH MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
24  * THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
25  * THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
26  * CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
27  * SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
28  * STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
29  * CUMULATIVE LIABILITY WITH RESPECT TO MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
30  * AT MEDIATEK'S OPTION, TO REVISE OR REPLACE MEDIATEK SOFTWARE AT ISSUE,
31  * OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
32  * MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
33  */
34 
35 #ifndef __HAL_EINT_H__
36 #define __HAL_EINT_H__
37 #include "hal_platform.h"
38 
39 #ifdef HAL_EINT_MODULE_ENABLED
40 
66 #ifdef HAL_EINT_FEATURE_MASK
67 
129 #else
130 
182 #endif
183 
184 #ifdef __cplusplus
185 extern "C" {
186 #endif
187 
188 
194 typedef enum {
201 
202 
204 typedef enum {
210 
211 
222 typedef struct {
224  uint32_t debounce_time;
226 
241 typedef void (*hal_eint_callback_t)(void *user_data);
242 
248 /*****************************************************************************
249 * Functions
250 *****************************************************************************/
251 
263 hal_eint_status_t hal_eint_init(hal_eint_number_t eint_number, const hal_eint_config_t *eint_config);
264 
265 
277 
278 
292  hal_eint_callback_t callback,
293  void *user_data);
294 
295 
307  hal_eint_trigger_mode_t trigger_mode);
308 
309 
321  uint32_t time_ms);
322 
323 #ifdef HAL_EINT_FEATURE_SW_TRIGGER_EINT
324 
334 hal_eint_status_t hal_eint_set_software_trigger(hal_eint_number_t eint_number);
335 
336 
347 hal_eint_status_t hal_eint_clear_software_trigger(hal_eint_number_t eint_number);
348 #endif
349 
350 #ifdef HAL_EINT_FEATURE_MASK
351 
359 hal_eint_status_t hal_eint_mask(hal_eint_number_t eint_number);
360 
361 
370 hal_eint_status_t hal_eint_unmask(hal_eint_number_t eint_number);
371 #endif
372 
384 
385 
386 #ifdef __cplusplus
387 }
388 #endif
389 
390 
396 #endif /*HAL_EINT_MODULE_ENABLED*/
397 #endif /* __HAL_EINT_H__ */
398 
399 
EINT error number.
Definition: hal_eint.h:205
Level and low trigger.
Definition: hal_eint.h:195
hal_eint_trigger_mode_t
This emun defines the EINT trigger mode.
Definition: hal_eint.h:194
Edge and falling trigger.
Definition: hal_eint.h:197
void(* hal_eint_callback_t)(void *user_data)
This defines the callback function prototype.
Definition: hal_eint.h:241
hal_eint_trigger_mode_t trigger_mode
EINT trigger mode.
Definition: hal_eint.h:223
hal_eint_number_t
eint pin number
Definition: hal_platform.h:605
Edge and rising trigger.
Definition: hal_eint.h:198
hal_eint_status_t hal_eint_deinit(hal_eint_number_t eint_number)
This function deinitializes the EINT number, it resets the EINT trigger mode and debounce time...
EINT error invalid parameter.
Definition: hal_eint.h:206
uint32_t debounce_time
EINT hardware debounce time in milliseconds.
Definition: hal_eint.h:224
hal_eint_status_t hal_eint_register_callback(hal_eint_number_t eint_number, hal_eint_callback_t callback, void *user_data)
This function registers a callback function for a specified EINT number.
This structure defines the initial configuration structure.
Definition: hal_eint.h:222
EINT operation completed successfully.
Definition: hal_eint.h:208
hal_eint_status_t
This enum define the API return type.
Definition: hal_eint.h:204
EINT undefined error.
Definition: hal_eint.h:207
hal_eint_status_t hal_eint_set_debounce_count(hal_eint_number_t eint_number, uint32_t count)
This function sets the EINT debounce count.
hal_eint_status_t hal_eint_init(hal_eint_number_t eint_number, const hal_eint_config_t *eint_config)
This function initializes the EINT number, it sets the EINT trigger mode and debounce time...
Level and high trigger.
Definition: hal_eint.h:196
Edge and falling or rising trigger.
Definition: hal_eint.h:199
hal_eint_status_t hal_eint_set_trigger_mode(hal_eint_number_t eint_number, hal_eint_trigger_mode_t trigger_mode)
This function sets the EINT number to a trigger mode.
hal_eint_status_t hal_eint_set_debounce_time(hal_eint_number_t eint_number, uint32_t time_ms)
This function sets the EINT debounce time.