driver changes - channel switching, sema timeout reduction, api frequency ranges bugfix for hif

pull/176/head
David Michaeli 2024-01-11 00:18:30 +02:00
rodzic b1ca9bf3ca
commit acaed4836f
114 zmienionych plików z 19263 dodań i 8904 usunięć

Wyświetl plik

@ -58,15 +58,14 @@ install() {
if [[ ! $output_dir == *`uname -r`* ]]; then
printf "${CYAN}Warning: Not installing to currently operating kernel version.${NC}\n"
fi
printf "\n[ 3 ] ${GREEN}Installing into '${output_dir}'${NC}\n"
xz -z ${ROOT_DIR}/$BUILD_DIR/smi_stream_dev.ko -c > ${ROOT_DIR}/$BUILD_DIR/smi_stream_dev.ko.xz
for dir in $output_dir; do
sudo cp ${ROOT_DIR}/$BUILD_DIR/smi_stream_dev.ko.xz $dir/
done
printf "\n[ 4 ] ${GREEN}Updating 'depmod'${NC}\n"
sudo depmod -a
@ -86,46 +85,46 @@ install() {
cd ${ROOT_DIR}/udev
sudo ./install.sh install
cd ${ROOT_DIR}
printf "${GREEN}Installation completed.${NC}\n"
}
uninstall() {
printf "${GREEN}Uninstalling started...${NC}\n"
# find the location of the older installed module
output_dir=$(find "/lib/modules" -type f -name "smi_stream_dev*" -exec dirname {} \;)
if [ -z "$output_dir" ]; then
printf "${CYAN}Warning: module 'smi_stream_dev' is not installed in the system${NC}\n"
sudo depmod -a
exit 0
fi
printf "\n[ 1 ] ${GREEN}Uninstalling from '${output_dir}'${NC}\n"
sudo rm ${output_dir}/smi_stream_dev.ko.xz
printf "\n[ 2 ] ${GREEN}Updating 'depmod'${NC}\n"
sudo depmod -a
printf "\n[ 3 ] ${GREEN}Removing the blacklist on the legacy smi device${NC}\n"
if [ -f "/etc/modprobe.d/blacklist-bcm_smi.conf" ]; then
sudo rm "/etc/modprobe.d/blacklist-bcm_smi.conf"
fi
printf "\n[ 4 ] ${GREEN}Removing device driver loading on start${NC}\n"
if [ -f "/etc/modules-load.d/smi_stream_mod.conf" ]; then
sudo rm "/etc/modules-load.d/smi_stream_mod.conf"
fi
printf "\n[ 5 ] ${GREEN}Removing modprobe parameters${NC}\n"
if [ -f "/etc/modprobe.d/smi_stream_mod_cariboulite.conf" ]; then
sudo rm "/etc/modprobe.d/smi_stream_mod_cariboulite.conf"
fi
printf "\n[ 6 ] ${GREEN}Removing UDEV rules${NC}\n"
sudo udev/install.sh uninstall
printf "${GREEN}Uninstallation completed.${NC}\n"
}
@ -135,11 +134,11 @@ printf "${GREEN}=============================================${NC}\n\n"
if [ "$1" == "install" ]; then
install "$2" "$3" "$4"
exit 0
elif [ "$1" == "uninstall" ]; then
uninstall
exit 0
else
printf "${CYAN}Usage: $0 [install|uninstall] <mtu_mult dir_offs ch_offs>${NC}\n"

Wyświetl plik

@ -216,8 +216,8 @@ static void set_state(smi_stream_state_en state)
dev_info(inst->dev, "Set STREAMING_STATUS = %d, cur_addr = %d", state, inst->cur_address);
inst->address_changed = 1;
// abort the current timed out waiting on the current channel
if (inst->smi_inst != NULL && inst->reader_waiting_sema)
// abort the current waiting on the current channel
if (inst->smi_inst != NULL && inst->reader_waiting_sema && state == smi_stream_idle)
{
up(&inst->smi_inst->bounce.callback_sem);
}
@ -570,12 +570,6 @@ ssize_t stream_smi_user_dma( struct bcm2835_smi_instance *inst,
struct scatterlist *sgl = NULL;
spin_lock(&inst->transaction_lock);
//printk(KERN_ERR DRIVER_NAME": SMI-DISABLE\n");
/*if (smi_disable(inst, dma_dir) != 0)
{
dev_err(inst->dev, "smi_disable failed");
return 0;
}*/
sema_init(&inst->bounce.callback_sem, 0);
@ -601,7 +595,6 @@ ssize_t stream_smi_user_dma( struct bcm2835_smi_instance *inst,
dma_async_issue_pending(inst->dma_chan);
// we have only 8 bit width
if (dma_dir == DMA_DEV_TO_MEM)
{
int ret = smi_init_programmed_read(inst, DMA_BOUNCE_BUFFER_SIZE);
@ -629,18 +622,65 @@ ssize_t stream_smi_user_dma( struct bcm2835_smi_instance *inst,
}
/***************************************************************************/
int reader_thread_stream_function(void *pv)
/*int reader_thread_stream_function(void *pv)
{
int count = 0;
int current_dma_buffer = 0;
struct bcm2835_smi_bounce_info *bounce = NULL;
struct dma_async_tx_descriptor *desc = NULL;
ktime_t start;
s64 t1, t2, t3;
dev_info(inst->dev, "Enterred reader thread");
inst->reader_thread_running = true;
//=================================================
// create cyclic dma read
//=================================================
struct scatterlist *sgl = NULL;
bounce = &(inst->smi_inst->inst->bounce)
spin_lock(&inst->smi_inst->inst->transaction_lock);
sema_init(&inst->smi_inst->inst->bounce.callback_sem, 0);
desc = dmaengine_prep_dma_cyclic(inst->smi_inst->inst->dma_chan,
bounce->phys[0],
DMA_BOUNCE_BUFFER_SIZE,
DMA_BOUNCE_BUFFER_SIZE,
DMA_DEV_TO_MEM,
DMA_PREP_INTERRUPT | DMA_CTRL_ACK | DMA_PREP_FENCE);
if (!desc)
{
unsigned int timeout = 10000U;
write_smi_reg(inst->smi_inst->inst, read_smi_reg(inst->smi_inst->inst, SMICS) & ~SMICS_ACTIVE, SMICS);
while ((read_smi_reg(inst->smi_inst->inst, SMICS) & SMICS_ACTIVE) && (timeout--)>0)
{
cpu_relax();
}
write_smi_reg(inst->smi_inst->inst, read_smi_reg(inst, SMICS) | SMICS_ACTIVE, SMICS);
return 0;
}
desc->callback = callback;
desc->callback_param = inst;
if (dmaengine_submit(desc) < 0)
{
return 0;
}
dma_async_issue_pending(inst->smi_inst->inst->dma_chan);
int ret = smi_init_programmed_read(inst->smi_inst->inst, DMA_BOUNCE_BUFFER_SIZE);
if (ret != 0)
{
spin_unlock(&inst->smi_inst->inst->transaction_lock);
dev_err(inst->smi_inst->inst->dev, "smi_init_programmed_read returned %d", ret);
return 0;
}
spin_unlock(&inst->smi_inst->inst->transaction_lock);
//=================================================
// reader loop
//=================================================
while(!kthread_should_stop())
{
// check if the streaming state is on, if not, sleep and check again
@ -666,7 +706,7 @@ int reader_thread_stream_function(void *pv)
{
dev_err(inst->dev, "stream_smi_user_dma returned illegal count = %d, buff_num = %d", count, current_dma_buffer);
spin_lock(&inst->smi_inst->transaction_lock);
dmaengine_terminate_sync(inst->smi_inst->dma_chan);
dmaengine_terminate_all(inst->smi_inst->dma_chan);
spin_unlock(&inst->smi_inst->transaction_lock);
continue;
}
@ -676,15 +716,15 @@ int reader_thread_stream_function(void *pv)
//--------------------------------------------------------
// Don't wait for the buffer to fill in, copy the "other"
// previously filled up buffer into the kfifo
if (mutex_lock_interruptible(&inst->read_lock))
{
return -EINTR;
}
//if (mutex_lock_interruptible(&inst->read_lock))
//{
// return -EINTR;
//}
start = ktime_get();
kfifo_in(&inst->rx_fifo, bounce->buffer[1-current_dma_buffer], DMA_BOUNCE_BUFFER_SIZE);
mutex_unlock(&inst->read_lock);
//mutex_unlock(&inst->read_lock);
// for the polling mechanism
inst->readable = true;
@ -705,7 +745,7 @@ int reader_thread_stream_function(void *pv)
{
dev_info(inst->dev, "Reader DMA bounce timed out");
spin_lock(&inst->smi_inst->transaction_lock);
dmaengine_terminate_sync(inst->smi_inst->dma_chan);
dmaengine_terminate_all(inst->smi_inst->dma_chan);
spin_unlock(&inst->smi_inst->transaction_lock);
}
else
@ -725,6 +765,115 @@ int reader_thread_stream_function(void *pv)
inst->reader_thread_running = false;
inst->reader_waiting_sema = false;
return 0;
}*/
/***************************************************************************/
int reader_thread_stream_function(void *pv)
{
int count = 0;
int current_dma_buffer = 0;
struct bcm2835_smi_bounce_info *bounce = NULL;
ktime_t start;
s64 t1, t2, t3;
dev_info(inst->dev, "Enterred reader thread");
inst->reader_thread_running = true;
while(!kthread_should_stop())
{
// check if the streaming state is on, if not, sleep and check again
if (inst->state != smi_stream_rx_channel_0 && inst->state != smi_stream_rx_channel_1)
{
msleep(10);
continue;
}
start = ktime_get();
// sync smi address
if (inst->address_changed)
{
bcm2835_smi_set_address(inst->smi_inst, inst->cur_address);
inst->address_changed = 0;
}
//--------------------------------------------------------
// try setup a new DMA transfer into dma bounce buffer
// bounce will hold the current transfers state
count = stream_smi_user_dma(inst->smi_inst, DMA_DEV_TO_MEM, &bounce, current_dma_buffer);
if (count != DMA_BOUNCE_BUFFER_SIZE || bounce == NULL)
{
dev_err(inst->dev, "stream_smi_user_dma returned illegal count = %d, buff_num = %d", count, current_dma_buffer);
spin_lock(&inst->smi_inst->transaction_lock);
dmaengine_terminate_all(inst->smi_inst->dma_chan);
spin_unlock(&inst->smi_inst->transaction_lock);
continue;
}
t1 = ktime_to_ns(ktime_sub(ktime_get(), start));
//--------------------------------------------------------
// Don't wait for the buffer to fill in, copy the "other"
// previously filled up buffer into the kfifo
//if (mutex_lock_interruptible(&inst->read_lock))
//{
// return -EINTR;
//}
start = ktime_get();
kfifo_in(&inst->rx_fifo, bounce->buffer[1-current_dma_buffer], DMA_BOUNCE_BUFFER_SIZE);
//mutex_unlock(&inst->read_lock);
// for the polling mechanism
inst->readable = true;
wake_up_interruptible(&inst->poll_event);
t2 = ktime_to_ns(ktime_sub(ktime_get(), start));
//--------------------------------------------------------
// Wait for current chunk to complete
// the semaphore will go up when "stream_smi_dma_callback_user_copy" interrupt is trigerred
// indicating that the dma transfer finished. If doesn't happen in 1000 jiffies, we have a
// timeout. This means that we didn't get enough data into the buffer during this period. we shall
// "continue" and try again
start = ktime_get();
// wait for completion
inst->reader_waiting_sema = true;
if (down_timeout(&bounce->callback_sem, msecs_to_jiffies(200)))
{
dev_info(inst->dev, "Reader DMA bounce timed out");
spin_lock(&inst->smi_inst->transaction_lock);
dmaengine_terminate_all(inst->smi_inst->dma_chan);
spin_unlock(&inst->smi_inst->transaction_lock);
}
else
{
// if state has become idle
if (inst->state == smi_stream_idle)
{
dev_info(inst->dev, "Reader state became idle, terminating dma");
spin_lock(&inst->smi_inst->transaction_lock);
dmaengine_terminate_all(inst->smi_inst->dma_chan);
spin_unlock(&inst->smi_inst->transaction_lock);
}
//--------------------------------------------------------
// Switch the buffers
current_dma_buffer = 1-current_dma_buffer;
}
inst->reader_waiting_sema = false;
t3 = ktime_to_ns(ktime_sub(ktime_get(), start));
//dev_info(inst->dev, "TIMING (1,2,3): %lld %lld %lld %d", (long long)t1, (long long)t2, (long long)t3, current_dma_buffer);
}
dev_info(inst->dev, "Left reader thread");
inst->reader_thread_running = false;
inst->reader_waiting_sema = false;
return 0;
}
/***************************************************************************/
@ -747,6 +896,7 @@ int writer_thread_stream_function(void *pv)
continue;
}
//msleep(5);
// sync smi address
if (inst->address_changed)
{
@ -879,7 +1029,10 @@ static int smi_stream_open(struct inode *inode, struct file *file)
printk(KERN_ERR DRIVER_NAME": writer_thread creation failed - kthread\n");
ret = PTR_ERR(inst->writer_thread);
inst->writer_thread = NULL;
kthread_stop(inst->reader_thread);
inst->reader_thread = NULL;
kfifo_free(&inst->rx_fifo);
kfifo_free(&inst->tx_fifo);
return ret;
@ -930,21 +1083,22 @@ static ssize_t smi_stream_read_file_fifo(struct file *file, char __user *buf, si
size_t num_bytes = 0;
unsigned int count_actual = count;
if (kfifo_is_empty(&inst->rx_fifo))
{
return -EAGAIN;
}
//if (kfifo_is_empty(&inst->rx_fifo))
//{
// return -EAGAIN;
//}
if (mutex_lock_interruptible(&inst->read_lock))
/*if (mutex_lock_interruptible(&inst->read_lock))
{
return -EINTR;
}
num_bytes = kfifo_len (&inst->rx_fifo);
count_actual = num_bytes > count ? count : num_bytes;
ret = kfifo_to_user(&inst->rx_fifo, buf, count_actual, &copied);
mutex_unlock(&inst->read_lock);
}*/
//num_bytes = kfifo_len (&inst->rx_fifo);
//count_actual = num_bytes > count ? count : num_bytes;
//ret = kfifo_to_user(&inst->rx_fifo, buf, count_actual, &copied);
ret = kfifo_to_user(&inst->rx_fifo, buf, count, &copied);
//mutex_unlock(&inst->read_lock);
return ret ? ret : (ssize_t)copied;
return ret < 0 ? ret : (ssize_t)copied;
}
/***************************************************************************/

Plik diff jest za duży Load Diff

Wyświetl plik

@ -59,18 +59,56 @@ int main ()
std::cout << "First Radio Name: " << s1g->GetRadioName() << " MtuSize: " << std::dec << s1g->GetNativeMtuSample() << " Samples" << std::endl;
std::cout << "First Radio Name: " << hif->GetRadioName() << " MtuSize: " << std::dec << hif->GetNativeMtuSample() << " Samples" << std::endl;
std::vector<CaribouLiteFreqRange> range_s1g = s1g->GetFrequencyRange();
std::vector<CaribouLiteFreqRange> range_hif = hif->GetFrequencyRange();
std::cout << "S1G Frequency Regions:" << std::endl;
for (int i = 0; i < range_s1g.size(); i++)
{
std::cout << " " << i << ": " << range_s1g[i] << std::endl;
}
std::cout << "HiF Frequency Regions:" << std::endl;
for (int i = 0; i < range_hif.size(); i++)
{
std::cout << " " << i << ": " << range_hif[i] << std::endl;
}
// start receiving until enter pressed on 900MHz
s1g->SetFrequency(900000000);
s1g->SetRxGain(50);
s1g->SetAgc(false);
s1g->StartReceiving(receivedSamples);
int num = 1;
while (num --)
{
try
{
s1g->SetFrequency(900000000);
}
catch (...)
{
std::cout << "The specified freq couldn't be used" << std::endl;
}
s1g->SetRxGain(50);
s1g->SetAgc(false);
s1g->StartReceiving(receivedSamples);
getchar();
getchar();
try
{
hif->SetFrequency(2400000000);
}
catch (...)
{
std::cout << "The specified freq couldn't be used" << std::endl;
}
hif->SetRxGain(50);
hif->SetAgc(false);
hif->StartReceiving(receivedSamples, 20000);
getchar();
}
hif->SetFrequency(900000000);
hif->StartReceiving(receivedSamples, 20000);
getchar();
hif->StopReceiving();
return 0;
}

Wyświetl plik

@ -0,0 +1,17 @@
cmake_minimum_required(VERSION 3.2)
project(cariboulite_util)
# Find the package using pkg-config
find_package(PkgConfig REQUIRED)
pkg_check_modules(CARIBOULITE REQUIRED cariboulite)
find_package(libsigmf REQUIRED)
# Add the executable
add_executable(cariboulite_util main.cpp)
# Include directories from the cariboulite package
target_include_directories(cariboulite_util PRIVATE ${CARIBOULITE_INCLUDE_DIRS})
# Link against the cariboulite library
target_link_libraries(cariboulite_util PRIVATE ${CARIBOULITE_LIBRARIES} -lcariboulite libsigmf::libsigmf)

Wyświetl plik

@ -0,0 +1,76 @@
#include <iostream>
#include <string>
#include <CaribouLite.hpp>
#include <thread>
#include <complex>
// Print Board Information
void printInfo(CaribouLite& cl)
{
std::cout << "Initialized CaribouLite: " << cl.IsInitialized() << std::endl;
std::cout << "API Versions: " << cl.GetApiVersion() << std::endl;
std::cout << "Hardware Serial Number: " << std::hex << cl.GetHwSerialNumber() << std::endl;
std::cout << "System Type: " << cl.GetSystemVersionStr() << std::endl;
std::cout << "Hardware Unique ID: " << cl.GetHwGuid() << std::endl;
}
// Detect the board before instantiating it
void detectBoard()
{
CaribouLite::SysVersion ver;
std::string name;
std::string guid;
if (CaribouLite::DetectBoard(&ver, name, guid))
{
std::cout << "Detected Version: " << CaribouLite::GetSystemVersionStr(ver) << ", Name: " << name << ", GUID: " << guid << std::endl;
}
else
{
std::cout << "Undetected CaribouLite!" << std::endl;
}
}
// Rx Callback (async)
void receivedSamples(CaribouLiteRadio* radio, const std::complex<float>* samples, CaribouLiteMeta* sync, size_t num_samples)
{
std::cout << "Radio: " << radio->GetRadioName() << " Received " << std::dec << num_samples << " samples" << std::endl;
}
// Main entry
int main ()
{
// try detecting the board before getting the instance
detectBoard();
// get driver instance - use "CaribouLite&" rather than "CaribouLite" (ref)
CaribouLite &cl = CaribouLite::GetInstance();
// print the info after connecting
printInfo(cl);
// get the radios
CaribouLiteRadio *s1g = cl.GetRadioChannel(CaribouLiteRadio::RadioType::S1G);
CaribouLiteRadio *hif = cl.GetRadioChannel(CaribouLiteRadio::RadioType::HiF);
// write radio information
std::cout << "First Radio Name: " << s1g->GetRadioName() << " MtuSize: " << std::dec << s1g->GetNativeMtuSample() << " Samples" << std::endl;
std::cout << "First Radio Name: " << hif->GetRadioName() << " MtuSize: " << std::dec << hif->GetNativeMtuSample() << " Samples" << std::endl;
// start receiving until enter pressed on 900MHz
s1g->SetFrequency(900000000);
s1g->SetRxGain(50);
s1g->SetAgc(false);
s1g->StartReceiving(receivedSamples);
getchar();
hif->SetFrequency(900000000);
hif->StartReceiving(receivedSamples, 20000);
getchar();
return 0;
}

Wyświetl plik

@ -7,82 +7,72 @@ import SoapySDR
from SoapySDR import SOAPY_SDR_RX, SOAPY_SDR_TX, SOAPY_SDR_CS16
"""
Build a dictionaly of parameters
Build a dictionaly of parameters
"""
def MakeParameters():
params = { "DriverName": "CaribouLite",
"RxChannel": 0,
"NumOfComplexSample": 4*16384,
"RxFrequencyHz": 915e6,
"UseAGC": True,
"Gain": 50.0,
"RXBandwidth": 0.02e6,
#"Frontend": "TX/RX ANT2 LNA-Bypass"}
"Frontend": "TX/RX ANT2"}
return params
params = {
"DriverName": "Cariboulite",
"ChannelName": "S1G",
"RxChannel": 0,
"NumOfComplexSample": 4*16384,
"RxFrequencyHz": 915e6,
"UseAGC": True,
"Gain": 50.0,
"RXBandwidth": 0.02e6}
return params
"""
Setup the RX channel
Setup the RX channel
"""
def SetupReceiver(sdr, params):
# Gain mode
sdr.setGainMode(SOAPY_SDR_RX, params["RxChannel"], params["UseAGC"])
# Gain mode
sdr.setGainMode(SOAPY_SDR_RX, params["RxChannel"], params["UseAGC"])
# Set RX gain (if not using AGC)
sdr.setGain(SOAPY_SDR_RX, params["RxChannel"], params["Gain"])
# Rx Frequency
sdr.setFrequency(SOAPY_SDR_RX, params["RxChannel"], params["RxFrequencyHz"])
# Rx BW
sdr.setBandwidth(SOAPY_SDR_RX, params["RxChannel"], params["RXBandwidth"])
# Frontend select
sdr.setAntenna(SOAPY_SDR_RX, params["RxChannel"], params["Frontend"])
# Make the stream
return sdr.setupStream(SOAPY_SDR_RX, SOAPY_SDR_CS16, [params["RxChannel"]]) # Setup data stream
# Set RX gain (if not using AGC)
sdr.setGain(SOAPY_SDR_RX, params["RxChannel"], params["Gain"])
# Rx Frequency
sdr.setFrequency(SOAPY_SDR_RX, params["RxChannel"], params["RxFrequencyHz"])
# Rx BW
sdr.setBandwidth(SOAPY_SDR_RX, params["RxChannel"], params["RXBandwidth"])
# Make the stream
return sdr.setupStream(SOAPY_SDR_RX, SOAPY_SDR_CS16, [params["RxChannel"]]) # Setup data stream
"""
Main
Main
"""
if __name__ == "__main__":
print("HermonSDR Sampling Test")
params = MakeParameters()
# Memory buffers
samples = np.empty(2 * params["NumOfComplexSample"], np.int16)
# Initialize Soapy
sdr = SoapySDR.Device(dict(driver=params["DriverName"]))
rxStream = SetupReceiver(sdr, params=params)
sdr.activateStream(rxStream)
# Read samples into buffer
for ii in range(1,10):
sr = sdr.readStream(rxStream, [samples], params["NumOfComplexSample"], timeoutUs=int(5e6))
rc = sr.ret
if (rc != params["NumOfComplexSample"]):
print("Error Reading Samples from Device (error code = %d)!" % rc)
exit
# convert to float complex
I = samples[::2].astype(np.float32)
Q = samples[1::2].astype(np.float32)
complexFloatSamples = I + 1j*Q
#for k in range(len(I)):
# if I[k] > 30 or I[k] < -30:
# print(I[k])
# plot samples
fig = plt.figure()
plt.plot(I)
plt.plot(Q)
plt.show()
print("Goodbye")
params = MakeParameters()
# Memory buffers
samples = np.empty(2 * params["NumOfComplexSample"], np.int16)
# Initialize Soapy
sdr = SoapySDR.Device(dict(driver=params["DriverName"], channel=params["ChannelName"]))
rxStream = SetupReceiver(sdr, params=params)
sdr.activateStream(rxStream)
# Read samples into buffer
for ii in range(1,10):
sr = sdr.readStream(rxStream, [samples], params["NumOfComplexSample"], timeoutUs=int(5e6))
rc = sr.ret
if (rc != params["NumOfComplexSample"]):
print("Error Reading Samples from Device (error code = %d)!" % rc)
exit
# convert to float complex
I = samples[::2].astype(np.float32)
Q = samples[1::2].astype(np.float32)
complexFloatSamples = I + 1j*Q
# plot samples
fig = plt.figure()
plt.plot(I)
plt.plot(Q)
plt.show()
print("Goodbye")

Wyświetl plik

@ -0,0 +1,202 @@
---
Language: Cpp
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignArrayOfStructures: None
AlignConsecutiveMacros: None
AlignConsecutiveAssignments: None
AlignConsecutiveBitFields: None
AlignConsecutiveDeclarations: None
AlignEscapedNewlines: Left
AlignOperands: Align
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortEnumsOnASingleLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortLambdasOnASingleLine: All
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: Yes
AttributeMacros:
- __capability
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterCaseLabel: false
AfterClass: true
AfterControlStatement: Never
AfterEnum: false
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: true
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 90
CommentPragmas: '^ IWYU pragma:'
QualifierAlignment: Leave
CompactNamespaces: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: false
DeriveLineEnding: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
PackConstructorInitializers: NextLine
BasedOnStyle: ''
ConstructorInitializerAllOnOneLineOrOnePerLine: false
AllowAllConstructorInitializersOnNextLine: true
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IfMacros:
- KJ_IF_MAYBE
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(gnuradio)/'
Priority: 1
SortPriority: 0
CaseSensitive: false
- Regex: '^<(gnuradio)/'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '^<(boost)/'
Priority: 98
SortPriority: 0
CaseSensitive: false
- Regex: '^<[a-z]*>$'
Priority: 99
SortPriority: 0
CaseSensitive: false
- Regex: '^".*"$'
Priority: 0
SortPriority: 0
CaseSensitive: false
- Regex: '.*'
Priority: 10
SortPriority: 0
CaseSensitive: false
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IndentAccessModifiers: false
IndentCaseLabels: false
IndentCaseBlocks: false
IndentGotoLabels: true
IndentPPDirectives: None
IndentExternBlock: AfterExternBlock
IndentRequires: false
IndentWidth: 4
IndentWrappedFunctionNames: false
InsertTrailingCommas: None
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
LambdaBodyIndentation: Signature
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 2
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakOpenParenthesis: 0
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PenaltyIndentedWhitespace: 0
PointerAlignment: Left
PPIndentWidth: -1
ReferenceAlignment: Pointer
ReflowComments: true
RemoveBracesLLVM: false
SeparateDefinitionBlocks: Leave
ShortNamespaceLines: 1
SortIncludes: CaseSensitive
SortJavaStaticImport: Before
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: true
AfterFunctionDefinitionName: false
AfterFunctionDeclarationName: false
AfterIfMacros: true
AfterOverloadedOperator: false
BeforeNonEmptyParentheses: false
SpaceAroundPointerQualifiers: Default
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: Never
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParentheses: false
SpacesInSquareBrackets: false
SpaceBeforeSquareBrackets: false
BitFieldColonSpacing: Both
Standard: Latest
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseCRLF: false
UseTab: Never
WhitespaceSensitiveMacros:
- STRINGIZE
- PP_STRINGIZE
- BOOST_PP_STRINGIZE
- NS_SWIFT_NAME
- CF_SWIFT_NAME

Wyświetl plik

@ -0,0 +1,62 @@
# Copyright 2021 Marcus Müller
# SPDX-License-Identifier: LGPL-3.0-or-later
class _clang_format_options:
def __init__(self, clangfile=None):
if not clangfile:
clangfile = ".clang-format"
self.lines = []
with open(clangfile, encoding="utf-8") as opened:
for line in opened:
if line.strip().startswith("#"):
continue
self.lines.append(line.rstrip().split(":"))
def __getitem__(self, string):
path = string.split(".")
value = None
for crumble in path:
for line in self.lines:
if line[0].strip() == crumble:
if len(line) > 1:
value = line[1].strip().rstrip()
break
return value
_clang_format = _clang_format_options()
with section("parse"):
additional_commands = {
'gr_python_install': {
'flags': [],
'kwargs': {
"PROGRAMS": "*",
"FILES": "*",
"DESTINATION": "*"
}
},
}
with section("markup"):
first_comment_is_literal = True
enable_markup = False
with section("format"):
disable = False
line_width = int(_clang_format["ColumnLimit"])
tab_size = int(_clang_format["IndentWidth"])
min_prefix_chars = tab_size
max_prefix_chars = 3 * tab_size
use_tabchars = _clang_format["UseTab"] in ("ForIndentation",
"ForContinuationAndIndentation",
"Always")
separate_ctrl_name_with_space = False
separate_fn_name_with_space = False
dangle_parens = False
command_case = 'canonical'
keyword_case = 'upper'
with section("lint"):
max_arguments = 6
max_localvars = 20
max_statements = 75

Wyświetl plik

@ -0,0 +1,110 @@
# gr-caribouLite conda recipe
This recipe is for creating a package that can be installed into a [conda](https://docs.conda.io/en/latest/) environment. See the [Conda GNU Radio Guide](https://wiki.gnuradio.org/index.php/CondaInstall) for more information on using GNU Radio with conda.
Packages for GNU Radio and some out-of-tree (OOT) modules are available through the [`conda-forge` channel](https://conda-forge.org/). If this OOT module is already available (search "gnuradio" on [anaconda.org](https://anaconda.org)), it is preferable to use that existing package rather than this recipe.
#### Users
- [Building the package](#building-the-package)
#### Developers
- [Modifying the recipe](#modifying-the-recipe)
- [Continuous integration](#continuous-integration)
## Building the package
(See the [Conda GNU Radio Guide](https://wiki.gnuradio.org/index.php/CondaInstall) if you are unfamiliar with how to use conda.)
1. Make sure that have `conda-build` and `conda-forge-pinning` installed and updated in your base environment:
conda activate base
conda install -n base conda-build conda-forge-pinning
conda upgrade -n base conda-build conda-forge-pinning
**Windows users only**: you will also need to have Microsoft's Visual C++ build tools installed. Usually you can do this by installing the [Community edition of Visual Studio](https://visualstudio.microsoft.com/free-developer-offers/) and then selecting a MSVC C++ x64/x86 build tools component under the list of "Individual Components". As of this writing, you will specifically need MSVC v142, i.e. the "MSVC v142 - VS 2019 C++ x64/x86 build tools" component. If the build fails to find the version of MSVC it is looking for, try installing other (newer) versions.
2. Download the source code for this OOT module (which includes this recipe). Typically, this is done by using `git` and cloning the module's repository:
git clone <repository_url>
cd <repository_name>
3. Run `conda-build` on the recipe to create the package:
(Linux and macOS)
conda build .conda/recipe/ -m ${CONDA_PREFIX}/conda_build_config.yaml
(Windows)
conda build .conda\recipe\ -m %CONDA_PREFIX%\conda_build_config.yaml
If you plan on using this package within an existing environment which uses a specific version of Python, specify the version of Python using the `--python` flag. You must use a version string that matches one of the strings listed under `python` in the `${CONDA_PREFIX}/conda_build_config.yaml` file, e.g:
(Linux and macOS)
conda build .conda/recipe/ -m ${CONDA_PREFIX}/conda_build_config.yaml --python="3.9.* *_cpython"
(Windows)
conda build .conda\recipe\ -m %CONDA_PREFIX%\conda_build_config.yaml --python="3.9.* *_cpython"
If you encounter errors, consult with the OOT module maintainer or the maintainers of the [gnuradio feedstock](https://github.com/conda-forge/gnuradio-feedstock). It is possible that the recipe will need to be updated.
4. Install the package into an existing environment
conda install --use-local -n <environment_name> gnuradio-caribouLite
or create a new environment that includes the package:
conda create -n test_env gnuradio-caribouLite
## Modifying the recipe
This recipe is derived from a template, and so it is best to check it and make any necessary modifications. Likely changes include:
- Populating metadata near the bottom of the `recipe/meta.yaml` file
- Adding "host" (build-time) and "run" (run-time) dependencies specific to your module in `recipe/meta.yaml`
- Adding special configuration flags or steps are necessary to carry out the build to the build scripts (`recipe/build.sh` for Linux/macOS and `recipe/bld.bat` for Windows)
Specifying the versions of GNU Radio that your OOT is compatible with is one of the most important modifications. Following the instructions below, the module will be built against the conda-forge "pinned" version of GNU Radio, which is usually the latest version.
- To override the pinned version of GNU Radio (e.g. for a branch that builds against an older version), specify the `gnuradio_core` key as instructed in `recipe/conda_build_config.yaml`.
- If the module is compatible with multiple major versions of GNU Radio, and you want to build against multiple of them, you can also add extra versions to `recipe/conda_build_config.yaml` to expand the default build matrix.
See the [conda-build documentation](https://docs.conda.io/projects/conda-build/en/latest/index.html) for details on how to write a conda recipe.
## Continuous integration
Only a few steps are needed to use this recipe to build and test this OOT module using CI services. It can also be used to upload packages to [anaconda.org](https://anaconda.org) for others to download and use.
1. Make sure that have `conda-smithy` installed in your base conda environment:
conda activate base
conda install -n base conda-smithy
conda upgrade -n base conda-smithy
2. Make any changes to the recipe and `conda-forge.yml` that are necessary. For example, if you plan on uploading packages to your own [anaconda.org](https://anaconda.org) channel, specify the channel name and label as the `channel_targets` key in `recipe/conda_build_config.yaml`. Commit the changes to your repository:
git commit -a
3. "Re-render" the CI scripts by running conda-smithy from the root of your repository:
conda-smithy rerender --feedstock_config .conda/conda-forge.yml -c auto
This will create a commit that adds or updates the CI scripts that have been configured with `conda-forge.yml`. If you want to minimize extraneous files, you can remove some of the newly-created files that are not necessary outside of a typical conda-forge feedstock:
git rm -f .github/workflows/automerge.yml .github/workflows/webservices.yml .circleci/config.yml
git commit --amend -s
When the CI is executed (on a pull request or commit), it will run one job per configuration file in `.ci_support` to build packages for various platforms, Python versions, and optionally `gnuradio` versions (by adding to `gnuradio_extra_pin` in `recipe/conda_build_config.yaml`).
**You should repeat this step whenever the recipe is updated or when changes to the conda-forge infrastructure require all CI scripts to be updated.**
Since the newly created files will be rewritten whenever conda-smithy is run, you should not edit any of the automatically-generated files in e.g. `.ci_support`, `.scripts`, or `.github/workflows/conda-build.yml`.
4. (optional) If you want to enable uploads of the packages to [anaconda.org](https://anaconda.org) whenever the CI is run from a commit on the branch specified in `conda-forge.yml`, you need to set an Anaconda Cloud API token to the `BINSTAR_TOKEN` environment variable. To generate a token, follow the instructions [here](https://docs.anaconda.com/anacondaorg/user-guide/tasks/work-with-accounts/#creating-access-tokens). To populate the `BINSTAR_TOKEN` environment variable for CI jobs, add the token as a secret by following, for example, the [Github docs](https://docs.github.com/en/actions/reference/encrypted-secrets).

Wyświetl plik

@ -0,0 +1,33 @@
# See https://conda-forge.org/docs/maintainer/conda_forge_yml.html for
# documentation on possible keys and values.
# uncomment to enable cross-compiled builds
#build_platform:
# linux_aarch64: linux_64
# linux_ppc64le: linux_64
# osx_arm64: osx_64
clone_depth: 0
github_actions:
cancel_in_progress: false
store_build_artifacts: true
os_version:
linux_64: cos7
provider:
linux: github_actions
osx: github_actions
win: github_actions
# uncomment to enable emulated builds for additional linux platforms
#linux_aarch64: github_actions
#linux_ppc64le: github_actions
recipe_dir: .conda/recipe
# skip unnecessary files since this is not a full-fledged conda-forge feedstock
skip_render:
- README.md
- LICENSE.txt
- .gitattributes
- .gitignore
- build-locally.py
- LICENSE
test: native_and_emulated
# enable uploads to Anaconda Cloud from specified branches only
upload_on_branch: main

Wyświetl plik

@ -0,0 +1,29 @@
setlocal EnableDelayedExpansion
@echo on
:: Make a build folder and change to it
cmake -E make_directory buildconda
cd buildconda
:: configure
cmake -G "Ninja" ^
-DCMAKE_BUILD_TYPE=Release ^
-DCMAKE_INSTALL_PREFIX="%LIBRARY_PREFIX%" ^
-DCMAKE_PREFIX_PATH="%LIBRARY_PREFIX%" ^
-DGR_PYTHON_DIR="%SP_DIR%" ^
-DENABLE_DOXYGEN=OFF ^
-DENABLE_TESTING=ON ^
..
if errorlevel 1 exit 1
:: build
cmake --build . --config Release -- -j%CPU_COUNT%
if errorlevel 1 exit 1
:: install
cmake --build . --config Release --target install
if errorlevel 1 exit 1
:: test
ctest --build-config Release --output-on-failure --timeout 120 -j%CPU_COUNT%
if errorlevel 1 exit 1

Wyświetl plik

@ -0,0 +1,22 @@
#!/usr/bin/env bash
set -ex
cmake -E make_directory buildconda
cd buildconda
cmake_config_args=(
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX=$PREFIX
-DLIB_SUFFIX=""
-DENABLE_DOXYGEN=OFF
-DENABLE_TESTING=ON
)
cmake ${CMAKE_ARGS} -G "Ninja" .. "${cmake_config_args[@]}"
cmake --build . --config Release -- -j${CPU_COUNT}
cmake --build . --config Release --target install
if [[ "${CONDA_BUILD_CROSS_COMPILATION:-}" != "1" || "${CROSSCOMPILING_EMULATOR}" != "" ]]; then
ctest --build-config Release --output-on-failure --timeout 120 -j${CPU_COUNT}
fi

Wyświetl plik

@ -0,0 +1,14 @@
# this is the channel and label where packages will be uploaded to if enabled
# (see ../README.md)
channel_targets:
- gnuradio main
# override the conda-forge pin for gnuradio-core by uncommenting
# and specifying a different version here
#gnuradio_core:
#- "3.10.1"
gnuradio_extra_pin:
# always leave one entry with the empty string
- ""
# add version strings here like to get builds for versions other than
# the conda-forge-wide default or version specified above for gnuradio_core
#- "3.9.5"

Wyświetl plik

@ -0,0 +1,95 @@
{% set oot_name = "caribouLite" %}
{% set name = "gnuradio-" + oot_name %}
# Set package version from cleaned up git tags if possible,
# otherwise fall back to date-based version.
{% set tag_version = environ.get("GIT_DESCRIBE_TAG", "")|string|replace("-","_")|replace("v","")|replace("git","") %}
{% set post_commit = environ.get("GIT_DESCRIBE_NUMBER", 0)|string %}
{% set hash = environ.get("GIT_DESCRIBE_HASH", "local")|string %}
{% set fallback_version = "0.0.0.{0}.dev+g{1}".format(datetime.datetime.now().strftime("%Y%m%d"), environ.get("GIT_FULL_HASH", "local")[:9]) %}
{% set version = (tag_version if post_commit == "0" else "{0}.post{1}+{2}".format(tag_version, post_commit, hash)) if tag_version else fallback_version %}
package:
name: {{ name|lower }}
version: {{ version }}
source:
# use local path or git repository depending on if the build is local or done on CI
path: "../.." # [not os.environ.get("CI")]
git_url: {{ environ.get('FEEDSTOCK_ROOT', "../..") }} # [os.environ.get("CI")]
build:
number: 0
requirements:
build:
- {{ compiler("c") }}
- {{ compiler("cxx") }}
- cmake
- git
- ninja
- pkg-config
# cross-compilation requirements
- python # [build_platform != target_platform]
- cross-python_{{ target_platform }} # [build_platform != target_platform]
- numpy # [build_platform != target_platform]
- pybind11 # [build_platform != target_platform]
# Add extra build tool dependencies here
host:
- gmp # [linux]
# the following two entries are for generating builds against specific GR versions
- gnuradio-core # [not gnuradio_extra_pin]
- gnuradio-core {{ gnuradio_extra_pin }}.* # [gnuradio_extra_pin]
- libboost-headers
- pip # [win]
- pybind11
- python
- numpy
- volk
# Add/remove library dependencies here
run:
- numpy
- python
# Add/remove runtime dependencies here
test:
commands:
# Add a list of commands to run to check that the package works. Examples below.
## verify that commands run
#- COMMAND --help
## verify that (some) headers get installed
- test -f $PREFIX/include/gnuradio/{{ oot_name }}/api.h # [not win]
- if not exist %PREFIX%\\Library\\include\\gnuradio\\{{ oot_name }}\\api.h exit 1 # [win]
## verify that libraries get installed
#- test -f $PREFIX/lib/lib{{ name }}${SHLIB_EXT} # [not win]
#- if not exist %PREFIX%\\Library\\bin\\{{ name }}.dll exit 1 # [win]
#- if not exist %PREFIX%\\Library\\lib\\{{ name }}.lib exit 1 # [win]
## verify that (some) GRC blocks get installed
#{% set blocks = ["LIST", "OF", "GRC", "BLOCK", "NAMES"] %}
#{% for block in blocks %}
#- test -f $PREFIX/share/gnuradio/grc/blocks/{{ block }}.block.yml # [not win]
#- if not exist %PREFIX%\\Library\\share\\gnuradio\\grc\\blocks\\{{ block }}.block.yml exit 1 # [win]
#{% endfor %}
imports:
# verify that the python module imports
- gnuradio.{{ oot_name }}
about:
# For licenses, use the SPDX identifier, e.g: "GPL-2.0-only" instead of
# "GNU General Public License version 2.0". See https://spdx.org/licenses/.
# Include the license text by using the license_file entry set to the path
# of the license text file within the source directory, e.g. "LICENSE".
# See https://docs.conda.io/projects/conda-build/en/latest/resources/define-metadata.html#license-file
#home: https://github.com/<FIXME>/gr-caribouLite
#license: GPL-3.0-or-later
#license_file: LICENSE
#summary: GNU Radio caribouLite module
#description: >
# Short description of the gr-caribouLite module.

Wyświetl plik

@ -0,0 +1,152 @@
# Copyright 2011-2020 Free Software Foundation, Inc.
#
# This file was generated by gr_modtool, a tool from the GNU Radio framework
# This file is a part of gr-caribouLite
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
# Select the release build type by default to get optimization flags.
# This has to come before project() which otherwise initializes it.
# Build type can still be overridden by setting -DCMAKE_BUILD_TYPE=
set(CMAKE_BUILD_TYPE
"Release"
CACHE STRING "")
########################################################################
# Project setup
########################################################################
cmake_minimum_required(VERSION 3.8)
project(gr-caribouLite CXX C)
enable_testing()
# Install to PyBOMBS target prefix if defined
if(DEFINED ENV{PYBOMBS_PREFIX})
set(CMAKE_INSTALL_PREFIX
$ENV{PYBOMBS_PREFIX}
CACHE PATH "")
message(
STATUS
"PyBOMBS installed GNU Radio. Defaulting CMAKE_INSTALL_PREFIX to $ENV{PYBOMBS_PREFIX}"
)
endif()
# Make sure our local CMake Modules path comes first
list(INSERT CMAKE_MODULE_PATH 0 ${PROJECT_SOURCE_DIR}/cmake/Modules)
# Find gnuradio to get access to the cmake modules
find_package(Gnuradio "3.10" REQUIRED)
# Set the version information here
# cmake-format: off
set(VERSION_MAJOR 1)
set(VERSION_API 0)
set(VERSION_ABI 0)
set(VERSION_PATCH 0)
# cmake-format: on
cmake_policy(SET CMP0011 NEW)
# Enable generation of compile_commands.json for code completion engines
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
########################################################################
# Minimum Version Requirements
########################################################################
include(GrMinReq)
########################################################################
# Compiler settings
########################################################################
include(GrCompilerSettings)
########################################################################
# Install directories
########################################################################
include(GrVersion)
include(GrPlatform) #define LIB_SUFFIX
if(NOT CMAKE_MODULES_DIR)
set(CMAKE_MODULES_DIR lib${LIB_SUFFIX}/cmake)
endif(NOT CMAKE_MODULES_DIR)
set(GR_INCLUDE_DIR include/gnuradio/caribouLite)
set(GR_CMAKE_DIR ${CMAKE_MODULES_DIR}/gnuradio-caribouLite)
set(GR_PKG_DATA_DIR ${GR_DATA_DIR}/${CMAKE_PROJECT_NAME})
set(GR_PKG_DOC_DIR ${GR_DOC_DIR}/${CMAKE_PROJECT_NAME})
set(GR_PKG_CONF_DIR ${GR_CONF_DIR}/${CMAKE_PROJECT_NAME}/conf.d)
set(GR_PKG_LIBEXEC_DIR ${GR_LIBEXEC_DIR}/${CMAKE_PROJECT_NAME})
########################################################################
# On Apple only, set install name and use rpath correctly, if not already set
########################################################################
if(APPLE)
if(NOT CMAKE_INSTALL_NAME_DIR)
set(CMAKE_INSTALL_NAME_DIR
${CMAKE_INSTALL_PREFIX}/${GR_LIBRARY_DIR}
CACHE PATH "Library Install Name Destination Directory" FORCE)
endif(NOT CMAKE_INSTALL_NAME_DIR)
if(NOT CMAKE_INSTALL_RPATH)
set(CMAKE_INSTALL_RPATH
${CMAKE_INSTALL_PREFIX}/${GR_LIBRARY_DIR}
CACHE PATH "Library Install RPath" FORCE)
endif(NOT CMAKE_INSTALL_RPATH)
if(NOT CMAKE_BUILD_WITH_INSTALL_RPATH)
set(CMAKE_BUILD_WITH_INSTALL_RPATH
ON
CACHE BOOL "Do Build Using Library Install RPath" FORCE)
endif(NOT CMAKE_BUILD_WITH_INSTALL_RPATH)
endif(APPLE)
########################################################################
# Find gnuradio build dependencies
########################################################################
find_package(Doxygen)
########################################################################
# Setup doxygen option
########################################################################
if(DOXYGEN_FOUND)
option(ENABLE_DOXYGEN "Build docs using Doxygen" ON)
else(DOXYGEN_FOUND)
option(ENABLE_DOXYGEN "Build docs using Doxygen" OFF)
endif(DOXYGEN_FOUND)
########################################################################
# Create uninstall target
########################################################################
configure_file(${PROJECT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake @ONLY)
add_custom_target(uninstall ${CMAKE_COMMAND} -P
${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
########################################################################
# Add subdirectories
########################################################################
add_subdirectory(include/gnuradio/caribouLite)
add_subdirectory(lib)
add_subdirectory(apps)
add_subdirectory(docs)
# NOTE: manually update below to use GRC to generate C++ flowgraphs w/o python
if(ENABLE_PYTHON)
message(STATUS "PYTHON and GRC components are enabled")
add_subdirectory(python/caribouLite)
add_subdirectory(grc)
else(ENABLE_PYTHON)
message(STATUS "PYTHON and GRC components are disabled")
endif(ENABLE_PYTHON)
########################################################################
# Install cmake search helper for this library
########################################################################
install(FILES cmake/Modules/gnuradio-caribouLiteConfig.cmake DESTINATION ${GR_CMAKE_DIR})
include(CMakePackageConfigHelpers)
configure_package_config_file(
${PROJECT_SOURCE_DIR}/cmake/Modules/targetConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/cmake/Modules/${target}Config.cmake
INSTALL_DESTINATION ${GR_CMAKE_DIR})

Wyświetl plik

@ -0,0 +1,17 @@
title: The CARIBOULITE OOT Module
brief: Short description of gr-caribouLite
tags: # Tags are arbitrary, but look at CGRAN what other authors are using
- sdr
author:
- Author Name <authors@email.address>
copyright_owner:
- Copyright Owner 1
license:
gr_supported_version: # Put a comma separated list of supported GR versions here
#repo: # Put the URL of the repository here, or leave blank for default
#website: <module_website> # If you have a separate project website, put it here
#icon: <icon_url> # Put a URL to a square image here that will be used as an icon on CGRAN
---
A longer, multi-line description of gr-caribouLite.
You may use some *basic* Markdown here.
If left empty, it will try to find a README file instead.

Wyświetl plik

@ -0,0 +1,11 @@
# Copyright 2011 Free Software Foundation, Inc.
#
# This file was generated by gr_modtool, a tool from the GNU Radio framework
# This file is a part of gr-caribouLite
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
include(GrPython)
gr_python_install(PROGRAMS DESTINATION bin)

Wyświetl plik

@ -0,0 +1,138 @@
# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...)
#
# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions for
# parsing the arguments given to that macro or function.
# It processes the arguments and defines a set of variables which hold the
# values of the respective options.
#
# The <options> argument contains all options for the respective macro,
# i.e. keywords which can be used when calling the macro without any value
# following, like e.g. the OPTIONAL keyword of the install() command.
#
# The <one_value_keywords> argument contains all keywords for this macro
# which are followed by one value, like e.g. DESTINATION keyword of the
# install() command.
#
# The <multi_value_keywords> argument contains all keywords for this macro
# which can be followed by more than one value, like e.g. the TARGETS or
# FILES keywords of the install() command.
#
# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the
# keywords listed in <options>, <one_value_keywords> and
# <multi_value_keywords> a variable composed of the given <prefix>
# followed by "_" and the name of the respective keyword.
# These variables will then hold the respective value from the argument list.
# For the <options> keywords this will be TRUE or FALSE.
#
# All remaining arguments are collected in a variable
# <prefix>_UNPARSED_ARGUMENTS, this can be checked afterwards to see whether
# your macro was called with unrecognized parameters.
#
# As an example here a my_install() macro, which takes similar arguments as the
# real install() command:
#
# function(MY_INSTALL)
# set(options OPTIONAL FAST)
# set(oneValueArgs DESTINATION RENAME)
# set(multiValueArgs TARGETS CONFIGURATIONS)
# cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
# ...
#
# Assume my_install() has been called like this:
# my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub)
#
# After the cmake_parse_arguments() call the macro will have set the following
# variables:
# MY_INSTALL_OPTIONAL = TRUE
# MY_INSTALL_FAST = FALSE (this option was not used when calling my_install()
# MY_INSTALL_DESTINATION = "bin"
# MY_INSTALL_RENAME = "" (was not used)
# MY_INSTALL_TARGETS = "foo;bar"
# MY_INSTALL_CONFIGURATIONS = "" (was not used)
# MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL"
#
# You can the continue and process these variables.
#
# Keywords terminate lists of values, e.g. if directly after a one_value_keyword
# another recognized keyword follows, this is interpreted as the beginning of
# the new option.
# E.g. my_install(TARGETS foo DESTINATION OPTIONAL) would result in
# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION would
# be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefore.
#=============================================================================
# Copyright 2010 Alexander Neundorf <neundorf@kde.org>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
if(__CMAKE_PARSE_ARGUMENTS_INCLUDED)
return()
endif()
set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE)
function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames)
# first set all result variables to empty/FALSE
foreach(arg_name ${_singleArgNames} ${_multiArgNames})
set(${prefix}_${arg_name})
endforeach(arg_name)
foreach(option ${_optionNames})
set(${prefix}_${option} FALSE)
endforeach(option)
set(${prefix}_UNPARSED_ARGUMENTS)
set(insideValues FALSE)
set(currentArgName)
# now iterate over all arguments and fill the result variables
foreach(currentArg ${ARGN})
list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword
list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword
list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword
if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1)
if(insideValues)
if("${insideValues}" STREQUAL "SINGLE")
set(${prefix}_${currentArgName} ${currentArg})
set(insideValues FALSE)
elseif("${insideValues}" STREQUAL "MULTI")
list(APPEND ${prefix}_${currentArgName} ${currentArg})
endif()
else(insideValues)
list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg})
endif(insideValues)
else()
if(NOT ${optionIndex} EQUAL -1)
set(${prefix}_${currentArg} TRUE)
set(insideValues FALSE)
elseif(NOT ${singleArgIndex} EQUAL -1)
set(currentArgName ${currentArg})
set(${prefix}_${currentArgName})
set(insideValues "SINGLE")
elseif(NOT ${multiArgIndex} EQUAL -1)
set(currentArgName ${currentArg})
set(${prefix}_${currentArgName})
set(insideValues "MULTI")
endif()
endif()
endforeach(currentArg)
# propagate the result variables to the caller:
foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames})
set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE)
endforeach(arg_name)
set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE)
endfunction(CMAKE_PARSE_ARGUMENTS _options _singleArgs _multiArgs)

Wyświetl plik

@ -0,0 +1,32 @@
find_package(PkgConfig)
PKG_CHECK_MODULES(PC_GR_CARIBOULITE gnuradio-caribouLite)
FIND_PATH(
GR_CARIBOULITE_INCLUDE_DIRS
NAMES gnuradio/caribouLite/api.h
HINTS $ENV{CARIBOULITE_DIR}/include
${PC_CARIBOULITE_INCLUDEDIR}
PATHS ${CMAKE_INSTALL_PREFIX}/include
/usr/local/include
/usr/include
)
FIND_LIBRARY(
GR_CARIBOULITE_LIBRARIES
NAMES gnuradio-caribouLite
HINTS $ENV{CARIBOULITE_DIR}/lib
${PC_CARIBOULITE_LIBDIR}
PATHS ${CMAKE_INSTALL_PREFIX}/lib
${CMAKE_INSTALL_PREFIX}/lib64
/usr/local/lib
/usr/local/lib64
/usr/lib
/usr/lib64
)
include("${CMAKE_CURRENT_LIST_DIR}/gnuradio-caribouLiteTarget.cmake")
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GR_CARIBOULITE DEFAULT_MSG GR_CARIBOULITE_LIBRARIES GR_CARIBOULITE_INCLUDE_DIRS)
MARK_AS_ADVANCED(GR_CARIBOULITE_LIBRARIES GR_CARIBOULITE_INCLUDE_DIRS)

Wyświetl plik

@ -0,0 +1,14 @@
# Copyright 2018 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
include(CMakeFindDependencyMacro)
set(target_deps "@TARGET_DEPENDENCIES@")
foreach(dep IN LISTS target_deps)
find_dependency(${dep})
endforeach()
include("${CMAKE_CURRENT_LIST_DIR}/@TARGET@Targets.cmake")

Wyświetl plik

@ -0,0 +1,32 @@
# http://www.vtk.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F
IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
STRING(REGEX REPLACE "\n" ";" files "${files}")
FOREACH(file ${files})
MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
IF(EXISTS "$ENV{DESTDIR}${file}")
EXEC_PROGRAM(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
IF(NOT "${rm_retval}" STREQUAL 0)
MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
ENDIF(NOT "${rm_retval}" STREQUAL 0)
ELSEIF(IS_SYMLINK "$ENV{DESTDIR}${file}")
EXEC_PROGRAM(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
IF(NOT "${rm_retval}" STREQUAL 0)
MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
ENDIF(NOT "${rm_retval}" STREQUAL 0)
ELSE(EXISTS "$ENV{DESTDIR}${file}")
MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
ENDIF(EXISTS "$ENV{DESTDIR}${file}")
ENDFOREACH(file)

Wyświetl plik

@ -0,0 +1,24 @@
# Copyright 2011 Free Software Foundation, Inc.
#
# This file was generated by gr_modtool, a tool from the GNU Radio framework
# This file is a part of gr-caribouLite
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
########################################################################
# Setup dependencies
########################################################################
find_package(Doxygen)
########################################################################
# Begin conditional configuration
########################################################################
if(ENABLE_DOXYGEN)
########################################################################
# Add subdirectories
########################################################################
add_subdirectory(doxygen)
endif(ENABLE_DOXYGEN)

Wyświetl plik

@ -0,0 +1,11 @@
This is the caribouLite-write-a-block package meant as a guide to building
out-of-tree packages. To use the caribouLite blocks, the Python namespaces
is in 'caribouLite', which is imported as:
import caribouLite
See the Doxygen documentation for details about the blocks available
in this package. A quick listing of the details can be found in Python
after importing by using:
help(caribouLite)

Wyświetl plik

@ -0,0 +1,39 @@
# Copyright 2011 Free Software Foundation, Inc.
#
# This file was generated by gr_modtool, a tool from the GNU Radio framework
# This file is a part of gr-caribouLite
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
########################################################################
# Create the doxygen configuration file
########################################################################
file(TO_NATIVE_PATH ${PROJECT_SOURCE_DIR} top_srcdir)
file(TO_NATIVE_PATH ${PROJECT_BINARY_DIR} top_builddir)
file(TO_NATIVE_PATH ${PROJECT_SOURCE_DIR} abs_top_srcdir)
file(TO_NATIVE_PATH ${PROJECT_BINARY_DIR} abs_top_builddir)
set(HAVE_DOT ${DOXYGEN_DOT_FOUND})
set(enable_html_docs YES)
set(enable_latex_docs NO)
set(enable_mathjax NO)
set(enable_xml_docs YES)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
set(BUILT_DIRS ${CMAKE_CURRENT_BINARY_DIR}/xml ${CMAKE_CURRENT_BINARY_DIR}/html)
########################################################################
# Make and install doxygen docs
########################################################################
add_custom_command(
OUTPUT ${BUILT_DIRS}
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating documentation with doxygen")
add_custom_target(doxygen_target ALL DEPENDS ${BUILT_DIRS})
install(DIRECTORY ${BUILT_DIRS} DESTINATION ${GR_PKG_DOC_DIR})

Wyświetl plik

@ -0,0 +1,72 @@
#
# Copyright 2010 Free Software Foundation, Inc.
#
# This file was generated by gr_modtool, a tool from the GNU Radio framework
# This file is a part of gr-caribouLite
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
"""
Python interface to contents of doxygen xml documentation.
Example use:
See the contents of the example folder for the C++ and
doxygen-generated xml used in this example.
>>> # Parse the doxygen docs.
>>> import os
>>> this_dir = os.path.dirname(globals()['__file__'])
>>> xml_path = this_dir + "/example/xml/"
>>> di = DoxyIndex(xml_path)
Get a list of all top-level objects.
>>> print([mem.name() for mem in di.members()])
[u'Aadvark', u'aadvarky_enough', u'main']
Get all functions.
>>> print([mem.name() for mem in di.in_category(DoxyFunction)])
[u'aadvarky_enough', u'main']
Check if an object is present.
>>> di.has_member(u'Aadvark')
True
>>> di.has_member(u'Fish')
False
Get an item by name and check its properties.
>>> aad = di.get_member(u'Aadvark')
>>> print(aad.brief_description)
Models the mammal Aadvark.
>>> print(aad.detailed_description)
Sadly the model is incomplete and cannot capture all aspects of an aadvark yet.
<BLANKLINE>
This line is uninformative and is only to test line breaks in the comments.
>>> [mem.name() for mem in aad.members()]
[u'aadvarkness', u'print', u'Aadvark', u'get_aadvarkness']
>>> aad.get_member(u'print').brief_description
u'Outputs the vital aadvark statistics.'
"""
from .doxyindex import DoxyIndex, DoxyFunction, DoxyParam, DoxyClass, DoxyFile, DoxyNamespace, DoxyGroup, DoxyFriend, DoxyOther
def _test():
import os
this_dir = os.path.dirname(globals()['__file__'])
xml_path = this_dir + "/example/xml/"
di = DoxyIndex(xml_path)
# Get the Aadvark class
aad = di.get_member('Aadvark')
aad.brief_description
import doctest
return doctest.testmod()
if __name__ == "__main__":
_test()

Wyświetl plik

@ -0,0 +1,208 @@
#
# Copyright 2010 Free Software Foundation, Inc.
#
# This file was generated by gr_modtool, a tool from the GNU Radio framework
# This file is a part of gr-caribouLite
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
"""
A base class is created.
Classes based upon this are used to make more user-friendly interfaces
to the doxygen xml docs than the generated classes provide.
"""
import os
import pdb
from xml.parsers.expat import ExpatError
from .generated import compound
class Base(object):
class Duplicate(Exception):
pass
class NoSuchMember(Exception):
pass
class ParsingError(Exception):
pass
def __init__(self, parse_data, top=None):
self._parsed = False
self._error = False
self._parse_data = parse_data
self._members = []
self._dict_members = {}
self._in_category = {}
self._data = {}
if top is not None:
self._xml_path = top._xml_path
# Set up holder of references
else:
top = self
self._refs = {}
self._xml_path = parse_data
self.top = top
@classmethod
def from_refid(cls, refid, top=None):
""" Instantiate class from a refid rather than parsing object. """
# First check to see if its already been instantiated.
if top is not None and refid in top._refs:
return top._refs[refid]
# Otherwise create a new instance and set refid.
inst = cls(None, top=top)
inst.refid = refid
inst.add_ref(inst)
return inst
@classmethod
def from_parse_data(cls, parse_data, top=None):
refid = getattr(parse_data, 'refid', None)
if refid is not None and top is not None and refid in top._refs:
return top._refs[refid]
inst = cls(parse_data, top=top)
if refid is not None:
inst.refid = refid
inst.add_ref(inst)
return inst
def add_ref(self, obj):
if hasattr(obj, 'refid'):
self.top._refs[obj.refid] = obj
mem_classes = []
def get_cls(self, mem):
for cls in self.mem_classes:
if cls.can_parse(mem):
return cls
raise Exception(("Did not find a class for object '%s'."
% (mem.get_name())))
def convert_mem(self, mem):
try:
cls = self.get_cls(mem)
converted = cls.from_parse_data(mem, self.top)
if converted is None:
raise Exception('No class matched this object.')
self.add_ref(converted)
return converted
except Exception as e:
print(e)
@classmethod
def includes(cls, inst):
return isinstance(inst, cls)
@classmethod
def can_parse(cls, obj):
return False
def _parse(self):
self._parsed = True
def _get_dict_members(self, cat=None):
"""
For given category a dictionary is returned mapping member names to
members of that category. For names that are duplicated the name is
mapped to None.
"""
self.confirm_no_error()
if cat not in self._dict_members:
new_dict = {}
for mem in self.in_category(cat):
if mem.name() not in new_dict:
new_dict[mem.name()] = mem
else:
new_dict[mem.name()] = self.Duplicate
self._dict_members[cat] = new_dict
return self._dict_members[cat]
def in_category(self, cat):
self.confirm_no_error()
if cat is None:
return self._members
if cat not in self._in_category:
self._in_category[cat] = [mem for mem in self._members
if cat.includes(mem)]
return self._in_category[cat]
def get_member(self, name, cat=None):
self.confirm_no_error()
# Check if it's in a namespace or class.
bits = name.split('::')
first = bits[0]
rest = '::'.join(bits[1:])
member = self._get_dict_members(cat).get(first, self.NoSuchMember)
# Raise any errors that are returned.
if member in set([self.NoSuchMember, self.Duplicate]):
raise member()
if rest:
return member.get_member(rest, cat=cat)
return member
def has_member(self, name, cat=None):
try:
mem = self.get_member(name, cat=cat)
return True
except self.NoSuchMember:
return False
def data(self):
self.confirm_no_error()
return self._data
def members(self):
self.confirm_no_error()
return self._members
def process_memberdefs(self):
mdtss = []
for sec in self._retrieved_data.compounddef.sectiondef:
mdtss += sec.memberdef
# At the moment we lose all information associated with sections.
# Sometimes a memberdef is in several sectiondef.
# We make sure we don't get duplicates here.
uniques = set([])
for mem in mdtss:
converted = self.convert_mem(mem)
pair = (mem.name, mem.__class__)
if pair not in uniques:
uniques.add(pair)
self._members.append(converted)
def retrieve_data(self):
filename = os.path.join(self._xml_path, self.refid + '.xml')
try:
self._retrieved_data = compound.parse(filename)
except ExpatError:
print('Error in xml in file %s' % filename)
self._error = True
self._retrieved_data = None
def check_parsed(self):
if not self._parsed:
self._parse()
def confirm_no_error(self):
self.check_parsed()
if self._error:
raise self.ParsingError()
def error(self):
self.check_parsed()
return self._error
def name(self):
# first see if we can do it without processing.
if self._parse_data is not None:
return self._parse_data.name
self.check_parsed()
return self._retrieved_data.compounddef.name

Wyświetl plik

@ -0,0 +1,295 @@
#
# Copyright 2010 Free Software Foundation, Inc.
#
# This file was generated by gr_modtool, a tool from the GNU Radio framework
# This file is a part of gr-caribouLite
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
"""
Classes providing more user-friendly interfaces to the doxygen xml
docs than the generated classes provide.
"""
import os
from .generated import index
from .base import Base
from .text import description
class DoxyIndex(Base):
"""
Parses a doxygen xml directory.
"""
__module__ = "gnuradio.utils.doxyxml"
def _parse(self):
if self._parsed:
return
super(DoxyIndex, self)._parse()
self._root = index.parse(os.path.join(self._xml_path, 'index.xml'))
for mem in self._root.compound:
converted = self.convert_mem(mem)
# For files and namespaces we want the contents to be
# accessible directly from the parent rather than having
# to go through the file object.
if self.get_cls(mem) == DoxyFile:
if mem.name.endswith('.h'):
self._members += converted.members()
self._members.append(converted)
elif self.get_cls(mem) == DoxyNamespace:
self._members += converted.members()
self._members.append(converted)
else:
self._members.append(converted)
class DoxyCompMem(Base):
kind = None
def __init__(self, *args, **kwargs):
super(DoxyCompMem, self).__init__(*args, **kwargs)
@classmethod
def can_parse(cls, obj):
return obj.kind == cls.kind
def set_descriptions(self, parse_data):
bd = description(getattr(parse_data, 'briefdescription', None))
dd = description(getattr(parse_data, 'detaileddescription', None))
self._data['brief_description'] = bd
self._data['detailed_description'] = dd
def set_parameters(self, data):
vs = [ddc.value for ddc in data.detaileddescription.content_]
pls = []
for v in vs:
if hasattr(v, 'parameterlist'):
pls += v.parameterlist
pis = []
for pl in pls:
pis += pl.parameteritem
dpis = []
for pi in pis:
dpi = DoxyParameterItem(pi)
dpi._parse()
dpis.append(dpi)
self._data['params'] = dpis
class DoxyCompound(DoxyCompMem):
pass
class DoxyMember(DoxyCompMem):
pass
class DoxyFunction(DoxyMember):
__module__ = "gnuradio.utils.doxyxml"
kind = 'function'
def _parse(self):
if self._parsed:
return
super(DoxyFunction, self)._parse()
self.set_descriptions(self._parse_data)
self.set_parameters(self._parse_data)
if not self._data['params']:
# If the params weren't set by a comment then just grab the names.
self._data['params'] = []
prms = self._parse_data.param
for prm in prms:
self._data['params'].append(DoxyParam(prm))
brief_description = property(lambda self: self.data()['brief_description'])
detailed_description = property(
lambda self: self.data()['detailed_description'])
params = property(lambda self: self.data()['params'])
Base.mem_classes.append(DoxyFunction)
class DoxyParam(DoxyMember):
__module__ = "gnuradio.utils.doxyxml"
def _parse(self):
if self._parsed:
return
super(DoxyParam, self)._parse()
self.set_descriptions(self._parse_data)
self._data['declname'] = self._parse_data.declname
@property
def description(self):
descriptions = []
if self.brief_description:
descriptions.append(self.brief_description)
if self.detailed_description:
descriptions.append(self.detailed_description)
return '\n\n'.join(descriptions)
brief_description = property(lambda self: self.data()['brief_description'])
detailed_description = property(
lambda self: self.data()['detailed_description'])
name = property(lambda self: self.data()['declname'])
class DoxyParameterItem(DoxyMember):
"""A different representation of a parameter in Doxygen."""
def _parse(self):
if self._parsed:
return
super(DoxyParameterItem, self)._parse()
names = []
for nl in self._parse_data.parameternamelist:
for pn in nl.parametername:
names.append(description(pn))
# Just take first name
self._data['name'] = names[0]
# Get description
pd = description(self._parse_data.get_parameterdescription())
self._data['description'] = pd
description = property(lambda self: self.data()['description'])
name = property(lambda self: self.data()['name'])
class DoxyClass(DoxyCompound):
__module__ = "gnuradio.utils.doxyxml"
kind = 'class'
def _parse(self):
if self._parsed:
return
super(DoxyClass, self)._parse()
self.retrieve_data()
if self._error:
return
self.set_descriptions(self._retrieved_data.compounddef)
self.set_parameters(self._retrieved_data.compounddef)
# Sectiondef.kind tells about whether private or public.
# We just ignore this for now.
self.process_memberdefs()
brief_description = property(lambda self: self.data()['brief_description'])
detailed_description = property(
lambda self: self.data()['detailed_description'])
params = property(lambda self: self.data()['params'])
Base.mem_classes.append(DoxyClass)
class DoxyFile(DoxyCompound):
__module__ = "gnuradio.utils.doxyxml"
kind = 'file'
def _parse(self):
if self._parsed:
return
super(DoxyFile, self)._parse()
self.retrieve_data()
self.set_descriptions(self._retrieved_data.compounddef)
if self._error:
return
self.process_memberdefs()
brief_description = property(lambda self: self.data()['brief_description'])
detailed_description = property(
lambda self: self.data()['detailed_description'])
Base.mem_classes.append(DoxyFile)
class DoxyNamespace(DoxyCompound):
__module__ = "gnuradio.utils.doxyxml"
kind = 'namespace'
def _parse(self):
if self._parsed:
return
super(DoxyNamespace, self)._parse()
self.retrieve_data()
self.set_descriptions(self._retrieved_data.compounddef)
if self._error:
return
self.process_memberdefs()
Base.mem_classes.append(DoxyNamespace)
class DoxyGroup(DoxyCompound):
__module__ = "gnuradio.utils.doxyxml"
kind = 'group'
def _parse(self):
if self._parsed:
return
super(DoxyGroup, self)._parse()
self.retrieve_data()
if self._error:
return
cdef = self._retrieved_data.compounddef
self._data['title'] = description(cdef.title)
# Process inner groups
grps = cdef.innergroup
for grp in grps:
converted = DoxyGroup.from_refid(grp.refid, top=self.top)
self._members.append(converted)
# Process inner classes
klasses = cdef.innerclass
for kls in klasses:
converted = DoxyClass.from_refid(kls.refid, top=self.top)
self._members.append(converted)
# Process normal members
self.process_memberdefs()
title = property(lambda self: self.data()['title'])
Base.mem_classes.append(DoxyGroup)
class DoxyFriend(DoxyMember):
__module__ = "gnuradio.utils.doxyxml"
kind = 'friend'
Base.mem_classes.append(DoxyFriend)
class DoxyOther(Base):
__module__ = "gnuradio.utils.doxyxml"
kinds = set(['variable', 'struct', 'union', 'define', 'typedef', 'enum',
'dir', 'page', 'signal', 'slot', 'property'])
@classmethod
def can_parse(cls, obj):
return obj.kind in cls.kinds
Base.mem_classes.append(DoxyOther)

Wyświetl plik

@ -0,0 +1,7 @@
"""
Contains generated files produced by generateDS.py.
These do the real work of parsing the doxygen xml files but the
resultant classes are not very friendly to navigate so the rest of the
doxyxml module processes them further.
"""

Wyświetl plik

@ -0,0 +1,620 @@
#!/usr/bin/env python
"""
Generated Mon Feb 9 19:08:05 2009 by generateDS.py.
"""
from xml.dom import minidom
from xml.dom import Node
import sys
from . import compoundsuper as supermod
from .compoundsuper import MixedContainer
class DoxygenTypeSub(supermod.DoxygenType):
def __init__(self, version=None, compounddef=None):
supermod.DoxygenType.__init__(self, version, compounddef)
def find(self, details):
return self.compounddef.find(details)
supermod.DoxygenType.subclass = DoxygenTypeSub
# end class DoxygenTypeSub
class compounddefTypeSub(supermod.compounddefType):
def __init__(self, kind=None, prot=None, id=None, compoundname='', title='', basecompoundref=None, derivedcompoundref=None, includes=None, includedby=None, incdepgraph=None, invincdepgraph=None, innerdir=None, innerfile=None, innerclass=None, innernamespace=None, innerpage=None, innergroup=None, templateparamlist=None, sectiondef=None, briefdescription=None, detaileddescription=None, inheritancegraph=None, collaborationgraph=None, programlisting=None, location=None, listofallmembers=None):
supermod.compounddefType.__init__(self, kind, prot, id, compoundname, title, basecompoundref, derivedcompoundref, includes, includedby, incdepgraph, invincdepgraph, innerdir, innerfile, innerclass,
innernamespace, innerpage, innergroup, templateparamlist, sectiondef, briefdescription, detaileddescription, inheritancegraph, collaborationgraph, programlisting, location, listofallmembers)
def find(self, details):
if self.id == details.refid:
return self
for sectiondef in self.sectiondef:
result = sectiondef.find(details)
if result:
return result
supermod.compounddefType.subclass = compounddefTypeSub
# end class compounddefTypeSub
class listofallmembersTypeSub(supermod.listofallmembersType):
def __init__(self, member=None):
supermod.listofallmembersType.__init__(self, member)
supermod.listofallmembersType.subclass = listofallmembersTypeSub
# end class listofallmembersTypeSub
class memberRefTypeSub(supermod.memberRefType):
def __init__(self, virt=None, prot=None, refid=None, ambiguityscope=None, scope='', name=''):
supermod.memberRefType.__init__(
self, virt, prot, refid, ambiguityscope, scope, name)
supermod.memberRefType.subclass = memberRefTypeSub
# end class memberRefTypeSub
class compoundRefTypeSub(supermod.compoundRefType):
def __init__(self, virt=None, prot=None, refid=None, valueOf_='', mixedclass_=None, content_=None):
supermod.compoundRefType.__init__(self, mixedclass_, content_)
supermod.compoundRefType.subclass = compoundRefTypeSub
# end class compoundRefTypeSub
class reimplementTypeSub(supermod.reimplementType):
def __init__(self, refid=None, valueOf_='', mixedclass_=None, content_=None):
supermod.reimplementType.__init__(self, mixedclass_, content_)
supermod.reimplementType.subclass = reimplementTypeSub
# end class reimplementTypeSub
class incTypeSub(supermod.incType):
def __init__(self, local=None, refid=None, valueOf_='', mixedclass_=None, content_=None):
supermod.incType.__init__(self, mixedclass_, content_)
supermod.incType.subclass = incTypeSub
# end class incTypeSub
class refTypeSub(supermod.refType):
def __init__(self, prot=None, refid=None, valueOf_='', mixedclass_=None, content_=None):
supermod.refType.__init__(self, mixedclass_, content_)
supermod.refType.subclass = refTypeSub
# end class refTypeSub
class refTextTypeSub(supermod.refTextType):
def __init__(self, refid=None, kindref=None, external=None, valueOf_='', mixedclass_=None, content_=None):
supermod.refTextType.__init__(self, mixedclass_, content_)
supermod.refTextType.subclass = refTextTypeSub
# end class refTextTypeSub
class sectiondefTypeSub(supermod.sectiondefType):
def __init__(self, kind=None, header='', description=None, memberdef=None):
supermod.sectiondefType.__init__(
self, kind, header, description, memberdef)
def find(self, details):
for memberdef in self.memberdef:
if memberdef.id == details.refid:
return memberdef
return None
supermod.sectiondefType.subclass = sectiondefTypeSub
# end class sectiondefTypeSub
class memberdefTypeSub(supermod.memberdefType):
def __init__(self, initonly=None, kind=None, volatile=None, const=None, raise_=None, virt=None, readable=None, prot=None, explicit=None, new=None, final=None, writable=None, add=None, static=None, remove=None, sealed=None, mutable=None, gettable=None, inline=None, settable=None, id=None, templateparamlist=None, type_=None, definition='', argsstring='', name='', read='', write='', bitfield='', reimplements=None, reimplementedby=None, param=None, enumvalue=None, initializer=None, exceptions=None, briefdescription=None, detaileddescription=None, inbodydescription=None, location=None, references=None, referencedby=None):
supermod.memberdefType.__init__(self, initonly, kind, volatile, const, raise_, virt, readable, prot, explicit, new, final, writable, add, static, remove, sealed, mutable, gettable, inline, settable, id, templateparamlist, type_,
definition, argsstring, name, read, write, bitfield, reimplements, reimplementedby, param, enumvalue, initializer, exceptions, briefdescription, detaileddescription, inbodydescription, location, references, referencedby)
supermod.memberdefType.subclass = memberdefTypeSub
# end class memberdefTypeSub
class descriptionTypeSub(supermod.descriptionType):
def __init__(self, title='', para=None, sect1=None, internal=None, mixedclass_=None, content_=None):
supermod.descriptionType.__init__(self, mixedclass_, content_)
supermod.descriptionType.subclass = descriptionTypeSub
# end class descriptionTypeSub
class enumvalueTypeSub(supermod.enumvalueType):
def __init__(self, prot=None, id=None, name='', initializer=None, briefdescription=None, detaileddescription=None, mixedclass_=None, content_=None):
supermod.enumvalueType.__init__(self, mixedclass_, content_)
supermod.enumvalueType.subclass = enumvalueTypeSub
# end class enumvalueTypeSub
class templateparamlistTypeSub(supermod.templateparamlistType):
def __init__(self, param=None):
supermod.templateparamlistType.__init__(self, param)
supermod.templateparamlistType.subclass = templateparamlistTypeSub
# end class templateparamlistTypeSub
class paramTypeSub(supermod.paramType):
def __init__(self, type_=None, declname='', defname='', array='', defval=None, briefdescription=None):
supermod.paramType.__init__(
self, type_, declname, defname, array, defval, briefdescription)
supermod.paramType.subclass = paramTypeSub
# end class paramTypeSub
class linkedTextTypeSub(supermod.linkedTextType):
def __init__(self, ref=None, mixedclass_=None, content_=None):
supermod.linkedTextType.__init__(self, mixedclass_, content_)
supermod.linkedTextType.subclass = linkedTextTypeSub
# end class linkedTextTypeSub
class graphTypeSub(supermod.graphType):
def __init__(self, node=None):
supermod.graphType.__init__(self, node)
supermod.graphType.subclass = graphTypeSub
# end class graphTypeSub
class nodeTypeSub(supermod.nodeType):
def __init__(self, id=None, label='', link=None, childnode=None):
supermod.nodeType.__init__(self, id, label, link, childnode)
supermod.nodeType.subclass = nodeTypeSub
# end class nodeTypeSub
class childnodeTypeSub(supermod.childnodeType):
def __init__(self, relation=None, refid=None, edgelabel=None):
supermod.childnodeType.__init__(self, relation, refid, edgelabel)
supermod.childnodeType.subclass = childnodeTypeSub
# end class childnodeTypeSub
class linkTypeSub(supermod.linkType):
def __init__(self, refid=None, external=None, valueOf_=''):
supermod.linkType.__init__(self, refid, external)
supermod.linkType.subclass = linkTypeSub
# end class linkTypeSub
class listingTypeSub(supermod.listingType):
def __init__(self, codeline=None):
supermod.listingType.__init__(self, codeline)
supermod.listingType.subclass = listingTypeSub
# end class listingTypeSub
class codelineTypeSub(supermod.codelineType):
def __init__(self, external=None, lineno=None, refkind=None, refid=None, highlight=None):
supermod.codelineType.__init__(
self, external, lineno, refkind, refid, highlight)
supermod.codelineType.subclass = codelineTypeSub
# end class codelineTypeSub
class highlightTypeSub(supermod.highlightType):
def __init__(self, class_=None, sp=None, ref=None, mixedclass_=None, content_=None):
supermod.highlightType.__init__(self, mixedclass_, content_)
supermod.highlightType.subclass = highlightTypeSub
# end class highlightTypeSub
class referenceTypeSub(supermod.referenceType):
def __init__(self, endline=None, startline=None, refid=None, compoundref=None, valueOf_='', mixedclass_=None, content_=None):
supermod.referenceType.__init__(self, mixedclass_, content_)
supermod.referenceType.subclass = referenceTypeSub
# end class referenceTypeSub
class locationTypeSub(supermod.locationType):
def __init__(self, bodystart=None, line=None, bodyend=None, bodyfile=None, file=None, valueOf_=''):
supermod.locationType.__init__(
self, bodystart, line, bodyend, bodyfile, file)
supermod.locationType.subclass = locationTypeSub
# end class locationTypeSub
class docSect1TypeSub(supermod.docSect1Type):
def __init__(self, id=None, title='', para=None, sect2=None, internal=None, mixedclass_=None, content_=None):
supermod.docSect1Type.__init__(self, mixedclass_, content_)
supermod.docSect1Type.subclass = docSect1TypeSub
# end class docSect1TypeSub
class docSect2TypeSub(supermod.docSect2Type):
def __init__(self, id=None, title='', para=None, sect3=None, internal=None, mixedclass_=None, content_=None):
supermod.docSect2Type.__init__(self, mixedclass_, content_)
supermod.docSect2Type.subclass = docSect2TypeSub
# end class docSect2TypeSub
class docSect3TypeSub(supermod.docSect3Type):
def __init__(self, id=None, title='', para=None, sect4=None, internal=None, mixedclass_=None, content_=None):
supermod.docSect3Type.__init__(self, mixedclass_, content_)
supermod.docSect3Type.subclass = docSect3TypeSub
# end class docSect3TypeSub
class docSect4TypeSub(supermod.docSect4Type):
def __init__(self, id=None, title='', para=None, internal=None, mixedclass_=None, content_=None):
supermod.docSect4Type.__init__(self, mixedclass_, content_)
supermod.docSect4Type.subclass = docSect4TypeSub
# end class docSect4TypeSub
class docInternalTypeSub(supermod.docInternalType):
def __init__(self, para=None, sect1=None, mixedclass_=None, content_=None):
supermod.docInternalType.__init__(self, mixedclass_, content_)
supermod.docInternalType.subclass = docInternalTypeSub
# end class docInternalTypeSub
class docInternalS1TypeSub(supermod.docInternalS1Type):
def __init__(self, para=None, sect2=None, mixedclass_=None, content_=None):
supermod.docInternalS1Type.__init__(self, mixedclass_, content_)
supermod.docInternalS1Type.subclass = docInternalS1TypeSub
# end class docInternalS1TypeSub
class docInternalS2TypeSub(supermod.docInternalS2Type):
def __init__(self, para=None, sect3=None, mixedclass_=None, content_=None):
supermod.docInternalS2Type.__init__(self, mixedclass_, content_)
supermod.docInternalS2Type.subclass = docInternalS2TypeSub
# end class docInternalS2TypeSub
class docInternalS3TypeSub(supermod.docInternalS3Type):
def __init__(self, para=None, sect3=None, mixedclass_=None, content_=None):
supermod.docInternalS3Type.__init__(self, mixedclass_, content_)
supermod.docInternalS3Type.subclass = docInternalS3TypeSub
# end class docInternalS3TypeSub
class docInternalS4TypeSub(supermod.docInternalS4Type):
def __init__(self, para=None, mixedclass_=None, content_=None):
supermod.docInternalS4Type.__init__(self, mixedclass_, content_)
supermod.docInternalS4Type.subclass = docInternalS4TypeSub
# end class docInternalS4TypeSub
class docURLLinkSub(supermod.docURLLink):
def __init__(self, url=None, valueOf_='', mixedclass_=None, content_=None):
supermod.docURLLink.__init__(self, mixedclass_, content_)
supermod.docURLLink.subclass = docURLLinkSub
# end class docURLLinkSub
class docAnchorTypeSub(supermod.docAnchorType):
def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None):
supermod.docAnchorType.__init__(self, mixedclass_, content_)
supermod.docAnchorType.subclass = docAnchorTypeSub
# end class docAnchorTypeSub
class docFormulaTypeSub(supermod.docFormulaType):
def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None):
supermod.docFormulaType.__init__(self, mixedclass_, content_)
supermod.docFormulaType.subclass = docFormulaTypeSub
# end class docFormulaTypeSub
class docIndexEntryTypeSub(supermod.docIndexEntryType):
def __init__(self, primaryie='', secondaryie=''):
supermod.docIndexEntryType.__init__(self, primaryie, secondaryie)
supermod.docIndexEntryType.subclass = docIndexEntryTypeSub
# end class docIndexEntryTypeSub
class docListTypeSub(supermod.docListType):
def __init__(self, listitem=None):
supermod.docListType.__init__(self, listitem)
supermod.docListType.subclass = docListTypeSub
# end class docListTypeSub
class docListItemTypeSub(supermod.docListItemType):
def __init__(self, para=None):
supermod.docListItemType.__init__(self, para)
supermod.docListItemType.subclass = docListItemTypeSub
# end class docListItemTypeSub
class docSimpleSectTypeSub(supermod.docSimpleSectType):
def __init__(self, kind=None, title=None, para=None):
supermod.docSimpleSectType.__init__(self, kind, title, para)
supermod.docSimpleSectType.subclass = docSimpleSectTypeSub
# end class docSimpleSectTypeSub
class docVarListEntryTypeSub(supermod.docVarListEntryType):
def __init__(self, term=None):
supermod.docVarListEntryType.__init__(self, term)
supermod.docVarListEntryType.subclass = docVarListEntryTypeSub
# end class docVarListEntryTypeSub
class docRefTextTypeSub(supermod.docRefTextType):
def __init__(self, refid=None, kindref=None, external=None, valueOf_='', mixedclass_=None, content_=None):
supermod.docRefTextType.__init__(self, mixedclass_, content_)
supermod.docRefTextType.subclass = docRefTextTypeSub
# end class docRefTextTypeSub
class docTableTypeSub(supermod.docTableType):
def __init__(self, rows=None, cols=None, row=None, caption=None):
supermod.docTableType.__init__(self, rows, cols, row, caption)
supermod.docTableType.subclass = docTableTypeSub
# end class docTableTypeSub
class docRowTypeSub(supermod.docRowType):
def __init__(self, entry=None):
supermod.docRowType.__init__(self, entry)
supermod.docRowType.subclass = docRowTypeSub
# end class docRowTypeSub
class docEntryTypeSub(supermod.docEntryType):
def __init__(self, thead=None, para=None):
supermod.docEntryType.__init__(self, thead, para)
supermod.docEntryType.subclass = docEntryTypeSub
# end class docEntryTypeSub
class docHeadingTypeSub(supermod.docHeadingType):
def __init__(self, level=None, valueOf_='', mixedclass_=None, content_=None):
supermod.docHeadingType.__init__(self, mixedclass_, content_)
supermod.docHeadingType.subclass = docHeadingTypeSub
# end class docHeadingTypeSub
class docImageTypeSub(supermod.docImageType):
def __init__(self, width=None, type_=None, name=None, height=None, valueOf_='', mixedclass_=None, content_=None):
supermod.docImageType.__init__(self, mixedclass_, content_)
supermod.docImageType.subclass = docImageTypeSub
# end class docImageTypeSub
class docDotFileTypeSub(supermod.docDotFileType):
def __init__(self, name=None, valueOf_='', mixedclass_=None, content_=None):
supermod.docDotFileType.__init__(self, mixedclass_, content_)
supermod.docDotFileType.subclass = docDotFileTypeSub
# end class docDotFileTypeSub
class docTocItemTypeSub(supermod.docTocItemType):
def __init__(self, id=None, valueOf_='', mixedclass_=None, content_=None):
supermod.docTocItemType.__init__(self, mixedclass_, content_)
supermod.docTocItemType.subclass = docTocItemTypeSub
# end class docTocItemTypeSub
class docTocListTypeSub(supermod.docTocListType):
def __init__(self, tocitem=None):
supermod.docTocListType.__init__(self, tocitem)
supermod.docTocListType.subclass = docTocListTypeSub
# end class docTocListTypeSub
class docLanguageTypeSub(supermod.docLanguageType):
def __init__(self, langid=None, para=None):
supermod.docLanguageType.__init__(self, langid, para)
supermod.docLanguageType.subclass = docLanguageTypeSub
# end class docLanguageTypeSub
class docParamListTypeSub(supermod.docParamListType):
def __init__(self, kind=None, parameteritem=None):
supermod.docParamListType.__init__(self, kind, parameteritem)
supermod.docParamListType.subclass = docParamListTypeSub
# end class docParamListTypeSub
class docParamListItemSub(supermod.docParamListItem):
def __init__(self, parameternamelist=None, parameterdescription=None):
supermod.docParamListItem.__init__(
self, parameternamelist, parameterdescription)
supermod.docParamListItem.subclass = docParamListItemSub
# end class docParamListItemSub
class docParamNameListSub(supermod.docParamNameList):
def __init__(self, parametername=None):
supermod.docParamNameList.__init__(self, parametername)
supermod.docParamNameList.subclass = docParamNameListSub
# end class docParamNameListSub
class docParamNameSub(supermod.docParamName):
def __init__(self, direction=None, ref=None, mixedclass_=None, content_=None):
supermod.docParamName.__init__(self, mixedclass_, content_)
supermod.docParamName.subclass = docParamNameSub
# end class docParamNameSub
class docXRefSectTypeSub(supermod.docXRefSectType):
def __init__(self, id=None, xreftitle=None, xrefdescription=None):
supermod.docXRefSectType.__init__(self, id, xreftitle, xrefdescription)
supermod.docXRefSectType.subclass = docXRefSectTypeSub
# end class docXRefSectTypeSub
class docCopyTypeSub(supermod.docCopyType):
def __init__(self, link=None, para=None, sect1=None, internal=None):
supermod.docCopyType.__init__(self, link, para, sect1, internal)
supermod.docCopyType.subclass = docCopyTypeSub
# end class docCopyTypeSub
class docCharTypeSub(supermod.docCharType):
def __init__(self, char=None, valueOf_=''):
supermod.docCharType.__init__(self, char)
supermod.docCharType.subclass = docCharTypeSub
# end class docCharTypeSub
class docParaTypeSub(supermod.docParaType):
def __init__(self, char=None, valueOf_=''):
supermod.docParaType.__init__(self, char)
self.parameterlist = []
self.simplesects = []
self.content = []
def buildChildren(self, child_, nodeName_):
supermod.docParaType.buildChildren(self, child_, nodeName_)
if child_.nodeType == Node.TEXT_NODE:
obj_ = self.mixedclass_(MixedContainer.CategoryText,
MixedContainer.TypeNone, '', child_.nodeValue)
self.content.append(obj_)
elif child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == "ref":
obj_ = supermod.docRefTextType.factory()
obj_.build(child_)
self.content.append(obj_)
elif child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'parameterlist':
obj_ = supermod.docParamListType.factory()
obj_.build(child_)
self.parameterlist.append(obj_)
elif child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'simplesect':
obj_ = supermod.docSimpleSectType.factory()
obj_.build(child_)
self.simplesects.append(obj_)
supermod.docParaType.subclass = docParaTypeSub
# end class docParaTypeSub
def parse(inFilename):
doc = minidom.parse(inFilename)
rootNode = doc.documentElement
rootObj = supermod.DoxygenType.factory()
rootObj.build(rootNode)
return rootObj

Wyświetl plik

@ -0,0 +1,80 @@
#!/usr/bin/env python
"""
Generated Mon Feb 9 19:08:05 2009 by generateDS.py.
"""
from xml.dom import minidom
import os
import sys
from . import compound
from . import indexsuper as supermod
class DoxygenTypeSub(supermod.DoxygenType):
def __init__(self, version=None, compound=None):
supermod.DoxygenType.__init__(self, version, compound)
def find_compounds_and_members(self, details):
"""
Returns a list of all compounds and their members which match details
"""
results = []
for compound in self.compound:
members = compound.find_members(details)
if members:
results.append([compound, members])
else:
if details.match(compound):
results.append([compound, []])
return results
supermod.DoxygenType.subclass = DoxygenTypeSub
# end class DoxygenTypeSub
class CompoundTypeSub(supermod.CompoundType):
def __init__(self, kind=None, refid=None, name='', member=None):
supermod.CompoundType.__init__(self, kind, refid, name, member)
def find_members(self, details):
"""
Returns a list of all members which match details
"""
results = []
for member in self.member:
if details.match(member):
results.append(member)
return results
supermod.CompoundType.subclass = CompoundTypeSub
# end class CompoundTypeSub
class MemberTypeSub(supermod.MemberType):
def __init__(self, kind=None, refid=None, name=''):
supermod.MemberType.__init__(self, kind, refid, name)
supermod.MemberType.subclass = MemberTypeSub
# end class MemberTypeSub
def parse(inFilename):
doc = minidom.parse(inFilename)
rootNode = doc.documentElement
rootObj = supermod.DoxygenType.factory()
rootObj.build(rootNode)
return rootObj

Wyświetl plik

@ -0,0 +1,581 @@
#!/usr/bin/env python
#
# Generated Thu Jun 11 18:43:54 2009 by generateDS.py.
#
import sys
from xml.dom import minidom
from xml.dom import Node
#
# User methods
#
# Calls to the methods in these classes are generated by generateDS.py.
# You can replace these methods by re-implementing the following class
# in a module named generatedssuper.py.
try:
from generatedssuper import GeneratedsSuper
except ImportError as exp:
class GeneratedsSuper(object):
def format_string(self, input_data, input_name=''):
return input_data
def format_integer(self, input_data, input_name=''):
return '%d' % input_data
def format_float(self, input_data, input_name=''):
return '%f' % input_data
def format_double(self, input_data, input_name=''):
return '%e' % input_data
def format_boolean(self, input_data, input_name=''):
return '%s' % input_data
#
# If you have installed IPython you can uncomment and use the following.
# IPython is available from http://ipython.scipy.org/.
#
## from IPython.Shell import IPShellEmbed
## args = ''
# ipshell = IPShellEmbed(args,
## banner = 'Dropping into IPython',
# exit_msg = 'Leaving Interpreter, back to program.')
# Then use the following line where and when you want to drop into the
# IPython shell:
# ipshell('<some message> -- Entering ipshell.\nHit Ctrl-D to exit')
#
# Globals
#
ExternalEncoding = 'ascii'
#
# Support/utility functions.
#
def showIndent(outfile, level):
for idx in range(level):
outfile.write(' ')
def quote_xml(inStr):
s1 = (isinstance(inStr, str) and inStr or
'%s' % inStr)
s1 = s1.replace('&', '&amp;')
s1 = s1.replace('<', '&lt;')
s1 = s1.replace('>', '&gt;')
return s1
def quote_attrib(inStr):
s1 = (isinstance(inStr, str) and inStr or
'%s' % inStr)
s1 = s1.replace('&', '&amp;')
s1 = s1.replace('<', '&lt;')
s1 = s1.replace('>', '&gt;')
if '"' in s1:
if "'" in s1:
s1 = '"%s"' % s1.replace('"', "&quot;")
else:
s1 = "'%s'" % s1
else:
s1 = '"%s"' % s1
return s1
def quote_python(inStr):
s1 = inStr
if s1.find("'") == -1:
if s1.find('\n') == -1:
return "'%s'" % s1
else:
return "'''%s'''" % s1
else:
if s1.find('"') != -1:
s1 = s1.replace('"', '\\"')
if s1.find('\n') == -1:
return '"%s"' % s1
else:
return '"""%s"""' % s1
class MixedContainer(object):
# Constants for category:
CategoryNone = 0
CategoryText = 1
CategorySimple = 2
CategoryComplex = 3
# Constants for content_type:
TypeNone = 0
TypeText = 1
TypeString = 2
TypeInteger = 3
TypeFloat = 4
TypeDecimal = 5
TypeDouble = 6
TypeBoolean = 7
def __init__(self, category, content_type, name, value):
self.category = category
self.content_type = content_type
self.name = name
self.value = value
def getCategory(self):
return self.category
def getContenttype(self, content_type):
return self.content_type
def getValue(self):
return self.value
def getName(self):
return self.name
def export(self, outfile, level, name, namespace):
if self.category == MixedContainer.CategoryText:
outfile.write(self.value)
elif self.category == MixedContainer.CategorySimple:
self.exportSimple(outfile, level, name)
else: # category == MixedContainer.CategoryComplex
self.value.export(outfile, level, namespace, name)
def exportSimple(self, outfile, level, name):
if self.content_type == MixedContainer.TypeString:
outfile.write('<%s>%s</%s>' % (self.name, self.value, self.name))
elif self.content_type == MixedContainer.TypeInteger or \
self.content_type == MixedContainer.TypeBoolean:
outfile.write('<%s>%d</%s>' % (self.name, self.value, self.name))
elif self.content_type == MixedContainer.TypeFloat or \
self.content_type == MixedContainer.TypeDecimal:
outfile.write('<%s>%f</%s>' % (self.name, self.value, self.name))
elif self.content_type == MixedContainer.TypeDouble:
outfile.write('<%s>%g</%s>' % (self.name, self.value, self.name))
def exportLiteral(self, outfile, level, name):
if self.category == MixedContainer.CategoryText:
showIndent(outfile, level)
outfile.write('MixedContainer(%d, %d, "%s", "%s"),\n' %
(self.category, self.content_type, self.name, self.value))
elif self.category == MixedContainer.CategorySimple:
showIndent(outfile, level)
outfile.write('MixedContainer(%d, %d, "%s", "%s"),\n' %
(self.category, self.content_type, self.name, self.value))
else: # category == MixedContainer.CategoryComplex
showIndent(outfile, level)
outfile.write('MixedContainer(%d, %d, "%s",\n' %
(self.category, self.content_type, self.name,))
self.value.exportLiteral(outfile, level + 1)
showIndent(outfile, level)
outfile.write(')\n')
class _MemberSpec(object):
def __init__(self, name='', data_type='', container=0):
self.name = name
self.data_type = data_type
self.container = container
def set_name(self, name): self.name = name
def get_name(self): return self.name
def set_data_type(self, data_type): self.data_type = data_type
def get_data_type(self): return self.data_type
def set_container(self, container): self.container = container
def get_container(self): return self.container
#
# Data representation classes.
#
class DoxygenType(GeneratedsSuper):
subclass = None
superclass = None
def __init__(self, version=None, compound=None):
self.version = version
if compound is None:
self.compound = []
else:
self.compound = compound
def factory(*args_, **kwargs_):
if DoxygenType.subclass:
return DoxygenType.subclass(*args_, **kwargs_)
else:
return DoxygenType(*args_, **kwargs_)
factory = staticmethod(factory)
def get_compound(self): return self.compound
def set_compound(self, compound): self.compound = compound
def add_compound(self, value): self.compound.append(value)
def insert_compound(self, index, value): self.compound[index] = value
def get_version(self): return self.version
def set_version(self, version): self.version = version
def export(self, outfile, level, namespace_='', name_='DoxygenType', namespacedef_=''):
showIndent(outfile, level)
outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
self.exportAttributes(outfile, level, namespace_, name_='DoxygenType')
if self.hasContent_():
outfile.write('>\n')
self.exportChildren(outfile, level + 1, namespace_, name_)
showIndent(outfile, level)
outfile.write('</%s%s>\n' % (namespace_, name_))
else:
outfile.write(' />\n')
def exportAttributes(self, outfile, level, namespace_='', name_='DoxygenType'):
outfile.write(' version=%s' % (self.format_string(quote_attrib(
self.version).encode(ExternalEncoding), input_name='version'), ))
def exportChildren(self, outfile, level, namespace_='', name_='DoxygenType'):
for compound_ in self.compound:
compound_.export(outfile, level, namespace_, name_='compound')
def hasContent_(self):
if (
self.compound is not None
):
return True
else:
return False
def exportLiteral(self, outfile, level, name_='DoxygenType'):
level += 1
self.exportLiteralAttributes(outfile, level, name_)
if self.hasContent_():
self.exportLiteralChildren(outfile, level, name_)
def exportLiteralAttributes(self, outfile, level, name_):
if self.version is not None:
showIndent(outfile, level)
outfile.write('version = %s,\n' % (self.version,))
def exportLiteralChildren(self, outfile, level, name_):
showIndent(outfile, level)
outfile.write('compound=[\n')
level += 1
for compound in self.compound:
showIndent(outfile, level)
outfile.write('model_.compound(\n')
compound.exportLiteral(outfile, level, name_='compound')
showIndent(outfile, level)
outfile.write('),\n')
level -= 1
showIndent(outfile, level)
outfile.write('],\n')
def build(self, node_):
attrs = node_.attributes
self.buildAttributes(attrs)
for child_ in node_.childNodes:
nodeName_ = child_.nodeName.split(':')[-1]
self.buildChildren(child_, nodeName_)
def buildAttributes(self, attrs):
if attrs.get('version'):
self.version = attrs.get('version').value
def buildChildren(self, child_, nodeName_):
if child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'compound':
obj_ = CompoundType.factory()
obj_.build(child_)
self.compound.append(obj_)
# end class DoxygenType
class CompoundType(GeneratedsSuper):
subclass = None
superclass = None
def __init__(self, kind=None, refid=None, name=None, member=None):
self.kind = kind
self.refid = refid
self.name = name
if member is None:
self.member = []
else:
self.member = member
def factory(*args_, **kwargs_):
if CompoundType.subclass:
return CompoundType.subclass(*args_, **kwargs_)
else:
return CompoundType(*args_, **kwargs_)
factory = staticmethod(factory)
def get_name(self): return self.name
def set_name(self, name): self.name = name
def get_member(self): return self.member
def set_member(self, member): self.member = member
def add_member(self, value): self.member.append(value)
def insert_member(self, index, value): self.member[index] = value
def get_kind(self): return self.kind
def set_kind(self, kind): self.kind = kind
def get_refid(self): return self.refid
def set_refid(self, refid): self.refid = refid
def export(self, outfile, level, namespace_='', name_='CompoundType', namespacedef_=''):
showIndent(outfile, level)
outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
self.exportAttributes(outfile, level, namespace_, name_='CompoundType')
if self.hasContent_():
outfile.write('>\n')
self.exportChildren(outfile, level + 1, namespace_, name_)
showIndent(outfile, level)
outfile.write('</%s%s>\n' % (namespace_, name_))
else:
outfile.write(' />\n')
def exportAttributes(self, outfile, level, namespace_='', name_='CompoundType'):
outfile.write(' kind=%s' % (quote_attrib(self.kind), ))
outfile.write(' refid=%s' % (self.format_string(quote_attrib(
self.refid).encode(ExternalEncoding), input_name='refid'), ))
def exportChildren(self, outfile, level, namespace_='', name_='CompoundType'):
if self.name is not None:
showIndent(outfile, level)
outfile.write('<%sname>%s</%sname>\n' % (namespace_, self.format_string(
quote_xml(self.name).encode(ExternalEncoding), input_name='name'), namespace_))
for member_ in self.member:
member_.export(outfile, level, namespace_, name_='member')
def hasContent_(self):
if (
self.name is not None or
self.member is not None
):
return True
else:
return False
def exportLiteral(self, outfile, level, name_='CompoundType'):
level += 1
self.exportLiteralAttributes(outfile, level, name_)
if self.hasContent_():
self.exportLiteralChildren(outfile, level, name_)
def exportLiteralAttributes(self, outfile, level, name_):
if self.kind is not None:
showIndent(outfile, level)
outfile.write('kind = "%s",\n' % (self.kind,))
if self.refid is not None:
showIndent(outfile, level)
outfile.write('refid = %s,\n' % (self.refid,))
def exportLiteralChildren(self, outfile, level, name_):
showIndent(outfile, level)
outfile.write('name=%s,\n' % quote_python(
self.name).encode(ExternalEncoding))
showIndent(outfile, level)
outfile.write('member=[\n')
level += 1
for member in self.member:
showIndent(outfile, level)
outfile.write('model_.member(\n')
member.exportLiteral(outfile, level, name_='member')
showIndent(outfile, level)
outfile.write('),\n')
level -= 1
showIndent(outfile, level)
outfile.write('],\n')
def build(self, node_):
attrs = node_.attributes
self.buildAttributes(attrs)
for child_ in node_.childNodes:
nodeName_ = child_.nodeName.split(':')[-1]
self.buildChildren(child_, nodeName_)
def buildAttributes(self, attrs):
if attrs.get('kind'):
self.kind = attrs.get('kind').value
if attrs.get('refid'):
self.refid = attrs.get('refid').value
def buildChildren(self, child_, nodeName_):
if child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'name':
name_ = ''
for text__content_ in child_.childNodes:
name_ += text__content_.nodeValue
self.name = name_
elif child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'member':
obj_ = MemberType.factory()
obj_.build(child_)
self.member.append(obj_)
# end class CompoundType
class MemberType(GeneratedsSuper):
subclass = None
superclass = None
def __init__(self, kind=None, refid=None, name=None):
self.kind = kind
self.refid = refid
self.name = name
def factory(*args_, **kwargs_):
if MemberType.subclass:
return MemberType.subclass(*args_, **kwargs_)
else:
return MemberType(*args_, **kwargs_)
factory = staticmethod(factory)
def get_name(self): return self.name
def set_name(self, name): self.name = name
def get_kind(self): return self.kind
def set_kind(self, kind): self.kind = kind
def get_refid(self): return self.refid
def set_refid(self, refid): self.refid = refid
def export(self, outfile, level, namespace_='', name_='MemberType', namespacedef_=''):
showIndent(outfile, level)
outfile.write('<%s%s %s' % (namespace_, name_, namespacedef_, ))
self.exportAttributes(outfile, level, namespace_, name_='MemberType')
if self.hasContent_():
outfile.write('>\n')
self.exportChildren(outfile, level + 1, namespace_, name_)
showIndent(outfile, level)
outfile.write('</%s%s>\n' % (namespace_, name_))
else:
outfile.write(' />\n')
def exportAttributes(self, outfile, level, namespace_='', name_='MemberType'):
outfile.write(' kind=%s' % (quote_attrib(self.kind), ))
outfile.write(' refid=%s' % (self.format_string(quote_attrib(
self.refid).encode(ExternalEncoding), input_name='refid'), ))
def exportChildren(self, outfile, level, namespace_='', name_='MemberType'):
if self.name is not None:
showIndent(outfile, level)
outfile.write('<%sname>%s</%sname>\n' % (namespace_, self.format_string(
quote_xml(self.name).encode(ExternalEncoding), input_name='name'), namespace_))
def hasContent_(self):
if (
self.name is not None
):
return True
else:
return False
def exportLiteral(self, outfile, level, name_='MemberType'):
level += 1
self.exportLiteralAttributes(outfile, level, name_)
if self.hasContent_():
self.exportLiteralChildren(outfile, level, name_)
def exportLiteralAttributes(self, outfile, level, name_):
if self.kind is not None:
showIndent(outfile, level)
outfile.write('kind = "%s",\n' % (self.kind,))
if self.refid is not None:
showIndent(outfile, level)
outfile.write('refid = %s,\n' % (self.refid,))
def exportLiteralChildren(self, outfile, level, name_):
showIndent(outfile, level)
outfile.write('name=%s,\n' % quote_python(
self.name).encode(ExternalEncoding))
def build(self, node_):
attrs = node_.attributes
self.buildAttributes(attrs)
for child_ in node_.childNodes:
nodeName_ = child_.nodeName.split(':')[-1]
self.buildChildren(child_, nodeName_)
def buildAttributes(self, attrs):
if attrs.get('kind'):
self.kind = attrs.get('kind').value
if attrs.get('refid'):
self.refid = attrs.get('refid').value
def buildChildren(self, child_, nodeName_):
if child_.nodeType == Node.ELEMENT_NODE and \
nodeName_ == 'name':
name_ = ''
for text__content_ in child_.childNodes:
name_ += text__content_.nodeValue
self.name = name_
# end class MemberType
USAGE_TEXT = """
Usage: python <Parser>.py [ -s ] <in_xml_file>
Options:
-s Use the SAX parser, not the minidom parser.
"""
def usage():
print(USAGE_TEXT)
sys.exit(1)
def parse(inFileName):
doc = minidom.parse(inFileName)
rootNode = doc.documentElement
rootObj = DoxygenType.factory()
rootObj.build(rootNode)
# Enable Python to collect the space used by the DOM.
doc = None
sys.stdout.write('<?xml version="1.0" ?>\n')
rootObj.export(sys.stdout, 0, name_="doxygenindex",
namespacedef_='')
return rootObj
def parseString(inString):
doc = minidom.parseString(inString)
rootNode = doc.documentElement
rootObj = DoxygenType.factory()
rootObj.build(rootNode)
# Enable Python to collect the space used by the DOM.
doc = None
sys.stdout.write('<?xml version="1.0" ?>\n')
rootObj.export(sys.stdout, 0, name_="doxygenindex",
namespacedef_='')
return rootObj
def parseLiteral(inFileName):
doc = minidom.parse(inFileName)
rootNode = doc.documentElement
rootObj = DoxygenType.factory()
rootObj.build(rootNode)
# Enable Python to collect the space used by the DOM.
doc = None
sys.stdout.write('from index import *\n\n')
sys.stdout.write('rootObj = doxygenindex(\n')
rootObj.exportLiteral(sys.stdout, 0, name_="doxygenindex")
sys.stdout.write(')\n')
return rootObj
def main():
args = sys.argv[1:]
if len(args) == 1:
parse(args[0])
else:
usage()
if __name__ == '__main__':
main()
#import pdb
# pdb.run('main()')

Wyświetl plik

@ -0,0 +1,49 @@
#
# Copyright 2010 Free Software Foundation, Inc.
#
# This file was generated by gr_modtool, a tool from the GNU Radio framework
# This file is a part of gr-caribouLite
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
"""
Utilities for extracting text from generated classes.
"""
def is_string(txt):
if isinstance(txt, str):
return True
try:
if isinstance(txt, str):
return True
except NameError:
pass
return False
def description(obj):
if obj is None:
return None
return description_bit(obj).strip()
def description_bit(obj):
if hasattr(obj, 'content'):
contents = [description_bit(item) for item in obj.content]
result = ''.join(contents)
elif hasattr(obj, 'content_'):
contents = [description_bit(item) for item in obj.content_]
result = ''.join(contents)
elif hasattr(obj, 'value'):
result = description_bit(obj.value)
elif is_string(obj):
return obj
else:
raise Exception(
'Expecting a string or something with content, content_ or value attribute')
# If this bit is a paragraph then add one some line breaks.
if hasattr(obj, 'name') and obj.name == 'para':
result += "\n\n"
return result

Wyświetl plik

@ -0,0 +1,446 @@
#!/usr/bin/env python
__applicationName__ = "doxypy"
__blurb__ = """
doxypy is an input filter for Doxygen. It preprocesses python
files so that docstrings of classes and functions are reformatted
into Doxygen-conform documentation blocks.
"""
__doc__ = __blurb__ + \
"""
In order to make Doxygen preprocess files through doxypy, simply
add the following lines to your Doxyfile:
FILTER_SOURCE_FILES = YES
INPUT_FILTER = "python /path/to/doxypy.py"
"""
__version__ = "0.4.2"
__date__ = "5th December 2008"
__website__ = "http://code.foosel.org/doxypy"
__author__ = (
"Philippe 'demod' Neumann (doxypy at demod dot org)",
"Gina 'foosel' Haeussge (gina at foosel dot net)"
)
__licenseName__ = "GPL v2"
__license__ = """This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
import sys
import re
from argparse import ArgumentParser
class FSM(object):
"""Implements a finite state machine.
Transitions are given as 4-tuples, consisting of an origin state, a target
state, a condition for the transition (given as a reference to a function
which gets called with a given piece of input) and a pointer to a function
to be called upon the execution of the given transition.
"""
"""
@var transitions holds the transitions
@var current_state holds the current state
@var current_input holds the current input
@var current_transition hold the currently active transition
"""
def __init__(self, start_state=None, transitions=[]):
self.transitions = transitions
self.current_state = start_state
self.current_input = None
self.current_transition = None
def setStartState(self, state):
self.current_state = state
def addTransition(self, from_state, to_state, condition, callback):
self.transitions.append([from_state, to_state, condition, callback])
def makeTransition(self, input):
""" Makes a transition based on the given input.
@param input input to parse by the FSM
"""
for transition in self.transitions:
[from_state, to_state, condition, callback] = transition
if from_state == self.current_state:
match = condition(input)
if match:
self.current_state = to_state
self.current_input = input
self.current_transition = transition
if args.debug:
print("# FSM: executing (%s -> %s) for line '%s'" %
(from_state, to_state, input), file=sys.stderr)
callback(match)
return
class Doxypy(object):
def __init__(self):
string_prefixes = "[uU]?[rR]?"
self.start_single_comment_re = re.compile(
r"^\s*%s(''')" % string_prefixes)
self.end_single_comment_re = re.compile(r"(''')\s*$")
self.start_double_comment_re = re.compile(
r'^\s*%s(""")' % string_prefixes)
self.end_double_comment_re = re.compile(r'(""")\s*$')
self.single_comment_re = re.compile(
r"^\s*%s(''').*(''')\s*$" % string_prefixes)
self.double_comment_re = re.compile(
r'^\s*%s(""").*(""")\s*$' % string_prefixes)
self.defclass_re = re.compile(r"^(\s*)(def .+:|class .+:)")
self.empty_re = re.compile(r"^\s*$")
self.hashline_re = re.compile(r"^\s*#.*$")
self.importline_re = re.compile(r"^\s*(import |from .+ import)")
self.multiline_defclass_start_re = re.compile(
r"^(\s*)(def|class)(\s.*)?$")
self.multiline_defclass_end_re = re.compile(r":\s*$")
# Transition list format
# ["FROM", "TO", condition, action]
transitions = [
# FILEHEAD
# single line comments
["FILEHEAD", "FILEHEAD", self.single_comment_re.search,
self.appendCommentLine],
["FILEHEAD", "FILEHEAD", self.double_comment_re.search,
self.appendCommentLine],
# multiline comments
["FILEHEAD", "FILEHEAD_COMMENT_SINGLE",
self.start_single_comment_re.search, self.appendCommentLine],
["FILEHEAD_COMMENT_SINGLE", "FILEHEAD",
self.end_single_comment_re.search, self.appendCommentLine],
["FILEHEAD_COMMENT_SINGLE", "FILEHEAD_COMMENT_SINGLE",
self.catchall, self.appendCommentLine],
["FILEHEAD", "FILEHEAD_COMMENT_DOUBLE",
self.start_double_comment_re.search, self.appendCommentLine],
["FILEHEAD_COMMENT_DOUBLE", "FILEHEAD",
self.end_double_comment_re.search, self.appendCommentLine],
["FILEHEAD_COMMENT_DOUBLE", "FILEHEAD_COMMENT_DOUBLE",
self.catchall, self.appendCommentLine],
# other lines
["FILEHEAD", "FILEHEAD", self.empty_re.search, self.appendFileheadLine],
["FILEHEAD", "FILEHEAD", self.hashline_re.search, self.appendFileheadLine],
["FILEHEAD", "FILEHEAD", self.importline_re.search,
self.appendFileheadLine],
["FILEHEAD", "DEFCLASS", self.defclass_re.search, self.resetCommentSearch],
["FILEHEAD", "DEFCLASS_MULTI",
self.multiline_defclass_start_re.search, self.resetCommentSearch],
["FILEHEAD", "DEFCLASS_BODY", self.catchall, self.appendFileheadLine],
# DEFCLASS
# single line comments
["DEFCLASS", "DEFCLASS_BODY",
self.single_comment_re.search, self.appendCommentLine],
["DEFCLASS", "DEFCLASS_BODY",
self.double_comment_re.search, self.appendCommentLine],
# multiline comments
["DEFCLASS", "COMMENT_SINGLE",
self.start_single_comment_re.search, self.appendCommentLine],
["COMMENT_SINGLE", "DEFCLASS_BODY",
self.end_single_comment_re.search, self.appendCommentLine],
["COMMENT_SINGLE", "COMMENT_SINGLE",
self.catchall, self.appendCommentLine],
["DEFCLASS", "COMMENT_DOUBLE",
self.start_double_comment_re.search, self.appendCommentLine],
["COMMENT_DOUBLE", "DEFCLASS_BODY",
self.end_double_comment_re.search, self.appendCommentLine],
["COMMENT_DOUBLE", "COMMENT_DOUBLE",
self.catchall, self.appendCommentLine],
# other lines
["DEFCLASS", "DEFCLASS", self.empty_re.search, self.appendDefclassLine],
["DEFCLASS", "DEFCLASS", self.defclass_re.search, self.resetCommentSearch],
["DEFCLASS", "DEFCLASS_MULTI",
self.multiline_defclass_start_re.search, self.resetCommentSearch],
["DEFCLASS", "DEFCLASS_BODY", self.catchall, self.stopCommentSearch],
# DEFCLASS_BODY
["DEFCLASS_BODY", "DEFCLASS",
self.defclass_re.search, self.startCommentSearch],
["DEFCLASS_BODY", "DEFCLASS_MULTI",
self.multiline_defclass_start_re.search, self.startCommentSearch],
["DEFCLASS_BODY", "DEFCLASS_BODY", self.catchall, self.appendNormalLine],
# DEFCLASS_MULTI
["DEFCLASS_MULTI", "DEFCLASS",
self.multiline_defclass_end_re.search, self.appendDefclassLine],
["DEFCLASS_MULTI", "DEFCLASS_MULTI",
self.catchall, self.appendDefclassLine],
]
self.fsm = FSM("FILEHEAD", transitions)
self.outstream = sys.stdout
self.output = []
self.comment = []
self.filehead = []
self.defclass = []
self.indent = ""
def __closeComment(self):
"""Appends any open comment block and triggering block to the output."""
if args.autobrief:
if len(self.comment) == 1 \
or (len(self.comment) > 2 and self.comment[1].strip() == ''):
self.comment[0] = self.__docstringSummaryToBrief(
self.comment[0])
if self.comment:
block = self.makeCommentBlock()
self.output.extend(block)
if self.defclass:
self.output.extend(self.defclass)
def __docstringSummaryToBrief(self, line):
"""Adds \\brief to the docstrings summary line.
A \\brief is prepended, provided no other doxygen command is at the
start of the line.
"""
stripped = line.strip()
if stripped and not stripped[0] in ('@', '\\'):
return "\\brief " + line
else:
return line
def __flushBuffer(self):
"""Flushes the current outputbuffer to the outstream."""
if self.output:
try:
if args.debug:
print("# OUTPUT: ", self.output, file=sys.stderr)
print("\n".join(self.output), file=self.outstream)
self.outstream.flush()
except IOError:
# Fix for FS#33. Catches "broken pipe" when doxygen closes
# stdout prematurely upon usage of INPUT_FILTER, INLINE_SOURCES
# and FILTER_SOURCE_FILES.
pass
self.output = []
def catchall(self, input):
"""The catchall-condition, always returns true."""
return True
def resetCommentSearch(self, match):
"""Restarts a new comment search for a different triggering line.
Closes the current commentblock and starts a new comment search.
"""
if args.debug:
print("# CALLBACK: resetCommentSearch", file=sys.stderr)
self.__closeComment()
self.startCommentSearch(match)
def startCommentSearch(self, match):
"""Starts a new comment search.
Saves the triggering line, resets the current comment and saves
the current indentation.
"""
if args.debug:
print("# CALLBACK: startCommentSearch", file=sys.stderr)
self.defclass = [self.fsm.current_input]
self.comment = []
self.indent = match.group(1)
def stopCommentSearch(self, match):
"""Stops a comment search.
Closes the current commentblock, resets the triggering line and
appends the current line to the output.
"""
if args.debug:
print("# CALLBACK: stopCommentSearch", file=sys.stderr)
self.__closeComment()
self.defclass = []
self.output.append(self.fsm.current_input)
def appendFileheadLine(self, match):
"""Appends a line in the FILEHEAD state.
Closes the open comment block, resets it and appends the current line.
"""
if args.debug:
print("# CALLBACK: appendFileheadLine", file=sys.stderr)
self.__closeComment()
self.comment = []
self.output.append(self.fsm.current_input)
def appendCommentLine(self, match):
"""Appends a comment line.
The comment delimiter is removed from multiline start and ends as
well as singleline comments.
"""
if args.debug:
print("# CALLBACK: appendCommentLine", file=sys.stderr)
(from_state, to_state, condition, callback) = self.fsm.current_transition
# single line comment
if (from_state == "DEFCLASS" and to_state == "DEFCLASS_BODY") \
or (from_state == "FILEHEAD" and to_state == "FILEHEAD"):
# remove comment delimiter from begin and end of the line
activeCommentDelim = match.group(1)
line = self.fsm.current_input
self.comment.append(line[line.find(
activeCommentDelim) + len(activeCommentDelim):line.rfind(activeCommentDelim)])
if (to_state == "DEFCLASS_BODY"):
self.__closeComment()
self.defclass = []
# multiline start
elif from_state == "DEFCLASS" or from_state == "FILEHEAD":
# remove comment delimiter from begin of the line
activeCommentDelim = match.group(1)
line = self.fsm.current_input
self.comment.append(
line[line.find(activeCommentDelim) + len(activeCommentDelim):])
# multiline end
elif to_state == "DEFCLASS_BODY" or to_state == "FILEHEAD":
# remove comment delimiter from end of the line
activeCommentDelim = match.group(1)
line = self.fsm.current_input
self.comment.append(line[0:line.rfind(activeCommentDelim)])
if (to_state == "DEFCLASS_BODY"):
self.__closeComment()
self.defclass = []
# in multiline comment
else:
# just append the comment line
self.comment.append(self.fsm.current_input)
def appendNormalLine(self, match):
"""Appends a line to the output."""
if args.debug:
print("# CALLBACK: appendNormalLine", file=sys.stderr)
self.output.append(self.fsm.current_input)
def appendDefclassLine(self, match):
"""Appends a line to the triggering block."""
if args.debug:
print("# CALLBACK: appendDefclassLine", file=sys.stderr)
self.defclass.append(self.fsm.current_input)
def makeCommentBlock(self):
"""Indents the current comment block with respect to the current
indentation level.
@returns a list of indented comment lines
"""
doxyStart = "##"
commentLines = self.comment
commentLines = ["%s# %s" % (self.indent, x) for x in commentLines]
l = [self.indent + doxyStart]
l.extend(commentLines)
return l
def parse(self, input):
"""Parses a python file given as input string and returns the doxygen-
compatible representation.
@param input the python code to parse
@returns the modified python code
"""
lines = input.split("\n")
for line in lines:
self.fsm.makeTransition(line)
if self.fsm.current_state == "DEFCLASS":
self.__closeComment()
return "\n".join(self.output)
def parseFile(self, filename):
"""Parses a python file given as input string and returns the doxygen-
compatible representation.
@param input the python code to parse
@returns the modified python code
"""
f = open(filename, 'r')
for line in f:
self.parseLine(line.rstrip('\r\n'))
if self.fsm.current_state == "DEFCLASS":
self.__closeComment()
self.__flushBuffer()
f.close()
def parseLine(self, line):
"""Parse one line of python and flush the resulting output to the
outstream.
@param line the python code line to parse
"""
self.fsm.makeTransition(line)
self.__flushBuffer()
def argParse():
"""Parses commandline args."""
parser = ArgumentParser(prog=__applicationName__)
parser.add_argument("--version", action="version",
version="%(prog)s " + __version__
)
parser.add_argument("--autobrief", action="store_true",
help="use the docstring summary line as \\brief description"
)
parser.add_argument("--debug", action="store_true",
help="enable debug output on stderr"
)
parser.add_argument("filename", metavar="FILENAME")
return parser.parse_args()
def main():
"""Starts the parser on the file given by the filename as the first
argument on the commandline.
"""
global args
args = argParse()
fsm = Doxypy()
fsm.parseFile(args.filename)
if __name__ == "__main__":
main()

Wyświetl plik

@ -0,0 +1,6 @@
/*!
* \defgroup block GNU Radio CARIBOULITE C++ Signal Processing Blocks
* \brief All C++ blocks that can be used from the CARIBOULITE GNU Radio
* module are listed here or in the subcategories below.
*
*/

Wyświetl plik

@ -0,0 +1,10 @@
/*! \mainpage
Welcome to the GNU Radio CARIBOULITE Block
This is the intro page for the Doxygen manual generated for the CARIBOULITE
block (docs/doxygen/other/main_page.dox). Edit it to add more detailed
documentation about the new GNU Radio modules contained in this
project.
*/

Wyświetl plik

@ -0,0 +1,19 @@
#ifndef PYDOC_MACROS_H
#define PYDOC_MACROS_H
#define __EXPAND(x) x
#define __COUNT(_1, _2, _3, _4, _5, _6, _7, COUNT, ...) COUNT
#define __VA_SIZE(...) __EXPAND(__COUNT(__VA_ARGS__, 7, 6, 5, 4, 3, 2, 1))
#define __CAT1(a, b) a##b
#define __CAT2(a, b) __CAT1(a, b)
#define __DOC1(n1) __doc_##n1
#define __DOC2(n1, n2) __doc_##n1##_##n2
#define __DOC3(n1, n2, n3) __doc_##n1##_##n2##_##n3
#define __DOC4(n1, n2, n3, n4) __doc_##n1##_##n2##_##n3##_##n4
#define __DOC5(n1, n2, n3, n4, n5) __doc_##n1##_##n2##_##n3##_##n4##_##n5
#define __DOC6(n1, n2, n3, n4, n5, n6) __doc_##n1##_##n2##_##n3##_##n4##_##n5##_##n6
#define __DOC7(n1, n2, n3, n4, n5, n6, n7) \
__doc_##n1##_##n2##_##n3##_##n4##_##n5##_##n6##_##n7
#define DOC(...) __EXPAND(__EXPAND(__CAT2(__DOC, __VA_SIZE(__VA_ARGS__)))(__VA_ARGS__))
#endif // PYDOC_MACROS_H

Wyświetl plik

@ -0,0 +1,372 @@
#
# Copyright 2010-2012 Free Software Foundation, Inc.
#
# This file was generated by gr_modtool, a tool from the GNU Radio framework
# This file is a part of gnuradio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
"""
Updates the *pydoc_h files for a module
Execute using: python update_pydoc.py xml_path outputfilename
The file instructs Pybind11 to transfer the doxygen comments into the
python docstrings.
"""
import os
import sys
import time
import glob
import re
import json
from argparse import ArgumentParser
from doxyxml import DoxyIndex, DoxyClass, DoxyFriend, DoxyFunction, DoxyFile
from doxyxml import DoxyOther, base
def py_name(name):
bits = name.split('_')
return '_'.join(bits[1:])
def make_name(name):
bits = name.split('_')
return bits[0] + '_make_' + '_'.join(bits[1:])
class Block(object):
"""
Checks if doxyxml produced objects correspond to a gnuradio block.
"""
@classmethod
def includes(cls, item):
if not isinstance(item, DoxyClass):
return False
# Check for a parsing error.
if item.error():
return False
friendname = make_name(item.name())
is_a_block = item.has_member(friendname, DoxyFriend)
# But now sometimes the make function isn't a friend so check again.
if not is_a_block:
is_a_block = di.has_member(friendname, DoxyFunction)
return is_a_block
class Block2(object):
"""
Checks if doxyxml produced objects correspond to a new style
gnuradio block.
"""
@classmethod
def includes(cls, item):
if not isinstance(item, DoxyClass):
return False
# Check for a parsing error.
if item.error():
return False
is_a_block2 = item.has_member(
'make', DoxyFunction) and item.has_member('sptr', DoxyOther)
return is_a_block2
def utoascii(text):
"""
Convert unicode text into ascii and escape quotes and backslashes.
"""
if text is None:
return ''
out = text.encode('ascii', 'replace')
# swig will require us to replace blackslash with 4 backslashes
# TODO: evaluate what this should be for pybind11
out = out.replace(b'\\', b'\\\\\\\\')
out = out.replace(b'"', b'\\"').decode('ascii')
return str(out)
def combine_descriptions(obj):
"""
Combines the brief and detailed descriptions of an object together.
"""
description = []
bd = obj.brief_description.strip()
dd = obj.detailed_description.strip()
if bd:
description.append(bd)
if dd:
description.append(dd)
return utoascii('\n\n'.join(description)).strip()
def format_params(parameteritems):
output = ['Args:']
template = ' {0} : {1}'
for pi in parameteritems:
output.append(template.format(pi.name, pi.description))
return '\n'.join(output)
entry_templ = '%feature("docstring") {name} "{docstring}"'
def make_entry(obj, name=None, templ="{description}", description=None, params=[]):
"""
Create a docstring key/value pair, where the key is the object name.
obj - a doxyxml object from which documentation will be extracted.
name - the name of the C object (defaults to obj.name())
templ - an optional template for the docstring containing only one
variable named 'description'.
description - if this optional variable is set then it's value is
used as the description instead of extracting it from obj.
"""
if name is None:
name = obj.name()
if hasattr(obj, '_parse_data') and hasattr(obj._parse_data, 'definition'):
name = obj._parse_data.definition.split(' ')[-1]
if "operator " in name:
return ''
if description is None:
description = combine_descriptions(obj)
if params:
description += '\n\n'
description += utoascii(format_params(params))
docstring = templ.format(description=description)
return {name: docstring}
def make_class_entry(klass, description=None, ignored_methods=[], params=None):
"""
Create a class docstring key/value pair.
"""
if params is None:
params = klass.params
output = {}
output.update(make_entry(klass, description=description, params=params))
for func in klass.in_category(DoxyFunction):
if func.name() not in ignored_methods:
name = klass.name() + '::' + func.name()
output.update(make_entry(func, name=name))
return output
def make_block_entry(di, block):
"""
Create class and function docstrings of a gnuradio block
"""
descriptions = []
# Get the documentation associated with the class.
class_desc = combine_descriptions(block)
if class_desc:
descriptions.append(class_desc)
# Get the documentation associated with the make function
make_func = di.get_member(make_name(block.name()), DoxyFunction)
make_func_desc = combine_descriptions(make_func)
if make_func_desc:
descriptions.append(make_func_desc)
# Get the documentation associated with the file
try:
block_file = di.get_member(block.name() + ".h", DoxyFile)
file_desc = combine_descriptions(block_file)
if file_desc:
descriptions.append(file_desc)
except base.Base.NoSuchMember:
# Don't worry if we can't find a matching file.
pass
# And join them all together to make a super duper description.
super_description = "\n\n".join(descriptions)
# Associate the combined description with the class and
# the make function.
output = {}
output.update(make_class_entry(block, description=super_description))
output.update(make_entry(make_func, description=super_description,
params=block.params))
return output
def make_block2_entry(di, block):
"""
Create class and function docstrings of a new style gnuradio block
"""
# For new style blocks all the relevant documentation should be
# associated with the 'make' method.
class_description = combine_descriptions(block)
make_func = block.get_member('make', DoxyFunction)
make_description = combine_descriptions(make_func)
description = class_description + \
"\n\nConstructor Specific Documentation:\n\n" + make_description
# Associate the combined description with the class and
# the make function.
output = {}
output.update(make_class_entry(
block, description=description,
ignored_methods=['make'], params=make_func.params))
makename = block.name() + '::make'
output.update(make_entry(
make_func, name=makename, description=description,
params=make_func.params))
return output
def get_docstrings_dict(di, custom_output=None):
output = {}
if custom_output:
output.update(custom_output)
# Create docstrings for the blocks.
blocks = di.in_category(Block)
blocks2 = di.in_category(Block2)
make_funcs = set([])
for block in blocks:
try:
make_func = di.get_member(make_name(block.name()), DoxyFunction)
# Don't want to risk writing to output twice.
if make_func.name() not in make_funcs:
make_funcs.add(make_func.name())
output.update(make_block_entry(di, block))
except block.ParsingError:
sys.stderr.write(
'Parsing error for block {0}\n'.format(block.name()))
raise
for block in blocks2:
try:
make_func = block.get_member('make', DoxyFunction)
make_func_name = block.name() + '::make'
# Don't want to risk writing to output twice.
if make_func_name not in make_funcs:
make_funcs.add(make_func_name)
output.update(make_block2_entry(di, block))
except block.ParsingError:
sys.stderr.write(
'Parsing error for block {0}\n'.format(block.name()))
raise
# Create docstrings for functions
# Don't include the make functions since they have already been dealt with.
funcs = [f for f in di.in_category(DoxyFunction)
if f.name() not in make_funcs and not f.name().startswith('std::')]
for f in funcs:
try:
output.update(make_entry(f))
except f.ParsingError:
sys.stderr.write(
'Parsing error for function {0}\n'.format(f.name()))
# Create docstrings for classes
block_names = [block.name() for block in blocks]
block_names += [block.name() for block in blocks2]
klasses = [k for k in di.in_category(DoxyClass)
if k.name() not in block_names and not k.name().startswith('std::')]
for k in klasses:
try:
output.update(make_class_entry(k))
except k.ParsingError:
sys.stderr.write('Parsing error for class {0}\n'.format(k.name()))
# Docstrings are not created for anything that is not a function or a class.
# If this excludes anything important please add it here.
return output
def sub_docstring_in_pydoc_h(pydoc_files, docstrings_dict, output_dir, filter_str=None):
if filter_str:
docstrings_dict = {
k: v for k, v in docstrings_dict.items() if k.startswith(filter_str)}
with open(os.path.join(output_dir, 'docstring_status'), 'w') as status_file:
for pydoc_file in pydoc_files:
if filter_str:
filter_str2 = "::".join((filter_str, os.path.split(
pydoc_file)[-1].split('_pydoc_template.h')[0]))
docstrings_dict2 = {
k: v for k, v in docstrings_dict.items() if k.startswith(filter_str2)}
else:
docstrings_dict2 = docstrings_dict
file_in = open(pydoc_file, 'r').read()
for key, value in docstrings_dict2.items():
file_in_tmp = file_in
try:
doc_key = key.split("::")
# if 'gr' in doc_key:
# doc_key.remove('gr')
doc_key = '_'.join(doc_key)
regexp = r'(__doc_{} =\sR\"doc\()[^)]*(\)doc\")'.format(
doc_key)
regexp = re.compile(regexp, re.MULTILINE)
(file_in, nsubs) = regexp.subn(
r'\1' + value + r'\2', file_in, count=1)
if nsubs == 1:
status_file.write("PASS: " + pydoc_file + "\n")
except KeyboardInterrupt:
raise KeyboardInterrupt
except: # be permissive, TODO log, but just leave the docstring blank
status_file.write("FAIL: " + pydoc_file + "\n")
file_in = file_in_tmp
output_pathname = os.path.join(output_dir, os.path.basename(
pydoc_file).replace('_template.h', '.h'))
with open(output_pathname, 'w') as file_out:
file_out.write(file_in)
def copy_docstring_templates(pydoc_files, output_dir):
with open(os.path.join(output_dir, 'docstring_status'), 'w') as status_file:
for pydoc_file in pydoc_files:
file_in = open(pydoc_file, 'r').read()
output_pathname = os.path.join(output_dir, os.path.basename(
pydoc_file).replace('_template.h', '.h'))
with open(output_pathname, 'w') as file_out:
file_out.write(file_in)
status_file.write("DONE")
def argParse():
"""Parses commandline args."""
desc = 'Scrape the doxygen generated xml for docstrings to insert into python bindings'
parser = ArgumentParser(description=desc)
parser.add_argument("function", help="Operation to perform on docstrings", choices=[
"scrape", "sub", "copy"])
parser.add_argument("--xml_path")
parser.add_argument("--bindings_dir")
parser.add_argument("--output_dir")
parser.add_argument("--json_path")
parser.add_argument("--filter", default=None)
return parser.parse_args()
if __name__ == "__main__":
# Parse command line options and set up doxyxml.
args = argParse()
if args.function.lower() == 'scrape':
di = DoxyIndex(args.xml_path)
docstrings_dict = get_docstrings_dict(di)
with open(args.json_path, 'w') as fp:
json.dump(docstrings_dict, fp)
elif args.function.lower() == 'sub':
with open(args.json_path, 'r') as fp:
docstrings_dict = json.load(fp)
pydoc_files = glob.glob(os.path.join(
args.bindings_dir, '*_pydoc_template.h'))
sub_docstring_in_pydoc_h(
pydoc_files, docstrings_dict, args.output_dir, args.filter)
elif args.function.lower() == 'copy':
pydoc_files = glob.glob(os.path.join(
args.bindings_dir, '*_pydoc_template.h'))
copy_docstring_templates(pydoc_files, args.output_dir)

Wyświetl plik

@ -0,0 +1,3 @@
It is considered good practice to add examples in here to demonstrate the
functionality of your OOT module. Python scripts, GRC flow graphs or other
code can go here.

Wyświetl plik

@ -0,0 +1,10 @@
# Copyright 2011 Free Software Foundation, Inc.
#
# This file was generated by gr_modtool, a tool from the GNU Radio framework
# This file is a part of gr-caribouLite
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
install(FILES
caribouLite_caribouLiteSource.block.yml DESTINATION share/gnuradio/grc/blocks)

Wyświetl plik

@ -0,0 +1,69 @@
id: caribouLite_caribouLiteSource
label: CaribouLite Source
category: '[caribouLite]'
flags: throttle
templates:
imports:
from gnuradio import caribouLite
make:
caribouLite.caribouLiteSource(${channel}, ${enable_agc}, ${rx_gain}, ${rx_bw}, ${sample_rate}, ${freq})
# Make one 'parameters' list entry for every parameter you want settable from the GUI.
# Keys include:
# * id (makes the value accessible as keyname, e.g. in the make entry)
# * label (label shown in the GUI)
# * dtype (e.g. int, float, complex, byte, short, xxx_vector, ...)
# * default
parameters:
- id: channel
label: S1G(0) or HiF(1)
dtype: int
default: 0
- id: enable_agc
label: Enable AGC
dtype: bool
default: False
- id: rx_gain
label: Rx gain [dB]
dtype: float
default: 40.0
- id: rx_bw
label: Rx bandwidth [Hz]
dtype: float
default: 2500000.0
- id: sample_rate
label: Sample rate [Hz]
dtype: float
default: 4000000.0
- id: freq
label: Frequency [Hz]
dtype: float
default: 900000000.0
# Make one 'inputs' list entry per input and one 'outputs' list entry per output.
# Keys include:
# * label (an identifier for the GUI)
# * domain (optional - stream or message. Default is stream)
# * dtype (e.g. int, float, complex, byte, short, xxx_vector, ...)
# * vlen (optional - data stream vector length. Default is 1)
# * optional (optional - set to 1 for optional inputs. Default is 0)
inputs:
outputs:
- label: samples
domain: stream
dtype: complex
# 'file_format' specifies the version of the GRC yml format used in the file
# and should usually not be changed.
file_format: 1

Wyświetl plik

@ -1,7 +1,7 @@
# Copyright 2011-2021 Free Software Foundation, Inc.
# Copyright 2011,2012 Free Software Foundation, Inc.
#
# This file was generated by gr_modtool, a tool from the GNU Radio framework
# This file is a part of gr-soapy
# This file is a part of gr-caribouLite
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
@ -9,12 +9,5 @@
########################################################################
# Install public header files
########################################################################
install(FILES
api.h
block.h
soapy_types.h
source.h
sink.h
DESTINATION ${GR_INCLUDE_DIR}/gnuradio/soapy
)
install(FILES api.h
caribouLiteSource.h DESTINATION include/gnuradio/caribouLite)

Wyświetl plik

@ -1,8 +1,8 @@
/*
* gr-soapy: Soapy SDR Radio Module
* Copyright 2011 Free Software Foundation, Inc.
*
* Copyright (C) 2018
* Libre Space Foundation <http://librespacefoundation.org/>
* This file was generated by gr_modtool, a tool from the GNU Radio framework
* This file is a part of gr-caribouLite
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
@ -13,7 +13,7 @@
#include <gnuradio/attributes.h>
#ifdef gnuradio_cariboulite_EXPORTS
#ifdef gnuradio_caribouLite_EXPORTS
#define CARIBOULITE_API __GR_ATTR_EXPORT
#else
#define CARIBOULITE_API __GR_ATTR_IMPORT

Wyświetl plik

@ -0,0 +1,41 @@
/* -*- c++ -*- */
/*
* Copyright 2023 CaribouLabs LTD.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#ifndef INCLUDED_CARIBOULITE_CARIBOULITESOURCE_H
#define INCLUDED_CARIBOULITE_CARIBOULITESOURCE_H
#include <gnuradio/caribouLite/api.h>
#include <gnuradio/sync_block.h>
namespace gr {
namespace caribouLite {
/*!
* \brief <+description of block+>
* \ingroup caribouLite
*
*/
class CARIBOULITE_API caribouLiteSource : virtual public gr::sync_block
{
public:
typedef std::shared_ptr<caribouLiteSource> sptr;
/*!
* \brief Return a shared_ptr to a new instance of caribouLite::caribouLiteSource.
*
* To avoid accidental use of raw pointers, caribouLite::caribouLiteSource's
* constructor is in a private implementation
* class. caribouLite::caribouLiteSource::make is the public interface for
* creating new instances.
*/
static sptr make(int channel=0, bool enable_agc=false, float rx_gain=40, float rx_bw=2500000, float sample_rate=4000000, float freq=900000000);
};
} // namespace caribouLite
} // namespace gr
#endif /* INCLUDED_CARIBOULITE_CARIBOULITESOURCE_H */

Wyświetl plik

@ -0,0 +1,73 @@
# Copyright 2011,2012,2016,2018,2019 Free Software Foundation, Inc.
#
# This file was generated by gr_modtool, a tool from the GNU Radio framework
# This file is a part of gr-caribouLite
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
########################################################################
# Setup library
########################################################################
include(GrPlatform) #define LIB_SUFFIX
find_package(PkgConfig REQUIRED)
pkg_check_modules(CARIBOULITE REQUIRED cariboulite)
list(APPEND caribouLite_sources
caribouLiteSource_impl.cc)
set(caribouLite_sources
"${caribouLite_sources}"
PARENT_SCOPE)
if(NOT caribouLite_sources)
message(STATUS "No C++ sources... skipping lib/")
return()
endif(NOT caribouLite_sources)
add_library(gnuradio-caribouLite SHARED ${caribouLite_sources})
target_link_libraries(gnuradio-caribouLite gnuradio::gnuradio-runtime ${CARIBOULITE_LIBRARIES} -lcariboulite)
target_include_directories(
gnuradio-caribouLite
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
PUBLIC $<INSTALL_INTERFACE:include>
${CARIBOULITE_INCLUDE_DIRS})
set_target_properties(gnuradio-caribouLite PROPERTIES DEFINE_SYMBOL "gnuradio_caribouLite_EXPORTS")
if(APPLE)
set_target_properties(gnuradio-caribouLite PROPERTIES INSTALL_NAME_DIR
"${CMAKE_INSTALL_PREFIX}/lib")
endif(APPLE)
########################################################################
# Install built library files
########################################################################
include(GrMiscUtils)
gr_library_foo(gnuradio-caribouLite)
########################################################################
# Print summary
########################################################################
message(STATUS "Using install prefix: ${CMAKE_INSTALL_PREFIX}")
message(STATUS "Building for version: ${VERSION} / ${LIBVER}")
########################################################################
# Build and register unit test
########################################################################
include(GrTest)
# If your unit tests require special include paths, add them here
#include_directories()
# List all files that contain Boost.UTF unit tests here
list(APPEND test_caribouLite_sources)
# Anything we need to link to for the unit tests go here
list(APPEND GR_TEST_TARGET_DEPS gnuradio-caribouLite)
if(NOT test_caribouLite_sources)
message(STATUS "No C++ unit tests... skipping")
return()
endif(NOT test_caribouLite_sources)
foreach(qa_file ${test_caribouLite_sources})
gr_add_cpp_test("caribouLite_${qa_file}" ${CMAKE_CURRENT_SOURCE_DIR}/${qa_file})
endforeach(qa_file)

Wyświetl plik

@ -0,0 +1,106 @@
/* -*- c++ -*- */
/*
* Copyright 2023 CaribouLabs LTD.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#include <gnuradio/io_signature.h>
#include "caribouLiteSource_impl.h"
namespace gr {
namespace caribouLite {
#define NUM_NATIVE_MTUS_PER_QUEUE ( 10 )
#define USE_ASYNC_OVERRIDE_WRITES ( true )
#define USE_ASYNC_BLOCK_READS ( true )
using output_type = gr_complex;
void detectBoard()
{
CaribouLite::SysVersion ver;
std::string name;
std::string guid;
if (CaribouLite::DetectBoard(&ver, name, guid))
{
std::cout << "Detected Version: " << CaribouLite::GetSystemVersionStr(ver) << ", Name: " << name << ", GUID: " << guid << std::endl;
}
else
{
std::cout << "Undetected CaribouLite!" << std::endl;
}
}
//-------------------------------------------------------------------------------------------------------------
caribouLiteSource::sptr caribouLiteSource::make(int channel, bool enable_agc, float rx_gain, float rx_bw, float sample_rate, float freq)
{
return gnuradio::make_block_sptr<caribouLiteSource_impl>(channel, enable_agc, rx_gain, rx_bw, sample_rate, freq);
}
// private constructor
//-------------------------------------------------------------------------------------------------------------
caribouLiteSource_impl::caribouLiteSource_impl(int channel, bool enable_agc, float rx_gain, float rx_bw, float sample_rate, float freq)
: gr::sync_block("caribouLiteSource",
gr::io_signature::make(0, 0, 0),
gr::io_signature::make(1 /* min outputs */, 1 /*max outputs */, sizeof(output_type)))
{
_rx_queue = NULL;
_channel = (CaribouLiteRadio::RadioType)channel;
_enable_agc = enable_agc;
_rx_gain = rx_gain;
_rx_bw = rx_bw;
_sample_rate = sample_rate;
_frequency = freq;
detectBoard();
CaribouLite &cl = CaribouLite::GetInstance();
_cl = &cl;
_radio = cl.GetRadioChannel(_channel);
_mtu_size = _radio->GetNativeMtuSample();
_rx_queue = new circular_buffer<gr_complex>(_mtu_size * NUM_NATIVE_MTUS_PER_QUEUE,
USE_ASYNC_OVERRIDE_WRITES,
USE_ASYNC_BLOCK_READS);
// setup parameters
_radio->SetRxGain(rx_gain);
_radio->SetAgc(enable_agc);
_radio->SetRxBandwidth(rx_bw);
_radio->SetRxSampleRate(sample_rate);
_radio->SetFrequency(freq);
_radio->StartReceiving([this](CaribouLiteRadio* radio, const std::complex<float>* samples, CaribouLiteMeta* sync, size_t num_samples) {
receivedSamples(radio, samples, sync, num_samples);
});
}
// virtual destructor
//-------------------------------------------------------------------------------------------------------------
caribouLiteSource_impl::~caribouLiteSource_impl()
{
_radio->StopReceiving();
if (_rx_queue) delete _rx_queue;
}
// Receive samples callback
//-------------------------------------------------------------------------------------------------------------
void caribouLiteSource_impl::receivedSamples(CaribouLiteRadio* radio, const std::complex<float>* samples, CaribouLiteMeta* sync, size_t num_samples)
{
//std::cout << "Radio: " << radio->GetRadioName() << " Received " << std::dec << num_samples << " samples" << std::endl;
_rx_queue->put(static_cast<const gr_complex*>(samples), num_samples);
}
//-------------------------------------------------------------------------------------------------------------
int caribouLiteSource_impl::work( int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items)
{
auto out = static_cast<output_type*>(output_items[0]);
size_t num_read = _rx_queue->get(out, noutput_items);
return noutput_items;
}
} /* namespace caribouLite */
} /* namespace gr */

Wyświetl plik

@ -0,0 +1,51 @@
/* -*- c++ -*- */
/*
* Copyright 2023 CaribouLabs LTD.
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#ifndef INCLUDED_CARIBOULITE_CARIBOULITESOURCE_IMPL_H
#define INCLUDED_CARIBOULITE_CARIBOULITESOURCE_IMPL_H
#include <gnuradio/caribouLite/caribouLiteSource.h>
#include <CaribouLite.hpp>
#include "circular_buffer.h"
namespace gr
{
namespace caribouLite
{
class caribouLiteSource_impl : public caribouLiteSource
{
private:
CaribouLiteRadio::RadioType _channel;
bool _enable_agc;
float _rx_gain;
float _rx_bw;
float _sample_rate;
float _frequency;
size_t _mtu_size;
CaribouLite* _cl;
CaribouLiteRadio *_radio;
circular_buffer<gr_complex> *_rx_queue;
private:
void receivedSamples(CaribouLiteRadio* radio, const std::complex<float>* samples, CaribouLiteMeta* sync, size_t num_samples);
public:
caribouLiteSource_impl(int channel, bool enable_agc, float rx_gain, float rx_bw, float sample_rate, float freq);
~caribouLiteSource_impl();
int work(
int noutput_items,
gr_vector_const_void_star &input_items,
gr_vector_void_star &output_items
);
};
} // namespace caribouLite
} // namespace gr
#endif /* INCLUDED_CARIBOULITE_CARIBOULITESOURCE_IMPL_H */

Wyświetl plik

@ -0,0 +1,165 @@
#ifndef __CIRC_BUFFER_H__
#define __CIRC_BUFFER_H__
#include <string.h>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <chrono>
#include <atomic>
#define IS_POWER_OF_2(x) (!((x) == 0) && !((x) & ((x) - 1)))
#define MIN(x,y) ((x)>(y)?(y):(x))
template <class T>
class circular_buffer {
public:
circular_buffer(size_t size, bool override_write = true, bool block_read = true)
{
max_size_ = size;
if (!IS_POWER_OF_2(max_size_))
{
max_size_ = next_power_of_2(max_size_);
}
buf_ = new T[max_size_];
override_write_ = override_write;
block_read_ = block_read;
}
~circular_buffer()
{
std::unique_lock<std::mutex> lock(mutex_);
delete []buf_;
}
size_t put(const T *data, size_t length)
{
std::lock_guard<std::mutex> lock(mutex_);
if ((max_size_ - size()) < length && override_write_)
{
// pop the amount of data the is needed
tail_ += length - (max_size_ - size());
}
size_t len = MIN(length, max_size_ - head_ + tail_);
auto l = MIN(len, max_size_ - (head_ & (max_size_ - 1)));
memcpy(buf_ + (head_ & (max_size_ - 1)), data, l * sizeof(T));
memcpy(buf_, data + l, (len - l) * sizeof(T));
head_ += len;
if (block_read_)
{
cond_var_.notify_one();
}
return len;
}
size_t get(T *data, size_t length, int timeout_us = 100000)
{
std::unique_lock<std::mutex> lock(mutex_);
if (block_read_)
{
cond_var_.wait_for(lock, std::chrono::microseconds(timeout_us), [&]()
{
// Acquire the lock only if
// we got enough items
return size() >= length;
});
if (size() < length)
{
return 0;
}
}
size_t len = MIN(length, head_ - tail_);
auto l = MIN(len, max_size_ - (tail_ & (max_size_ - 1)));
if (data != NULL)
{
memcpy(data, buf_ + (tail_ & (max_size_ - 1)), l * sizeof(T));
memcpy(data + l, buf_, (len - l) * sizeof(T));
}
tail_ += len;
return len;
}
void put(T item)
{
put(&item, 1);
}
T get()
{
T item;
get(&item, 1);
return item;
}
void reset()
{
std::unique_lock<std::mutex> lock(mutex_);
head_ = tail_ = 0;
}
inline bool empty()
{
return head_ == tail_;
}
inline bool full()
{
return size() == capacity();
}
inline size_t capacity() const
{
return max_size_;
}
size_t size()
{
return (head_ - tail_);
}
void print_buffer()
{
std::unique_lock<std::mutex> lock(mutex_);
size_t t = tail_;
int i = 0;
while (t < head_)
{
printf("%d => %d\n", i++, (int)buf_[t++&(max_size_-1)]);
}
}
private:
uint32_t next_power_of_2 (uint32_t x)
{
uint32_t power = 1;
while(power < x)
{
power <<= 1;
}
return power;
}
private:
std::mutex mutex_;
std::condition_variable cond_var_;
T* buf_;
size_t head_ = 0;
size_t tail_ = 0;
size_t max_size_;
bool override_write_;
bool block_read_;
};
#endif

Wyświetl plik

@ -0,0 +1,5 @@
*~
*.pyc
*.pyo
build*/
examples/grc/*.py

Wyświetl plik

@ -1,7 +1,7 @@
# Copyright 2011-2021 Free Software Foundation, Inc.
# Copyright 2011 Free Software Foundation, Inc.
#
# This file was generated by gr_modtool, a tool from the GNU Radio framework
# This file is a part of gr-cariboulite
# This file is a part of gr-caribouLite
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
@ -10,32 +10,27 @@
# Include python install macros
########################################################################
include(GrPython)
if(NOT PYTHONINTERP_FOUND)
return()
endif()
add_subdirectory(bindings)
########################################################################
# Install python sources
########################################################################
GR_PYTHON_INSTALL(
FILES
__init__.py
DESTINATION ${GR_PYTHON_DIR}/gnuradio/cariboulite
)
gr_python_install(FILES __init__.py DESTINATION ${GR_PYTHON_DIR}/gnuradio/caribouLite)
########################################################################
# Handle the unit tests
########################################################################
if(ENABLE_TESTING)
set(GR_TEST_TARGET_DEPS "")
set(GR_TEST_LIBRARY_DIRS "")
set(GR_TEST_PYTHON_DIRS
${CMAKE_BINARY_DIR}/gnuradio-runtime/python
)
include(GrTest)
include(GrTest)
file(GLOB py_qa_test_files "qa_*.py")
foreach(py_qa_test_file ${py_qa_test_files})
get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE)
GR_ADD_TEST(${py_qa_test_name} ${QA_PYTHON_EXECUTABLE} -B ${py_qa_test_file})
endforeach(py_qa_test_file)
endif(ENABLE_TESTING)
set(GR_TEST_TARGET_DEPS gnuradio-caribouLite)
add_subdirectory(bindings)
# Create a package directory that tests can import. It includes everything
# from `python/`.
add_custom_target(
copy_module_for_tests ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}
${PROJECT_BINARY_DIR}/test_modules/gnuradio/caribouLite/)

Wyświetl plik

@ -0,0 +1,23 @@
#
# Copyright 2008,2009 Free Software Foundation, Inc.
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
# The presence of this file turns this directory into a Python package
'''
This is the GNU Radio CARIBOULITE module. Place your Python package
description here (python/__init__.py).
'''
import os
# import pybind11 generated symbols into the caribouLite namespace
try:
# this might fail if the module is python-only
from .caribouLite_python import *
except ModuleNotFoundError:
pass
# import any pure python here
#

Wyświetl plik

@ -0,0 +1,42 @@
# Copyright 2020 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
########################################################################
# Check if there is C++ code at all
########################################################################
if(NOT caribouLite_sources)
message(STATUS "No C++ sources... skipping python bindings")
return()
endif(NOT caribouLite_sources)
########################################################################
# Check for pygccxml
########################################################################
gr_python_check_module_raw("pygccxml" "import pygccxml" PYGCCXML_FOUND)
include(GrPybind)
########################################################################
# Python Bindings
########################################################################
list(APPEND caribouLite_python_files
caribouLiteSource_python.cc python_bindings.cc)
gr_pybind_make_oot(caribouLite ../../.. gr::caribouLite "${caribouLite_python_files}")
# copy bindings extension for use in QA test module
add_custom_command(
TARGET caribouLite_python
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:caribouLite_python>
${PROJECT_BINARY_DIR}/test_modules/gnuradio/caribouLite/)
install(
TARGETS caribouLite_python
DESTINATION ${GR_PYTHON_DIR}/gnuradio/caribouLite
COMPONENT pythonapi)

Wyświetl plik

@ -0,0 +1,54 @@
import warnings
import argparse
from gnuradio.bindtool import BindingGenerator
import sys
import tempfile
parser = argparse.ArgumentParser(description='Bind a GR Out of Tree Block')
parser.add_argument('--module', type=str,
help='Name of gr module containing file to bind (e.g. fft digital analog)')
parser.add_argument('--output_dir', default=tempfile.gettempdir(),
help='Output directory of generated bindings')
parser.add_argument('--prefix', help='Prefix of Installed GNU Radio')
parser.add_argument(
'--filename', help="File to be parsed")
parser.add_argument(
'--defines', help='Set additional defines for precompiler', default=(), nargs='*')
parser.add_argument(
'--include', help='Additional Include Dirs, separated', default=(), nargs='*')
parser.add_argument(
'--status', help='Location of output file for general status (used during cmake)', default=None
)
parser.add_argument(
'--flag_automatic', default='0'
)
parser.add_argument(
'--flag_pygccxml', default='0'
)
args = parser.parse_args()
prefix = args.prefix
output_dir = args.output_dir
defines = tuple(','.join(args.defines).split(','))
includes = ','.join(args.include)
name = args.module
namespace = ['gr', name]
prefix_include_root = name
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
bg = BindingGenerator(prefix, namespace,
prefix_include_root, output_dir, define_symbols=defines, addl_includes=includes,
catch_exceptions=False, write_json_output=False, status_output=args.status,
flag_automatic=True if args.flag_automatic.lower() in [
'1', 'true'] else False,
flag_pygccxml=True if args.flag_pygccxml.lower() in ['1', 'true'] else False)
bg.gen_file_binding(args.filename)

Wyświetl plik

@ -1,6 +1,5 @@
/* -*- c++ -*- */
/*
* Copyright 2020-2021 Free Software Foundation, Inc.
* Copyright 2023 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@ -14,8 +13,8 @@
/* If manual edits are made, the following tags should be modified accordingly. */
/* BINDTOOL_GEN_AUTOMATIC(0) */
/* BINDTOOL_USE_PYGCCXML(0) */
/* BINDTOOL_HEADER_FILE(source.h) */
/* BINDTOOL_HEADER_FILE_HASH(2ae3163aea8bce7c6a687dda4356f09e) */
/* BINDTOOL_HEADER_FILE(caribouLiteSource.h) */
/* BINDTOOL_HEADER_FILE_HASH(9ce2846f2939a8b8e624a4612154ad52) */
/***********************************************************************************/
#include <pybind11/complex.h>
@ -24,33 +23,37 @@
namespace py = pybind11;
#include <gnuradio/soapy/block.h>
#include <gnuradio/soapy/source.h>
#include <gnuradio/caribouLite/caribouLiteSource.h>
// pydoc.h is automatically generated in the build directory
#include <source_pydoc.h>
#include <caribouLiteSource_pydoc.h>
void bind_source(py::module& m)
void bind_caribouLiteSource(py::module& m)
{
using source = ::gr::soapy::source;
using caribouLiteSource = gr::caribouLite::caribouLiteSource;
py::class_<source,
gr::soapy::block,
gr::block,
gr::basic_block,
std::shared_ptr<source>>(m, "source", D(source))
py::class_<caribouLiteSource, gr::sync_block, gr::block, gr::basic_block,
std::shared_ptr<caribouLiteSource>>(m, "caribouLiteSource", D(caribouLiteSource))
.def(py::init(&caribouLiteSource::make),
D(caribouLiteSource,make)
)
.def(py::init(&source::make),
py::arg("device"),
py::arg("type"),
py::arg("nchan"),
py::arg("dev_args"),
py::arg("stream_args"),
py::arg("tune_args"),
py::arg("other_settings"),
D(source, make))
;
}

Wyświetl plik

@ -0,0 +1 @@
This directory stores templates for docstrings that are scraped from the include header files for each block

Wyświetl plik

@ -0,0 +1,27 @@
/*
* Copyright 2023 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
*/
#include "pydoc_macros.h"
#define D(...) DOC(gr, caribouLite, __VA_ARGS__)
/*
This file contains placeholders for docstrings for the Python bindings.
Do not edit! These were automatically extracted during the binding process
and will be overwritten during the build process
*/
static const char *__doc_gr_caribouLite_caribouLiteSource = R"doc()doc";
static const char *__doc_gr_caribouLite_caribouLiteSource_caribouLiteSource = R"doc()doc";
static const char *__doc_gr_caribouLite_caribouLiteSource_make = R"doc()doc";

Wyświetl plik

@ -0,0 +1,80 @@
# Utilities for reading values in header files
from argparse import ArgumentParser
import re
class PybindHeaderParser:
def __init__(self, pathname):
with open(pathname, 'r') as f:
self.file_txt = f.read()
def get_flag_automatic(self):
# p = re.compile(r'BINDTOOL_GEN_AUTOMATIC\(([^\s])\)')
# m = p.search(self.file_txt)
m = re.search(r'BINDTOOL_GEN_AUTOMATIC\(([^\s])\)', self.file_txt)
if (m and m.group(1) == '1'):
return True
else:
return False
def get_flag_pygccxml(self):
# p = re.compile(r'BINDTOOL_USE_PYGCCXML\(([^\s])\)')
# m = p.search(self.file_txt)
m = re.search(r'BINDTOOL_USE_PYGCCXML\(([^\s])\)', self.file_txt)
if (m and m.group(1) == '1'):
return True
else:
return False
def get_header_filename(self):
# p = re.compile(r'BINDTOOL_HEADER_FILE\(([^\s]*)\)')
# m = p.search(self.file_txt)
m = re.search(r'BINDTOOL_HEADER_FILE\(([^\s]*)\)', self.file_txt)
if (m):
return m.group(1)
else:
return None
def get_header_file_hash(self):
# p = re.compile(r'BINDTOOL_HEADER_FILE_HASH\(([^\s]*)\)')
# m = p.search(self.file_txt)
m = re.search(r'BINDTOOL_HEADER_FILE_HASH\(([^\s]*)\)', self.file_txt)
if (m):
return m.group(1)
else:
return None
def get_flags(self):
return f'{self.get_flag_automatic()};{self.get_flag_pygccxml()};{self.get_header_filename()};{self.get_header_file_hash()};'
def argParse():
"""Parses commandline args."""
desc = 'Reads the parameters from the comment block in the pybind files'
parser = ArgumentParser(description=desc)
parser.add_argument("function", help="Operation to perform on comment block of pybind file", choices=[
"flag_auto", "flag_pygccxml", "header_filename", "header_file_hash", "all"])
parser.add_argument(
"pathname", help="Pathname of pybind c++ file to read, e.g. blockname_python.cc")
return parser.parse_args()
if __name__ == "__main__":
# Parse command line options and set up doxyxml.
args = argParse()
pbhp = PybindHeaderParser(args.pathname)
if args.function == "flag_auto":
print(pbhp.get_flag_automatic())
elif args.function == "flag_pygccxml":
print(pbhp.get_flag_pygccxml())
elif args.function == "header_filename":
print(pbhp.get_header_filename())
elif args.function == "header_file_hash":
print(pbhp.get_header_file_hash())
elif args.function == "all":
print(pbhp.get_flags())

Wyświetl plik

@ -0,0 +1,55 @@
/*
* Copyright 2020 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
*/
#include <pybind11/pybind11.h>
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include <numpy/arrayobject.h>
namespace py = pybind11;
// Headers for binding functions
/**************************************/
// The following comment block is used for
// gr_modtool to insert function prototypes
// Please do not delete
/**************************************/
// BINDING_FUNCTION_PROTOTYPES(
void bind_caribouLiteSource(py::module& m);
// ) END BINDING_FUNCTION_PROTOTYPES
// We need this hack because import_array() returns NULL
// for newer Python versions.
// This function is also necessary because it ensures access to the C API
// and removes a warning.
void* init_numpy()
{
import_array();
return NULL;
}
PYBIND11_MODULE(caribouLite_python, m)
{
// Initialize the numpy C API
// (otherwise we will see segmentation faults)
init_numpy();
// Allow access to base block methods
py::module::import("gnuradio.gr");
/**************************************/
// The following comment block is used for
// gr_modtool to insert binding function calls
// Please do not delete
/**************************************/
// BINDING_FUNCTION_CALLS(
bind_caribouLiteSource(m);
// ) END BINDING_FUNCTION_CALLS
}

Wyświetl plik

@ -1,62 +0,0 @@
# Copyright 2011-2021 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
########################################################################
# Setup dependencies
########################################################################
########################################################################
# External dependencies
########################################################################
find_package(cariboulite)
########################################################################
# Register component
########################################################################
include(GrComponent)
GR_REGISTER_COMPONENT("gr-cariboulite" ENABLE_GR_CARIBOULITE
CARIBOULITE_FOUND
ENABLE_GNURADIO_RUNTIME
)
SET(GR_PKG_CARIBOULITE_EXAMPLES_DIR ${GR_PKG_DATA_DIR}/examples/cariboulite)
########################################################################
# Begin conditional configuration
########################################################################
if(ENABLE_GR_CARIBOULITE)
message(STATUS " CariobouLite Version: ${CaribouLite_VERSION}")
########################################################################
# Add subdirectories
########################################################################
add_subdirectory(include/gnuradio/cariboulite)
add_subdirectory(lib)
add_subdirectory(docs)
if(ENABLE_PYTHON)
add_subdirectory(python/cariboulite)
if(ENABLE_EXAMPLES)
add_subdirectory(examples/grc)
endif(ENABLE_EXAMPLES)
endif(ENABLE_PYTHON)
if(ENABLE_GRC)
add_subdirectory(grc)
endif(ENABLE_GRC)
########################################################################
# Create Pkg Config File
########################################################################
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-cariboulite.pc.in
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-cariboulite.pc
@ONLY)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/gnuradio-cariboulite.pc
DESTINATION ${GR_LIBRARY_DIR}/pkgconfig
)
endif(ENABLE_GR_CARIBOULITE)

