no-OS
iio_app.h
Go to the documentation of this file.
1 /***************************************************************************/
34 #ifndef IIO_APP
35 #define IIO_APP
36 
37 #include "iio.h"
38 #include "no_os_irq.h"
39 #include "no_os_uart.h"
40 #include "no_os_error.h"
41 #include "no_os_delay.h"
42 
43 #if defined(NO_OS_LWIP_NETWORKING)
44 #include "lwip_socket.h"
45 #endif
46 
47 #define IIO_APP_DEVICE(_name, _dev, _dev_descriptor, _read_buff, _write_buff, _default_trigger_id) {\
48  .name = _name,\
49  .dev = _dev,\
50  .dev_descriptor = _dev_descriptor,\
51  .read_buff = _read_buff,\
52  .write_buff = _write_buff,\
53  .default_trigger_id = _default_trigger_id\
54 }
55 
56 #define IIO_APP_TRIGGER(_name, _trig, _trig_descriptor) {\
57  .name = _name,\
58  .trig = _trig,\
59  .descriptor = _trig_descriptor,\
60 }
61 
63  uint32_t size;
64  void *buff;
65 };
66 
68  char *name;
69  void *dev;
74 };
75 
80 struct iio_app_desc {
84  void *irq_desc;
86  struct iio_desc *iio_desc;
88  int (*post_step_callback)(void *arg);
90  void *arg;
91 
92 #ifdef NO_OS_LWIP_NETWORKING
93  struct lwip_network_desc *lwip_desc;
94 #endif
95 };
96 
105  uint32_t nb_ctx_attr;
109  uint32_t nb_devices;
113  int32_t nb_trigs;
117  void *irq_desc;
119  int (*post_step_callback)(void *arg);
121  void *arg;
122 
123 #ifdef NO_OS_LWIP_NETWORKING
124  struct lwip_network_param lwip_param;
125 #endif
126 };
127 
129 int iio_app_init(struct iio_app_desc **app,
130  struct iio_app_init_param app_init_param);
131 
133 int iio_app_run(struct iio_app_desc *app);
134 
136 int iio_app_remove(struct iio_app_desc *app);
137 
138 #endif
iio_app_init_param::nb_ctx_attr
uint32_t nb_ctx_attr
Definition: iio_app.h:105
iio_app_init_param
IIO application descriptor initialization parameters.
Definition: iio_app.h:101
no_os_alloc.h
no_os_uart_init_param::parity
enum no_os_uart_parity parity
Definition: no_os_uart.h:122
iio_remove
int iio_remove(struct iio_desc *desc)
Free the resources allocated by "iio_init()".
Definition: iio.c:2029
iio_app_desc::arg
void * arg
Definition: iio_app.h:90
aducm3029_uart.h
Header file of UART driver for ADuCM302x.
iio_app_init_param::uart_init_params
struct no_os_uart_init_param uart_init_params
Definition: iio_app.h:115
no_os_uart_write
int32_t no_os_uart_write(struct no_os_uart_desc *desc, const uint8_t *data, uint32_t bytes_number)
Write to UART.
Definition: no_os_uart.c:144
no_os_uart_init_param::extra
void * extra
Definition: no_os_uart.h:127
iio_init_param::nb_trigs
uint32_t nb_trigs
Definition: iio.h:118
iio_data_buffer::size
uint32_t size
Definition: iio_app.h:63
iio_app_desc::iio_desc
struct iio_desc * iio_desc
Definition: iio_app.h:86
iio_app_desc::post_step_callback
int(* post_step_callback)(void *arg)
Definition: iio_app.h:88
NO_OS_UART_STOP_1_BIT
@ NO_OS_UART_STOP_1_BIT
Definition: no_os_uart.h:94
no_os_irq.h
Header file of IRQ interface.
no_os_uart_init_param::size
enum no_os_uart_size size
Definition: no_os_uart.h:120
iio_desc
Definition: iio.c:204
iio_app.h
Header file of iio_app.
iio_trigger_init
Definition: iio.h:76
xilinx_uart.h
NO_OS_EOVERRUN
#define NO_OS_EOVERRUN
Definition: no_os_error.h:47
iio_app_desc
IIO application descriptor.
Definition: iio_app.h:80
iio_data_buffer::buff
void * buff
Definition: iio_app.h:64
no_os_delay.h
Header file of Delay functions.
iio_app_device::name
char * name
Definition: iio_app.h:68
iio_init_param
Definition: iio.h:104
iio_init_param::phy_type
enum physical_link_type phy_type
Definition: iio.h:105
no_os_uart_init_param::irq_id
uint32_t irq_id
Definition: no_os_uart.h:114
iio_app_device::default_trigger_id
char * default_trigger_id
Definition: iio_app.h:73
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
WIFI_PWD
#define WIFI_PWD
Definition: parameters.h:101
iio_app_desc::uart_desc
struct no_os_uart_desc * uart_desc
Definition: iio_app.h:82
no_os_uart_remove
int32_t no_os_uart_remove(struct no_os_uart_desc *desc)
Free the resources allocated by no_os_uart_init().
Definition: no_os_uart.c:81
iio_init
int iio_init(struct iio_desc **desc, struct iio_init_param *init_param)
Set communication ops and read/write ops.
Definition: iio.c:1890
iio_device_init::trigger_id
char * trigger_id
Definition: iio.h:73
uart_desc
struct no_os_uart_desc * uart_desc
Definition: main.c:46
iio_init_param::ctx_attrs
struct iio_ctx_attr * ctx_attrs
Definition: iio.h:113
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: aducm3029_delay.c:126
iio_app_device::read_buff
struct iio_data_buffer * read_buff
Definition: iio_app.h:71
iio_init_param::uart_desc
struct no_os_uart_desc * uart_desc
Definition: iio.h:107
no_os_uart_desc
Stucture holding the UART descriptor.
Definition: no_os_uart.h:134
iio.h
Header file of iio.
no_os_error.h
Error codes definition.
USE_NETWORK
@ USE_NETWORK
Definition: iio.h:55
no_os_irq_global_enable
int32_t no_os_irq_global_enable(struct no_os_irq_ctrl_desc *desc)
Enable global interrupts.
Definition: no_os_irq.c:129
stm32_uart.h
Header file of UART driver for STM32.
iio_app_device
Definition: iio_app.h:67
iio_app_init_param::post_step_callback
int(* post_step_callback)(void *arg)
Definition: iio_app.h:119
aducm_irq_ops
const struct no_os_irq_platform_ops aducm_irq_ops
Aducm3029 platform specific IRQ platform ops structure.
Definition: aducm3029_irq.c:551
stm32_irq.h
Header file for stm32 irq specifics.
max_irq_ops
const struct no_os_irq_platform_ops max_irq_ops
maxim specific IRQ platform ops structure
Definition: maxim_irq.c:657
iio_app_device::write_buff
struct iio_data_buffer * write_buff
Definition: iio_app.h:72
iio_device_init::name
char * name
Definition: iio.h:61
iio_data_buffer
Definition: iio_app.h:62
no_os_irq_init_param::irq_ctrl_id
uint32_t irq_ctrl_id
Definition: no_os_irq.h:109
UART_IRQ_ID
#define UART_IRQ_ID
Definition: parameters.h:50
aducm3029_irq.h
Header file of IRQ driver for ADuCM302x.
iio_app_desc::irq_desc
void * irq_desc
Definition: iio_app.h:84
stm32_irq_ops
const struct no_os_irq_platform_ops stm32_irq_ops
stm32 specific IRQ platform ops structure
Definition: stm32_irq.c:582
no_os_irq_ctrl_init
int32_t no_os_irq_ctrl_init(struct no_os_irq_ctrl_desc **desc, const struct no_os_irq_init_param *param)
Initialize the IRQ interrupts.
Definition: no_os_irq.c:45
iio_app_init_param::arg
void * arg
Definition: iio_app.h:121
iio_init_param::devs
struct iio_device_init * devs
Definition: iio.h:115
iio_init_param::nb_ctx_attr
uint32_t nb_ctx_attr
Definition: iio.h:114
xilinx_irq.h
iio_app_run
int iio_app_run(struct iio_app_desc *app)
no_os_uart_init_param::baud_rate
uint32_t baud_rate
Definition: no_os_uart.h:118
no_os_uart_init_param::stop
enum no_os_uart_stop stop
Definition: no_os_uart.h:124
irq_desc
Structure for Interrupt Request descriptor.
iio_app_init
int iio_app_init(struct iio_app_desc **app, struct iio_app_init_param app_init_param)
INTC_DEVICE_ID
#define INTC_DEVICE_ID
Definition: parameters.h:86
iio_app_init_param::trigs
struct iio_trigger_init * trigs
Definition: iio_app.h:111
iio_init_param::trigs
struct iio_trigger_init * trigs
Definition: iio.h:117
iio_init_param::nb_devs
uint32_t nb_devs
Definition: iio.h:116
no_os_free
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:69
iio_app_init_param::nb_trigs
int32_t nb_trigs
Definition: iio_app.h:113
iio_app_remove
int iio_app_remove(struct iio_app_desc *app)
iio_device_init::dev_descriptor
struct iio_device * dev_descriptor
Definition: iio.h:63
no_os_uart_init_param::platform_ops
const struct no_os_uart_platform_ops * platform_ops
Definition: no_os_uart.h:125
iio_app_init_param::ctx_attrs
struct iio_ctx_attr * ctx_attrs
Definition: iio_app.h:103
no_os_uart_init
int32_t no_os_uart_init(struct no_os_uart_desc **desc, struct no_os_uart_init_param *param)
Initialize the UART communication peripheral.
Definition: no_os_uart.c:52
iio_device_init::dev
void * dev
Definition: iio.h:62
iio_device::irq_desc
struct no_os_irq_ctrl_desc * irq_desc
Definition: iio_types.h:250
NULL
#define NULL
Definition: wrapper.h:64
no_os_uart_init_param
Structure holding the parameters for UART initialization.
Definition: no_os_uart.h:110
iio_app_device::dev
void * dev
Definition: iio_app.h:69
iio_device
Structure holding channels and attributes of a device.
Definition: iio_types.h:247
iio_device_init::raw_buf_len
uint32_t raw_buf_len
Definition: iio.h:71
no_os_irq_init_param
Structure holding the initial parameters for Interrupt Request.
Definition: no_os_irq.h:107
NO_OS_UART_PAR_NO
@ NO_OS_UART_PAR_NO
Definition: no_os_uart.h:77
no_os_irq_ctrl_remove
int32_t no_os_irq_ctrl_remove(struct no_os_irq_ctrl_desc *desc)
Free the resources allocated by no_os_irq_ctrl_init().
Definition: no_os_irq.c:71
no_os_uart_init_param::device_id
uint8_t device_id
Definition: no_os_uart.h:112
iio_app_device::dev_descriptor
struct iio_device * dev_descriptor
Definition: iio_app.h:70
no_os_irq_platform_ops
Structure holding IRQ function pointers that point to the platform specific function.
Definition: no_os_irq.h:160
iio_ctx_attr
Structure holding the context attribute members.
Definition: iio.h:86
no_os_uart.h
Header file of UART interface.
iio_app_init_param::irq_desc
void * irq_desc
Definition: iio_app.h:117
iio_device_init
Definition: iio.h:60
WIFI_SSID
#define WIFI_SSID
Definition: parameters.h:100
iio_device_init::raw_buf
int8_t * raw_buf
Definition: iio.h:69
no_os_irq_ctrl_desc
Definition: no_os_irq.h:123
NO_OS_UART_CS_8
@ NO_OS_UART_CS_8
Definition: no_os_uart.h:66
iio_app_init_param::devices
struct iio_app_device * devices
Definition: iio_app.h:107
iio_step
int iio_step(struct iio_desc *desc)
Execute an iio step.
Definition: iio.c:1510
errno.h
Error macro definition for ARM Compiler.
iio_app_init_param::nb_devices
uint32_t nb_devices
Definition: iio_app.h:109
USE_UART
@ USE_UART
Definition: iio.h:53