#ifndef _U_
#define _U_ __attribute__((__unused__))
#endif

#define CMD_MAXLEN  (32)

enum{
   RET_HELP = -3,
   RET_CMDNOTFOUND = -2,
   RET_WRONGCMD = -1,
   RET_GOOD = 0,
   RET_BAD = 1
};

int parsecmd(const char *cmdwargs);

extern char lastcmd[];

#define CMD_ABSPOS          (3056382221)
#define CMD_ACCEL           (1490521981)
#define CMD_ADC             (2963026093)
#define CMD_BUTTON          (1093508897)
#define CMD_CANERRCODES     (1736697870)
#define CMD_CANFILTER       (3964416573)
#define CMD_CANFLOOD        (1235816779)
#define CMD_CANFLOODT       (506574623)
#define CMD_CANID           (2040257924)
#define CMD_CANIGNORE       (3209755195)
#define CMD_CANINCRFLOOD    (3987155959)
#define CMD_CANPAUSE        (3981532373)
#define CMD_CANREINIT       (2030075842)
#define CMD_CANRESUME       (2051659720)
#define CMD_CANSEND         (237136225)
#define CMD_CANSPEED        (549265992)
#define CMD_CANSTAT         (237384179)
#define CMD_DIAGN           (2334137736)
#define CMD_DRVTYPE         (3930242451)
#define CMD_DUMPCMD         (1223955823)
#define CMD_DUMPCONF        (3271513185)
#define CMD_DUMPERR         (1223989764)
#define CMD_DUMPMOT         (1224122507)
#define CMD_DUMPMOTFLAGS    (36159640)
#define CMD_DUMPSTATES      (4235564367)
#define CMD_EMSTOP          (2965919005)
#define CMD_ERASEFLASH      (3177247267)
#define CMD_ESW             (2963094612)
#define CMD_ESWREACT        (1614224995)
#define CMD_GOTO            (4286309438)
#define CMD_GOTOZ           (3178103736)
#define CMD_GPIO            (4286324660)
#define CMD_GPIOCONF        (1309721562)
#define CMD_HELP            (4288288686)
#define CMD_MAXSPEED        (1498078812)
#define CMD_MAXSTEPS        (1506667002)
#define CMD_MCUT            (4022718)
#define CMD_MCUVDD          (2517587080)
#define CMD_MICROSTEPS      (3974395854)
#define CMD_MINSPEED        (3234848090)
#define CMD_MOTCURRENT      (1926997848)
#define CMD_MOTFLAGS        (2153634658)
#define CMD_MOTMUL          (1543400099)
#define CMD_MOTNO           (544673586)
#define CMD_MOTREINIT       (199682784)
#define CMD_PDN             (2963275719)
#define CMD_PING            (10561715)
#define CMD_RELPOS          (1278646042)
#define CMD_RELSLOW         (1742971917)
#define CMD_RESET           (1907803304)
#define CMD_SAVECONF        (141102426)
#define CMD_SCREEN          (2100809349)
#define CMD_SPEEDLIMIT      (1654184245)
#define CMD_STATE           (2216628902)
#define CMD_STOP            (17184971)
#define CMD_TIME            (19148340)
#define CMD_TMCBUS          (1906135955)
#define CMD_UDATA           (2736127636)
#define CMD_USARTSTATUS     (4007098968)
#define CMD_VDRIVE          (2172773525)
#define CMD_VFIVE           (3017477285)


#define STR_ABSPOS          "abspos"
#define STR_ACCEL           "accel"
#define STR_ADC             "adc"
#define STR_BUTTON          "button"
#define STR_CANERRCODES     "canerrcodes"
#define STR_CANFILTER       "canfilter"
#define STR_CANFLOOD        "canflood"
#define STR_CANFLOODT       "canfloodT"
#define STR_CANID           "canid"
#define STR_CANIGNORE       "canignore"
#define STR_CANINCRFLOOD    "canincrflood"
#define STR_CANPAUSE        "canpause"
#define STR_CANREINIT       "canreinit"
#define STR_CANRESUME       "canresume"
#define STR_CANSEND         "cansend"
#define STR_CANSPEED        "canspeed"
#define STR_CANSTAT         "canstat"
#define STR_DIAGN           "diagn"
#define STR_DRVTYPE         "drvtype"
#define STR_DUMPCMD         "dumpcmd"
#define STR_DUMPCONF        "dumpconf"
#define STR_DUMPERR         "dumperr"
#define STR_DUMPMOT         "dumpmot"
#define STR_DUMPMOTFLAGS    "dumpmotflags"
#define STR_DUMPSTATES      "dumpstates"
#define STR_EMSTOP          "emstop"
#define STR_ERASEFLASH      "eraseflash"
#define STR_ESW             "esw"
#define STR_ESWREACT        "eswreact"
#define STR_GOTO            "goto"
#define STR_GOTOZ           "gotoz"
#define STR_GPIO            "gpio"
#define STR_GPIOCONF        "gpioconf"
#define STR_HELP            "help"
#define STR_MAXSPEED        "maxspeed"
#define STR_MAXSTEPS        "maxsteps"
#define STR_MCUT            "mcut"
#define STR_MCUVDD          "mcuvdd"
#define STR_MICROSTEPS      "microsteps"
#define STR_MINSPEED        "minspeed"
#define STR_MOTCURRENT      "motcurrent"
#define STR_MOTFLAGS        "motflags"
#define STR_MOTMUL          "motmul"
#define STR_MOTNO           "motno"
#define STR_MOTREINIT       "motreinit"
#define STR_PDN             "pdn"
#define STR_PING            "ping"
#define STR_RELPOS          "relpos"
#define STR_RELSLOW         "relslow"
#define STR_RESET           "reset"
#define STR_SAVECONF        "saveconf"
#define STR_SCREEN          "screen"
#define STR_SPEEDLIMIT      "speedlimit"
#define STR_STATE           "state"
#define STR_STOP            "stop"
#define STR_TIME            "time"
#define STR_TMCBUS          "tmcbus"
#define STR_UDATA           "udata"
#define STR_USARTSTATUS     "usartstatus"
#define STR_VDRIVE          "vdrive"
#define STR_VFIVE           "vfive"
