![]() |
no-OS
|
Implementation of MAXM86161 IIO driver. More...
#include <stdlib.h>#include <stdio.h>#include <string.h>#include "iio_maxm86161.h"#include "maxm86161.h"#include "no_os_alloc.h"#include "no_os_circular_buffer.h"#include "no_os_delay.h"#include "no_os_error.h"#include "no_os_irq.h"#include "no_os_mutex.h"#include "no_os_util.h"Macros | |
| #define | MAXM86161_IIO_SAMPLE_SIZE sizeof(uint32_t) |
Functions | |
| void | maxm86161_iio_fifo_irq_handler (void *ctx) |
| FIFO almost-full interrupt handler for the MAXM86161 IIO device. | |
| int | maxm86161_iio_init (struct maxm86161_iio_desc **iio_desc, struct maxm86161_iio_init_param *init_param) |
| Initialize the MAXM86161 IIO device descriptor. | |
| int | maxm86161_iio_remove (struct maxm86161_iio_desc *iio_desc) |
| Free resources allocated by maxm86161_iio_init(). | |
| int | maxm86161_iio_get_dev_descriptor (struct maxm86161_iio_desc *iio_desc, struct iio_device **iio_dev) |
| Retrieve the IIO device structure from the IIO descriptor. | |
Implementation of MAXM86161 IIO driver.
Copyright 2026(c) Analog Devices, Inc.
SPDX-License-Identifier: BSD-3-Clause
| #define MAXM86161_IIO_SAMPLE_SIZE sizeof(uint32_t) |
| void maxm86161_iio_fifo_irq_handler | ( | void * | ctx | ) |
FIFO almost-full interrupt handler for the MAXM86161 IIO device.
Invoked by the driver-level IRQ dispatcher when the FIFO almost-full (A_FULL) condition is asserted. It queries the current FIFO sample count, clamps it to the physical FIFO depth, reads the pending samples from the device, decodes each sample (tag + 24-bit data) and writes the raw data words into the IIO circular buffer for later consumption by the submit callback. Samples that fail to decode are skipped. The function returns silently on any error or when there are no samples to read.
| ctx | - Opaque context pointer to the MAXM86161 IIO descriptor (struct maxm86161_iio_desc *). |
| int maxm86161_iio_get_dev_descriptor | ( | struct maxm86161_iio_desc * | iio_desc, |
| struct iio_device ** | iio_dev ) |
Retrieve the IIO device structure from the IIO descriptor.
Provides access to the underlying struct iio_device so it can be registered with the IIO framework.
| iio_desc | - IIO descriptor. |
| iio_dev | - Pointer that receives the address of the IIO device structure. |
iio_desc or iio_dev is NULL. | int maxm86161_iio_init | ( | struct maxm86161_iio_desc ** | iio_desc, |
| struct maxm86161_iio_init_param * | init_param ) |
Initialize the MAXM86161 IIO device descriptor.
Allocates the IIO descriptor, initializes the underlying MAXM86161 driver device, sets up the FIFO circular buffer, configures the FIFO watermark and registers the FIFO almost-full interrupt handler. The IRQ must be enabled in the driver init parameters for IIO operation. On failure, all previously acquired resources are released before returning.
| iio_desc | - Pointer that receives the address of the allocated IIO descriptor on success. |
| init_param | - Initialization parameters, including the driver init parameters and the FIFO watermark level. |
| int maxm86161_iio_remove | ( | struct maxm86161_iio_desc * | iio_desc | ) |
Free resources allocated by maxm86161_iio_init().
Detaches the FIFO almost-full callback from the driver-level IRQ dispatcher, removes the FIFO circular buffer, removes the underlying MAXM86161 driver device and frees the IIO descriptor.
| iio_desc | - IIO descriptor to free. |
iio_desc is NULL.