Skip to content

Commit

Permalink
CLOCK_MONOTONIC_RAW
Browse files Browse the repository at this point in the history
  • Loading branch information
RainerZ committed Oct 27, 2024
1 parent 956cae3 commit 5e9fbdd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
8 changes: 4 additions & 4 deletions xcp_lite.a2l
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,10 @@

/begin GROUP task2_inst "" ROOT /begin REF_MEASUREMENT channel_1 channel_10 channel_2 channel_3 channel_4 channel_5 channel_6 channel_7 channel_8 channel_9 /end REF_MEASUREMENT /end GROUP

/begin CHARACTERISTIC static_cal_page.task1_cycle_time_us "task1 cycle time" VALUE 0x13400C U32 0 NO_COMPU_METHOD 0 4294967295 PHYS_UNIT "us" ECU_ADDRESS_EXTENSION 1 /end CHARACTERISTIC
/begin CHARACTERISTIC static_cal_page.task2_cycle_time_us "task2 cycle time" VALUE 0x134010 U32 0 NO_COMPU_METHOD 0 4294967295 PHYS_UNIT "us" ECU_ADDRESS_EXTENSION 1 /end CHARACTERISTIC
/begin CHARACTERISTIC static_vars.test_f64 "Test static f64" VALUE 0x1343DC F32 0 NO_COMPU_METHOD -1000000000000 1000000000000 ECU_ADDRESS_EXTENSION 1 /begin IF_DATA XCP /begin DAQ_EVENT FIXED_EVENT_LIST EVENT 3 /end DAQ_EVENT /end IF_DATA /end CHARACTERISTIC
/begin CHARACTERISTIC static_vars.test_u32 "Test static u32" VALUE 0x1343D8 U32 0 NO_COMPU_METHOD 0 4294967295 ECU_ADDRESS_EXTENSION 1 /begin IF_DATA XCP /begin DAQ_EVENT FIXED_EVENT_LIST EVENT 3 /end DAQ_EVENT /end IF_DATA /end CHARACTERISTIC
/begin CHARACTERISTIC static_cal_page.task1_cycle_time_us "task1 cycle time" VALUE 0x13000C U32 0 NO_COMPU_METHOD 0 4294967295 PHYS_UNIT "us" ECU_ADDRESS_EXTENSION 1 /end CHARACTERISTIC
/begin CHARACTERISTIC static_cal_page.task2_cycle_time_us "task2 cycle time" VALUE 0x130010 U32 0 NO_COMPU_METHOD 0 4294967295 PHYS_UNIT "us" ECU_ADDRESS_EXTENSION 1 /end CHARACTERISTIC
/begin CHARACTERISTIC static_vars.test_f64 "Test static f64" VALUE 0x1303DC F32 0 NO_COMPU_METHOD -1000000000000 1000000000000 ECU_ADDRESS_EXTENSION 1 /begin IF_DATA XCP /begin DAQ_EVENT FIXED_EVENT_LIST EVENT 3 /end DAQ_EVENT /end IF_DATA /end CHARACTERISTIC
/begin CHARACTERISTIC static_vars.test_u32 "Test static u32" VALUE 0x1303D8 U32 0 NO_COMPU_METHOD 0 4294967295 ECU_ADDRESS_EXTENSION 1 /begin IF_DATA XCP /begin DAQ_EVENT FIXED_EVENT_LIST EVENT 3 /end DAQ_EVENT /end IF_DATA /end CHARACTERISTIC
/begin CHARACTERISTIC CalPage.cycle_time_ms "main task cycle time" VALUE 0x80010000 U32 0 NO_COMPU_METHOD 0 4294967295 PHYS_UNIT "ms" /end CHARACTERISTIC
/begin CHARACTERISTIC CalPage.run "" VALUE 0x80010004 U8 0 NO_COMPU_METHOD 0 1 PHYS_UNIT "bool" /end CHARACTERISTIC
/begin CHARACTERISTIC CalPage.run1 "" VALUE 0x80010005 U8 0 NO_COMPU_METHOD 0 1 PHYS_UNIT "bool" /end CHARACTERISTIC
Expand Down
6 changes: 3 additions & 3 deletions xcplib/main_cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
#define OPTION_DEFAULT_DEBUG_LEVEL Default log level: 1 - Error, 2 - Warn, 3 - Info, 4 - Trace, 5 - Debug
// Clock
// Default is 1ns since 1970 epoch based on real time clock
#define OPTION_ARB_CLOCK 1us free running timescale and arbitrary epoch
#define OPTION_TAI_CLOCK 1ns since 1970 clock, TAI syncronized by platform specific real time clock NTP, PTP4L, ...
// Default (none of these defined) is 1ns since 1970 epoch based on unsyncronized system clock
#define OPTION_ARB_CLOCK 1us per tick free running timescale and arbitrary epoch
#define OPTION_TAI_CLOCK 1ns per tick since 1.1.1970, TAI syncronized by platform specific real time clock NTP, PTP4L, ...
// XCP
#define OPTION_ENABLE_TCP
Expand Down
10 changes: 7 additions & 3 deletions xcplib/src/platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,6 @@ Linux clock type
//#define CLOCK_TYPE CLOCK_TAI


static struct timespec gtr;
#ifdef OPTION_ARB_CLOCK
static struct timespec gts0;
#endif
Expand Down Expand Up @@ -756,8 +755,13 @@ BOOL clockInit()

sClock = 0;

clock_getres(CLOCK_TYPE, &gtr);
DBG_PRINTF3("Clock resolution is %ldns!\n", gtr.tv_nsec);
#ifdef DBG_LEVEL
if (DBG_LEVEL >= 3) { // Test
struct timespec gtr;
clock_getres(CLOCK_TYPE, &gtr);
DBG_PRINTF3("Clock resolution is %ldns!\n", gtr.tv_nsec);
}
#endif

#ifdef OPTION_ARB_CLOCK
clock_gettime(CLOCK_TYPE, &gts0);
Expand Down

0 comments on commit 5e9fbdd

Please sign in to comment.