drivers: can: fake: specify maximum supported bitrate

Specify a maximum supported bitrate.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
This commit is contained in:
Henrik Brix Andersen 2024-04-08 11:42:49 +02:00 committed by Anas Nashif
parent 776f771172
commit be54b552d7

View file

@ -146,16 +146,22 @@ static const struct can_driver_api fake_can_driver_api = {
#endif /* CONFIG_CAN_FD_MODE */
};
#define FAKE_CAN_INIT(inst) \
static const struct fake_can_config fake_can_config_##inst = { \
.common = CAN_DT_DRIVER_CONFIG_INST_GET(inst, 0, 0), \
}; \
\
static struct fake_can_data fake_can_data_##inst; \
\
CAN_DEVICE_DT_INST_DEFINE(inst, NULL, NULL, &fake_can_data_##inst, \
&fake_can_config_##inst, POST_KERNEL, \
CONFIG_CAN_INIT_PRIORITY, \
#ifdef CONFIG_CAN_FD_MODE
#define FAKE_CAN_MAX_BITRATE 8000000
#else /* CONFIG_CAN_FD_MODE */
#define FAKE_CAN_MAX_BITRATE 1000000
#endif /* !CONFIG_CAN_FD_MODE */
#define FAKE_CAN_INIT(inst) \
static const struct fake_can_config fake_can_config_##inst = { \
.common = CAN_DT_DRIVER_CONFIG_INST_GET(inst, 0, FAKE_CAN_MAX_BITRATE), \
}; \
\
static struct fake_can_data fake_can_data_##inst; \
\
CAN_DEVICE_DT_INST_DEFINE(inst, NULL, NULL, &fake_can_data_##inst, \
&fake_can_config_##inst, POST_KERNEL, \
CONFIG_CAN_INIT_PRIORITY, \
&fake_can_driver_api);
DT_INST_FOREACH_STATUS_OKAY(FAKE_CAN_INIT)