Skip to content

Commit

Permalink
Merge with XCPlite
Browse files Browse the repository at this point in the history
  • Loading branch information
RainerZ committed Sep 12, 2024
1 parent 3b08c89 commit 0679b74
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 12 deletions.
2 changes: 2 additions & 0 deletions tests/multi_thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Integration test for XCP in a multi threaded application
// Uses the test XCP client in test_executor

// cargo test --features=json --features=auto_reg -- --test-threads=1 --nocapture --test test_multi_thread

use xcp::*;
use xcp_type_description::prelude::*;

Expand Down
4 changes: 3 additions & 1 deletion tests/tokio_multi_thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Integration test for XCP in a multi threaded application
// Uses the test XCP client in test_executor

// cargo test --features=json --features=auto_reg -- --test-threads=1 --nocapture --test test_tokio_multi_thread

use xcp::*;
use xcp_type_description::prelude::*;

Expand Down Expand Up @@ -150,7 +152,7 @@ fn task(cal_seg: CalSeg<CalPage1>) {
//-----------------------------------------------------------------------------
// Integration test multi thread measurememt and calibration

#[ignore]
//#[ignore]
#[tokio::test]
async fn test_tokio_multi_thread() {
env_logger::Builder::new().filter_level(OPTION_LOG_LEVEL.to_log_level_filter()).init();
Expand Down
4 changes: 3 additions & 1 deletion tests/tokio_single_thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// Integration test for XCP in a single thread application
// Uses the test XCP client in test_executor

// cargo test --features=json --features=auto_reg -- --test-threads=1 --nocapture --test test_tokio_single_thread

use xcp::*;
use xcp_type_description::prelude::*;

Expand Down Expand Up @@ -147,7 +149,7 @@ fn task(cal_seg: CalSeg<CalPage1>) {
//-----------------------------------------------------------------------------
// Integration test single thread measurement and calibration

#[ignore]
//#[ignore]
#[tokio::test]
async fn test_tokio_single_thread() {
env_logger::Builder::new().filter_level(OPTION_LOG_LEVEL.to_log_level_filter()).try_init().ok();
Expand Down
21 changes: 14 additions & 7 deletions xcplib/main_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,31 @@
#define ON 1
#define OFF 0

// Debug prints
#define XCP_ENABLE_DBG_PRINTS
#define XCP_DEFAULT_DEBUG_LEVEL 2 /*1 - Error, 2 - Warn, 3 - Info, 4 - Trace, 5 - Debug */

// Set clock resolution (for clock function in platform.c)
#define CLOCK_USE_APP_TIME_US
// #define CLOCK_USE_UTC_TIME_NS

// #define PLATFORM_ENABLE_GET_LOCAL_ADDR
// #define PLATFORM_ENABLE_KEYBOARD



// Ethernet Transport Layer
#define OPTION_MTU 8000 // Ethernet MTU

// Ethernet Server
// TCP or/and UDP server enabled
#define XCPTL_ENABLE_TCP
#define XCPTL_ENABLE_UDP
#define XCP_SERVER_FORCEFULL_TERMINATION // Otherwise use gracefull server thread termination in xcplib

// Ethernet Transport Layer
#define OPTION_MTU 8000 // Ethernet MTU

// Debug prints
#define OPTION_ENABLE_DBG_PRINTS ON
#define OPTION_DEBUG_LEVEL 2 /*1 - Error, 2 - Warn, 3 - Info, 4 - Trace, 5 - Debug */
#if OPTION_ENABLE_DBG_PRINTS
#define XCP_ENABLE_DBG_PRINTS
#define XCP_DEFAULT_DEBUG_LEVEL OPTION_DEBUG_LEVEL
#endif

// #define PLATFORM_ENABLE_GET_LOCAL_ADDR
// #define PLATFORM_ENABLE_KEYBOARD
13 changes: 10 additions & 3 deletions xcplib/src/dbg_print.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#pragma once
#define __DBG_PRINT_H__


/* dbg_print.h */
/*
Expand All @@ -9,10 +11,12 @@
//-------------------------------------------------------------------------------
// Debug print

#ifdef XCP_ENABLE_DBG_PRINTS
#if !defined(OPTION_ENABLE_DBG_PRINTS) || !defined(OPTION_DEBUG_LEVEL)
#error "Please define OPTION_ENABLE_DBG_PRINTS and OPTION_DEBUG_LEVEL in main_cfg.h to ON or OFF"
#endif

extern uint8_t gDebugLevel;
#define DBG_LEVEL gDebugLevel

#if OPTION_ENABLE_DBG_PRINTS

/*
1 - Error
Expand All @@ -21,6 +25,9 @@ extern uint8_t gDebugLevel;
4 - Trace
5 - Debug
*/
extern uint8_t gDebugLevel;
#define DBG_LEVEL gDebugLevel


#define DBG_PRINTF(level, format, ...) if (DBG_LEVEL>=level) printf(format, __VA_ARGS__)
#define DBG_PRINTF_ERROR(format, ...) if (DBG_LEVEL>=1) printf(format, __VA_ARGS__)
Expand Down
1 change: 1 addition & 0 deletions xcplib/src/main.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once
#define __MAIN_CFG_H__


/* main.h */
Expand Down

0 comments on commit 0679b74

Please sign in to comment.