Rewrite md2_update function and fix some bug.
[bertos.git] / app / triface / protocol.c
index e659888b3d9c820c7b734cbd6dc287e4ff69e97d..8be3d3c96b113eb0981f1ed4a0301a7ddb93a090 100755 (executable)
 
 /*#*
  *#* $Log$
+ *#* Revision 1.7  2007/01/09 09:00:16  bernie
+ *#* Doxygen fix.
+ *#*
+ *#* Revision 1.6  2006/09/20 13:54:04  marco
+ *#* Usage examples of MAKE_CMD.
+ *#*
  *#* Revision 1.5  2006/06/14 01:03:01  marco
  *#* Add response code. Add command ping.
  *#*
@@ -46,7 +52,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <cmd_hunk.h>
+//#include <cmd_hunk.h>
 
 #include "cmd_ctor.h"  // MAKE_CMD, REGISTER_CMD
 
@@ -69,6 +75,7 @@ static struct RLContext rl_ctx;
 /**
  * Send a NAK asking the host to send the current message again.
  *
+ * \param ser  serial port handle to output to.
  * \param err  human-readable description of the error for debug purposes.
  */
 INLINE void NAK(Serial *ser, const char *err)
@@ -218,14 +225,15 @@ void protocol_run(Serial *ser)
  *
  */
 
-/* Version.  */
-MAKE_CMD(ver, "", "s",
-({
-       args[1].s = VERS_TAG;
-       0;
-}))
+/* Version. Example of declaring function and passing it to MAKE_CMD.  */
+static int ver_fn(const char **str)
+{
+       *str = VERS_TAG;
+       return 0;
+}
+MAKE_CMD(ver, "", "s", ver_fn(&args[1].s))
 
-/* Sleep.  */
+/* Sleep. Example of declaring function body directly in macro call.  */
 MAKE_CMD(sleep, "d", "",
 ({
        timer_delay((mtime_t)args[1].l);