* 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>
*
* -->
#include <cfg/debug.h>
#include <drv/timer.h>
-#include <drv/ser.h>
#include <mware/readline.h>
#include <mware/parser.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,
- * 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;
/// 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.
*
else
{
- abort();
+ //abort();
+ kprintf("errore\n");
}
}
kfile_printf(fd, "\r\n");
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));
- // reset serial port error anyway
+ /* Clear errors on channel */
kfile_clearerr(fd);
- // check message minimum length
+ /* check message minimum length */
if (linebuf[0])
{
/* If we enter lines beginning with sharp(#)
const char *buf;
/*
- * Read a line from serial. We use a temporary buffer
+ * Read a line from channel. 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
rl_sethook_clear(&rl_ctx, (clear_hook)kfile_clearerr,fd);
parser_init();
-
protocol_registerCmds();
-
protocol_prompt(fd);
}