system:qnx
1. how to use
msmgpiotool
usage: msmgpiotool <command> <gpio> <arg>
Provides a mechanism to easily view and reconfigure TLMM GPIOs on the command line.
commands:
dump
info <gpio number>
write <gpio number> <value>
read <gpio>
rawread <gpio>
set-dir <gpio number> <value>
set-drive <gpio number> <value>
set-pull <gpio number> <value>
set-func <gpio number> <value>
enable-irq <gpio number> <value>
clear-irq <gpio>
set-pol <gpio number> <value>
set-trigger <gpio number> <value>
Description:
dump prints the entire GPIO configuration table
info prints the configuration for the specified gpio
set-dir sets the direction when in gpio mode
[0] Input, [1] Output
set-drive sets the pin drive strength regardless of mode
drive strength = [n] * 2mA for n[0..15]
set-pull sets internal pull on the pin regardless of mode
[0] No pull [1] Pull Down [2] Keeper [3] Pull Up
set-func sets the pin function. Set to 0 for GPIO mode
valid for n[0..15]
enable-irq configures the pin as a gpio interrupt source
[0] Enable [1] Disable
clear-irq clears the pending IRQ status
set-pol sets the interrupt polarity of the gpio
[0] Inverted [1] Normal
set-trigger sets the irq trigger type
[0] Level [1] Edge
2. read gpio interrupt
# tlmm_gpio_interrupt_test
usage is : tlmm_gpio_interrupt_test <gpio_number> <trigger>
Acceptable trigger values are as follows
trigger = (GPIO_INTERRUPT_TRIGGER_DISABLE) 0
trigger = (GPIO_INTERRUPT_TRIGGER_HIGH) 1
trigger = (GPIO_INTERRUPT_TRIGGER_LOW) 2
trigger = (GPIO_INTERRUPT_TRIGGER_RISING) 3
trigger = (GPIO_INTERRUPT_TRIGGER_FALLING) 4
trigger = (GPIO_INTERRUPT_TRIGGER_DUAL) 5
etc: read gpio number 110 interrupt
# tlmm_gpio_interrupt_test 110 4
Enter Test
GPIO 110 trigger 4
irq corresponding to gpio 110 is 790 status 0
Wakeup setup successfully completed and now wait for interrupt
Got GPIO110 interrupt
Got GPIO110 interrupt
Got GPIO110 interrupt
Got GPIO110 interrupt
Got GPIO110 interrupt
3. pull up gpio
msmgpiotool write 89 1
Wrote GPIO 89 to 1
#
# msmgpiotool info 89
OFFSET GPIO IN OUT DIR DRIVE PULL ALT FUNCTION TARGET IRQ POL TRIG STS
---------------------------------------------------------------------------------------------
f15b000 89 High High Out 2 mA Pull up 0 NONE 0 1 Level 0
#
4.read gpio status
msmgpiotool read 89