Private
Public Access
2
0
Commit Graph

1815 Commits

Author SHA1 Message Date
Thomas Ingleby
156fea550c up2: update docs to point to new wiki link
Signed-off-by: Thomas Ingleby <thomas.ingleby@intel.com>
2018-09-20 10:06:50 +02:00
Thomas Ingleby
3e7a468a8a README: update PPA instructions for mraa2
Signed-off-by: Thomas Ingleby <thomas.ingleby@intel.com>
2018-09-11 14:00:20 +02:00
Mihai Tudor Panu
967585c9ea mraa: Update to v2.0.0
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-09-06 05:34:41 -07:00
Manivannan Sadhasivam
b07633c38a 96boards: Add onboard LED support for Dragonboard410c
Add onboard LED support for Dragonboard410c. There are 4 user LEDs and
two LEDs for BT and WLAN.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2018-09-05 09:05:26 +05:30
Manivannan Sadhasivam
806c17f664 examples: c: led: Initialize LED based on index
Since the LEDs are initialized based on index, modify the USER_LED
to index 0.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2018-09-05 09:05:26 +05:30
Manivannan Sadhasivam
6fcd882d58 led: Add support for initializing onboard LEDs based on board definition
1. Add support for initializing onboard LEDs based on board definition.
Maximum LED count has been set to 12.

2. Introduce mraa_led_init_raw API for initializing LEDs based on
function name. This API can be used by platforms which doesn't have mapping
in board definition.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2018-09-05 09:05:26 +05:30
Manivannan Sadhasivam
6c0ec10ba1 96boards: Configure SPI0_CS pin as GPIO for Dragonboard410c
On Dragonboard410c, configure SPI0_CS pin as GPIO for enabling the
user to control it without adding chip select property in Devicetree.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2018-08-30 22:23:15 +05:30
Manivannan Sadhasivam
77d4676616 mraa: fix mraa_gpio_lookup function
1. Extend the lookup count to phy_pin_count to cover all physical pins
   exposed on the board
2. Ignore the non GPIO pins by checking for GPIO capability

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2018-08-15 08:53:04 +05:30
Noel Eck
d24457f9a1 ioinit: Update to build/test C++ ioinit
Multiple changes necessary to enable this.  The main goal is to build
and run the C++ ioinit unit tests (which require c++11)

    * Updated mraa required CMake version to 2.8.11 (this is needed for
      the target_xxx_xxx CMake syntax.
    * Added function for adding the c++11 flag give a CMake target.
    * Updated unit tests for range of CMake versions (tested on 2.8.11,
      3.8.2, 3.9.6, and 3.12.0).
    * Added C++ unit test file (more needed here).)

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-07-29 21:26:50 -07:00
Manivannan Sadhasivam
9056556b7a 96boards: Add Ultra-96 board support
This commit adds Ultra96, one of the Consumer Edition boards of the
96Boards family.

Ultra96 is an Arm-based, Xilinx Zynq UltraScale+ MPSoC development board.
This board runs petalinux distribution on the ARM core and integrates
Xilinx programmable logic (PL) UltraScale architecture in a single fabric.

This board supports standard peripherals defined by 96Boards CE
Specification. Since it ships with >4.8 kernel, only chardev mapping
is supported for accessing GPIO.

More information about this board can be found in 96Boards product
page: https://www.96boards.org/product/ultra96/

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2018-07-29 23:13:30 +05:30
Manivannan Sadhasivam
71b87904a0 96boards: Cleanup the board support
This commit cleans up the 96boards board support by sorting the boards
in alphabetical manner and also executing clang-format for 96boards.c

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
2018-07-29 23:13:30 +05:30
Noel Eck
9a44283a93 initio.c: Clean up memory from a failed init
Delete allocated space if the string init fails.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-07-23 22:00:27 -07:00
Noel Eck
b3c1c5ac3c initio.c: Re-applied clang-format for source
Ran clang-format to conform to mraa's coding guide.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-07-23 21:51:58 -07:00
Noel Eck
e772aec69d initio: Handle no-conversion case in mraa_atoi_x
If strtol fails to process any characters, return a failure.

