1# 2# Copyright 2018, Data61 3# Commonwealth Scientific and Industrial Research Organisation (CSIRO) 4# ABN 41 687 119 230. 5# 6# This software may be distributed and modified according to the terms of 7# the BSD 2-Clause license. Note that NO WARRANTY is provided. 8# See "LICENSE_BSD2.txt" for details. 9# 10# @TAG(DATA61_BSD) 11# 12 13cmake_minimum_required(VERSION 3.8.2) 14 15project(libethdrivers C) 16 17set(configure_string "") 18 19config_string( 20 LibEthdriverRXDescCount 21 LIB_ETHDRIVER_RX_DESC_COUNT 22 "Number of RX descriptors in the descriptor ring for the driver." 23 DEFAULT 24 128 25 UNQUOTE 26) 27 28config_string( 29 LibEthdriverTXDescCount 30 LIB_ETHDRIVER_TX_DESC_COUNT 31 "Number of TX descriptors in the descriptor ring for the driver." 32 DEFAULT 33 128 34 UNQUOTE 35) 36 37config_string( 38 LibEthdriverNumPreallocatedBuffers 39 LIB_ETHDRIVER_NUM_PREALLOCATED_BUFFERS 40 "Number of preallocated DMA buffers 41 To avoid allocating and freeing buffers continuously the driver 42 can preallocate a base amount internally." 43 DEFAULT 44 512 45 UNQUOTE 46) 47 48config_string( 49 LibEthdriverPreallocatedBufSize 50 LIB_ETHDRIVER_PREALLOCATED_BUF_SIZE 51 "Size of preallocated DMA buffers 52 The size of each preallocated buffer that will be used for RX and 53 TX allocation requests. This needs to be the maximum of the RX buffer 54 size and the MTU. Currently the largest RX buffer of any of the 55 implemented drivers is 2048, and the MTU is 1500" 56 DEFAULT 57 2048 58 UNQUOTE 59) 60 61config_option(LibEthdriverPicoTCBAsyncDriver LIB_PICOTCP_ASYNC_DRIVER "Async driver for PicoTcp 62 Use an async instead of a polling driver for PicoTCP." DEFAULT ON) 63mark_as_advanced( 64 LibEthdriverRXDescCount 65 LibEthdriverTXDescCount 66 LibEthdriverNumPreallocatedBuffers 67 LibEthdriverPreallocatedBufSize 68 LibEthdriverPicoTCBAsyncDriver 69) 70add_config_library(ethdrivers "${configure_string}") 71 72if("${KernelPlatform}" MATCHES "imx8mq-evk") 73 # Re-use the imx6 sources 74 set(PlatPrefix "imx6") 75else() 76 set(PlatPrefix "${KernelPlatform}") 77endif() 78 79file( 80 GLOB 81 sources 82 src/plat/${PlatPrefix}/*.c 83 src/plat/${PlatPrefix}/uboot/*.c 84 src/plat/${PlatPrefix}/cpsw/*.c 85 src/*.c 86) 87 88add_library(ethdrivers STATIC EXCLUDE_FROM_ALL ${sources}) 89target_include_directories(ethdrivers PRIVATE src/plat/${PlatPrefix}/cpsw) 90target_include_directories( 91 ethdrivers 92 PUBLIC include plat_include/${PlatPrefix} arch_include/${KernelArch} 93) 94target_link_libraries( 95 ethdrivers 96 muslc 97 platsupport 98 ethdrivers_Config 99 lwip_Config 100 picotcp_Config 101 sel4_autoconf 102) 103if(LibLwip) 104 target_link_libraries(ethdrivers lwip) 105endif() 106if(LibPicotcp) 107 target_link_libraries(ethdrivers picotcp) 108endif() 109 110if("${KernelPlatform}" STREQUAL "tx2") 111 target_link_libraries(ethdrivers platsupportports) 112endif() 113target_link_libraries( 114 ethdrivers 115 "-Wl,--undefined=tx2_ether_qos_ptr,--undefined=zynq7000_gem_ptr,--undefined=imx_fec_ptr" 116) 117