1 /* 2 * Copyright (c) 2024 Renesas Electronics Corporation 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 7 #ifndef __ZEPHYR_INCLUDE_DRIVERS_FLASH_RA_EXTENSIONS_H__ 8 #define __ZEPHYR_INCLUDE_DRIVERS_FLASH_RA_EXTENSIONS_H__ 9 10 #include <zephyr/drivers/flash.h> 11 12 enum ra_ex_ops { 13 FLASH_RA_EX_OP_WRITE_PROTECT = FLASH_EX_OP_VENDOR_BASE, 14 }; 15 16 typedef struct { 17 union { 18 uint32_t BPS[4]; 19 20 struct { 21 uint32_t b000: 1; 22 uint32_t b001: 1; 23 uint32_t b002: 1; 24 uint32_t b003: 1; 25 uint32_t b004: 1; 26 uint32_t b005: 1; 27 uint32_t b006: 1; 28 uint32_t b007: 1; 29 uint32_t b008: 1; 30 uint32_t b009: 1; 31 uint32_t b010: 1; 32 uint32_t b011: 1; 33 uint32_t b012: 1; 34 uint32_t b013: 1; 35 uint32_t b014: 1; 36 uint32_t b015: 1; 37 uint32_t b016: 1; 38 uint32_t b017: 1; 39 uint32_t b018: 1; 40 uint32_t b019: 1; 41 uint32_t b020: 1; 42 uint32_t b021: 1; 43 uint32_t b022: 1; 44 uint32_t b023: 1; 45 uint32_t b024: 1; 46 uint32_t b025: 1; 47 uint32_t b026: 1; 48 uint32_t b027: 1; 49 uint32_t b028: 1; 50 uint32_t b029: 1; 51 uint32_t b030: 1; 52 uint32_t b031: 1; 53 uint32_t b032: 1; 54 uint32_t b033: 1; 55 uint32_t b034: 1; 56 uint32_t b035: 1; 57 uint32_t b036: 1; 58 uint32_t b037: 1; 59 uint32_t b038: 1; 60 uint32_t b039: 1; 61 uint32_t b040: 1; 62 uint32_t b041: 1; 63 uint32_t b042: 1; 64 uint32_t b043: 1; 65 uint32_t b044: 1; 66 uint32_t b045: 1; 67 uint32_t b046: 1; 68 uint32_t b047: 1; 69 uint32_t b048: 1; 70 uint32_t b049: 1; 71 uint32_t b050: 1; 72 uint32_t b051: 1; 73 uint32_t b052: 1; 74 uint32_t b053: 1; 75 uint32_t b054: 1; 76 uint32_t b055: 1; 77 uint32_t b056: 1; 78 uint32_t b057: 1; 79 uint32_t b058: 1; 80 uint32_t b059: 1; 81 uint32_t b060: 1; 82 uint32_t b061: 1; 83 uint32_t b062: 1; 84 uint32_t b063: 1; 85 uint32_t b064: 1; 86 uint32_t b065: 1; 87 uint32_t b066: 1; 88 uint32_t b067: 1; 89 uint32_t b068: 1; 90 uint32_t b069: 1; 91 uint32_t b070: 1; 92 uint32_t b071: 1; 93 uint32_t b072: 1; 94 uint32_t b073: 1; 95 uint32_t b074: 1; 96 uint32_t b075: 1; 97 uint32_t b076: 1; 98 uint32_t b077: 1; 99 uint32_t b078: 1; 100 uint32_t b079: 1; 101 uint32_t b080: 1; 102 uint32_t b081: 1; 103 uint32_t b082: 1; 104 uint32_t b083: 1; 105 uint32_t b084: 1; 106 uint32_t b085: 1; 107 uint32_t b086: 1; 108 uint32_t b087: 1; 109 uint32_t b088: 1; 110 uint32_t b089: 1; 111 uint32_t b090: 1; 112 uint32_t b091: 1; 113 uint32_t b092: 1; 114 uint32_t b093: 1; 115 uint32_t b094: 1; 116 uint32_t b095: 1; 117 uint32_t b096: 1; 118 uint32_t b097: 1; 119 uint32_t b098: 1; 120 uint32_t b099: 1; 121 uint32_t b100: 1; 122 uint32_t b101: 1; 123 uint32_t b102: 1; 124 uint32_t b103: 1; 125 uint32_t b104: 1; 126 uint32_t b105: 1; 127 uint32_t b106: 1; 128 uint32_t: 21; 129 } BPS_b; 130 }; 131 } flash_ra_cf_block_map; 132 133 #if defined(CONFIG_FLASH_RA_WRITE_PROTECT) 134 typedef struct flash_ra_ex_write_protect_in { 135 flash_ra_cf_block_map protect_enable; 136 flash_ra_cf_block_map protect_disable; 137 flash_ra_cf_block_map protect_permanent; 138 } flash_ra_ex_write_protect_in_t; 139 140 typedef struct flash_ra_ex_write_protect_out { 141 flash_ra_cf_block_map protected_enabled; 142 flash_ra_cf_block_map protected_premanent; 143 } flash_ra_ex_write_protect_out_t; 144 #endif /* CONFIG_FLASH_RA_WRITE_PROTECT */ 145 146 #endif 147