Wyświetl plik

@ -1,11 +0,0 @@
# Copyright 2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
install(
FILES README.cariboulite
DESTINATION ${GR_PKG_DOC_DIR}
)

Wyświetl plik

@ -1,13 +0,0 @@
This is the gr-cariboulite package. It is interfaces to the CaribouLite
library, which supports driver modules for many types of SDR hardware.
The Python namespace is in gnuradio.cariboulite, which would be normally
imported as:
from gnuradio import cariboulite
See the Doxygen documentation for details about the blocks available
in this package. A quick listing of the details can be found in Python
after importing by using:
help(cariboulite)

Wyświetl plik

@ -1,16 +0,0 @@
# Copyright 2012-2021 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
install(
FILES
fm_radio_receiver_soapy.grc
fm_radio_receiver_soapyremote.grc
soapy_receive2.grc
soapy_receive.grc
soapy_transmit.grc
DESTINATION ${GR_PKG_SOAPY_EXAMPLES_DIR}
)

Wyświetl plik

@ -1,530 +0,0 @@
options:
parameters:
author: ''
catch_exceptions: 'True'
category: '[GRC Hier Blocks]'
cmake_opt: ''
comment: ''
copyright: ''
description: ''
gen_cmake: 'On'
gen_linking: dynamic
generate_options: qt_gui
hier_block_src_path: '.:'
id: fm_radio_receiver_soapy
max_nouts: '0'
output_language: python
placement: (0,0)
qt_qss_theme: ''
realtime_scheduling: ''
run: 'True'
run_command: '{python} -u {filename}'
run_options: prompt
sizing_mode: fixed
thread_safe_setters: ''
title: ''
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [8, 8]
rotation: 0
state: enabled
blocks:
- name: antenna
id: variable
parameters:
comment: ''
value: '"RX"'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [240, 172.0]
rotation: 0
state: enabled
- name: audio_rate
id: variable
parameters:
comment: ''
value: '48000'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [240, 92.0]
rotation: 0
state: enabled
- name: gain
id: variable_qtgui_range
parameters:
comment: ''
gui_hint: 1,3,1,3
label: Gain
min_len: '200'
orient: QtCore.Qt.Horizontal
rangeType: float
start: '0'
step: '2'
stop: '60'
value: '6'
widget: counter_slider
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [784, 8.0]
rotation: 0
state: enabled
- name: radio_freq
id: variable_qtgui_entry
parameters:
comment: ''
gui_hint: 0,0,1,3
label: Center Frequency
type: real
value: 99.5e6
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [368, 16.0]
rotation: 0
state: enabled
- name: samp_rate
id: variable
parameters:
comment: ''
value: 2.5e6
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [240, 12.0]
rotation: 0
state: enabled
- name: vol
id: variable_qtgui_range
parameters:
comment: ''
gui_hint: 0,3,1,3
label: Volume
min_len: '200'
orient: QtCore.Qt.Horizontal
rangeType: float
start: '0'
step: '0.05'
stop: '1.5'
value: '0.3'
widget: counter_slider
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [592, 8.0]
rotation: 0
state: enabled
- name: analog_wfm_rcv_0
id: analog_wfm_rcv
parameters:
affinity: ''
alias: ''
audio_decimation: '2'
comment: Quadrature rate is the input rate
maxoutbuf: '0'
minoutbuf: '0'
quad_rate: audio_rate
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [896, 404.0]
rotation: 180
state: enabled
- name: audio_sink_0
id: audio_sink
parameters:
affinity: ''
alias: ''
comment: ''
device_name: ''
num_inputs: '1'
ok_to_block: 'True'
samp_rate: audio_rate
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [880, 588.0]
rotation: 180
state: enabled
- name: blocks_multiply_const_vxx_0
id: blocks_multiply_const_vxx
parameters:
affinity: ''
alias: ''
comment: ''
const: vol
maxoutbuf: '0'
minoutbuf: '0'
type: float
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [896, 524.0]
rotation: 0
state: enabled
- name: low_pass_filter_0
id: low_pass_filter
parameters:
affinity: ''
alias: ''
beta: '6.76'
comment: ''
cutoff_freq: 60e3
decim: '1'
gain: '1'
interp: '1'
maxoutbuf: '0'
minoutbuf: '0'
samp_rate: samp_rate
type: fir_filter_ccf
width: 10e3
win: window.WIN_HAMMING
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [496, 296.0]
rotation: 0
state: enabled
- name: pfb_arb_resampler_xxx_0
id: pfb_arb_resampler_xxx
parameters:
affinity: ''
alias: ''
atten: '100'
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
nfilts: '32'
rrate: (audio_rate * 2) / samp_rate
samp_delay: '0'
taps: ''
type: ccf
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [792, 276.0]
rotation: 0
state: true
- name: qtgui_freq_sink_x_0
id: qtgui_freq_sink_x
parameters:
affinity: ''
alias: ''
alpha1: '1.0'
alpha10: '1.0'
alpha2: '1.0'
alpha3: '1.0'
alpha4: '1.0'
alpha5: '1.0'
alpha6: '1.0'
alpha7: '1.0'
alpha8: '1.0'
alpha9: '1.0'
autoscale: 'False'
average: '1.0'
axislabels: 'True'
bw: samp_rate
color1: '"blue"'
color10: '"dark blue"'
color2: '"red"'
color3: '"green"'
color4: '"black"'
color5: '"cyan"'
color6: '"magenta"'
color7: '"yellow"'
color8: '"dark red"'
color9: '"dark green"'
comment: ''
ctrlpanel: 'False'
fc: radio_freq
fftsize: '1024'
freqhalf: 'True'
grid: 'False'
gui_hint: 2,0,2,3
label: Relative Gain
label1: ''
label10: ''
label2: ''
label3: ''
label4: ''
label5: ''
label6: ''
label7: ''
label8: ''
label9: ''
legend: 'True'
maxoutbuf: '0'
minoutbuf: '0'
name: '"Input"'
nconnections: '1'
norm_window: 'False'
showports: 'True'
tr_chan: '0'
tr_level: '0.0'
tr_mode: qtgui.TRIG_MODE_FREE
tr_tag: '""'
type: complex
units: dB
update_time: '0.10'
width1: '1'
width10: '1'
width2: '1'
width3: '1'
width4: '1'
width5: '1'
width6: '1'
width7: '1'
width8: '1'
width9: '1'
wintype: window.WIN_BLACKMAN_hARRIS
ymax: '0'
ymin: '-90'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [496, 492.0]
rotation: 0
state: enabled
- name: qtgui_freq_sink_x_1
id: qtgui_freq_sink_x
parameters:
affinity: ''
alias: ''
alpha1: '1.0'
alpha10: '1.0'
alpha2: '1.0'
alpha3: '1.0'
alpha4: '1.0'
alpha5: '1.0'
alpha6: '1.0'
alpha7: '1.0'
alpha8: '1.0'
alpha9: '1.0'
autoscale: 'False'
average: '1.0'
axislabels: 'True'
bw: audio_rate
color1: '"blue"'
color10: '"dark blue"'
color2: '"red"'
color3: '"green"'
color4: '"black"'
color5: '"cyan"'
color6: '"magenta"'
color7: '"yellow"'
color8: '"dark red"'
color9: '"dark green"'
comment: ''
ctrlpanel: 'False'
fc: radio_freq
fftsize: '1024'
freqhalf: 'True'
grid: 'False'
gui_hint: 2,3,2,3
label: Relative Gain
label1: ''
label10: ''
label2: ''
label3: ''
label4: ''
label5: ''
label6: ''
label7: ''
label8: ''
label9: ''
legend: 'True'
maxoutbuf: '0'
minoutbuf: '0'
name: Audio
nconnections: '1'
norm_window: 'False'
showports: 'True'
tr_chan: '0'
tr_level: '0.0'
tr_mode: qtgui.TRIG_MODE_FREE
tr_tag: '""'
type: float
units: dB
update_time: '0.10'
width1: '1'
width10: '1'
width2: '1'
width3: '1'
width4: '1'
width5: '1'
width6: '1'
width7: '1'
width8: '1'
width9: '1'
wintype: window.WIN_BLACKMAN_hARRIS
ymax: '10'
ymin: '-90'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [776, 652.0]
rotation: 180
state: enabled
- name: qtgui_waterfall_sink_x_0
id: qtgui_waterfall_sink_x
parameters:
affinity: ''
alias: ''
alpha1: '1.0'
alpha10: '1.0'
alpha2: '1.0'
alpha3: '1.0'
alpha4: '1.0'
alpha5: '1.0'
alpha6: '1.0'
alpha7: '1.0'
alpha8: '1.0'
alpha9: '1.0'
axislabels: 'True'
bw: samp_rate
color1: '0'
color10: '0'
color2: '0'
color3: '0'
color4: '0'
color5: '0'
color6: '0'
color7: '0'
color8: '0'
color9: '0'
comment: ''
fc: radio_freq
fftsize: '1024'
freqhalf: 'True'
grid: 'False'
gui_hint: 4,0,2,3
int_max: '10'
int_min: '-80'
label1: ''
label10: ''
label2: ''
label3: ''
label4: ''
label5: ''
label6: ''
label7: ''
label8: ''
label9: ''
legend: 'True'
maxoutbuf: '0'
minoutbuf: '0'
name: '""'
nconnections: '1'
showports: 'True'
type: complex
update_time: '0.10'
wintype: window.WIN_BLACKMAN_hARRIS
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [496, 184.0]
rotation: 0
state: enabled
- name: soapy_source_0
id: soapy_source
parameters:
affinity: ''
agc0: 'False'
agc1: 'False'
alias: ''
amp_gain0: '0'
ant0: antenna
ant1: RX2
balance0: '0'
balance1: '0'
bw0: '0'
bw1: '0'
center_freq0: radio_freq
center_freq1: '0'
clock_rate: '0'
clock_source: ''
comment: ''
correction0: '0'
correction1: '0'
dc_offset0: '0'
dc_offset1: '0'
dc_removal0: 'False'
dc_removal1: 'True'
dev: driver=rtlsdr
dev_args: ''
devname: rtlsdr
gain_mode0: Overall
gain_mode1: Overall
ifgr_gain: '59'
lna_gain0: '10'
lna_gain1: '10'
maxoutbuf: '0'
minoutbuf: '0'
mix_gain0: '10'
nchan: '1'
nco_freq0: '0'
nco_freq1: '0'
overall_gain0: gain
overall_gain1: '10'
pga_gain0: '24'
pga_gain1: '24'
rf_gain0: '18'
rfgr_gain: '9'
rxvga1_gain: '5'
rxvga2_gain: '0'
samp_rate: samp_rate
sdrplay_agc_setpoint: '-30'
sdrplay_biastee: 'True'
sdrplay_dabnotch: 'False'
sdrplay_if_mode: Zero-IF
sdrplay_rfnotch: 'False'
settings0: ''
settings1: ''
stream_args: ''
tia_gain0: '0'
tia_gain1: '0'
tune_args0: ''
tune_args1: ''
tuner_gain0: '10'
type: fc32
vga_gain0: '10'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [88, 312.0]
rotation: 0
state: true
connections:
- [analog_wfm_rcv_0, '0', blocks_multiply_const_vxx_0, '0']
- [blocks_multiply_const_vxx_0, '0', audio_sink_0, '0']
- [blocks_multiply_const_vxx_0, '0', qtgui_freq_sink_x_1, '0']
- [low_pass_filter_0, '0', pfb_arb_resampler_xxx_0, '0']
- [pfb_arb_resampler_xxx_0, '0', analog_wfm_rcv_0, '0']
- [soapy_source_0, '0', low_pass_filter_0, '0']
- [soapy_source_0, '0', qtgui_freq_sink_x_0, '0']
- [soapy_source_0, '0', qtgui_waterfall_sink_x_0, '0']
metadata:
file_format: 1

