no-OS
swiot.h
Go to the documentation of this file.
1 /***************************************************************************/
39 #ifndef IIO_SWIOT_H
40 #define IIO_SWIOT_H
41 
42 #include <stdbool.h>
43 #include "no_os_gpio.h"
44 #include "ad74413r.h"
45 #include "iio_ad74413r.h"
46 #include "max14906.h"
47 #include "iio_max14906.h"
48 #include "adin1110.h"
49 
50 #define SWIOT_CHANNELS 4
51 
52 static const char *const ad74413r_function_available[] = {
53  [AD74413R_HIGH_Z] = "high_z",
54  [AD74413R_VOLTAGE_OUT] = "voltage_out",
55  [AD74413R_CURRENT_OUT] = "current_out",
56  [AD74413R_VOLTAGE_IN] = "voltage_in",
57  [AD74413R_CURRENT_IN_EXT] = "current_in_ext",
58  [AD74413R_CURRENT_IN_LOOP] = "current_in_loop",
59  [AD74413R_RESISTANCE] = "resistance",
60  [AD74413R_DIGITAL_INPUT] = "digital_input",
61  [AD74413R_DIGITAL_INPUT_LOOP] = "digital_input_loop",
62  [AD74413R_CURRENT_IN_EXT_HART] = "current_in_ext_hart",
63  [AD74413R_CURRENT_IN_LOOP_HART] = "current_in_loop_hart"
64 };
65 
70 };
71 
72 enum swiot_mode {
75 };
76 
78  bool enabled;
80  uint32_t function;
81 };
82 
85  struct max149x6_iio_desc *max14906;
88  uint32_t active_channels;
90 
95 
100 };
101 
104  struct max149x6_iio_desc *max14906;
108 };
109 
110 int swiot_iio_init(struct swiot_iio_desc **,
111  struct swiot_iio_desc_init_param *);
112 int swiot_iio_remove(struct swiot_iio_desc *);
113 
114 #endif
swiot_iio_desc_init_param::mode
enum swiot_mode mode
Definition: swiot.h:107
swiot_iio_desc_init_param
Definition: swiot.h:102
no_os_alloc.h
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:85
END_ATTRIBUTES_ARRAY
#define END_ATTRIBUTES_ARRAY
Definition: iio_types.h:122
swiot_iio_desc::iio_dev
struct iio_device * iio_dev
Definition: swiot.h:87
swiot_iio_desc::ad74413r
struct ad74413r_iio_desc * ad74413r
Definition: swiot.h:84
IIO_VAL_INT
@ IIO_VAL_INT
Definition: iio_types.h:56
swiot_iio_desc_init_param::ad74413r
struct ad74413r_iio_desc * ad74413r
Definition: swiot.h:103
swiot_iio_desc::mode_change
bool mode_change
Definition: swiot.h:92
ad74413r_channel_config::enabled
bool enabled
Definition: ad74413r.h:320
ad74413r_diag_channel_config
Diagnostics channel state.
Definition: iio_ad74413r.h:56
swiot_config_state::device
enum swiot_device device
Definition: swiot.h:79
AD74413R_CURRENT_OUT
@ AD74413R_CURRENT_OUT
Definition: ad74413r.h:202
swiot_iio_desc::max14906
struct max149x6_iio_desc * max14906
Definition: swiot.h:85
iio_ch_info
Structure holding channel attributess.
Definition: iio_types.h:109
no_os_gpio_get_value
int32_t no_os_gpio_get_value(struct no_os_gpio_desc *desc, uint8_t *value)
Get the value of the specified GPIO.
Definition: no_os_gpio.c:227
swiot_iio_desc::ad74413r_configs
struct ad74413r_channel_config ad74413r_configs[AD74413R_N_CHANNELS]
Definition: swiot.h:97
no_os_delay.h
Header file of Delay functions.
AD74413R_N_DIAG_CHANNELS
#define AD74413R_N_DIAG_CHANNELS
Definition: ad74413r.h:48
ad74413r_diag_channel_config::enabled
bool enabled
Definition: iio_ad74413r.h:57
swiot_iio_desc::active_channels
uint32_t active_channels
Definition: swiot.h:88
device
Definition: ad9361_util.h:75
swiot_iio_desc::ad74413r_diag_configs
struct ad74413r_diag_channel_config ad74413r_diag_configs[AD74413R_N_DIAG_CHANNELS]
Definition: swiot.h:98
AD74413R_N_CHANNELS
#define AD74413R_N_CHANNELS
Definition: ad74413r.h:47
AD74413R_CURRENT_IN_EXT_HART
@ AD74413R_CURRENT_IN_EXT_HART
Definition: ad74413r.h:209
swiot_iio_desc::no_of_active_channels
uint8_t no_of_active_channels
Definition: swiot.h:89
no_os_calloc
void * no_os_calloc(size_t nitems, size_t size)
Allocate memory and return a pointer to it, set memory to 0.
Definition: chibios_alloc.c:60
NO_OS_ARRAY_SIZE
#define NO_OS_ARRAY_SIZE(x)
Definition: no_os_util.h:55
no_os_gpio_direction_input
int32_t no_os_gpio_direction_input(struct no_os_gpio_desc *desc)
Enable the input direction of the specified GPIO.
Definition: no_os_gpio.c:130
ad7616_init_param::mode
enum ad7616_mode mode
Definition: ad7616.h:232
SWIOT_CONFIG
@ SWIOT_CONFIG
Definition: swiot.h:73
AD74413R_VOLTAGE_OUT
@ AD74413R_VOLTAGE_OUT
Definition: ad74413r.h:201
swiot_config_state
Definition: swiot.h:77
adin1110.h
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: aducm3029_delay.c:132
SWIOT_DEV_CNT
@ SWIOT_DEV_CNT
Definition: swiot.h:69
MAX14906_HIGH_Z
@ MAX14906_HIGH_Z
Definition: max14906.h:93
iio.h
Header file of iio.
iio_max14906.h
Header file of MAX14906 IIO Driver.
iio_attribute::name
const char * name
Definition: iio_types.h:137
swiot_iio_desc::identify_gpio
struct no_os_gpio_desc * identify_gpio
Definition: swiot.h:94
SWIOT_CHANNELS
#define SWIOT_CHANNELS
Definition: swiot.h:50
ad74413r_channel_config::function
enum ad74413r_op_mode function
Definition: ad74413r.h:321
swiot_config_state::enabled
bool enabled
Definition: swiot.h:78
iio_attribute
Structure holding pointers to show and store functions.
Definition: iio_types.h:135
swiot_config_state::function
uint32_t function
Definition: swiot.h:80
swiot_iio_desc::adin1110
struct adin1110_desc * adin1110
Definition: swiot.h:86
ad74413r_iio_desc
Descriptor that stores a iio specific state.
Definition: iio_ad74413r.h:81
ad74413r_diag_channel_config::function
enum ad74413r_diag_mode function
Definition: iio_ad74413r.h:58
swiot_device
swiot_device
Definition: swiot.h:66
no_os_gpio_remove
int32_t no_os_gpio_remove(struct no_os_gpio_desc *desc)
Free the resources allocated by no_os_gpio_get().
Definition: no_os_gpio.c:110
ad74413r.h
Header file of AD74413r Driver.
AD74413R_DIGITAL_INPUT
@ AD74413R_DIGITAL_INPUT
Definition: ad74413r.h:207
max14906_ch_config::enabled
bool enabled
Definition: iio_max14906.h:53
no_os_gpio_desc
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:102
swiot_iio_desc::mode
enum swiot_mode mode
Definition: swiot.h:91
swiot_iio_remove
int swiot_iio_remove(struct swiot_iio_desc *swiot_desc)
Free the swiot iio descriptor.
Definition: swiot.c:703
swiot_iio_desc
Definition: swiot.h:83
iio_ad74413r.h
Header file of the IIO AD74413r Driver.
no_os_gpio_get
int32_t no_os_gpio_get(struct no_os_gpio_desc **desc, const struct no_os_gpio_init_param *param)
Obtain the GPIO decriptor.
Definition: no_os_gpio.c:55
swiot.h
Header file for the swiot IIO device.
SWIOT_RUNTIME
@ SWIOT_RUNTIME
Definition: swiot.h:74
AD74413R_CURRENT_IN_LOOP
@ AD74413R_CURRENT_IN_LOOP
Definition: ad74413r.h:205
MAX14906_CHANNELS
#define MAX14906_CHANNELS
Definition: max14906.h:49
swiot_iio_init
int swiot_iio_init(struct swiot_iio_desc **, struct swiot_iio_desc_init_param *)
Initializes the swiot IIO descriptor.
Definition: swiot.c:648
iio_format_value
int iio_format_value(char *buf, uint32_t len, enum iio_val fmt, int32_t size, int32_t *vals)
Definition: iio.c:667
AD74413R_RESISTANCE
@ AD74413R_RESISTANCE
Definition: ad74413r.h:206
AD74413R_CURRENT_IN_EXT
@ AD74413R_CURRENT_IN_EXT
Definition: ad74413r.h:204
swiot_iio_desc_init_param::psu_gpio_param
struct no_os_gpio_init_param psu_gpio_param
Definition: swiot.h:105
SWIOT_AD74413R
@ SWIOT_AD74413R
Definition: swiot.h:67
no_os_gpio_set_value
int32_t no_os_gpio_set_value(struct no_os_gpio_desc *desc, uint8_t value)
Set the value of the specified GPIO.
Definition: no_os_gpio.c:203
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:119
max14906.h
Header file of MAX14906 Driver.
swiot_iio_desc_init_param::max14906
struct max149x6_iio_desc * max14906
Definition: swiot.h:104
iio_device
Structure holding channels and attributes of a device.
Definition: iio_types.h:253
ad74413r_channel_config
Device channel state.
Definition: ad74413r.h:319
adin1110_desc
ADIN1110 device descriptor.
Definition: adin1110.h:205
swiot_iio_desc_init_param::identify_gpio_param
struct no_os_gpio_init_param identify_gpio_param
Definition: swiot.h:106
AD74413R_DIGITAL_INPUT_LOOP
@ AD74413R_DIGITAL_INPUT_LOOP
Definition: ad74413r.h:208
max14906_ch_config
Configuration structure for a MAX14906 channel.
Definition: iio_max14906.h:52
AD74413R_DIAG_AGND
@ AD74413R_DIAG_AGND
Definition: ad74413r.h:248
AD74413R_HIGH_Z
@ AD74413R_HIGH_Z
Definition: ad74413r.h:200
no_os_gpio.h
Header file of GPIO Interface.
swiot_iio_desc::max14906_configs
struct max14906_ch_config max14906_configs[MAX14906_CHANNELS]
Definition: swiot.h:96
swiot_iio_desc::psu_gpio
struct no_os_gpio_desc * psu_gpio
Definition: swiot.h:93
no_os_gpio_direction_output
int32_t no_os_gpio_direction_output(struct no_os_gpio_desc *desc, uint8_t value)
Enable the output direction of the specified GPIO.
Definition: no_os_gpio.c:153
SWIOT_MAX14906
@ SWIOT_MAX14906
Definition: swiot.h:68
swiot_iio_init
int swiot_iio_init(struct swiot_iio_desc **swiot_desc, struct swiot_iio_desc_init_param *init_param)
Initializes the swiot IIO descriptor.
Definition: swiot.c:648
swiot_iio_remove
int swiot_iio_remove(struct swiot_iio_desc *)
Free the swiot iio descriptor.
Definition: swiot.c:703
AD74413R_CURRENT_IN_LOOP_HART
@ AD74413R_CURRENT_IN_LOOP_HART
Definition: ad74413r.h:210
errno.h
Error macro definition for ARM Compiler.
swiot_mode
swiot_mode
Definition: swiot.h:72
iio_device::attributes
struct iio_attribute * attributes
Definition: iio_types.h:262
AD74413R_VOLTAGE_IN
@ AD74413R_VOLTAGE_IN
Definition: ad74413r.h:203
max14906_ch_config::function
enum max14906_function function
Definition: iio_max14906.h:54