Skip to content

Commit

Permalink
move common autosar headers in common folder.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sauci committed Sep 24, 2019
1 parent 9da7261 commit f4f0ea5
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 106 deletions.
7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand All @@ -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)
Expand All @@ -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 $<$<BOOL:${CANTP_ENABLE_TEST}>:${CMAKE_CURRENT_SOURCE_DIR}/test/stub>)

if (${CANTP_ENABLE_TEST})
enable_testing()
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) |
Expand Down
3 changes: 2 additions & 1 deletion generated/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<$<BOOL:${CANTP_ENABLE_TEST}>:${PROJECT_SOURCE_DIR}/test/stub>)

if (${ENABLE_PC_LINT})
add_pc_lint_target(NAME CanTp_PBcfg
Expand Down
148 changes: 74 additions & 74 deletions test/stub/ComStack_Types.h → test/stub/common/ComStack_Types.h
Original file line number Diff line number Diff line change
@@ -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 */
54 changes: 27 additions & 27 deletions test/stub/Compiler.h → test/stub/common/Compiler.h
Original file line number Diff line number Diff line change
@@ -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 */
File renamed without changes.
File renamed without changes.

0 comments on commit f4f0ea5

Please sign in to comment.