Wyświetl plik

@ -1,532 +0,0 @@
options:
parameters:
author: ''
catch_exceptions: 'True'
category: '[GRC Hier Blocks]'
cmake_opt: ''
comment: ''
copyright: ''
description: ''
gen_cmake: 'On'
gen_linking: dynamic
generate_options: qt_gui
hier_block_src_path: '.:'
id: fm_radio_receiver_soapy
max_nouts: '0'
output_language: python
placement: (0,0)
qt_qss_theme: ''
realtime_scheduling: ''
run: 'True'
run_command: '{python} -u {filename}'
run_options: prompt
sizing_mode: fixed
thread_safe_setters: ''
title: ''
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [8, 8]
rotation: 0
state: enabled
blocks:
- name: antenna
id: variable
parameters:
comment: ''
value: '"RX"'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [368, 12.0]
rotation: 0
state: enabled
- name: audio_rate
id: variable
parameters:
comment: ''
value: '48000'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [240, 92.0]
rotation: 0
state: enabled
- name: gain
id: variable_qtgui_range
parameters:
comment: ''
gui_hint: 1,3,1,3
label: Gain
min_len: '200'
orient: QtCore.Qt.Horizontal
rangeType: float
start: '0'
step: '2'
stop: '60'
value: '6'
widget: counter_slider
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [672, 8.0]
rotation: 0
state: enabled
- name: radio_freq
id: variable_qtgui_entry
parameters:
comment: ''
gui_hint: 0,0,1,3
label: Center Frequency
type: real
value: 95.7e6
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [832, 8.0]
rotation: 0
state: enabled
- name: samp_rate
id: variable
parameters:
comment: ''
value: 2.5e6
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [240, 12.0]
rotation: 0
state: enabled
- name: vol
id: variable_qtgui_range
parameters:
comment: ''
gui_hint: 0,3,1,3
label: Volume
min_len: '200'
orient: QtCore.Qt.Horizontal
rangeType: float
start: '0'
step: '0.05'
stop: '1.5'
value: '0.3'
widget: counter_slider
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [480, 8.0]
rotation: 0
state: enabled
- name: analog_wfm_rcv_0
id: analog_wfm_rcv
parameters:
affinity: ''
alias: ''
audio_decimation: '2'
comment: Quadrature rate is the input rate
maxoutbuf: '0'
minoutbuf: '0'
quad_rate: audio_rate
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [864, 588.0]
rotation: 180
state: enabled
- name: audio_sink_0
id: audio_sink
parameters:
affinity: ''
alias: ''
comment: ''
device_name: ''
num_inputs: '1'
ok_to_block: 'True'
samp_rate: audio_rate
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [536, 660.0]
rotation: 0
state: enabled
- name: blocks_multiply_const_vxx_0
id: blocks_multiply_const_vxx
parameters:
affinity: ''
alias: ''
comment: ''
const: vol
maxoutbuf: '0'
minoutbuf: '0'
type: float
vlen: '1'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [536, 596.0]
rotation: 180
state: enabled
- name: low_pass_filter_0
id: low_pass_filter
parameters:
affinity: ''
alias: ''
beta: '6.76'
comment: ''
cutoff_freq: 60e3
decim: '1'
gain: '1'
interp: '1'
maxoutbuf: '0'
minoutbuf: '0'
samp_rate: samp_rate
type: fir_filter_ccf
width: 10e3
win: window.WIN_HAMMING
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [480, 400.0]
rotation: 0
state: enabled
- name: pfb_arb_resampler_xxx_0
id: pfb_arb_resampler_xxx
parameters:
affinity: ''
alias: ''
atten: '100'
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
nfilts: '32'
rrate: (audio_rate * 2) / samp_rate
samp_delay: '0'
taps: ''
type: ccf
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [784, 404.0]
rotation: 0
state: true
- name: qtgui_freq_sink_x_0
id: qtgui_freq_sink_x
parameters:
affinity: ''
alias: ''
alpha1: '1.0'
alpha10: '1.0'
alpha2: '1.0'
alpha3: '1.0'
alpha4: '1.0'
alpha5: '1.0'
alpha6: '1.0'
alpha7: '1.0'
alpha8: '1.0'
alpha9: '1.0'
autoscale: 'False'
average: '1.0'
axislabels: 'True'
bw: samp_rate
color1: '"blue"'
color10: '"dark blue"'
color2: '"red"'
color3: '"green"'
color4: '"black"'
color5: '"cyan"'
color6: '"magenta"'
color7: '"yellow"'
color8: '"dark red"'
color9: '"dark green"'
comment: ''
ctrlpanel: 'False'
fc: radio_freq
fftsize: '1024'
freqhalf: 'True'
grid: 'False'
gui_hint: 2,0,2,3
label: Relative Gain
label1: ''
label10: ''
label2: ''
label3: ''
label4: ''
label5: ''
label6: ''
label7: ''
label8: ''
label9: ''
legend: 'True'
maxoutbuf: '0'
minoutbuf: '0'
name: '"Input"'
nconnections: '1'
norm_window: 'False'
showports: 'True'
tr_chan: '0'
tr_level: '0.0'
tr_mode: qtgui.TRIG_MODE_FREE
tr_tag: '""'
type: complex
units: dB
update_time: '0.10'
width1: '1'
width10: '1'
width2: '1'
width3: '1'
width4: '1'
width5: '1'
width6: '1'
width7: '1'
width8: '1'
width9: '1'
wintype: window.WIN_BLACKMAN_hARRIS
ymax: '0'
ymin: '-90'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [480, 172.0]
rotation: 0
state: enabled
- name: qtgui_freq_sink_x_1
id: qtgui_freq_sink_x
parameters:
affinity: ''
alias: ''
alpha1: '1.0'
alpha10: '1.0'
alpha2: '1.0'
alpha3: '1.0'
alpha4: '1.0'
alpha5: '1.0'
alpha6: '1.0'
alpha7: '1.0'
alpha8: '1.0'
alpha9: '1.0'
autoscale: 'False'
average: '1.0'
axislabels: 'True'
bw: audio_rate
color1: '"blue"'
color10: '"dark blue"'
color2: '"red"'
color3: '"green"'
color4: '"black"'
color5: '"cyan"'
color6: '"magenta"'
color7: '"yellow"'
color8: '"dark red"'
color9: '"dark green"'
comment: ''
ctrlpanel: 'False'
fc: radio_freq
fftsize: '1024'
freqhalf: 'True'
grid: 'False'
gui_hint: 2,3,2,3
label: Relative Gain
label1: ''
label10: ''
label2: ''
label3: ''
label4: ''
label5: ''
label6: ''
label7: ''
label8: ''
label9: ''
legend: 'True'
maxoutbuf: '0'
minoutbuf: '0'
name: Audio
nconnections: '1'
norm_window: 'False'
showports: 'True'
tr_chan: '0'
tr_level: '0.0'
tr_mode: qtgui.TRIG_MODE_FREE
tr_tag: '""'
type: float
units: dB
update_time: '0.10'
width1: '1'
width10: '1'
width2: '1'
width3: '1'
width4: '1'
width5: '1'
width6: '1'
width7: '1'
width8: '1'
width9: '1'
wintype: window.WIN_BLACKMAN_hARRIS
ymax: '10'
ymin: '-90'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [536, 724.0]
rotation: 0
state: enabled
- name: qtgui_waterfall_sink_x_0
id: qtgui_waterfall_sink_x
parameters:
affinity: ''
alias: ''
alpha1: '1.0'
alpha10: '1.0'
alpha2: '1.0'
alpha3: '1.0'
alpha4: '1.0'
alpha5: '1.0'
alpha6: '1.0'
alpha7: '1.0'
alpha8: '1.0'
alpha9: '1.0'
axislabels: 'True'
bw: samp_rate
color1: '0'
color10: '0'
color2: '0'
color3: '0'
color4: '0'
color5: '0'
color6: '0'
color7: '0'
color8: '0'
color9: '0'
comment: ''
fc: radio_freq
fftsize: '1024'
freqhalf: 'True'
grid: 'False'
gui_hint: 4,0,2,3
int_max: '10'
int_min: '-80'
label1: ''
label10: ''
label2: ''
label3: ''
label4: ''
label5: ''
label6: ''
label7: ''
label8: ''
label9: ''
legend: 'True'
maxoutbuf: '0'
minoutbuf: '0'
name: '""'
nconnections: '1'
showports: 'True'
type: complex
update_time: '0.10'
wintype: window.WIN_BLACKMAN_hARRIS
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [480, 296.0]
rotation: 0
state: enabled
- name: soapy_source_0
id: soapy_source
parameters:
affinity: ''
agc0: 'False'
agc1: 'False'
alias: ''
amp_gain0: '0'
ant0: antenna
ant1: RX2
balance0: '0'
balance1: '0'
bw0: '0'
bw1: '0'
center_freq0: radio_freq
center_freq1: '0'
clock_rate: '0'
clock_source: ''
comment: 'Use SoapySDRServer --bind="0.0.0.0:1234"
or similar to the remote server'
correction0: '0'
correction1: '0'
dc_offset0: '0'
dc_offset1: '0'
dc_removal0: 'True'
dc_removal1: 'True'
dev: driver=remote
dev_args: ''
devname: custom
gain_mode0: Overall
gain_mode1: Overall
ifgr_gain: '59'
lna_gain0: '10'
lna_gain1: '10'
maxoutbuf: '0'
minoutbuf: '0'
mix_gain0: '10'
nchan: '1'
nco_freq0: '0'
nco_freq1: '0'
overall_gain0: gain
overall_gain1: '10'
pga_gain0: '24'
pga_gain1: '24'
rf_gain0: '18'
rfgr_gain: '9'
rxvga1_gain: '5'
rxvga2_gain: '0'
samp_rate: samp_rate
sdrplay_agc_setpoint: '-30'
sdrplay_biastee: 'True'
sdrplay_dabnotch: 'False'
sdrplay_if_mode: Zero-IF
sdrplay_rfnotch: 'False'
settings0: ''
settings1: ''
stream_args: ''
tia_gain0: '0'
tia_gain1: '0'
tune_args0: ''
tune_args1: ''
tuner_gain0: '10'
type: fc32
vga_gain0: '10'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [56, 176.0]
rotation: 0
state: true
connections:
- [analog_wfm_rcv_0, '0', blocks_multiply_const_vxx_0, '0']
- [blocks_multiply_const_vxx_0, '0', audio_sink_0, '0']
- [blocks_multiply_const_vxx_0, '0', qtgui_freq_sink_x_1, '0']
- [low_pass_filter_0, '0', pfb_arb_resampler_xxx_0, '0']
- [pfb_arb_resampler_xxx_0, '0', analog_wfm_rcv_0, '0']
- [soapy_source_0, '0', low_pass_filter_0, '0']
- [soapy_source_0, '0', qtgui_freq_sink_x_0, '0']
- [soapy_source_0, '0', qtgui_waterfall_sink_x_0, '0']
metadata:
file_format: 1