Added protocol chunk string to each parse_xxx method for completeness
when printing to syslog.

Added more tests - passing and failing cases.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-07-23 21:40:45 -07:00
Noel Eck
6fe510a27f Peripheralman: Remove IIO from ioinit for android
Since peripheral manager does not build in the IIO source, ifdef's were
added around the initio functionality for IIO.

IMO this is an ugly fix, but I don't see a better way since the
PERIPHERALMAN architecture is qualified throughout the CMake and source
with ifdef's.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-07-23 21:40:45 -07:00
Noel Eck
4487c98b6f gtest: Organized Gtest unit tests
This commit limits which tests run on which ARCH to allow all tests to
pass on CI.

    * Qualify the FTDI tests with (FTDI4222 AND USBPLAT)
    * Qualify the IO init tests with (DETECTED_ARCH == "MOCK")
    * Renamed all unit tests to start with 'test_unit_' to facilitate
      grouping with tab completion (or any other type of sorting)
    * Updated docker targets with new unit test target name

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-07-23 21:40:45 -07:00
Mihai Stefanescu
ae391fe9fe String based IO initialization for MRAA
Signed-off-by: Mihai Stefanescu <mihai.stefanescu@rinftech.com>
Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-07-23 21:40:12 -07:00
netlhx
4b2279704b boards: add rock960 support
Signed-off-by: Hongxin Liu <761896148@qq.com>
2018-07-23 16:33:44 +05:30
Noel Eck
b90c0efcb8 gtest: Added headers to unit tests
Added missing headers for the common and platform extender unit test
source files.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-07-17 09:48:45 -07:00
Noel Eck
c563e4fb4d gpio.c: Handle subplatform interrupts
For all subplaform pins, save the subplatform index as dev->pin and the
actual platform index as dev->phy_pin.

Example:
    pin 515 (subplatform pin 3)
    dev->pin = 515
    dev->phy_pin = 515 - 512 = 3

In this way, methods which get a mraa_gpio_context have a means
to tell whether the pin is on a subplatform or not.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-07-01 20:51:02 -07:00
Noel Eck
fc4b2a554d Platform_extender: FT4222 library refactor
Updates to make the FT4222 platform extender more usable.

Previous implementation opened libft4222.so and loaded symbols as
needed.  This implementation removes dynamic loading of libft4222 in
favor of creating a new shared libary which links against libft4222.so.
The dynamic loading is now done in mraa.c.  One C method is exposed in
libmraa-platform-ft4222.so for finding/initializing an FT4222:

mraa_platform_t mraa_usb_platform_extender(mraa_board_t* board);

Mraa.c attempts to open this platform library and calls the
mraa_usb_platform_extender method.  If an ftdi4222 is connected, the
user gets added IO from the extender.  If no FT4222 device is connected,
continue as normal.

    * Create a new platform library for the FT4222
    * Expose only 1 C method from the library -
      mraa_usb_platform_extender
    * libmraa-platform-ft4222.so contains CXX code (as well as previous
      C code).  All *allocs have been removed in favor of global
      C++ stl containers.
    * Previously, the FT4222 would only initialize correctly if 2 ftdi
      devices existed.  Now, initialize FT4222 devices based on the
      device id.
    * Many fixes for various problems with the FT4222
    * Added unit test for platform extender (minimal functionality w/o hw)
    * Updated to FindFtd4222.cmake module to handle standard arguments
    * Removed CMAKE_C_FLAGS addition of -DFTDID2XX and -DFTDI4222 since
      these are NOT used anywhere in source.
    * Building the FTDI4222 shim requires libft4222.h which requires
      ftd2xx.h.  Updated CMakeLists.txt to require both when building
      the shim.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-06-26 12:57:13 -07:00
Mihai Tudor Panu
47728b4c1d gpio: adjust adv function hooks to fix subplatforms
The chardev feature changed the flow for most GPIO functions but did not take into account existing function hooks correctly.
This fixes the checks and restores subplatform GPIO access.

Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-06-25 09:48:12 -07:00
Noel Eck
a2f01bee5f mraa.c: Added pointer to pointer back to find_uart
Went a bit too far with the previous commit.  Added pointer to pointer
back to mraa_find_uart_bus_pci.

