no-OS
iio_trigger.h
Go to the documentation of this file.
1 /***************************************************************************/
34 #ifndef IIO_TRIGGER_H_
35 #define IIO_TRIGGER_H_
36 
37 /******************************************************************************/
38 /***************************** Include Files **********************************/
39 /******************************************************************************/
40 #include "iio.h"
41 #include "iio_types.h"
42 #include "no_os_irq.h"
43 
44 /******************************************************************************/
45 /********************** Macros and Constants Definitions **********************/
46 /******************************************************************************/
47 #define TRIG_MAX_NAME_SIZE 20
48 
49 /******************************************************************************/
50 /*************************** Types Declarations *******************************/
51 /******************************************************************************/
56 struct iio_hw_trig {
58  struct iio_desc *iio_desc;
62  uint32_t irq_id;
67 };
68 
79  void *handle;
80 };
81 
88  struct iio_desc *iio_desc;
92  uint32_t irq_id;
98  const char *name;
99 };
100 
105 struct iio_sw_trig {
110 };
111 
120  const char *name;
121 };
122 
123 #ifndef LINUX_PLATFORM
124 
125 int iio_hw_trig_init(struct iio_hw_trig **iio_trig,
128 int iio_trig_enable(void *trig);
130 int iio_trig_disable(void *trig);
132 void iio_hw_trig_handler(void *trig);
134 int iio_hw_trig_remove(struct iio_hw_trig *trig);
135 #endif
136 
138 int iio_sw_trig_init(struct iio_sw_trig **iio_trig,
141 int iio_sw_trig_handler(void *trig, char *buf, uint32_t len,
142  const struct iio_ch_info *channel,
143  intptr_t priv);
145 int iio_trig_remove(struct iio_sw_trig *trig);
146 
147 #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:127
iio_trigger.h
Header file for iio_trigger.
iio_hw_trig::iio_desc
struct iio_desc * iio_desc
Definition: iio_trigger.h:58
no_os_callback_desc
Structure describing a callback to be registered.
Definition: no_os_irq.h:142
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:92
iio_desc
Definition: iio.c:204
iio_hw_trig::irq_id
uint32_t irq_id
Definition: iio_trigger.h:62
iio_ch_info
Structure holding channel attributess.
Definition: iio_types.h:103
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:56
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:143
iio_sw_trig::iio_desc
struct iio_desc * iio_desc
Definition: iio_trigger.h:107
iio_trig_disable
int iio_trig_disable(void *trig)
Disable system interrupt which is linked to the given trigger.
Definition: iio_trigger.c:127
iio_sw_trig_init_param::name
const char * name
Definition: iio_trigger.h:120
iio_sw_trig::name
char name[TRIG_MAX_NAME_SIZE+1]
Definition: iio_trigger.h:109
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:177
iio_hw_trig_init_param::irq_ctrl
struct no_os_irq_ctrl_desc * irq_ctrl
Definition: iio_trigger.h:90
no_os_irq_peripheral
no_os_irq_peripheral
Definition: no_os_irq.h:84
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
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:56
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:227
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:208
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:88
iio_hw_trig::irq_ctrl
struct no_os_irq_ctrl_desc * irq_ctrl
Definition: iio_trigger.h:60
TRIG_MAX_NAME_SIZE
#define TRIG_MAX_NAME_SIZE
Definition: iio_trigger.h:47
iio_hw_trig_init_param::irq_trig_lvl
enum no_os_irq_trig_level irq_trig_lvl
Definition: iio_trigger.h:94
iio_trig_enable
int iio_trig_enable(void *trig)
Enable system interrupt which is linked to the given trigger.
Definition: iio_trigger.c:110
iio_hw_trig::name
char name[TRIG_MAX_NAME_SIZE+1]
Definition: iio_trigger.h:66
no_os_irq_trig_level
no_os_irq_trig_level
Definition: no_os_irq.h:76
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:160
iio_hw_trig_cb_info::handle
void * handle
Definition: iio_trigger.h:79
no_os_callback_desc::callback
void(* callback)(void *context)
Definition: no_os_irq.h:144
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:160
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:1091
iio_hw_trig::irq_trig_lvl
enum no_os_irq_trig_level irq_trig_lvl
Definition: iio_trigger.h:64
iio_sw_trig
IIO software trigger structure.
Definition: iio_trigger.h:105
iio_trig_enable
int iio_trig_enable(void *trig)
Enable system interrupt which is linked to the given trigger.
Definition: iio_trigger.c:110
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:69
iio_hw_trig_init_param
IIO hardware trigger initialization structure.
Definition: iio_trigger.h:86
iio_hw_trig_cb_info::event
enum no_os_irq_event event
Definition: iio_trigger.h:75
iio_hw_trig_cb_info::peripheral
enum no_os_irq_peripheral peripheral
Definition: iio_trigger.h:77
iio_hw_trig_init_param::irq_id
uint32_t irq_id
Definition: iio_trigger.h:92
iio_sw_trig_init_param
IIO software trigger initialization structure.
Definition: iio_trigger.h:116
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:143
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c: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:208
NO_OS_EVT_GPIO
@ NO_OS_EVT_GPIO
Definition: no_os_irq.h:62
no_os_irq_event
no_os_irq_event
Definition: no_os_irq.h:61
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:177
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:181
iio_hw_trig_init_param::cb_info
struct iio_hw_trig_cb_info cb_info
Definition: iio_trigger.h:96
iio_hw_trig_cb_info
Hardware trigger callback extra information structure.
Definition: iio_trigger.h:73
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:162
iio_sw_trig_init_param::iio_desc
struct iio_desc * iio_desc
Definition: iio_trigger.h:118
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:198
no_os_irq_ctrl_desc
Definition: no_os_irq.h:123
iio_hw_trig
IIO hardware trigger structure.
Definition: iio_trigger.h:56
iio_hw_trig_init_param::name
const char * name
Definition: iio_trigger.h:98