![]() |
m2mb API docs
37.00.006.0
m2mb API sets documentation
|
GPIO library implementation. More...
Go to the source code of this file.
Macros | |
#define | NULL 0 |
#define | M2MB_GPIO_ISR_IS_ENABLED 1 |
ME910 products have 10 GPIOs. | |
#define | M2MB_GPIO_ISR_IS_DISABLED 0 |
#define | m2mb_gpio_multi_ioctl_(fd, args...) m2mb_gpio_multi_ioctl( fd, CMDS_ARGS( args ) ) |
Typedefs | |
typedef void(* | m2mb_gpio_intr_callback) (UINT32 fd, void *userdata) |
GPIO interrupt callback function definition. More... | |
Functions | |
INT32 | m2mb_gpio_open (const CHAR *path, INT32 flags,...) |
open a GPIO device More... | |
INT32 | m2mb_gpio_close (INT32 fd) |
close a GPIO device More... | |
INT32 | m2mb_gpio_ioctl (INT32 fd, INT32 cmd, UINT32 arg) |
configure a GPIO device More... | |
INT32 | m2mb_gpio_multi_ioctl (INT32 fd, UINT8 nCmds,...) |
: multiple configuration of a GPIO device. More... | |
INT32 | m2mb_gpio_read (INT32 fd, M2MB_GPIO_VALUE_E *value) |
Reads the state of a GPIO pin. More... | |
INT32 | m2mb_gpio_write (INT32 fd, M2MB_GPIO_VALUE_E value) |
write the value of a GPIO device More... | |
GPIO library implementation.
m2m_generic/common/m2mb_inc/m2mb_gpio.h
The following functions are implemented: m2mb_gpio_ioctl m2mb_gpio_multi_ioctl m2mb_gpio_open m2mb_gpio_read m2mb_gpio_write m2mb_gpio_close
@notes Dependencies: m2mb_types.h
@changes Dino Apostoli, Alessandro Papagno, Mathan Babu
typedef void( * m2mb_gpio_intr_callback) (UINT32 fd, void *userdata) |
GPIO interrupt callback function definition.
GPIO interrupt clients will pass a function pointer of this format in M2MB_GPIO_CFG_T callback function
enum M2M_GPIO_INTR_TYPE_E |
GPIO ISR type: callback or counter.
enum M2MB_GPIO_DRIVE_E |
enum M2MB_GPIO_TRIGGER_E |
enum M2MB_GPIO_VALUE_E |
INT32 m2mb_gpio_close | ( | INT32 | fd | ) |
close a GPIO device
This function close a GPIO device
[in] | fd | file descriptor returned by m2mb_gpio_open |
INT32 m2mb_gpio_ioctl | ( | INT32 | fd, |
INT32 | cmd, | ||
UINT32 | arg | ||
) |
configure a GPIO device
This function configure a GPIO using the M2MB_GPIO_IOCTL_REQUEST_E enum
[in] | fd | file descriptor returned by m2mb_gpio_open |
[in] | cmd | required operation (see M2MB_GPIO_IOCTL_REQUEST_E) |
[in] | arg | pointer to the value to set |
Example
INT32 m2mb_gpio_multi_ioctl | ( | INT32 | fd, |
UINT8 | nCmds, | ||
... | |||
) |
: multiple configuration of a GPIO device.
allow a multiple configuration of a GPIO device. Can not be used in order to get data. In order to use interrupts it is mandatory to initialize the interrupt with M2MB_GPIO_IOCTL_INIT_INTR
[in] | fd | file descriptor returned by m2mb_gpio_open |
[in] | nCmds | number of commands to be issued at once |
[in] | ... | variable inputs, N cmds (see M2MB_GPIO_IOCTL_REQUEST_E) followed by N arguments for their respective issued commands. CMDS(...) and CMDS_ARGS(...) macro can be used to better insert cmd and parameters and to better control right insertion |
Example
INT32 m2mb_gpio_open | ( | const CHAR * | path, |
INT32 | flags, | ||
... | |||
) |
open a GPIO device
This function open a GPIO device
[in] | path | the path has a string of this type: /dev/GPIO# where # is in decimal format |
[in] | flags | currently unused |
Example
INT32 m2mb_gpio_read | ( | INT32 | fd, |
M2MB_GPIO_VALUE_E * | value | ||
) |
Reads the state of a GPIO pin.
Reads the state of a GPIO pin, used only for M2MB_GPIO_MODE_INPUT
[in] | fd | file descriptor returned by m2mb_gpio_open |
[out] | value | get the M2MB_GPIO_VALUE_E LOW or HIGH |
Example
INT32 m2mb_gpio_write | ( | INT32 | fd, |
M2MB_GPIO_VALUE_E | value | ||
) |
write the value of a GPIO device
write the value high or low to a GPIO device, used only for M2MB_GPIO_MODE_OUTPUT
[in] | fd | file descriptor returned by m2mb_gpio_open |
[in] | value | set high or low |