7 gpio management apis, 1 m1x66_getgpioconfig, 2 m1x66_setgpioconfig – Maxim Integrated 73M1866B/73M1966B FXOAPI User Manual
Page 22: Gpio management apis, M1x66_getgpioconfig, M1x66_setgpioconfig

73M1866B/73M1966B FXOAPI User Guide
UG_1x66B_046
22
Rev. 2.1
2.7 GPIO Management APIs
2.7.1 M1x66_GetGpioConfig
Description
This is an API for reading the configuration of a GPIO. If reading is successful the driver returns the
direction and the polarity of the GPIO parameter.
Prototype
M1x66_RET M1x66_GetGpioConfig (M1x66_HANDLE chanHandle,
M1966_GPIO_NUMBER gpio,
M1966_GPIO_SIGNAL_DIR *direction,
M1966_GPIO_INTR_POLARITY *polarity)
Parameters
Data Type
Name
Description
chanHandle
Channel handle from FXO open channel.
M1966_GPIO_NUMBER
gpio
GPIO number
M1966_GPIO_SIGNAL_DIR
*direction
Points to direction variable (output)
M1966_GPIO_INTR_POLARITY *polarity
Points to polarity variable (output)
Return Values
Data Type
Description
M1x66_SUCCESS – Successful.
M1x66_FAILED – Failure.
2.7.2 M1x66_SetGpioConfig
Description
This API configures the selected GPIO per “direction” and “polarity” selected. Configuring the GPIO does
not activate it; the GPIO must be “enabled” using M1x66_GpioEnable.
When configured as input (direction), the GPIO signal transition can cause interrupt which in turn sends
an M1966_EVENT_GPIO_INTERRUPT event to the upper layer application. This depends on the interrupt
detection polarity. For example if the polarity is set for detection on the rising edge
(M1966_GPIO_POL_RISING), then interrupt will occur when the GPIO data pin signal transitions from
low to high, and vice-versa.
Prototype
M1x66_RET M1x66_SetGpioConfig (M1x66_HANDLE chanHandle,
M1966_GPIO_NUMBER gpio,
M1966_GPIO_SIGNAL_DIR direction,
M1966_GPIO_INTR_POLARITY polarity)
Parameters
Data Type
Name
Description
chanHandle
Channel handle from FXO open channel.
M1966_GPIO_NUMBER
gpio
GPIO number.
M1966_GPIO_SIGNAL_DIR
direction
GPIO signal direction.
M1966_GPIO_INTR_POLARITY polarity
GPIO interrupt edge transition polarity.