1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- #include "common.h"
- #include "config.h"
- #include "console.h"
- #include "io.h"
- char __dram_bss config_buf[CONFIG_BUFSIZE];
- volatile bool do_update_config;
- bool _configured;
- void update_config(void)
- {
- do_update_config = false;
- memcpy(sysvar_val, config_buf, sizeof sysvar_val);
- memset(sysvar_isset, 1, sizeof sysvar_isset);
- con_puts("esp: Configuration received: ");
- con_puts(_configured ? "update\n" : "initial\n");
- #if 0
- con_printf("config_buf = %p\n", config_buf);
- for (enum sysvar_enum i = sysvar_null+1; i < sysvar_count; i++) {
- con_puts(sysvar_name[i]);
- con_putc('=');
- con_puts(notempty(getvar_tostr(i)));
- if (sysvar_types[i]->datasize)
- con_printf(" (%p)", sysvar_val[i].v_ptr);
- con_putc('\n');
- }
- #endif
- if (!_configured) {
- _configured = true;
- return;
- }
- uint32_t busctl = ABC_BUSCTL;
- if (getvar_bool(config_abc_reset)) {
- ABC_BUSCTL = busctl | ABC_BUSCTL_RESET;
- udelay(20000);
- }
- if (getvar_bool(config_fpga_reset)) {
- shutdown(SYS_RESET_SOFT);
- }
- ABC_BUSCTL = busctl;
- }
|