Azure Sphere MT3620 M4 API Reference Manual
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Function

This section provides Fixed APIs(defined as Common Interface) to fully control the MediaTek GPIOIF HW. More...

Overview

This section provides Fixed APIs(defined as Common Interface) to fully control the MediaTek GPIOIF HW.

Functions

int mtk_mhal_gpioif_select_clock_source (struct mtk_gpioif_controller *ctlr)
 This function is used to select the GPIOIF clock source. More...
 
int mtk_mhal_gpioif_event_counter_setting (struct mtk_gpioif_controller *ctlr)
 This function is used to set event counter mode setting. More...
 
int mtk_mhal_gpioif_capture_counter_setting (struct mtk_gpioif_controller *ctlr)
 This function is used to set capture mode counter setting. More...
 
int mtk_mhal_gpioif_enable_event_counter (struct mtk_gpioif_controller *ctlr)
 This function is used to enable event counter mode. More...
 
int mtk_mhal_gpioif_disable_event_counter (struct mtk_gpioif_controller *ctlr)
 This function is used to disable event counter mode. More...
 
int mtk_mhal_gpioif_enable_capture_counter (struct mtk_gpioif_controller *ctlr)
 This function is used to enable capture counter mode. More...
 
int mtk_mhal_gpioif_disable_capture_counter (struct mtk_gpioif_controller *ctlr)
 This function is used to disable capture counter mode. More...
 
int mtk_mhal_gpioif_software_reset (struct mtk_gpioif_controller *ctlr)
 This function is used to perform software reset of the GPIO event counter. More...
 
int mtk_mhal_gpioif_interrupt_bit_wise (struct mtk_gpioif_controller *ctlr, u32 bit, u8 enable)
 This function is used to enable/disable bit-wise interrupt. More...
 
int mtk_mhal_gpioif_hardware_reset_by_gpio_2 (struct mtk_gpioif_controller *ctlr, int active_reset)
 This function uses GPIO_2 pin to reset GPIOIF event counter. More...
 
int mtk_mhal_gpioif_read_gpio_event_count (struct mtk_gpioif_controller *ctlr, unsigned int *pvalue)
 This function is used to read the GPIO event counter value. More...
 
int mtk_mhal_gpioif_read_gpio_cap_fifo0_value (struct mtk_gpioif_controller *ctlr, unsigned int *pvalue)
 This function is used to read the GPIO capture fifo0 counter. More...
 
int mtk_mhal_gpioif_read_gpio_cap_fifo1_value (struct mtk_gpioif_controller *ctlr, unsigned int *pvalue)
 This function is used to read the GPIO capture fifo1 counter. More...
 
int mtk_mhal_gpioif_de_glitch (struct mtk_gpioif_controller *ctlr, int gpio, int enable, unsigned int min_p, unsigned int init_v)
 This function is used to set GPIOIF de-glitch setting. More...
 
int mtk_mhal_gpioif_limit_comparator (struct mtk_gpioif_controller *ctlr)
 This function is used to set interrupt mode or saturation mode of the GPIO event counter. More...
 
int mtk_mhal_gpioif_global_reset (struct mtk_gpioif_controller *ctlr)
 This function is used to reset all GPIOIF group globally and make the register of the GPIOIF group to default value. More...
 
int mtk_mhal_gpioif_counter_clock_setting (struct mtk_gpioif_controller *ctlr, int enable)
 This function is used to enable/disable GPIOIF source clock. More...
 
int mtk_mhal_gpioif_isr_handle (struct mtk_gpioif_controller *ctlr)
 This function is used to handle GPIOIF group0~5 interrupt. More...
 
int mtk_mhal_gpioif_read_reset_val (struct mtk_gpioif_controller *ctlr, unsigned int *pvalue)
 This function is used to read reset value of GPIOIF Event Counter. More...
 
int mtk_mhal_gpioif_read_low_limit_val (struct mtk_gpioif_controller *ctlr, unsigned int *pvalue)
 This function is used to read low limit value of GPIOIF Event Counter. More...
 
