forked from xuos/xiuos
powerlink: implement console-xiuos.c
This commit is contained in:
parent
320998dee5
commit
736189f855
|
@ -40,12 +40,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// includes
|
// includes
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
#include <stdio.h>
|
#include <dev_serial.h>
|
||||||
#include <unistd.h>
|
|
||||||
#include <fcntl.h>
|
|
||||||
// #include <strings.h>
|
|
||||||
|
|
||||||
#include <xsconfig.h>
|
|
||||||
|
|
||||||
//============================================================================//
|
//============================================================================//
|
||||||
// P U B L I C F U N C T I O N S //
|
// P U B L I C F U N C T I O N S //
|
||||||
|
@ -65,7 +60,15 @@ termios library.
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
int console_getch(void)
|
int console_getch(void)
|
||||||
{
|
{
|
||||||
return 'p';
|
char ch, len;
|
||||||
|
|
||||||
|
extern char userShellRead(char *data);
|
||||||
|
|
||||||
|
do {
|
||||||
|
len = userShellRead(&ch);
|
||||||
|
} while (!len);
|
||||||
|
|
||||||
|
return ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
@ -82,5 +85,16 @@ The function checks the console for a keystroke.
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
int console_kbhit(void)
|
int console_kbhit(void)
|
||||||
{
|
{
|
||||||
|
extern HardwareDevType console;
|
||||||
|
struct SerialHardwareDevice *serial_dev = (struct SerialHardwareDevice *)console;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret = KSemaphoreObtain(serial_dev->haldev.dev_sem, 0);
|
||||||
|
|
||||||
|
if (ret == EOK) {
|
||||||
|
KSemaphoreAbandon(serial_dev->haldev.dev_sem);
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue