DriveWorks SDK Reference
4.0.0 Release
For Test and Development only

CAN.h
Go to the documentation of this file.
1 // This code contains NVIDIA Confidential Information and is disclosed
3 // under the Mutual Non-Disclosure Agreement.
4 //
5 // Notice
6 // ALL NVIDIA DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS" NVIDIA MAKES
7 // NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
8 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT,
9 // MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
10 //
11 // NVIDIA Corporation assumes no responsibility for the consequences of use of such
12 // information or for any infringement of patents or other rights of third parties that may
13 // result from its use. No license is granted by implication or otherwise under any patent
14 // or patent rights of NVIDIA Corporation. No third party distribution is allowed unless
15 // expressly authorized by NVIDIA. Details are subject to change without notice.
16 // This code supersedes and replaces all information previously supplied.
17 // NVIDIA Corporation products are not authorized for use as critical
18 // components in life support devices or systems without express written approval of
19 // NVIDIA Corporation.
20 //
21 // Copyright (c) 2016-2020 NVIDIA Corporation. All rights reserved.
22 //
23 // NVIDIA Corporation and its licensors retain all intellectual property and proprietary
24 // rights in and to this software and related documentation and any modifications thereto.
25 // Any use, reproduction, disclosure or distribution of this software and related
26 // documentation without an express license agreement from NVIDIA Corporation is
27 // strictly prohibited.
28 //
30 
47 #ifndef DW_SENSORS_CANBUS_CAN_H_
48 #define DW_SENSORS_CANBUS_CAN_H_
49 
50 #include <dw/core/Config.h>
51 #include <dw/core/base/Exports.h>
52 #include <dw/core/base/Types.h>
53 
54 #include <dw/sensors/Sensors.h>
55 
56 // clang-format off
57 
94 // clang-format on
95 
97 #define DW_SENSORS_CAN_MAX_ID_LEN 29
98 
100 #define DW_SENSORS_CAN_MAX_MESSAGE_LEN 64
101 
103 #define DW_SENSORS_CAN_MAX_FILTERS 255
104 
105 #ifdef __cplusplus
106 extern "C" {
107 #endif
108 
109 #pragma pack(push, 1) // Makes sure you have consistent structure packings.
110 
112 typedef struct dwCANMessage
113 {
116 
118  uint32_t id;
119 
121  uint16_t size;
122 
125 } dwCANMessage;
126 
127 #pragma pack(pop)
128 
151 
175 dwStatus dwSensorCAN_setMessageFilter(const uint32_t* ids, const uint32_t* masks,
176  uint16_t num, dwSensorHandle_t sensor);
177 
195 
218  dwTime_t timeout_us, dwSensorHandle_t sensor);
219 
237 dwStatus dwSensorCAN_processRawData(const uint8_t* data, size_t size,
238  dwSensorHandle_t sensor);
239 
254  dwSensorHandle_t sensor);
255 
256 #ifdef __cplusplus
257 }
258 #endif
259 
260 #endif // DW_SENSORS_CANBUS_CAN_H_
NVIDIA DriveWorks API: Core Types
DW_API_PUBLIC dwStatus dwSensorCAN_setUseHwTimestamps(bool flag, dwSensorHandle_t sensor)
Enables or disables hardware timestamp of the CAN messages.
DW_API_PUBLIC dwStatus dwSensorCAN_readMessage(dwCANMessage *msg, dwTime_t timeout_us, dwSensorHandle_t sensor)
Reads a CAN packet with a given timeout from the CAN bus.
uint16_t size
Number of bytes of the payload.
Definition: CAN.h:121
uint8_t data[DW_SENSORS_CAN_MAX_MESSAGE_LEN]
Payload.
Definition: CAN.h:124
DW_API_PUBLIC dwStatus dwSensorCAN_popMessage(dwCANMessage *msg, dwSensorHandle_t sensor)
Returns any CAN data previously processed through a RAW data stream.
struct dwSensorObject * dwSensorHandle_t
Handle representing a sensor.
Definition: Sensors.h:84
dwStatus
Status definition.
Definition: Status.h:180
NVIDIA DriveWorks API: Sensors
dwTime_t timestamp_us
Timestamp of the message in microseconds (using clock of the context).
Definition: CAN.h:115
int64_t dwTime_t
Specifies a timestamp unit, in microseconds.
Definition: Types.h:82
DW_API_PUBLIC dwStatus dwSensorCAN_sendMessage(const dwCANMessage *msg, dwTime_t timeout_us, dwSensorHandle_t sensor)
Sends a message over the CAN bus within a specified timeout.
uint32_t id
CAN ID of the message sender.
Definition: CAN.h:118
DW_API_PUBLIC dwStatus dwSensorCAN_setMessageFilter(const uint32_t *ids, const uint32_t *masks, uint16_t num, dwSensorHandle_t sensor)
Specifes a set of CAN IDs to be filtered.
#define DW_API_PUBLIC
Definition: Exports.h:54
Holds a CAN package.
Definition: CAN.h:112
#define DW_SENSORS_CAN_MAX_MESSAGE_LEN
Maximal length of the supported CAN payload [bytes].
Definition: CAN.h:100
DW_API_PUBLIC dwStatus dwSensorCAN_processRawData(const uint8_t *data, size_t size, dwSensorHandle_t sensor)
Decodes CAN data previously read as a RAW data stream into internal queue.
NVIDIA DriveWorks API: Core Exports