uint16_t gvLen;
int pressed_time;
+static void db_incorect_format(void)
+{
+ A_PRINTF("Error! Incorrect format.\n\r");
+}
+
+static void db_unknown_command(void)
+{
+ A_PRINTF("Error! Unknown command.\n\r");
+}
+
static void zf_debug_init(void)
{
uint8_t ch;
A_PRINTF("%s : %s\n\r", addr_str, val_str);
return 0;
}
- else
- {
- A_PRINTF("Error! Incorrect format.\n\r");
- return -1;
- }
+ db_incorect_format();
+ return -1;
}
static int db_str_cmd(char *cmd, char *param1, char *param2, char *param3)
A_PRINTF("%s : %s\n\r", addr_str, val_str);
return 0;
}
- else
- {
- A_PRINTF("Error! Incorrect format.\n\r");
- return -1;
- }
+ db_incorect_format();
+ return -1;
}
LOCAL void dbg_timer_func(A_HANDLE alarm, void *data)
{
if ( strcmp(param1, "rst") == 0 )
{
- A_PRINTF(" reseting.....................\n\n\r");
+ A_PRINTF(" reseting...\n\n\r");
A_WDT_RESET();
}
else if( strcmp(param1, "on") == 0 )
}
else if ( strcmp(param1, "boot") == 0 )
{
+ A_PRINTF("Last BOOT is ");
if (ENUM_WDT_BOOT == A_WDT_LASTBOOT() )
- A_PRINTF("LAST BOOT IS %s", "wdt");
+ A_PRINTF("wdt");
else
- A_PRINTF("LAST BOOT IS %s", "normal boot");
+ A_PRINTF("normal boot");
}
else if (strcmp(param1, "loop") == 0 )
{
T_WDT_CMD wdt_cmd;
uint32_t time_offset;
- A_PRINTF(" doing the wdt reseting................\n\n\r");
+ A_PRINTF(" doing the wdt reseting...");
if( db_ascii_to_hex(param2, &time_offset)!=0 )
{
if( time_offset < 0 || time_offset >0xffffffff )
time_offset = 0xffffff;
}
- A_PRINTF(" doing the wdt reseting (wdt tick: 0x%08x................\n\n\r", time_offset);
+ A_PRINTF(" (wdt tick: 0x%08x...\n\n\r", time_offset);
wdt_cmd.cmd = WDT_TIMEOUT;
wdt_cmd.timeout = time_offset;
{
T_WDT_CMD wdt_cmd;
uint32_t time_offset;
- A_PRINTF(" doing the wdt reseting................\n\n\r");
+ A_PRINTF(" doing the wdt reseting...");
if( db_ascii_to_hex(param3, &time_offset)!=0 )
{
if( time_offset < 0 || time_offset >0xffffffff )
time_offset = 0xffffff;
}
- A_PRINTF(" doing the wdt reseting (wdt tick: 0x%08x................\n\n\r", time_offset);
+ A_PRINTF(" (wdt tick: 0x%08x...\n\n\r", time_offset);
wdt_cmd.cmd = WDT_TIMEOUT;
wdt_cmd.timeout = time_offset;
return 0;
}
- else
- {
- A_PRINTF("Error! Incorrect format.\n\r");
- return -1;
- }
+
+ db_incorect_format();
+ return -1;
}
else if (strcmp(param2, "b") == 0)
{
return 0;
}
- else
- {
- A_PRINTF("Error! Incorrect format.\n\r");
- return -1;
- }
+
+ db_incorect_format();
+ return -1;
+
}
else if (strcmp(param1, "c") == 0)
{
A_PRINTF("\n\r");
return 0;
}
- else
- {
- A_PRINTF("Error! Unknown command.\n\r");
- return -1;
- }
+
+ db_unknown_command();
+ return -1;
}
/* Serial Flash -> Program */
A_PRINTF("\n\r");
return 0;
}
- else
- {
- A_PRINTF("Error! Incorrect format.\n\r");
- return -1;
- }
+
+ db_incorect_format();
+ return -1;
}
/* Serial Flash -> Read, Fast Read to UART */
fast = 1;
else
{
- A_PRINTF("Error! Unknown command.\n\r");
+ db_unknown_command();
return -1;
}
A_PRINTF("\n\r");
return 0;
}
- else
- {
- A_PRINTF("Error! Incorrect format.\n\r");
- return -1;
- }
+
+ db_incorect_format();
+ return -1;
}
/* Serial Flash -> Read, Fast Read to Memory */
fast = 1;
else
{
- A_PRINTF("Error! Unknown command.\n\r");
+ db_unknown_command();
return -1;
}
A_PRINTF("\n\r");
return 0;
}
- else
- {
- A_PRINTF("Error! Incorrect format.\n\r");
- return -1;
- }
+
+ db_incorect_format();
+ return -1;
}
/* Serial Flash -> Read Status Register */
A_PRINTF("memcmp(buf1, buf2, len) = %d\n\r", A_MEMCMP(buf1, buf2, len));
return 0;
}
- else
- {
- A_PRINTF("Error! Incorrect format.\n\r");
- return -1;
- }
+
+ db_incorect_format();
+ return -1;
}
/* Memory Dump */
A_PRINTF("\n\r");
return 0;
}
- else
- {
- A_PRINTF("Error! Incorrect format.\n\r");
- return -1;
- }
+
+ db_incorect_format();
+ return -1;
}
void cmnos_dbg_module_install(struct dbg_api *apis)
{