You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a one-page index of the whole public API of libxcplite: functions, macros, templates, classes, constants and types. For each entry it lists the configuration option that enables it and the examples that use it. For details, see the doc comments in the headers, and the examples for their usage. The basic call sequence of an application is shown in Getting Started.
Once-patterns and variadic typedef creation for runtime A2L generation
How to read the tables
Option: what has to be enabled for the entry to exist or to have an effect. — means it is always available. The options are explained in xcplib_cfg.md and set in src/xcplib_cfg.h and the configuration override headers src/xcplib_<config>_cfg.h. A ! in front of an option means the entry requires that option to be off.
Examples: the examples that use the entry, based on their source code. — means no example uses it directly. Some of those entries are tested in test/, and many are used internally by other macros.
Unlock a segment, with the page pointer returned by the lock
OPTION_CAL_SEGMENTS, OPTION_CAL_RCU_REFCOUNT
— (tests only)
XcpGetCalSegCount()
function
Number of segments and blocks
OPTION_CAL_SEGMENTS
—
XcpFindCalSeg(name)
function
Look up a segment by name
OPTION_CAL_SEGMENTS
—
XcpGetCalSegName(index)
function
Segment name
OPTION_CAL_SEGMENTS
—
XcpGetCalSegSize(index)
function
Segment size in bytes
OPTION_CAL_SEGMENTS
—
XcpGetCalSegNumber(index)
function
XCP/A2L segment number (XCP_UNDEFINED_CALSEG_NUM for blocks)
OPTION_CAL_SEGMENTS
—
XcpResetAllCalSegs()
function
Switch all segments to their default page (emergency)
OPTION_CAL_SEGMENTS, OPTION_ENABLE_PERSISTENCE
—
XcpFreeze()
function
Write the working pages to the persistence file; they become the defaults of the next run
OPTION_CAL_SEGMENTS, OPTION_ENABLE_PERSISTENCE
silkit_demo
XcpBinWrite(epk)
function
Create the persistence file with the current working pages as defaults
OPTION_ENABLE_PERSISTENCE
—
1.5 Calibration segments: macros (C only)
The macros take the default page variable as an identifier: name is the segment name, &name the default page, sizeof(name) the size. They define the static index variable calseg_id_<name> (or calblk_id_<name>) and a section descriptor calseg__<name>, which also serves as a marker for xcpclient.
Name
Kind
Description
Option
Examples
CalSegCreate(name) / CalBlkCreate(name)
macro
Create the segment or block immediately, if it does not exist yet. Can be used inside functions and loops. Before XcpInit nothing is created, CalSegLock returns the default page until the segment is created (section scan in XcpInit, or the next execution after XcpInit)
OPTION_CAL_SEGMENTS. With OPTION_SECTION_REGISTRATION, XcpInit also pre-registers the segment
no_a2l_demo, freertos_demo
CalSegDecl(name) / CalBlkDecl(name)
macro
File scope declaration only. XcpInit creates the segment from the xcp_cals section
OPTION_SECTION_REGISTRATION (compile error without it)
no_a2l_demo, freertos_demo
CalSegLock(name) / CalBlkLock(name)
macro
Typed lock, returns const T*. In passive mode it returns the default page
OPTION_CAL_SEGMENTS
no_a2l_demo, freertos_demo
CalSegUnlock(name) / CalBlkUnlock(name)
macro
Unlock
!OPTION_CAL_RCU_REFCOUNT
no_a2l_demo, freertos_demo
CalSegUnlock(name, ptr) / CalBlkUnlock(name, ptr)
macro
Unlock with the pointer returned by the lock
OPTION_CAL_RCU_REFCOUNT
—
CalSegIndex(name)
macro
The tXcpCalSegIndex of the segment
—
—
1.6 DAQ events: creation
Name
Kind
Description
Option
Examples
XcpCreateEvent(name, cycle_ns, prio)
function
Create an event, or return the existing one with this name. Thread safe
OPTION_DAQ_EVENT_LIST
multi_thread_demo, bpf_demo, freertos_demo
XcpCreateEventInstance(name, cycle_ns, prio)
function
Create a new indexed instance (name_<n>) of an event
OPTION_DAQ_EVENT_LIST
—
XcpFindEvent(name)
function
Look up an event id by name
—
— (used by the trigger macros)
XcpGetEventIndex(event)
function
Instance index (1..) of an indexed event
OPTION_DAQ_EVENT_LIST
multi_thread_demo
DaqCreateEvent(name)
macro
Create a sporadic event (inside a function). It is created at runtime, or registered at link time with section registration
OPTION_DAQ_EVENT_LIST or OPTION_SECTION_REGISTRATION
most C examples, cpp_demo, silkit_demo, no_a2l_demo, no_a2l_demo_cpp, freertos_demo
DaqCreateEventExt(name, cycle_us, prio)
macro
Like DaqCreateEvent, with a cycle time and priority
as above
—
DaqDeclareEvent(name)
macro
File scope event declaration, so callbacks can trigger it by name
OPTION_SECTION_REGISTRATION
—
DaqDeclareEventExt(name, cycle_us, prio)
macro
As above, with a cycle time and priority
OPTION_SECTION_REGISTRATION
—
DaqCreateEvent_s(name_str)
macro
Create an event with a runtime string name, once per thread
OPTION_DAQ_EVENT_LIST
cpp_demo
DaqCreateEventInstance(name)
macro
Create a new event instance on every call
OPTION_DAQ_EVENT_LIST
multi_thread_demo
DaqGetEventInstanceId(name)
macro
Id of the instance created by DaqCreateEventInstance
OPTION_DAQ_EVENT_LIST
multi_thread_demo
1.7 DAQ events: trigger functions
All trigger functions are thread safe. They are lock free with the 64-bit queues.
Name
Kind
Description
Option
Examples
XcpEvent(event)
function
Trigger, absolute addressing only
—
—
XcpEventAt(event, clock)
function
As above, with an explicit timestamp
—
—
XcpEventExt(event, base)
function
Trigger with one base address (stack or relative addressing)
—
bpf_demo
XcpEventExtAt(event, base, clock)
function
As above, with a timestamp
—
—
XcpEventExt_Var(event, count, ...)
function
Trigger with a variadic list of base addresses (address extensions 2..)
—
— (used by the trigger macros)
XcpEventExtAt_Var(event, clock, count, ...)
function
As above, with a timestamp
—
multi_thread_demo
XcpEventExtAt_(event, count, bases, clock)
function
Base address array variant, used by the C++ templates
—
—
XcpEventEnable(event, enable)
function
Enable or disable an event
OPTION_DAQ_EVENT_LIST
—
1.8 DAQ events: trigger macros
The trg__<modes>__<event> static variables emitted by these macros are the markers that xcpclient uses for offline A2L generation (see TECHNICAL.md). Functions which measure their local variables must not be inlined (XCP_NOINLINE).
Name
Kind
Description
Option
Examples
DaqTriggerEvent(name)
macro
Trigger by name, with absolute and stack addressing (AAS)
— (with section registration, the event descriptor must be visible)
Trigger by name with absolute, stack and relative addressing (AASD)
—
c_demo, struct_demo, no_a2l_demo, silkit_demo
DaqTriggerEventExt_s(name_str, base)
macro
As above, with the name as a runtime string (lookup once per thread)
—
cpp_demo
DaqTriggerEventExt_i(id, base)
macro
As above, by event id
—
—
DaqCreateAndTriggerEvent(name)
macro
Create and trigger in one statement (AAS)
—
no_a2l_demo, no_a2l_demo_cpp, freertos_demo
DaqEventVar(name, A2L_MEAS(var, comment), ...)
macro
C only. Create the event, register the listed variables once and trigger. In C, A2L_MEAS/A2L_MEAS_PHYS are empty markers in front of the tuples (var, comment) and (var, comment, unit, min, max)
OPTION_ENABLE_A2L_GENERATOR
hello_xcp
DaqEventEnable(name) / DaqEventDisable(name)
macro
Enable or disable an event by name
OPTION_DAQ_EVENT_LIST
—
1.9 Capturing local variables
The capture macros copy register-allocated locals into a struct on the stack, which is measured with address extension 3 (AASR). Not available with MSVC.
Name
Kind
Description
Option
Examples
DaqTriggerEventCapture(name, vars...)
macro
Trigger and capture up to 16 variables
— (not MSVC)
no_a2l_demo_cpp
DaqTriggerEventCaptureAt(name, clock, vars...)
macro
As above, with a timestamp
— (not MSVC)
—
DaqCreateAndTriggerEventCapture(name, vars...)
macro
Create, trigger and capture
— (not MSVC)
no_a2l_demo, no_a2l_demo_cpp, freertos_demo
XCP_CAPTURE_MAX_COUNT
const
Maximum number of captured variables (16)
—
—
1.10 Instrumentation helpers and offline A2L metadata
Name
Kind
Description
Option
Examples
XCP_NOINLINE
macro
Function attribute: keep a function with measured locals out of line
—
no_a2l_demo, no_a2l_demo_cpp, freertos_demo
XCP_MEAS
macro
volatile: keep a local variable in memory for offline A2L
— (meant for no_a2l/rtos)
no_a2l_demo, no_a2l_demo_cpp, freertos_demo
XCP_FORCE_TO_STACK(var)
macro
Force an aggregate local to stay on the stack
—
no_a2l_demo, no_a2l_demo_cpp
XCP_MEMORY_BARRIER()
macro
Compiler memory barrier
—
—
XCP_NO_TAIL_CALL()
macro
Prevent tail call optimization after a trigger that passes the frame address
—
— (used by the trigger macros)
XCP_COMMENT(name, text)
macro
A2L comment for a variable, stored in the xcp_meta section
OPTION_SECTION_REGISTRATION
no_a2l_demo, no_a2l_demo_cpp, freertos_demo
XCP_UNIT(name, unit)
macro
A2L physical unit
OPTION_SECTION_REGISTRATION
no_a2l_demo, no_a2l_demo_cpp, freertos_demo
XCP_LIMITS(name, min, max)
macro
A2L limits
OPTION_SECTION_REGISTRATION
no_a2l_demo, no_a2l_demo_cpp, freertos_demo
XCP_READ_WRITE(name)
macro
Mark a measurement as writable
OPTION_SECTION_REGISTRATION
no_a2l_demo, no_a2l_demo_cpp, freertos_demo
XcpCreateEpk(epk)
macro
Emit the EPK string xcp_epk__ for xcpclient (in the xcp_epk section with section registration)
— (meant for offline A2L)
no_a2l_demo, no_a2l_demo_cpp, freertos_demo
THREAD_LOCAL
macro
Portable thread-local storage specifier
—
multi_thread_demo
XCP_MAYBE_UNUSED
macro
Portable "maybe unused" attribute
—
—
1.11 Addressing helpers
Name
Kind
Description
Option
Examples
xcp_get_frame_addr()
macro
Stack frame base address for stack-relative addressing (clang: frame pointer, GCC: CFA, MSVC: intrinsic)
—
multi_thread_demo, bpf_demo, freertos_demo
XCP_FRAME_ADDR_OFFSET
const
Offset subtracted from the frame address, which sets the maximum frame size (0x10000)
—
—
xcp_get_base_addr() / gXcpBaseAddr
macro / variable
Base address of absolute addressing (fast path)
—
—
ApplXcpGetBaseAddr()
function
Base address of absolute addressing
—
—
ApplXcpSetBaseAddr(addr)
function
Override the base address (NULL restores the module address)
XCP command return codes, for callback return values
—
c_demo, external_example
1.16 Internal building blocks
These macros are public because the instrumentation macros expand to them. Applications normally don't use them directly: XCP_CAL_SECTION_ATTR, XCP_EVENT_SECTION_ATTR, XCP_EPK_SECTION_ATTR, XCP_METADATA_SECTION_ATTR, XCP_EVENT_DESCRIPTOR_INIT, XCP_EVENT_SECTION_GET_LINKTIME_ID, XCP_EVENT_SECTION_SET_ID, XCP_EVENT_SECTION_LOOKUP_ID, XCP_CALSEG_DECL_CHECK, XCP_CAPTURE, XCP_CAP_*, XCPLIB_FOR_EACH_MEAS_*, XCPLIB_FE_*, XCPLIB_APPLY_, A2L_UNPACK_AND_REG_*, A2L_TUPLE_SIZE_*. With section registration, __start_xcp_evts/__stop_xcp_evts are the linker-generated bounds of the event section.
Everything in this part requires OPTION_ENABLE_A2L_GENERATOR (configurations default, ptp, shm and raw). The Option column lists only additional requirements. The A2L generator state (addressing mode, group, typedef) is not thread safe: protect registrations with A2lLock/A2lUnlock or a once-pattern.
2.1 Initialization and file
Name
Kind
Description
Option
Examples
A2lInit(addr, port, use_tcp, mode)
function
Start A2L generation, or reuse an existing A2L file that matches the EPK
—
all default-config examples, silkit_demo, external/fetchcontent
A2lFinalize()
function
Write the A2L file and the persistence file
—
all default-config examples, silkit_demo, external/fetchcontent
Set the addressing mode before the registrations it applies to. It stays active until the next A2lSet*AddrMode. Each macro has an _s variant (event or segment name as a string) and an _i variant (id or index). See TECHNICAL.md for the address extension mapping.
The registration macros expand to these functions. Call them directly only for names, types or addresses that are known only at runtime: A2lSetSegmentAddrMode__i/__s, A2lSetAbsoluteAddrMode__i/__s, A2lSetStackAddrMode__i/__s, A2lSetRelativeAddrMode__i/__s, A2lSetAutoAddrMode__i/__s, A2lCreateParameter_, A2lCreateCurve_, A2lCreateMap_, A2lCreateAxis_, A2lCreateLinearConversion_, A2lCreateEnumConversion_, A2lCreateMeasurement_ (used directly in bpf_demo), A2lCreateMeasurementArray_, A2lTypedefBegin_, A2lTypedefEnd_, A2lTypedefComponent_, A2lTypedefMeasurementComponent_, A2lTypedefParameterComponent_, A2lCreateInstance_.
A2lSetSymbolPrefix(enable) switches the project name prefix (A2L_MODE_SYMBOL_PREFIX) on or off for the symbols created after the call. Call it after A2lInit. In SHM mode the prefix is mandatory and cannot be switched off.
Namespace xcp. In C++, the C calibration segment macros of section 1.5 are replaced by the classes and macros below. Everything in Part 1 except the C only entries is available as well.
3.1 Calibration segments
Name
Kind
Description
Option
Examples
xcp::CalSeg<T>
class template
Owning RAII wrapper: the constructor (name, &default) creates the segment (construct after XcpInit), lock() returns a guard, getIndex() the index
Expression: auto seg = CalSegCreate(params); returns xcp::CalSeg<T> and emits the xcp_cals descriptor. Must run after XcpInit, otherwise the object stays passive permanently (not as a namespace-scope global initializer)
OPTION_CAL_SEGMENTS
cpp_demo, freertos_demo
CalBlkCreate(value)
macro
As above, returns xcp::CalBlk<T>
OPTION_CAL_SEGMENTS
—
CalSegDeclRef(value, handle)
macro
File scope declaration plus a typed handle xcp::CalSegRef<T> handle. XcpInit creates the segment
OPTION_SECTION_REGISTRATION
no_a2l_demo_cpp, freertos_demo
CalSegDecl(value)
macro
CalSegDeclRef(value, value_calseg)
OPTION_SECTION_REGISTRATION
no_a2l_demo_cpp
3.2 Variadic DAQ templates
The whole section requires !OPTION_SECTION_REGISTRATION. Measurements use individual relative address extensions (AASDD).
Name
Kind
Description
Option
Examples
DaqEventVar(name, A2L_MEAS(...), ...)
macro
Create the event, register the measurements once and trigger
registration needs OPTION_ENABLE_A2L_GENERATOR
hello_xcp_cpp, cpp_demo, ptp4l_demo, silkit_demo
DaqEventAtVar(name, clock, ...)
macro
As above, with a timestamp
as above
point_cloud_demo
DaqTriggerEventVar(name, bases...)
macro
Create the event once and trigger with a variadic list of base addresses
Namespace xcp::a2l. Everything requires OPTION_ENABLE_A2L_GENERATOR. The C macros of Part 2 can be used from C++ as well, except A2lOnce(name), A2lThreadOnce(name) and A2lGetTypeIdFromPtr.
4.1 Once-patterns
Name
Kind
Description
Option
Examples
A2lOnce()
macro
if (A2lOnce()) {…} runs once across all threads (std::call_once, unique for each source line)