Private
Public Access
2
0

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>
This commit is contained in:
Noel Eck
2018-06-01 14:59:39 -07:00
parent 47728b4c1d
commit fc4b2a554d
15 changed files with 1591 additions and 1291 deletions

View File

@@ -27,11 +27,11 @@ else (LIBFTD2XX_LIBRARIES AND LIBFTD2XX_INCLUDE_DIRS)
/usr/local/include
/opt/local/include
/sw/include
)
)
SET(FTD2XX_LIBNAME ftd2xx)
IF(WIN32)
SET(FTD2XX_LIBNAME ftd2xx.lib)
SET(FTD2XX_LIBNAME ftd2xx.lib)
ENDIF(WIN32)
find_library(LIBFTD2XX_LIBRARY
@@ -42,16 +42,16 @@ else (LIBFTD2XX_LIBRARIES AND LIBFTD2XX_INCLUDE_DIRS)
/usr/local/lib
/opt/local/lib
/sw/lib
)
)
if(LIBFTD2XX_INCLUDE_DIR)
set(LIBFTD2XX_INCLUDE_DIRS
set(LIBFTD2XX_INCLUDE_DIRS
${LIBFTD2XX_INCLUDE_DIR}
)
)
endif(LIBFTD2XX_INCLUDE_DIR)
set(LIBFTD2XX_LIBRARIES
${LIBFTD2XX_LIBRARY}
)
)
if (LIBFTD2XX_INCLUDE_DIRS AND LIBFTD2XX_LIBRARIES)
set(LIBFTD2XX_FOUND TRUE)
@@ -59,14 +59,17 @@ else (LIBFTD2XX_LIBRARIES AND LIBFTD2XX_INCLUDE_DIRS)
if (LIBFTD2XX_FOUND)
if (NOT libftd2xx_FIND_QUIETLY)
message(STATUS "Found libftd2xx: ${LIBFTD2XX_LIBRARIES}")
message(STATUS "Found libftd2xx: ${LIBFTD2XX_LIBRARIES}")
endif (NOT libftd2xx_FIND_QUIETLY)
else (LIBFTD2XX_FOUND)
if (libftd2xx_FIND_REQUIRED)
message(FATAL_ERROR "Could not find libftd2xx")
message(FATAL_ERROR "Could not find libftd2xx")
endif (libftd2xx_FIND_REQUIRED)
endif (LIBFTD2XX_FOUND)
find_package_handle_standard_args(Ftd2xx
REQUIRED_VARS LIBFTD2XX_INCLUDE_DIRS)
# show the LIBFTD2XX_INCLUDE_DIRS and LIBFTD2XX_LIBRARIES variables only in the advanced view
mark_as_advanced(LIBFTD2XX_INCLUDE_DIRS LIBFTD2XX_LIBRARIES)

View File

@@ -28,11 +28,11 @@ else (LIBFT4222_LIBRARIES AND LIBFT4222_INCLUDE_DIRS)
/usr/local/include
/opt/local/include
/sw/include
)
)
SET(FTD4222_LIBNAME ft4222)
IF(WIN32)
SET(FTD4222_LIBNAME LibFT4222.lib)
SET(FTD4222_LIBNAME LibFT4222.lib)
ENDIF(WIN32)
find_library(LIBFT4222_LIBRARY
@@ -43,16 +43,16 @@ else (LIBFT4222_LIBRARIES AND LIBFT4222_INCLUDE_DIRS)
/usr/local/lib
/opt/local/lib
/sw/lib
)
)
if(LIBFT4222_INCLUDE_DIR)
set(LIBFT4222_INCLUDE_DIRS
set(LIBFT4222_INCLUDE_DIRS
${LIBFT4222_INCLUDE_DIR}
)
)
endif(LIBFT4222_INCLUDE_DIR)
set(LIBFT4222_LIBRARIES
${LIBFT4222_LIBRARY}
)
)
if (LIBFT4222_INCLUDE_DIRS AND LIBFT4222_LIBRARIES)
set(LIBFT4222_FOUND TRUE)
@@ -60,14 +60,17 @@ else (LIBFT4222_LIBRARIES AND LIBFT4222_INCLUDE_DIRS)
if (LIBFT4222_FOUND)
if (NOT LIBFT4222_FIND_QUIETLY)
message(STATUS "Found LIBFT4222: ${LIBFT4222_LIBRARIES}")
message(STATUS "Found LIBFT4222: ${LIBFT4222_LIBRARIES}")
endif (NOT LIBFT4222_FIND_QUIETLY)
else (LIBFT4222_FOUND)
if (LIBFT4222_FIND_REQUIRED)
message(FATAL_ERROR "Could not find LIBFT4222")
message(FATAL_ERROR "Could not find LIBFT4222")
endif (LIBFT4222_FIND_REQUIRED)
endif (LIBFT4222_FOUND)
find_package_handle_standard_args(Ftd4222
REQUIRED_VARS LIBFT4222_INCLUDE_DIRS LIBFT4222_LIBRARIES)
# show the LIBFT4222_INCLUDE_DIRS and LIBFT4222_LIBRARIES variables only in the advanced view
mark_as_advanced(LIBFT4222_INCLUDE_DIRS LIBFT4222_LIBRARIES)