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

            Line data    Source code
       1            1 : /*
       2              :  * Copyright (c) 2024-2025 Renesas Electronics Corporation
       3              :  *
       4              :  * SPDX-License-Identifier: Apache-2.0
       5              :  */
       6              : 
       7              : /**
       8              :  * @file
       9              :  * @brief Header file for Renesas RA flash extended operations.
      10              :  * @ingroup ra_flash_ex_op
      11              :  */
      12              : 
      13              : #ifndef __ZEPHYR_INCLUDE_DRIVERS_FLASH_RA_FLASH_API_EXTENSIONS_H__
      14              : #define __ZEPHYR_INCLUDE_DRIVERS_FLASH_RA_FLASH_API_EXTENSIONS_H__
      15              : 
      16              : /**
      17              :  * @brief Extended operations for Renesas RA flash controllers.
      18              :  * @defgroup ra_flash_ex_op Renesas RA
      19              :  * @ingroup flash_ex_op
      20              :  * @{
      21              :  */
      22              : 
      23              : #include <zephyr/drivers/flash.h>
      24              : 
      25              : /**
      26              :  * @brief Enumeration for Renesas RA flash extended operations.
      27              :  */
      28            1 : enum ra_ex_ops {
      29              :         /**
      30              :          * Renesas RA flash write protection control.
      31              :          *
      32              :          * @kconfig_dep{CONFIG_FLASH_RENESAS_RA_HP_WRITE_PROTECT}
      33              :          *
      34              :          * @param in Pointer to a @ref flash_ra_ex_write_protect_in_t structure specifying the
      35              :          *           desired changes to the write protection settings. Can be @a NULL if only
      36              :          *           retrieving the current write protection settings is desired.
      37              :          * @param out Pointer to a @ref flash_ra_ex_write_protect_out_t structure to store the
      38              :          *            current write protection settings. Can be @a NULL if the statis is not needed.
      39              :          */
      40              :         FLASH_RA_EX_OP_WRITE_PROTECT = FLASH_EX_OP_VENDOR_BASE,
      41              :         /**
      42              :          * Reset Flash device (at QPI(4-4-4) mode).
      43              :          */
      44              :         QSPI_FLASH_EX_OP_EXIT_QPI,
      45              : };
      46              : 
      47              : /**
      48              :  * @brief A bitmask structure for mapping code flash blocks.
      49              :  *
      50              :  * This structure provides a bitfield representation for the code flash blocks,
      51              :  * allowing individual blocks to be selected for operations like write protection.
      52              :  * Each bit from b000 to b106 corresponds to a specific code flash block.
      53              : 
      54              :  * Setting a bit to '1' in a mask selects that block for an operation.
      55              :  */
      56            1 : typedef struct {
      57              :         /** Union allowing access to the block map as an array of 32-bit words or as bitfields. */
      58              :         union {
      59              :                 /** Access the block map as an array of 32-bit words. */
      60            1 :                 uint32_t BPS[4];
      61              : 
      62              :                 /** Access individual blocks as bitfields. */
      63              :                 struct {
      64            1 :                         uint32_t b000: 1; /**< Block 0 */
      65            1 :                         uint32_t b001: 1; /**< Block 1 */
      66            1 :                         uint32_t b002: 1; /**< Block 2 */
      67            1 :                         uint32_t b003: 1; /**< Block 3 */
      68            1 :                         uint32_t b004: 1; /**< Block 4 */
      69            1 :                         uint32_t b005: 1; /**< Block 5 */
      70            1 :                         uint32_t b006: 1; /**< Block 6 */
      71            1 :                         uint32_t b007: 1; /**< Block 7 */
      72            1 :                         uint32_t b008: 1; /**< Block 8 */
      73            1 :                         uint32_t b009: 1; /**< Block 9 */
      74            1 :                         uint32_t b010: 1; /**< Block 10 */
      75            1 :                         uint32_t b011: 1; /**< Block 11 */
      76            1 :                         uint32_t b012: 1; /**< Block 12 */
      77            1 :                         uint32_t b013: 1; /**< Block 13 */
      78            1 :                         uint32_t b014: 1; /**< Block 14 */
      79            1 :                         uint32_t b015: 1; /**< Block 15 */
      80            1 :                         uint32_t b016: 1; /**< Block 16 */
      81            1 :                         uint32_t b017: 1; /**< Block 17 */
      82            1 :                         uint32_t b018: 1; /**< Block 18 */
      83            1 :                         uint32_t b019: 1; /**< Block 19 */
      84            1 :                         uint32_t b020: 1; /**< Block 20 */
      85            1 :                         uint32_t b021: 1; /**< Block 21 */
      86            1 :                         uint32_t b022: 1; /**< Block 22 */
      87            1 :                         uint32_t b023: 1; /**< Block 23 */
      88            1 :                         uint32_t b024: 1; /**< Block 24 */
      89            1 :                         uint32_t b025: 1; /**< Block 25 */
      90            1 :                         uint32_t b026: 1; /**< Block 26 */
      91            1 :                         uint32_t b027: 1; /**< Block 27 */
      92            1 :                         uint32_t b028: 1; /**< Block 28 */
      93            1 :                         uint32_t b029: 1; /**< Block 29 */
      94            1 :                         uint32_t b030: 1; /**< Block 30 */
      95            1 :                         uint32_t b031: 1; /**< Block 31 */
      96            1 :                         uint32_t b032: 1; /**< Block 32 */
      97            1 :                         uint32_t b033: 1; /**< Block 33 */
      98            1 :                         uint32_t b034: 1; /**< Block 34 */
      99            1 :                         uint32_t b035: 1; /**< Block 35 */
     100            1 :                         uint32_t b036: 1; /**< Block 36 */
     101            1 :                         uint32_t b037: 1; /**< Block 37 */
     102            1 :                         uint32_t b038: 1; /**< Block 38 */
     103            1 :                         uint32_t b039: 1; /**< Block 39 */
     104            1 :                         uint32_t b040: 1; /**< Block 40 */
     105            1 :                         uint32_t b041: 1; /**< Block 41 */
     106            1 :                         uint32_t b042: 1; /**< Block 42 */
     107            1 :                         uint32_t b043: 1; /**< Block 43 */
     108            1 :                         uint32_t b044: 1; /**< Block 44 */
     109            1 :                         uint32_t b045: 1; /**< Block 45 */
     110            1 :                         uint32_t b046: 1; /**< Block 46 */
     111            1 :                         uint32_t b047: 1; /**< Block 47 */
     112            1 :                         uint32_t b048: 1; /**< Block 48 */
     113            1 :                         uint32_t b049: 1; /**< Block 49 */
     114            1 :                         uint32_t b050: 1; /**< Block 50 */
     115            1 :                         uint32_t b051: 1; /**< Block 51 */
     116            1 :                         uint32_t b052: 1; /**< Block 52 */
     117            1 :                         uint32_t b053: 1; /**< Block 53 */
     118            1 :                         uint32_t b054: 1; /**< Block 54 */
     119            1 :                         uint32_t b055: 1; /**< Block 55 */
     120            1 :                         uint32_t b056: 1; /**< Block 56 */
     121            1 :                         uint32_t b057: 1; /**< Block 57 */
     122            1 :                         uint32_t b058: 1; /**< Block 58 */
     123            1 :                         uint32_t b059: 1; /**< Block 59 */
     124            1 :                         uint32_t b060: 1; /**< Block 60 */
     125            1 :                         uint32_t b061: 1; /**< Block 61 */
     126            1 :                         uint32_t b062: 1; /**< Block 62 */
     127            1 :                         uint32_t b063: 1; /**< Block 63 */
     128            1 :                         uint32_t b064: 1; /**< Block 64 */
     129            1 :                         uint32_t b065: 1; /**< Block 65 */
     130            1 :                         uint32_t b066: 1; /**< Block 66 */
     131            1 :                         uint32_t b067: 1; /**< Block 67 */
     132            1 :                         uint32_t b068: 1; /**< Block 68 */
     133            1 :                         uint32_t b069: 1; /**< Block 69 */
     134            1 :                         uint32_t b070: 1; /**< Block 70 */
     135            1 :                         uint32_t b071: 1; /**< Block 71 */
     136            1 :                         uint32_t b072: 1; /**< Block 72 */
     137            1 :                         uint32_t b073: 1; /**< Block 73 */
     138            1 :                         uint32_t b074: 1; /**< Block 74 */
     139            1 :                         uint32_t b075: 1; /**< Block 75 */
     140            1 :                         uint32_t b076: 1; /**< Block 76 */
     141            1 :                         uint32_t b077: 1; /**< Block 77 */
     142            1 :                         uint32_t b078: 1; /**< Block 78 */
     143            1 :                         uint32_t b079: 1; /**< Block 79 */
     144            1 :                         uint32_t b080: 1; /**< Block 80 */
     145            1 :                         uint32_t b081: 1; /**< Block 81 */
     146            1 :                         uint32_t b082: 1; /**< Block 82 */
     147            1 :                         uint32_t b083: 1; /**< Block 83 */
     148            1 :                         uint32_t b084: 1; /**< Block 84 */
     149            1 :                         uint32_t b085: 1; /**< Block 85 */
     150            1 :                         uint32_t b086: 1; /**< Block 86 */
     151            1 :                         uint32_t b087: 1; /**< Block 87 */
     152            1 :                         uint32_t b088: 1; /**< Block 88 */
     153            1 :                         uint32_t b089: 1; /**< Block 89 */
     154            1 :                         uint32_t b090: 1; /**< Block 90 */
     155            1 :                         uint32_t b091: 1; /**< Block 91 */
     156            1 :                         uint32_t b092: 1; /**< Block 92 */
     157            1 :                         uint32_t b093: 1; /**< Block 93 */
     158            1 :                         uint32_t b094: 1; /**< Block 94 */
     159            1 :                         uint32_t b095: 1; /**< Block 95 */
     160            1 :                         uint32_t b096: 1; /**< Block 96 */
     161            1 :                         uint32_t b097: 1; /**< Block 97 */
     162            1 :                         uint32_t b098: 1; /**< Block 98 */
     163            1 :                         uint32_t b099: 1; /**< Block 99 */
     164            1 :                         uint32_t b100: 1; /**< Block 100 */
     165            1 :                         uint32_t b101: 1; /**< Block 101 */
     166            1 :                         uint32_t b102: 1; /**< Block 102 */
     167            1 :                         uint32_t b103: 1; /**< Block 103 */
     168            1 :                         uint32_t b104: 1; /**< Block 104 */
     169            1 :                         uint32_t b105: 1; /**< Block 105 */
     170            1 :                         uint32_t b106: 1; /**< Block 106 */
     171              :                         uint32_t: 21;
     172            1 :                 } BPS_b;
     173            1 :         };
     174              : } flash_ra_cf_block_map;
     175              : 
     176              : /**
     177              :  * @brief Input parameters for @ref FLASH_RA_EX_OP_WRITE_PROTECT operation.
     178              :  */
     179            1 : typedef struct flash_ra_ex_write_protect_in {
     180              :         /** Bitmask of blocks to enable write protection for. */
     181            1 :         flash_ra_cf_block_map protect_enable;
     182              :         /** Bitmask of blocks to disable write protection for. */
     183            1 :         flash_ra_cf_block_map protect_disable;
     184              :         /** Bitmask of blocks to permanently enable write protection for. */
     185            1 :         flash_ra_cf_block_map protect_permanent;
     186            1 : } flash_ra_ex_write_protect_in_t;
     187              : 
     188              : /**
     189              :  * @brief Output parameters for @ref FLASH_RA_EX_OP_WRITE_PROTECT operation.
     190              :  *
     191              :  * This is populated by the driver to report the current write protection settings.
     192              :  */
     193            1 : typedef struct flash_ra_ex_write_protect_out {
     194              :         /** Bitmask of blocks that are currently write-protected. */
     195            1 :         flash_ra_cf_block_map protected_enabled;
     196              :         /** Bitmask of blocks that are permanently write-protected. */
     197            1 :         flash_ra_cf_block_map protected_premanent;
     198            1 : } flash_ra_ex_write_protect_out_t;
     199              : 
     200              : /**
     201              :  * @}
     202              :  */
     203              : 
     204              : #endif /* __ZEPHYR_INCLUDE_DRIVERS_FLASH_RA_FLASH_API_EXTENSIONS_H__ */
        

Generated by: LCOV version 2.0-1