From 5b5a4ee08357f1bac784fda82a50eaad2d747d78 Mon Sep 17 00:00:00 2001 From: F5OEO Date: Thu, 27 Jun 2019 08:58:34 +0100 Subject: [PATCH] Work on PI4 --- app/Makefile | 4 ++-- app/testrpitx.cpp | 14 ++++++++++++-- src/Makefile | 4 ++-- src/gpio.cpp | 8 ++++++-- 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/app/Makefile b/app/Makefile index 189c248..3ea6f49 100644 --- a/app/Makefile +++ b/app/Makefile @@ -1,7 +1,7 @@ all: testrpitx -CFLAGS = -Wall -g -O3 -Wno-unused-variable -LDFLAGS = -lm -lrt -lpthread +CFLAGS = -Wall -g -O3 -Wno-unused-variable -I /opt/vc/include +LDFLAGS = -lm -lrt -lpthread -L/opt/vc/lib -lbcm_host CCP = g++ CC = gcc diff --git a/app/testrpitx.cpp b/app/testrpitx.cpp index 3a81b9b..95edf55 100644 --- a/app/testrpitx.cpp +++ b/app/testrpitx.cpp @@ -701,6 +701,13 @@ void SimpleTestAtv(uint64_t Freq) } } +void info(void) +{ + clkgpio clk; + clk.print_clock_tree(); + +} + static void terminate(int num) { @@ -723,7 +730,7 @@ int main(int argc, char *argv[]) sa.sa_handler = terminate; sigaction(i, &sa, NULL); } - dbg_setlevel(0); + dbg_setlevel(1); //SimpleTest(Freq); //SimpleTestbpsk(Freq); //SimpleTestFileIQ(Freq); @@ -733,6 +740,9 @@ int main(int argc, char *argv[]) //SimpleTestBurstFsk(Freq); //SimpleTestOOKTiming(Freq); //AlectoOOK(Freq); - RfSwitchOOK(Freq); + //RfSwitchOOK(Freq); + //SimpleTestbpsk(Freq); + //SimpleTestAtv(Freq); + info(); } diff --git a/src/Makefile b/src/Makefile index 4cc2324..012c34e 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,6 +1,6 @@ CFLAGS = -Wall -O3 -Wno-unused-variable -CXXFLAGS = -std=c++11 -Wall -O3 -Wno-unused-variable -LDFLAGS = -lm -lrt -lpthread +CXXFLAGS = -std=c++11 -Wall -O3 -Wno-unused-variable -I /opt/vc/include +LDFLAGS = -lm -lrt -lpthread -L/opt/vc/lib -lbcm_host CCP = c++ CC = cc diff --git a/src/gpio.cpp b/src/gpio.cpp index 3ae6c45..7156233 100644 --- a/src/gpio.cpp +++ b/src/gpio.cpp @@ -25,6 +25,8 @@ extern "C" { #include #include #include "util.h" +#include +//#include "/opt/vc/include/bcm_host.h" gpio::gpio(uint32_t base, uint32_t len) { @@ -42,7 +44,9 @@ gpio::~gpio() uint32_t gpio::GetPeripheralBase() { RASPBERRY_PI_INFO_T info; - uint32_t BCM2708_PERI_BASE = 0; + uint32_t BCM2708_PERI_BASE = bcm_host_get_peripheral_address(); + dbg_printf(1,"Peri Base = %x\n",BCM2708_PERI_BASE); + /* if (getRaspberryPiInformation(&info) > 0) { if (info.peripheralBase == RPI_BROADCOM_2835_PERIPHERAL_BASE) @@ -54,7 +58,7 @@ uint32_t gpio::GetPeripheralBase() { BCM2708_PERI_BASE = info.peripheralBase; } - } + }*/ return BCM2708_PERI_BASE; }