Tested leaks against valgrind and verified dev_path gets set with gdb.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-06-14 21:21:37 -07:00
Noel Eck
17342cbbbb mraa.c: Fixed memleak of device_path for IEI_TANK
Unfortunately the device_path char* is dynamically allocated
and #defined and const char *'ed depending on how each platform provided the
uart device paths which makes cleaning it up more complicated.

Added a check for the IEI_TANK.

Removed the char** (in favor of a char*) for mraa_find_uart_bus_pci.)

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-06-14 15:18:29 -07:00
Mihai Tudor Panu
4c4845b101 types.hpp: add missing mediatek boards to platform enum
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-06-11 22:52:37 -07:00
Mihai Tudor Panu
b06172b05a aiotdevkit: add readme and link to it
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-06-11 22:47:39 -07:00
Mihai Tudor Panu
8a22f18152 aiotdevkit: fix pinmap and add uart names
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-06-06 16:28:29 -07:00
Mihai Tudor Panu
9c5f940dad aiotdevkit: add support for IEI Tank platforms
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-05-31 21:21:53 -07:00
Noel Eck
7d58d4c6d0 ftdi_4222: Memleak fixes
Fixes for assortment of memory leaks.  Updated i2c_read/write_internal
methods to get the controller status ONLY when a read/write fails.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-05-30 13:53:45 -07:00
Noel Eck
0712b9ea63 ftdi_4222: Cleanup warning messages from compile
* Fixed broken switch statement - missing 'case' in front of labels
    * Added default case to switch statement
    * Removed unused variable
    * Removed unused static functions
    * Attempted to fix cases where functions are returning/not returning
      data incorrectly.
    * Attempted to fix i2c read which was returning an
    * uninitialized/unused variable.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-05-30 11:30:49 -07:00
Noel Eck
ed79502efc ftdi_4222: Fix mode check in FTDI4222
If numDevs is not == 2, the previous code would fail.  If numDevs > 2
(example 1 ft2xx device connected and 1 ft4222 device in mode 3) then
the code would not initialize the FT4222 and give an error that the mode
must be 0 or 3.

Updated source to find the first index of a ft4222 device.  Initialize
it as I2C.  If another device of the same id exists, then initialize it
as GPIO.

Added more syslog messages for debugging.

Signed-off-by: Noel Eck <noel.eck@intel.com>
2018-05-30 11:02:04 -07:00
Manivannan Sadhasivam
46b3a3ef88 arm: 96boards: Move pin capabilities property inside is_gpio condition
Declare the GPIO pins capabilities under is_gpio condition instead of
under sysfs_pin.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: malikabhi05 <abhishek.malik@intel.com>
2018-05-03 14:17:55 -04:00
Manivannan Sadhasivam
3fa1237255 arm: 96boards: Add support for Hikey960
Add support for Hikey960 board from HiSilicon based on their Kirin960 SoC.

Peripherals supported:

1. GPIO
2. UART
3. I2C

For GPIO only Chardev interface has been added since this board only supports
>=4.15 kernel and using legacy sysfs interface is highly discouraged.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: malikabhi05 <abhishek.malik@intel.com>
2018-05-03 14:17:38 -04:00
Manivannan Sadhasivam
5faa2b93ca 96boards: db820c: Fix chardev mapping
Fix chardev mapping for GPIO-C and GPIO-F.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: malikabhi05 <abhishek.malik@intel.com>
2018-05-02 17:09:13 -04:00
Manivannan Sadhasivam
b04e728957 gpio: chardev: fix leaking of gpiochip file descriptors
The following APIs are only used for getting the line information from
kernel by opening the gpiochip independently and they fails to close
the file descriptor when done:

1. mraa_get_line_info_by_chip_number()
2. mraa_get_line_info_by_chip_name()
3. mraa_get_line_info_by_chip_label()

This will create issue if these API consumers like mraa_gpio_read_dir(),
mraa_gpio_mode(), mraa_gpio_chardev_dir() gets called in a loop. The
system will run out of file descriptor after some time.

