From 054165ed84b492b6cea9facd3d5f858f9a33ea02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois?= Date: Sun, 16 Feb 2025 11:27:46 +0100 Subject: [PATCH] dirs refactoring --- .vscode/settings.json | 13 + CMakeLists.txt | 10 +- app/CMakeLists.txt | 3 +- app/src/cmds/exit.h | 2 +- app/src/cmds/help.h | 2 +- app/src/cmds/list_probes.h | 4 +- app/src/cmds/scan.h | 2 +- app/src/cmds/select_probe.c | 2 +- app/src/cmds/select_probe.h | 2 +- app/src/common.h | 2 +- app/src/main.c | 2 +- .../os_interface/win32/libjtagcore.def | 66 ----- .../os_interface/win32/libjtagcore.rc | 107 -------- lib_jtag_core/os_interface/win32/stdint.h | 247 ------------------ libs/bsdl_parser/CMakeLists.txt | 7 + .../bsdl_parser/bsdl_loader.c | 12 +- .../bsdl_parser/bsdl_loader.h | 0 .../bsdl_parser/bsdl_strings.c | 6 +- .../bsdl_parser/bsdl_strings.h | 0 libs/bus_over_jtag/CMakeLists.txt | 7 + .../bus_over_jtag/i2c_over_jtag.c | 12 +- .../bus_over_jtag/mdio_over_jtag.c | 10 +- .../bus_over_jtag/memory_over_jtag.c | 10 +- .../bus_over_jtag/spi_over_jtag.c | 10 +- {lib_jtag_core => libs/config}/config.script | 0 .../config}/config_script.h | 0 libs/drivers/CMakeLists.txt | 10 + .../drivers/drivers_list.c | 6 +- .../drivers/drivers_list.h | 0 {lib_jtag_core => libs}/drivers/drv_loader.c | 8 +- {lib_jtag_core => libs}/drivers/drv_loader.h | 0 .../drivers/ftdi_jtag/ftdi_jtag_drv.c | 10 +- .../drivers/ftdi_jtag/ftdi_jtag_drv.h | 0 .../drivers/jlink_jtag/jlink_jtag_drv.c | 8 +- .../drivers/jlink_jtag/jlink_jtag_drv.h | 0 .../linux_gpio_jtag/linux_gpio_jtag_drv.c | 10 +- .../linux_gpio_jtag/linux_gpio_jtag_drv.h | 0 .../drivers/lpt_jtag/lpt_jtag_drv.c | 8 +- .../drivers/lpt_jtag/lpt_jtag_drv.h | 0 .../lib_jtag_core}/CMakeLists.txt | 11 +- .../lib_jtag_core}/COPYING.LESSER | 0 libs/lib_jtag_core/config_script.h | 0 .../lib_jtag_core}/dbg_logs.c | 6 +- .../lib_jtag_core}/dbg_logs.h | 0 .../lib_jtag_core}/jtag_core.c | 7 +- .../lib_jtag_core}/jtag_core.h | 3 +- .../lib_jtag_core}/jtag_core_internal.h | 0 .../lib_jtag_core}/version.h | 0 libs/{ => libftd2xx}/WinTypes.h | 0 libs/{ => libftd2xx}/ftd2xx.h | 0 libs/{ => libftd2xx}/libftd2xx.a | Bin libs/natsort/CMakeLists.txt | 5 + {lib_jtag_core => libs}/natsort/strnatcmp.c | 0 {lib_jtag_core => libs}/natsort/strnatcmp.h | 0 libs/os_interface/CMakeLists.txt | 5 + {lib_jtag_core => libs}/os_interface/fs.c | 4 +- .../os_interface/network.c | 1 - .../os_interface/network.h | 0 .../os_interface/os_interface.c | 200 ++------------ .../os_interface/os_interface.h | 32 +-- libs/script/CMakeLists.txt | 7 + {lib_jtag_core => libs}/script/env.c | 0 {lib_jtag_core => libs}/script/env.h | 0 {lib_jtag_core => libs}/script/script.c | 12 +- {lib_jtag_core => libs}/script/script.h | 0 65 files changed, 182 insertions(+), 709 deletions(-) create mode 100644 .vscode/settings.json delete mode 100644 lib_jtag_core/os_interface/win32/libjtagcore.def delete mode 100644 lib_jtag_core/os_interface/win32/libjtagcore.rc delete mode 100644 lib_jtag_core/os_interface/win32/stdint.h create mode 100644 libs/bsdl_parser/CMakeLists.txt rename {lib_jtag_core => libs}/bsdl_parser/bsdl_loader.c (94%) rename {lib_jtag_core => libs}/bsdl_parser/bsdl_loader.h (100%) rename {lib_jtag_core => libs}/bsdl_parser/bsdl_strings.c (90%) rename {lib_jtag_core => libs}/bsdl_parser/bsdl_strings.h (100%) create mode 100644 libs/bus_over_jtag/CMakeLists.txt rename {lib_jtag_core => libs}/bus_over_jtag/i2c_over_jtag.c (93%) rename {lib_jtag_core => libs}/bus_over_jtag/mdio_over_jtag.c (92%) rename {lib_jtag_core => libs}/bus_over_jtag/memory_over_jtag.c (94%) rename {lib_jtag_core => libs}/bus_over_jtag/spi_over_jtag.c (94%) rename {lib_jtag_core => libs/config}/config.script (100%) rename {lib_jtag_core => libs/config}/config_script.h (100%) create mode 100644 libs/drivers/CMakeLists.txt rename {lib_jtag_core => libs}/drivers/drivers_list.c (90%) rename {lib_jtag_core => libs}/drivers/drivers_list.h (100%) rename {lib_jtag_core => libs}/drivers/drv_loader.c (90%) rename {lib_jtag_core => libs}/drivers/drv_loader.h (100%) rename {lib_jtag_core => libs}/drivers/ftdi_jtag/ftdi_jtag_drv.c (95%) rename {lib_jtag_core => libs}/drivers/ftdi_jtag/ftdi_jtag_drv.h (100%) rename {lib_jtag_core => libs}/drivers/jlink_jtag/jlink_jtag_drv.c (94%) rename {lib_jtag_core => libs}/drivers/jlink_jtag/jlink_jtag_drv.h (100%) rename {lib_jtag_core => libs}/drivers/linux_gpio_jtag/linux_gpio_jtag_drv.c (93%) rename {lib_jtag_core => libs}/drivers/linux_gpio_jtag/linux_gpio_jtag_drv.h (100%) rename {lib_jtag_core => libs}/drivers/lpt_jtag/lpt_jtag_drv.c (93%) rename {lib_jtag_core => libs}/drivers/lpt_jtag/lpt_jtag_drv.h (100%) rename {lib_jtag_core => libs/lib_jtag_core}/CMakeLists.txt (63%) rename {lib_jtag_core => libs/lib_jtag_core}/COPYING.LESSER (100%) create mode 100644 libs/lib_jtag_core/config_script.h rename {lib_jtag_core => libs/lib_jtag_core}/dbg_logs.c (93%) rename {lib_jtag_core => libs/lib_jtag_core}/dbg_logs.h (100%) rename {lib_jtag_core => libs/lib_jtag_core}/jtag_core.c (95%) rename {lib_jtag_core => libs/lib_jtag_core}/jtag_core.h (97%) rename {lib_jtag_core => libs/lib_jtag_core}/jtag_core_internal.h (100%) rename {lib_jtag_core => libs/lib_jtag_core}/version.h (100%) rename libs/{ => libftd2xx}/WinTypes.h (100%) rename libs/{ => libftd2xx}/ftd2xx.h (100%) rename libs/{ => libftd2xx}/libftd2xx.a (100%) create mode 100644 libs/natsort/CMakeLists.txt rename {lib_jtag_core => libs}/natsort/strnatcmp.c (100%) rename {lib_jtag_core => libs}/natsort/strnatcmp.h (100%) create mode 100644 libs/os_interface/CMakeLists.txt rename {lib_jtag_core => libs}/os_interface/fs.c (93%) rename {lib_jtag_core => libs}/os_interface/network.c (99%) rename {lib_jtag_core => libs}/os_interface/network.h (100%) rename {lib_jtag_core => libs}/os_interface/os_interface.c (67%) rename {lib_jtag_core => libs}/os_interface/os_interface.h (77%) create mode 100644 libs/script/CMakeLists.txt rename {lib_jtag_core => libs}/script/env.c (100%) rename {lib_jtag_core => libs}/script/env.h (100%) rename {lib_jtag_core => libs}/script/script.c (95%) rename {lib_jtag_core => libs}/script/script.h (100%) diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..9405994 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,13 @@ +{ + "files.associations": { + "*.cpt": "yaml", + "*.seq": "yaml", + "os_interface.h": "c", + "bsdl_strings.h": "c", + "script.h": "c", + "env.h": "c", + "drivers_list.h": "c", + "bsdl_loader.h": "c", + "jtag_core_internal.h": "c" + } +} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index fcb5102..472b489 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,11 @@ cmake_minimum_required(VERSION 3.10) -project(BoundaryScan) +project(BoundaryScanExplorer) -add_subdirectory(lib_jtag_core) +add_subdirectory(libs/lib_jtag_core) +add_subdirectory(libs/os_interface) +add_subdirectory(libs/natsort) +add_subdirectory(libs/script) +add_subdirectory(libs/drivers) +add_subdirectory(libs/bus_over_jtag) +add_subdirectory(libs/bsdl_parser) add_subdirectory(app) \ No newline at end of file diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index d28296e..feb8d15 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -8,8 +8,9 @@ add_executable( ) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../libs) # linking configuration target_link_libraries( - bs PRIVATE jtag_core + bs PRIVATE script jtag_core bsdl_parser bus_over_jtag drivers os_interface natsort readline ncurses ) \ No newline at end of file diff --git a/app/src/cmds/exit.h b/app/src/cmds/exit.h index 216bef8..b4cebe3 100644 --- a/app/src/cmds/exit.h +++ b/app/src/cmds/exit.h @@ -1,7 +1,7 @@ #ifndef _CMD_EXIT_H #define _CMD_EXIT_H -#include "jtag_core.h" +#include "lib_jtag_core/jtag_core.h" extern const char cmd_exit_help[]; diff --git a/app/src/cmds/help.h b/app/src/cmds/help.h index f18113b..f9fc311 100644 --- a/app/src/cmds/help.h +++ b/app/src/cmds/help.h @@ -1,7 +1,7 @@ #ifndef _CMD_HELP_H #define _CMD_HELP_H -#include "jtag_core.h" +#include "lib_jtag_core/jtag_core.h" int cmd_help(jtag_core *jc, int argc, char *argv[]); diff --git a/app/src/cmds/list_probes.h b/app/src/cmds/list_probes.h index 144de78..f2cd276 100644 --- a/app/src/cmds/list_probes.h +++ b/app/src/cmds/list_probes.h @@ -1,9 +1,9 @@ #ifndef _LIST_PROBES_H #define _LIST_PROBES_H -#include "jtag_core.h" +#include "lib_jtag_core/jtag_core.h" -const char cmd_list_probes_help[]; +extern const char cmd_list_probes_help[]; int cmd_list_probes(jtag_core *jc, int argc, char *argv[]); diff --git a/app/src/cmds/scan.h b/app/src/cmds/scan.h index 7639f2b..50d6dbc 100644 --- a/app/src/cmds/scan.h +++ b/app/src/cmds/scan.h @@ -1,7 +1,7 @@ #ifndef _CMDS_SCAN_H #define _CMDS_SCAN_H -#include "jtag_core.h" +#include "lib_jtag_core/jtag_core.h" extern const char cmd_scan_help[]; diff --git a/app/src/cmds/select_probe.c b/app/src/cmds/select_probe.c index d84a328..6478373 100644 --- a/app/src/cmds/select_probe.c +++ b/app/src/cmds/select_probe.c @@ -7,7 +7,7 @@ const char cmd_select_probe_help[] = "Bla bla."; int cmd_select_probe(jtag_core *jc, int argc, char *argv[]) { int error = 0; - error = jtagcore_select_and_open_probe(jc, probe_id); + // error = jtagcore_select_and_open_probe(jc, probe_id); if (error < 0) { printf("Impossible to open the selected probe.\n"); return error; diff --git a/app/src/cmds/select_probe.h b/app/src/cmds/select_probe.h index 1b88393..ca2f755 100644 --- a/app/src/cmds/select_probe.h +++ b/app/src/cmds/select_probe.h @@ -1,7 +1,7 @@ #ifndef _SELECT_PROBE_H #define _SELECT_PROBE_H -#include "jtag_core.h" +#include "lib_jtag_core/jtag_core.h" extern const char cmd_select_probe_help[]; diff --git a/app/src/common.h b/app/src/common.h index 8d09d62..91546ff 100644 --- a/app/src/common.h +++ b/app/src/common.h @@ -1,7 +1,7 @@ #ifndef _UTILS_H #define _UTILS_H -#include "jtag_core.h" +#include "lib_jtag_core/jtag_core.h" #define MAX_LINE 1024 #define MAX_ARGS 16 diff --git a/app/src/main.c b/app/src/main.c index 1978f13..220eb0d 100644 --- a/app/src/main.c +++ b/app/src/main.c @@ -5,7 +5,7 @@ #include #include -#include "jtag_core.h" +#include "lib_jtag_core/jtag_core.h" #include "common.h" #include "args.h" diff --git a/lib_jtag_core/os_interface/win32/libjtagcore.def b/lib_jtag_core/os_interface/win32/libjtagcore.def deleted file mode 100644 index d0a6494..0000000 --- a/lib_jtag_core/os_interface/win32/libjtagcore.def +++ /dev/null @@ -1,66 +0,0 @@ -LIBRARY LIBJTAGCORE - -EXPORTS - jtagcore_init @1 - jtagcore_set_logs_callback @2 - jtagcore_set_logs_level @3 - setOutputFunc_script @4 - jtagcore_get_logs_level @5 - jtagcore_set_logs_file @6 - jtagcore_get_logs_file @7 - jtagcore_deinit @9 - - jtagcore_scan_and_init_chain @10 - jtagcore_get_number_of_devices @11 - jtagcore_get_dev_id @12 - jtagcore_loadbsdlfile @13 - jtagcore_get_dev_name @14 - jtagcore_get_number_of_pins @15 - jtagcore_get_pin_properties @16 - jtagcore_get_bsdl_id @17 - jtagcore_set_scan_mode @18 - jtagcore_get_pin_state @19 - jtagcore_set_pin_state @20 - jtagcore_push_and_pop_chain @21 - - jtagcore_get_number_of_probes @30 - jtagcore_get_number_of_probes_drv @31 - jtagcore_get_probe_name @32 - jtagcore_select_and_open_probe @33 - jtagcore_get_pin_id @34 - - jtagcore_i2c_set_scl_pin @100 - jtagcore_i2c_set_sda_pin @101 - jtagcore_i2c_write_read @102 - - jtagcore_spi_set_cs_pin @200 - jtagcore_spi_set_clk_pin @201 - jtagcore_spi_set_miso_pin @202 - jtagcore_spi_set_mosi_pin @203 - jtagcore_spi_write_read @204 - jtagcore_spi_set_bitorder @205 - - jtagcore_mdio_set_mdio_pin @300 - jtagcore_mdio_set_mdc_pin @301 - jtagcore_mdio_read @302 - jtagcore_mdio_write @303 - - jtagcore_memory_clear_pins @400 - jtagcore_memory_set_address_pin @401 - jtagcore_memory_set_data_pin @402 - jtagcore_memory_set_ctrl_pin @403 - jtagcore_memory_read @404 - jtagcore_memory_write @405 - - jtagcore_setEnvVar @500 - jtagcore_getEnvVar @501 - jtagcore_getEnvVarValue @502 - jtagcore_getEnvVarIndex @503 - - jtagcore_execScriptLine @600 - jtagcore_execScriptFile @601 - jtagcore_execScriptRam @602 - jtagcore_savePinsStateScript @603 - jtagcore_initScript @604 - jtagcore_setScriptOutputFunc @605 - jtagcore_deinitScript @606 diff --git a/lib_jtag_core/os_interface/win32/libjtagcore.rc b/lib_jtag_core/os_interface/win32/libjtagcore.rc deleted file mode 100644 index 84de267..0000000 --- a/lib_jtag_core/os_interface/win32/libjtagcore.rc +++ /dev/null @@ -1,107 +0,0 @@ -//Microsoft Developer Studio generated resource script. -// -#include "../../version.h" - -#define FILE_VERSION VDIG1,VDIG2,VDIG3,VDIG4 -#define STR_FILE_VERSION vxstr(VDIG1) "." vxstr(VDIG2) "." vxstr(VDIG3) "." vxstr(VDIG4) - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "windows.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Language resources - -#if !defined(AFX_RESOURCE_DLL) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE DISCARDABLE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE DISCARDABLE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE DISCARDABLE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -#ifndef _MAC -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION FILE_VERSION - PRODUCTVERSION FILE_VERSION - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS VOS__WINDOWS32 - FILETYPE VFT_DLL - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040c04b0" - BEGIN - VALUE "Comments", "lib jtag core " STR_FILE_VERSION " Release : " STR_DATE " Build : " __DATE__ " " __TIME__ "\0" - VALUE "CompanyName", "(c) Viveris\0" - VALUE "FileDescription", "jtag boundary scanner core\0" - VALUE "FileVersion", STR_FILE_VERSION "\0" - VALUE "InternalName", "libjtagcore.dll\0" - VALUE "LegalCopyright", "Copyright © 2023\0" - VALUE "LegalTrademarks", "(c) Viveris\0" - VALUE "OriginalFilename", "libjtagcore.dll\0" - VALUE "ProductName", "jtag-boundary-scanner\0" - VALUE "ProductVersion", STR_FILE_VERSION "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x40c, 1200 - END -END - -#endif // !_MAC - -#endif -///////////////////////////////////////////////////////////////////////////// - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/lib_jtag_core/os_interface/win32/stdint.h b/lib_jtag_core/os_interface/win32/stdint.h deleted file mode 100644 index e0fb19f..0000000 --- a/lib_jtag_core/os_interface/win32/stdint.h +++ /dev/null @@ -1,247 +0,0 @@ -// ISO C9x compliant stdint.h for Microsoft Visual Studio -// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 -// -// Copyright (c) 2006-2008 Alexander Chemeris -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. The name of the author may be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _MSC_VER // [ -#error "Use this header only with Microsoft Visual C++ compilers!" -#endif // _MSC_VER ] - -#ifndef _MSC_STDINT_H_ // [ -#define _MSC_STDINT_H_ - -#if _MSC_VER > 1000 -#pragma once -#endif - -#include - -// For Visual Studio 6 in C++ mode and for many Visual Studio versions when -// compiling for ARM we should wrap include with 'extern "C++" {}' -// or compiler give many errors like this: -// error C2733: second C linkage of overloaded function 'wmemchr' not allowed -/*#ifdef __cplusplus -extern "C" { -#endif -# include -#ifdef __cplusplus -} -#endif*/ - -// Define _W64 macros to mark types changing their size, like intptr_t. -#ifndef _W64 -# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 -# define _W64 __w64 -# else -# define _W64 -# endif -#endif - - -// 7.18.1 Integer types - -// 7.18.1.1 Exact-width integer types - -// Visual Studio 6 and Embedded Visual C++ 4 doesn't -// realize that, e.g. char has the same size as __int8 -// so we give up on __intX for them. -#if (_MSC_VER < 1300) - typedef signed char int8_t; - typedef signed short int16_t; - typedef signed int int32_t; - typedef unsigned char uint8_t; - typedef unsigned short uint16_t; - typedef unsigned int uint32_t; -#else - typedef signed __int8 int8_t; - typedef signed __int16 int16_t; - typedef signed __int32 int32_t; - typedef unsigned __int8 uint8_t; - typedef unsigned __int16 uint16_t; - typedef unsigned __int32 uint32_t; -#endif -typedef signed __int64 int64_t; -typedef unsigned __int64 uint64_t; - - -// 7.18.1.2 Minimum-width integer types -typedef int8_t int_least8_t; -typedef int16_t int_least16_t; -typedef int32_t int_least32_t; -typedef int64_t int_least64_t; -typedef uint8_t uint_least8_t; -typedef uint16_t uint_least16_t; -typedef uint32_t uint_least32_t; -typedef uint64_t uint_least64_t; - -// 7.18.1.3 Fastest minimum-width integer types -typedef int8_t int_fast8_t; -typedef int16_t int_fast16_t; -typedef int32_t int_fast32_t; -typedef int64_t int_fast64_t; -typedef uint8_t uint_fast8_t; -typedef uint16_t uint_fast16_t; -typedef uint32_t uint_fast32_t; -typedef uint64_t uint_fast64_t; - -// 7.18.1.4 Integer types capable of holding object pointers -#ifdef _WIN64 // [ - typedef signed __int64 intptr_t; - typedef unsigned __int64 uintptr_t; -#else // _WIN64 ][ - typedef _W64 signed int intptr_t; - typedef _W64 unsigned int uintptr_t; -#endif // _WIN64 ] - -// 7.18.1.5 Greatest-width integer types -typedef int64_t intmax_t; -typedef uint64_t uintmax_t; - - -// 7.18.2 Limits of specified-width integer types - -#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259 - -// 7.18.2.1 Limits of exact-width integer types -#define INT8_MIN ((int8_t)_I8_MIN) -#define INT8_MAX _I8_MAX -#define INT16_MIN ((int16_t)_I16_MIN) -#define INT16_MAX _I16_MAX -#define INT32_MIN ((int32_t)_I32_MIN) -#define INT32_MAX _I32_MAX -#define INT64_MIN ((int64_t)_I64_MIN) -#define INT64_MAX _I64_MAX -#define UINT8_MAX _UI8_MAX -#define UINT16_MAX _UI16_MAX -#define UINT32_MAX _UI32_MAX -#define UINT64_MAX _UI64_MAX - -// 7.18.2.2 Limits of minimum-width integer types -#define INT_LEAST8_MIN INT8_MIN -#define INT_LEAST8_MAX INT8_MAX -#define INT_LEAST16_MIN INT16_MIN -#define INT_LEAST16_MAX INT16_MAX -#define INT_LEAST32_MIN INT32_MIN -#define INT_LEAST32_MAX INT32_MAX -#define INT_LEAST64_MIN INT64_MIN -#define INT_LEAST64_MAX INT64_MAX -#define UINT_LEAST8_MAX UINT8_MAX -#define UINT_LEAST16_MAX UINT16_MAX -#define UINT_LEAST32_MAX UINT32_MAX -#define UINT_LEAST64_MAX UINT64_MAX - -// 7.18.2.3 Limits of fastest minimum-width integer types -#define INT_FAST8_MIN INT8_MIN -#define INT_FAST8_MAX INT8_MAX -#define INT_FAST16_MIN INT16_MIN -#define INT_FAST16_MAX INT16_MAX -#define INT_FAST32_MIN INT32_MIN -#define INT_FAST32_MAX INT32_MAX -#define INT_FAST64_MIN INT64_MIN -#define INT_FAST64_MAX INT64_MAX -#define UINT_FAST8_MAX UINT8_MAX -#define UINT_FAST16_MAX UINT16_MAX -#define UINT_FAST32_MAX UINT32_MAX -#define UINT_FAST64_MAX UINT64_MAX - -// 7.18.2.4 Limits of integer types capable of holding object pointers -#ifdef _WIN64 // [ -# define INTPTR_MIN INT64_MIN -# define INTPTR_MAX INT64_MAX -# define UINTPTR_MAX UINT64_MAX -#else // _WIN64 ][ -# define INTPTR_MIN INT32_MIN -# define INTPTR_MAX INT32_MAX -# define UINTPTR_MAX UINT32_MAX -#endif // _WIN64 ] - -// 7.18.2.5 Limits of greatest-width integer types -#define INTMAX_MIN INT64_MIN -#define INTMAX_MAX INT64_MAX -#define UINTMAX_MAX UINT64_MAX - -// 7.18.3 Limits of other integer types - -#ifdef _WIN64 // [ -# define PTRDIFF_MIN _I64_MIN -# define PTRDIFF_MAX _I64_MAX -#else // _WIN64 ][ -# define PTRDIFF_MIN _I32_MIN -# define PTRDIFF_MAX _I32_MAX -#endif // _WIN64 ] - -#define SIG_ATOMIC_MIN INT_MIN -#define SIG_ATOMIC_MAX INT_MAX - -#ifndef SIZE_MAX // [ -# ifdef _WIN64 // [ -# define SIZE_MAX _UI64_MAX -# else // _WIN64 ][ -# define SIZE_MAX _UI32_MAX -# endif // _WIN64 ] -#endif // SIZE_MAX ] - -// WCHAR_MIN and WCHAR_MAX are also defined in -#ifndef WCHAR_MIN // [ -# define WCHAR_MIN 0 -#endif // WCHAR_MIN ] -#ifndef WCHAR_MAX // [ -# define WCHAR_MAX _UI16_MAX -#endif // WCHAR_MAX ] - -#define WINT_MIN 0 -#define WINT_MAX _UI16_MAX - -#endif // __STDC_LIMIT_MACROS ] - - -// 7.18.4 Limits of other integer types - -#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260 - -// 7.18.4.1 Macros for minimum-width integer constants - -#define INT8_C(val) val##i8 -#define INT16_C(val) val##i16 -#define INT32_C(val) val##i32 -#define INT64_C(val) val##i64 - -#define UINT8_C(val) val##ui8 -#define UINT16_C(val) val##ui16 -#define UINT32_C(val) val##ui32 -#define UINT64_C(val) val##ui64 - -// 7.18.4.2 Macros for greatest-width integer constants -#define INTMAX_C INT64_C -#define UINTMAX_C UINT64_C - -#endif // __STDC_CONSTANT_MACROS ] - - -#endif // _MSC_STDINT_H_ ] diff --git a/libs/bsdl_parser/CMakeLists.txt b/libs/bsdl_parser/CMakeLists.txt new file mode 100644 index 0000000..b41df43 --- /dev/null +++ b/libs/bsdl_parser/CMakeLists.txt @@ -0,0 +1,7 @@ +set(SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") + +file(GLOB_RECURSE ALL_SOURCES "*.c") + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) + +add_library(bsdl_parser ${ALL_SOURCES}) diff --git a/lib_jtag_core/bsdl_parser/bsdl_loader.c b/libs/bsdl_parser/bsdl_loader.c similarity index 94% rename from lib_jtag_core/bsdl_parser/bsdl_loader.c rename to libs/bsdl_parser/bsdl_loader.c index 4f32909..46f966c 100644 --- a/lib_jtag_core/bsdl_parser/bsdl_loader.c +++ b/libs/bsdl_parser/bsdl_loader.c @@ -29,18 +29,18 @@ #include #include -#include "../drivers/drv_loader.h" -#include "../jtag_core_internal.h" -#include "../jtag_core.h" +#include "drivers/drv_loader.h" +#include "lib_jtag_core/jtag_core_internal.h" +#include "lib_jtag_core/jtag_core.h" #include "bsdl_loader.h" #include "bsdl_strings.h" -#include "../natsort/strnatcmp.h" +#include "natsort/strnatcmp.h" -#include "../os_interface/os_interface.h" +#include "os_interface/os_interface.h" -#include "../dbg_logs.h" +#include "lib_jtag_core/dbg_logs.h" #define DEBUG 1 char *string_upper(char *str) diff --git a/lib_jtag_core/bsdl_parser/bsdl_loader.h b/libs/bsdl_parser/bsdl_loader.h similarity index 100% rename from lib_jtag_core/bsdl_parser/bsdl_loader.h rename to libs/bsdl_parser/bsdl_loader.h diff --git a/lib_jtag_core/bsdl_parser/bsdl_strings.c b/libs/bsdl_parser/bsdl_strings.c similarity index 90% rename from lib_jtag_core/bsdl_parser/bsdl_strings.c rename to libs/bsdl_parser/bsdl_strings.c index a3667b9..9a09e75 100644 --- a/lib_jtag_core/bsdl_parser/bsdl_strings.c +++ b/libs/bsdl_parser/bsdl_strings.c @@ -25,9 +25,9 @@ #include -#include "../drivers/drv_loader.h" -#include "../jtag_core_internal.h" -#include "../jtag_core.h" +#include "drivers/drv_loader.h" +#include "lib_jtag_core/jtag_core_internal.h" +#include "lib_jtag_core/jtag_core.h" #include "bsdl_loader.h" #include "bsdl_strings.h" diff --git a/lib_jtag_core/bsdl_parser/bsdl_strings.h b/libs/bsdl_parser/bsdl_strings.h similarity index 100% rename from lib_jtag_core/bsdl_parser/bsdl_strings.h rename to libs/bsdl_parser/bsdl_strings.h diff --git a/libs/bus_over_jtag/CMakeLists.txt b/libs/bus_over_jtag/CMakeLists.txt new file mode 100644 index 0000000..478a892 --- /dev/null +++ b/libs/bus_over_jtag/CMakeLists.txt @@ -0,0 +1,7 @@ +set(SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") + +file(GLOB_RECURSE ALL_SOURCES "*.c") + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) + +add_library(bus_over_jtag ${ALL_SOURCES}) diff --git a/lib_jtag_core/bus_over_jtag/i2c_over_jtag.c b/libs/bus_over_jtag/i2c_over_jtag.c similarity index 93% rename from lib_jtag_core/bus_over_jtag/i2c_over_jtag.c rename to libs/bus_over_jtag/i2c_over_jtag.c index 028ec22..b0aadd3 100644 --- a/lib_jtag_core/bus_over_jtag/i2c_over_jtag.c +++ b/libs/bus_over_jtag/i2c_over_jtag.c @@ -27,15 +27,15 @@ #include #include -#include "../drivers/drv_loader.h" -#include "../jtag_core_internal.h" -#include "../jtag_core.h" +#include "drivers/drv_loader.h" +#include "lib_jtag_core/jtag_core_internal.h" +#include "lib_jtag_core/jtag_core.h" -#include "../bsdl_parser/bsdl_loader.h" +#include "bsdl_parser/bsdl_loader.h" -#include "../drivers/drivers_list.h" +#include "drivers/drivers_list.h" -#include "../dbg_logs.h" +#include "lib_jtag_core/dbg_logs.h" ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // I2C Over JTAG API diff --git a/lib_jtag_core/bus_over_jtag/mdio_over_jtag.c b/libs/bus_over_jtag/mdio_over_jtag.c similarity index 92% rename from lib_jtag_core/bus_over_jtag/mdio_over_jtag.c rename to libs/bus_over_jtag/mdio_over_jtag.c index 587a4db..b20e091 100644 --- a/lib_jtag_core/bus_over_jtag/mdio_over_jtag.c +++ b/libs/bus_over_jtag/mdio_over_jtag.c @@ -27,14 +27,14 @@ #include #include -#include "../drivers/drv_loader.h" +#include "drivers/drv_loader.h" -#include "../jtag_core_internal.h" -#include "../jtag_core.h" +#include "lib_jtag_core/jtag_core_internal.h" +#include "lib_jtag_core/jtag_core.h" -#include "../bsdl_parser/bsdl_loader.h" +#include "bsdl_parser/bsdl_loader.h" -#include "../drivers/drivers_list.h" +#include "drivers/drivers_list.h" ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // MDIO Over JTAG API diff --git a/lib_jtag_core/bus_over_jtag/memory_over_jtag.c b/libs/bus_over_jtag/memory_over_jtag.c similarity index 94% rename from lib_jtag_core/bus_over_jtag/memory_over_jtag.c rename to libs/bus_over_jtag/memory_over_jtag.c index bbc3a2b..1593399 100644 --- a/lib_jtag_core/bus_over_jtag/memory_over_jtag.c +++ b/libs/bus_over_jtag/memory_over_jtag.c @@ -27,14 +27,14 @@ #include #include -#include "../drivers/drv_loader.h" +#include "drivers/drv_loader.h" -#include "../jtag_core_internal.h" -#include "../jtag_core.h" +#include "lib_jtag_core/jtag_core_internal.h" +#include "lib_jtag_core/jtag_core.h" -#include "../bsdl_parser/bsdl_loader.h" +#include "bsdl_parser/bsdl_loader.h" -#include "../drivers/drivers_list.h" +#include "drivers/drivers_list.h" ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Memory Over JTAG API diff --git a/lib_jtag_core/bus_over_jtag/spi_over_jtag.c b/libs/bus_over_jtag/spi_over_jtag.c similarity index 94% rename from lib_jtag_core/bus_over_jtag/spi_over_jtag.c rename to libs/bus_over_jtag/spi_over_jtag.c index 5df3188..077086d 100644 --- a/lib_jtag_core/bus_over_jtag/spi_over_jtag.c +++ b/libs/bus_over_jtag/spi_over_jtag.c @@ -27,14 +27,14 @@ #include #include -#include "../drivers/drv_loader.h" +#include "drivers/drv_loader.h" -#include "../jtag_core_internal.h" -#include "../jtag_core.h" +#include "lib_jtag_core/jtag_core_internal.h" +#include "lib_jtag_core/jtag_core.h" -#include "../bsdl_parser/bsdl_loader.h" +#include "bsdl_parser/bsdl_loader.h" -#include "../drivers/drivers_list.h" +#include "drivers/drivers_list.h" ////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // SPI Over JTAG API diff --git a/lib_jtag_core/config.script b/libs/config/config.script similarity index 100% rename from lib_jtag_core/config.script rename to libs/config/config.script diff --git a/lib_jtag_core/config_script.h b/libs/config/config_script.h similarity index 100% rename from lib_jtag_core/config_script.h rename to libs/config/config_script.h diff --git a/libs/drivers/CMakeLists.txt b/libs/drivers/CMakeLists.txt new file mode 100644 index 0000000..0a7548d --- /dev/null +++ b/libs/drivers/CMakeLists.txt @@ -0,0 +1,10 @@ +set(SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") + +file(GLOB MAIN_SOURCES "*.c") +file(GLOB_RECURSE JLINK_SOURCES "jlink_jtag/*.c") +file(GLOB_RECURSE FTDI_SOURCES "ftdi_jtag/*.c") +file(GLOB_RECURSE GPIO_SOURCES "linux_gpio_jtag/*.c") + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) + +add_library(drivers ${MAIN_SOURCES} ${FTDI_SOURCES} ${GPIO_SOURCES} ${JLINK_SOURCES}) diff --git a/lib_jtag_core/drivers/drivers_list.c b/libs/drivers/drivers_list.c similarity index 90% rename from lib_jtag_core/drivers/drivers_list.c rename to libs/drivers/drivers_list.c index 64c5a52..5fbd223 100644 --- a/lib_jtag_core/drivers/drivers_list.c +++ b/libs/drivers/drivers_list.c @@ -25,10 +25,10 @@ #include "drv_loader.h" -#include "../jtag_core_internal.h" -#include "../jtag_core.h" +#include "lib_jtag_core/jtag_core_internal.h" +#include "lib_jtag_core/jtag_core.h" -#include "../bsdl_parser/bsdl_loader.h" +#include "bsdl_parser/bsdl_loader.h" #ifdef WIN32 #include "./lpt_jtag/lpt_jtag_drv.h" diff --git a/lib_jtag_core/drivers/drivers_list.h b/libs/drivers/drivers_list.h similarity index 100% rename from lib_jtag_core/drivers/drivers_list.h rename to libs/drivers/drivers_list.h diff --git a/lib_jtag_core/drivers/drv_loader.c b/libs/drivers/drv_loader.c similarity index 90% rename from lib_jtag_core/drivers/drv_loader.c rename to libs/drivers/drv_loader.c index d555575..82a0d40 100644 --- a/lib_jtag_core/drivers/drv_loader.c +++ b/libs/drivers/drv_loader.c @@ -28,14 +28,14 @@ #include "drv_loader.h" -#include "../jtag_core_internal.h" -#include "../jtag_core.h" +#include "lib_jtag_core/jtag_core_internal.h" +#include "lib_jtag_core/jtag_core.h" -#include "../bsdl_parser/bsdl_loader.h" +#include "bsdl_parser/bsdl_loader.h" #include "drivers_list.h" -#include "../dbg_logs.h" +#include "lib_jtag_core/dbg_logs.h" int GetDrvInfo(void * jc_ctx,unsigned long infotype,void * returnvalue,const char * drv_id,const char * drv_desc,drv_ptr * drv_func) { diff --git a/lib_jtag_core/drivers/drv_loader.h b/libs/drivers/drv_loader.h similarity index 100% rename from lib_jtag_core/drivers/drv_loader.h rename to libs/drivers/drv_loader.h diff --git a/lib_jtag_core/drivers/ftdi_jtag/ftdi_jtag_drv.c b/libs/drivers/ftdi_jtag/ftdi_jtag_drv.c similarity index 95% rename from lib_jtag_core/drivers/ftdi_jtag/ftdi_jtag_drv.c rename to libs/drivers/ftdi_jtag/ftdi_jtag_drv.c index c4468c1..03640a6 100644 --- a/lib_jtag_core/drivers/ftdi_jtag/ftdi_jtag_drv.c +++ b/libs/drivers/ftdi_jtag/ftdi_jtag_drv.c @@ -32,11 +32,11 @@ #endif #include "../drv_loader.h" -#include "../../jtag_core_internal.h" -#include "../../jtag_core.h" -#include "../../bsdl_parser/bsdl_loader.h" -#include "../../dbg_logs.h" -#include "../../os_interface/os_interface.h" +#include "lib_jtag_core/jtag_core_internal.h" +#include "lib_jtag_core/jtag_core.h" +#include "bsdl_parser/bsdl_loader.h" +#include "lib_jtag_core/dbg_logs.h" +#include "os_interface/os_interface.h" #ifdef __cplusplus extern "C" { diff --git a/lib_jtag_core/drivers/ftdi_jtag/ftdi_jtag_drv.h b/libs/drivers/ftdi_jtag/ftdi_jtag_drv.h similarity index 100% rename from lib_jtag_core/drivers/ftdi_jtag/ftdi_jtag_drv.h rename to libs/drivers/ftdi_jtag/ftdi_jtag_drv.h diff --git a/lib_jtag_core/drivers/jlink_jtag/jlink_jtag_drv.c b/libs/drivers/jlink_jtag/jlink_jtag_drv.c similarity index 94% rename from lib_jtag_core/drivers/jlink_jtag/jlink_jtag_drv.c rename to libs/drivers/jlink_jtag/jlink_jtag_drv.c index 3cff8b8..b4c6144 100644 --- a/lib_jtag_core/drivers/jlink_jtag/jlink_jtag_drv.c +++ b/libs/drivers/jlink_jtag/jlink_jtag_drv.c @@ -26,12 +26,12 @@ #include #include #include "../drv_loader.h" -#include "../../jtag_core_internal.h" -#include "../../jtag_core.h" +#include "lib_jtag_core/jtag_core_internal.h" +#include "lib_jtag_core/jtag_core.h" -#include "../../bsdl_parser/bsdl_loader.h" +#include "bsdl_parser/bsdl_loader.h" -#include "../../dbg_logs.h" +#include "lib_jtag_core/dbg_logs.h" #if defined(WIN32) // Compiling on Windows diff --git a/lib_jtag_core/drivers/jlink_jtag/jlink_jtag_drv.h b/libs/drivers/jlink_jtag/jlink_jtag_drv.h similarity index 100% rename from lib_jtag_core/drivers/jlink_jtag/jlink_jtag_drv.h rename to libs/drivers/jlink_jtag/jlink_jtag_drv.h diff --git a/lib_jtag_core/drivers/linux_gpio_jtag/linux_gpio_jtag_drv.c b/libs/drivers/linux_gpio_jtag/linux_gpio_jtag_drv.c similarity index 93% rename from lib_jtag_core/drivers/linux_gpio_jtag/linux_gpio_jtag_drv.c rename to libs/drivers/linux_gpio_jtag/linux_gpio_jtag_drv.c index 9c67588..b9d14de 100644 --- a/lib_jtag_core/drivers/linux_gpio_jtag/linux_gpio_jtag_drv.c +++ b/libs/drivers/linux_gpio_jtag/linux_gpio_jtag_drv.c @@ -35,14 +35,14 @@ #endif #include "../drv_loader.h" -#include "../../jtag_core_internal.h" -#include "../../jtag_core.h" +#include "lib_jtag_core/jtag_core_internal.h" +#include "lib_jtag_core/jtag_core.h" -#include "../../bsdl_parser/bsdl_loader.h" +#include "bsdl_parser/bsdl_loader.h" -#include "../../os_interface/os_interface.h" +#include "os_interface/os_interface.h" -#include "../../dbg_logs.h" +#include "lib_jtag_core/dbg_logs.h" char linux_gpio_base[512]; diff --git a/lib_jtag_core/drivers/linux_gpio_jtag/linux_gpio_jtag_drv.h b/libs/drivers/linux_gpio_jtag/linux_gpio_jtag_drv.h similarity index 100% rename from lib_jtag_core/drivers/linux_gpio_jtag/linux_gpio_jtag_drv.h rename to libs/drivers/linux_gpio_jtag/linux_gpio_jtag_drv.h diff --git a/lib_jtag_core/drivers/lpt_jtag/lpt_jtag_drv.c b/libs/drivers/lpt_jtag/lpt_jtag_drv.c similarity index 93% rename from lib_jtag_core/drivers/lpt_jtag/lpt_jtag_drv.c rename to libs/drivers/lpt_jtag/lpt_jtag_drv.c index d6b4489..d2c5d4c 100644 --- a/lib_jtag_core/drivers/lpt_jtag/lpt_jtag_drv.c +++ b/libs/drivers/lpt_jtag/lpt_jtag_drv.c @@ -33,12 +33,12 @@ #endif #include "../drv_loader.h" -#include "../../jtag_core_internal.h" -#include "../../jtag_core.h" +#include "lib_jtag_core/jtag_core_internal.h" +#include "lib_jtag_core/jtag_core.h" -#include "../../bsdl_parser/bsdl_loader.h" +#include "bsdl_parser/bsdl_loader.h" -#include "../../dbg_logs.h" +#include "lib_jtag_core/dbg_logs.h" #if defined(WIN32) diff --git a/lib_jtag_core/drivers/lpt_jtag/lpt_jtag_drv.h b/libs/drivers/lpt_jtag/lpt_jtag_drv.h similarity index 100% rename from lib_jtag_core/drivers/lpt_jtag/lpt_jtag_drv.h rename to libs/drivers/lpt_jtag/lpt_jtag_drv.h diff --git a/lib_jtag_core/CMakeLists.txt b/libs/lib_jtag_core/CMakeLists.txt similarity index 63% rename from lib_jtag_core/CMakeLists.txt rename to libs/lib_jtag_core/CMakeLists.txt index e3a025b..ca3eb2f 100644 --- a/lib_jtag_core/CMakeLists.txt +++ b/libs/lib_jtag_core/CMakeLists.txt @@ -1,12 +1,13 @@ set(SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") -set(LIB_FTD2XXX "${CMAKE_CURRENT_SOURCE_DIR}/../libs/libftd2xx.a") +set(CONFIG_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../config/") +set(LIB_FTD2XXX "${CMAKE_CURRENT_SOURCE_DIR}/../libftd2xx/libftd2xx.a") file(GLOB_RECURSE ALL_SOURCES "*.c") # Custom command to be executed before the build add_custom_command( OUTPUT prebuild_command_done - COMMAND cd "${SOURCE_DIR}" && xxd -i config.script > config_script.h + COMMAND cd "${CONFIG_DIR}" && xxd -i config.script > config_script.h COMMENT "Generating the config script" VERBATIM ) @@ -20,11 +21,9 @@ add_custom_target( add_compile_definitions(FTD2XX_STATIC) add_compile_definitions(FTDILIB) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../libs) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) add_library(jtag_core ${ALL_SOURCES}) add_dependencies(jtag_core prebuild) -target_link_libraries(jtag_core PRIVATE ${LIB_FTD2XXX}) - -target_include_directories(jtag_core PUBLIC ${SOURCE_DIR}) \ No newline at end of file +target_link_libraries(jtag_core PRIVATE ${LIB_FTD2XXX}) \ No newline at end of file diff --git a/lib_jtag_core/COPYING.LESSER b/libs/lib_jtag_core/COPYING.LESSER similarity index 100% rename from lib_jtag_core/COPYING.LESSER rename to libs/lib_jtag_core/COPYING.LESSER diff --git a/libs/lib_jtag_core/config_script.h b/libs/lib_jtag_core/config_script.h new file mode 100644 index 0000000..e69de29 diff --git a/lib_jtag_core/dbg_logs.c b/libs/lib_jtag_core/dbg_logs.c similarity index 93% rename from lib_jtag_core/dbg_logs.c rename to libs/lib_jtag_core/dbg_logs.c index d62aa28..ec61a48 100644 --- a/lib_jtag_core/dbg_logs.c +++ b/libs/lib_jtag_core/dbg_logs.c @@ -29,11 +29,11 @@ #include #include -#include "./drivers/drv_loader.h" +#include "drivers/drv_loader.h" #include "jtag_core_internal.h" #include "jtag_core.h" -#include "./os_interface/os_interface.h" +#include "os_interface/os_interface.h" #include "dbg_logs.h" @@ -91,7 +91,7 @@ int jtagcore_set_logs_callback(jtag_core * jc, JTAGCORE_PRINT_FUNC jtag_core_pri if(jc) { jc->jtagcore_print_callback = jtag_core_print; - + return JTAG_CORE_NO_ERROR; } return JTAG_CORE_BAD_PARAMETER; diff --git a/lib_jtag_core/dbg_logs.h b/libs/lib_jtag_core/dbg_logs.h similarity index 100% rename from lib_jtag_core/dbg_logs.h rename to libs/lib_jtag_core/dbg_logs.h diff --git a/lib_jtag_core/jtag_core.c b/libs/lib_jtag_core/jtag_core.c similarity index 95% rename from lib_jtag_core/jtag_core.c rename to libs/lib_jtag_core/jtag_core.c index 82bdab4..f511357 100644 --- a/lib_jtag_core/jtag_core.c +++ b/libs/lib_jtag_core/jtag_core.c @@ -40,7 +40,7 @@ #include "drivers/drivers_list.h" -#include "config_script.h" +/* #include "config_script.h" */ jtag_core * jtagcore_init() { @@ -51,7 +51,7 @@ jtag_core * jtagcore_init() if ( jc ) { memset( jc, 0, sizeof(jtag_core) ); - +/* jc->envvar = (void*)initEnv(NULL, NULL); jtagcore_setEnvVar( jc, "LIBVERSION", "v"LIB_JTAG_CORE_VERSION); @@ -73,6 +73,7 @@ jtag_core * jtagcore_init() } jtagcore_deinitScript(sctx); +*/ } return jc; @@ -1106,7 +1107,7 @@ void jtagcore_deinit(jtag_core * jc) { if( jc ) { - deinitEnv( (envvar_entry *)jc->envvar ); +// deinitEnv( (envvar_entry *)jc->envvar ); free( jc ); } } diff --git a/lib_jtag_core/jtag_core.h b/libs/lib_jtag_core/jtag_core.h similarity index 97% rename from lib_jtag_core/jtag_core.h rename to libs/lib_jtag_core/jtag_core.h index f02e48b..4bc4881 100644 --- a/lib_jtag_core/jtag_core.h +++ b/libs/lib_jtag_core/jtag_core.h @@ -291,7 +291,6 @@ int jtagcore_memory_write(jtag_core * jc, int mem_adr, unsigned long data); ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Internal variables functions - int jtagcore_setEnvVar( jtag_core * jc, char * varname, char * varvalue ); char * jtagcore_getEnvVar( jtag_core * jc, char * varname, char * varvalue); int jtagcore_getEnvVarValue( jtag_core * jc, char * varname); @@ -332,6 +331,7 @@ int jtagcore_savePinsStateScript( jtag_core * jc, int device, char * script_path ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // JTAG Emulation layer (WIP) +#if 0 jtag_emu * jtagemu_init(jtag_core * jc); int jtagemu_reset(jtag_emu * je); @@ -343,5 +343,6 @@ int jtagemu_get_regbit_state(jtag_emu * je, int regid, int bit); int jtagemu_loadbsdlfile(jtag_emu * je, char * path, int device); void jtagemu_deinit(jtag_emu * je); +#endif #endif \ No newline at end of file diff --git a/lib_jtag_core/jtag_core_internal.h b/libs/lib_jtag_core/jtag_core_internal.h similarity index 100% rename from lib_jtag_core/jtag_core_internal.h rename to libs/lib_jtag_core/jtag_core_internal.h diff --git a/lib_jtag_core/version.h b/libs/lib_jtag_core/version.h similarity index 100% rename from lib_jtag_core/version.h rename to libs/lib_jtag_core/version.h diff --git a/libs/WinTypes.h b/libs/libftd2xx/WinTypes.h similarity index 100% rename from libs/WinTypes.h rename to libs/libftd2xx/WinTypes.h diff --git a/libs/ftd2xx.h b/libs/libftd2xx/ftd2xx.h similarity index 100% rename from libs/ftd2xx.h rename to libs/libftd2xx/ftd2xx.h diff --git a/libs/libftd2xx.a b/libs/libftd2xx/libftd2xx.a similarity index 100% rename from libs/libftd2xx.a rename to libs/libftd2xx/libftd2xx.a diff --git a/libs/natsort/CMakeLists.txt b/libs/natsort/CMakeLists.txt new file mode 100644 index 0000000..1112df4 --- /dev/null +++ b/libs/natsort/CMakeLists.txt @@ -0,0 +1,5 @@ +set(SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") + +file(GLOB_RECURSE ALL_SOURCES "*.c") + +add_library(natsort ${ALL_SOURCES}) diff --git a/lib_jtag_core/natsort/strnatcmp.c b/libs/natsort/strnatcmp.c similarity index 100% rename from lib_jtag_core/natsort/strnatcmp.c rename to libs/natsort/strnatcmp.c diff --git a/lib_jtag_core/natsort/strnatcmp.h b/libs/natsort/strnatcmp.h similarity index 100% rename from lib_jtag_core/natsort/strnatcmp.h rename to libs/natsort/strnatcmp.h diff --git a/libs/os_interface/CMakeLists.txt b/libs/os_interface/CMakeLists.txt new file mode 100644 index 0000000..6a9a214 --- /dev/null +++ b/libs/os_interface/CMakeLists.txt @@ -0,0 +1,5 @@ +set(SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") + +file(GLOB_RECURSE ALL_SOURCES "*.c") + +add_library(os_interface ${ALL_SOURCES}) diff --git a/lib_jtag_core/os_interface/fs.c b/libs/os_interface/fs.c similarity index 93% rename from lib_jtag_core/os_interface/fs.c rename to libs/os_interface/fs.c index d0c5001..a330fe6 100644 --- a/lib_jtag_core/os_interface/fs.c +++ b/libs/os_interface/fs.c @@ -20,7 +20,7 @@ /** * @file fs.c * @brief Basic/generic OS file system functions wrapper. -* @author Jean-François DEL NERO +* @author Jean-Fran�ois DEL NERO */ #include @@ -52,8 +52,6 @@ #endif -#include "../jtag_core.h" - #include "os_interface.h" diff --git a/lib_jtag_core/os_interface/network.c b/libs/os_interface/network.c similarity index 99% rename from lib_jtag_core/os_interface/network.c rename to libs/os_interface/network.c index ecd8dfb..7ad3903 100644 --- a/lib_jtag_core/os_interface/network.c +++ b/libs/os_interface/network.c @@ -63,7 +63,6 @@ typedef struct sockaddr SOCKADDR; #endif -#include "../jtag_core.h" #include "network.h" #include "os_interface.h" diff --git a/lib_jtag_core/os_interface/network.h b/libs/os_interface/network.h similarity index 100% rename from lib_jtag_core/os_interface/network.h rename to libs/os_interface/network.h diff --git a/lib_jtag_core/os_interface/os_interface.c b/libs/os_interface/os_interface.c similarity index 67% rename from lib_jtag_core/os_interface/os_interface.c rename to libs/os_interface/os_interface.c index 898cd8f..bf2eba5 100644 --- a/lib_jtag_core/os_interface/os_interface.c +++ b/libs/os_interface/os_interface.c @@ -20,7 +20,7 @@ /** * @file os_interface.c * @brief Basic/generic OS functions wrapper. -* @author Jean-François DEL NERO +* @author Jean-Fran�ois DEL NERO */ #include @@ -33,66 +33,27 @@ #include #include -#ifdef WIN32 - #include - #include -#else - #include - #include - #include -#endif +#include +#include +#include #include #include -#include "../drivers/drv_loader.h" -#include "../jtag_core_internal.h" -#include "../script/script.h" -#include "../jtag_core.h" - #include "os_interface.h" -#ifdef WIN32 - HANDLE eventtab[256]; - CRITICAL_SECTION criticalsectiontab[256]; -#else - typedef struct _EVENT_HANDLE{ - pthread_cond_t eCondVar; - pthread_mutex_t eMutex; - int iVar; - } EVENT_HANDLE; +typedef struct _EVENT_HANDLE{ + pthread_cond_t eCondVar; + pthread_mutex_t eMutex; + int iVar; +} EVENT_HANDLE; - EVENT_HANDLE * eventtab[256]; +EVENT_HANDLE * eventtab[256]; - pthread_mutex_t criticalsectiontab[256]; -#endif +pthread_mutex_t criticalsectiontab[256]; -#ifdef WIN32 - -DWORD WINAPI ThreadProc( LPVOID lpParameter) -{ - threadinit *threadinitptr; - THREADFUNCTION thread; - jtag_core* jtag_ctx; - void * hw_context; - - if( lpParameter ) - { - //SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL); - - threadinitptr=(threadinit*)lpParameter; - thread=threadinitptr->thread; - jtag_ctx = threadinitptr->jtag_ctx; - hw_context=threadinitptr->hwcontext; - thread(jtag_ctx,hw_context); - - free(threadinitptr); - } - - return 0; -} -#else +#if 0 void * ThreadProc( void *lpParameter) { threadinit *threadinitptr; @@ -116,52 +77,24 @@ void * ThreadProc( void *lpParameter) } #endif -int genos_setevent(jtag_core* jtag_ctx,unsigned char id) +int genos_setevent(unsigned char id) { -#ifdef WIN32 - SetEvent(eventtab[id]); -#else pthread_mutex_lock(&eventtab[id]->eMutex); pthread_cond_signal(&eventtab[id]->eCondVar); pthread_mutex_unlock(&eventtab[id]->eMutex); -#endif return 0; } -uintptr_t genos_createevent(jtag_core* jtag_ctx,unsigned char id) +uintptr_t genos_createevent(unsigned char id) { -#ifdef WIN32 - - eventtab[id] = CreateEvent(NULL,FALSE,FALSE,NULL); - return (uintptr_t)eventtab[id]; - -#else - eventtab[id]=(EVENT_HANDLE*)malloc(sizeof(EVENT_HANDLE)); pthread_mutex_init(&eventtab[id]->eMutex, NULL); pthread_cond_init(&eventtab[id]->eCondVar, NULL); return (uintptr_t)eventtab[id]; -#endif } -int genos_waitevent(jtag_core* jtag_ctx,int id,int timeout) +int genos_waitevent(int id,int timeout) { - -#ifdef WIN32 - int ret; - - if(timeout==0) timeout=INFINITE; - ret=WaitForSingleObject(eventtab[id],timeout); - - if(ret==0) - { - return 0; - } - else - { - return 1; - } -#else struct timeval now; struct timespec timeoutstr; int retcode; @@ -183,17 +116,10 @@ int genos_waitevent(jtag_core* jtag_ctx,int id,int timeout) pthread_mutex_unlock(&eventtab[id]->eMutex); return 0; } -#endif } -uintptr_t genos_createcriticalsection(jtag_core* jtag_ctx,unsigned char id) +uintptr_t genos_createcriticalsection(unsigned char id) { -#ifdef WIN32 - - InitializeCriticalSection(&criticalsectiontab[id]); - return (uintptr_t)&criticalsectiontab[id]; - -#else //create mutex attribute variable pthread_mutexattr_t mAttr; @@ -212,11 +138,10 @@ uintptr_t genos_createcriticalsection(jtag_core* jtag_ctx,unsigned char id) pthread_mutexattr_destroy(&mAttr); return (uintptr_t)&criticalsectiontab[id]; -#endif } -void genos_entercriticalsection(jtag_core* jtag_ctx,unsigned char id) +void genos_entercriticalsection(unsigned char id) { #ifdef WIN32 EnterCriticalSection( &criticalsectiontab[id] ); @@ -225,7 +150,7 @@ void genos_entercriticalsection(jtag_core* jtag_ctx,unsigned char id) #endif } -void genos_leavecriticalsection(jtag_core* jtag_ctx,unsigned char id) +void genos_leavecriticalsection(unsigned char id) { #ifdef WIN32 LeaveCriticalSection( &criticalsectiontab[id] ); @@ -234,7 +159,7 @@ void genos_leavecriticalsection(jtag_core* jtag_ctx,unsigned char id) #endif } -void genos_destroycriticalsection(jtag_core* jtag_ctx,unsigned char id) +void genos_destroycriticalsection(unsigned char id) { #ifdef WIN32 DeleteCriticalSection(&criticalsectiontab[id]); @@ -244,7 +169,6 @@ void genos_destroycriticalsection(jtag_core* jtag_ctx,unsigned char id) } -#ifndef WIN32 void genos_msleep (unsigned int ms) { int microsecs; struct timeval tv; @@ -253,43 +177,15 @@ void genos_msleep (unsigned int ms) { tv.tv_usec = microsecs % 1000000; select (0, NULL, NULL, NULL, &tv); } -#endif void genos_pause(int ms) { -#ifdef WIN32 - Sleep(ms); -#else genos_msleep(ms); -#endif } -int genos_createthread(jtag_core* jtag_ctx,void* hwcontext,THREADFUNCTION thread,int priority) +#if 0 +int genos_createthread(void* hwcontext,THREADFUNCTION thread,int priority) { -#ifdef WIN32 - DWORD sit; - HANDLE thread_handle; - threadinit *threadinitptr; - - sit = 0; - - threadinitptr=(threadinit*)malloc(sizeof(threadinit)); - if( threadinitptr ) - { - threadinitptr->thread = thread; - threadinitptr->jtag_ctx = jtag_ctx; - threadinitptr->hwcontext = hwcontext; - - thread_handle = CreateThread(NULL,8*1024,&ThreadProc,threadinitptr,0,&sit); - - if(!thread_handle) - { - free(threadinitptr); - // jtag_ctx->jtagcore_print_callback(MSG_ERROR,"genos_createthread : CreateThread failed -> 0x.8X", GetLastError()); - } - } - return sit; -#else unsigned long sit; int ret; pthread_t threadid; @@ -339,22 +235,7 @@ int genos_createthread(jtag_core* jtag_ctx,void* hwcontext,THREADFUNCTION thread } return sit; -#endif - } - -#ifndef WIN32 -/*void strlwr(char *string) -{ - int i; - - i=0; - while (string[i]) - { - string[i] = tolower(string[i]); - i++; - } -}*/ #endif char * genos_strupper(char * str) @@ -603,45 +484,6 @@ int genos_getfilesize(char * path) return filesize; } -#ifdef WIN32 - -#if defined(_MSC_VER) && _MSC_VER < 1900 - -#define va_copy(dest, src) (dest = src) - -int vsnprintf(char *s, size_t n, const char *fmt, va_list ap) -{ - int ret; - va_list ap_copy; - - if (n == 0) - return 0; - else if (n > INT_MAX) - return 0; - memset(s, 0, n); - va_copy(ap_copy, ap); - ret = _vsnprintf(s, n - 1, fmt, ap_copy); - va_end(ap_copy); - - return ret; -} - -int snprintf(char *s, size_t n, const char *fmt, ...) -{ - va_list ap; - int ret; - - va_start(ap, fmt); - ret = vsnprintf(s, n, fmt, ap); - va_end(ap); - - return ret; -} - -#endif - -#endif - char * genos_strndstcat( char *dest, const char *src, size_t maxdestsize ) { int i,j; diff --git a/lib_jtag_core/os_interface/os_interface.h b/libs/os_interface/os_interface.h similarity index 77% rename from lib_jtag_core/os_interface/os_interface.h rename to libs/os_interface/os_interface.h index 309d612..2253bd1 100644 --- a/lib_jtag_core/os_interface/os_interface.h +++ b/libs/os_interface/os_interface.h @@ -26,21 +26,13 @@ extern "C" { #endif -#ifdef WIN32 -#define DIR_SEPARATOR "\\" -#define DIR_SEPARATOR_CHAR '\\' -#if defined(_MSC_VER) && _MSC_VER < 1900 -int snprintf(char *outBuf, size_t size, const char *format, ...); -#endif -#else #define DIR_SEPARATOR "/" #define DIR_SEPARATOR_CHAR '/' -#endif - #define FILEFOUND_NAMESIZE 256 /////////////// Thread functions //////////////// +#if 0 typedef int (*THREADFUNCTION) (void* jtag_ctx,void* hw_ctx); typedef struct threadinit_ @@ -49,6 +41,7 @@ typedef struct threadinit_ jtag_core * jtag_ctx; void * hwcontext; }threadinit; +#endif typedef struct filefoundinfo_ { @@ -57,22 +50,21 @@ typedef struct filefoundinfo_ int size; }filefoundinfo; -int genos_setevent( jtag_core* jtag_ctx, unsigned char id ); -uintptr_t genos_createevent( jtag_core* jtag_ctx, unsigned char id ); -int genos_waitevent( jtag_core* jtag_ctx, int id, int timeout ); +int genos_setevent(unsigned char id ); +uintptr_t genos_createevent(unsigned char id ); +int genos_waitevent(int id, int timeout ); void genos_pause( int ms ); -int genos_createthread( jtag_core* jtag_ctx, void* hwcontext, THREADFUNCTION thread, int priority ); +#if 0 +int genos_createthread(void* hwcontext, THREADFUNCTION thread, int priority ); +#endif -uintptr_t genos_createcriticalsection( jtag_core* jtag_ctx, unsigned char id ); -void genos_entercriticalsection( jtag_core* jtag_ctx, unsigned char id ); -void genos_leavecriticalsection( jtag_core* jtag_ctx, unsigned char id ); -void genos_destroycriticalsection( jtag_core* jtag_ctx, unsigned char id ); +uintptr_t genos_createcriticalsection(unsigned char id ); +void genos_entercriticalsection(unsigned char id ); +void genos_leavecriticalsection(unsigned char id ); +void genos_destroycriticalsection(unsigned char id ); /////////////// String functions /////////////// -#ifndef WIN32 -//void strlwr(char *string) -#endif char * genos_strupper( char * str ); char * genos_strlower( char * str ); char * genos_strndstcat( char *dest, const char *src, size_t maxdestsize ); diff --git a/libs/script/CMakeLists.txt b/libs/script/CMakeLists.txt new file mode 100644 index 0000000..404de25 --- /dev/null +++ b/libs/script/CMakeLists.txt @@ -0,0 +1,7 @@ +set(SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") + +file(GLOB_RECURSE ALL_SOURCES "*.c") + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..) + +add_library(script ${ALL_SOURCES}) diff --git a/lib_jtag_core/script/env.c b/libs/script/env.c similarity index 100% rename from lib_jtag_core/script/env.c rename to libs/script/env.c diff --git a/lib_jtag_core/script/env.h b/libs/script/env.h similarity index 100% rename from lib_jtag_core/script/env.h rename to libs/script/env.h diff --git a/lib_jtag_core/script/script.c b/libs/script/script.c similarity index 95% rename from lib_jtag_core/script/script.c rename to libs/script/script.c index 0c14188..34b672b 100644 --- a/lib_jtag_core/script/script.c +++ b/libs/script/script.c @@ -31,14 +31,14 @@ #define MAX_PATH 256 -#include "../drivers/drv_loader.h" -#include "../jtag_core_internal.h" +#include "drivers/drv_loader.h" +#include "lib_jtag_core/jtag_core_internal.h" #include "script.h" -#include "../jtag_core.h" -#include "../version.h" +#include "lib_jtag_core/jtag_core.h" +#include "lib_jtag_core/version.h" -#include "../bsdl_parser/bsdl_loader.h" -#include "../os_interface/os_interface.h" +#include "bsdl_parser/bsdl_loader.h" +#include "os_interface/os_interface.h" #include "env.h" diff --git a/lib_jtag_core/script/script.h b/libs/script/script.h similarity index 100% rename from lib_jtag_core/script/script.h rename to libs/script/script.h