Wyświetl plik

@ -1,310 +0,0 @@
options:
parameters:
author: ''
catch_exceptions: 'True'
category: '[GRC Hier Blocks]'
cmake_opt: ''
comment: ''
copyright: ''
description: ''
gen_cmake: 'On'
gen_linking: dynamic
generate_options: qt_gui
hier_block_src_path: '.:'
id: soapy_rcv
max_nouts: '0'
output_language: python
placement: (0,0)
qt_qss_theme: ''
realtime_scheduling: ''
run: 'True'
run_command: '{python} -u {filename}'
run_options: prompt
sizing_mode: fixed
thread_safe_setters: ''
title: SOAPY Receive Test
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [8, 8]
rotation: 0
state: enabled
blocks:
- name: antenna
id: variable
parameters:
comment: ''
value: '"RX"'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [568, 12.0]
rotation: 0
state: enabled
- name: freq
id: variable
parameters:
comment: ''
value: 99.5e6
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [248, 92.0]
rotation: 0
state: true
- name: gain
id: variable_qtgui_range
parameters:
comment: ''
gui_hint: 0,0,1,1
label: ''
min_len: '200'
orient: QtCore.Qt.Horizontal
rangeType: float
start: '0'
step: '2'
stop: '50'
value: '0'
widget: counter_slider
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [400, 12.0]
rotation: 0
state: true
- name: samp_rate
id: variable
parameters:
comment: ''
value: 2e6
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [248, 12.0]
rotation: 0
state: enabled
- name: qtgui_freq_sink_x_0
id: qtgui_freq_sink_x
parameters:
affinity: ''
alias: ''
alpha1: '1.0'
alpha10: '1.0'
alpha2: '1.0'
alpha3: '1.0'
alpha4: '1.0'
alpha5: '1.0'
alpha6: '1.0'
alpha7: '1.0'
alpha8: '1.0'
alpha9: '1.0'
autoscale: 'False'
average: '1.0'
axislabels: 'True'
bw: samp_rate
color1: '"blue"'
color10: '"dark blue"'
color2: '"red"'
color3: '"green"'
color4: '"black"'
color5: '"cyan"'
color6: '"magenta"'
color7: '"yellow"'
color8: '"dark red"'
color9: '"dark green"'
comment: ''
ctrlpanel: 'False'
fc: freq
fftsize: '1024'
freqhalf: 'True'
grid: 'False'
gui_hint: 1,0,1,1
label: Relative Gain
label1: ''
label10: ''''''
label2: ''''''
label3: ''''''
label4: ''''''
label5: ''''''
label6: ''''''
label7: ''''''
label8: ''''''
label9: ''''''
legend: 'True'
maxoutbuf: '0'
minoutbuf: '0'
name: '""'
nconnections: '1'
norm_window: 'False'
showports: 'False'
tr_chan: '0'
tr_level: '0.0'
tr_mode: qtgui.TRIG_MODE_FREE
tr_tag: '""'
type: complex
units: dB
update_time: '0.10'
width1: '1'
width10: '1'
width2: '1'
width3: '1'
width4: '1'
width5: '1'
width6: '1'
width7: '1'
width8: '1'
width9: '1'
wintype: window.WIN_BLACKMAN_hARRIS
ymax: '0'
ymin: '-100'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [528, 224.0]
rotation: 0
state: true
- name: qtgui_waterfall_sink_x_0
id: qtgui_waterfall_sink_x
parameters:
affinity: ''
alias: ''
alpha1: '1.0'
alpha10: '1.0'
alpha2: '1.0'
alpha3: '1.0'
alpha4: '1.0'
alpha5: '1.0'
alpha6: '1.0'
alpha7: '1.0'
alpha8: '1.0'
alpha9: '1.0'
axislabels: 'True'
bw: samp_rate
color1: '0'
color10: '0'
color2: '0'
color3: '0'
color4: '0'
color5: '0'
color6: '0'
color7: '0'
color8: '0'
color9: '0'
comment: ''
fc: '0'
fftsize: '1024'
freqhalf: 'True'
grid: 'False'
gui_hint: 2,0,1,1
int_max: '-10'
int_min: '-80'
label1: ''
label10: ''
label2: ''
label3: ''
label4: ''
label5: ''
label6: ''
label7: ''
label8: ''
label9: ''
legend: 'True'
maxoutbuf: '0'
minoutbuf: '0'
name: '""'
nconnections: '1'
showports: 'False'
type: complex
update_time: '0.10'
wintype: window.WIN_BLACKMAN_hARRIS
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [528, 352.0]
rotation: 0
state: true
- name: soapy_source_0
id: soapy_source
parameters:
affinity: ''
agc0: 'False'
agc1: 'False'
alias: ''
amp_gain0: '0'
ant0: antenna
ant1: RX2
balance0: '0'
balance1: '0'
bw0: '0'
bw1: '0'
center_freq0: freq
center_freq1: '0'
clock_rate: '0'
clock_source: ''
comment: ''
correction0: '0'
correction1: '0'
dc_offset0: '0'
dc_offset1: '0'
dc_removal0: 'False'
dc_removal1: 'True'
dev: driver=rtlsdr
dev_args: ''
devname: rtlsdr
gain_mode0: Overall
gain_mode1: Overall
ifgr_gain: '59'
lna_gain0: '10'
lna_gain1: '10'
maxoutbuf: '0'
minoutbuf: '0'
mix_gain0: '10'
nchan: '1'
nco_freq0: '0'
nco_freq1: '0'
overall_gain0: gain
overall_gain1: '10'
pga_gain0: '24'
pga_gain1: '24'
rf_gain0: '18'
rfgr_gain: '9'
rxvga1_gain: '5'
rxvga2_gain: '0'
samp_rate: samp_rate
sdrplay_agc_setpoint: '-30'
sdrplay_biastee: 'True'
sdrplay_dabnotch: 'False'
sdrplay_if_mode: Zero-IF
sdrplay_rfnotch: 'False'
settings0: ''
settings1: ''
stream_args: ''
tia_gain0: '0'
tia_gain1: '0'
tune_args0: ''
tune_args1: ''
tuner_gain0: '10'
type: fc32
vga_gain0: '10'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [112, 228.0]
rotation: 0
state: true
connections:
- [soapy_source_0, '0', qtgui_freq_sink_x_0, '0']
- [soapy_source_0, '0', qtgui_waterfall_sink_x_0, '0']
metadata:
file_format: 1

