ECU Measurement and Calibration Toolkit C API Reference

Content Type
Programming Language
Current manual

mcGeneric

mcGeneric

Purpose

Sends a generic XCP or CCP command.

Format

mcTypeStatus mcGeneric(
mcTypeTaskRef ECURefNum,
u8 Command,
u8 *Data,
u32 DataSize,
u32 Timeout,
u8 *ErrorCode,
u8 *ReturnValue,
u32 *ReturnValueSize);

Input

ECURefNum

ECURefNum is the task reference which links to the selected ECU. This reference is originally returned from mcECUSelectEx.

Command

Command is the command code to send to the ECU.

Data

Data contains the parameters of the command as an array of bytes. For more information about the parameters of the (user defined) commands implemented in the ECU, refer to the documentation for the ECU.

DataSize

DataSize defines the number of bytes (the array size) passed in the input parameter Data.

Timeout

Timeout specifies the maximum number of milliseconds to wait for a response from the ECU. If the Timeout expires before an ECU response occurs, the error mcErrorTimeout is returned.

Output

ErrorCode

ErrorCode describes the error returned from the ECU during the communication.

ReturnValue

ReturnValue may contain an array of bytes returned from the ECU as a response to the command sent to the ECU.

ReturnValueSize

ReturnValueSize contains the number of bytes returned from the ECU passed to ReturnValue.

Return Value

The return value indicates the status of the function call as a signed 32-bit integer. Zero means the function executed successfully. A negative value specifies an error, which means the function did not perform the expected behavior. A positive value specifies a warning, which means the function performed as expected, but a condition arose that may require attention.

Use the mcStatusToString function of the ECU M&C API to obtain a descriptive string for the return value.

Description

mcGeneric can be used to send commands to the ECU that are not defined by the XCP or CCP specification. The command code in Command and the parameters of this command defined in Data are sent to the ECU, and the data returned by the ECU is passed to the parameter ReturnValue. Since the ECU M&C driver has no knowledge of the parameters of the command and their data types, all parameters and return values are passed as an array of bytes. Therefore you are responsible for the correct type casting of all parameters and return values of this command. Make sure that all parameters are passed in the correct byte ordering for this function. For more information about the (user defined) commands and their parameters refer to the documentation for the ECU.

Was this information helpful?