Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,15 @@ if(DEVOURER_KESTREL)
target_include_directories(kestrelprobe PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/examples/common)
endif()

# cellcaps — print the AdapterCaps that gate a cell node (USB or, with
# DEVOURER_PCIE, vfio PCIe). examples/common/radio_open.h selects the radio;
# a POSIX bench tool (libusb + _exit), like the other radio_open probes.
if(NOT WIN32)
add_executable(cellcaps examples/cellcaps/main.cpp examples/common/env_config.cpp)
target_link_libraries(cellcaps PUBLIC devourer PRIVATE PkgConfig::libusb)
target_include_directories(cellcaps PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/examples/common)
endif()

# rtl8733bprobe — staged USB bring-up prober for the RTL8733B (HALMAC 87xx),
# the pcieprobe/kestrelprobe sibling: identity -> power-on + EFUSE -> firmware
# -> MAC/PHY -> TSSI audit stages, used alongside normal factory dispatch. It
Expand Down
3 changes: 2 additions & 1 deletion examples/cell/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@
#include "cell/LinkAdapt.h"
#include "cell/SlotGrid.h"
#include "logger.h"
#include "cell_caps.h"
#include "radio_open.h"
#include "cell/CellScheduler.h"
#include "cell/ChannelSwitch.h"
Expand Down Expand Up @@ -564,7 +565,7 @@ int64_t sleep_until_tsf(IRadio *dev, int64_t target) {

bool caps_ok(IRadio *dev) {
const auto c = dev->GetAdapterCaps();
if (!c.tsf_write_ok || !c.tbtt_follows_tsf || !c.beacon_backoff_ctl || !c.hw_beacon_txtsf) {
if (!devourer::cell_node_caps_ok(c)) {
fprintf(stderr, "this radio cannot run a cell node (tsf_write_ok=%d tbtt_follows_tsf=%d "
"beacon_backoff_ctl=%d hw_beacon_txtsf=%d)\n",
c.tsf_write_ok, c.tbtt_follows_tsf, c.beacon_backoff_ctl, c.hw_beacon_txtsf);
Expand Down
28 changes: 28 additions & 0 deletions examples/cellcaps/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* cellcaps — open the radio named in the environment (USB via DEVOURER_VID/
* PID, or PCIe via DEVOURER_PCIE_BDF) and print the AdapterCaps that decide
* whether it can run a cell node (examples/cell caps_ok), as JSON. Read-only
* beyond the normal bring-up the open path does; no beacon, no TX. */
#include <cstdio>
#include <memory>

#include "cell_caps.h"
#include "radio_open.h"

int main() {
auto logger = std::make_shared<Logger>();
OpenedRadio radio = open_radio_from_env(logger, 0x0bda, 0);
if (!radio.dev) {
fprintf(stderr, "cellcaps: open failed\n");
return 1;
}
const auto c = radio.dev->GetAdapterCaps();
const bool cell_ok = devourer::cell_node_caps_ok(c);
printf("{\"ev\":\"cellcaps\",\"radio\":\"%s\",\"chip\":\"%s\",\"variant\":\"%s\",\"transport\":\"%s\","
"\"tsf_write_ok\":%d,\"tbtt_follows_tsf\":%d,\"beacon_backoff_ctl\":%d,\"hw_beacon_txtsf\":%d,"
"\"ack_responder_ok\":%d,\"hw_rx_timestamp\":%d,\"hw_injected_mgmt_txtsf\":%d,"
"\"cell_node_ok\":%d}\n",
radio.label.c_str(), c.chip_name, c.variant, c.transport, c.tsf_write_ok, c.tbtt_follows_tsf,
c.beacon_backoff_ctl, c.hw_beacon_txtsf, c.ack_responder_ok, c.hw_rx_timestamp,
c.hw_injected_mgmt_txtsf, cell_ok ? 1 : 0);
return 0;
}
20 changes: 20 additions & 0 deletions examples/common/cell_caps.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// cell_caps.h — the single source of truth for which AdapterCaps a radio
// needs to run an examples/cell node (a DU or a UE): write its TSF, have the
// beacon TBTT follow that TSF, control the beacon-queue backoff, and stamp the
// live TSF into the beacon at TX. Both examples/cell (caps_ok) and the
// examples/cellcaps probe use this, so the probe's verdict cannot drift from
// the gate the cell node actually applies.
#ifndef DEVOURER_EXAMPLES_CELL_CAPS_H
#define DEVOURER_EXAMPLES_CELL_CAPS_H

#include "AdapterCaps.h"

namespace devourer {

inline bool cell_node_caps_ok(const AdapterCaps &c) {
return c.tsf_write_ok && c.tbtt_follows_tsf && c.beacon_backoff_ctl && c.hw_beacon_txtsf;
}

} // namespace devourer

#endif // DEVOURER_EXAMPLES_CELL_CAPS_H
Loading