1 /*
2  * Copyright 2021 NXP
3  * All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 #ifndef _FSL_RUN_BOOTLOADER_H_
8 #define _FSL_RUN_BOOTLOADER_H_
9 
10 #include "fsl_common.h"
11 
12 /*!
13  * @addtogroup runbootloader
14  * @{
15  */
16 /*******************************************************************************
17  * Definitions
18  ******************************************************************************/
19 
20 /*   API prototype fields definition.
21 | 31 : 24  	|    23 : 20    	|     19 : 16        |  15 : 12             |  11 : 8     |  7 : 0  |
22     |     Tag  	|   Boot mode   	| bootloader periphal|  Instance            |  Image Index| Reserved  |
23 |           | 			    	|					 |  Used For Boot mode 0|             |           |
24 |			| 0: Passive mode   | 0 - Auto detection |            		    |             |           |
25 |			| 1: ISP mode   	| 1 - USB-HID        |            		    |             |           |
26 |			|					| 2 - UART           |            		    |             |           |
27 |			|					| 3 - SPI            |            		    |             |           |
28 |			|					| 4 - I2C            |            		    |             |           |
29 |			|					| 5 - CAN		     |            		    |             |           |
30 */
31 
32 typedef struct
33 {
34     union
35     {
36         struct
37         {
38             uint32_t reserved : 8;
39             uint32_t boot_image_index : 4;
40             uint32_t instance : 4;
41             uint32_t boot_interface : 4;
42             uint32_t mode : 4;
43             uint32_t tag : 8;
44         } B;
45         uint32_t U;
46     } option;
47 } user_app_boot_invoke_option_t;
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
53 /*******************************************************************************
54  * API
55  ******************************************************************************/
56 
57 /*!
58  * @brief Run the Bootloader API  to force into the ISP mode base on the user arg
59  *
60  * @param arg Indicates API prototype fields definition. Refer to the above user_app_boot_invoke_option_t structure
61  */
62 void bootloader_user_entry(void *arg);
63 
64 #ifdef __cplusplus
65 }
66 #endif
67 
68 /**
69  * @}
70  */
71 
72 #endif /* _FSL_RUN_BOOTLOADER_H_ */
73