David Vincze | 225c58f | 2019-12-09 17:32:48 +0100 | [diff] [blame] | 1 | /* Manual version of auto-generated version. */ |
| 2 | |
| 3 | /* |
| 4 | * Original code taken from mcuboot project at: |
Tamas Ban | c5b2f2b | 2020-11-12 09:47:05 +0000 | [diff] [blame^] | 5 | * https://github.com/mcu-tools/mcuboot |
David Vincze | 225c58f | 2019-12-09 17:32:48 +0100 | [diff] [blame] | 6 | * Git SHA of the original version: ac55554059147fff718015be9f4bd3108123f50a |
| 7 | * Modifications are Copyright (c) 2020 Arm Limited. |
| 8 | */ |
| 9 | |
| 10 | #ifndef __SYSFLASH_H__ |
| 11 | #define __SYSFLASH_H__ |
| 12 | |
| 13 | #include "flash_layout.h" |
| 14 | |
| 15 | #ifdef __cplusplus |
| 16 | extern "C" { |
| 17 | #endif |
| 18 | |
| 19 | #if (MCUBOOT_IMAGE_NUMBER == 1) |
| 20 | /* |
| 21 | * NOTE: the definition below returns the same values for true/false on |
| 22 | * purpose, to avoid having to mark x as non-used by all callers when |
| 23 | * running in single image mode. |
| 24 | */ |
| 25 | #define FLASH_AREA_IMAGE_PRIMARY(x) (((x) == 0) ? FLASH_AREA_0_ID : \ |
| 26 | FLASH_AREA_0_ID) |
| 27 | #define FLASH_AREA_IMAGE_SECONDARY(x) (((x) == 0) ? FLASH_AREA_2_ID : \ |
| 28 | FLASH_AREA_2_ID) |
| 29 | #elif (MCUBOOT_IMAGE_NUMBER == 2) |
| 30 | /* MCUBoot currently supports only up to 2 updatable firmware images. |
| 31 | * If the number of the current image is greater than MCUBOOT_IMAGE_NUMBER - 1 |
| 32 | * then a dummy value will be assigned to the flash area macros. |
| 33 | */ |
| 34 | #define FLASH_AREA_IMAGE_PRIMARY(x) (((x) == 0) ? FLASH_AREA_0_ID : \ |
| 35 | ((x) == 1) ? FLASH_AREA_1_ID : \ |
| 36 | 255 ) |
| 37 | #define FLASH_AREA_IMAGE_SECONDARY(x) (((x) == 0) ? FLASH_AREA_2_ID : \ |
| 38 | ((x) == 1) ? FLASH_AREA_3_ID : \ |
| 39 | 255 ) |
| 40 | #else |
| 41 | #error "Image slot and flash area mapping is not defined" |
| 42 | #endif |
| 43 | |
| 44 | #define FLASH_AREA_IMAGE_SCRATCH FLASH_AREA_SCRATCH_ID |
| 45 | |
| 46 | #ifdef __cplusplus |
| 47 | } |
| 48 | #endif |
| 49 | |
| 50 | #endif /* __SYSFLASH_H__ */ |