示例#1
0
byte BL_ParseCommand(const unsigned char *cmd, bool *handled, CLS1_ConstStdIOType *io) {
  if (UTIL1_strcmp((char*)cmd, CLS1_CMD_HELP)==0 || UTIL1_strcmp((char*)cmd, "BL help")==0) {
    BL_PrintHelp(io);
    *handled = TRUE;
    return ERR_OK;
  } else if ((UTIL1_strcmp((char*)cmd, CLS1_CMD_STATUS)==0) || (UTIL1_strcmp((char*)cmd, "BL status")==0)) {
    BL_PrintStatus(io);
    *handled = TRUE;
    return ERR_OK;
  } else if ((UTIL1_strcmp((char*)cmd, "BL erase")==0)) {
    *handled = TRUE;
    return BL_EraseAppFlash(io);
  } else if ((UTIL1_strcmp((char*)cmd, "BL restart")==0)) {
#if 0
    uint32_t startup;

    *handled = TRUE;
    startup = ((uint32_t*)BL_FLASH_VECTOR_TABLE)[1];
    ((void(*)(void))startup)(); /* Jump to startup code */
#else
    KIN1_SoftwareReset();
#endif
    /* will never get here! */
    return ERR_OK;
  } else if ((UTIL1_strcmp((char*)cmd, "BL load s19")==0)) {
    *handled = TRUE;
    return BL_LoadS19(io);
  }
  return ERR_OK; /* no error */
}
示例#2
0
byte BL_ParseCommand(const unsigned char *cmd, bool *handled, CLS1_ConstStdIOType *io) {
  if (UTIL1_strcmp((char*)cmd, CLS1_CMD_HELP)==0 || UTIL1_strcmp((char*)cmd, "BL help")==0) {
    BL_PrintHelp(io);
    *handled = TRUE;
    return ERR_OK;
  } else if ((UTIL1_strcmp((char*)cmd, CLS1_CMD_STATUS)==0) || (UTIL1_strcmp((char*)cmd, "BL status")==0)) {
    BL_PrintStatus(io);
    *handled = TRUE;
    return ERR_OK;
  } else if ((UTIL1_strcmp((char*)cmd, "BL erase")==0)) {
    *handled = TRUE;
    return BL_EraseAppFlash(io);
  } else if ((UTIL1_strcmp((char*)cmd, "BL restart")==0)) {
    KIN1_SoftwareReset();
    /* will never get here! */
    return ERR_OK;
  } else if ((UTIL1_strcmp((char*)cmd, "BL load s19")==0)) {
    *handled = TRUE;
    return BL_LoadS19(io);
  }
  return ERR_OK; /* no error */
}