|
| 1 | +/***************************************************************************//** |
| 2 | +* \file cytfm_flash_info.c |
| 3 | +* |
| 4 | +* Description: |
| 5 | +* Provides Flash characteristics information for target CYTFM_064B0S2_4343W |
| 6 | +* Cypress board. |
| 7 | +* |
| 8 | +******************************************************************************** |
| 9 | +* \copyright |
| 10 | +* Copyright 2020 Cypress Semiconductor Corporation |
| 11 | +* SPDX-License-Identifier: Apache-2.0 |
| 12 | +* |
| 13 | +* Licensed under the Apache License, Version 2.0 (the "License"); |
| 14 | +* you may not use this file except in compliance with the License. |
| 15 | +* You may obtain a copy of the License at |
| 16 | +* |
| 17 | +* http://www.apache.org/licenses/LICENSE-2.0 |
| 18 | +* |
| 19 | +* Unless required by applicable law or agreed to in writing, software |
| 20 | +* distributed under the License is distributed on an "AS IS" BASIS, |
| 21 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 22 | +* See the License for the specific language governing permissions and |
| 23 | +* limitations under the License. |
| 24 | +*******************************************************************************/ |
| 25 | +#include "cyhal_flash.h" |
| 26 | +#include "region_defs.h" |
| 27 | +#include "cytfm_flash_info.h" |
| 28 | + |
| 29 | +#if DEVICE_FLASH |
| 30 | + |
| 31 | +#ifdef __cplusplus |
| 32 | +extern "C" { |
| 33 | +#endif |
| 34 | + |
| 35 | +/* Flash layout for App on TARGET_CYTFM_064B0S2_4343W |
| 36 | + * +--------------------------+ |
| 37 | + * | | |
| 38 | + * | KVSTORE | }+ MBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_SIZE |
| 39 | + * | | |
| 40 | + * +--------------------------+ |
| 41 | + * | | |
| 42 | + * | | |
| 43 | + * | NS partition for App | }+ NS_PARTITION_SIZE |
| 44 | + * | | |
| 45 | + * | | |
| 46 | + * +--------------------------+ <-+ NS_PARTITION_START |
| 47 | + */ |
| 48 | + |
| 49 | +static const cyhal_flash_block_info_t CYTFM_FLASH_BLOCKS[2] = |
| 50 | +{ |
| 51 | + // Main Flash |
| 52 | + { |
| 53 | + .start_address = NS_PARTITION_START, |
| 54 | + .size = NS_PARTITION_SIZE + MBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_SIZE, |
| 55 | + .sector_size = CY_FLASH_SIZEOF_ROW, |
| 56 | + .page_size = CY_FLASH_SIZEOF_ROW, |
| 57 | + .erase_value = 0x00U, |
| 58 | + }, |
| 59 | + // Working Flash |
| 60 | + { |
| 61 | + .start_address = CY_EM_EEPROM_BASE, |
| 62 | + .size = CY_EM_EEPROM_SIZE, |
| 63 | + .sector_size = CY_FLASH_SIZEOF_ROW, |
| 64 | + .page_size = CY_FLASH_SIZEOF_ROW, |
| 65 | + .erase_value = 0x00U, |
| 66 | + }, |
| 67 | +}; |
| 68 | + |
| 69 | +void cytfm_flash_get_info(const cyhal_flash_t *obj, cyhal_flash_info_t *info) |
| 70 | +{ |
| 71 | + CY_UNUSED_PARAMETER(obj); |
| 72 | + CY_ASSERT(NULL != obj); |
| 73 | + |
| 74 | + info->block_count = |
| 75 | + sizeof(CYTFM_FLASH_BLOCKS) / sizeof(cyhal_flash_block_info_t); |
| 76 | + info->blocks = CYTFM_FLASH_BLOCKS; |
| 77 | +} |
| 78 | + |
| 79 | +#ifdef __cplusplus |
| 80 | +} |
| 81 | +#endif |
| 82 | + |
| 83 | +#endif |
0 commit comments