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 {
113  struct iio_desc **iio_desc;
116 };
117 
124  struct iio_desc **iio_desc;
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_ */
iio_hw_trig_init_param::iio_desc
struct iio_desc ** iio_desc
Definition: iio_trigger.h:94
iio_trig_disable
int iio_trig_disable(void *trig)
Disable system interrupt which is linked to the given trigger.
Definition: iio_trigger.c:132
iio_trigger.h
Header file for iio_trigger.
no_os_callback_desc
Structure describing a callback to be registered.
Definition: no_os_irq.h:136
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:82
iio_desc
Definition: iio.c:202
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:101
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:61
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:148
iio_trig_disable
int iio_trig_disable(void *trig)
Disable system interrupt which is linked to the given trigger.
Definition: iio_trigger.c:132
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:182
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:85
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:61
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:232
iio_sw_trig::iio_desc
struct iio_desc ** iio_desc
Definition: iio_trigger.h:113
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:213
iio.h
Header file of iio.
no_os_error.h
Error codes definition.
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:115
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:77
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:165
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:138
iio_sw_trig_init_param::iio_desc
struct iio_desc ** iio_desc
Definition: iio_trigger.h:124
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:165
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:1011
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:115
iio_types.h
Header file for iio_types.
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:148
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:96
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:213
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:182
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:144
iio_hw_trig::iio_desc
struct iio_desc ** iio_desc
Definition: iio_trigger.h:64
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:128
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:155
no_os_irq_ctrl_desc
Definition: no_os_irq.h:119
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