From 6c19fe3c46321647363fda0615af9f60639cdcf4 Mon Sep 17 00:00:00 2001 From: "Paul R. Tagliamonte" Date: Fri, 26 May 2023 12:44:43 -0400 Subject: [PATCH 1/2] [adrv9364] Start to add support for the ADRV9364-Z7020 Specifically, I'm using a ADRV9364-Z7020 with a ADRV1CRR-BOB, which is an Analog device accessable over libiio. This is going to be a bit of a refactor on the PlutoSDR backend at the same time. --- adrv9364/adrv9364.go | 31 ++++++++++++++++++++++++++++++ adrv9364/doc.go | 25 ++++++++++++++++++++++++ go.mod | 10 ++++++++-- go.sum | 2 ++ {pluto => internal}/iio/buffer.go | 0 {pluto => internal}/iio/channel.go | 0 {pluto => internal}/iio/context.go | 0 {pluto => internal}/iio/device.go | 0 {pluto => internal}/iio/doc.go | 0 {pluto => internal}/iio/static.go | 0 pluto/pluto.go | 2 +- pluto/rx.go | 2 +- pluto/tx.go | 2 +- pluto/tx_cyclic.go | 2 +- 14 files changed, 70 insertions(+), 6 deletions(-) create mode 100644 adrv9364/adrv9364.go create mode 100644 adrv9364/doc.go rename {pluto => internal}/iio/buffer.go (100%) rename {pluto => internal}/iio/channel.go (100%) rename {pluto => internal}/iio/context.go (100%) rename {pluto => internal}/iio/device.go (100%) rename {pluto => internal}/iio/doc.go (100%) rename {pluto => internal}/iio/static.go (100%) diff --git a/adrv9364/adrv9364.go b/adrv9364/adrv9364.go new file mode 100644 index 0000000..3920ca4 --- /dev/null +++ b/adrv9364/adrv9364.go @@ -0,0 +1,31 @@ +// {{{ Copyright (c) Paul R. Tagliamonte , 2020-2023 +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. }}} + +package adrv9364 + +import ( + "hz.tools/sdr/debug" +) + +func init() { + debug.RegisterRadioDriver("hz.tools/sdr/adrv9364.Sdr") +} + +// vim: foldmethod=marker diff --git a/adrv9364/doc.go b/adrv9364/doc.go new file mode 100644 index 0000000..948eea9 --- /dev/null +++ b/adrv9364/doc.go @@ -0,0 +1,25 @@ +// {{{ Copyright (c) Paul R. Tagliamonte , 2020-2023 +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. }}} + +// Package adrv9364 contains an sdr.Sdr implementation for the Analog Devices +// ADRV9364-Z7020 (Z7020/AD9364) mounted on a ADRV1CRR-BOB. +package adrv9364 + +// vim: foldmethod=marker diff --git a/go.mod b/go.mod index 18bf9fe..c016aa7 100644 --- a/go.mod +++ b/go.mod @@ -1,9 +1,15 @@ module hz.tools/sdr -go 1.14 +go 1.19 require ( github.com/mattn/go-pointer v0.0.1 - github.com/stretchr/testify v1.8.1 + github.com/stretchr/testify v1.8.3 hz.tools/rf v0.0.7 ) + +require ( + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/pmezard/go-difflib v1.0.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/go.sum b/go.sum index 61a5064..8723c47 100644 --- a/go.sum +++ b/go.sum @@ -13,6 +13,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= +github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/pluto/iio/buffer.go b/internal/iio/buffer.go similarity index 100% rename from pluto/iio/buffer.go rename to internal/iio/buffer.go diff --git a/pluto/iio/channel.go b/internal/iio/channel.go similarity index 100% rename from pluto/iio/channel.go rename to internal/iio/channel.go diff --git a/pluto/iio/context.go b/internal/iio/context.go similarity index 100% rename from pluto/iio/context.go rename to internal/iio/context.go diff --git a/pluto/iio/device.go b/internal/iio/device.go similarity index 100% rename from pluto/iio/device.go rename to internal/iio/device.go diff --git a/pluto/iio/doc.go b/internal/iio/doc.go similarity index 100% rename from pluto/iio/doc.go rename to internal/iio/doc.go diff --git a/pluto/iio/static.go b/internal/iio/static.go similarity index 100% rename from pluto/iio/static.go rename to internal/iio/static.go diff --git a/pluto/pluto.go b/pluto/pluto.go index 4e14a0e..a30a29e 100644 --- a/pluto/pluto.go +++ b/pluto/pluto.go @@ -26,7 +26,7 @@ import ( "hz.tools/rf" "hz.tools/sdr" "hz.tools/sdr/debug" - "hz.tools/sdr/pluto/iio" + "hz.tools/sdr/internal/iio" ) func init() { diff --git a/pluto/rx.go b/pluto/rx.go index 4520349..0c665ed 100644 --- a/pluto/rx.go +++ b/pluto/rx.go @@ -25,7 +25,7 @@ import ( "unsafe" "hz.tools/sdr" - "hz.tools/sdr/pluto/iio" + "hz.tools/sdr/internal/iio" "hz.tools/sdr/stream" ) diff --git a/pluto/tx.go b/pluto/tx.go index a8aed00..eaccc6f 100644 --- a/pluto/tx.go +++ b/pluto/tx.go @@ -25,7 +25,7 @@ import ( "unsafe" "hz.tools/sdr" - "hz.tools/sdr/pluto/iio" + "hz.tools/sdr/internal/iio" ) type tx struct { diff --git a/pluto/tx_cyclic.go b/pluto/tx_cyclic.go index 81d79dc..2e3a302 100644 --- a/pluto/tx_cyclic.go +++ b/pluto/tx_cyclic.go @@ -26,7 +26,7 @@ import ( "unsafe" "hz.tools/sdr" - "hz.tools/sdr/pluto/iio" + "hz.tools/sdr/internal/iio" ) // CyclicTx will transmit a specific buffer in a loop. If the buffer is to be From 7db73c5e2a24524018dc58e3b034413bcb8fcef8 Mon Sep 17 00:00:00 2001 From: "Paul R. Tagliamonte" Date: Thu, 22 Jun 2023 13:58:33 -0400 Subject: [PATCH 2/2] [adrv9364] Add in the device names I think I'll be using. I need to actually write the code here and check this works like the PlutoSDR does, and has a similar interface. --- adrv9364/adrv9364.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/adrv9364/adrv9364.go b/adrv9364/adrv9364.go index 3920ca4..d03646a 100644 --- a/adrv9364/adrv9364.go +++ b/adrv9364/adrv9364.go @@ -28,4 +28,18 @@ func init() { debug.RegisterRadioDriver("hz.tools/sdr/adrv9364.Sdr") } +var ( + // adrv9364PhyName is the name of the transceiver itself, used for control + // over things like samples per second or frequency. + adrv9364PhyName = "ad9361-phy" + + // adrv9364RxName is the name of the RX ADC, to read samples from the rx + // antenna. + adrv9364RxName = "cf-ad9361-lpc" + + // adrv9364TxName is the name of the TX DAC, to write samples to the + // tx side of the house. + adrv9364TxName = "cf-ad9361-dds-core-lpc" +) + // vim: foldmethod=marker