Wyświetl plik

@ -1,352 +0,0 @@
options:
parameters:
author: ''
catch_exceptions: 'True'
category: '[GRC Hier Blocks]'
cmake_opt: ''
comment: ''
copyright: ''
description: ''
gen_cmake: 'On'
gen_linking: dynamic
generate_options: qt_gui
hier_block_src_path: '.:'
id: soapy_rcv2
max_nouts: '0'
output_language: python
placement: (0,0)
qt_qss_theme: ''
realtime_scheduling: ''
run: 'True'
run_command: '{python} -u {filename}'
run_options: prompt
sizing_mode: fixed
thread_safe_setters: ''
title: SOAPY Receive Test
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [8, 8]
rotation: 0
state: enabled
blocks:
- name: antenna
id: variable
parameters:
comment: ''
value: '"RX"'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [240, 172.0]
rotation: 0
state: enabled
- name: freq
id: variable
parameters:
comment: ''
value: 905e6
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [240, 92.0]
rotation: 0
state: true
- name: lna
id: variable_qtgui_range
parameters:
comment: ''
gui_hint: ''
label: VGA Gain
min_len: '200'
orient: QtCore.Qt.Horizontal
rangeType: float
start: '0'
step: '0.5'
stop: '50'
value: '0'
widget: counter_slider
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [368, 12.0]
rotation: 0
state: true
- name: mix
id: variable_qtgui_range
parameters:
comment: ''
gui_hint: ''
label: MIX Gain
min_len: '200'
orient: QtCore.Qt.Horizontal
rangeType: float
start: '0'
step: '0.5'
stop: '50'
value: '0'
widget: counter_slider
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [528, 16.0]
rotation: 0
state: true
- name: samp_rate
id: variable
parameters:
comment: ''
value: 2.5e6
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [240, 12.0]
rotation: 0
state: enabled
- name: vga
id: variable_qtgui_range
parameters:
comment: ''
gui_hint: ''
label: VGA Gain
min_len: '200'
orient: QtCore.Qt.Horizontal
rangeType: float
start: '0'
step: '0.5'
stop: '50'
value: '0'
widget: counter_slider
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [688, 24.0]
rotation: 0
state: true
- name: qtgui_freq_sink_x_0
id: qtgui_freq_sink_x
parameters:
affinity: ''
alias: ''
alpha1: '1.0'
alpha10: '1.0'
alpha2: '1.0'
alpha3: '1.0'
alpha4: '1.0'
alpha5: '1.0'
alpha6: '1.0'
alpha7: '1.0'
alpha8: '1.0'
alpha9: '1.0'
autoscale: 'False'
average: '1.0'
axislabels: 'True'
bw: samp_rate
color1: '"blue"'
color10: '"dark blue"'
color2: '"red"'
color3: '"green"'
color4: '"black"'
color5: '"cyan"'
color6: '"magenta"'
color7: '"yellow"'
color8: '"dark red"'
color9: '"dark green"'
comment: ''
ctrlpanel: 'False'
fc: freq
fftsize: '1024'
freqhalf: 'True'
grid: 'False'
gui_hint: 1,0,1,2
label: Relative Gain
label1: ''
label10: ''''''
label2: ''''''
label3: ''''''
label4: ''''''
label5: ''''''
label6: ''''''
label7: ''''''
label8: ''''''
label9: ''''''
legend: 'True'
maxoutbuf: '0'
minoutbuf: '0'
name: '""'
nconnections: '1'
norm_window: 'False'
showports: 'False'
tr_chan: '0'
tr_level: '0.0'
tr_mode: qtgui.TRIG_MODE_FREE
tr_tag: '""'
type: complex
units: dB
update_time: '0.10'
width1: '1'
width10: '1'
width2: '1'
width3: '1'
width4: '1'
width5: '1'
width6: '1'
width7: '1'
width8: '1'
width9: '1'
wintype: window.WIN_BLACKMAN_hARRIS
ymax: '0'
ymin: '-100'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [480, 248.0]
rotation: 0
state: true
- name: qtgui_waterfall_sink_x_0
id: qtgui_waterfall_sink_x
parameters:
affinity: ''
alias: ''
alpha1: '1.0'
alpha10: '1.0'
alpha2: '1.0'
alpha3: '1.0'
alpha4: '1.0'
alpha5: '1.0'
alpha6: '1.0'
alpha7: '1.0'
alpha8: '1.0'
alpha9: '1.0'
axislabels: 'True'
bw: samp_rate
color1: '0'
color10: '0'
color2: '0'
color3: '0'
color4: '0'
color5: '0'
color6: '0'
color7: '0'
color8: '0'
color9: '0'
comment: ''
fc: freq
fftsize: '1024'
freqhalf: 'True'
grid: 'False'
gui_hint: 2,0,1,2
int_max: '-10'
int_min: '-80'
label1: ''
label10: ''
label2: ''
label3: ''
label4: ''
label5: ''
label6: ''
label7: ''
label8: ''
label9: ''
legend: 'True'
maxoutbuf: '0'
minoutbuf: '0'
name: '""'
nconnections: '1'
showports: 'False'
type: complex
update_time: '0.10'
wintype: window.WIN_BLACKMAN_hARRIS
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [480, 360.0]
rotation: 0
state: true
- name: soapy_source_0
id: soapy_source
parameters:
affinity: ''
agc0: 'False'
agc1: 'False'
alias: ''
amp_gain0: '0'
ant0: antenna
ant1: RX2
balance0: '0'
balance1: '0'
bw0: '0'
bw1: '0'
center_freq0: freq
center_freq1: '0'
clock_rate: '0'
clock_source: ''
comment: ''
correction0: '0'
correction1: '0'
dc_offset0: '0'
dc_offset1: '0'
dc_removal0: 'True'
dc_removal1: 'True'
dev: driver=rtlsdr
dev_args: ''
devname: airspy
gain_mode0: Overall
gain_mode1: Overall
ifgr_gain: '59'
lna_gain0: lna
lna_gain1: '10'
maxoutbuf: '0'
minoutbuf: '0'
mix_gain0: mix
nchan: '1'
nco_freq0: '0'
nco_freq1: '0'
overall_gain0: '0'
overall_gain1: '10'
pga_gain0: '24'
pga_gain1: '24'
rf_gain0: '18'
rfgr_gain: '9'
rxvga1_gain: '5'
rxvga2_gain: '0'
samp_rate: samp_rate
sdrplay_agc_setpoint: '-30'
sdrplay_biastee: 'True'
sdrplay_dabnotch: 'False'
sdrplay_if_mode: Zero-IF
sdrplay_rfnotch: 'False'
settings0: ''
settings1: ''
stream_args: ''
tia_gain0: '0'
tia_gain1: '0'
tune_args0: ''
tune_args1: ''
tuner_gain0: '10'
type: fc32
vga_gain0: vga
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [96, 264.0]
rotation: 0
state: true
connections:
- [soapy_source_0, '0', qtgui_freq_sink_x_0, '0']
- [soapy_source_0, '0', qtgui_waterfall_sink_x_0, '0']
metadata:
file_format: 1