int mtk_mhal_gpioif_read_high_limit_val (struct mtk_gpioif_controller *ctlr, unsigned int *pvalue)
 This function is used to read high limit value of GPIOIF Event Counter. More...
 

Function Documentation

int mtk_mhal_gpioif_select_clock_source ( struct mtk_gpioif_controller ctlr)

This function is used to select the GPIOIF clock source.

Usage: OS-HAL driver should call it to select the GPIOIF clock source.

Parameters
[in]ctlr: GPIOIF controller used with the device.
Example
See How to Use This Driver to use this function.
Returns
To indicate whether this function call is successful or not.
If the return value is -GPIOIF_EINVAL, it means that a wrong parameter is given, and the parameter must be verified.
If the return value is 0, it means success.
int mtk_mhal_gpioif_event_counter_setting ( struct mtk_gpioif_controller ctlr)

This function is used to set event counter mode setting.

Usage: OS-HAL driver should call it to set event counter mode setting.

Parameters
[in]ctlr: GPIOIF controller used with the device
Example
See How to Use This Driver to use this function.
Returns
To indicate whether this function call is successful or not.
If the return value is -GPIOIF_EINVAL, it means that a wrong parameter is given, and the parameter must be verified.
If the return value is 0, it means success.
int mtk_mhal_gpioif_capture_counter_setting ( struct mtk_gpioif_controller ctlr)

This function is used to set capture mode counter setting.

Usage: OS-HAL driver should call it to set capture mode counter setting.

Parameters
[in]ctlr: GPIOIF controller used with the device
Example
See How to Use This Driver to use this function.
Returns
To indicate whether this function call is successful or not.
If the return value is -GPIOIF_EINVAL, it means that a wrong parameter is given, and the parameter must be verified.
If the return value is 0, it means success.
int mtk_mhal_gpioif_enable_event_counter ( struct mtk_gpioif_controller ctlr)

This function is used to enable event counter mode.

Usage: OS-HAL driver should call it to enable event counter mode.

Parameters
[in]ctlr: GPIOIF controller used with the device
Example
See How to Use This Driver to use this function.
Returns
To indicate whether this function call is successful or not.
If the return value is -GPIOIF_EINVAL, it means that a wrong parameter is given, and the parameter must be verified.
If the return value is 0, it means success.
int mtk_mhal_gpioif_disable_event_counter ( struct mtk_gpioif_controller ctlr)

This function is used to disable event counter mode.

Usage: OS-HAL driver should call it to disable event counter mode.

Parameters
[in]ctlr: GPIOIF controller used with the device
Example
See How to Use This Driver to use this function.
Returns
To indicate whether this function call is successful or not.
If the return value is -GPIOIF_EINVAL, it means that a wrong parameter is given, and the parameter must be verified.
If the return value is 0, it means success.
int mtk_mhal_gpioif_enable_capture_counter ( struct mtk_gpioif_controller ctlr)

This function is used to enable capture counter mode.

Usage: OS-HAL driver should call it to enable capture counter mode.

Parameters
[in]ctlr: GPIOIF controller used with the device
Returns
To indicate whether this function call is successful or not.
If the return value is -GPIOIF_EINVAL, it means that a wrong parameter is given, and the parameter must be verified.
If the return value is 0, it means success.
int mtk_mhal_gpioif_disable_capture_counter ( struct mtk_gpioif_controller ctlr)

This function is used to disable capture counter mode.

Usage: OS-HAL driver should call it to disable capture counter mode.

Parameters
[in]ctlr: GPIOIF controller used with the device
Returns
To indicate whether this function call is successful or not.
If the return value is -GPIOIF_EINVAL, it means that a wrong parameter is given, and the parameter must be verified.
If the return value is 0, it means success.
int mtk_mhal_gpioif_software_reset ( struct mtk_gpioif_controller ctlr)

This function is used to perform software reset of the GPIO event counter.

Usage: OS-HAL driver should call it to perform software reset of the GPIO event counter.

