DriveWorks SDK Reference
3.0.4260 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 
49 #ifndef DW_SENSORS_CANBUS_CAN_H_
50 #define DW_SENSORS_CANBUS_CAN_H_
51 
52 #include <dw/core/Config.h>
53 #include <dw/core/Exports.h>
54 #include <dw/core/Types.h>
55 
56 #include <dw/sensors/Sensors.h>
57 
58 // clang-format off
59 
96 // clang-format on
97 
99 #define DW_SENSORS_CAN_MAX_ID_LEN 29
100 
102 #define DW_SENSORS_CAN_MAX_MESSAGE_LEN 64
103 
105 #define DW_SENSORS_CAN_MAX_FILTERS 255
106 
107 #ifdef __cplusplus
108 extern "C" {
109 #endif
110 
111 #pragma pack(push, 1) // Makes sure you have consistent structure packings.
112 
114 typedef struct dwCANMessage
115 {
118 
120  uint32_t id;
121 
123  uint16_t size;
124 
127 } dwCANMessage;
128 
129 #pragma pack(pop)
130 
153 
177 dwStatus dwSensorCAN_setMessageFilter(const uint32_t* ids, const uint32_t* masks,
178  uint16_t num, dwSensorHandle_t sensor);
179 
197 
220  dwTime_t timeout_us, dwSensorHandle_t sensor);
221 
239 dwStatus dwSensorCAN_processRawData(const uint8_t* data, size_t size,
240  dwSensorHandle_t sensor);
241 
256  dwSensorHandle_t sensor);
257 
258 #ifdef __cplusplus
259 }
260 #endif
261 
262 #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:123
uint8_t data[DW_SENSORS_CAN_MAX_MESSAGE_LEN]
Payload.
Definition: CAN.h:126
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:88
dwStatus
Status definition.
Definition: Status.h:166
NVIDIA DriveWorks API: Sensors
dwTime_t timestamp_us
Timestamp of the message in microseconds (using clock of the context).
Definition: CAN.h:117
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:120
NVIDIA DriveWorks API: Core Exports
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:56
Holds a CAN package.
Definition: CAN.h:114
#define DW_SENSORS_CAN_MAX_MESSAGE_LEN
Maximal length of the supported CAN payload [bytes].
Definition: CAN.h:102
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.