no-OS
iio_trigger.h
Go to the documentation of this file.
1 /***************************************************************************/
40 #ifndef IIO_TRIGGER_H_
41 #define IIO_TRIGGER_H_
42 
43 /******************************************************************************/
44 /***************************** Include Files **********************************/
45 /******************************************************************************/
46 #include "iio.h"
47 #include "iio_types.h"
48 #include "no_os_irq.h"
49 
50 /******************************************************************************/
51 /********************** Macros and Constants Definitions **********************/
52 /******************************************************************************/
53 #define TRIG_MAX_NAME_SIZE 20
54 
55 /******************************************************************************/
56 /*************************** Types Declarations *******************************/
57 /******************************************************************************/
62 struct iio_hw_trig {
64  struct iio_desc *iio_desc;
68  uint32_t irq_id;
73 };
74 
85  void *handle;
86 };
87 
94  struct iio_desc *iio_desc;
98  uint32_t irq_id;
104  const char *name;
105 };
106 
111 struct iio_sw_trig {
116 };
117 
126  const char *name;
127 };
128 
129 #ifndef LINUX_PLATFORM
130 
131 int iio_hw_trig_init(struct iio_hw_trig **iio_trig,
134 int iio_trig_enable(void *trig);
136 int iio_trig_disable(void *trig);
138 void iio_hw_trig_handler(void *trig);
140 int iio_hw_trig_remove(struct iio_hw_trig *trig);
141 #endif
142 
144 int iio_sw_trig_init(struct iio_sw_trig **iio_trig,
147 int iio_sw_trig_handler(void *trig, char *buf, uint32_t len,
148  const struct iio_ch_info *channel,
149  intptr_t priv);
151 int iio_trig_remove(struct iio_sw_trig *trig);
152 
153 #endif /* IIO_TRIGGER_H_ */
no_os_alloc.h
iio_trig_disable
int iio_trig_disable(void *trig)
Disable system interrupt which is linked to the given trigger.
Definition: iio_trigger.c:133
iio_trigger.h
Header file for iio_trigger.
iio_hw_trig::iio_desc
struct iio_desc * iio_desc
Definition: iio_trigger.h:64
no_os_callback_desc
Structure describing a callback to be registered.
Definition: no_os_irq.h:148
no_os_irq.h
Header file of IRQ interface.
no_os_irq_register_callback
int32_t no_os_irq_register_callback(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, struct no_os_callback_desc *callback_desc)
Register a callback to handle the irq events.
Definition: no_os_irq.c:98
iio_desc
Definition: iio.c:209
iio_hw_trig::irq_id
uint32_t irq_id
Definition: iio_trigger.h:68
iio_ch_info
Structure holding channel attributess.
Definition: iio_types.h:108
iio_hw_trig_init
int iio_hw_trig_init(struct iio_hw_trig **iio_trig, struct iio_hw_trig_init_param *init_param)
Initialize hardware trigger.
Definition: iio_trigger.c:62
iio_hw_trig_handler
void iio_hw_trig_handler(void *trig)
Trigger interrupt handler. This function will be called when a system interrupt is asserted for the c...
Definition: iio_trigger.c:149
iio_sw_trig::iio_desc
struct iio_desc * iio_desc
Definition: iio_trigger.h:113
iio_trig_disable
int iio_trig_disable(void *trig)
Disable system interrupt which is linked to the given trigger.
Definition: iio_trigger.c:133
iio_sw_trig_init_param::name
const char * name
Definition: iio_trigger.h:126
iio_sw_trig::name
char name[TRIG_MAX_NAME_SIZE+1]
Definition: iio_trigger.h:115
iio_sw_trig_init
int iio_sw_trig_init(struct iio_sw_trig **iio_trig, struct iio_sw_trig_init_param *init_param)
Initialize software trigger.
Definition: iio_trigger.c:183
iio_hw_trig_init_param::irq_ctrl
struct no_os_irq_ctrl_desc * irq_ctrl
Definition: iio_trigger.h:96
no_os_irq_peripheral
no_os_irq_peripheral
Definition: no_os_irq.h:90
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
iio_hw_trig_init
int iio_hw_trig_init(struct iio_hw_trig **iio_trig, struct iio_hw_trig_init_param *init_param)
Initialize hardware trigger.
Definition: iio_trigger.c:62
iio_sw_trig_remove
int iio_sw_trig_remove(struct iio_sw_trig *trig)
Free the resources allocated by iio_sw_trig_init().
Definition: iio_trigger.c:233
iio_sw_trig_handler
int iio_sw_trig_handler(void *trig, char *buf, uint32_t len, const struct iio_ch_info *channel, intptr_t priv)
Handles the write request for trigger_now attribute.
Definition: iio_trigger.c:214
iio.h
Header file of iio.
no_os_error.h
Error codes definition.
iio_hw_trig_init_param::iio_desc
struct iio_desc * iio_desc
Definition: iio_trigger.h:94
iio_hw_trig::irq_ctrl
struct no_os_irq_ctrl_desc * irq_ctrl
Definition: iio_trigger.h:66
TRIG_MAX_NAME_SIZE
#define TRIG_MAX_NAME_SIZE
Definition: iio_trigger.h:53
iio_hw_trig_init_param::irq_trig_lvl
enum no_os_irq_trig_level irq_trig_lvl
Definition: iio_trigger.h:100
iio_trig_enable
int iio_trig_enable(void *trig)
Enable system interrupt which is linked to the given trigger.
Definition: iio_trigger.c:116
iio_hw_trig::name
char name[TRIG_MAX_NAME_SIZE+1]
Definition: iio_trigger.h:72
no_os_irq_trig_level
no_os_irq_trig_level
Definition: no_os_irq.h:82
iio_hw_trig_remove
int iio_hw_trig_remove(struct iio_hw_trig *trig)
Free the resources allocated by iio_hw_trig_init().
Definition: iio_trigger.c:166
iio_hw_trig_cb_info::handle
void * handle
Definition: iio_trigger.h:85
no_os_callback_desc::callback
void(* callback)(void *context)
Definition: no_os_irq.h:150
iio_trig_remove
int iio_trig_remove(struct iio_sw_trig *trig)
iio_hw_trig_remove
int iio_hw_trig_remove(struct iio_hw_trig *trig)
Free the resources allocated by iio_hw_trig_init().
Definition: iio_trigger.c:166
iio_process_trigger_type
int iio_process_trigger_type(struct iio_desc *desc, char *trigger_name)
Searches for trigger name and processes the trigger based on its type (sync or async with the interru...
Definition: iio.c:1069
iio_hw_trig::irq_trig_lvl
enum no_os_irq_trig_level irq_trig_lvl
Definition: iio_trigger.h:70
iio_sw_trig
IIO software trigger structure.
Definition: iio_trigger.h:111
iio_trig_enable
int iio_trig_enable(void *trig)
Enable system interrupt which is linked to the given trigger.
Definition: iio_trigger.c:116
iio_types.h
Header file for iio_types.
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:75
iio_hw_trig_init_param
IIO hardware trigger initialization structure.
Definition: iio_trigger.h:92
iio_hw_trig_cb_info::event
enum no_os_irq_event event
Definition: iio_trigger.h:81
iio_hw_trig_cb_info::peripheral
enum no_os_irq_peripheral peripheral
Definition: iio_trigger.h:83
iio_hw_trig_init_param::irq_id
uint32_t irq_id
Definition: iio_trigger.h:98
iio_sw_trig_init_param
IIO software trigger initialization structure.
Definition: iio_trigger.h:122
iio_hw_trig_handler
void iio_hw_trig_handler(void *trig)
Trigger interrupt handler. This function will be called when a system interrupt is asserted for the c...
Definition: iio_trigger.c:149
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:119
iio_sw_trig_handler
int iio_sw_trig_handler(void *trig, char *buf, uint32_t len, const struct iio_ch_info *channel, intptr_t priv)
Handles the write request for trigger_now attribute.
Definition: iio_trigger.c:214
NO_OS_EVT_GPIO
@ NO_OS_EVT_GPIO
Definition: no_os_irq.h:68
no_os_irq_event
no_os_irq_event
Definition: no_os_irq.h:67
iio_sw_trig_init
int iio_sw_trig_init(struct iio_sw_trig **iio_trig, struct iio_sw_trig_init_param *init_param)
Initialize software trigger.
Definition: iio_trigger.c:183
no_os_irq_enable
int32_t no_os_irq_enable(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
Enable specific interrupt.
Definition: no_os_irq.c:187
iio_hw_trig_init_param::cb_info
struct iio_hw_trig_cb_info cb_info
Definition: iio_trigger.h:102
iio_hw_trig_cb_info
Hardware trigger callback extra information structure.
Definition: iio_trigger.h:79
no_os_irq_trigger_level_set
int32_t no_os_irq_trigger_level_set(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, enum no_os_irq_trig_level trig)
Set interrupt trigger level.
Definition: no_os_irq.c:168
iio_sw_trig_init_param::iio_desc
struct iio_desc * iio_desc
Definition: iio_trigger.h:124
no_os_irq_disable
int32_t no_os_irq_disable(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
Disable specific interrupt.
Definition: no_os_irq.c:204
no_os_irq_ctrl_desc
Definition: no_os_irq.h:129
iio_hw_trig
IIO hardware trigger structure.
Definition: iio_trigger.h:62
iio_hw_trig_init_param::name
const char * name
Definition: iio_trigger.h:104