MT7687 API Reference  LinkIt SDK v4
hal_gpio.h
1 /* Copyright Statement:
2  *
3  * (C) 2005-2017 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_GPIO_H__
36 #define __HAL_GPIO_H__
37 #include "hal_platform.h"
38 #include "hal_pinmux_define.h"
39 
40 #ifdef HAL_GPIO_MODULE_ENABLED
41 
84 #ifdef HAL_GPIO_FEATURE_PUPD
85 
96 #endif
97 
98 
99 #ifdef HAL_GPIO_FEATURE_INVERSE
100 
111 #endif
112 
113 
114 #ifdef HAL_GPIO_FEATURE_CLOCKOUT
115 
127 #endif
128 
129 
201 #ifdef __cplusplus
202 extern "C" {
203 #endif
204 
210 typedef enum {
214 
215 
217 typedef enum {
221 
222 
224 typedef enum {
230 
231 
233 typedef enum {
239 
240 #ifdef HAL_GPIO_FEATURE_SET_DRIVING
241 
242 typedef enum {
243  HAL_GPIO_DRIVING_CURRENT_4MA = 0,
244  HAL_GPIO_DRIVING_CURRENT_8MA = 1,
245  HAL_GPIO_DRIVING_CURRENT_12MA = 2,
246  HAL_GPIO_DRIVING_CURRENT_16MA = 3
247 } hal_gpio_driving_current_t;
248 #endif
249 
267 
268 
280 
281 
297 hal_pinmux_status_t hal_pinmux_set_function(hal_gpio_pin_t gpio_pin, uint8_t function_index);
298 
299 
313 
314 
328 
329 
343 
344 
358 
359 
373 
374 
375 #ifdef HAL_GPIO_FEATURE_HIGH_Z
376 
389 hal_gpio_status_t hal_gpio_set_high_impedance(hal_gpio_pin_t gpio_pin);
390 
415 hal_gpio_status_t hal_gpio_clear_high_impedance(hal_gpio_pin_t gpio_pin);
416 #endif
417 
418 
443 
444 
445 #ifdef HAL_GPIO_FEATURE_INVERSE
446 
467 hal_gpio_status_t hal_gpio_enable_inversion(hal_gpio_pin_t gpio_pin);
468 
469 
490 hal_gpio_status_t hal_gpio_disable_inversion(hal_gpio_pin_t gpio_pin);
491 #endif
492 
493 
518 
519 
544 
545 
570 
571 
572 #ifdef HAL_GPIO_FEATURE_PUPD
573 
597 hal_gpio_status_t hal_gpio_set_pupd_register(hal_gpio_pin_t gpio_pin, uint8_t gpio_pupd, uint8_t gpio_r0, uint8_t gpio_r1);
598 #endif
599 
600 
601 #ifdef HAL_GPIO_FEATURE_CLOCKOUT
602 
626 hal_gpio_status_t hal_gpio_set_clockout(hal_gpio_clock_t gpio_clock_num, hal_gpio_clock_mode_t clock_mode);
627 #endif
628 
629 
630 #ifdef HAL_GPIO_FEATURE_SET_DRIVING
631 
650 hal_gpio_status_t hal_gpio_set_driving_current(hal_gpio_pin_t gpio_pin, hal_gpio_driving_current_t driving);
651 
672 hal_gpio_status_t hal_gpio_get_driving_current(hal_gpio_pin_t gpio_pin, hal_gpio_driving_current_t *driving);
673 #endif
674 
675 
676 
677 #ifdef __cplusplus
678 }
679 #endif
680 
681 
686 #endif /*HAL_GPIO_MODULE_ENABLED*/
687 #endif /* __HAL_GPIO_H__ */
688 
hal_gpio_status_t hal_gpio_set_output(hal_gpio_pin_t gpio_pin, hal_gpio_data_t gpio_data)
This function sets the output data of the target GPIO.
hal_gpio_status_t hal_gpio_init(hal_gpio_pin_t gpio_pin)
This function initializes the GPIO hardware with basic functionality.
hal_gpio_status_t hal_gpio_disable_pull(hal_gpio_pin_t gpio_pin)
This function disables pull-up or pull-down of the target GPIO.
hal_gpio_status_t hal_gpio_pull_down(hal_gpio_pin_t gpio_pin)
This function sets the target GPIO to the pull-down state, after this function, the input data of the...
hal_gpio_status_t hal_gpio_get_direction(hal_gpio_pin_t gpio_pin, hal_gpio_direction_t *gpio_direction)
This function gets the direction of the target GPIO.
hal_gpio_direction_t
This enum defines the GPIO direction.
Definition: hal_gpio.h:210
Invalid input pin port.
Definition: hal_gpio.h:235
hal_gpio_status_t hal_gpio_pull_up(hal_gpio_pin_t gpio_pin)
This function sets the target GPIO to pull-up state, after this function, the input data of the targe...
GPIO output direction.
Definition: hal_gpio.h:212
The pinmux function failed to execute.
Definition: hal_gpio.h:234
The GPIO function executed successfully.
Definition: hal_gpio.h:228
hal_gpio_status_t hal_gpio_set_direction(hal_gpio_pin_t gpio_pin, hal_gpio_direction_t gpio_direction)
This function sets the direction of the target GPIO.
The GPIO function failed to execute.
Definition: hal_gpio.h:225
hal_gpio_pin_t
This enum define the gpio port.
Definition: hal_platform.h:241
hal_gpio_status_t hal_gpio_toggle_pin(hal_gpio_pin_t gpio_pin)
This function toggles the output data of the target GPIO when the direction of the pin is output...
hal_pinmux_status_t hal_pinmux_set_function(hal_gpio_pin_t gpio_pin, uint8_t function_index)
This function configures the pinmux of target GPIO.
GPIO data high.
Definition: hal_gpio.h:219
Invalid input pin number.
Definition: hal_gpio.h:226
The pinmux function executed successfully.
Definition: hal_gpio.h:237
hal_gpio_data_t
This enum defines the data type of GPIO.
Definition: hal_gpio.h:217
hal_pinmux_status_t
This enum defines the return type of pinmux API.
Definition: hal_gpio.h:233
hal_gpio_status_t hal_gpio_deinit(hal_gpio_pin_t gpio_pin)
This function deinitializes the GPIO hardware to its default status.
Invalid input function.
Definition: hal_gpio.h:236
Invalid input parameter.
Definition: hal_gpio.h:227
hal_gpio_status_t hal_gpio_get_input(hal_gpio_pin_t gpio_pin, hal_gpio_data_t *gpio_data)
This function gets the input data of target GPIO when the direction of the GPIO is input...
GPIO input direction.
Definition: hal_gpio.h:211
hal_gpio_status_t
This enum defines the return type of GPIO API.
Definition: hal_gpio.h:224
GPIO data low.
Definition: hal_gpio.h:218
hal_gpio_status_t hal_gpio_get_output(hal_gpio_pin_t gpio_pin, hal_gpio_data_t *gpio_data)
This function gets the output data of the target GPIO when the direction of the GPIO is output...