mirror of
https://github.com/EttusResearch/uhd.git
synced 2026-10-25 17:36:10 +00:00
b300: depend on installed nib310rio.h for Linux PCIe support
Remove the vendored copy of nib310rio.h from the inchworm tree and
replace it with a build-time dependency on the header installed by
the nib310rio-dev package:
/usr/include/nib310rio/nib310rio.h
CMake now searches for this header before registering the B300
component. On Linux, if the header is absent, B300 support is
silently skipped with a status message pointing to the missing
package. If the user explicitly passes -DENABLE_B300=ON without
the header present, CMake fails with a clear error.
Update the two Linux-only include sites to use the system path:
#include <nib310rio/nib310rio.h>
This makes the build-time dependency on the kernel driver explicit
and removes the risk of the vendored copy drifting out of sync with
the installed driver.
Signed-off-by: Virendra Kakade <virendra.kakade@ni.com>
This commit is contained in:
parent
a9ddd67fb9
commit
3716dd0884
@ -65,7 +65,26 @@ LIBUHD_REGISTER_COMPONENT("USB" ENABLE_USB ON "ENABLE_LIBUHD;LIBUSB_FOUND" OFF O
|
||||
# Devices
|
||||
LIBUHD_REGISTER_COMPONENT("B100" ENABLE_B100 ON "ENABLE_LIBUHD;ENABLE_USB" OFF OFF)
|
||||
LIBUHD_REGISTER_COMPONENT("B200" ENABLE_B200 ON "ENABLE_LIBUHD;ENABLE_USB" OFF OFF)
|
||||
LIBUHD_REGISTER_COMPONENT("B300" ENABLE_B300 ON "ENABLE_LIBUHD" OFF OFF)
|
||||
# B300 support is available on Linux and Windows.
|
||||
# Only Linux requires the nib310rio kernel driver userspace header.
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
find_file(NIB310RIO_HEADER
|
||||
NAMES nib310rio/nib310rio.h
|
||||
DOC "nib310rio kernel driver userspace header (from nib310rio-dev package)")
|
||||
if(NIB310RIO_HEADER)
|
||||
set(NIB310RIO_FOUND TRUE)
|
||||
else()
|
||||
set(NIB310RIO_FOUND FALSE)
|
||||
message(STATUS "nib310rio/nib310rio.h not found — B300 support requires the nib310rio-dev package.")
|
||||
endif()
|
||||
elseif(WIN32)
|
||||
# Windows B300 support does not depend on nib310rio/nib310rio.h.
|
||||
set(NIB310RIO_FOUND TRUE)
|
||||
else()
|
||||
# B300 is not supported on other platforms (e.g., macOS).
|
||||
set(NIB310RIO_FOUND FALSE)
|
||||
endif()
|
||||
LIBUHD_REGISTER_COMPONENT("B300" ENABLE_B300 ON "ENABLE_LIBUHD;NIB310RIO_FOUND" OFF OFF)
|
||||
LIBUHD_REGISTER_COMPONENT("USRP1" ENABLE_USRP1 ON "ENABLE_LIBUHD;ENABLE_USB" OFF OFF)
|
||||
LIBUHD_REGISTER_COMPONENT("USRP2" ENABLE_USRP2 ON "ENABLE_LIBUHD" OFF OFF)
|
||||
LIBUHD_REGISTER_COMPONENT("X300" ENABLE_X300 ON "ENABLE_LIBUHD" OFF OFF)
|
||||
|
||||
@ -7,7 +7,6 @@
|
||||
#include "./inchworm/user/libnifpga-usrp/src/Exception.h"
|
||||
#include "./inchworm/user/libnifpga-usrp/src/SysfsFile.h"
|
||||
#include "./inchworm/user/libnifpga-usrp/src/Timer.h"
|
||||
#include "./inchworm/user/libnifpga-usrp/src/nib310rio.h"
|
||||
#include "b300_regs.hpp"
|
||||
#include <uhd/config.h>
|
||||
#include <uhd/exception.hpp>
|
||||
@ -15,6 +14,7 @@
|
||||
#include <uhdlib/usrp/b300/b300_pcie_fifo.hpp>
|
||||
#include <uhdlib/usrp/b300/b300_pcie_session.hpp>
|
||||
#include <fcntl.h>
|
||||
#include <nib310rio/nib310rio.h>
|
||||
#include <system_error>
|
||||
#include <unistd.h>
|
||||
#include <cerrno>
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
#include "Fifo.h"
|
||||
#include "ErrnoMap.h"
|
||||
#include "Exception.h"
|
||||
#include "nib310rio.h"
|
||||
#include <nib310rio/nib310rio.h>
|
||||
#include <unistd.h> // sysconf
|
||||
#include <cassert> // assert
|
||||
#include <cstdlib> // valloc
|
||||
|
||||
@ -1,68 +0,0 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0+ WITH Linux-syscall-note */
|
||||
#ifndef __NIB310RIO_H__
|
||||
#define __NIB310RIO_H__
|
||||
|
||||
#include <linux/types.h>
|
||||
|
||||
#define NIB310RIO_IOC_MAGIC (93)
|
||||
|
||||
struct ioctl_nib310rio_array
|
||||
{
|
||||
__u32 offset;
|
||||
__u32 count;
|
||||
__u32 data[0];
|
||||
};
|
||||
|
||||
struct ioctl_nib310rio_fifo_set_buf
|
||||
{
|
||||
__u32 fd;
|
||||
};
|
||||
|
||||
struct ioctl_nib310rio_fifo_acquire
|
||||
{
|
||||
__aligned_u64 elements;
|
||||
__aligned_u64 available;
|
||||
__u32 timeout_ms;
|
||||
__u32 timed_out;
|
||||
};
|
||||
|
||||
struct ioctl_nib310rio_irq_wait
|
||||
{
|
||||
__u32 ctx;
|
||||
__u32 mask;
|
||||
__u32 timeout_ms;
|
||||
__u32 asserted;
|
||||
__u32 timed_out;
|
||||
};
|
||||
|
||||
struct ioctl_nib310rio_reg32
|
||||
{
|
||||
__u32 offset;
|
||||
__u32 value;
|
||||
};
|
||||
|
||||
struct ioctl_nib310rio_reg64
|
||||
{
|
||||
__u32 offset;
|
||||
__u64 value;
|
||||
};
|
||||
|
||||
#define NIB310RIO_IOC_FIFO_STOP _IO(NIB310RIO_IOC_MAGIC, 2)
|
||||
#define NIB310RIO_IOC_FIFO_START _IO(NIB310RIO_IOC_MAGIC, 3)
|
||||
#define NIB310RIO_IOC_FIFO_SET_BUF \
|
||||
_IOW(NIB310RIO_IOC_MAGIC, 4, struct ioctl_nib310rio_fifo_set_buf)
|
||||
#define NIB310RIO_IOC_FIFO_ACQUIRE \
|
||||
_IOWR(NIB310RIO_IOC_MAGIC, 5, struct ioctl_nib310rio_fifo_acquire)
|
||||
#define NIB310RIO_IOC_FIFO_RELEASE _IOW(NIB310RIO_IOC_MAGIC, 6, __u64)
|
||||
#define NIB310RIO_IOC_FIFO_GET_AVAIL _IOR(NIB310RIO_IOC_MAGIC, 7, __u64)
|
||||
#define NIB310RIO_IOC_IRQ_CTX_ALLOC _IOR(NIB310RIO_IOC_MAGIC, 10, __u32)
|
||||
#define NIB310RIO_IOC_IRQ_CTX_FREE _IOW(NIB310RIO_IOC_MAGIC, 11, __u32)
|
||||
#define NIB310RIO_IOC_IRQ_WAIT \
|
||||
_IOWR(NIB310RIO_IOC_MAGIC, 12, struct ioctl_nib310rio_irq_wait)
|
||||
#define NIB310RIO_IOC_IRQ_ACK _IOW(NIB310RIO_IOC_MAGIC, 13, __u32)
|
||||
#define NIB310RIO_IOC_PEEK32 _IOWR(NIB310RIO_IOC_MAGIC, 20, struct ioctl_nib310rio_reg32)
|
||||
#define NIB310RIO_IOC_POKE32 _IOW(NIB310RIO_IOC_MAGIC, 21, struct ioctl_nib310rio_reg32)
|
||||
#define NIB310RIO_IOC_PEEK64 _IOWR(NIB310RIO_IOC_MAGIC, 22, struct ioctl_nib310rio_reg64)
|
||||
#define NIB310RIO_IOC_POKE64 _IOW(NIB310RIO_IOC_MAGIC, 23, struct ioctl_nib310rio_reg64)
|
||||
|
||||
#endif
|
||||
Loading…
Reference in New Issue
Block a user