38 lines
1.6 KiB
C++
38 lines
1.6 KiB
C++
/*
|
|
* RtlSdr.hpp
|
|
* Realtek RTL2832U + R820T2 software-defined-radio receiver (RTL-SDR).
|
|
*
|
|
* The RTL2832U is a DVB-T demodulator that, in raw mode, streams 8-bit
|
|
* unsigned I/Q samples over a USB bulk-IN endpoint. This driver brings up the
|
|
* demodulator + R820T2 tuner, configures the resampler / IF, and feeds the
|
|
* bulk-IN samples into the generic SDR receive subsystem (Drivers::Radio::Sdr),
|
|
* which userspace reaches through the SYS_SDR_* syscalls.
|
|
* Copyright (c) 2026 Daniel Hammer
|
|
*/
|
|
|
|
#pragma once
|
|
#include <cstdint>
|
|
|
|
namespace Drivers::USB::Radio {
|
|
|
|
// True if a USB VID:PID identifies a supported RTL2832U-based SDR dongle.
|
|
bool IsRtlSdr(uint16_t vid, uint16_t pid);
|
|
|
|
// Called by USB enumeration once the bulk-IN endpoint has been configured.
|
|
// Registers a receiver with the SDR subsystem; the demod/tuner are brought
|
|
// up lazily on first use (in process context, never from the USB poll path).
|
|
void RegisterDevice(uint8_t slotId);
|
|
|
|
// Tear down on unplug.
|
|
void UnregisterDevice(uint8_t slotId);
|
|
|
|
// -------------------------------------------------------------------------
|
|
// I2C facade used by the R820T2 tuner module. These carry the tuner's
|
|
// register traffic over the demod's I2C block. The control-transfer mutex
|
|
// is held by the calling op wrapper, so these do not lock themselves.
|
|
// -------------------------------------------------------------------------
|
|
bool RtlI2cWrite(uint8_t slotId, uint8_t i2cAddr, const uint8_t* buf, uint8_t len);
|
|
bool RtlI2cRead(uint8_t slotId, uint8_t i2cAddr, uint8_t* buf, uint8_t len);
|
|
|
|
}
|