dirs refactoring

This commit is contained in:
2025-02-16 11:27:46 +01:00
parent 5ddc9fe9b4
commit 054165ed84
65 changed files with 182 additions and 709 deletions

13
.vscode/settings.json vendored Normal file
View File

@@ -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"
}
}

View File

@@ -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)

View File

@@ -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
)

View File

@@ -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[];

View File

@@ -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[]);

View File

@@ -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[]);

View File

@@ -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[];

View File

@@ -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;

View File

@@ -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[];

View File

@@ -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

View File

@@ -5,7 +5,7 @@
#include <readline/readline.h>
#include <readline/history.h>
#include "jtag_core.h"
#include "lib_jtag_core/jtag_core.h"
#include "common.h"
#include "args.h"

View File

@@ -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

View File

@@ -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

View File

@@ -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 <limits.h>
// For Visual Studio 6 in C++ mode and for many Visual Studio versions when
// compiling for ARM we should wrap <wchar.h> 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 <wchar.h>
#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 <wchar.h>
#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_ ]

View File

@@ -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})

View File

@@ -29,18 +29,18 @@
#include <stdlib.h>
#include <string.h>
#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)

View File

@@ -25,9 +25,9 @@
#include <string.h>
#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"

View File

@@ -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})

View File

@@ -27,15 +27,15 @@
#include <string.h>
#include <stdlib.h>
#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

View File

@@ -27,14 +27,14 @@
#include <string.h>
#include <stdlib.h>
#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

View File

@@ -27,14 +27,14 @@
#include <string.h>
#include <stdlib.h>
#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

View File

@@ -27,14 +27,14 @@
#include <string.h>
#include <stdlib.h>
#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

View File

@@ -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})

View File

@@ -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"

View File

@@ -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)
{

View File

@@ -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" {

View File

@@ -26,12 +26,12 @@
#include <stdio.h>
#include <string.h>
#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

View File

@@ -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];

View File

@@ -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)

View File

@@ -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})
target_link_libraries(jtag_core PRIVATE ${LIB_FTD2XXX})

View File

View File

@@ -29,11 +29,11 @@
#include <stdlib.h>
#include <stdarg.h>
#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;

View File

@@ -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 );
}
}

View File

@@ -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

View File

@@ -0,0 +1,5 @@
set(SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
file(GLOB_RECURSE ALL_SOURCES "*.c")
add_library(natsort ${ALL_SOURCES})

View File

@@ -0,0 +1,5 @@
set(SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
file(GLOB_RECURSE ALL_SOURCES "*.c")
add_library(os_interface ${ALL_SOURCES})

View File

@@ -20,7 +20,7 @@
/**
* @file fs.c
* @brief Basic/generic OS file system functions wrapper.
* @author Jean-François DEL NERO <Jean-Francois.DELNERO@viveris.fr>
* @author Jean-Fran<EFBFBD>ois DEL NERO <Jean-Francois.DELNERO@viveris.fr>
*/
#include <assert.h>
@@ -52,8 +52,6 @@
#endif
#include "../jtag_core.h"
#include "os_interface.h"

View File

@@ -63,7 +63,6 @@ typedef struct sockaddr SOCKADDR;
#endif
#include "../jtag_core.h"
#include "network.h"
#include "os_interface.h"

View File

@@ -20,7 +20,7 @@
/**
* @file os_interface.c
* @brief Basic/generic OS functions wrapper.
* @author Jean-François DEL NERO <Jean-Francois.DELNERO@viveris.fr>
* @author Jean-Fran<EFBFBD>ois DEL NERO <Jean-Francois.DELNERO@viveris.fr>
*/
#include <stdlib.h>
@@ -33,66 +33,27 @@
#include <stdlib.h>
#include <stdarg.h>
#ifdef WIN32
#include <windows.h>
#include <direct.h>
#else
#include <sys/time.h>
#include <pthread.h>
#include <sched.h>
#endif
#include <sys/time.h>
#include <pthread.h>
#include <sched.h>
#include <errno.h>
#include <stdint.h>
#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;

View File

@@ -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 );

View File

@@ -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})

View File

@@ -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"