projects
/
oweals
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'denx-coldfire' into coldfire-aug2007
[oweals/u-boot.git]
/
drivers
/
netconsole.c
diff --git
a/drivers/netconsole.c
b/drivers/netconsole.c
index 6c27c08f2aa5f7dc08e5d5996790109bad3439e5..69089f92cec913b1ab6d0c33f94273d8cc10badf 100644
(file)
--- a/
drivers/netconsole.c
+++ b/
drivers/netconsole.c
@@
-29,9
+29,7
@@
#include <devices.h>
#include <net.h>
#include <devices.h>
#include <net.h>
-#ifndef CONFIG_NET_MULTI
-#error define CONFIG_NET_MULTI to use netconsole
-#endif
+DECLARE_GLOBAL_DATA_PTR;
static char input_buffer[512];
static int input_size = 0; /* char count in input buffer */
static char input_buffer[512];
static int input_size = 0; /* char count in input buffer */
@@
-109,8
+107,6
@@
int nc_input_packet (uchar * pkt, unsigned dest, unsigned src, unsigned len)
static void nc_send_packet (const char *buf, int len)
{
static void nc_send_packet (const char *buf, int len)
{
- DECLARE_GLOBAL_DATA_PTR;
-
struct eth_device *eth;
int inited = 0;
uchar *pkt;
struct eth_device *eth;
int inited = 0;
uchar *pkt;
@@
-153,11
+149,12
@@
int nc_start (void)
nc_port = 6666; /* default port */
if (getenv ("ncip")) {
nc_port = 6666; /* default port */
if (getenv ("ncip")) {
+ char *p;
+
nc_ip = getenv_IPaddr ("ncip");
if (!nc_ip)
return -1; /* ncip is 0.0.0.0 */
nc_ip = getenv_IPaddr ("ncip");
if (!nc_ip)
return -1; /* ncip is 0.0.0.0 */
- char *p = strchr (getenv ("ncip"), ':');
- if (p)
+ if ((p = strchr (getenv ("ncip"), ':')) != NULL)
nc_port = simple_strtoul (p + 1, NULL, 10);
} else
nc_ip = ~0; /* ncip is not set */
nc_port = simple_strtoul (p + 1, NULL, 10);
} else
nc_ip = ~0; /* ncip is not set */
@@
-188,13
+185,13
@@
void nc_putc (char c)
void nc_puts (const char *s)
{
void nc_puts (const char *s)
{
+ int len;
+
if (output_recursion)
return;
output_recursion = 1;
if (output_recursion)
return;
output_recursion = 1;
- int len = strlen (s);
-
- if (len > 512)
+ if ((len = strlen (s)) > 512)
len = 512;
nc_send_packet (s, len);
len = 512;
nc_send_packet (s, len);
@@
-204,6
+201,8
@@
void nc_puts (const char *s)
int nc_getc (void)
{
int nc_getc (void)
{
+ uchar c;
+
input_recursion = 1;
net_timeout = 0; /* no timeout */
input_recursion = 1;
net_timeout = 0; /* no timeout */
@@
-212,8
+211,8
@@
int nc_getc (void)
input_recursion = 0;
input_recursion = 0;
-
uchar c = input_buffer[input_offset
];
- input_offset++;
+
c = input_buffer[input_offset++
];
+
if (input_offset >= sizeof input_buffer)
input_offset -= sizeof input_buffer;
input_size--;
if (input_offset >= sizeof input_buffer)
input_offset -= sizeof input_buffer;
input_size--;