no-OS
Loading...
Searching...
No Matches
iio_trigger.c File Reference

Implementation of generic iio trigger. More...

#include <stdlib.h>
#include <string.h>
#include "no_os_error.h"
#include "no_os_alloc.h"
#include "iio.h"
#include "iio_trigger.h"
Include dependency graph for iio_trigger.c:

Functions

int iio_hw_trig_init (struct iio_hw_trig **iio_trig, struct iio_hw_trig_init_param *init_param)
 Initialize hardware trigger.
 
int iio_trig_enable (void *trig)
 Enable system interrupt which is linked to the given trigger.
 
int iio_trig_disable (void *trig)
 Disable system interrupt which is linked to the given trigger.
 
void iio_hw_trig_handler (void *trig)
 Trigger interrupt handler. This function will be called when a system interrupt is asserted for the configured trigger.
 
int iio_hw_trig_remove (struct iio_hw_trig *trig)
 Free the resources allocated by iio_hw_trig_init().
 
int iio_sw_trig_init (struct iio_sw_trig **iio_trig, struct iio_sw_trig_init_param *init_param)
 Initialize software trigger.
 
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.
 
int iio_sw_trig_remove (struct iio_sw_trig *trig)
 Free the resources allocated by iio_sw_trig_init().
 

Detailed Description

Implementation of generic iio trigger.

Author
RBolboac (ramon.nosp@m.a.bo.nosp@m.lboac.nosp@m.a@an.nosp@m.alog..nosp@m.com)

Copyright 2022(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

Function Documentation

◆ 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 configured trigger.

Parameters
trig- Trigger structure which is linked to this handler.

◆ 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.

Parameters
iio_trig- The iio trigger structure.
init_param- The structure that contains the trigger initial params.
Returns
ret - Result of the initialization procedure.

◆ iio_hw_trig_remove()

int iio_hw_trig_remove ( struct iio_hw_trig * trig)

Free the resources allocated by iio_hw_trig_init().

Parameters
trig- The trigger structure.
Returns
ret - Result of the remove procedure.

◆ 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.

Parameters
trig- The iio trigger structure.
buf- Command buffer to be filled with the data to be written.
len- Length of the received command buffer in bytes.
channel- Command channel info (is NULL).
priv- Command attribute id.
Returns
ret - Result of the sw trigger handler procedure.

◆ 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.

Parameters
iio_trig- The iio trigger structure.
init_param- The structure that contains the sw trigger initial params.
Returns
ret - Result of the initialization procedure.

◆ iio_sw_trig_remove()

int iio_sw_trig_remove ( struct iio_sw_trig * trig)

Free the resources allocated by iio_sw_trig_init().

Parameters
trig- The trigger structure.
Returns
ret - Result of the remove procedure.

◆ iio_trig_disable()

int iio_trig_disable ( void * trig)

Disable system interrupt which is linked to the given trigger.

Parameters
trig- Trigger structure.
Returns
ret - Result of the disable procedure.

◆ iio_trig_enable()

int iio_trig_enable ( void * trig)

Enable system interrupt which is linked to the given trigger.

Parameters
trig- Trigger structure.
Returns
ret - Result of the enable procedure.