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

            Line data    Source code
       1            0 : /*
       2              :  * Copyright 2025 NXP
       3              :  *
       4              :  * SPDX-License-Identifier: Apache-2.0
       5              :  */
       6              : 
       7              : #include <zephyr/device.h>
       8              : #include <zephyr/dt-bindings/misc/nxp_rtxxx_dsp_ctrl.h>
       9              : 
      10              : #ifndef __NXP_RTXXX_DSP_CTRL_H__
      11              : #define __NXP_RTXXX_DSP_CTRL_H__
      12              : 
      13              : /**
      14              :  * @brief Describes an image section type selection.
      15              :  */
      16            0 : enum nxp_rtxxx_dsp_ctrl_section_type {
      17              :         NXP_RTXXX_DSP_CTRL_SECTION_RESET = NXP_RTXXX_DSP_REGION_RESET,
      18              :         NXP_RTXXX_DSP_CTRL_SECTION_TEXT = NXP_RTXXX_DSP_REGION_TEXT,
      19              :         NXP_RTXXX_DSP_CTRL_SECTION_DATA = NXP_RTXXX_DSP_REGION_DATA
      20              : };
      21              : 
      22            0 : typedef int (*nxp_rtxxx_dsp_ctrl_api_load_section)(
      23              :         const struct device *,
      24              :         const void *,
      25              :         size_t,
      26              :         enum nxp_rtxxx_dsp_ctrl_section_type
      27              : );
      28            0 : typedef void (*nxp_rtxxx_dsp_ctrl_api_enable)(const struct device *dev);
      29            0 : typedef void (*nxp_rtxxx_dsp_ctrl_api_disable)(const struct device *dev);
      30              : 
      31            0 : struct nxp_rtxxx_dsp_ctrl_api {
      32            0 :         nxp_rtxxx_dsp_ctrl_api_load_section load_section;
      33            0 :         nxp_rtxxx_dsp_ctrl_api_enable enable;
      34            0 :         nxp_rtxxx_dsp_ctrl_api_disable disable;
      35              : };
      36              : 
      37              : /**
      38              :  * @brief Loads a specified image representing a specified section to a particular region in the
      39              :  * DSP's memory.
      40              :  *
      41              :  * @param dev DSP device
      42              :  * @param base Base pointer of the image to load
      43              :  * @param length Length of the image
      44              :  * @param section Section type which specified image represents
      45              :  * @return int 0 on success, -EINVAL for invalid parameters, -ENOMEM for image bigger than the
      46              :  * target region
      47              :  */
      48            1 : static inline int nxp_rtxxx_dsp_ctrl_load_section(
      49              :         const struct device *dev,
      50              :         const void *base,
      51              :         size_t length,
      52              :         enum nxp_rtxxx_dsp_ctrl_section_type section
      53              : )
      54              : {
      55              :         return ((struct nxp_rtxxx_dsp_ctrl_api *)dev->api)
      56              :                 ->load_section(dev, base, length, section);
      57              : }
      58              : 
      59              : /**
      60              :  * @brief Starts (unstalls) the DSP.
      61              :  *
      62              :  * @param dev DSP device
      63              :  */
      64            1 : static inline void nxp_rtxxx_dsp_ctrl_enable(const struct device *dev)
      65              : {
      66              :         ((struct nxp_rtxxx_dsp_ctrl_api *)dev->api)->enable(dev);
      67              : }
      68              : 
      69              : /**
      70              :  * @brief Stops (stalls) the DSP.
      71              :  *
      72              :  * @param dev DSP device
      73              :  */
      74            1 : static inline void nxp_rtxxx_dsp_ctrl_disable(const struct device *dev)
      75              : {
      76              :         ((struct nxp_rtxxx_dsp_ctrl_api *)dev->api)->disable(dev);
      77              : }
      78              : 
      79              : #endif
        

Generated by: LCOV version 2.0-1