no-OS
swiot.h
Go to the documentation of this file.
1 /***************************************************************************/
33 #ifndef IIO_SWIOT_H
34 #define IIO_SWIOT_H
35 
36 #include <stdbool.h>
37 #include "no_os_gpio.h"
38 #include "ad74413r.h"
39 #include "iio_ad74413r.h"
40 #include "max14906.h"
41 #include "iio_max14906.h"
42 #include "adin1110.h"
43 
44 #define SWIOT_CHANNELS 4
45 
46 static const char *const ad74413r_function_available[] = {
47  [AD74413R_HIGH_Z] = "high_z",
48  [AD74413R_VOLTAGE_OUT] = "voltage_out",
49  [AD74413R_CURRENT_OUT] = "current_out",
50  [AD74413R_VOLTAGE_IN] = "voltage_in",
51  [AD74413R_CURRENT_IN_EXT] = "current_in_ext",
52  [AD74413R_CURRENT_IN_LOOP] = "current_in_loop",
53  [AD74413R_RESISTANCE] = "resistance",
54  [AD74413R_DIGITAL_INPUT] = "digital_input",
55  [AD74413R_DIGITAL_INPUT_LOOP] = "digital_input_loop",
56  [AD74413R_CURRENT_IN_EXT_HART] = "current_in_ext_hart",
57  [AD74413R_CURRENT_IN_LOOP_HART] = "current_in_loop_hart"
58 };
59 
64 };
65 
66 enum swiot_mode {
69 };
70 
72  bool enabled;
74  uint32_t function;
75 };
76 
79  struct max149x6_iio_desc *max14906;
82  uint32_t active_channels;
84 
89 
94 };
95 
98  struct max149x6_iio_desc *max14906;
102 };
103 
104 int swiot_iio_init(struct swiot_iio_desc **,
105  struct swiot_iio_desc_init_param *);
106 int swiot_iio_remove(struct swiot_iio_desc *);
107 
108 #endif
swiot_iio_desc_init_param::mode
enum swiot_mode mode
Definition: swiot.h:101
swiot_iio_desc_init_param
Definition: swiot.h:96
no_os_alloc.h
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:79
END_ATTRIBUTES_ARRAY
#define END_ATTRIBUTES_ARRAY
Definition: iio_types.h:116
swiot_iio_desc::iio_dev
struct iio_device * iio_dev
Definition: swiot.h:81
swiot_iio_desc::ad74413r
struct ad74413r_iio_desc * ad74413r
Definition: swiot.h:78
IIO_VAL_INT
@ IIO_VAL_INT
Definition: iio_types.h:50
swiot_iio_desc_init_param::ad74413r
struct ad74413r_iio_desc * ad74413r
Definition: swiot.h:97
swiot_iio_desc::mode_change
bool mode_change
Definition: swiot.h:86
ad74413r_channel_config::enabled
bool enabled
Definition: ad74413r.h:314
ad74413r_diag_channel_config
Diagnostics channel state.
Definition: iio_ad74413r.h:50
swiot_config_state::device
enum swiot_device device
Definition: swiot.h:73
AD74413R_CURRENT_OUT
@ AD74413R_CURRENT_OUT
Definition: ad74413r.h:196
swiot_iio_desc::max14906
struct max149x6_iio_desc * max14906
Definition: swiot.h:79
iio_ch_info
Structure holding channel attributess.
Definition: iio_types.h:103
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:221
swiot_iio_desc::ad74413r_configs
struct ad74413r_channel_config ad74413r_configs[AD74413R_N_CHANNELS]
Definition: swiot.h:91
no_os_delay.h
Header file of Delay functions.
AD74413R_N_DIAG_CHANNELS
#define AD74413R_N_DIAG_CHANNELS
Definition: ad74413r.h:42
ad74413r_diag_channel_config::enabled
bool enabled
Definition: iio_ad74413r.h:51
swiot_iio_desc::active_channels
uint32_t active_channels
Definition: swiot.h:82
device
Definition: ad9361_util.h:69
swiot_iio_desc::ad74413r_diag_configs
struct ad74413r_diag_channel_config ad74413r_diag_configs[AD74413R_N_DIAG_CHANNELS]
Definition: swiot.h:92
AD74413R_N_CHANNELS
#define AD74413R_N_CHANNELS
Definition: ad74413r.h:41
AD74413R_CURRENT_IN_EXT_HART
@ AD74413R_CURRENT_IN_EXT_HART
Definition: ad74413r.h:203
swiot_iio_desc::no_of_active_channels
uint8_t no_of_active_channels
Definition: swiot.h:83
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:54
NO_OS_ARRAY_SIZE
#define NO_OS_ARRAY_SIZE(x)
Definition: no_os_util.h:49
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:124
ad7616_init_param::mode
enum ad7616_mode mode
Definition: ad7616.h:226
SWIOT_CONFIG
@ SWIOT_CONFIG
Definition: swiot.h:67
AD74413R_VOLTAGE_OUT
@ AD74413R_VOLTAGE_OUT
Definition: ad74413r.h:195
swiot_config_state
Definition: swiot.h:71
adin1110.h
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: aducm3029_delay.c:126
SWIOT_DEV_CNT
@ SWIOT_DEV_CNT
Definition: swiot.h:63
MAX14906_HIGH_Z
@ MAX14906_HIGH_Z
Definition: max14906.h:87
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:131
swiot_iio_desc::identify_gpio
struct no_os_gpio_desc * identify_gpio
Definition: swiot.h:88
SWIOT_CHANNELS
#define SWIOT_CHANNELS
Definition: swiot.h:44
ad74413r_channel_config::function
enum ad74413r_op_mode function
Definition: ad74413r.h:315
swiot_config_state::enabled
bool enabled
Definition: swiot.h:72
iio_attribute
Structure holding pointers to show and store functions.
Definition: iio_types.h:129
swiot_config_state::function
uint32_t function
Definition: swiot.h:74
swiot_iio_desc::adin1110
struct adin1110_desc * adin1110
Definition: swiot.h:80
ad74413r_iio_desc
Descriptor that stores a iio specific state.
Definition: iio_ad74413r.h:75
ad74413r_diag_channel_config::function
enum ad74413r_diag_mode function
Definition: iio_ad74413r.h:52
swiot_device
swiot_device
Definition: swiot.h:60
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:104
ad74413r.h
Header file of AD74413r Driver.
AD74413R_DIGITAL_INPUT
@ AD74413R_DIGITAL_INPUT
Definition: ad74413r.h:201
max14906_ch_config::enabled
bool enabled
Definition: iio_max14906.h:47
no_os_gpio_desc
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:96
swiot_iio_desc::mode
enum swiot_mode mode
Definition: swiot.h:85
swiot_iio_remove
int swiot_iio_remove(struct swiot_iio_desc *swiot_desc)
Free the swiot iio descriptor.
Definition: swiot.c:697
swiot_iio_desc
Definition: swiot.h:77
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:49
swiot.h
Header file for the swiot IIO device.
SWIOT_RUNTIME
@ SWIOT_RUNTIME
Definition: swiot.h:68
AD74413R_CURRENT_IN_LOOP
@ AD74413R_CURRENT_IN_LOOP
Definition: ad74413r.h:199
MAX14906_CHANNELS
#define MAX14906_CHANNELS
Definition: max14906.h:43
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:642
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:686
AD74413R_RESISTANCE
@ AD74413R_RESISTANCE
Definition: ad74413r.h:200
AD74413R_CURRENT_IN_EXT
@ AD74413R_CURRENT_IN_EXT
Definition: ad74413r.h:198
swiot_iio_desc_init_param::psu_gpio_param
struct no_os_gpio_init_param psu_gpio_param
Definition: swiot.h:99
SWIOT_AD74413R
@ SWIOT_AD74413R
Definition: swiot.h:61
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:197
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
max14906.h
Header file of MAX14906 Driver.
swiot_iio_desc_init_param::max14906
struct max149x6_iio_desc * max14906
Definition: swiot.h:98
iio_device
Structure holding channels and attributes of a device.
Definition: iio_types.h:247
ad74413r_channel_config
Device channel state.
Definition: ad74413r.h:313
adin1110_desc
ADIN1110 device descriptor.
Definition: adin1110.h:199
swiot_iio_desc_init_param::identify_gpio_param
struct no_os_gpio_init_param identify_gpio_param
Definition: swiot.h:100
AD74413R_DIGITAL_INPUT_LOOP
@ AD74413R_DIGITAL_INPUT_LOOP
Definition: ad74413r.h:202
max14906_ch_config
Configuration structure for a MAX14906 channel.
Definition: iio_max14906.h:46
AD74413R_DIAG_AGND
@ AD74413R_DIAG_AGND
Definition: ad74413r.h:242
AD74413R_HIGH_Z
@ AD74413R_HIGH_Z
Definition: ad74413r.h:194
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:90
swiot_iio_desc::psu_gpio
struct no_os_gpio_desc * psu_gpio
Definition: swiot.h:87
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:147
SWIOT_MAX14906
@ SWIOT_MAX14906
Definition: swiot.h:62
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:642
swiot_iio_remove
int swiot_iio_remove(struct swiot_iio_desc *)
Free the swiot iio descriptor.
Definition: swiot.c:697
AD74413R_CURRENT_IN_LOOP_HART
@ AD74413R_CURRENT_IN_LOOP_HART
Definition: ad74413r.h:204
errno.h
Error macro definition for ARM Compiler.
swiot_mode
swiot_mode
Definition: swiot.h:66
iio_device::attributes
struct iio_attribute * attributes
Definition: iio_types.h:256
AD74413R_VOLTAGE_IN
@ AD74413R_VOLTAGE_IN
Definition: ad74413r.h:197
max14906_ch_config::function
enum max14906_function function
Definition: iio_max14906.h:48