1# SPDX-License-Identifier: Apache-2.0
2
3zephyr_syscall_header(${ZEPHYR_BASE}/include/zephyr/drivers/can.h)
4
5zephyr_library()
6zephyr_sources_ifdef(CONFIG_CAN_MCUX_MCAN    can_mcux_mcan.c)
7
8zephyr_library_sources_ifdef(CONFIG_CAN              can_common.c)
9zephyr_library_sources_ifdef(CONFIG_CAN_FAKE         can_fake.c)
10zephyr_library_sources_ifdef(CONFIG_CAN_LOOPBACK     can_loopback.c)
11zephyr_library_sources_ifdef(CONFIG_CAN_MCAN         can_mcan.c)
12zephyr_library_sources_ifdef(CONFIG_CAN_MCP2515      can_mcp2515.c)
13zephyr_library_sources_ifdef(CONFIG_CAN_MCP251XFD    can_mcp251xfd.c)
14zephyr_library_sources_ifdef(CONFIG_CAN_MCUX_FLEXCAN can_mcux_flexcan.c)
15zephyr_library_sources_ifdef(CONFIG_CAN_SAM          can_sam.c)
16zephyr_library_sources_ifdef(CONFIG_CAN_SAM0         can_sam0.c)
17zephyr_library_sources_ifdef(CONFIG_CAN_STM32_BXCAN  can_stm32_bxcan.c)
18zephyr_library_sources_ifdef(CONFIG_CAN_STM32_FDCAN  can_stm32_fdcan.c)
19zephyr_library_sources_ifdef(CONFIG_CAN_STM32H7_FDCAN can_stm32h7_fdcan.c)
20zephyr_library_sources_ifdef(CONFIG_CAN_TCAN4X5X     can_tcan4x5x.c)
21zephyr_library_sources_ifdef(CONFIG_CAN_RCAR         can_rcar.c)
22
23if(CONFIG_CAN_NATIVE_POSIX_LINUX)
24  if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL Linux)
25    zephyr_library_include_directories(${ZEPHYR_BASE}/subsys/net/l2)
26    zephyr_library_compile_definitions(NO_POSIX_CHEATS)
27    zephyr_library_compile_definitions(_BSD_SOURCE)
28    zephyr_library_compile_definitions(_DEFAULT_SOURCE)
29    zephyr_library_sources(
30      can_native_posix_linux.c
31      can_native_posix_linux_socketcan.c
32    )
33  else()
34    message(FATAL_ERROR "CONFIG_CAN_NATIVE_POSIX_LINUX only available on Linux")
35  endif()
36endif()
37
38zephyr_library_sources_ifdef(CONFIG_CAN_SJA1000      can_sja1000.c)
39zephyr_library_sources_ifdef(CONFIG_CAN_ESP32_TWAI   can_esp32_twai.c)
40zephyr_library_sources_ifdef(CONFIG_CAN_KVASER_PCI   can_kvaser_pci.c)
41
42zephyr_library_sources_ifdef(CONFIG_USERSPACE        can_handlers.c)
43zephyr_library_sources_ifdef(CONFIG_CAN_SHELL        can_shell.c)
44zephyr_library_sources_ifdef(CONFIG_CAN_NXP_S32_CANXL    can_nxp_s32_canxl.c)
45
46add_subdirectory(transceiver)
47