#include <common.h> | |
#include <command.h> | |
#include <asr_flag.h> | |
//#define CMD_ASR_FLAG_CFG_PROD | |
int do_asr_flag (cmd_tbl_t * cmdtp, int flag, int argc, char * const argv[]) | |
{ | |
u32 len; | |
int i; | |
u32 *ptr; | |
struct asr_firmware_flag *p_asr_flag = get_asr_flag(); | |
if (strcmp (argv[1], "ota") == 0) { | |
p_asr_flag->upgrade_flag = 1; | |
p_asr_flag->upgrade_method = simple_strtoul(argv[2], NULL, 10); | |
p_asr_flag->fbf_flash_address = simple_strtoul(argv[3], NULL, 16); | |
p_asr_flag->fbf_file_size = simple_strtoul(argv[4], NULL, 16); | |
if (p_asr_flag->upgrade_method == 4 /*dfota/sdfota*/) { | |
p_asr_flag->dfota_n_of_images = 0xFFFFFFFF; | |
p_asr_flag->dfota_need_copy_only = 0; | |
p_asr_flag->dfota_conpy_len = 0; | |
memset(&p_asr_flag->SDfotaInfo, 0, sizeof(SDfotaState)); | |
printf("dfota or sdfota triggered\n"); | |
} else { | |
printf("fota triggered\n"); | |
} | |
asr_flag_update(); | |
return 0; | |
} | |
if (strcmp (argv[1], "nocp") == 0) { | |
p_asr_flag->nocp[0] = 0x50434F4E; | |
p_asr_flag->nocp[1] = simple_strtoul(argv[2], NULL, 10); | |
printf("set nocp mode as %d\n", p_asr_flag->nocp[1]); | |
asr_flag_update(); | |
return 0; | |
} | |
if (strcmp (argv[1], "dump") == 0) { | |
len = (sizeof(struct asr_firmware_flag)) >> 2; | |
ptr = (u32 *)p_asr_flag; | |
printf("ASR Flag dump:\n"); | |
for (i = 0; i < len; i++) { | |
printf("0x%08x ", ptr[i]); | |
if((i + 1)%4 == 0) | |
printf("\n"); | |
} | |
printf("\n"); | |
return 0; | |
} | |
#ifdef CMD_ASR_FLAG_CFG_PROD | |
if(strcmp (argv[1], "prod") == 0) { | |
p_asr_flag->production_mode_flag = simple_strtoul(argv[2], NULL, 10); | |
printf("set production mode as %d\n", p_asr_flag->production_mode_flag); | |
printf("need to reboot to take affect\n"); | |
asr_flag_update(); | |
return 0; | |
} | |
#endif | |
printf("run 'help asr_flag' to check usage\n"); | |
return 0; | |
} | |
U_BOOT_CMD( | |
asr_flag, 5, 1, do_asr_flag, | |
"ASR flag modify command", | |
"ota <method> <fbf_addr> <fbf_len> - trigger an OTA process\n" | |
"asr_flag nocp <mode> - configure nocp mode\n" | |
#ifdef CMD_ASR_FLAG_CFG_PROD | |
"asr_flag prod <mode> - configure production mode\n" | |
#endif | |
"asr_flag dump - dump asr flag content\n" | |
); |