123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- #include "nrf_dfu_mbr.h"
- #include "nrf_mbr.h"
- #include "nrf_dfu_types.h"
- #include "nrf_log.h"
- #include "nrf_bootloader_info.h"
- #define MBR_IRQ_FORWARD_ADDRESS_ADDRESS (0x20000000)
- uint32_t nrf_dfu_mbr_copy_bl(uint32_t * p_src, uint32_t len)
- {
- uint32_t ret_val;
- uint32_t const len_words = len / sizeof(uint32_t);
- sd_mbr_command_t command =
- {
- .command = SD_MBR_COMMAND_COPY_BL,
- .params.copy_bl.bl_src = p_src,
- .params.copy_bl.bl_len = len_words
- };
- ret_val = sd_mbr_command(&command);
- return ret_val;
- }
- uint32_t nrf_dfu_mbr_init_sd(void)
- {
- uint32_t ret_val;
- sd_mbr_command_t command =
- {
- .command = SD_MBR_COMMAND_INIT_SD
- };
- ret_val = sd_mbr_command(&command);
- return ret_val;
- }
- uint32_t nrf_dfu_mbr_irq_forward_address_set(void)
- {
- uint32_t ret_val = NRF_ERROR_INVALID_PARAM;
- uint32_t address = MBR_SIZE;
- #if !defined(BLE_STACK_SUPPORT_REQD) && !defined(ANT_STACK_SUPPORT_REQD)
- sd_mbr_command_t command =
- {
- .command = SD_MBR_COMMAND_IRQ_FORWARD_ADDRESS_SET,
- .params.irq_forward_address_set.address = address,
- };
- ret_val = sd_mbr_command(&command);
- #endif
- if (ret_val == NRF_ERROR_INVALID_PARAM)
- {
-
- *(uint32_t *)(MBR_IRQ_FORWARD_ADDRESS_ADDRESS) = address;
- ret_val = NRF_SUCCESS;
- }
- return ret_val;
- }
|