Wyświetl plik

@ -1,339 +0,0 @@
options:
parameters:
author: ''
catch_exceptions: 'True'
category: '[GRC Hier Blocks]'
cmake_opt: ''
comment: ''
copyright: ''
description: ''
gen_cmake: 'On'
gen_linking: dynamic
generate_options: qt_gui
hier_block_src_path: '.:'
id: soapy_xmit
max_nouts: '0'
output_language: python
placement: (0,0)
qt_qss_theme: ''
realtime_scheduling: ''
run: 'True'
run_command: '{python} -u {filename}'
run_options: prompt
sizing_mode: fixed
thread_safe_setters: ''
title: Soapy Test Transmit
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [8, 8]
rotation: 0
state: enabled
blocks:
- name: freq
id: variable
parameters:
comment: ''
value: 905e6
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [248, 92.0]
rotation: 0
state: enabled
- name: gain
id: variable_qtgui_range
parameters:
comment: ''
gui_hint: 0,0,1,1
label: ''
min_len: '200'
orient: QtCore.Qt.Horizontal
rangeType: float
start: '0'
step: '2'
stop: '80'
value: '40'
widget: counter_slider
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [384, 12.0]
rotation: 0
state: true
- name: samp_rate
id: variable
parameters:
comment: ''
value: 500e3
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [248, 12.0]
rotation: 0
state: enabled
- name: xmit_rate
id: variable
parameters:
comment: ''
value: 2e6
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [248, 172.0]
rotation: 0
state: enabled
- name: analog_sig_source_x_0
id: analog_sig_source_x
parameters:
affinity: ''
alias: ''
amp: '1'
comment: ''
freq: '1000'
maxoutbuf: '0'
minoutbuf: '0'
offset: '0'
phase: '0'
samp_rate: samp_rate
type: complex
waveform: analog.GR_COS_WAVE
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [80, 264.0]
rotation: 0
state: true
- name: pfb_arb_resampler_xxx_0
id: pfb_arb_resampler_xxx
parameters:
affinity: ''
alias: ''
atten: '100'
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
nfilts: '32'
rrate: xmit_rate / samp_rate
samp_delay: '0'
taps: ''
type: ccf
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [392, 244.0]
rotation: 0
state: true
- name: qtgui_freq_sink_x_0
id: qtgui_freq_sink_x
parameters:
affinity: ''
alias: ''
alpha1: '1.0'
alpha10: '1.0'
alpha2: '1.0'
alpha3: '1.0'
alpha4: '1.0'
alpha5: '1.0'
alpha6: '1.0'
alpha7: '1.0'
alpha8: '1.0'
alpha9: '1.0'
autoscale: 'False'
average: '1.0'
axislabels: 'True'
bw: xmit_rate
color1: '"blue"'
color10: '"dark blue"'
color2: '"red"'
color3: '"green"'
color4: '"black"'
color5: '"cyan"'
color6: '"magenta"'
color7: '"yellow"'
color8: '"dark red"'
color9: '"dark green"'
comment: ''
ctrlpanel: 'False'
fc: freq
fftsize: '1024'
freqhalf: 'True'
grid: 'False'
gui_hint: 1,0,1,2
label: Relative Gain
label1: ''
label10: ''''''
label2: ''''''
label3: ''''''
label4: ''''''
label5: ''''''
label6: ''''''
label7: ''''''
label8: ''''''
label9: ''''''
legend: 'True'
maxoutbuf: '0'
minoutbuf: '0'
name: '""'
nconnections: '1'
norm_window: 'False'
showports: 'False'
tr_chan: '0'
tr_level: '0.0'
tr_mode: qtgui.TRIG_MODE_FREE
tr_tag: '""'
type: complex
units: dB
update_time: '0.10'
width1: '1'
width10: '1'
width2: '1'
width3: '1'
width4: '1'
width5: '1'
width6: '1'
width7: '1'
width8: '1'
width9: '1'
wintype: window.WIN_BLACKMAN_hARRIS
ymax: '0'
ymin: '-100'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [824, 312.0]
rotation: 0
state: true
- name: qtgui_waterfall_sink_x_0
id: qtgui_waterfall_sink_x
parameters:
affinity: ''
alias: ''
alpha1: '1.0'
alpha10: '1.0'
alpha2: '1.0'
alpha3: '1.0'
alpha4: '1.0'
alpha5: '1.0'
alpha6: '1.0'
alpha7: '1.0'
alpha8: '1.0'
alpha9: '1.0'
axislabels: 'True'
bw: xmit_rate
color1: '0'
color10: '0'
color2: '0'
color3: '0'
color4: '0'
color5: '0'
color6: '0'
color7: '0'
color8: '0'
color9: '0'
comment: ''
fc: freq
fftsize: '1024'
freqhalf: 'True'
grid: 'False'
gui_hint: 2,0,1,2
int_max: '-10'
int_min: '-80'
label1: ''
label10: ''
label2: ''
label3: ''
label4: ''
label5: ''
label6: ''
label7: ''
label8: ''
label9: ''
legend: 'True'
maxoutbuf: '0'
minoutbuf: '0'
name: '""'
nconnections: '1'
showports: 'False'
type: complex
update_time: '0.10'
wintype: window.WIN_BLACKMAN_hARRIS
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [824, 416.0]
rotation: 0
state: true
- name: soapy_sink_0
id: soapy_sink
parameters:
affinity: ''
alias: ''
amp_gain0: '0'
ant0: TX/RX
ant1: ''
args: ''
balance0: '0'
balance1: '0'
bw0: '0'
bw1: '0'
center_freq0: freq
center_freq1: 100.0e6
clock_rate: '0'
clock_source: ''
comment: ''
correction0: '0'
correction1: '0'
dc_offset0: '0'
dc_offset1: '0'
dc_offset_auto_mode0: 'False'
dc_offset_auto_mode1: 'False'
dev: driver=uhd
devname: uhd
gain_auto_mode0: 'False'
gain_auto_mode1: 'False'
iamp_gain0: '0'
iamp_gain1: '0'
length_tag_name: ''
manual_gain0: 'True'
manual_gain1: 'True'
nchan: '1'
nco_freq0: '0'
nco_freq1: '0'
overall_gain0: gain
overall_gain1: '0'
pad_gain0: '0'
pad_gain1: '0'
pga_gain0: gain
pga_gain1: '0'
samp_rate: xmit_rate
txvga1_gain: '-35'
txvga2_gain: '0'
type: fc32
vga_gain0: '10'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [824, 136.0]
rotation: 0
state: true
connections:
- [analog_sig_source_x_0, '0', pfb_arb_resampler_xxx_0, '0']
- [pfb_arb_resampler_xxx_0, '0', qtgui_freq_sink_x_0, '0']
- [pfb_arb_resampler_xxx_0, '0', qtgui_waterfall_sink_x_0, '0']
- [pfb_arb_resampler_xxx_0, '0', soapy_sink_0, '0']
metadata:
file_format: 1

Wyświetl plik

@ -1,11 +0,0 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: gnuradio-cariboulite
Description: GNU Radio blocks for CaribouLite
Requires: gnuradio-runtime
Version: @LIBVER@
Libs: -L${libdir} -lgnuradio-cariboulite
Cflags: -I${includedir}

Wyświetl plik

@ -1,14 +0,0 @@
# Copyright 2021 Free Software Foundation, Inc.
#
# This file was generated by gr_modtool, a tool from the GNU Radio framework
# This file is a part of gr-cariboulite
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
install(FILES
cariboulite.tree.yml
cariboulite_source.block.yml
cariboulite_sink.block.yml
DESTINATION share/gnuradio/grc/blocks
)

Wyświetl plik

@ -1,6 +0,0 @@
'[Core]':
- CaribouLite:
- Source:
- cariboulite_source
- Sink:
- cariboulite_sink

Wyświetl plik

