1 /* 2 * Copyright 2024 NXP 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #include "fsl_romapi_otp.h" 8 #include "fsl_romapi_nboot.h" 9 #include "fsl_romapi_iap.h" 10 #include "fsl_romapi.h" 11 12 /******************************************************************************* 13 * Definitions 14 ******************************************************************************/ 15 /* Component ID definition, used by tools. */ 16 #ifndef FSL_COMPONENT_ID 17 #define FSL_COMPONENT_ID "platform.drivers.romapi" 18 #endif 19 20 /*! @brief Root of the bootloader API tree. 21 * 22 * An instance of this struct resides in read-only memory in the bootloader. It 23 * provides a user application access to APIs exported by the bootloader. 24 * 25 * @note The order of existing fields must not be changed. 26 */ 27 typedef struct BootloaderTree 28 { 29 void (*runBootloader)(void *arg); /*!< Function to start the bootloader executing.*/ 30 const uint32_t version; /*!< Bootloader version number.*/ 31 const char *copyright; /*!< Copyright string.*/ 32 const uint32_t reserved0[7]; /*!< reserved*/ 33 const nboot_interface_t *nbootDriver; /*!< Image authentication API.*/ 34 const uint32_t reserved7; /*!< reserved*/ 35 const ocotp_driver_t *otpDriver; /*!< OTP driver API. */ 36 const iap_api_interface_t *iapApiDriver; /*!< IAP driver API. */ 37 } bootloader_tree_t; 38 39 #define ROM_API_TREE ((bootloader_tree_t *)ROM_API_TREE_ADDR) 40 bootloader_user_entry(void * arg)41void bootloader_user_entry(void *arg) 42 { 43 assert(ROM_API_TREE); 44 ROM_API_TREE->runBootloader(arg); 45 } 46 bootloader_version(void)47uint32_t bootloader_version(void) 48 { 49 assert(ROM_API_TREE); 50 return (ROM_API_TREE->version); 51 } 52 bootloader_copyright(void)53const char *bootloader_copyright(void) 54 { 55 assert(ROM_API_TREE); 56 return (ROM_API_TREE->copyright); 57 } 58