This fixes#698 where an application will crash after calling mraa_deinit and
later closing calling deinit again because of the gcc destructor argument
introduced with cac8f7a
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
Currently, mraa_init is called when loading libmraa. This commit
adds similar functionality to call mraa_deinit when unloading
libmraa. This is a nice-to-have since it makes identifying other
memory leaks easier.
Signed-off-by: Noel Eck <noel.eck@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
In the process of using the mraa mock platform to identify memory leaks
in UPM libraries. This commit fixes some non-critical places where
memory was getting lost in mraa.
Signed-off-by: Noel Eck <noel.eck@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
Updated Doxyfile to strip the full path to the base MRAA directory
from generated documentation. This removes the build path from
MRAA documentation.
Old html:
aio_8h.html:<title>mraa: /iotdk/jenkins/workspace/upm-doc-stable/api/mraa/aio.h File Reference</title>
New html:
aio_8h.html:<title>mraa: api/mraa/aio.h File Reference</title>
Signed-off-by: Noel Eck <noel.eck@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
GPIO and I2C functions of some PINs are not possible
with default BIOS configuration. Current documentation
wrongly shows that the PINs can work as both GPIO and I2C.
This patch fixes this issue and also updated pin conf for
I2C 1 and 2 to disable GPIO functionality.
Signed-off-by: Arun Ravindran <arun.ravindran@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
The earlier patches did not fix the following issues.
1) gpio number used for ISH I2C 0 and I2C 1 were not correct
2) gpio number used in ISH I2C 1 and I2C 2 were not correct
3) ISH UART 0 gpio numbers were wrong
This patch fixes this issue and also update the doc.
Signed-off-by: Arun Ravindran <arun.ravindran@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
Variable 'dup' doesn't get freed correctly as the pointer to it changes
after 'strsep' function is used. Also 'token' variable doesn't need to
be freed as freeing the original 'dup' already frees the same memory.
Signed-off-by: Simo Kuusela <simo.kuusela@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
MRAA is using gpio 484, 483, 485 and 486 as ISH UART1.
But J13 expansion connector doesn't expose ISH UART1,
instead it exposes ISH UART0 as per dev kit hardware guide.
This patch fixes this descrpency and renames the UART and
also enables the GPIO usage.
Signed-off-by: Arun Ravindran <arun.ravindran@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
With a broken device, or a broken interface circuit, it is possible
for _ow_read_byte() to spin forever. This patch arranges for it to
timeout after 5 seconds if it cannot read a valid byte from the UART.
Signed-off-by: Jon Trulson <jtrulson@ics.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
The mapping for gpio-339 went away with commit
gpio-339 is available as LED102 or ISH_IO2
Signed-off-by: Arun Ravindran <arun.ravindran@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
The GPIOs are not mapped correctly in MRAA for tuchuk board.
This patch corrects the GPIO maps and the PIN assignments.
Note:
1) There are nothing called I2S(x)SDO and I2S(x)SDI available over breakout
pins, the usage is commented now.
2) There is nothing called SPP0FS3, is now commented, what we have is SPP1FS3.
3) I2C1SDA available twise 15 and 71. PIN 71 as per gpio used should be renamed as ISHI2C0SDA
4) I2C1SCL available twise 17 and 73. PIN 73 as per gpio used should be renamed as ISHI2C0SCL
5) UART1TX available twise 22 and 74. PIN 74 as per gpio used is ISHUART1TXD
and is not available in breakout.
6) UART1RX available twise 24 and 76. PIN 76 as per gpio used is ISHUART1RXD
and is not available in breakout.
7) I2C2SDA available twise 19 and 75. PIN 75 as per gpio used is ISHI2C1SDA
and is not available in breakout pins
8) I2C2SCL available twise 21 and 77. PIN 75 as per gpio used is ISHI2C1SCL
and is not available in breakout pins
9) PIN 78 UART1RT as per GPIO used is ISHUART1RT and is not available in breakout pins
10) PIN 80 UART1CT as per GPIO is ISHUART1CT and is not available in breakout pins
BIOS used is 193
Signed-off-by: Arun Ravindran <arun.ravindran@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
The gpio pins numbers aren't just matching the physical pin numbers...
on some distros like raspbian, with a kernel explicitly setting the
base to 0, it works, but for kernels using the first free slot it
doesn't (see gpiochip_find_base() in kernel's gpiolib.c).
To get the proper gpio pin value, we thus need to find the base for
the corresponding gpiochip. For the raspberry pi, we search for the
chip with a label containing 'bcm2835'.
Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
While some distributions have a modified /proc/cpuinfo including
the board revision for raspberry pi, most distributions don't
have this.
In order to guess the raspberry pi version in such cases, use
the /proc/device-tree/compatible content as a fallback solution.
The values expected from this file have been taken from
upstream kernel documentation:
Documentation/devicetree/bindings/arm/bcm/brcm,bcm2835.txt
Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
As per Documentation/ABI/testing/sysfs-firmware-ofw, perfer
/proc/device-tree over /sys/firmware/devicetree/base as this
is the stable one.
Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
Some compilers are raising an error if no value is returned in main.
Add a return 0 in spi_max7219.c main to quiet them.
Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
Change PLATFORM_RASPBERRY_PI_ZERO into an integer to avoid
build error when comparing it to integer platform_detected.
Signed-off-by: Cédric Bosdonnat <cbosdonnat@suse.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
GT/GrosseTete -> Joule. This commit deprecates the MRAA_INTEL_GT_TUCHUCK
mraa_platform_t value and links the grossetete.md page to joule.md.
Signed-off-by: Wai Lun Poon <wai.lun.poon@intel.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
Like the beaglebone, the phyBOARD-Wega also got an am335x.
So I merged the four mmap-functions for gpio_context and some
identical defines in a separate header and c-file.
The new platform support-files are based on beaglebone-files.
The documentation of phyBOARD-Wega is still in process,
but for now there are enough informations.
At this time it is possible to use GPIO-Pins and Uart0
(tested via python with mraa). The code for using SPI, I2C and
PWM is also still in process and not tested yet.
Signed-off-by: Norbert Wesp <nwesp@phytec.de>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
.c_str() works accidentally, but is technically incorrect as these
"strings" can have embedded 0 bytes in them.
Signed-off-by: Jon Trulson <jtrulson@ics.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
The command() function had a logic error that caused a command to be
broadcast to all devices on the DS OW bus when a proper ID was
specified. This should only be done when NO ID is specified.
This fixes UPM issue #502.
In addition, there were two cases where the C++ string accessor method
.c_str() was used when .data() should be used instead. This worked
anyway (accidentally), but is improper since the strings can have
embedded 0 bytes.
Signed-off-by: Jon Trulson <jtrulson@ics.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This adds logic to save PWM duty when disabling the pin (which sets
the duty to 0), and restore it when re-enabling the pin.
Signed-off-by: Alex Tereschenko <alext.mkrs@gmail.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
Edison pwm can stuck at high if pin is disabled during ON pwm peroid.
Workaround is to force zero duty time before disabling the pin.
Signed-off-by: Billy Bai <belugon@outlook.com>
Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>