LCOV - code coverage report
Current view: top level - zephyr/drivers/misc/nxp_flexio - nxp_flexio.h Coverage Total Hit
Test: new.info Lines: 100.0 % 17 17
Test Date: 2025-09-05 16:43:28

            Line data    Source code
       1            1 : /*
       2              :  * Copyright (c) 2024, STRIM, ALC
       3              :  *
       4              :  * SPDX-License-Identifier: Apache-2.0
       5              :  */
       6              : 
       7              : /**
       8              :  * @file
       9              :  * @brief Header file for NXP FlexIO driver
      10              :  * @ingroup nxp_flexio_interface
      11              :  */
      12              : 
      13              : #ifndef ZEPHYR_DRIVERS_MISC_NXP_FLEXIO_NXP_FLEXIO_H_
      14              : #define ZEPHYR_DRIVERS_MISC_NXP_FLEXIO_NXP_FLEXIO_H_
      15              : 
      16              : /**
      17              :  * @brief NXP FlexIO driver APIs
      18              :  * @defgroup nxp_flexio_interface NXP FlexIO driver APIs
      19              :  * @ingroup misc_interfaces
      20              :  *
      21              :  * @{
      22              :  */
      23              : 
      24              : #include <zephyr/device.h>
      25              : 
      26              : /**
      27              :  * @brief Structure containing information about the required resources for a FlexIO child.
      28              :  */
      29            1 : struct nxp_flexio_child_res {
      30              :         /** Output array where assigned shifter indices are stored.
      31              :          *
      32              :          * Must point to an array with at least @ref shifter_count entries. Values are 0-based
      33              :          * hardware indices valid for the bound FlexIO.
      34              :          */
      35            1 :         uint8_t *shifter_index;
      36              :         /** Number of shifter indices required by the child. */
      37            1 :         uint8_t shifter_count;
      38              :         /** Output array where assigned timer indices are stored.
      39              :          *
      40              :          * Must point to an array with at least @ref timer_count entries.  Values are 0-based
      41              :          * hardware indices valid for the bound FlexIO.
      42              :          */
      43            1 :         uint8_t *timer_index;
      44              :         /** Number of timer indices required by the child. */
      45            1 :         uint8_t timer_count;
      46              : };
      47              : 
      48              : /**
      49              :  * @typedef nxp_flexio_child_isr_t
      50              :  * @brief Callback API to inform API user that FlexIO triggered interrupt
      51              :  *
      52              :  * The controller calls this from IRQ context whenever one of the child's mapped shifters or timers
      53              :  * has a pending and enabled interrupt.
      54              :  *
      55              :  * @param user_data Opaque pointer provided at attachment time.
      56              :  */
      57            1 : typedef int (*nxp_flexio_child_isr_t)(void *user_data);
      58              : 
      59              : /**
      60              :  * @struct nxp_flexio_child
      61              :  * @brief Structure containing the required child data for FlexIO
      62              :  */
      63            1 : struct nxp_flexio_child {
      64              :         /** ISR called from the FlexIO controller's IRQ handler.
      65              :          * May be @c NULL if the child does not require IRQ notifications.
      66              :          */
      67            1 :         nxp_flexio_child_isr_t isr;
      68              :         /** Opaque pointer passed to @ref isr function when it is invoked. */
      69            1 :         void *user_data;
      70              :         /** Resource requirements and output indices filled by nxp_flexio_child_attach(). */
      71            1 :         struct nxp_flexio_child_res res;
      72              : };
      73              : 
      74              : /**
      75              :  * @brief Enable FlexIO IRQ
      76              :  * @param dev Pointer to the device structure for the FlexIO driver instance
      77              :  */
      78            1 : void nxp_flexio_irq_enable(const struct device *dev);
      79              : 
      80              : /**
      81              :  * @brief Disable FlexIO IRQ
      82              :  * @param dev Pointer to the device structure for the FlexIO driver instance
      83              :  */
      84            1 : void nxp_flexio_irq_disable(const struct device *dev);
      85              : 
      86              : /**
      87              :  * @brief Lock FlexIO mutex.
      88              :  * @param dev Pointer to the device structure for the FlexIO driver instance
      89              :  */
      90            1 : void nxp_flexio_lock(const struct device *dev);
      91              : 
      92              : /**
      93              :  * @brief Unlock FlexIO mutex.
      94              :  * @param dev Pointer to the device structure for the FlexIO driver instance
      95              :  */
      96            1 : void nxp_flexio_unlock(const struct device *dev);
      97              : 
      98              : /**
      99              :  * @brief Obtain the clock rate of sub-system used by the FlexIO
     100              :  * @param dev Pointer to the device structure for the FlexIO driver instance
     101              :  * @param[out] rate Subsystem clock rate
     102              :  * @retval 0 on successful rate reading.
     103              :  * @retval -EAGAIN if rate cannot be read. Some drivers do not support returning the rate when the
     104              :  *         clock is off.
     105              :  * @retval -ENOTSUP if reading the clock rate is not supported for the given sub-system.
     106              :  * @retval -ENOSYS if the interface is not implemented.
     107              :  */
     108            1 : int nxp_flexio_get_rate(const struct device *dev, uint32_t *rate);
     109              : 
     110              : /**
     111              :  * @brief Attach flexio child to flexio controller
     112              :  * @param dev Pointer to the device structure for the FlexIO driver instance
     113              :  * @param child Pointer to flexio child
     114              :  * @retval 0 if successful
     115              :  * @retval -ENOBUFS if there are not enough available resources
     116              :  */
     117            1 : int nxp_flexio_child_attach(const struct device *dev,
     118              :         const struct nxp_flexio_child *child);
     119              : 
     120              : /**
     121              :  * @}
     122              :  */
     123              : 
     124              : #endif /* ZEPHYR_DRIVERS_MISC_NXP_FLEXIO_NXP_FLEXIO_H_ */
        

Generated by: LCOV version 2.0-1