Parameters
[in]ctlr: GPIOIF controller used with the device
Example
See How to Use This Driver to use this function.
Returns
To indicate whether this function call is successful or not.
If the return value is -GPIOIF_EINVAL, it means that a wrong parameter is given, and the parameter must be verified.
If the return value is 0, it means success.
int mtk_mhal_gpioif_interrupt_bit_wise ( struct mtk_gpioif_controller ctlr,
u32  bit,
u8  enable 
)

This function is used to enable/disable bit-wise interrupt.

Usage: OS-HAL driver should call it to enable/disable interrupt by bit-wise.

Parameters
[in]ctlr: GPIOIF controller used with the device
[in]bit: Different bit , different interrupt case
[in]enable: 0:No interrupt is issued when interrupt status is asserted; 1:Interrupt is issued when interrupt status is asserted.
Example
See How to Use This Driver to use this function.
Returns
To indicate whether this function call is successful or not.
If the return value is -GPIOIF_EINVAL, it means that a wrong parameter is given, and the parameter must be verified.
If the return value is 0, it means success.
int mtk_mhal_gpioif_hardware_reset_by_gpio_2 ( struct mtk_gpioif_controller ctlr,
int  active_reset 
)

This function uses GPIO_2 pin to reset GPIOIF event counter.

Usage: OS-HAL driver should call it to enable hardware reset of GPIOIF event counter.

Parameters
[in]ctlr: GPIOIF controller used with the device
[in]active_reset: 0: low; 1: high.
Example
See How to Use This Driver to use this function.
Returns
To indicate whether this function call is successful or not.
If the return value is -GPIOIF_EINVAL, it means that a wrong parameter is given, and the parameter must be verified.
If the return value is 0, it means success.
int mtk_mhal_gpioif_read_gpio_event_count ( struct mtk_gpioif_controller ctlr,
unsigned int *  pvalue 
)

This function is used to read the GPIO event counter value.

Usage: OS-HAL driver should call it to read the GPIO event counter.

Parameters
[in]ctlr: GPIOIF controller used with the device
[out]pvalue: Read GPIO event counter value and save it to address pvalue
Example
See How to Use This Driver to use this function.
Returns
To indicate whether this function call is successful or not.
If the return value is -GPIOIF_EINVAL, it means that a wrong parameter is given, and the parameter must be verified.
If the return value is 0, it means success.
int mtk_mhal_gpioif_read_gpio_cap_fifo0_value ( struct mtk_gpioif_controller ctlr,
unsigned int *  pvalue 
)

This function is used to read the GPIO capture fifo0 counter.

Parameters
[in]ctlr: GPIOIF controller used with the device
[out]pvalue: Read register value and save it to address pvalue
Example
See How to Use This Driver to use this function.
Returns
To indicate whether this function call is successful or not.
If the return value is -GPIOIF_EINVAL, it means that a wrong parameter is given, and the parameter must be verified.
If the return value is 0, it means success.
int mtk_mhal_gpioif_read_gpio_cap_fifo1_value ( struct mtk_gpioif_controller ctlr,
unsigned int *  pvalue 
)

This function is used to read the GPIO capture fifo1 counter.

Usage: OS-HAL driver should call it to read the capture fifo1 counter in the capture function mode.

Parameters
[in]ctlr: GPIOIF controller used with the device
[out]pvalue: Read register value and save it to address pvalue
Example
See How to Use This Driver to use this function.
Returns
To indicate whether this function call is successful or not.
If the return value is -GPIOIF_EINVAL, it means that a wrong parameter is given, and the parameter must be verified.
If the return value is 0, it means success.
int mtk_mhal_gpioif_de_glitch ( struct mtk_gpioif_controller ctlr,
int  gpio,
int  enable,
unsigned int  min_p,
unsigned int  init_v 
)

This function is used to set GPIOIF de-glitch setting.

Usage: OS-HAL driver should call it to add GPIOIF de-glitch setting.

Parameters
[in]ctlr: GPIOIF controller used with the device
[in]gpio: GPIO number(0~2)
[in]enable: 0: disable; 1: enable.
[in]min_p: Minimum pulse width of the GPIOIF de-glitch circuit(0~16383)
[in]init_v: Initial output value of the GPIOIF de-glitch circuit(0 or 1)
Returns
To indicate whether this function call is successful or not.
If the return value is -GPIOIF_EINVAL, it means that a wrong parameter is given, and the parameter must be verified.
If the return value is 0, it means success.
int mtk_mhal_gpioif_limit_comparator ( struct mtk_gpioif_controller ctlr)

