31 #ifndef __HOST_COMMAND_H__ 32 #define __HOST_COMMAND_H__ 36 #include "bootloader_common.h" 37 #include "property/property.h" 38 #include "packet/serial_packet.h" 45 enum _transfer_mode_type
54 #if DEBUG && !DEBUG_PRINT_DISABLE 56 static const char *
const kCommandNames[] = {
"flash-erase-all",
61 "flash-security-disable",
68 "flash-erase-all-unsecure",
71 "flash-read-resource",
82 typedef struct _command_frame_packet
92 typedef struct _generic_response_frame_packet
106 typedef struct _flash_read_once_response_frame_packet
115 typedef struct _property_response_frame_packet
123 typedef struct _memory_info
131 uint32_t reservedFlashStart;
132 uint32_t reservedFlashEnd;
133 uint32_t reservedRamStart;
134 uint32_t reservedRamEnd;
136 uint32_t blankFlashStart;
137 uint32_t blankFlashSize;
138 uint32_t blankRamStart;
139 uint32_t blankRamSize;
143 typedef struct _write_memory_test_option
146 uint32_t writeLength;
148 uint64_t averageCost;
149 uint32_t averageSpeed;
154 typedef struct _command_info
161 typedef status_t (*transfer_data_t)(uint8_t *data, uint32_t length);
162 extern transfer_data_t write_serial_data;
163 extern transfer_data_t read_serial_data;
168 #if defined(__cplusplus) 173 status_t handle_getProperty_command(uint8_t input_param, uint32_t *response_param);
176 status_t handle_setProperty_command(uint8_t property_tag, uint32_t property_value);
179 status_t handle_flashEraseAllUnsecure_command(
void);
182 status_t handle_flashEraseAll_command(
void);
185 status_t handle_flashEraseRegion_command(uint32_t start_address, uint32_t erase_bytes);
188 status_t handle_reset_command(
void);
191 status_t handle_writeMemory_command(uint32_t start_address, uint8_t *buffer, uint32_t length);
194 status_t handle_readMemory_command(uint32_t start_address, uint8_t *buffer, uint32_t length);
197 status_t handle_fillMemory_command(uint32_t start_address, uint32_t pattern_word, uint32_t byte_count);
200 status_t handle_flashSecurityDisable_command(uint32_t backdoorkey_low, uint32_t backdoorkey_high);
203 status_t handle_execute_command(uint32_t address, uint32_t arg, uint32_t stack_pointer);
206 status_t handle_call_command(uint32_t address, uint32_t arg);
209 status_t handle_flashProgramOnce_command(uint32_t index, uint32_t byte_count, uint32_t data1, uint32_t data2);
212 status_t handle_flashReadOnce_command(uint32_t index, uint32_t byte_count, uint32_t *data1, uint32_t *data2);
215 status_t handle_flashReadResource_command(uint32_t start_address, uint8_t *buffer, uint32_t length, uint32_t option);
218 status_t handle_receiveSBFile_command(uint32_t address, uint32_t length);
230 status_t wait_ping_response(uint8_t try_count);
239 void check_transfer_bus(uint8_t transfer_bus, uint32_t *input_freq);
242 void configure_transfer_bus(uint8_t transfer_bus, uint32_t freq);
244 #if defined(__cplusplus) uint8_t parameterCount
Definition: host_command.h:98
target memory info
Definition: host_command.h:123
uint8_t flags
Definition: host_command.h:96
Command packet format.
Definition: command_packet.h:113
generic response packet
Definition: host_command.h:106
Get Property response packet format.
Definition: command_packet.h:290
generic response packet
Definition: host_command.h:115
memory test options
Definition: host_command.h:143
generic response packet
Definition: host_command.h:92
uint8_t commandTag
Definition: host_command.h:95
uint32_t param_commandTag
Definition: host_command.h:100
Flash Read Once response packet format.
Definition: command_packet.h:306
Serial framing data packet.
Definition: serial_packet.h:106
uint8_t reserved
Definition: host_command.h:97
command packet
Definition: host_command.h:82
int32_t status_t
Type used for all status and error return values.
Definition: fsl_common.h:121
bootloader command info
Definition: host_command.h:154
uint32_t status
Definition: host_command.h:99