1 /*
2  * Copyright (c) 2022 Vestas Wind Systems A/S
3  * Copyright (c) 2019 Alexander Wachter
4  *
5  * SPDX-License-Identifier: Apache-2.0
6  */
7 
8 #include <zephyr/drivers/can.h>
9 #include <zephyr/ztest.h>
10 
11 #include "common.h"
12 
13 /**
14  * @addtogroup t_can_driver
15  * @{
16  * @defgroup t_can_canfd test_can_canfd
17  * @}
18  */
19 
tx_std_callback_1(const struct device * dev,int error,void * user_data)20 static void tx_std_callback_1(const struct device *dev, int error, void *user_data)
21 {
22 	const struct can_frame *frame = user_data;
23 
24 	k_sem_give(&tx_callback_sem);
25 
26 	zassert_equal(dev, can_dev, "CAN device does not match");
27 	zassert_equal(frame->id, TEST_CAN_STD_ID_1, "ID does not match");
28 }
29 
tx_std_callback_2(const struct device * dev,int error,void * user_data)30 static void tx_std_callback_2(const struct device *dev, int error, void *user_data)
31 {
32 	const struct can_frame *frame = user_data;
33 
34 	k_sem_give(&tx_callback_sem);
35 
36 	zassert_equal(dev, can_dev, "CAN device does not match");
37 	zassert_equal(frame->id, TEST_CAN_STD_ID_2, "ID does not match");
38 }
39 
rx_std_callback_1(const struct device * dev,struct can_frame * frame,void * user_data)40 static void rx_std_callback_1(const struct device *dev, struct can_frame *frame, void *user_data)
41 {
42 	struct can_filter *filter = user_data;
43 
44 	assert_frame_equal(frame, &test_std_frame_1, 0);
45 	zassert_equal(dev, can_dev, "CAN device does not match");
46 	zassert_equal_ptr(filter, &test_std_filter_1, "filter does not match");
47 
48 	k_sem_give(&rx_callback_sem);
49 }
50 
rx_std_callback_2(const struct device * dev,struct can_frame * frame,void * user_data)51 static void rx_std_callback_2(const struct device *dev, struct can_frame *frame, void *user_data)
52 {
53 	struct can_filter *filter = user_data;
54 
55 	assert_frame_equal(frame, &test_std_frame_2, 0);
56 	zassert_equal(dev, can_dev, "CAN device does not match");
57 	zassert_equal_ptr(filter, &test_std_filter_2, "filter does not match");
58 
59 	k_sem_give(&rx_callback_sem);
60 }
61 
rx_std_callback_fd_1(const struct device * dev,struct can_frame * frame,void * user_data)62 static void rx_std_callback_fd_1(const struct device *dev, struct can_frame *frame,
63 				 void *user_data)
64 {
65 	struct can_filter *filter = user_data;
66 
67 	assert_frame_equal(frame, &test_std_fdf_frame_1, 0);
68 	zassert_equal(dev, can_dev, "CAN device does not match");
69 	zassert_equal_ptr(filter, &test_std_filter_1, "filter does not match");
70 
71 	k_sem_give(&rx_callback_sem);
72 }
73 
rx_std_callback_fd_2(const struct device * dev,struct can_frame * frame,void * user_data)74 static void rx_std_callback_fd_2(const struct device *dev, struct can_frame *frame,
75 				 void *user_data)
76 {
77 	struct can_filter *filter = user_data;
78 
79 	assert_frame_equal(frame, &test_std_fdf_frame_2, 0);
80 	zassert_equal(dev, can_dev, "CAN device does not match");
81 	zassert_equal_ptr(filter, &test_std_filter_2, "filter does not match");
82 
83 	k_sem_give(&rx_callback_sem);
84 }
85 
86 /**
87  * @brief Send a CAN test frame with asserts.
88  *
89  * This function will block until the frame is transmitted or a test timeout
90  * occurs.
91  *
92  * @param dev   Pointer to the device structure for the driver instance.
93  * @param frame Pointer to the CAN frame to send.
94  */
send_test_frame(const struct device * dev,const struct can_frame * frame)95 static void send_test_frame(const struct device *dev, const struct can_frame *frame)
96 {
97 	int err;
98 
99 	err = can_send(dev, frame, TEST_SEND_TIMEOUT, NULL, NULL);
100 	zassert_not_equal(err, -EBUSY, "arbitration lost in loopback mode");
101 	zassert_equal(err, 0, "failed to send frame (err %d)", err);
102 }
103 
104 /**
105  * @brief Send a CAN test frame with asserts.
106  *
107  * This function will block until the frame is queued or a test timeout
108  * occurs.
109  *
110  * @param dev      Pointer to the device structure for the driver instance.
111  * @param frame    Pointer to the CAN frame to send.
112  * @param callback Transmit callback function.
113  */
send_test_frame_nowait(const struct device * dev,const struct can_frame * frame,can_tx_callback_t callback)114 static void send_test_frame_nowait(const struct device *dev, const struct can_frame *frame,
115 				   can_tx_callback_t callback)
116 {
117 	int err;
118 
119 	err = can_send(dev, frame, TEST_SEND_TIMEOUT, callback, (void *)frame);
120 	zassert_not_equal(err, -EBUSY, "arbitration lost in loopback mode");
121 	zassert_equal(err, 0, "failed to send frame (err %d)", err);
122 }
123 
124 /**
125  * @brief Add a CAN message queue with asserts.
126  *
127  * @param dev    Pointer to the device structure for the driver instance.
128  * @param filter CAN filter for the CAN message queue.
129  *
130  * @return CAN filter ID.
131  */
add_rx_msgq(const struct device * dev,const struct can_filter * filter)132 static inline int add_rx_msgq(const struct device *dev, const struct can_filter *filter)
133 {
134 	int filter_id;
135 
136 	filter_id = can_add_rx_filter_msgq(dev, &can_msgq, filter);
137 	zassert_not_equal(filter_id, -ENOSPC, "no filters available");
138 	zassert_true(filter_id >= 0, "negative filter number");
139 
140 	return filter_id;
141 }
142 
143 /**
144  * @brief Add a CAN filter with asserts.
145  *
146  * @param dev      Pointer to the device structure for the driver instance.
147  * @param filter   CAN filter.
148  * @param callback Receive callback function.
149  *
150  * @return CAN filter ID.
151  */
add_rx_filter(const struct device * dev,const struct can_filter * filter,can_rx_callback_t callback)152 static inline int add_rx_filter(const struct device *dev,
153 				const struct can_filter *filter,
154 				can_rx_callback_t callback)
155 {
156 	int filter_id;
157 
158 	k_sem_reset(&rx_callback_sem);
159 
160 	filter_id = can_add_rx_filter(dev, callback, (void *)filter, filter);
161 	zassert_not_equal(filter_id, -ENOSPC, "no filters available");
162 	zassert_true(filter_id >= 0, "negative filter number");
163 
164 	return filter_id;
165 }
166 
167 /**
168  * @brief Perform a send/receive test with a set of CAN ID filters and CAN frames.
169  *
170  * @param filter1 CAN filter 1
171  * @param filter2 CAN filter 2
172  * @param frame1  CAN frame 1
173  * @param frame2  CAN frame 2
174  */
send_receive(const struct can_filter * filter1,const struct can_filter * filter2,const struct can_frame * frame1,const struct can_frame * frame2)175 static void send_receive(const struct can_filter *filter1,
176 			 const struct can_filter *filter2,
177 			 const struct can_frame *frame1,
178 			 const struct can_frame *frame2)
179 {
180 	struct can_frame frame_buffer;
181 	int filter_id_1;
182 	int filter_id_2;
183 	int err;
184 
185 	filter_id_1 = add_rx_msgq(can_dev, filter1);
186 	send_test_frame(can_dev, frame1);
187 
188 	err = k_msgq_get(&can_msgq, &frame_buffer, TEST_RECEIVE_TIMEOUT);
189 	zassert_equal(err, 0, "receive timeout");
190 
191 	assert_frame_equal(&frame_buffer, frame1, 0);
192 	can_remove_rx_filter(can_dev, filter_id_1);
193 
194 	k_sem_reset(&tx_callback_sem);
195 
196 	if ((frame1->flags & CAN_FRAME_FDF) != 0) {
197 		filter_id_1 = add_rx_filter(can_dev, filter1, rx_std_callback_fd_1);
198 	} else {
199 		filter_id_1 = add_rx_filter(can_dev, filter1, rx_std_callback_1);
200 	}
201 
202 	if ((frame2->flags & CAN_FRAME_FDF) != 0) {
203 		filter_id_2 = add_rx_filter(can_dev, filter2, rx_std_callback_fd_2);
204 	} else {
205 		filter_id_2 = add_rx_filter(can_dev, filter2, rx_std_callback_2);
206 	}
207 
208 	send_test_frame_nowait(can_dev, frame1, tx_std_callback_1);
209 	send_test_frame_nowait(can_dev, frame2, tx_std_callback_2);
210 
211 	err = k_sem_take(&rx_callback_sem, TEST_RECEIVE_TIMEOUT);
212 	zassert_equal(err, 0, "receive timeout");
213 
214 	err = k_sem_take(&rx_callback_sem, TEST_RECEIVE_TIMEOUT);
215 	zassert_equal(err, 0, "receive timeout");
216 
217 	err = k_sem_take(&tx_callback_sem, TEST_SEND_TIMEOUT);
218 	zassert_equal(err, 0, "missing TX callback");
219 
220 	err = k_sem_take(&tx_callback_sem, TEST_SEND_TIMEOUT);
221 	zassert_equal(err, 0, "missing TX callback");
222 
223 	can_remove_rx_filter(can_dev, filter_id_1);
224 	can_remove_rx_filter(can_dev, filter_id_2);
225 }
226 
227 /**
228  * @brief Test getting the CAN controller capabilities.
229  */
ZTEST(canfd,test_canfd_get_capabilities)230 ZTEST(canfd, test_canfd_get_capabilities)
231 {
232 	can_mode_t cap;
233 	int err;
234 
235 	err = can_get_capabilities(can_dev, &cap);
236 	zassert_equal(err, 0, "failed to get CAN capabilities (err %d)", err);
237 	zassert_not_equal(cap & (CAN_MODE_LOOPBACK | CAN_MODE_FD), 0,
238 			  "CAN FD loopback mode not supported");
239 }
240 
241 /**
242  * @brief Test sending CAN FD frame with too big payload.
243  */
ZTEST(canfd,test_send_fd_dlc_out_of_range)244 ZTEST(canfd, test_send_fd_dlc_out_of_range)
245 {
246 	struct can_frame frame = {
247 		.flags = CAN_FRAME_FDF | CAN_FRAME_BRS,
248 		.id = TEST_CAN_STD_ID_1,
249 		.dlc = CANFD_MAX_DLC + 1U,
250 	};
251 	int err;
252 
253 	Z_TEST_SKIP_IFNDEF(CONFIG_RUNTIME_ERROR_CHECKS);
254 
255 	err = can_send(can_dev, &frame, TEST_SEND_TIMEOUT, NULL, NULL);
256 	zassert_equal(err, -EINVAL, "wrong error on sending invalid frame (err %d)", err);
257 }
258 
259 /**
260  * @brief Test error when CAN FD Error State Indicator (ESI) is set on transmit frame.
261  *
262  * CAN FD Error State Indicator (ESI) indicates that the transmitting node is in error-passive
263  * state, but should never be set explicitly. Setting it is handled in the CAN controller hardware.
264  */
ZTEST(canfd,test_send_fd_incorrect_esi)265 ZTEST(canfd, test_send_fd_incorrect_esi)
266 {
267 	struct can_frame frame = {
268 		.flags = CAN_FRAME_FDF | CAN_FRAME_ESI,
269 		.id = TEST_CAN_STD_ID_1,
270 		.dlc = 0,
271 	};
272 	int err;
273 
274 	err = can_send(can_dev, &frame, TEST_SEND_TIMEOUT, NULL, NULL);
275 	zassert_equal(err, -ENOTSUP, "wrong error on sending invalid frame (err %d)", err);
276 }
277 
278 /**
279  * @brief Test send/receive with standard (11-bit) CAN IDs and classic CAN frames.
280  */
ZTEST(canfd,test_send_receive_classic)281 ZTEST(canfd, test_send_receive_classic)
282 {
283 	send_receive(&test_std_filter_1, &test_std_filter_2,
284 		     &test_std_frame_1, &test_std_frame_2);
285 }
286 
287 /**
288  * @brief Test send/receive with standard (11-bit) CAN IDs and CAN FD frames.
289  */
ZTEST(canfd,test_send_receive_fd)290 ZTEST(canfd, test_send_receive_fd)
291 {
292 	send_receive(&test_std_filter_1, &test_std_filter_2,
293 		     &test_std_fdf_frame_1, &test_std_fdf_frame_2);
294 }
295 
296 /**
297  * @brief Test send/receive with (11-bit) CAN IDs, mixed classic and CAN FD frames.
298  */
ZTEST(canfd,test_send_receive_mixed)299 ZTEST(canfd, test_send_receive_mixed)
300 {
301 	send_receive(&test_std_filter_1, &test_std_filter_2,
302 		     &test_std_fdf_frame_1, &test_std_frame_2);
303 }
304 
305 /**
306  * @brief Test that CAN RX filters are preserved through CAN controller mode changes.
307  */
check_filters_preserved_between_modes(can_mode_t first,can_mode_t second)308 static void check_filters_preserved_between_modes(can_mode_t first, can_mode_t second)
309 {
310 	struct can_frame frame;
311 	enum can_state state;
312 	int filter_id_1;
313 	int filter_id_2;
314 	int err;
315 
316 	/* Stop controller and set first mode */
317 	err = can_stop(can_dev);
318 	zassert_equal(err, 0, "failed to stop CAN controller (err %d)", err);
319 
320 	err = can_get_state(can_dev, &state, NULL);
321 	zassert_equal(err, 0, "failed to get CAN state (err %d)", err);
322 	zassert_equal(state, CAN_STATE_STOPPED, "CAN controller not stopped");
323 
324 	err = can_set_mode(can_dev, first | CAN_MODE_LOOPBACK);
325 	zassert_equal(err, 0, "failed to set first loopback mode (err %d)", err);
326 	zassert_equal(first | CAN_MODE_LOOPBACK, can_get_mode(can_dev));
327 
328 	err = can_start(can_dev);
329 	zassert_equal(err, 0, "failed to start CAN controller (err %d)", err);
330 
331 	/* Add classic CAN and CAN FD filter */
332 	filter_id_1 = add_rx_msgq(can_dev, &test_std_filter_1);
333 	filter_id_2 = add_rx_msgq(can_dev, &test_std_filter_2);
334 
335 	/* Verify classic filter in first mode */
336 	send_test_frame(can_dev, &test_std_frame_1);
337 	err = k_msgq_get(&can_msgq, &frame, TEST_RECEIVE_TIMEOUT);
338 	zassert_equal(err, 0, "receive timeout");
339 	assert_frame_equal(&frame, &test_std_frame_1, 0);
340 
341 	if ((first & CAN_MODE_FD) != 0) {
342 		/* Verify CAN FD filter in first mode */
343 		send_test_frame(can_dev, &test_std_fdf_frame_2);
344 		err = k_msgq_get(&can_msgq, &frame, TEST_RECEIVE_TIMEOUT);
345 		zassert_equal(err, 0, "receive timeout");
346 		assert_frame_equal(&frame, &test_std_fdf_frame_2, 0);
347 	}
348 
349 	/* Stop controller and set second mode */
350 	err = can_stop(can_dev);
351 	zassert_equal(err, 0, "failed to stop CAN controller (err %d)", err);
352 
353 	err = can_get_state(can_dev, &state, NULL);
354 	zassert_equal(err, 0, "failed to get CAN state (err %d)", err);
355 	zassert_equal(state, CAN_STATE_STOPPED, "CAN controller not stopped");
356 
357 	err = can_set_mode(can_dev, second | CAN_MODE_LOOPBACK);
358 	zassert_equal(err, 0, "failed to set second loopback mode (err %d)", err);
359 	zassert_equal(second | CAN_MODE_LOOPBACK, can_get_mode(can_dev));
360 
361 	err = can_start(can_dev);
362 	zassert_equal(err, 0, "failed to start CAN controller (err %d)", err);
363 
364 	/* Verify classic filter in second mode */
365 	send_test_frame(can_dev, &test_std_frame_1);
366 	err = k_msgq_get(&can_msgq, &frame, TEST_RECEIVE_TIMEOUT);
367 	zassert_equal(err, 0, "receive timeout");
368 	assert_frame_equal(&frame, &test_std_frame_1, 0);
369 
370 	if ((second & CAN_MODE_FD) != 0) {
371 		/* Verify CAN FD filter in second mode */
372 		send_test_frame(can_dev, &test_std_fdf_frame_2);
373 		err = k_msgq_get(&can_msgq, &frame, TEST_RECEIVE_TIMEOUT);
374 		zassert_equal(err, 0, "receive timeout");
375 		assert_frame_equal(&frame, &test_std_fdf_frame_2, 0);
376 	}
377 
378 	/* Stop controller and restore CAN FD loopback mode */
379 	err = can_stop(can_dev);
380 	zassert_equal(err, 0, "failed to stop CAN controller (err %d)", err);
381 
382 	err = can_get_state(can_dev, &state, NULL);
383 	zassert_equal(err, 0, "failed to get CAN state (err %d)", err);
384 	zassert_equal(state, CAN_STATE_STOPPED, "CAN controller not stopped");
385 
386 	err = can_set_mode(can_dev, CAN_MODE_FD | CAN_MODE_LOOPBACK);
387 	zassert_equal(err, 0, "failed to set loopback-mode (err %d)", err);
388 	zassert_equal(CAN_MODE_FD | CAN_MODE_LOOPBACK, can_get_mode(can_dev));
389 
390 	err = can_start(can_dev);
391 	zassert_equal(err, 0, "failed to start CAN controller (err %d)", err);
392 
393 	can_remove_rx_filter(can_dev, filter_id_1);
394 	can_remove_rx_filter(can_dev, filter_id_2);
395 }
396 
397 /**
398  * @brief Test that CAN RX filters are preserved through CAN controller mode changes between classic
399  * CAN and CAN FD.
400  */
ZTEST_USER(canfd,test_filters_preserved_through_classic_to_fd_mode_change)401 ZTEST_USER(canfd, test_filters_preserved_through_classic_to_fd_mode_change)
402 {
403 	check_filters_preserved_between_modes(CAN_MODE_NORMAL, CAN_MODE_FD);
404 }
405 
406 /**
407  * @brief Test that CAN RX filters are preserved through CAN controller mode changes between CAN FD
408  * and classic CAN.
409  */
ZTEST_USER(canfd,test_filters_preserved_through_fd_to_classic_mode_change)410 ZTEST_USER(canfd, test_filters_preserved_through_fd_to_classic_mode_change)
411 {
412 	check_filters_preserved_between_modes(CAN_MODE_FD, CAN_MODE_NORMAL);
413 }
414 
415 /**
416  * @brief Test that the minimum timing values for the data phase can be set.
417  */
ZTEST_USER(canfd,test_set_timing_data_min)418 ZTEST_USER(canfd, test_set_timing_data_min)
419 {
420 	int err;
421 
422 	err = can_stop(can_dev);
423 	zassert_equal(err, 0, "failed to stop CAN controller (err %d)", err);
424 
425 	err = can_set_timing_data(can_dev, can_get_timing_data_min(can_dev));
426 	zassert_equal(err, 0, "failed to set minimum timing data parameters (err %d)", err);
427 
428 	err = can_set_bitrate_data(can_dev, CONFIG_CAN_DEFAULT_BITRATE_DATA);
429 	zassert_equal(err, 0, "failed to restore default data bitrate");
430 
431 	err = can_start(can_dev);
432 	zassert_equal(err, 0, "failed to start CAN controller (err %d)", err);
433 }
434 
435 /**
436  * @brief Test setting a too low data phase bitrate.
437  */
ZTEST_USER(canfd,test_set_bitrate_data_too_low)438 ZTEST_USER(canfd, test_set_bitrate_data_too_low)
439 {
440 	uint32_t min = can_get_bitrate_min(can_dev);
441 	int err;
442 
443 	if (min == 0) {
444 		ztest_test_skip();
445 	}
446 
447 	err = can_stop(can_dev);
448 	zassert_equal(err, 0, "failed to stop CAN controller (err %d)", err);
449 
450 	err = can_set_bitrate_data(can_dev, min - 1);
451 	zassert_equal(err, -ENOTSUP, "too low data phase bitrate accepted");
452 
453 	err = can_set_bitrate_data(can_dev, CONFIG_CAN_DEFAULT_BITRATE_DATA);
454 	zassert_equal(err, 0, "failed to restore default data bitrate");
455 
456 	err = can_start(can_dev);
457 	zassert_equal(err, 0, "failed to start CAN controller (err %d)", err);
458 }
459 
460 /**
461  * @brief Test setting a too high data phase bitrate.
462  */
ZTEST_USER(canfd,test_set_bitrate_too_high)463 ZTEST_USER(canfd, test_set_bitrate_too_high)
464 {
465 	uint32_t max = can_get_bitrate_max(can_dev);
466 	int err;
467 
468 	err = can_stop(can_dev);
469 	zassert_equal(err, 0, "failed to stop CAN controller (err %d)", err);
470 
471 	err = can_set_bitrate_data(can_dev, max + 1);
472 	zassert_equal(err, -ENOTSUP, "too high data phase bitrate accepted");
473 
474 	err = can_start(can_dev);
475 	zassert_equal(err, 0, "failed to start CAN controller (err %d)", err);
476 }
477 
478 /**
479  * @brief Test using an invalid sample point.
480  */
ZTEST_USER(canfd,test_invalid_sample_point)481 ZTEST_USER(canfd, test_invalid_sample_point)
482 {
483 	struct can_timing timing;
484 	int err;
485 
486 	err = can_calc_timing_data(can_dev, &timing, TEST_BITRATE_3, 1000);
487 	zassert_equal(err, -EINVAL, "invalid sample point of 100.0% accepted (err %d)", err);
488 }
489 
490 /**
491  * @brief Test that the maximum timing values for the data phase can be set.
492  */
ZTEST_USER(canfd,test_set_timing_data_max)493 ZTEST_USER(canfd, test_set_timing_data_max)
494 {
495 	int err;
496 
497 	err = can_stop(can_dev);
498 	zassert_equal(err, 0, "failed to stop CAN controller (err %d)", err);
499 
500 	err = can_set_timing_data(can_dev, can_get_timing_data_max(can_dev));
501 	zassert_equal(err, 0, "failed to set maximum timing data parameters (err %d)", err);
502 
503 	err = can_set_bitrate_data(can_dev, CONFIG_CAN_DEFAULT_BITRATE_DATA);
504 	zassert_equal(err, 0, "failed to restore default data bitrate");
505 
506 	err = can_start(can_dev);
507 	zassert_equal(err, 0, "failed to start CAN controller (err %d)", err);
508 }
509 
510 /**
511  * @brief Test setting data phase bitrate is not allowed while started.
512  */
ZTEST_USER(canfd,test_set_bitrate_data_while_started)513 ZTEST_USER(canfd, test_set_bitrate_data_while_started)
514 {
515 	int err;
516 
517 	err = can_set_bitrate_data(can_dev, TEST_BITRATE_3);
518 	zassert_not_equal(err, 0, "changed data bitrate while started");
519 	zassert_equal(err, -EBUSY, "wrong error return code (err %d)", err);
520 }
521 
522 /**
523  * @brief Test setting data phase timing is not allowed while started.
524  */
ZTEST_USER(canfd,test_set_timing_data_while_started)525 ZTEST_USER(canfd, test_set_timing_data_while_started)
526 {
527 	struct can_timing timing = { 0 };
528 	int err;
529 
530 	err = can_calc_timing_data(can_dev, &timing, TEST_BITRATE_3, TEST_SAMPLE_POINT);
531 	zassert_ok(err, "failed to calculate data timing (err %d)", err);
532 
533 	err = can_set_timing_data(can_dev, &timing);
534 	zassert_not_equal(err, 0, "changed data timing while started");
535 	zassert_equal(err, -EBUSY, "wrong error return code (err %d)", err);
536 }
537 
canfd_predicate(const void * state)538 static bool canfd_predicate(const void *state)
539 {
540 	can_mode_t cap;
541 	int err;
542 
543 	ARG_UNUSED(state);
544 
545 	if (!device_is_ready(can_dev)) {
546 		TC_PRINT("CAN device not ready");
547 		return false;
548 	}
549 
550 	err = can_get_capabilities(can_dev, &cap);
551 	zassert_equal(err, 0, "failed to get CAN controller capabilities (err %d)", err);
552 
553 	if ((cap & CAN_MODE_FD) == 0) {
554 		return false;
555 	}
556 
557 	return true;
558 }
559 
canfd_setup(void)560 void *canfd_setup(void)
561 {
562 	can_common_test_setup(CAN_MODE_LOOPBACK | CAN_MODE_FD);
563 
564 	return NULL;
565 }
566 
567 ZTEST_SUITE(canfd, canfd_predicate, canfd_setup, NULL, NULL, NULL);
568