@ -1,84 +0,0 @@
id: soapy_hackrf_sink
label: Soapy HackRF Sink
flags: [python, throttle]
parameters:
- id: type
label: Input Type
dtype: enum
options: [fc32, sc16, sc8]
option_labels: [Complex Float32, Complex Int16, Complex Byte]
option_attributes:
type: [fc32, sc16, sc8]
hide: part
- id: dev_args
label: Device arguments
dtype: string
hide: ${'part' if not dev_args else 'none'}
- id: samp_rate
label: Sample Rate
dtype: float
default: 'samp_rate'
- id: bandwidth
label: Bandwidth (0=auto)
category: RF Options
dtype: float
default: '0'
hide: part
- id: center_freq
label: 'Center Freq (Hz)'
category: RF Options
dtype: real
default: 'freq'
- id: amp
label: 'Amp On (+14 dB)'
category: RF Options
dtype: bool
default: 'False'
hide: part
- id: vga
label: VGA Gain (0dB - 47dB)'
category: RF Options
dtype: real
default: '16'
hide: part
inputs:
- domain: stream
dtype: ${ type.type }
multiplicity: 1
- domain: message
id: cmd
optional: true
templates:
imports: from gnuradio import soapy
make: |
None
dev = 'driver=hackrf'
stream_args = ''
tune_args = ['']
settings = ['']
self.${id} = soapy.sink(dev, "${type}", 1, ${dev_args},
stream_args, tune_args, settings)
self.${id}.set_sample_rate(0, ${samp_rate})
self.${id}.set_bandwidth(0, ${bandwidth})
self.${id}.set_frequency(0, ${center_freq})
self.${id}.set_gain(0, 'AMP', ${amp})
self.${id}.set_gain(0, 'VGA', min(max(${vga}, 0.0), 47.0))
callbacks:
- set_sample_rate(0, ${samp_rate})
- set_bandwidth(0, ${bandwidth})
- set_frequency(0, ${center_freq})
- set_gain(0, 'AMP', ${amp})
- set_gain(0, 'VGA', min(max(${vga}, 0.0), 47.0))
file_format: 1

Wyświetl plik

@ -1,94 +0,0 @@
id: cariboulite_source
label: CaribouLite Source
flags: [python, throttle]
parameters:
- id: type
label: Output Type
dtype: enum
options: [fc32, sc16, sc8]
option_labels: [Complex Float32, Complex Int16, Complex Byte]
option_attributes:
type: [fc32, sc16, sc8]
hide: part
- id: dev_args
label: Device arguments
dtype: string
hide: ${'part' if not dev_args else 'none'}
- id: samp_rate
label: Sample Rate
dtype: float
default: 'samp_rate'
- id: bandwidth
label: Bandwidth (0=auto)
category: RF Options
dtype: float
default: '0'
hide: part
- id: center_freq
label: 'Center Freq (Hz)'
category: RF Options
dtype: real
default: 'freq'
- id: amp
label: 'Amp On (+14 dB)'
category: RF Options
dtype: bool
default: 'False'
hide: part
- id: gain
label: 'IF Gain (0dB - 40dB)'
category: RF Options
dtype: real
default: '16'
hide: part
- id: vga
label: VGA Gain (0dB - 62dB)'
category: RF Options
dtype: real
default: '16'
hide: part
inputs:
- domain: message
id: cmd
optional: true
outputs:
- domain: stream
dtype: ${ type.type }
multiplicity: 1
templates:
imports: from gnuradio import soapy
make: |
None
dev = 'driver=hackrf'
stream_args = ''
tune_args = ['']
settings = ['']
self.${id} = soapy.source(dev, "${type}", 1, ${dev_args},
stream_args, tune_args, settings)
self.${id}.set_sample_rate(0, ${samp_rate})
self.${id}.set_bandwidth(0, ${bandwidth})
self.${id}.set_frequency(0, ${center_freq})
self.${id}.set_gain(0, 'AMP', ${amp})
self.${id}.set_gain(0, 'LNA', min(max(${gain}, 0.0), 40.0))
self.${id}.set_gain(0, 'VGA', min(max(${vga}, 0.0), 62.0))
callbacks:
- set_sample_rate(0, ${samp_rate})
- set_bandwidth(0, ${bandwidth})
- set_frequency(0, ${center_freq})
- set_gain(0, 'AMP', ${amp})
- set_gain(0, 'LNA', min(max(${gain}, 0.0), 40.0))
- set_gain(0, 'VGA', min(max(${vga}, 0.0), 62.0))
file_format: 1

Wyświetl plik

@ -1,729 +0,0 @@
/* -*- c++ -*- */
/*
* Copyright 2021 Jeff Long
* Copyright 2018-2021 Libre Space Foundation <http://libre.space/>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#ifndef INCLUDED_GR_SOAPY_BLOCK_H
#define INCLUDED_GR_SOAPY_BLOCK_H
#include <gnuradio/block.h>
#include <gnuradio/cariboulite/api.h>
#include <gnuradio/cariboulite/cariboulite_types.h>
#include <cstdint>
#include <string>
#include <vector>
namespace gr {
namespace cariboulite {
class CARIBOULITE_API block : virtual public gr::block
{
public:
/*!
* A key that uniquely identifies the device driver.
* This key identifies the underlying implementation.
* Several variants of a product may share a driver.
*/
virtual std::string get_driver_key() const = 0;
/*!
* A key that uniquely identifies the hardware.
* This key should be meaningful to the user
* to optimize for the underlying hardware.
*/
virtual std::string get_hardware_key() const = 0;
/*!
* Query a dictionary of available device information.
* This dictionary can any number of values like
* vendor name, product name, revisions, serials...
* This information can be displayed to the user
* to help identify the instantiated device.
*/
virtual kwargs_t get_hardware_info() const = 0;
/*!
* Set the frontend mapping of available DSP units to RF frontends.
* This mapping controls channel mapping and channel availability.
* \param frontend_mapping a vendor-specific mapping string
*/
virtual void set_frontend_mapping(const std::string& frontend_mapping) = 0;
/*!
* Get the frontend mapping of available DSP units to RF frontends.
* This mapping describes channel mapping and channel availability.
* \return a vendor-specific mapping string
*/
virtual std::string get_frontend_mapping() const = 0;
/*!
* Query a dictionary of available channel information.
* This dictionary can any number of values like
* decoder type, version, available functions...
* This information can be displayed to the user
* to help identify the instantiated channel.
* \param channel an available channel on the device
* \return channel information
*/
virtual kwargs_t get_channel_info(size_t channel) const = 0;
/*!
* Set sample rate
* \param channel an available channel
* \param sample_rate samples per second
*/
virtual void set_sample_rate(size_t channel, double sample_rate) = 0;
/*!
* Get the baseband sample rate of the RX chain.
* \param channel an available channel on the device
* \return the sample rate in samples per second
*/
virtual double get_sample_rate(size_t channel) const = 0;
/*!
* Get the range of possible baseband sample rates.
* \param channel an available channel on the device
* \return a list of sample rate ranges in samples per second
*/
virtual range_list_t get_sample_rate_range(size_t channel) const = 0;
/*!
* Set device center frequency
* \param channel an available channel
* \param freq frequency in Hz
*/
virtual void set_frequency(size_t channel, double freq) = 0;
/*!
* Set center frequency of a tunable element
* \param channel an available channel
* \param name an available element name
* \param freq frequency in Hz
*/
virtual void set_frequency(size_t channel, const std::string& name, double freq) = 0;
/*!
* Get the down conversion frequency of the chain.
* \param channel an available channel on the device
* \return the center frequency in Hz
*/
virtual double get_frequency(size_t channel) const = 0;
/*!
* Get the frequency of a tunable element in the chain.
* \param channel an available channel on the device
* \param name the name of a tunable element
* \return the tunable element's frequency in Hz
*/
virtual double get_frequency(size_t channel, const std::string& name) const = 0;
/*!
* List available tunable elements in the chain.
* Elements should be in order RF to baseband.
* \param channel an available channel
* \return a list of tunable elements by name
*/
virtual std::vector<std::string> list_frequencies(size_t channel) const = 0;
/*!
* Get the range of overall frequency values.
* \param channel an available channel on the device
* \return a list of frequency ranges in Hz
*/
virtual range_list_t get_frequency_range(size_t channel) const = 0;
/*!
* Get the range of tunable values for the specified element.
* \param channel an available channel on the device
* \param name the name of a tunable element
* \return a list of frequency ranges in Hz
*/
virtual range_list_t get_frequency_range(size_t channel,
const std::string& name) const = 0;
/*!
* Query the argument info description for stream args.
* \param channel an available channel on the device
* \return a list of argument info structures
*/
virtual arginfo_list_t get_frequency_args_info(size_t channel) const = 0;
/*!
* Set filter bandwidth
* \param channel an available channel
* \param bandwidth filter width in Hz
*/
virtual void set_bandwidth(size_t channel, double bandwidth) = 0;
/*!
* Get baseband filter width of the RX chain.
* \param channel an available channel on the device
* \return the baseband filter width in Hz
*/
virtual double get_bandwidth(size_t channel) const = 0;
/*!
* Get the range of possible baseband filter widths.
* \param channel an available channel on the device
* \return a list of bandwidth ranges in Hz
*/
virtual range_list_t get_bandwidth_range(size_t channel) const = 0;
/*!
* List available antennas for a channel
* @param channel channel index
* @return available antenna names
*/
virtual std::vector<std::string> list_antennas(int channel) const = 0;
/*!
* Set antenna for channel
* \param channel an available channel
* \param name an available antenna string name
*/
virtual void set_antenna(size_t channel, const std::string& name) = 0;
/*!
* Get the selected antenna on RX chain.
* \param channel an available channel on the device
* \return the name of the selected antenna
*/
virtual std::string get_antenna(size_t channel) const = 0;
/*!
* Return whether automatic gain control (AGC) is supported
* \param channel an available channel
*/
virtual bool has_gain_mode(size_t channel) const = 0;
/*!
* Set automatic gain control (AGC)
* \param channel an available channel
* \param enable true to enable AGC
*/
virtual void set_gain_mode(size_t channel, bool enable) = 0;
/*!
* Get the automatic gain mode on the RX chain.
* \param channel an available channel on the device
* \return true for automatic gain setting
*/
virtual bool get_gain_mode(size_t channel) const = 0;
/*!
* List available amplification elements.
* Elements should be in order RF to baseband.
* \param channel an available channel
* \return a list of gain string names
*/
virtual std::vector<std::string> list_gains(size_t channel) const = 0;
/*!
* Set overall gain
* The gain will be distributed automatically across available
* elements according to Soapy API.
* \param channel an available channel
* \param gain overall gain value
*/
virtual void set_gain(size_t channel, double gain) = 0;
/*!
* Set specific gain value
* \param channel an available channel
* \param name gain name to set
* \param gain gain value
*/
virtual void set_gain(size_t channel, const std::string& name, double gain) = 0;
/*!
* Get the overall value of the gain elements in a chain
* \param channel an available channel on the device
* \return the value of the gain in dB
*/
virtual double get_gain(size_t channel) const = 0;
/*!
* Get the value of an individual amplification element in a chain.
* \param channel an available channel on the device
* \param name the name of an amplification element
* \return the value of the gain in dB
*/
virtual double get_gain(size_t channel, const std::string& name) const = 0;
/*!
* Get the overall range of possible gain values.
* \param channel an available channel on the device
* \return a list of gain ranges in dB
*/
virtual range_t get_gain_range(size_t channel) const = 0;
/*!
* Get the range of possible gain values for a specific element.
* \param channel an available channel on the device
* \param name the name of an amplification element
* \return a list of gain ranges in dB
*/
virtual range_t get_gain_range(size_t channel, const std::string& name) const = 0;
/*!
* Return whether frequency correction is supported
* \param channel an available channel
*/
virtual bool has_frequency_correction(size_t channel) const = 0;
/*!
* Set frequency correction
* \param channel an available channel
* \param freq_correction in PPM
*/
virtual void set_frequency_correction(size_t channel, double freq_correction) = 0;
/*!
* Get the frequency correction value.
* \param channel an available channel on the device
* \return the correction value in PPM
*/
virtual double get_frequency_correction(size_t channel) const = 0;
/*!
* Return whether DC offset mode can be set
* \param channel an available channel
*/
virtual bool has_dc_offset_mode(size_t channel) const = 0;
/*!
* Set DC offset mode
* \param channel an available channel
* \param automatic true to set automatic DC removal
*/
virtual void set_dc_offset_mode(size_t channel, bool automatic) = 0;
/*!
* Get the automatic DC offset correction mode.
* \param channel an available channel on the device
* \return true for automatic offset correction
*/
virtual bool get_dc_offset_mode(size_t channel) const = 0;
/*!
* Return whether manual dc offset correction is supported
* \param channel an available channel
*/
virtual bool has_dc_offset(size_t channel) const = 0;
/*!
* Set dc offset correction
* \param channel an available channel
* \param dc_offset complex dc offset correction
*/
virtual void set_dc_offset(size_t channel, const gr_complexd& dc_offset) = 0;
/*!
* Get the DC offset correction.
* \param channel an available channel on the device
* \return the relative correction (1.0 max)
*/
virtual gr_complexd get_dc_offset(size_t channel) const = 0;
/*!
* Return whether manual IQ balance correction is supported
* \param channel an available channel
*/
virtual bool has_iq_balance(size_t channel) const = 0;
/*!
* Set IQ balance correction
* \param channel an available channel
* \param iq_balance complex iq balance correction
*/
virtual void set_iq_balance(size_t channel, const gr_complexd& iq_balance) = 0;
/*!
* Get the IQ balance correction.
* \param channel an available channel on the device
* \return the relative correction (1.0 max)
*/
virtual gr_complexd get_iq_balance(size_t channel) const = 0;
/*!
* Does the device support automatic frontend IQ balance correction?
* \param channel an available channel on the device
* \return true if IQ balance corrections are supported
*/
virtual bool has_iq_balance_mode(size_t channel) const = 0;
/*!
* Set the automatic frontend IQ balance correction.
* \param channel an available channel on the device
* \param automatic true for automatic correction
*/
virtual void set_iq_balance_mode(size_t channel, bool automatic) = 0;
/*!
* Get the automatic IQ balance corrections mode.
* \param channel an available channel on the device
* \return true for automatic correction
*/
virtual bool get_iq_balance_mode(size_t channel) const = 0;
/*!
* Set master clock rate
* \param clock_rate clock rate in Hz
*/
virtual void set_master_clock_rate(double clock_rate) = 0;
/*!
* Get the master clock rate of the device.
* \return the clock rate in Hz
*/
virtual double get_master_clock_rate() const = 0;
/*!
* Get the range of available master clock rates.
* \return a list of clock rate ranges in Hz
*/
virtual range_list_t get_master_clock_rates() const = 0;
/*!
* Set the reference clock rate of the device.
* \param rate the clock rate in Hz
*/
virtual void set_reference_clock_rate(double rate) = 0;
/*!
* Get the reference clock rate of the device.
* \return the clock rate in Hz
*/
virtual double get_reference_clock_rate() const = 0;
/*!
* Get the range of available reference clock rates.
* \return a list of clock rate ranges in Hz
*/
virtual range_list_t get_reference_clock_rates() const = 0;
/*!
* Get the list of available clock sources.
* \return a list of clock source names
*/
virtual std::vector<std::string> list_clock_sources() const = 0;
/*!
* Set the clock source
* \param clock_source an available clock source
*/
virtual void set_clock_source(const std::string& clock_source) = 0;
/*!
* Get the clock source of the device
* \return the name of the clock source
*/
virtual std::string get_clock_source() const = 0;
/*!
* Get the list of available time sources.
* \return a list of time source names
*/
virtual std::vector<std::string> list_time_sources() const = 0;
/*!
* Set the time source on the device
* \param source the name of a time source
*/
virtual void set_time_source(const std::string& source) = 0;
/*!
* Get the time source of the device
* \return the name of a time source
*/
virtual std::string get_time_source() const = 0;
/*!
* Does this device have a hardware clock?
* \param what optional argument
* \return true if the hardware clock exists
*/
virtual bool has_hardware_time(const std::string& what = "") const = 0;
/*!
* Read the time from the hardware clock on the device.
* The what argument can refer to a specific time counter.
* \param what optional argument
* \return the time in nanoseconds
*/
virtual long long get_hardware_time(const std::string& what = "") const = 0;
/*!
* Write the time to the hardware clock on the device.
* The what argument can refer to a specific time counter.
* \param timeNs time in nanoseconds
* \param what optional argument
*/
virtual void set_hardware_time(long long timeNs, const std::string& what = "") = 0;
/*!
* List the available global readback sensors.
* A sensor can represent a reference lock, RSSI, temperature.
* \return a list of available sensor string names
*/
virtual std::vector<std::string> list_sensors() const = 0;
/*!
* Get meta-information about a sensor.
* Example: displayable name, type, range.
* \param key the ID name of an available sensor
* \return meta-information about a sensor
*/
virtual arginfo_t get_sensor_info(const std::string& key) const = 0;
/*!
* Readback a global sensor given the name.
* The value returned is a string which can represent
* a boolean ("true"/"false"), an integer, or float.
* \param key the ID name of an available sensor
* \return the current value of the sensor
*/
virtual std::string read_sensor(const std::string& key) const = 0;
/*!
* List the available channel readback sensors.
* A sensor can represent a reference lock, RSSI, temperature.
* \param channel an available channel on the device
* \return a list of available sensor string names
*/
virtual std::vector<std::string> list_sensors(size_t channel) const = 0;
/*!
* Get meta-information about a channel sensor.
* Example: displayable name, type, range.
* \param channel an available channel on the device
* \param key the ID name of an available sensor
* \return meta-information about a sensor
*/
virtual arginfo_t get_sensor_info(size_t channel, const std::string& key) const = 0;
/*!
* Readback a channel sensor given the name.
* The value returned is a string which can represent
* a boolean ("true"/"false"), an integer, or float.
* \param channel an available channel on the device
* \param key the ID name of an available sensor
* \return the current value of the sensor
*/
virtual std::string read_sensor(size_t channel, const std::string& key) const = 0;
/*!
* Get a list of available register interfaces by name.
* \return a list of available register interfaces
*/
virtual std::vector<std::string> list_register_interfaces() const = 0;
/*!
* Write a register on the device given the interface name.
* This can represent a register on a soft CPU, FPGA, IC;
* the interpretation is up the implementation to decide.
* \param name the name of a available register interface
* \param addr the register address
* \param value the register value
*/
virtual void
write_register(const std::string& name, unsigned addr, unsigned value) = 0;
/*!
* Read a register on the device given the interface name.
* \param name the name of a available register interface
* \param addr the register address
* \return the register value
*/
virtual unsigned read_register(const std::string& name, unsigned addr) const = 0;
/*!
* Write a memory block on the device given the interface name.
* This can represent a memory block on a soft CPU, FPGA, IC;
* the interpretation is up the implementation to decide.
* \param name the name of a available memory block interface
* \param addr the memory block start address
* \param value the memory block content
*/
virtual void write_registers(const std::string& name,
unsigned addr,
const std::vector<unsigned>& value) = 0;
/*!
* Read a memory block on the device given the interface name.
* \param name the name of a available memory block interface
* \param addr the memory block start address
* \param length number of words to be read from memory block
* \return the memory block content
*/
virtual std::vector<unsigned>
read_registers(const std::string& name, unsigned addr, size_t length) const = 0;
/*!
* Describe the allowed keys and values used for settings.
* \return a list of argument info structures
*/
virtual arginfo_list_t get_setting_info() const = 0;
/*!
* Write an arbitrary setting on the device.
* The interpretation is up the implementation.
* \param key the setting identifier
* \param value the setting value
*/
virtual void write_setting(const std::string& key, const std::string& value) = 0;
/*!
* Read an arbitrary setting on the device.
* \param key the setting identifier
* \return the setting value
*/
virtual std::string read_setting(const std::string& key) const = 0;
/*!
* Describe the allowed keys and values used for channel settings.
* \param channel an available channel on the device
* \return a list of argument info structures
*/
virtual arginfo_list_t get_setting_info(size_t channel) const = 0;
/*!
* Write an arbitrary channel setting on the device.
* The interpretation is up the implementation.
* \param channel an available channel on the device
* \param key the setting identifier
* \param value the setting value
*/
virtual void
write_setting(size_t channel, const std::string& key, const std::string& value) = 0;
/*!
* Read an arbitrary channel setting on the device.
* \param channel an available channel on the device
* \param key the setting identifier
* \return the setting value
*/
virtual std::string read_setting(size_t channel, const std::string& key) const = 0;
/*!
* Get a list of available GPIO banks by name.
*/
virtual std::vector<std::string> list_gpio_banks() const = 0;
/*!
* Write the value of a GPIO bank.
* \param bank the name of an available bank
* \param value an integer representing GPIO bits
*/
virtual void write_gpio(const std::string& bank, unsigned value) = 0;
/*!
* Write the value of a GPIO bank with modification mask.
* \param bank the name of an available bank
* \param value an integer representing GPIO bits
* \param mask a modification mask where 1 = modify
*/
virtual void write_gpio(const std::string& bank, unsigned value, unsigned mask) = 0;
/*!
* Readback the value of a GPIO bank.
* \param bank the name of an available bank
* \return an integer representing GPIO bits
*/
virtual unsigned read_gpio(const std::string& bank) const = 0;
/*!
* Write the data direction of a GPIO bank.
* 1 bits represent outputs, 0 bits represent inputs.
* \param bank the name of an available bank
* \param dir an integer representing data direction bits
*/
virtual void write_gpio_dir(const std::string& bank, unsigned dir) = 0;
/*!
* Write the data direction of a GPIO bank with modification mask.
* 1 bits represent outputs, 0 bits represent inputs.
* \param bank the name of an available bank
* \param dir an integer representing data direction bits
* \param mask a modification mask where 1 = modify
*/
virtual void write_gpio_dir(const std::string& bank, unsigned dir, unsigned mask) = 0;
/*!
* Read the data direction of a GPIO bank.
* 1 bits represent outputs, 0 bits represent inputs.
* \param bank the name of an available bank
* \return an integer representing data direction bits
*/
virtual unsigned read_gpio_dir(const std::string& bank) const = 0;
/*!
* Write to an available I2C slave.
* If the device contains multiple I2C masters,
* the address bits can encode which master.
* \param addr the address of the slave
* \param data an array of bytes write out
*/
virtual void write_i2c(int addr, const std::string& data) = 0;
/*!
* Read from an available I2C slave.
* If the device contains multiple I2C masters,
* the address bits can encode which master.
* \param addr the address of the slave
* \param num_bytes the number of bytes to read
* \return an array of bytes read from the slave
*/
virtual std::string read_i2c(int addr, size_t num_bytes) = 0;
/*!
* Perform a SPI transaction and return the result.
* Its up to the implementation to set the clock rate,
* and read edge, and the write edge of the SPI core.
* SPI slaves without a readback pin will return 0.
*
* If the device contains multiple SPI masters,
* the address bits can encode which master.
*
* \param addr an address of an available SPI slave
* \param data the SPI data, num_bits-1 is first out
* \param num_bits the number of bits to clock out
* \return the readback data, num_bits-1 is first in
*/
virtual unsigned transact_spi(int addr, unsigned data, size_t num_bits) = 0;
/*!
* Enumerate the available UART devices.
* \return a list of names of available UARTs
*/
virtual std::vector<std::string> list_uarts() const = 0;
/*!
* Write data to a UART device.
* Its up to the implementation to set the baud rate,
* carriage return settings, flushing on newline.
* \param which the name of an available UART
* \param data an array of bytes to write out
*/
virtual void write_uart(const std::string& which, const std::string& data) = 0;
/*!
* Read bytes from a UART until timeout or newline.
* Its up to the implementation to set the baud rate,
* carriage return settings, flushing on newline.
* \param which the name of an available UART
* \param timeout_us a timeout in microseconds
* \return an array of bytes read from the UART
*/
virtual std::string read_uart(const std::string& which,
long timeout_us = 100000) const = 0;
};
} // namespace soapy
} // namespace gr
#endif /* INCLUDED_GR_SOAPY_BLOCK_H */

Wyświetl plik

@ -1,80 +0,0 @@
/* -*- c++ -*- */
/*
* Copyright 2021 Jeff Long
* Copyright 2018-2021 Libre Space Foundation <http://libre.space/>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#ifndef INCLUDED_GR_SOAPY_SINK_H
#define INCLUDED_GR_SOAPY_SINK_H
#include <gnuradio/soapy/api.h>
#include <gnuradio/soapy/block.h>
#include <gnuradio/sync_block.h>
#include <cstdint>
#include <string>
#include <vector>
namespace gr {
namespace soapy {
/*!
* \addtogroup block
* \brief <b>Sink</b> block implements SoapySDR functionality for RX.
* \ingroup soapy
* \section sink Soapy Sink
* The soapy sink block receives samples and writes to a stream.
* The sink block also provides Soapy API calls for receiver settings.
* Includes all parameters for full RX implementation.
* Device is a string containing the driver and type name of the
* device the user wants to use according to the Soapy* module
* documentation.
* Make parameters are passed through the xml block.
* Some of the available parameters can be seen at Figure 2
* Antenna and clock source can be left empty and default values
* will be used.
* This block has a message port, which consumes PMT messages.
* For a description of the command syntax, see \ref cmd_handler_t.
*/
class SOAPY_API sink : virtual public block
{
public:
using sptr = std::shared_ptr<sink>;
/*!
* \brief Return a shared_ptr to a new instance of soapy::sink.
*
* To avoid accidental use of raw pointers, soapy::sink's
* constructor is in a private implementation
* class. soapy::sink::make is the public interface for
* creating new instances.
* \param device the device driver and type
* \param type output stream format
* \param nchan number of channels
* \param dev_args device specific arguments
* \param stream_args stream arguments. Same for all enabled channels
* \param tune_args list with tuning specific arguments, one entry for every
* enabled channel, or a single entry to apply to all
* \param other_settings list with general settings, one entry for every
* enabled channel, or a single entry to apply to all. Supports also specific
* gain settings.
*
* Driver name can be any of "uhd", "lime", "airspy",
* "rtlsdr" or others
*/
static sptr make(const std::string& device,
const std::string& type,
size_t nchan,
const std::string& dev_args = "",
const std::string& stream_args = "",
const std::vector<std::string>& tune_args = { "" },
const std::vector<std::string>& other_settings = { "" });
virtual void set_length_tag_name(const std::string& length_tag_name) = 0;
};
} // namespace soapy
} // namespace gr
#endif /* INCLUDED_GR_SOAPY_SINK_H */

Wyświetl plik

@ -1,34 +0,0 @@
/* -*- c++ -*- */
/*
* Copyright 2021 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
*/
/* GR-style type aliases for Soapy types exposed in gr-soapy blocks */
#ifndef INCLUDED_GR_SOAPY_TYPES_H
#define INCLUDED_GR_SOAPY_TYPES_H
#include <CaribouLite/Types.hpp>
namespace gr {
namespace soapy {
using arginfo_t = SoapySDR::ArgInfo;
using arginfo_list_t = SoapySDR::ArgInfoList;
using argtype_t = SoapySDR::ArgInfo::Type;
using kwargs_t = SoapySDR::Kwargs;
using kwargs_list_t = SoapySDR::KwargsList;
using range_t = SoapySDR::Range;
using range_list_t = SoapySDR::RangeList;
} // namespace soapy
} // namespace gr
#endif

Wyświetl plik

@ -1,78 +0,0 @@
/* -*- c++ -*- */
/*
* Copyright 2021 Jeff Long
* Copyright 2018-2021 Libre Space Foundation <http://libre.space/>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#ifndef INCLUDED_GR_SOAPY_SOURCE_H
#define INCLUDED_GR_SOAPY_SOURCE_H
#include <gnuradio/soapy/api.h>
#include <gnuradio/soapy/block.h>
#include <gnuradio/sync_block.h>
#include <cstdint>
#include <string>
#include <vector>
namespace gr {
namespace cariboulite {
/*!
* \addtogroup block
* \brief <b>Source</b> block implements SoapySDR functionality for RX.
* \ingroup soapy
* \section source Soapy Source
* The soapy source block receives samples and writes to a stream.
* The source block also provides Soapy API calls for receiver settings.
* Includes all parameters for full RX implementation.
* Device is a string containing the driver and type name of the
* device the user wants to use according to the Soapy* module
* documentation.
* Make parameters are passed through the xml block.
* Some of the available parameters can be seen at Figure 2
* Antenna and clock source can be left empty and default values
* will be used.
* This block has a message port, which consumes PMT messages.
* For a description of the command syntax, see \ref cmd_handler_t.
*/
class CARIBOULITE_API source : virtual public block
{
public:
using sptr = std::shared_ptr<source>;
/*!
* \brief Return a shared_ptr to a new instance of soapy::source.
*
* To avoid accidental use of raw pointers, soapy::source's
* constructor is in a private implementation
* class. soapy::source::make is the public interface for
* creating new instances.
* \param device the device driver and type
* \param type output stream format
* \param nchan number of channels
* \param dev_args device specific arguments
* \param stream_args stream arguments. Same for all enabled channels
* \param tune_args list with tuning specific arguments, one entry for every
* enabled channel, or a single entry to apply to all
* \param other_settings list with general settings, one entry for every
* enabled channel, or a single entry to apply to all. Supports also specific
* gain settings.
*
* Driver name can be any of "uhd", "lime", "airspy",
* "rtlsdr" or others
*/
static sptr make(const std::string& device,
const std::string& type,
size_t nchan,
const std::string& dev_args = "",
const std::string& stream_args = "",
const std::vector<std::string>& tune_args = { "" },
const std::vector<std::string>& other_settings = { "" });
};
} // namespace soapy
} // namespace gr
#endif /* INCLUDED_GR_SOAPY_SOURCE_H */

Wyświetl plik

@ -1,73 +0,0 @@
# Copyright 2011-2021 Free Software Foundation, Inc.
#
# This file was generated by gr_modtool, a tool from the GNU Radio framework
# This file is a part of gr-cariboulite
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
########################################################################
# Setup library
########################################################################
add_library(gnuradio-cariboulite
block_impl.cc
source_impl.cc
sink_impl.cc
)
target_compile_features(gnuradio-soapy PRIVATE ${GR_CXX_VERSION_FEATURE})
target_link_libraries(gnuradio-cariboulite PUBLIC
gnuradio-runtime
${CARIBOULITR_LIBRARIES}
)
if(ENABLE_COMMON_PCH)
target_link_libraries(gnuradio-cariboulite PRIVATE common-precompiled-headers)
endif()
target_include_directories(gnuradio-cariboulite PUBLIC
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../include>
)
#Add Windows DLL resource file if using MSVC
if (MSVC)
include(${CMAKE_SOURCE_DIR}/cmake/Modules/GrVersion.cmake)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/gnuradio-cariboulite.rc.in
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-cariboulite.rc
@ONLY)
target_sources(gnuradio-cariboulite PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/gnuradio-cariboulite.rc
)
endif (MSVC)
if(BUILD_SHARED_LIBS)
GR_LIBRARY_FOO(gnuradio-cariboulite CaribouLite)
endif()
if(ENABLE_TESTING)
include(GrTest)
# If your unit tests require special include paths, add them here
#include_directories()
# List all files that contain Boost.UTF unit tests here
list(APPEND test_cariboulite_sources)
# Anything we need to link to for the unit tests go here
list(APPEND GR_TEST_TARGET_DEPS gnuradio-cariboulite)
if(NOT test_cariboulite_sources)
MESSAGE(STATUS "No C++ unit tests... skipping")
return()
endif(NOT test_cariboulite_sources)
foreach(qa_file ${test_cariboulite_sources})
GR_ADD_CPP_TEST("cariboulite_${qa_file}"
${CMAKE_CURRENT_SOURCE_DIR}/${qa_file}
)
endforeach(qa_file)
endif()

Wyświetl plik

