Private
Public Access
2
0
Commit Graph

1731 Commits

Author SHA1 Message Date
Adelin Dobre
8ded6f1f6d initio.c: Add fix for passing null pointer as argument
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-03-06 12:11:33 -08:00
Cosmin Popescu
88a8bb22b6 mraa.c: Add fix for dereferencing of a null pointer
Signed-off-by: Cosmin Popescu <gabrielcosmin.popescu@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-03-06 12:11:21 -08:00
Cosmin Popescu
9fe2883e6a gpio.c: Add fix for dereferencing of a null pointer
Signed-off-by: Cosmin Popescu <gabrielcosmin.popescu@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-03-06 12:11:10 -08:00
Cosmin Popescu
5169021afd mraa.c: Add fix for potential memory leak
Signed-off-by: Cosmin Popescu <gabrielcosmin.popescu@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-03-06 12:10:59 -08:00
Cosmin Popescu
6252d25729 x86/intel_galileo_rev_g.c: Removed switch break after return
Signed-off-by: Cosmin Popescu <gabrielcosmin.popescu@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-03-06 12:10:48 -08:00
Cosmin Popescu
b75731d9d3 iio/iio.c: Fix typo
Signed-off-by: Cosmin Popescu <gabrielcosmin.popescu@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-03-06 12:10:35 -08:00
Cosmin Popescu
9cb508f5d2 iio/iio.c: Add fix for access of variable before error check
Signed-off-by: Cosmin Popescu <gabrielcosmin.popescu@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-03-06 12:10:06 -08:00
Cosmin Popescu
2bb200aa04 iio/iio.c: Add fix for division by 0 bug
Signed-off-by: Cosmin Popescu <gabrielcosmin.popescu@gmail.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2019-03-06 12:09:51 -08:00
Sai Hari Chandana Kalluri
b425c99030 [PATCH] Ultra96: Add support for ultra96
Add support for Ultra96 board: Ultra96 is an Arm-based, Xilinx Zynq
UltraScale+ MPSoC development board based on the Linaro 96Boards
Consumer Edition specification.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Peter Ryser <peter.ryser@xilinx.com>
Signed-off-by: Manjukumar Matha <manjukumar.harthikote-matha@xilinx.com>
Signed-off-by: Sai Hari Chandana Kalluri <chandana.kalluri@xilinx.com>
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
2019-02-23 20:46:49 +01:00
Burak Han
08b2cefebe DE10-Nano: Detection For Different Kernels
To detect DE10-Nano with default config.

Signed-off-by: Burak Han Corak<burakhancorak@gmail.com>
Signed-off-by: Thomas Ingleby <thomas.ingleby@intel.com>
2019-02-21 10:10:35 -08:00
Adelin Dobre
d0c884e67d initio.c: Fix parse issue inside mraa_io_init
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Thomas Ingleby <thomas.ingleby@intel.com>
2019-02-21 09:53:54 -08:00
Adelin Dobre
678e540291 initio: Add safety checks inside MraaIo destructor
Signed-off-by: Adelin Dobre <adelin.dobre@rinftech.com>
Signed-off-by: Thomas Ingleby <thomas.ingleby@intel.com>
2019-02-21 09:53:54 -08:00
Chuck Duey
eae4a0cfbf BeagleBone Fix detection of emmc and PCM for mraa pins 74-77
This fixes the problem of detecting if pins 74-77 are available for gpio/spi use.  These pins were sown to be used by the emmc, but actually used by the sound pcm.  If the sound PCM is disabled and the emmc is enabled the pinse can now be used.  mraa-gpio list output Pins 74-77
73     GPIO115: GPIO
74     GPIO113: GPIO SPI
75     GPIO111: GPIO SPI
76     GPIO112: GPIO SPI
77     GPIO110: GPIO SPI

to build:
1. clone repo
2. sudo apt-get install build-essential python-dev cmake automake libpcre3 libpcre3-dev byacc flex swig3.0
3. cd mraa, mkdir build, cd build
4. cmake -D CMAKE_INSTALL_PREFIX=/usr ..
5. make
6. sudo make install

This has been verified to work on BBGW, and BBBW with 9.0-9.5 with emmc enabled and PCM aduio turned off.  It is so nice to have control of these pins when running with out an SD card.

Closes #953

Signed-off-by: Chuck Duey <cduey@msn.com>
Signed-off-by: Thomas Ingleby <thomas.ingleby@intel.com>
2019-02-21 09:50:11 -08:00
Brett Haines
7a1db249fe rpi: Added Raspberry Pi 3 A+ definitions
Signed-off-by: Brett Haines <bhaines418@gmail.com>
Signed-off-by: Thomas Ingleby <thomas.ingleby@intel.com>
2018-11-29 09:53:11 -08:00
Chuck Duey
d3207769e7 rpi: Added Raspberry Pi 3 B+ to Hardware Versions with corrections
Signed-off-by: Chuck Duey <cduey@msn.com>
Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
2018-10-09 09:58:36 -07:00
Peter Robinson
66c2478183 Add instructions for Fedora
mraa is packaged in Fedora so add details for how people can consume mraa on that
distribution.

Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Thomas Ingleby <thomas.ingleby@intel.com>
2018-09-20 10:13:05 +02:00
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