File tree Expand file tree Collapse file tree 5 files changed +14
-0
lines changed
sw/device/silicon_creator/lib/rescue Expand file tree Collapse file tree 5 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -294,14 +294,20 @@ hardened_bool_t rescue_detect_entry(const owner_rescue_config_t *config) {
294294 if (rescue_requested == kHardenedBoolTrue ) {
295295 return kHardenedBoolTrue ;
296296 }
297+ rescue_protocol_t protocol = kRescueProtocolXmodem ;
297298 rescue_detect_t detect = kRescueDetectBreak ;
298299 uint32_t index = 0 ;
299300 uint32_t gpio_val = 0 ;
300301 if ((hardened_bool_t )config != kHardenedBoolFalse ) {
302+ protocol = config -> protocol ;
301303 detect = bitfield_field32_read (config -> detect , RESCUE_DETECT );
302304 index = bitfield_field32_read (config -> detect , RESCUE_DETECT_INDEX );
303305 gpio_val = bitfield_bit32_read (config -> gpio , RESCUE_GPIO_VALUE_BIT );
304306 }
307+ dbg_printf ("info: rescue protocol %c\r\n" , rescue_type );
308+ if (protocol != rescue_type ) {
309+ dbg_printf ("warning: rescue configured for protocol %c\r\n" , protocol );
310+ }
305311 switch (detect ) {
306312 case kRescueDetectNone :
307313 break ;
Original file line number Diff line number Diff line change @@ -86,6 +86,8 @@ typedef struct RescueState {
8686 uint8_t data [2048 ];
8787} rescue_state_t ;
8888
89+ extern const uint32_t rescue_type ;
90+
8991/**
9092 * Handle rescue modes that involve sending data to the host.
9193 *
Original file line number Diff line number Diff line change 2121
2222#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
2323
24+ const uint32_t rescue_type = kRescueProtocolSpiDfu ;
25+
2426enum {
2527 /**
2628 * Base address of the spi_device registers.
Original file line number Diff line number Diff line change 1919
2020#include "hw/top_earlgrey/sw/autogen/top_earlgrey.h"
2121
22+ const uint32_t rescue_type = kRescueProtocolUsbDfu ;
23+
2224static const usb_device_descriptor_t device_desc = {
2325 .length = (uint8_t )sizeof (usb_device_descriptor_t ),
2426 .descriptor_type = kUsbDescTypeDevice ,
Original file line number Diff line number Diff line change 1111#include "sw/device/silicon_creator/lib/rescue/rescue.h"
1212#include "sw/device/silicon_creator/lib/rescue/xmodem.h"
1313
14+ const uint32_t rescue_type = kRescueProtocolXmodem ;
15+
1416// All of the xmodem functions accept an opaque iohandle pointer.
1517// The iohandle is used to facilitate unit tests and doesn't have
1618// any function in real firmware.
You can’t perform that action at this time.
0 commit comments