int poke_mailbox(uint32_t val, int peer) { int rc; rc = chip_unipro_attr_write(TSB_MAILBOX, val, 0, peer); if (rc) { return rc; } return 0; }
int wait_for_mailbox_ack(uint32_t wval, int peer) { int rc; uint32_t val = 0; do { rc = chip_unipro_attr_read(MBOX_ACK_ATTR, &val, 0, peer); } while (!rc && val != wval); if (rc) { return rc; } val = 0; chip_unipro_attr_write(MBOX_ACK_ATTR, val, 0, peer); return 0; }
/** * @brief Bootloader "C" entry point * * @param none * * @returns Nothing. Will launch/restart image if successful, halt if not. */ void bootrom_main(void) { chip_init(); dbginit(); init_last_error(); dbgprint("gbboot Server\n"); chip_wait_for_link_up(); chip_unipro_attr_write(DME_ARA_BOOT_CONTROL, FORCE_UNIPRO_BOOT, 0, ATTR_PEER); while(1) { server_loop(); } }