projects
/
bertos.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
200574b
)
Start to clean up.
author
Daniele Basile
<asterix@develer.com>
Mon, 23 Jan 2012 17:03:29 +0000
(18:03 +0100)
committer
Daniele Basile
<asterix@develer.com>
Wed, 25 Jan 2012 11:00:27 +0000
(12:00 +0100)
bertos/net/protocol.c
patch
|
blob
|
history
diff --git
a/bertos/net/protocol.c
b/bertos/net/protocol.c
index e2ef94d65cc9b28680d2d36caae12923c5631354..f919e1679235cbc419aa66d4f2216a5993be1c54 100644
(file)
--- a/
bertos/net/protocol.c
+++ b/
bertos/net/protocol.c
@@
-26,7
+26,7
@@
* invalidate any other reasons why the executable file might be covered by
* the GNU General Public License.
*
* invalidate any other reasons why the executable file might be covered by
* the GNU General Public License.
*
- * Copyright 2003, 2004, 2006 Develer S.r.l. (http://www.develer.com/)
+ * Copyright 2003, 2004, 2006
, 2012
Develer S.r.l. (http://www.develer.com/)
* Copyright 2000 Bernie Innocenti <bernie@codewiz.org>
*
* -->
* Copyright 2000 Bernie Innocenti <bernie@codewiz.org>
*
* -->
@@
-48,7
+48,6
@@
#include <cfg/debug.h>
#include <drv/timer.h>
#include <cfg/debug.h>
#include <drv/timer.h>
-#include <drv/ser.h>
#include <mware/readline.h>
#include <mware/parser.h>
#include <mware/readline.h>
#include <mware/parser.h>
@@
-58,18
+57,13
@@
#include <stdlib.h>
#include <string.h>
#include <stdlib.h>
#include <string.h>
-// Define the format string for ADC
-#define ADC_FORMAT_STR "dddd"
-#define ADC_CHANNEL_NUM 4
-
// DEBUG: set to 1 to force interactive mode
#define FORCE_INTERACTIVE 1
/**
* True if we are in interactive mode, false if we are in protocol mode.
* In interactive mode, commands are read through readline() (prompt,
// DEBUG: set to 1 to force interactive mode
#define FORCE_INTERACTIVE 1
/**
* True if we are in interactive mode, false if we are in protocol mode.
* In interactive mode, commands are read through readline() (prompt,
- * completion, history) without IDs, and replies/errors are sent to the serial
- * output.
+ * completion, history) and replies/errors are sent to the output channel.
* In protocol mode, we implement the default protocol
*/
static bool interactive;
* In protocol mode, we implement the default protocol
*/
static bool interactive;
@@
-77,7
+71,6
@@
static bool interactive;
/// Readline context, used for interactive mode.
static struct RLContext rl_ctx;
/// Readline context, used for interactive mode.
static struct RLContext rl_ctx;
-uint8_t reg_status_dout;
/**
* Send a NAK asking the host to send the current message again.
*
/**
* Send a NAK asking the host to send the current message again.
*
@@
-121,7
+114,8
@@
static bool protocol_reply(KFile *fd, const struct CmdTemplate *t,
else
{
else
{
- abort();
+ //abort();
+ kprintf("errore\n");
}
}
kfile_printf(fd, "\r\n");
}
}
kfile_printf(fd, "\r\n");
@@
-167,20
+161,16
@@
static void protocol_parse(KFile *fd, const char *buf)
void protocol_run(KFile *fd)
{
void protocol_run(KFile *fd)
{
- /**
- * \todo to be removed, we could probably access the serial FIFO
- * directly
- */
static char linebuf[80];
if (!interactive)
{
kfile_gets(fd, linebuf, sizeof(linebuf));
static char linebuf[80];
if (!interactive)
{
kfile_gets(fd, linebuf, sizeof(linebuf));
- /
/ reset serial port error anyway
+ /
* Clear errors on channel */
kfile_clearerr(fd);
kfile_clearerr(fd);
- /
/ check message minimum length
+ /
* check message minimum length */
if (linebuf[0])
{
/* If we enter lines beginning with sharp(#)
if (linebuf[0])
{
/* If we enter lines beginning with sharp(#)
@@
-204,7
+194,7
@@
void protocol_run(KFile *fd)
const char *buf;
/*
const char *buf;
/*
- * Read a line from
seria
l. We use a temporary buffer
+ * Read a line from
channe
l. We use a temporary buffer
* because otherwise we would have to extract a message
* from the port immediately: there might not be any
* available, and one might get free while we read
* because otherwise we would have to extract a message
* from the port immediately: there might not be any
* available, and one might get free while we read
@@
-276,8
+266,6
@@
void protocol_init(KFile *fd)
rl_sethook_clear(&rl_ctx, (clear_hook)kfile_clearerr,fd);
parser_init();
rl_sethook_clear(&rl_ctx, (clear_hook)kfile_clearerr,fd);
parser_init();
-
protocol_registerCmds();
protocol_registerCmds();
-
protocol_prompt(fd);
}
protocol_prompt(fd);
}