30 #ifndef __BOOTLOADER_COMMON_H__ 31 #define __BOOTLOADER_COMMON_H__ 39 #include "bootloader_common.h" 40 #include "fsl_common.h" 42 #if defined(BOOTLOADER_HOST) 43 #include "blfwk/bootloader_config.h" 45 #include "../src/buspal_config.h" 47 #include "bootloader_config.h" 48 #include "target_config.h" 63 #define USE_ONLY_UART(instance) (defined(BL_FEATURE_UART_OPTIMIZE) && (BL_UART_USED_INSTANCE == instance)) 64 #define USE_ONLY_SPI(instance) (defined(BL_FEATURE_SPI_OPTIMIZE) && (BL_SPI_USED_INSTANCE == instance)) 65 #define USE_ONLY_I2C(instance) (defined(BL_FEATURE_I2C_OPTIMIZE) && (BL_I2C_USED_INSTANCE == instance)) 70 #define MIN(a, b) ((a) < (b) ? (a) : (b)) 74 #define MAX(a, b) ((a) > (b) ? (a) : (b)) 79 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 83 #define BSWAP_16(x) (uint16_t)((((x)&0xFF00) >> 0x8) | (((x)&0xFF) << 0x8)) 84 #define BSWAP_32(val) \ 85 (uint32_t)((BSWAP_16((uint32_t)(val) & (uint32_t)0xFFFF) << 0x10) | (BSWAP_16((uint32_t)((val) >> 0x10)))) 91 #define ALIGN_DOWN(x, a) ((x) & -(a)) 94 #define ALIGN_UP(x, a) (-(-(x) & -(a))) 103 #define FOUR_CHAR_CODE(a, b, c, d) (((d) << 24) | ((c) << 16) | ((b) << 8) | ((a))) 105 #if (defined(DEBUG) || defined(_DEBUG)) && !defined(DEBUG_PRINT_DISABLE) 106 static inline void debug_printf(
const char *format, ...);
111 static inline void debug_printf(
const char *format, ...)
114 va_start(args, format);
115 vprintf(format, args);
117 #if defined(__ICCARM__) 118 #pragma diag_suppress = Pm049 121 #if defined(__ICCARM__) 122 #pragma diag_default = Pm049 125 #else // (DEBUG || _DEBUG) && !DEBUG_PRINT_DISABLE 127 #define debug_printf(x, ...) \ 131 #endif // (DEBUG || _DEBUG) && !DEBUG_PRINT_DISABLE 161 #if defined(__CC_ARM) 168 typedef union StandardVersion
179 #if defined(__cplusplus) 184 StandardVersion(uint32_t version)
198 kExternalMemId_QuadSPI0 = 1,
202 typedef enum _bootloader_clock_option
204 kClockOption_EnterBootloader = 0,
205 kClockOption_ExitBootloader = 1,
206 } bootloader_clock_option_t;
299 #endif // __BOOTLOADER_COMMON_H__ status_t get_qspi_otfad_init_status(void)
Return status for intializing qspi and otfad modules.
Definition: bl_misc.c:236
Memory interface status group number (102).
Definition: bootloader_common.h:145
uint32_t version
combined version numbers
Definition: bootloader_common.h:177
Definition: fsl_common.h:105
bool is_in_execute_only_region(uint32_t start, uint32_t lengthInBytes)
Check if data to be accessed is in execute-only region.
Definition: bl_misc.c:249
uint32_t get_available_lirc_clock(void)
Returns the available lirc clock frequency in Hertz.
void bootloader_watchdog_init(void)
Initialize watchdog.
void Reset_Handler(void)
Declaration for the reset handler, which is defined in assembler.
uint32_t get_bus_clock(void)
Returns the current bus clock frequency in Hertz.
Definition: MK65F18/src/bus_pal_hardware.c:858
bool usb_clock_init(void)
Configure usb clock.
Definition: MK65F18/src/bus_pal_hardware.c:285
Bootloader status group number (100).
Definition: bootloader_common.h:143
void configure_clocks(bootloader_clock_option_t option)
Returns the logic level of the board specific GPIO pin used for autobaud.
void disable_autobaud_pin_irq(uint32_t instance)
Disables the autobaud pin IRQ for the instance passed.
_bl_status_groups
Bootloader status group numbers.
Definition: bootloader_common.h:141
uint32_t get_system_core_clock(void)
Returns the current core clock frequency in Hertz.
void init_hardware(void)
Initialize the hardware such as pinmux.
Definition: hardware_init_MK80F25615.c:49
_bl_driver_status_groups
Driver status group numbers.
Definition: bootloader_common.h:155
QSPI driver status group number.
Definition: bootloader_common.h:157
Property store status group number (103).
Definition: bootloader_common.h:146
void(* pin_irq_callback_t)(uint32_t instance)
Callback function invoked for a pin change interrupt.
Definition: bootloader_common.h:136
SB loader status group number (101).
Definition: bootloader_common.h:144
_external_mem_identifiers
External memory identifiers.
Definition: bootloader_common.h:196
uint32_t get_uart_clock(uint32_t instance)
Returns the value in MHz of the UART clock based on the instance.
Definition: host_hardware.c:303
bool qspi_need_configure(void)
Determine if QSPI module to be configured.
Definition: bl_misc.c:97
bool is_second_core_present(void)
Check if second core is present.
status_t otfad_init_as_needed(void)
Initialize QSPI and OTFAD module.
Definition: bl_misc.c:108
Structure of version property.
Definition: bootloader_common.h:168
void update_available_peripherals(void)
Update available peripherals based on specific chips.
void bootloader_watchdog_service(void)
Service watchdog.
void bootloader_watchdog_deinit(void)
De-initialize watchdog.
Application crc check status group number (104).
Definition: bootloader_common.h:147
void enable_autobaud_pin_irq(uint32_t instance, pin_irq_callback_t func)
Enables the autobaud pin IRQ for the specific instance passed.
bool is_qspi_present(void)
Determine if QSPI memory is present or not.
Definition: bl_misc.c:152
OTFAD driver status group number.
Definition: bootloader_common.h:158
bool is_ltc_present(void)
Determine if LTC module is present or not.
Definition: bl_misc.c:175
bool is_boot_pin_asserted(void)
Returns true if reset BOOTROM mode is selected.
void deinit_hardware(void)
DeInitialize the hardware such as disabling port clock gate.
bool is_otfad_present(void)
Determine if OTFAD module is present or not.
Definition: bl_misc.c:162
Packetizer status group number (105).
Definition: bootloader_common.h:148
int32_t status_t
Type used for all status and error return values.
Definition: fsl_common.h:121
Reliable Update status groupt number (106).
Definition: bootloader_common.h:149
void update_qspi_otfad_init_status(status_t initStatus)
Update status for intializing qspi and otfad modules
Definition: bl_misc.c:242
bool is_secondary_i2c_slave_address_enabled(void)
Determine is the Secondary I2C slave address is enabled.