This function is used to set interrupt mode or saturation mode of the GPIO event counter.

Usage: OS-HAL driver should call it in GPIO event counter to set different interrupt mode or saturation mode.

Parameters
[in]ctlr: GPIOIF controller used with the device
Returns
To indicate whether this function call is successful or not.
If the return value is -GPIOIF_EINVAL, it means that a wrong parameter is given, and the parameter must be verified.
If the return value is 0, it means success.
int mtk_mhal_gpioif_global_reset ( struct mtk_gpioif_controller ctlr)

This function is used to reset all GPIOIF group globally and make the register of the GPIOIF group to default value.

Usage: OS-HAL driver should call it to enable GPIOIF global software reset.

Parameters
[in]ctlr: GPIOIF controller used with the device
Returns
To indicate whether this function call is successful or not.
If the return value is -GPIOIF_EINVAL, it means that a wrong parameter is given, and the parameter must be verified.
If the return value is 0, it means success.
int mtk_mhal_gpioif_counter_clock_setting ( struct mtk_gpioif_controller ctlr,
int  enable 
)

This function is used to enable/disable GPIOIF source clock.

Usage: OS-HAL driver should call it to enable/disable GPIOIF counter clock source.

Parameters
[in]ctlr: GPIOIF controller used with the device
[in]enable: clock is enable or not(0:disable; 1:enable).
Example
See How to Use This Driver to use this function.
Returns
To indicate whether this function call is successful or not.
If the return value is -GPIOIF_EINVAL, it means that a wrong parameter is given, and the parameter must be verified.
If the return value is 0, it means success.
int mtk_mhal_gpioif_isr_handle ( struct mtk_gpioif_controller ctlr)

This function is used to handle GPIOIF group0~5 interrupt.

Usage: OS-HAL driver should call it to handle GPIOIF group0~5 interrupt.

Parameters
[in]ctlr: GPIOIF controller used with the device
Returns
To indicate whether this function call is successful or not.
If the return value is -GPIOIF_EINVAL, it means that a wrong parameter is given, and the parameter must be verified.
If the return value is 0, it means success.
int mtk_mhal_gpioif_read_reset_val ( struct mtk_gpioif_controller ctlr,
unsigned int *  pvalue 
)

This function is used to read reset value of GPIOIF Event Counter.

Parameters
[in]ctlr: GPIOIF controller used with the device
[out]pvalue: Read register value and save it to address pvalue
Example
See How to Use This Driver to use this function.
Returns
To indicate whether this function call is successful or not.
If the return value is -GPIOIF_EINVAL, it means that a wrong parameter is given, and the parameter must be verified.
If the return value is 0, it means success.
int mtk_mhal_gpioif_read_low_limit_val ( struct mtk_gpioif_controller ctlr,
unsigned int *  pvalue 
)

This function is used to read low limit value of GPIOIF Event Counter.

Parameters
[in]ctlr: GPIOIF controller used with the device
[out]pvalue: Read register value and save it to address pvalue
Example
See How to Use This Driver to use this function.
Returns
To indicate whether this function call is successful or not.
If the return value is -GPIOIF_EINVAL, it means that a wrong parameter is given, and the parameter must be verified.
If the return value is 0, it means success.
int mtk_mhal_gpioif_read_high_limit_val ( struct mtk_gpioif_controller ctlr,
unsigned int *  pvalue 
)

This function is used to read high limit value of GPIOIF Event Counter.

Parameters
[in]ctlr: GPIOIF controller used with the device
[out]pvalue: Read register value and save it to address pvalue
Example
See How to Use This Driver to use this function.
Returns
To indicate whether this function call is successful or not.
If the return value is -GPIOIF_EINVAL, it means that a wrong parameter is given, and the parameter must be verified.
If the return value is 0, it means success.