DriveWorks SDK Reference
5.4.5418 Release
For Test and Development only

CAN.h
Go to the documentation of this file.
1 //
3 // Notice
4 // ALL NVIDIA DESIGN SPECIFICATIONS AND CODE ("MATERIALS") ARE PROVIDED "AS IS" NVIDIA MAKES
5 // NO REPRESENTATIONS, WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
6 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTIES OF NONINFRINGEMENT,
7 // MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8 //
9 // NVIDIA CORPORATION & AFFILIATES assumes no responsibility for the consequences of use of such
10 // information or for any infringement of patents or other rights of third parties that may
11 // result from its use. No license is granted by implication or otherwise under any patent
12 // or patent rights of NVIDIA CORPORATION & AFFILIATES. No third party distribution is allowed unless
13 // expressly authorized by NVIDIA. Details are subject to change without notice.
14 // This code supersedes and replaces all information previously supplied.
15 // NVIDIA CORPORATION & AFFILIATES products are not authorized for use as critical
16 // components in life support devices or systems without express written approval of
17 // NVIDIA CORPORATION & AFFILIATES.
18 //
19 // SPDX-FileCopyrightText: Copyright (c) 2016-2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
20 // SPDX-License-Identifier: LicenseRef-NvidiaProprietary
21 //
22 // NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
23 // property and proprietary rights in and to this material, related
24 // documentation and any modifications thereto. Any use, reproduction,
25 // disclosure or distribution of this material and related documentation
26 // without an express license agreement from NVIDIA CORPORATION or
27 // its affiliates is 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 
150 dwStatus dwSensorCAN_setUseHwTimestamps(bool const flag, dwSensorHandle_t const sensor);
151 
175 dwStatus dwSensorCAN_setMessageFilter(const uint32_t* ids, const uint32_t* masks,
176  uint16_t num, dwSensorHandle_t sensor);
177 
194 dwStatus dwSensorCAN_readMessage(dwCANMessage* const msg, dwTime_t const timeoutUs, dwSensorHandle_t const sensor);
195 
218  dwTime_t const timeoutUs, dwSensorHandle_t const 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
uint16_t size
Number of bytes of the payload.
Definition: CAN.h:121
DW_API_PUBLIC dwStatus dwSensorCAN_setUseHwTimestamps(bool const flag, dwSensorHandle_t const sensor)
Enables or disables hardware timestamp of the CAN messages.
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.
DW_API_PUBLIC dwStatus dwSensorCAN_sendMessage(const dwCANMessage *const msg, dwTime_t const timeoutUs, dwSensorHandle_t const sensor)
Sends a message over the CAN bus within a specified timeout.
struct dwSensorObject * dwSensorHandle_t
Handle representing a sensor.
Definition: Sensors.h:85
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_readMessage(dwCANMessage *const msg, dwTime_t const timeoutUs, dwSensorHandle_t const sensor)
Reads a CAN packet with a given timeout from the CAN bus.
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