LCOV - code coverage report
Current view: top level - zephyr/drivers/interrupt_controller - intc_exti_stm32.h Coverage Total Hit
Test: new.info Lines: 62.5 % 8 5
Test Date: 2025-09-05 22:20:39

            Line data    Source code
       1            0 : /*
       2              :  * Copyright (c) 2025 Alexander Kozhinov <ak.alexander.kozhinov@gmail.com>
       3              :  *
       4              :  * SPDX-License-Identifier: Apache-2.0
       5              :  */
       6              : 
       7              : /**
       8              :  * @brief STM32 EXTI interrupt controller API
       9              :  *
      10              :  * This API is used to interact with STM32 EXTI interrupt controller
      11              :  */
      12              : 
      13              : #ifndef ZEPHYR_DRIVERS_INTERRUPT_CONTROLLER_INTC_EXTI_STM32_H_
      14              : #define ZEPHYR_DRIVERS_INTERRUPT_CONTROLLER_INTC_EXTI_STM32_H_
      15              : 
      16              : #include <zephyr/types.h>
      17              : 
      18              : #ifdef __cplusplus
      19              : extern "C" {
      20              : #endif
      21              : 
      22              : /**
      23              :  * @brief EXTI interrupt trigger type
      24              :  */
      25            0 : typedef enum {
      26              :         /* No trigger */
      27              :         STM32_EXTI_TRIG_NONE  = 0x0,
      28              :         /* Trigger on rising edge */
      29              :         STM32_EXTI_TRIG_RISING  = 0x1,
      30              :         /* Trigger on falling edge */
      31              :         STM32_EXTI_TRIG_FALLING = 0x2,
      32              :         /* Trigger on both rising and falling edge */
      33              :         STM32_EXTI_TRIG_BOTH = 0x3,
      34              : } stm32_exti_trigger_type;
      35              : 
      36              : /**
      37              :  * @brief EXTI line mode
      38              :  */
      39            0 : typedef enum {
      40              :         /* Generate interrupts only */
      41              :         STM32_EXTI_MODE_IT  = 0x0,
      42              :         /* Generate events only */
      43              :         STM32_EXTI_MODE_EVENT  = 0x1,
      44              :         /* Generate interrupts and events */
      45              :         STM32_EXTI_MODE_BOTH = 0x2,
      46              :         /* Disable interrupts and events */
      47              :         STM32_EXTI_MODE_NONE = 0x3,
      48              : } stm32_exti_mode;
      49              : 
      50              : /**
      51              :  * @brief Enable EXTI line.
      52              :  * @note The caller driver is responsible for registering an ISR and
      53              :  *        enabling the corresponding interrupt if MODE_IT is selected.
      54              :  *
      55              :  * @param line_num      EXTI line number
      56              :  * @param trigger       EXTI trigger type (see @ref stm32_exti_trigger_type)
      57              :  * @param mode          EXTI mode (see @ref stm32_exti_mode)
      58              :  * @returns 0 on success, -EINVAL if @p line_num is invalid
      59              :  */
      60            1 : int stm32_exti_enable(uint32_t line_num, stm32_exti_trigger_type trigger,
      61              :                                           stm32_exti_mode mode);
      62              : 
      63              : /**
      64              :  * @brief Disable EXTI line.
      65              :  * After this function has been called, EXTI line @p line_num will
      66              :  * not generate further interrupts or events.
      67              :  *
      68              :  * @param line_num      EXTI line number
      69              :  * @returns 0 on success, -EINVAL if @p line is invalid
      70              :  */
      71            1 : int stm32_exti_disable(uint32_t line_num);
      72              : 
      73              : /**
      74              :  * @brief Checks interrupt pending bit for specified EXTI line
      75              :  *
      76              :  * @param line_num EXTI line number
      77              :  * @returns true if @p line is pending, false otherwise
      78              :  */
      79            1 : bool stm32_exti_is_pending(uint32_t line_num);
      80              : 
      81              : /**
      82              :  * @brief Clears interrupt pending bit for specified EXTI line
      83              :  *
      84              :  * @param line_num      EXTI line number
      85              :  * @returns 0 on success, -EINVAL if @p line is invalid
      86              :  */
      87            1 : int stm32_exti_clear_pending(uint32_t line_num);
      88              : 
      89              : /**
      90              :  * @brief Generates SW interrupt for specified EXTI line number
      91              :  *
      92              :  * @param line_num      EXTI line number
      93              :  * @returns 0 on success, -EINVAL if @p line is invalid
      94              :  */
      95            1 : int stm32_exti_sw_interrupt(uint32_t line_num);
      96              : 
      97              : #ifdef __cplusplus
      98              : }
      99              : #endif
     100              : 
     101              : #endif /* ZEPHYR_DRIVERS_INTERRUPT_CONTROLLER_INTC_EXTI_STM32_H_ */
        

Generated by: LCOV version 2.0-1