diff --git a/CMakeLists.txt b/CMakeLists.txt index 73253f2..1825703 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.8.0) project(CanTp VERSION 0.1.0 LANGUAGES C) -set(AUTOSAR_STD_HEADER_PATH ${CMAKE_CURRENT_SOURCE_DIR}/test/stub CACHE FILEPATH +set(AUTOSAR_STD_HEADER_PATH ${CMAKE_CURRENT_SOURCE_DIR}/test/stub/common CACHE FILEPATH "path to directory containing Std_Types.h and ComStack_Types.h.") set(CANTP_CONFIG_FILEPATH ${CMAKE_CURRENT_SOURCE_DIR}/config/can_tp.json CACHE FILEPATH "path to configuration file used to generate post-build configuration.") @@ -21,7 +21,7 @@ if (${ENABLE_DOC_GEN}) set(DOXYGEN_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/doc) doxygen_add_docs(${PROJECT_NAME}.doc source interface COMMENT "generating CanTp documentation") -endif() +endif () add_subdirectory(extern) add_subdirectory(generated) @@ -44,7 +44,8 @@ target_compile_definitions(CanTp target_include_directories(CanTp PUBLIC interface - PUBLIC ${AUTOSAR_STD_HEADER_PATH}) + PUBLIC ${AUTOSAR_STD_HEADER_PATH} + PUBLIC $<$:${CMAKE_CURRENT_SOURCE_DIR}/test/stub>) if (${CANTP_ENABLE_TEST}) enable_testing() diff --git a/README.md b/README.md index 19a9cf1..395ccfa 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ The following definitions might be set by the user, depending on the needs. | definition | values | default | description | |:------------------------------|:---------------------------------|:-------------------------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| ```AUTOSAR_STD_HEADER_PATH``` | ```-``` | ```CanTp/test/stub``` | specifies the directory containing **AUTOSAR** standard headers ComStack_Types.h and Std_Types.h (used when integrating this module in an other project) | +| ```AUTOSAR_STD_HEADER_PATH``` | ```-``` | ```CanTp/test/stub/common``` | specifies the directory containing **AUTOSAR** standard headers ComStack_Types.h and Std_Types.h (used when integrating this module in an other project) | | ```CANTP_CONFIG_FILEPATH``` | ```-``` | ```CanTp/config/can_tp.json``` | specifies which json configuration file should be used to generate the auto-generated code | | ```CANTP_ENABLE_TEST``` | ```ON```/```OFF``` | ```OFF``` | enables/disables tests. if enabled, ```CANTP_BUILD_CFFI_INTERFACE``` preprocessor definition is set to ```STD_ON``` | | ```ENABLE_DET``` | ```ON```/```OFF``` | ```ON``` | enables/disables development error detections (see AUTOSAR [DET](https://www.autosar.org/fileadmin/user_upload/standards/classic/4-3/AUTOSAR_SWS_DefaultErrorTracer.pdf) module) | diff --git a/generated/CMakeLists.txt b/generated/CMakeLists.txt index a67d895..e63e6f3 100644 --- a/generated/CMakeLists.txt +++ b/generated/CMakeLists.txt @@ -22,7 +22,8 @@ add_library(CanTp_PBcfg STATIC ${CMAKE_CURRENT_SOURCE_DIR}/CanTp_PBcfg.c) target_include_directories(CanTp_PBcfg INTERFACE ${CMAKE_CURRENT_SOURCE_DIR} PRIVATE ${PROJECT_SOURCE_DIR}/interface - PRIVATE ${AUTOSAR_STD_HEADER_PATH}) + PRIVATE ${AUTOSAR_STD_HEADER_PATH} + PRIVATE $<$:${PROJECT_SOURCE_DIR}/test/stub>) if (${ENABLE_PC_LINT}) add_pc_lint_target(NAME CanTp_PBcfg diff --git a/test/stub/ComStack_Types.h b/test/stub/common/ComStack_Types.h similarity index 93% rename from test/stub/ComStack_Types.h rename to test/stub/common/ComStack_Types.h index 5e46759..a064cf9 100644 --- a/test/stub/ComStack_Types.h +++ b/test/stub/common/ComStack_Types.h @@ -1,74 +1,74 @@ -/** - * @file ComStack_Types.h - * @author Guillaume Sottas - * @date 06/12/2017 - */ - -#ifndef COMSTACK_TYPES_H -#define COMSTACK_TYPES_H - -#ifdef __cplusplus - -extern "C" { - -#endif /* ifdef __cplusplus */ - -#ifndef STD_TYPES_H -#include "Std_Types.h" -#endif /* #ifndef STD_TYPES_H */ - -typedef uint16 PduIdType; - -typedef uint32 PduLengthType; - -typedef uint8 NetworkHandleType; - -typedef uint8 IcomConfigIdType; - -typedef enum -{ - ICOM_SWITCH_E_OK = 0x00u, - ICOM_SWITCH_E_FAILED = 0x01u -} IcomSwitch_ErrorType; - -typedef enum -{ - TP_STMIN = 0x00u, - TP_BS = 0x01u, - TP_BC = 0x02u -} TPParameterType; - -typedef enum -{ - BUFREQ_OK = 0x00u, - BUFREQ_E_NOT_OK = 0x01u, - BUFREQ_E_BUSY = 0x02u, - BUFREQ_E_OVFL = 0x03u -} BufReq_ReturnType; - -typedef enum -{ - TP_DATACONF = 0x00u, - TP_DATARETRY = 0x01u, - TP_CONFPENDING = 0x02u -} TpDataStateType; - -typedef struct -{ - uint8 *SduDataPtr; - uint8 *MetaDataPtr; - PduLengthType SduLength; -} PduInfoType; - -typedef struct -{ - TpDataStateType TpDataState; - PduLengthType TxTpDataCnt; -} RetryInfoType; - -#ifdef __cplusplus -} - -#endif /* ifdef __cplusplus */ - -#endif /* #ifndef COMSTACK_TYPES_H */ +/** + * @file ComStack_Types.h + * @author Guillaume Sottas + * @date 06/12/2017 + */ + +#ifndef COMSTACK_TYPES_H +#define COMSTACK_TYPES_H + +#ifdef __cplusplus + +extern "C" { + +#endif /* ifdef __cplusplus */ + +#ifndef STD_TYPES_H +#include "Std_Types.h" +#endif /* #ifndef STD_TYPES_H */ + +typedef uint16 PduIdType; + +typedef uint32 PduLengthType; + +typedef uint8 NetworkHandleType; + +typedef uint8 IcomConfigIdType; + +typedef enum +{ + ICOM_SWITCH_E_OK = 0x00u, + ICOM_SWITCH_E_FAILED = 0x01u +} IcomSwitch_ErrorType; + +typedef enum +{ + TP_STMIN = 0x00u, + TP_BS = 0x01u, + TP_BC = 0x02u +} TPParameterType; + +typedef enum +{ + BUFREQ_OK = 0x00u, + BUFREQ_E_NOT_OK = 0x01u, + BUFREQ_E_BUSY = 0x02u, + BUFREQ_E_OVFL = 0x03u +} BufReq_ReturnType; + +typedef enum +{ + TP_DATACONF = 0x00u, + TP_DATARETRY = 0x01u, + TP_CONFPENDING = 0x02u +} TpDataStateType; + +typedef struct +{ + uint8 *SduDataPtr; + uint8 *MetaDataPtr; + PduLengthType SduLength; +} PduInfoType; + +typedef struct +{ + TpDataStateType TpDataState; + PduLengthType TxTpDataCnt; +} RetryInfoType; + +#ifdef __cplusplus +} + +#endif /* ifdef __cplusplus */ + +#endif /* #ifndef COMSTACK_TYPES_H */ diff --git a/test/stub/Compiler.h b/test/stub/common/Compiler.h similarity index 93% rename from test/stub/Compiler.h rename to test/stub/common/Compiler.h index fbefa63..7312999 100644 --- a/test/stub/Compiler.h +++ b/test/stub/common/Compiler.h @@ -1,27 +1,27 @@ -/** - * @file Compiler.h - * @author Guillaume Sottas - * @date 30/07/2019 - */ - -#ifndef COMPILER_H -#define COMPILER_H - -#ifdef __cplusplus - -extern "C" { - -#endif /* ifdef __cplusplus */ - -/* SWS_COMPILER_00057 -#define INLINE inline */ - -/* SWS_COMPILER_00060 */ -#define LOCAL_INLINE static inline - -#ifdef __cplusplus -} - -#endif /* ifdef __cplusplus */ - -#endif /* #ifndef COMPILER_H */ +/** + * @file Compiler.h + * @author Guillaume Sottas + * @date 30/07/2019 + */ + +#ifndef COMPILER_H +#define COMPILER_H + +#ifdef __cplusplus + +extern "C" { + +#endif /* ifdef __cplusplus */ + +/* SWS_COMPILER_00057 +#define INLINE inline */ + +/* SWS_COMPILER_00060 */ +#define LOCAL_INLINE static inline + +#ifdef __cplusplus +} + +#endif /* ifdef __cplusplus */ + +#endif /* #ifndef COMPILER_H */ diff --git a/test/stub/Platform_Types.h b/test/stub/common/Platform_Types.h similarity index 100% rename from test/stub/Platform_Types.h rename to test/stub/common/Platform_Types.h diff --git a/test/stub/Std_Types.h b/test/stub/common/Std_Types.h similarity index 100% rename from test/stub/Std_Types.h rename to test/stub/common/Std_Types.h