Skip to content

Commit

Permalink
move configuration definitions in CanTp_Cfg.h.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sauci committed Jul 4, 2019
1 parent d0fc644 commit a3d2231
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 18 deletions.
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,13 @@ add_subdirectory(generated)
add_library(${PROJECT_NAME} STATIC source/CanTp.c)

target_compile_definitions(${PROJECT_NAME}
PRIVATE CANTP_MAX_NUM_OF_CHANNEL=16
PRIVATE CANTP_MAX_NUM_OF_N_SDU=16
PRIVATE CANTP_DEV_ERROR_DETECT=$<IF:$<BOOL:${ENABLE_DET}>,STD_ON,STD_OFF>
PRIVATE CANTP_SW_VERSION_MAJOR=${PROJECT_VERSION_MAJOR}
PRIVATE CANTP_SW_VERSION_MINOR=${PROJECT_VERSION_MINOR}
PRIVATE CANTP_SW_VERSION_PATCH=${PROJECT_VERSION_PATCH}
# SWS_BSW_00059
PUBLIC CANTP_AR_RELEASE_MAJOR_VERSION=4
PUBLIC CANTP_AR_RELEASE_MINOR_VERSION=4
PUBLIC CANTP_API=STD_ON
# ECUC_CanTp_00283
PUBLIC CANTP_GET_VERSION_INFO_API=STD_ON
Expand Down
32 changes: 32 additions & 0 deletions interface/CanTp_Cfg.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/**
* @file CanTp_Cfg.h
* @author Guillaume Sottas
* @date 04/07/2019
*/

#ifndef CANTP_CFG_H
#define CANTP_CFG_H

/* SWS_BSW_00059 */
#ifndef CANTP_AR_RELEASE_MAJOR_VERSION
#error unknown AUTOSAR release major version
#elif (CANTP_AR_RELEASE_MAJOR_VERSION != 4)
#error incompatible AUTOSAR release major version
#endif

/* SWS_BSW_00059 */
#ifndef CANTP_AR_RELEASE_MINOR_VERSION
#error unknown AUTOSAR release minor version
#elif (CANTP_AR_RELEASE_MINOR_VERSION != 4)
#error incompatible AUTOSAR release minor version
#endif

#ifndef CANTP_MAX_NUM_OF_CHANNEL
#define CANTP_MAX_NUM_OF_CHANNEL (0x10u)
#endif

#ifndef CANTP_MAX_NUM_OF_N_SDU
#define CANTP_MAX_NUM_OF_N_SDU (0x10u)
#endif

#endif /* #ifndef CANTP_CFG_H */
8 changes: 0 additions & 8 deletions script/config.h.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@
#include "CanTp_Types.h"
#endif /* #ifndef CANTP_TYPES_H */

#ifndef CANTP_MAX_NUM_OF_CHANNEL
#define CANTP_MAX_NUM_OF_CHANNEL (0x10u)
#endif

#ifndef CANTP_MAX_NUM_OF_N_SDU
#define CANTP_MAX_NUM_OF_N_SDU (0x10u)
#endif

#define CanTp_START_SEC_CONST_UNSPECIFIED
#include "CanTp_MemMap.h"

Expand Down
10 changes: 2 additions & 8 deletions source/CanTp.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,6 @@
* @{
*/

#ifndef CANTP_MAX_NUM_OF_CHANNEL
#error CANTP_MAX_NUM_OF_CHANNEL must be defined by the build system.
#endif /* #ifndef CANTP_MAX_NUM_OF_CHANNEL */

#ifndef CANTP_MAX_NUM_OF_N_SDU
#error CANTP_MAX_NUM_OF_N_SDU must be defined by the build system.
#endif /* #ifndef CANTP_MAX_NUM_OF_N_SDU */

#ifdef __cplusplus

extern "C"
Expand All @@ -62,6 +54,8 @@ extern "C"

#include "CanTp.h"

#include "CanTp_Cfg.h"

#ifndef CANTP_CBK_H
#include "CanTp_Cbk.h"
#endif /* #ifndef CANTP_CBK_H */
Expand Down

0 comments on commit a3d2231

Please sign in to comment.