envm_write_and_reset(ulong dst, ulong src, ulong size, int do_reset) { int ret = 0; /* * Copy the buffer to the destination. */ if (envm_write((uint) dst, (void *) src, (uint) size) != size) { ret = -1; goto Done; } /* * If the user needs a reset, do the reset */ if (do_reset) { /* * Cortex-M3 core reset. */ reset_cpu(0); /* * Should never be here. */ } Done: return ret; }
int saveenv(void) { /* env must be copied to do not alter env structure in memory*/ unsigned char temp[CONFIG_ENV_SIZE]; memcpy(temp, env_ptr, CONFIG_ENV_SIZE); return envm_write(CONFIG_ENV_ADDR, temp, CONFIG_ENV_SIZE); }