1 /* 2 * Copyright 2024 NXP 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef FSL_ROMAPI_H_ 8 #define FSL_ROMAPI_H_ 9 /******************************************************************************* 10 * Definitions 11 ******************************************************************************/ 12 #include <stdint.h> 13 #include <fsl_device_registers.h> 14 15 /******************************************************************************* 16 * Definitions 17 ******************************************************************************/ 18 19 /*! @name Driver version */ 20 /*@{*/ 21 /*! @brief ROMAPI driver version 2.0.0. */ 22 #define FSL_ROMAPI_DRIVER_VERSION (MAKE_VERSION(2, 0, 0)) 23 /*@}*/ 24 25 #define ROM_API_TREE_ADDR (0x1303FC00U) 26 27 /*! 28 * @addtogroup runbootloader 29 * @{ 30 */ 31 /******************************************************************************* 32 * Definitions 33 ******************************************************************************/ 34 /* clang-format off */ 35 /* API prototype fields definition. 36 | 31 : 24 | 23 : 20 | 19 : 16 | 15 : 12 | 11 : 8 | 7 : 6 | 5 : 4 | 3 : 0 | 37 | Tag | Boot mode | boot interface | Instance | Reserved | Recovery | Recovery | Reserved | 38 | | | | Used For Boot mode 0| | boot | boot | | 39 | |0: Prime boot mode | ISP boot mode | | |interface |interface | | 40 | |1: ISP mode | 0 - UART | | |configure1|configure0| | 41 | | | 1 - I2C | | | | | | 42 | | | 2 - SPI | | | | | | 43 | | | 3 - USB_HID(USB0) | | | | | | 44 | | | 8 - eUSB(USB1) | | | | | | 45 | | | F - Auto detection | | | | | | 46 | | | Prime boot mode | | | | | | 47 | | | 4 - XSPI NOR | | | | | | 48 | | | 5 - LPSPI NOR | | | | | | 49 | | | 6 - DFU | | | | | | 50 | | | 7 - eMMC | | | | | | 51 52 */ 53 /* clang-format on */ 54 55 typedef struct _user_app_boot_invoke_option 56 { 57 union 58 { 59 struct 60 { 61 uint32_t reserved0 : 4; 62 uint32_t recovery_boot_cfg0 : 2; 63 uint32_t recovery_boot_cfg1 : 2; 64 uint32_t reserved1 : 4; 65 uint32_t instance : 4; 66 uint32_t boot_interface : 4; 67 uint32_t mode : 4; 68 uint32_t tag : 8; 69 } B; 70 uint32_t U; 71 } option; 72 } user_app_boot_invoke_option_t; 73 74 /*! 75 * @brief Run the Bootloader API to force into the ISP mode base on the user arg 76 * 77 * @param arg Indicates API prototype fields definition. Refer to the above user_app_boot_invoke_option_t structure 78 */ 79 void bootloader_user_entry(void *arg); 80 81 /*! 82 * @brief Get Bootloader version 83 * 84 * @retval Bootloader version. 85 */ 86 uint32_t bootloader_version(void); 87 88 /*! 89 * @brief Get Bootloader Copyright 90 * 91 * @retval Pointer to Bootloader copyright header 92 */ 93 const char *bootloader_copyright(void); 94 95 #endif /* FSL_ROMAPI_H_ */ 96