9
0
Fork 0

Add the possibility to have an architecture specific ctrlc() function.

This allows us to return immediately in ctrlc() on sandbox and thus
not slow down network througput.
This commit is contained in:
Sascha Hauer 2008-03-11 00:00:37 +01:00
parent 4dba16c692
commit 8759e68de2
3 changed files with 18 additions and 4 deletions

View File

@ -97,9 +97,7 @@ int linux_tstc(int fd)
/*
* We set the timeout here to 100us, because otherwise
* U-Boot would eat all cpu resources while waiting
* for input. On the other hand this makes some
* things like networking slow, because U-Boot will
* poll this function very often.
* for input.
*/
ret = select(fd + 1, &rfds, NULL, NULL, &tv);
@ -109,6 +107,15 @@ int linux_tstc(int fd)
return 0;
}
int ctrlc(void)
{
char chr;
if (linux_read_nonblock(0, &chr, 1) == 1 && chr == 3)
return 1;
return 0;
}
int linux_getc(void)
{
char ret;

View File

@ -357,6 +357,7 @@ int vprintf (const char *fmt, va_list args)
}
EXPORT_SYMBOL(vprintf);
#ifndef ARCH_HAS_CTRLC
/* test if ctrl-c was pressed */
int ctrlc (void)
{
@ -365,6 +366,7 @@ int ctrlc (void)
return 0;
}
EXPORT_SYMBOL(ctrlc);
#endif /* ARCH_HAS_CTRC */
#ifdef CONFIG_HAS_EARLY_INIT

View File

@ -1 +1,6 @@
/* nothing */
#ifndef ASM_COMMON_H
#define ASM_COMMON_H
#define ARCH_HAS_CTRLC
#endif /* ASM_COMMON_H */