blob: 8aabab43a492f0440936271217cbf57ac0c43003 [file] [log] [blame]
#include <arch/console.h>
#include <console.h>
#include <pmap.h>
#include <atomic.h>
#include <smp.h>
#include <kmalloc.h>
#include <monitor.h>
#include <process.h>
int cons_get_any_char(void)
{
assert(0);
}
void cons_init()
{
mtpcr(PCR_SR, mfpcr(PCR_SR) | (1 << (IRQ_HOST+SR_IM_SHIFT)));
while (mtpcr(PCR_TOHOST, 0x01L << 56));
}
// `High'-level console I/O. Used by readline and cprintf.
void
cputbuf(const char* str, int len)
{
for (int i = 0; i < len; i++)
cputchar(str[i]);
}
void poll_keyboard()
{
}
// Low-level console I/O
void
cputchar(int c)
{
while (mtpcr(PCR_TOHOST, 0x0101000000000000 | (unsigned char)c));
}
int
getchar(void)
{
char c;
kb_get_from_buf(&cons_buf, &c, 1);
return c;
}
int
iscons(int fdnum)
{
// used by readline
return 1;
}