1 /* 2 * Copyright 2020 NXP 3 * All rights reserved. 4 * 5 * 6 * SPDX-License-Identifier: BSD-3-Clause 7 */ 8 9 #ifndef __NVM_ADAPTER_H__ 10 #define __NVM_ADAPTER_H__ 11 12 #include "NVM_Interface.h" 13 14 #if (defined(__CC_ARM) || defined(__ARMCC_VERSION)) 15 16 #define NVM_ADAPTER_TABLE(table) const table __attribute__((section("NVM_ADAPTER_TABLE"), used)) 17 18 #elif defined(__GNUC__) 19 20 #define __section_define(x) __attribute__((section("" #x), used)) 21 #define NVM_ADAPTER_TABLE(table) const __section_define(.NVM_ADAPTER_TABLE) table 22 23 #elif (defined(__IAR_SYSTEMS_ICC__)) 24 25 #pragma section = "NVM_ADAPTER_TABLE" 26 27 #define NVM_ADAPTER_TABLE(table) const table @ "NVM_ADAPTER_TABLE" 28 29 #else 30 #error unsupported tool-chain for NVM adapter! 31 #endif 32 33 typedef int (*nvm_adapter_table_init)(void); 34 typedef int (*nvm_adapter_table_load)(void); 35 typedef int (*nvm_adapter_table_commit)(void); 36 37 typedef struct _nvm_adapter_table 38 { 39 NVM_DataEntry_t *table; 40 uint32_t tableCount; 41 nvm_adapter_table_init init; 42 nvm_adapter_table_load load; 43 nvm_adapter_table_commit commit; 44 } nvm_adapter_table_t; 45 46 int NVM_AdapterInit(void); 47 int NVM_AdapterLoad(void); 48 49 #endif /* __NVM_ADAPTER_H__ */ 50