From 39e46c69fed5bae9c877cdd59dd7c268a666607b Mon Sep 17 00:00:00 2001 From: "Ionut.Muthi" Date: Thu, 13 Oct 2022 07:49:31 +0100 Subject: [PATCH] streaming for AD9208 --- +adi/+AD9208/Base.m | 75 +++++++++++++++++++++++++++++++++++++++++++++ +adi/+AD9208/Rx.m | 61 ++++++++++++++++++++++++++++++++++++ 2 files changed, 136 insertions(+) create mode 100644 +adi/+AD9208/Base.m create mode 100644 +adi/+AD9208/Rx.m diff --git a/+adi/+AD9208/Base.m b/+adi/+AD9208/Base.m new file mode 100644 index 00000000..cf5c999f --- /dev/null +++ b/+adi/+AD9208/Base.m @@ -0,0 +1,75 @@ +classdef (Abstract) Base < ... + adi.common.RxTx & ... + matlabshared.libiio.base + %AD9208 Base Class + + properties (Nontunable) + %SamplesPerFrame Samples Per Frame + % Number of samples per frame, specified as an even positive + % integer from 2 to 16,777,216. Using values less than 3660 can + % yield poor performance. + SamplesPerFrame = 2^15; + end + + properties(Nontunable, Hidden) + Timeout = Inf; + kernelBuffersCount = 2; + dataTypeStr = 'int16'; + end + + properties (Abstract, Hidden, Constant) + Type + end + + properties (Hidden, Constant) + ComplexData = false; + end + + methods + %% Constructor + function obj = Base(varargin) + % Returns the matlabshared.libiio.base object + coder.allowpcode('plain'); + obj = obj@matlabshared.libiio.base(varargin{:}); + end + % Check SamplesPerFrame + function set.SamplesPerFrame(obj, value) + validateattributes( value, { 'double','single' }, ... + { 'real', 'positive','scalar', 'finite', 'nonnan', 'nonempty','integer','>',0,'<',2^20+1}, ... + '', 'SamplesPerFrame'); + obj.SamplesPerFrame = value; + end + end + + %% API Functions + methods (Hidden, Access = protected) + + function icon = getIconImpl(obj) + icon = sprintf(['AD9208 ',obj.Type]); + end + + function setupInit(~) + % Unused + end + + end + + %% External Dependency Methods + methods (Hidden, Static) + + function tf = isSupportedContext(bldCfg) + tf = matlabshared.libiio.ExternalDependency.isSupportedContext(bldCfg); + end + + function updateBuildInfo(buildInfo, bldCfg) + % Call the matlabshared.libiio.method first + matlabshared.libiio.ExternalDependency.updateBuildInfo(buildInfo, bldCfg); + end + + function bName = getDescriptiveName(~) + bName = 'AD9208'; + end + + end +end + diff --git a/+adi/+AD9208/Rx.m b/+adi/+AD9208/Rx.m new file mode 100644 index 00000000..d56a42ee --- /dev/null +++ b/+adi/+AD9208/Rx.m @@ -0,0 +1,61 @@ +classdef Rx < adi.common.Rx & adi.AD9208.Base + % adi.AD9208.Rx Receive data from the AD9208 high speed multi-channel ADC + % The adi.AD9208.Rx System object is a signal source that can receive + % data from the AD9208. + % + % rx = adi.AD9208.Rx; + % rx = adi.AD9208.Rx('uri','192.168.2.1'); + % + % AD9208 Datasheet + % + + properties (Constant) + %SamplingRate Sampling Rate + % Baseband sampling rate in Hz, specified as a scalar + % in samples per second. This value is constant + SamplingRate = 125e6; + end + properties (Hidden, Nontunable, Access = protected) + isOutput = false; + end + + properties(Nontunable, Hidden, Constant) + Type = 'Rx'; + end + + properties (Nontunable, Hidden) + devName = 'axi-AD9208-rx-hpc'; + channel_names = {... + 'voltage0',... + 'voltage1',... + }; + end + + methods + %% Constructor + function obj = Rx(varargin) + % Returns the matlabshared.libiio.base object + coder.allowpcode('plain'); + obj = obj@adi.AD9208.Base(varargin{:}); + end + end + + %% External Dependency Methods + methods (Hidden, Static) + + function tf = isSupportedContext(bldCfg) + tf = matlabshared.libiio.ExternalDependency.isSupportedContext(bldCfg); + end + + function updateBuildInfo(buildInfo, bldCfg) + % Call the matlabshared.libiio.method first + matlabshared.libiio.ExternalDependency.updateBuildInfo(buildInfo, bldCfg); + end + + function bName = getDescriptiveName(~) + bName = 'AD9208'; + end + + end +end +