Fix this issue by closing the opened file descriptors before freeing
the cinfo struct.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: malikabhi05 <abhishek.malik@intel.com>
2018-05-02 11:38:12 -04:00
Mihai Tudor Panu
b59fc8f076 docs: updated readme and build instructions for node.js and ubuntu
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
Signed-off-by: malikabhi05 <abhishek.malik@intel.com>
2018-04-19 13:35:06 -04:00
Mihai Tudor Panu
bdd00e10ed minnowboard: add chardev support
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
Signed-off-by: malikabhi05 <abhishek.malik@intel.com>
2018-04-19 13:35:06 -04:00
Brendan Le Foll
72f1ffca31 cmake: force c99 to be set in the compiler
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
Signed-off-by: malikabhi05 <abhishek.malik@intel.com>
2018-04-19 12:00:02 -04:00
Manivannan Sadhasivam
6258bd5fdd 96boards: chardev: Move chardev enablement inside platform check
Move the chardev enablement inside the platform check.
Some boards might not have the chardev mapping yet.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: malikabhi05 <abhishek.malik@intel.com>
2018-04-19 11:42:24 -04:00
IvanFarkas
284d882b9d Added Qualcomm DragonBoard 820c support.
GPIO ports from DragonBoard 820c Hardware Manual (p16) at
https://github.com/sdrobertw/dragonboard820c/blob/master/hardware-docs/files/db820c-user-guide.docx

Add Chardev support for DragonBoard 820c

Signed-off-by: Ivan Farkas <Ivan.Farkas@TeleCuris.com>
Signed-off-by: malikabhi05 <abhishek.malik@intel.com>
2018-04-10 16:49:38 -04:00
Manivannan Sadhasivam
7ea32cf1ec arm: 96boards: Add Chardev support for relevant boards
As of now both Dragonboard410c and Hikey boards run latest LTS kernel.
Hence, adding chardev support for those.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Ivan Farkas <Ivan.Farkas@TeleCuris.com>
Signed-off-by: malikabhi05 <abhishek.malik@intel.com>
2018-04-10 16:49:18 -04:00
Manivannan Sadhasivam
b48baf01bc gpio: chardev: Fix flag for checking kernel owned & open source gpio line
The flag used for checking the kernel owned gpio line is GPIOLINE_FLAG_KERNEL.
Hence use that instead of GPIOLINE_FLAG_IS_OUT.

Flag used for checking the open source gpio line is GPIOLINE_FLAG_OPEN_SOURCE.
Hence use that instead of GPIOHANDLE_REQUEST_OPEN_SOURCE, which should be
only used when requesting lines.

Reported-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: malikabhi05 <abhishek.malik@intel.com>
2018-04-06 15:47:06 -04:00
Manivannan Sadhasivam
be9cd0138a arm: 96boards: Run clang-format on source code
Run clan-format on the source code for better code visibility.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: malikabhi05 <abhishek.malik@intel.com>
2018-04-06 15:20:13 -04:00
Manivannan Sadhasivam
dee7b80f06 arm: 96boards: Add Chardev support for relevant boards
As of now both Dragonboard410c and Hikey boards run latest LTS kernel.
Hence, adding chardev support for those.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: malikabhi05 <abhishek.malik@intel.com>
2018-04-06 15:19:25 -04:00
Abhishek Malik
cfda9c99d7 UART: Fixing UART issues on UP2
Signed-off-by: Abhishek Malik <abhishek.malik@intel.com>
2018-03-14 16:21:42 -07:00
Mihai Tudor Panu
acff725d93 gpio: minor change to resource cleanup code
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-03-22 17:52:55 -07:00
mihais
ac58754756 gpio: resource cleanup fix for chardev changes
Signed-off-by: Mihai Stefanescu <mihai.t.gh.stefanescu@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-03-22 17:45:34 -07:00
Mihai Tudor Panu
bbcdb1e087 up2: adding platform examples for built-in user leds
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-03-22 15:29:01 -07:00
Mihai Tudor Panu
d9c54e1d31 up2: added chardev map to platform
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-03-14 16:10:03 -07:00
Mihai Tudor Panu
cf2e69a8ea chardev: boards need to specify chardev support explicitly before runtime check is performed
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-03-14 14:39:42 -07:00