From 72455b7fb010681ff36e7113d142bb46dbfaf4b8 Mon Sep 17 00:00:00 2001 From: Silvano Seva Date: Sat, 30 Jan 2021 10:42:44 +0100 Subject: [PATCH] New radio driver for linux platform --- meson.build | 2 +- platform/drivers/baseband/radio_linux.c | 93 +++++++++++++++++++++++++ 2 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 platform/drivers/baseband/radio_linux.c diff --git a/meson.build b/meson.build index 6002f227..0e9c520e 100644 --- a/meson.build +++ b/meson.build @@ -159,7 +159,7 @@ linux_src = src + ['platform/targets/linux/emulator/emulator.c', 'platform/mcu/x86_64/drivers/gpio.c', 'platform/mcu/x86_64/drivers/delays.c', 'platform/mcu/x86_64/drivers/rtc.c', - 'platform/drivers/baseband/rtx_linux.c', + 'platform/drivers/baseband/radio_linux.c', 'platform/targets/linux/platform.c', 'rtos/uC-OS3/Ports/POSIX/os_cpu_c.c', 'rtos/uC-CPU/Posix/cpu_c.c'] diff --git a/platform/drivers/baseband/radio_linux.c b/platform/drivers/baseband/radio_linux.c new file mode 100644 index 00000000..71ad230e --- /dev/null +++ b/platform/drivers/baseband/radio_linux.c @@ -0,0 +1,93 @@ +/*************************************************************************** + * Copyright (C) 2020 by Federico Amedeo Izzo IU2NUO, * + * Niccolò Izzo IU2KIN * + * Frederik Saraci IU2NRO * + * Silvano Seva IU2KWO * + * * + * 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 3 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 * + ***************************************************************************/ + +#include +#include + +void radio_init() +{ + puts("radio_linux: init() called"); +} + +void radio_terminate() +{ + puts("radio_linux: terminate() called"); +} + +void radio_setBandwidth(const enum bandwidth bw) +{ + + char *band = (bw == BW_12_5) ? "12.5" : + ((bw == BW_20) ? "20" : "25"); + + printf("radio_linux: setting bandwidth to %skHz\n", band); +} + +void radio_setOpmode(const enum opmode mode) +{ + char *mod = (mode == FM) ? "FM" : "DMR"; + printf("radio_linux: setting opmode to %s", mod); +} + +void radio_setVcoFrequency(const freq_t frequency, const bool isTransmitting) +{ + char *txrx = isTransmitting ? "RX" : "RX"; + printf("radio_linux: setting %s VCO frequency to %d\n", txrx, frequency); +} + +void radio_setCSS(const tone_t rxCss, const tone_t txCss) +{ + printf("radio_linux: setting CTCSS: RX to %.1f and TX to %.1f\n", + rxCss/10.0f, txCss/10.0f); +} + +bool radio_checkRxDigitalSquelch() +{ + puts("radio_linux: radio_checkRxDigitalSquelch(), returning 'true'"); + return true; +} + +void radio_enableRx() +{ + puts("radio_linux: enableRx() called"); +} + +void radio_enableTx(const float txPower, const bool enableCss) +{ + printf("radio_linux: enabling TX with output power of %.2fW and CTCSS %s\n", + txPower, enableCss ? "enabled" : "disabled"); +} + +void radio_disableRtx() +{ + puts("radio_linux: disableRtx() called"); +} + +void radio_updateCalibrationParams(const rtxStatus_t* rtxCfg) +{ + (void) rtxCfg; + puts("radio_linux: updateCalibrationParams() called"); +} + +float radio_getRssi(const freq_t rxFreq) +{ + printf("radio_linux: requested RSSI at freq %d, returning -100dBm\n", rxFreq); + return -100.0f; +}