@ -1,297 +0,0 @@
/* -*- c++ -*- */
/*
* Copyright 2021 Jeff Long
* Copyright 2018-2021 Libre Space Foundation <http://libre.space>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#ifndef INCLUDED_GR_SOAPY_BLOCK_IMPL_H
#define INCLUDED_GR_SOAPY_BLOCK_IMPL_H
#include <mutex>
#include <gnuradio/cariboulite/block.h>
#include <SoapySDR/Device.hpp>
#include <SoapySDR/Modules.hpp>
#include <SoapySDR/Registry.hpp>
#include <SoapySDR/Version.hpp>
namespace gr {
namespace soapy {
using cmd_handler_t = std::function<void(pmt::pmt_t, size_t)>;
struct device_deleter {
void operator()(SoapySDR::Device* d) { SoapySDR::Device::unmake(d); }
};
using device_ptr_t = std::unique_ptr<SoapySDR::Device, device_deleter>;
/*!
* \brief Base block implementation for SDR devices.
*/
class block_impl : virtual public block
{
private:
const int d_direction;
const std::string d_dev_str;
const std::string d_args;
size_t d_mtu = 0;
size_t d_nchan;
std::string d_stream_args;
std::vector<size_t> d_channels;
std::string d_soapy_type;
std::map<pmt::pmt_t, cmd_handler_t> d_cmd_handlers;
kwargs_list_t d_tune_args;
void register_msg_cmd_handler(const pmt::pmt_t& cmd, cmd_handler_t handler);
/*!
* \brief Raise std::invalid_argument if channel is invalid
*/
void validate_channel(size_t channel) const;
protected:
block_impl(int direction,
const std::string& device,
const std::string& type,
size_t nchan,
const std::string& dev_args,
const std::string& stream_args,
const std::vector<std::string>& tune_args,
const std::vector<std::string>& other_settings);
block_impl(const block_impl&) = delete;
block_impl(block_impl&&) = delete;
block_impl& operator=(const block_impl&) = delete;
block_impl& operator=(block_impl&&) = delete;
virtual ~block_impl();
std::mutex d_device_mutex;
device_ptr_t d_device;
SoapySDR::Stream* d_stream = nullptr;
static io_signature::sptr args_to_io_sig(const std::string& type, size_t nchan)
{
size_t size = 0;
if (type == "fc32") {
size = 8;
} else if (type == "sc16") {
size = 4;
} else if (type == "sc8") {
size = 2;
} else {
size = 1; /* TODO: this is an error */
}
return io_signature::make(nchan, nchan, size);
}
public:
bool start() override;
bool stop() override;
/*** Begin public API implementation ***/
std::string get_driver_key() const override;
std::string get_hardware_key() const override;
kwargs_t get_hardware_info() const override;
void set_frontend_mapping(const std::string& frontend_mapping) override;
std::string get_frontend_mapping() const override;
kwargs_t get_channel_info(size_t channel) const override;
void set_sample_rate(size_t channel, double sample_rate) override;
double get_sample_rate(size_t channel) const override;
range_list_t get_sample_rate_range(size_t channel) const override;
void set_frequency(size_t channel, double frequency) override;
void
set_frequency(size_t channel, const std::string& name, double frequency) override;
double get_frequency(size_t channel) const override;
double get_frequency(size_t channel, const std::string& name) const override;
std::vector<std::string> list_frequencies(size_t channel) const override;
range_list_t get_frequency_range(size_t channel) const override;
range_list_t get_frequency_range(size_t channel,
const std::string& name) const override;
arginfo_list_t get_frequency_args_info(size_t channel) const override;
void set_bandwidth(size_t channel, double bandwidth) override;
double get_bandwidth(size_t channel) const override;
range_list_t get_bandwidth_range(size_t channel) const override;
std::vector<std::string> list_antennas(int channel) const override;
void set_antenna(size_t channel, const std::string& name) override;
std::string get_antenna(size_t channel) const override;
bool has_gain_mode(size_t channel) const override;
void set_gain_mode(size_t channel, bool enable) override;
bool get_gain_mode(size_t channel) const override;
std::vector<std::string> list_gains(size_t channel) const override;
void set_gain(size_t channel, double gain) override;
void set_gain(size_t channel, const std::string& name, double gain) override;
double get_gain(size_t channel) const override;
double get_gain(size_t channel, const std::string& name) const override;
range_t get_gain_range(size_t channel) const override;
range_t get_gain_range(size_t channel, const std::string& name) const override;
bool has_frequency_correction(size_t channel) const override;
void set_frequency_correction(size_t channel, double freq_correction) override;
double get_frequency_correction(size_t channel) const override;
bool has_dc_offset_mode(size_t channel) const override;
void set_dc_offset_mode(size_t channel, bool automatic) override;
bool get_dc_offset_mode(size_t channel) const override;
bool has_dc_offset(size_t channel) const override;
void set_dc_offset(size_t channel, const gr_complexd& dc_offset) override;
gr_complexd get_dc_offset(size_t channel) const override;
bool has_iq_balance(size_t channel) const override;
void set_iq_balance(size_t channel, const gr_complexd& iq_balance) override;
gr_complexd get_iq_balance(size_t channel) const override;
bool has_iq_balance_mode(size_t channel) const override;
void set_iq_balance_mode(size_t channel, bool automatic) override;
bool get_iq_balance_mode(size_t channel) const override;
void set_master_clock_rate(double clock_rate) override;
double get_master_clock_rate() const override;
range_list_t get_master_clock_rates() const override;
void set_reference_clock_rate(double rate) override;
double get_reference_clock_rate() const override;
range_list_t get_reference_clock_rates() const override;
std::vector<std::string> list_clock_sources() const override;
void set_clock_source(const std::string& clock_source) override;
std::string get_clock_source() const override;
std::vector<std::string> list_time_sources() const override;
void set_time_source(const std::string& source) override;
std::string get_time_source() const override;
bool has_hardware_time(const std::string& what) const override;
long long get_hardware_time(const std::string& what) const override;
void set_hardware_time(long long timeNs, const std::string& what) override;
std::vector<std::string> list_sensors() const override;
arginfo_t get_sensor_info(const std::string& key) const override;
std::string read_sensor(const std::string& key) const override;
std::vector<std::string> list_sensors(size_t channel) const override;
arginfo_t get_sensor_info(size_t channel, const std::string& key) const override;
std::string read_sensor(size_t channel, const std::string& key) const override;
std::vector<std::string> list_register_interfaces() const override;
void write_register(const std::string& name, unsigned addr, unsigned value) override;
unsigned read_register(const std::string& name, unsigned addr) const override;
void write_registers(const std::string& name,
unsigned addr,
const std::vector<unsigned>& value) override;
std::vector<unsigned>
read_registers(const std::string& name, unsigned addr, size_t length) const override;
virtual arginfo_list_t get_setting_info() const override;
virtual void write_setting(const std::string& key, const std::string& value) override;
virtual std::string read_setting(const std::string& key) const override;
virtual arginfo_list_t get_setting_info(size_t channel) const override;
virtual void write_setting(size_t channel,
const std::string& key,
const std::string& value) override;
virtual std::string read_setting(size_t channel,
const std::string& key) const override;
std::vector<std::string> list_gpio_banks() const override;
void write_gpio(const std::string& bank, unsigned value) override;
void write_gpio(const std::string& bank, unsigned value, unsigned mask) override;
unsigned read_gpio(const std::string& bank) const override;
void write_gpio_dir(const std::string& bank, unsigned dir) override;
void write_gpio_dir(const std::string& bank, unsigned dir, unsigned mask) override;
unsigned read_gpio_dir(const std::string& bank) const override;
void write_i2c(int addr, const std::string& data) override;
std::string read_i2c(int addr, size_t num_bytes) override;
unsigned transact_spi(int addr, unsigned data, size_t num_bits) override;
std::vector<std::string> list_uarts() const override;
void write_uart(const std::string& which, const std::string& data) override;
std::string read_uart(const std::string& which, long timeout_us) const override;
/*** End public API implementation ***/
protected:
/*** Begin message handlers ***/
/*!
* Calls the correct message handler according to the received message symbol.
* A dictionary with key the handler name is used in order to call the
* corresponding handler.
* \param msg a PMT dictionary
*/
void msg_handler_cmd(pmt::pmt_t msg);
/*!
* Set the center frequency of the RX chain.
* @param val center frequency in Hz
* @param channel an available channel on the device
*/
void cmd_handler_frequency(pmt::pmt_t val, size_t channel);
/*!
* Set the overall gain for the specified chain.
* The gain will be distributed automatically across available
* elements according to Soapy API.
* @param val the new amplification value in dB
* @param channel an available channel on the device
*/
void cmd_handler_gain(pmt::pmt_t val, size_t channel);
/*!
* Set the baseband sample rate for the RX chain.
* @param val the sample rate samples per second
* @param channel an available channel on the device
*/
void cmd_handler_samp_rate(pmt::pmt_t val, size_t channel);
/*!
* Set the baseband filter width for the RX chain.
* @param val baseband filter width in Hz
* @param channel an available channel on the device
*/
void cmd_handler_bw(pmt::pmt_t val, size_t channel);
/*!
* Set the anntena element for the RX chain.
* @param val name of the anntena
* @param channel an available channel on the device
*/
void cmd_handler_antenna(pmt::pmt_t val, size_t channel);
void cmd_handler_gain_mode(pmt::pmt_t val, size_t channel);
void cmd_handler_frequency_correction(pmt::pmt_t val, size_t channel);
void cmd_handler_dc_offset_mode(pmt::pmt_t val, size_t channel);
void cmd_handler_dc_offset(pmt::pmt_t val, size_t channel);
void cmd_handler_iq_balance(pmt::pmt_t val, size_t channel);
void cmd_handler_iq_balance_mode(pmt::pmt_t val, size_t channel);
void cmd_handler_master_clock_rate(pmt::pmt_t val, size_t);
void cmd_handler_reference_clock_rate(pmt::pmt_t val, size_t);
void cmd_handler_clock_source(pmt::pmt_t val, size_t);
void cmd_handler_time_source(pmt::pmt_t val, size_t);
void cmd_handler_hardware_time(pmt::pmt_t val, size_t);
void cmd_handler_register(pmt::pmt_t val, size_t);
void cmd_handler_registers(pmt::pmt_t val, size_t);
void cmd_handler_setting(pmt::pmt_t val, size_t channel);
void cmd_handler_gpio(pmt::pmt_t val, size_t);
void cmd_handler_gpio_dir(pmt::pmt_t val, size_t);
void cmd_handler_i2c(pmt::pmt_t val, size_t);
void cmd_handler_uart(pmt::pmt_t val, size_t);
/*** End message handlers ***/
};
} // namespace soapy
} // namespace gr
#endif /* INCLUDED_GR_SOAPY_BLOCK_IMPL_H */

Wyświetl plik

@ -1,43 +0,0 @@
/* -*- c++ -*- */
/*
* Copyright 2013 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
*/
#include <afxres.h>
VS_VERSION_INFO VERSIONINFO
FILEVERSION @MAJOR_VERSION@,@API_COMPAT@,@RC_MINOR_VERSION@,@RC_MAINT_VERSION@
PRODUCTVERSION @MAJOR_VERSION@,@API_COMPAT@,@RC_MINOR_VERSION@,@RC_MAINT_VERSION@
FILEFLAGSMASK 0x3fL
#ifndef NDEBUG
FILEFLAGS 0x0L
#else
FILEFLAGS 0x1L
#endif
FILEOS VOS__WINDOWS32
FILETYPE VFT_DLL
FILESUBTYPE VFT2_DRV_INSTALLABLE
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "gnuradio-cariboulite"
VALUE "FileVersion", "@VERSION@"
VALUE "InternalName", "gnuradio-cariboulite.dll"
VALUE "LegalCopyright", "Licensed under GPLv3 or any later version"
VALUE "OriginalFilename", "gnuradio-cariboulite.dll"
VALUE "ProductName", "gnuradio-cariboulite"
VALUE "ProductVersion", "@VERSION@"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END

Wyświetl plik

@ -1,87 +0,0 @@
/*
* Copyright 2021 Nicholas Corgan
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#ifndef INCLUDED_GR_SOAPY_SETTING_STRING_CONVERSION_H
#define INCLUDED_GR_SOAPY_SETTING_STRING_CONVERSION_H
#include <SoapySDR/Types.hpp>
#include <SoapySDR/Version.h>
#include <sstream>
namespace gr {
namespace soapy {
// SoapySDR doesn't have an API define for SettingToString, so we need
// to check the version. 0.8 is the first tagged version to have this
// functionality.
#if SOAPY_SDR_API_VERSION >= 0x080000
template <typename T>
static inline T string_to_setting(const std::string& str)
{
return SoapySDR::StringToSetting<T>(str);
}
template <typename T>
static inline std::string setting_to_string(const T& setting)
{
return SoapySDR::SettingToString<T>(setting);
}
#else
// Copied from SoapySDR 0.8
#define SOAPY_SDR_TRUE "true"
#define SOAPY_SDR_FALSE "false"
template <typename T>
static inline T string_to_setting(const std::string& str)
{
std::stringstream sstream(str);
T setting;
sstream >> setting;
return setting;
}
// Copied from SoapySDR 0.8
//! convert empty and "false" strings to false, integers to their truthness
template <>
inline bool string_to_setting<bool>(const std::string& str)
{
if (str.empty() || str == SOAPY_SDR_FALSE) {
return false;
}
if (str == SOAPY_SDR_TRUE) {
return true;
}
try {
return static_cast<bool>(std::stod(str));
} catch (std::invalid_argument& e) {
}
// other values are true
return true;
}
template <typename T>
static inline std::string setting_to_string(const T& setting)
{
return std::to_string(setting);
}
template <>
inline std::string setting_to_string<bool>(const bool& setting)
{
return setting ? SOAPY_SDR_TRUE : SOAPY_SDR_FALSE;
}
#endif
} // namespace soapy
} // namespace gr
#endif /* INCLUDED_GR_SOAPY_SETTING_STRING_CONVERSION_H */

Wyświetl plik

@ -1,137 +0,0 @@
/* -*- c++ -*- */
/*
* Copyright 2021 Jeff Long
* Copyright 2018-2021 Libre Space Foundation <http://libre.space>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "sink_impl.h"
#include <SoapySDR/Errors.hpp>
#include <iostream>
namespace gr {
namespace soapy {
sink::sptr sink::make(const std::string& device,
const std::string& type,
size_t nchan,
const std::string& dev_args,
const std::string& stream_args,
const std::vector<std::string>& tune_args,
const std::vector<std::string>& other_settings)
{
return gnuradio::make_block_sptr<sink_impl>(
device, type, nchan, dev_args, stream_args, tune_args, other_settings);
}
sink_impl::sink_impl(const std::string& device,
const std::string& type,
size_t nchan,
const std::string& dev_args,
const std::string& stream_args,
const std::vector<std::string>& tune_args,
const std::vector<std::string>& other_settings)
: gr::block("sink", args_to_io_sig(type, nchan), gr::io_signature::make(0, 0, 0)),
block_impl(SOAPY_SDR_TX,
device,
type,
nchan,
dev_args,
stream_args,
tune_args,
other_settings)
{
}
void sink_impl::set_length_tag_name(const std::string& length_tag_name)
{
d_length_tag_key = pmt::mp(length_tag_name);
}
int sink_impl::general_work(__GR_ATTR_UNUSED int noutput_items,
gr_vector_int& ninput_items,
gr_vector_const_void_star& input_items,
__GR_ATTR_UNUSED gr_vector_void_star& output_items)
{
int nin = ninput_items[0];
long long int time_ns = 0;
int nconsumed = 0;
int nwrite = nin;
int flags = 0;
// TODO: optimization: add loop to handle portions of more than one burst
// per call.
// If using tagged bursts
if (!pmt::is_null(d_length_tag_key)) {
// If there are any length tags in the window, look at the first one only.
std::vector<tag_t> length_tags;
get_tags_in_window(length_tags, 0, 0, nin, d_length_tag_key);
auto tag = length_tags.begin();
if (tag != length_tags.end()) {
long offset = tag->offset - nitems_read(0);
// Current burst is done, new tag follows immediately.
if (d_burst_remaining == 0 && offset == 0) {
d_burst_remaining = pmt::to_long(tag->value);
}
// A length tag appears before the end of the current burst, alert
// user of tag preemption. This may mean that samples have been
// dropped somewhere. Adjust d_burst_remaining to end before tag.
// The remaining samples in the current burst will still be written.
else if (offset < d_burst_remaining) {
std::cerr << "tP" << std::flush;
d_burst_remaining = offset;
}
}
// No samples remaining in burst means there was a tag gap. Alert user
// and consume samples.
if (d_burst_remaining == 0) {
std::cerr << "tG" << std::flush;
nconsumed += nin;
}
nwrite = std::min<long>(d_burst_remaining, nin);
// If a burst is active, check if we finish it on this call
if (d_burst_remaining == nwrite) {
flags |= SOAPY_SDR_END_BURST;
}
}
int result = 0;
if (nwrite != 0) {
// No command handlers while writing
std::lock_guard<std::mutex> l(d_device_mutex);
result =
d_device->writeStream(d_stream, input_items.data(), nwrite, flags, time_ns);
}
if (result >= 0) {
nconsumed += result;
if (d_burst_remaining > 0) {
d_burst_remaining -= result;
}
} else if (result == SOAPY_SDR_UNDERFLOW) {
std::cerr << "sU" << std::flush;
} else {
d_logger->warn("Soapy sink error: {:s}", SoapySDR::errToStr(result));
}
consume_each(nconsumed);
return 0;
}
} /* namespace soapy */
} /* namespace gr */

Wyświetl plik

@ -1,57 +0,0 @@
/* -*- c++ -*- */
/*
* Copyright 2021 Jeff Long
* Copyright 2018-2021 Libre Space Foundation <http://libre.space>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#ifndef INCLUDED_SOAPY_GR_SINK_IMPL_H
#define INCLUDED_SOAPY_GR_SINK_IMPL_H
#include <functional>
#include "block_impl.h"
#include <gnuradio/io_signature.h>
#include <gnuradio/soapy/sink.h>
#include <SoapySDR/Device.hpp>
#include <SoapySDR/Modules.hpp>
#include <SoapySDR/Registry.hpp>
#include <SoapySDR/Version.hpp>
namespace gr {
namespace soapy {
/*!
* \brief Sink block implementation for SDR devices.
*/
class sink_impl : public sink, public block_impl
{
public:
sink_impl(const std::string& device,
const std::string& type,
size_t nchan,
const std::string& dev_args,
const std::string& stream_args,
const std::vector<std::string>& tune_args,
const std::vector<std::string>& other_settings);
~sink_impl() override{};
int general_work(int noutput_items,
gr_vector_int& ninput_items,
gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items) override;
void set_length_tag_name(const std::string& length_tag_name) override;
private:
pmt::pmt_t d_length_tag_key = pmt::get_PMT_NIL();
long d_burst_remaining;
};
} // namespace soapy
} // namespace gr
#endif /* INCLUDED_SOAPY_GR_SINK_IMPL_H */

Wyświetl plik

@ -1,100 +0,0 @@
/* -*- c++ -*- */
/*
* Copyright 2021 Jeff Long
* Copyright 2018-2021 Libre Space Foundation <http://libre.space>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "source_impl.h"
#include <SoapySDR/Errors.hpp>
#include <iostream>
namespace gr {
namespace soapy {
source::sptr source::make(const std::string& device,
const std::string& type,
size_t nchan,
const std::string& dev_args,
const std::string& stream_args,
const std::vector<std::string>& tune_args,
const std::vector<std::string>& other_settings)
{
return gnuradio::make_block_sptr<source_impl>(
device, type, nchan, dev_args, stream_args, tune_args, other_settings);
}
source_impl::source_impl(const std::string& device,
const std::string& type,
size_t nchan,
const std::string& dev_args,
const std::string& stream_args,
const std::vector<std::string>& tune_args,
const std::vector<std::string>& other_settings)
: gr::block("source", gr::io_signature::make(0, 0, 0), args_to_io_sig(type, nchan)),
block_impl(SOAPY_SDR_RX,
device,
type,
nchan,
dev_args,
stream_args,
tune_args,
other_settings)
{
}
int source_impl::general_work(int noutput_items,
__GR_ATTR_UNUSED gr_vector_int& ninput_items,
__GR_ATTR_UNUSED gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items)
{
long long int time_ns = 0;
int flags = 0;
const long timeout_us = 500000; // 0.5 sec
int nout = 0;
for (;;) {
// No command handlers while reading
int result;
{
std::lock_guard<std::mutex> l(d_device_mutex);
result = d_device->readStream(
d_stream, output_items.data(), noutput_items, flags, time_ns, timeout_us);
}
if (result >= 0) {
nout = result;
break;
}
switch (result) {
// Retry on overflow. Data has been lost.
case SOAPY_SDR_OVERFLOW:
std::cerr << "sO" << std::flush;
continue;
// Yield back to scheduler on timeout.
case SOAPY_SDR_TIMEOUT:
break;
// Report and yield back to scheduler on other errors.
default:
d_logger->warn("Soapy source error: {:s}", SoapySDR::errToStr(result));
break;
}
break;
};
return nout;
}
} /* namespace soapy */
} /* namespace gr */

Wyświetl plik

@ -1,51 +0,0 @@
/* -*- c++ -*- */
/*
* Copyright 2021 Jeff Long
* Copyright 2018-2021 Libre Space Foundation <http://libre.space>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#ifndef INCLUDED_GR_SOAPY_SOURCE_IMPL_H
#define INCLUDED_GR_SOAPY_SOURCE_IMPL_H
#include <functional>
#include "block_impl.h"
#include <gnuradio/io_signature.h>
#include <gnuradio/soapy/source.h>
#include <SoapySDR/Device.hpp>
#include <SoapySDR/Modules.hpp>
#include <SoapySDR/Registry.hpp>
#include <SoapySDR/Version.hpp>
namespace gr {
namespace soapy {
/*!
* \brief Source block implementation for SDR devices.
*/
class source_impl : public source, public block_impl
{
public:
source_impl(const std::string& device,
const std::string& type,
size_t nchan,
const std::string& dev_args,
const std::string& stream_args,
const std::vector<std::string>& tune_args,
const std::vector<std::string>& other_settings);
~source_impl() override{};
int general_work(int noutput_items,
gr_vector_int& ninput_items,
gr_vector_const_void_star& input_items,
gr_vector_void_star& output_items) override;
};
} // namespace soapy
} // namespace gr
#endif /* INCLUDED_GR_SOAPY_SOURCE_IMPL_H */

Wyświetl plik

@ -1,24 +0,0 @@
#
# Copyright 2008-2021 Free Software Foundation, Inc.
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
# The presence of this file turns this directory into a Python package
'''
This is the GNU Radio CaribouLite module. Place your Python package
description here (python/__init__.py).
'''
import os
# import pybind11 generated symbols into the soapy namespace
try:
from .cariboulite_python import *
except ImportError:
dirname, filename = os.path.split(os.path.abspath(__file__))
__path__.append(os.path.join(dirname, "bindings"))
from .cariboulite_python import *
# import any pure python here
#

Wyświetl plik

@ -1,32 +0,0 @@
# Copyright 2020-2021 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
include(GrPybind)
########################################################################
# Python Bindings
########################################################################
# For setting string conversions
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../../lib)
list(APPEND soapy_python_files
block_python.cc
soapy_common.cc
soapy_types_python.cc
source_python.cc
sink_python.cc
python_bindings.cc)
GR_PYBIND_MAKE_CHECK_HASH(soapy
../../..
gr::soapy
"${soapy_python_files}")
target_compile_features(soapy_python PRIVATE ${GR_CXX_VERSION_FEATURE})
install(TARGETS soapy_python DESTINATION ${GR_PYTHON_DIR}/gnuradio/soapy COMPONENT pythonapi)

Wyświetl plik

@ -1,644 +0,0 @@
/* -*- c++ -*- */
/*
* Copyright 2020-2021 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
*/
/***********************************************************************************/
/* This file is automatically generated using bindtool and can be manually edited */
/* The following lines can be configured to regenerate this file during cmake */
/* If manual edits are made, the following tags should be modified accordingly. */
/* BINDTOOL_GEN_AUTOMATIC(0) */
/* BINDTOOL_USE_PYGCCXML(0) */
/* BINDTOOL_HEADER_FILE(block.h) */
/* BINDTOOL_HEADER_FILE_HASH(6326cce2f22e30ab332ef966343f4a50) */
/***********************************************************************************/
#include "soapy_common.h"
#include <pybind11/complex.h>
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
namespace py = pybind11;
#include <gnuradio/soapy/block.h>
// pydoc.h is automatically generated in the build directory
#include <block_pydoc.h>
#include <algorithm>
#include <cassert>
// Assumption: we've validated that this key exists,
// probably through get_setting_info.
static gr::soapy::arginfo_t
get_specific_arginfo(const gr::soapy::arginfo_list_t& arginfo_list,
const std::string& key)
{
auto iter = std::find_if(
arginfo_list.begin(),
arginfo_list.end(),
[&key](const gr::soapy::arginfo_t& arginfo) { return (arginfo.key == key); });
assert(iter != arginfo_list.end());
return (*iter);
}
void bind_block(py::module& m)
{
using block = ::gr::soapy::block;
py::class_<block, gr::block, gr::basic_block, std::shared_ptr<block>>(
m, "block", D(block))
.def("set_frontend_mapping",
&block::set_frontend_mapping,
py::arg("frontend_mapping"),
D(block, set_frontend_mapping))
.def("get_frontend_mapping",
&block::get_frontend_mapping,
D(block, get_frontend_mapping))
.def("get_channel_info",
&block::get_channel_info,
py::arg("channel"),
D(block, get_channel_info))
.def("set_sample_rate",
&block::set_sample_rate,
py::arg("channel"),
py::arg("sample_rate"),
D(block, set_sample_rate))
.def("get_sample_rate",
&block::get_sample_rate,
py::arg("channel"),
D(block, get_sample_rate))
.def("get_sample_rate_range",
&block::get_sample_rate_range,
py::arg("channel"),
D(block, get_sample_rate_range))
.def("set_frequency",
(void (block::*)(size_t, double)) & block::set_frequency,
py::arg("channel"),
py::arg("freq"),
D(block, set_frequency, 0))
.def("set_frequency",
(void (block::*)(size_t, const std::string&, double)) & block::set_frequency,
py::arg("channel"),
py::arg("name"),
py::arg("freq"),
D(block, set_frequency, 1))
.def("get_frequency",
(double (block::*)(size_t) const) & block::get_frequency,
py::arg("channel"),
D(block, get_frequency, 0))
.def("get_frequency",
(double (block::*)(size_t, const std::string&) const) & block::get_frequency,
py::arg("channel"),
py::arg("name"),
D(block, get_frequency, 1))
.def("list_frequencies",
&block::list_frequencies,
py::arg("channel"),
D(block, list_frequencies))
.def("get_frequency_range",
(gr::soapy::range_list_t(block::*)(size_t) const) &
block::get_frequency_range,
py::arg("channel"),
D(block, get_frequency_range, 0))
.def("get_frequency_range",
(gr::soapy::range_list_t(block::*)(size_t, const std::string&) const) &
block::get_frequency_range,
py::arg("channel"),
py::arg("name"),
D(block, get_frequency_range, 1))
.def("get_frequency_args_info",
&block::get_frequency_args_info,
py::arg("channel"),
D(block, get_frequency_args_info))
.def("set_bandwidth",
&block::set_bandwidth,
py::arg("channel"),
py::arg("bandwidth"),
D(block, set_bandwidth))
.def("get_bandwidth",
&block::get_bandwidth,
py::arg("channel"),
D(block, get_bandwidth))
.def("get_bandwidth_range",
&block::get_bandwidth_range,
py::arg("channel"),
D(block, get_bandwidth_range))
.def("list_antennas",
&block::list_antennas,
py::arg("channel"),
D(block, list_antennas))
.def("set_antenna",
&block::set_antenna,
py::arg("channel"),
py::arg("name"),
D(block, set_antenna))
.def(
"get_antenna", &block::get_antenna, py::arg("channel"), D(block, get_antenna))
.def("has_gain_mode",
&block::has_gain_mode,
py::arg("channel"),
D(block, has_gain_mode))
.def("set_gain_mode",
&block::set_gain_mode,
py::arg("channel"),
py::arg("automatic"),
D(block, set_gain_mode))
.def("get_gain_mode",
&block::get_gain_mode,
py::arg("channel"),
D(block, get_gain_mode))
.def("list_gains", &block::list_gains, py::arg("channel"), D(block, list_gains))
.def("set_gain",
(void (block::*)(size_t, double)) & block::set_gain,
py::arg("channel"),
py::arg("gain"),
D(block, set_gain, 0))
.def("set_gain",
(void (block::*)(size_t, const std::string&, double)) & block::set_gain,
py::arg("channel"),
py::arg("name"),
py::arg("gain"),
D(block, set_gain, 1))
.def("get_gain",
(double (block::*)(size_t) const) & block::get_gain,
py::arg("channel"),
D(block, get_gain, 0))
.def("get_gain",
(double (block::*)(size_t, const std::string&) const) & block::get_gain,
py::arg("channel"),
py::arg("name"),
D(block, get_gain, 1))
.def("get_gain_range",
(gr::soapy::range_t(block::*)(size_t) const) & block::get_gain_range,
py::arg("channel"),
D(block, get_gain_range, 0))
.def("get_gain_range",
(gr::soapy::range_t(block::*)(size_t, const std::string&) const) &
block::get_gain_range,
py::arg("channel"),
py::arg("name"),
D(block, get_gain_range, 1))
.def("has_frequency_correction",
&block::has_frequency_correction,
py::arg("channel"),
D(block, has_frequency_correction))
.def("set_frequency_correction",
&block::set_frequency_correction,
py::arg("channel"),
py::arg("freq_correction"),
D(block, set_frequency_correction))
.def("get_frequency_correction",
&block::get_frequency_correction,
py::arg("channel"),
D(block, get_frequency_correction))
.def("has_dc_offset_mode",
&block::has_dc_offset_mode,
py::arg("channel"),
D(block, has_dc_offset_mode))
.def("set_dc_offset_mode",
&block::set_dc_offset_mode,
py::arg("channel"),
py::arg("automatic"),
D(block, set_dc_offset_mode))
.def("get_dc_offset_mode",
&block::get_dc_offset_mode,
py::arg("channel"),
D(block, get_dc_offset_mode))
.def("has_dc_offset",
&block::has_dc_offset,
py::arg("channel"),
D(block, has_dc_offset))
.def("set_dc_offset",
&block::set_dc_offset,
py::arg("channel"),
py::arg("dc_offset"),
D(block, set_dc_offset))
.def("get_dc_offset",
&block::get_dc_offset,
py::arg("channel"),
D(block, get_dc_offset))
.def("has_iq_balance",
&block::has_iq_balance,
py::arg("channel"),
D(block, has_iq_balance))
.def("set_iq_balance",
&block::set_iq_balance,
py::arg("channel"),
py::arg("iq_balance"),
D(block, set_iq_balance))
.def("get_iq_balance",
&block::get_iq_balance,
py::arg("channel"),
D(block, get_iq_balance))
.def("has_iq_balance_mode",
&block::has_iq_balance_mode,
py::arg("channel"),
D(block, has_iq_balance_mode))
.def("set_iq_balance_mode",
&block::set_iq_balance_mode,
py::arg("channel"),
py::arg("automatic"),
D(block, set_iq_balance_mode))
.def("get_iq_balance_mode",
&block::get_iq_balance_mode,
py::arg("channel"),
D(block, get_iq_balance_mode))
.def("set_master_clock_rate",
&block::set_master_clock_rate,
py::arg("clock_rate"),
D(block, set_master_clock_rate))
.def("get_master_clock_rate",
&block::get_master_clock_rate,
D(block, get_master_clock_rate))
.def("get_master_clock_rates",
&block::get_master_clock_rates,
D(block, get_master_clock_rate))
.def("set_reference_clock_rate",
&block::set_reference_clock_rate,
py::arg("clock_rate"),
D(block, set_reference_clock_rate))
.def("get_reference_clock_rate",
&block::get_reference_clock_rate,
D(block, get_reference_clock_rate))
.def("get_reference_clock_rates",
&block::get_reference_clock_rates,
D(block, get_reference_clock_rate))
.def("list_clock_sources",
&block::list_clock_sources,
D(block, list_clock_sources))
.def("set_clock_source",
&block::set_clock_source,
py::arg("clock_source"),
D(block, set_clock_source))
.def("get_clock_source", &block::get_clock_source, D(block, get_clock_source))
.def("list_time_sources", &block::list_time_sources, D(block, list_time_sources))
.def("set_time_source",
&block::set_time_source,
py::arg("time_source"),
D(block, set_time_source))
.def("get_time_source", &block::get_time_source, D(block, get_time_source))
.def("has_hardware_time",
&block::has_hardware_time,
py::arg("what") = "",
D(block, has_hardware_time))
.def("set_hardware_time",
&block::set_hardware_time,
py::arg("what") = "",
py::arg("time_ns"),
D(block, set_hardware_time))
.def("get_hardware_time",
&block::get_hardware_time,
py::arg("what") = "",
D(block, get_hardware_time))
.def("list_sensors",
(std::vector<std::string>(block::*)() const) & block::list_sensors,
D(block, list_sensors, 0))
.def("get_sensor_info",
(gr::soapy::arginfo_t(block::*)(const std::string&) const) &
block::get_sensor_info,
py::arg("key"),
D(block, get_sensor_info, 0))
.def(
"read_sensor",
[](const block& self, const std::string& key) -> py::object {
const auto arginfo = self.get_sensor_info(key);
return cast_string_to_arginfo_type(arginfo.type, arginfo.value);
},
py::arg("key"),
D(block, read_sensor, 0))
.def("list_sensors",
(std::vector<std::string>(block::*)(size_t) const) & block::list_sensors,
py::arg("channel"),
D(block, list_sensors, 1))
.def("get_sensor_info",
(gr::soapy::arginfo_t(block::*)(size_t, const std::string&) const) &
block::get_sensor_info,
py::arg("channel"),
py::arg("key"),
D(block, get_sensor_info, 1))
.def(
"read_sensor",
[](const block& self, size_t channel, const std::string& key) -> py::object {
const auto arginfo = self.get_sensor_info(channel, key);
return cast_string_to_arginfo_type(arginfo.type, arginfo.value);
},
py::arg("channel"),
py::arg("key"),
D(block, read_sensor, 1))
.def("list_register_interfaces",
&block::list_register_interfaces,
D(block, list_register_interfaces))
.def("write_register",
&block::write_register,
py::arg("name"),
py::arg("addr"),
py::arg("value"),
D(block, write_register))
.def("read_register",
&block::read_register,
py::arg("name"),
py::arg("addr"),
D(block, read_register))
.def("write_registers",
&block::write_registers,
py::arg("name"),
py::arg("addr"),
py::arg("value"),
D(block, write_registers))
.def("read_registers",
&block::read_registers,
py::arg("name"),
py::arg("addr"),
py::arg("length"),
D(block, read_registers))
.def("get_setting_info",
(gr::soapy::arginfo_list_t(block::*)() const) & block::get_setting_info,
D(block, get_setting_info, 0))
.def(
"write_setting",
[](block& self, const std::string& key, py::object value) -> void {
auto setting_info = cast_pyobject_to_arginfo_string(value);
self.write_setting(key, setting_info.value);
},
py::arg("key"),
py::arg("value"),
D(block, write_setting, 0))
.def(
"read_setting",
[](const block& self, const std::string& key) -> py::object {
const auto setting_info =
get_specific_arginfo(self.get_setting_info(), key);
return cast_string_to_arginfo_type(setting_info.type, setting_info.value);
},
py::arg("key"),
D(block, read_setting, 0))
.def("get_setting_info",
(gr::soapy::arginfo_list_t(block::*)(size_t) const) &
block::get_setting_info,
py::arg("channel"),
D(block, get_setting_info, 0))
.def(
"write_setting",
[](block& self, size_t channel, const std::string& key, py::object value)
-> void {
auto setting_info = cast_pyobject_to_arginfo_string(value);
self.write_setting(channel, key, setting_info.value);
},
py::arg("channel"),
py::arg("key"),
py::arg("value"),
D(block, write_setting, 0))
.def(
"read_setting",
[](const block& self, size_t channel, const std::string& key) -> py::object {
const auto setting_info =
get_specific_arginfo(self.get_setting_info(channel), key);
return cast_string_to_arginfo_type(setting_info.type, setting_info.value);
},
py::arg("channel"),
py::arg("key"),
D(block, read_setting, 0))
.def("list_gpio_banks", &block::list_gpio_banks, D(block, list_gpio_banks))
.def("write_gpio",
(void (block::*)(const std::string&, unsigned)) & block::write_gpio,
py::arg("bank"),
py::arg("value"),
D(block, write_gpio, 0))
.def("write_gpio",
(void (block::*)(const std::string&, unsigned, unsigned)) &
block::write_gpio,
py::arg("bank"),
py::arg("value"),
py::arg("mask"),
D(block, write_gpio, 1))
.def("read_gpio", &block::read_gpio, py::arg("bank"), D(block, read_gpio))
.def("write_gpio_dir",
(void (block::*)(const std::string&, unsigned)) & block::write_gpio_dir,
py::arg("bank"),
py::arg("value"),
D(block, write_gpio_dir, 0))
.def("write_gpio_dir",
(void (block::*)(const std::string&, unsigned, unsigned)) &
block::write_gpio_dir,
py::arg("bank"),
py::arg("value"),
py::arg("mask"),
D(block, write_gpio_dir, 1))
.def("read_gpio_dir",
&block::read_gpio_dir,
py::arg("bank"),
D(block, read_gpio_dir))
.def("write_i2c",
&block::write_i2c,
py::arg("addr"),
py::arg("data"),
D(block, write_i2c))
.def("read_i2c",
&block::read_i2c,
py::arg("addr"),
py::arg("length"),
D(block, read_i2c))
.def("transact_spi",
&block::transact_spi,
py::arg("addr"),
py::arg("data"),
py::arg("num_bits"),
D(block, transact_spi))
.def("list_uarts", &block::list_uarts, D(block, list_uarts))
.def("write_uart",
&block::write_uart,
py::arg("which"),
py::arg("data"),
D(block, write_uart))
.def("read_uart",
&block::read_uart,
py::arg("which"),
py::arg("timeout_us") = 100000,
D(block, read_uart))
;
}

Some files were not shown because too many files have changed in this diff Show More