TX2 library for UART, PWM and GPIO?

It there any available library resource for TX2 application of UART, PWM and GPIO? Something like Beaglebone black and Raspberry PI, they all have factory library which can be directly used to save time for development.
Please let me know if there’s any. Thanks in advance!!

hello kaosun,

please refer to Development Guide, and Tegra Linux Driver Package TX2 Adaptation Guide
thanks

Checked both guides but nothing helps. Thanks anyway!

hello kaosun,

may I know what’s your usage.
could you please have some examples or please have a brief descriptions of your expect results.
thanks

For example, if I’d like to read a GPS module by ttyTHS2 and output PWM signal to drive a DC motor. It’s kind of embedded system application. On Beaglebonoe or Raspberry Pi, ther’re already libraries like UART, GPIO, ADC, I2C.h for easier programming. Is there any libraries for TX2? THX!

hello kaosun,

please refer to below gpio functions at /kernel_src/kernel/kernel-4.4/include/asm-generic/gpio.h

static inline int __gpio_get_value(unsigned gpio)
{
        return gpiod_get_raw_value(gpio_to_desc(gpio));
}
static inline void __gpio_set_value(unsigned gpio, int value)
{
        return gpiod_set_raw_value(gpio_to_desc(gpio), value);
}

you may also check kernel drivers for reference,
for example, /kernel_src/kernel/kernel-4.4/drivers/media/i2c/imx274.c

If you are in user space, then the UARTs are just files to open and read from or write to. For example:
[url]Serial Programming Guide for POSIX Operating Systems

Do note that a user needs to be in group “dialout” to access this. Otherwise, “sudo” would have to be used to run this. If your GPS module is configured to know about “/dev/ttyTHS2”, then it will already use this port the same way as the above URL does and won’t need anything special. I suppose an OOP wrapper might be used if C++.