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 
184 #endif
185 
186 #ifdef __cplusplus
187 extern "C" {
188 #endif
189 
190 
196 typedef enum {
203 
204 
206 typedef enum {
212 
213 
224 typedef struct {
226  uint32_t debounce_time;
228 
243 typedef void (*hal_eint_callback_t)(void *user_data);
244 
250 /*****************************************************************************
251 * Functions
252 *****************************************************************************/
253 
265 hal_eint_status_t hal_eint_init(hal_eint_number_t eint_number, const hal_eint_config_t *eint_config);
266 
267 
279 
280 
294  hal_eint_callback_t callback,
295  void *user_data);
296 
297 
309  hal_eint_trigger_mode_t trigger_mode);
310 
311 
323  uint32_t time_ms);
324 
325 #ifdef HAL_EINT_FEATURE_SW_TRIGGER_EINT
326 
336 hal_eint_status_t hal_eint_set_software_trigger(hal_eint_number_t eint_number);
337 
338 
349 hal_eint_status_t hal_eint_clear_software_trigger(hal_eint_number_t eint_number);
350 #endif
351 
352 #ifdef HAL_EINT_FEATURE_MASK
353 
361 hal_eint_status_t hal_eint_mask(hal_eint_number_t eint_number);
362 
363 
372 hal_eint_status_t hal_eint_unmask(hal_eint_number_t eint_number);
373 #endif
374 
375 
376 #ifdef __cplusplus
377 }
378 #endif
379 
380 
386 #endif /*HAL_EINT_MODULE_ENABLED*/
387 #endif /* __HAL_EINT_H__ */
388 
389 
EINT error number.
Definition: hal_eint.h:207
Level and low trigger.
Definition: hal_eint.h:197
hal_eint_trigger_mode_t
This emun defines the EINT trigger mode.
Definition: hal_eint.h:196
Edge and falling trigger.
Definition: hal_eint.h:199
void(* hal_eint_callback_t)(void *user_data)
This defines the callback function prototype.
Definition: hal_eint.h:243
hal_eint_trigger_mode_t trigger_mode
EINT trigger mode.
Definition: hal_eint.h:225
hal_eint_number_t
eint pin number
Definition: hal_platform.h:583
Edge and rising trigger.
Definition: hal_eint.h:200
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:208
uint32_t debounce_time
EINT hardware debounce time in milliseconds.
Definition: hal_eint.h:226
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:224
EINT operation completed successfully.
Definition: hal_eint.h:210
hal_eint_status_t
This enum define the API return type.
Definition: hal_eint.h:206
EINT undefined error.
Definition: hal_eint.h:209
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:198
Edge and falling or rising trigger.
Definition: hal_eint.h:201
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.