LCOV - code coverage report
Current view: top level - zephyr/drivers/pinctrl - pinctrl_soc_bflb_common.h Coverage Total Hit
Test: new.info Lines: 100.0 % 1 1
Test Date: 2025-09-05 20:47:19

            Line data    Source code
       1            1 : /*
       2              :  * Copyright (c) 2021-2025 Gerson Fernando Budke <nandojve@gmail.com>
       3              :  *
       4              :  * SPDX-License-Identifier: Apache-2.0
       5              :  */
       6              : 
       7              : /**
       8              :  * @file
       9              :  * Bouffalo Lab SoC specific helpers for pinctrl driver
      10              :  */
      11              : 
      12              : #ifndef ZEPHYR_INCLUDE_DRIVERS_PINCTRL_PINCTRL_SOC_BFLB_COMMON_H_
      13              : #define ZEPHYR_INCLUDE_DRIVERS_PINCTRL_PINCTRL_SOC_BFLB_COMMON_H_
      14              : 
      15              : #include <zephyr/devicetree.h>
      16              : #include <zephyr/types.h>
      17              : #include <zephyr/dt-bindings/pinctrl/bflb-common-pinctrl.h>
      18              : 
      19              : /* clang-format off */
      20              : 
      21              : #ifdef __cplusplus
      22              : extern "C" {
      23              : #endif
      24              : 
      25              : /** @cond INTERNAL_HIDDEN */
      26              : 
      27              : /**
      28              :  * @brief BFLB pincfg bit field.
      29              :  * @anchor BFLB_PINMUX
      30              :  *
      31              :  * Fields:
      32              :  *
      33              :  * - 24..31: pin
      34              :  * - 20..23: signal
      35              :  * - 18..19: mode
      36              :  * - 16..17: instance
      37              :  * -  8..15: function
      38              :  * -      7: reserved
      39              :  * -      6: GPIO Output Enable
      40              :  * -      5: Pull Down
      41              :  * -      4: Pull Up
      42              :  * -   2..3: Driver Strength
      43              :  * -      1: Schmitt trigger (SMT)
      44              :  * -      0: reserved
      45              :  */
      46              : typedef uint32_t pinctrl_soc_pin_t;
      47              : 
      48              : /**
      49              :  * @brief Utility macro to initialize each pin.
      50              :  *
      51              :  * @param node_id Node identifier.
      52              :  * @param prop Property name.
      53              :  * @param idx Property entry index.
      54              :  */
      55              : #define Z_PINCTRL_STATE_PIN_INIT(node_id, prop, idx)                                            \
      56              :         ((DT_PROP_BY_IDX(node_id, prop, idx))                                                   \
      57              :          | (DT_PROP(node_id, bias_pull_up)              << BFLB_PINMUX_PULL_UP_POS)               \
      58              :          | (DT_PROP(node_id, bias_pull_down)            << BFLB_PINMUX_PULL_DOWN_POS)             \
      59              :          | (DT_PROP(node_id, output_enable)             << BFLB_PINMUX_OE_POS)                    \
      60              :          | (DT_PROP(node_id, input_schmitt_enable)      << BFLB_PINMUX_SMT_POS)                   \
      61              :          | (DT_ENUM_IDX(node_id, drive_strength)        << BFLB_PINMUX_DRIVER_STRENGTH_POS)       \
      62              :         ),
      63              : 
      64              : /**
      65              :  * @brief Utility macro to initialize state pins contained in a given property.
      66              :  *
      67              :  * @param node_id Node identifier.
      68              :  * @param prop Property name describing state pins.
      69              :  */
      70              : #define Z_PINCTRL_STATE_PINS_INIT(node_id, prop)                               \
      71              :         {DT_FOREACH_CHILD_VARGS(DT_PHANDLE(node_id, prop),                     \
      72              :                                 DT_FOREACH_PROP_ELEM, pinmux,                  \
      73              :                                 Z_PINCTRL_STATE_PIN_INIT)}
      74              : 
      75              : /** @endcond */
      76              : 
      77              : #ifdef __cplusplus
      78              : }
      79              : #endif
      80              : 
      81              : /* clang-format on */
      82              : 
      83              : #endif /* ZEPHYR_INCLUDE_DRIVERS_PINCTRL_PINCTRL_SOC_BFLB_COMMON_H_ */
        

Generated by: LCOV version 2.0-1