Files
kunlun/inc/driver/iot_gpio.h
2024-09-28 14:24:04 +08:00

63 lines
2.3 KiB
C

/****************************************************************************
Copyright(c) 2019 by Aerospace C.Power (Chongqing) Microelectronics. ALL RIGHTS RESERVED.
This Information is proprietary to Aerospace C.Power (Chongqing) Microelectronics and MAY NOT
be copied by any method or incorporated into another program without
the express written consent of Aerospace C.Power. This Information or any portion
thereof remains the property of Aerospace C.Power. The Information contained herein
is believed to be accurate and Aerospace C.Power assumes no responsibility or
liability for its use in any way and conveys no license or title under
any patent or copyright and makes no representation or warranty that this
Information is free from patent or copyright infringement.
****************************************************************************/
/*
* Notice :
* This iot_xxx.h file, belongs to HAL level. iot_xxx_api.h is a part of this.
* The bellows are ready for HW & HAL/CVG/MAC level, limited for APP level.
*/
#ifndef __IOT_GPIO_H__
#define __IOT_GPIO_H__
#include "iot_gpio_api.h"
enum gpio_int_isr_mode
{
/* ISR runs in interrupt enviroment */
GPIO_INT_ISR,
/* ISR runs in task enviroment */
GPIO_INT_ISR_TASK,
/* ISR runs in interrupt enviroment and interrupt disabled before ISR. */
GPIO_INT_ISR_AUTO_STOP,
/* ISR runs in task enviroment and interrupt disabled before ISR. */
GPIO_INT_ISR_TASK_AUTO_STOP,
/* Invalid value */
GPIO_INT_ISR_INVALID
};
/*
* @brief iot_gpio_get_inner_gpio_num() - Get count of GPIOs on chip.
* @return : The count of GPIOs.
*/
int iot_gpio_get_inner_gpio_num(void);
/**
* @brief iot_gpio_interrupt_config_detail() - This function should be called
* after iot_gpio_open_as_interrupt() to configure an interrupt.
* @param gpio: GPIO-NO that starts from 'Zero'.
* @param mode: Interrupt trigger mode.@see enum int_trigger_mode.
* @param isr: Interrupt call-back function. It's a function pionter
* like int (*isr)(int).
* @param arg: Argument for isr.
* @param isr_mode: Interrupt mode when interrupt occurs.
* See enum gpio_int_isr_mode.
* @return ERR_FAIL -- Operation failed.
* @return ERR_OK -- Operation Successful.
*/
int iot_gpio_interrupt_config_detail(int gpio,
enum gpio_int_trigger_mode mode,
iot_gpio_isr_func isr, int arg, int isr_mode);
#endif