Skip to content

Commit

Permalink
First commit of updates against libiio v1.0
Browse files Browse the repository at this point in the history
Signed-off-by: Pagadarai <[email protected]>
  • Loading branch information
SrikanthPagadarai committed Jun 3, 2024
1 parent 6a91d5c commit 69ed4b7
Show file tree
Hide file tree
Showing 7 changed files with 443 additions and 1 deletion.
2 changes: 1 addition & 1 deletion +adi/+common
23 changes: 23 additions & 0 deletions +adi/+libiio/base.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
classdef (Abstract) base < adi.libiio.device & ...
adi.libiio.channel & ...
adi.libiio.context & ...
adi.libiio.top & ...
adi.libiio.low_level & ...
matlab.System
properties(Hidden, Access = protected, Nontunable, Dependent)
libraryVersion_v1
end

methods
function version = get.libraryVersion_v1(obj)
version = '1.0';
end
end

%{
methods (Hidden, Access = {?handle})
function devPtr = getDev(obj, name)
end
end
%}
end
95 changes: 95 additions & 0 deletions +adi/+libiio/channel.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
classdef (Abstract) channel < handle & matlabshared.libiio.channel
% matlabshared.libiio.channel_V1p0 channel class for base matlabshared.libiio.support
%
% This abstract system object defines the APIs necessary to use libIIO
% V1.0 for MATLAB/Simulink simulation as well as codegen on a Linux
% target

% Copyright 2024 Analog Devices Inc.
%#codegen

%% Abstract Properties
properties(Abstract, Hidden, Access = protected)
libName
end

methods
function obj = channel()
% CHANNEL constructor method for matlabshared.libiio.context
%
% Returns the matlabshared.libiio.context object
coder.allowpcode('plain');
end
end

%% Internal Helper Functions
methods (Hidden, Access = {?handle})
function iio_channel_get_device(obj)
end

function iio_channel_get_id(obj)
end

function iio_channel_get_name(obj)
end

function iio_channel_is_output(obj)
end

function iio_channel_is_scan_element(obj)
end

function iio_channel_get_attrs_count(obj)
end

function iio_channel_get_attr(obj)
end

function iio_channel_find_attr(obj)
end

function iio_channel_enable(obj)
end

function iio_channel_disable(obj)
end

function iio_channel_is_enabled(obj)
end

function iio_channel_read(obj)
end

function iio_channel_write(obj)
end

function iio_channel_set_data(obj)
end

function iio_channel_get_data(obj)
end

function iio_channel_get_type(obj)
end

function iio_channel_get_modifier(obj)
end

function status = iio_channel_attr_write_longlong(obj,chanPtr,attr,value)
% This function is a wrapper. Its name is chosen to match the
% corresponding version in < v1.0 to support compatibility
% through Compat.m.

attrPtr = calllib(obj.libName, 'iio_channel_find_attr', chanPtr, attr);
status = calllib(obj.libName, 'iio_attr_write_longlong', attrPtr,value);
end

function iio_channel_attr_read_longlong(obj)
% This function is a wrapper. It calls iio_channel_read() for
% longlong input. Its name is chosen to match the
% corresponding version in < v1.0 to support compatibility
% through Compat.m.
iio_channel_read(obj);
end
end
end
94 changes: 94 additions & 0 deletions +adi/+libiio/context.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
classdef (Abstract) context < matlabshared.libiio.context & ...
matlabshared.libiio.device
% matlabshared.libiio.contextV1p0 context class for base matlabshared.libiio.support
%
% This abstract system object defines the APIs necessary to use libIIO
% V1.0 for MATLAB/Simulink simulation as well as codegen on a Linux
% target

% Copyright 2024 Analog Devices Inc.
%#codegen

%% Abstract Properties
properties(Abstract, Hidden, Access = protected)
libName
end

methods
function obj = context()
% CONTEXT constructor method for matlabshared.libiio.context
%
% Returns the matlabshared.libiio.context object
coder.allowpcode('plain');
end
end

%% Internal Helper Functions
methods (Hidden, Access = {?handle})
%% Context Methods
function ctxPtr = iio_create_context(obj, ctxParamsPtr, uri)
% iio_create_context_from_uri (const char *uri)
%
% Create a context from a URI description.
if useCalllib(obj)
ctxPtr = calllib(obj.libName, 'iio_create_context', ctxParamsPtr, uri);
else
ctxPtr = coder.opaque('struct iio_context*', 'NULL');
if useCodegen(obj)
ctxPtr = coder.ceval('iio_create_context', ctxParamsPtr, obj.ntstr(uri));
end
end
end

function iio_context_destroy(obj)
end

function iio_context_get_version_major(obj)
end

function iio_context_get_version_minor(obj)
end

function iio_context_get_version_tag(obj)
end

function iio_context_get_xml(obj)
end

function iio_context_get_name(obj)
end

function iio_context_get_description(obj)
end

function iio_context_get_attrs_count(obj)
end

function iio_context_get_attr(obj)
end

function iio_context_find_attr(obj)
end

function iio_context_get_devices_count(obj)
end

function iio_context_get_device(obj)
end

function iio_context_find_device(obj)
end

function iio_context_set_timeout(obj)
end

function iio_context_get_params(obj)
end

function iio_context_set_data(obj)
end

function iio_context_get_data(obj)
end
end
end
85 changes: 85 additions & 0 deletions +adi/+libiio/device.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
classdef (Abstract) device < handle & matlabshared.libiio.device
% matlabshared.libiio.contextV1p0 context class for base matlabshared.libiio.support
%
% This abstract system object defines the APIs necessary to use libIIO
% V1.0 for MATLAB/Simulink simulation as well as codegen on a Linux
% target

% Copyright 2024 Analog Devices Inc.
%#codegen

%% Abstract Properties
properties(Abstract, Hidden, Access = protected)
libName
end

methods
function obj = device()
% CONTEXT constructor method for matlabshared.libiio.context
%
% Returns the matlabshared.libiio.context object
coder.allowpcode('plain');
end
end

%% Internal Helper Functions
methods (Hidden, Access = {?handle})
%% Device Methods
function ctxPtr = iio_device_get_context(obj, devPtr)
% iio_device_get_context (const char *uri)
%
% Get context from device pointer.
if useCalllib(obj)
ctxPtr = calllib(obj.libName, 'iio_device_get_context', devPtr);
else
ctxPtr = coder.opaque('struct iio_context*', 'NULL');
if useCodegen(obj)
ctxPtr = coder.ceval('iio_device_get_context', devPtr);
end
end
end

function iio_device_get_id(obj)
end

function iio_device_get_name(obj)
end

function iio_device_get_label(obj)
end

function iio_device_get_channels_count(obj)
end

function iio_device_get_attrs_count(obj)
end

function iio_device_get_channel(obj)
% [email protected](obj);
end

function iio_device_get_attr(obj)
end

function chanPtr = iio_device_find_channel(obj,dev,id,output)
end

function iio_device_find_attr(obj)
end

function iio_device_set_data(obj)
end

function iio_device_get_data(obj)
end

function iio_device_get_trigger(obj)
end

function iio_device_set_trigger(obj)
end

function iio_device_is_trigger(obj)
end
end
end
Loading

0 comments on commit 69ed4b7

Please sign in to comment.