OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [orpmon/] [common/] [common.c] - Diff between revs 833 and 855

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 833 Rev 855
Line 1... Line 1...
#include "common.h"
#include "common.h"
#include "uart.h"
#include "uart.h"
#include "screen.h"
#include "screen.h"
#include "support.h"
#include "support.h"
 
#include "keyboard.h"
 
 
#define MAX_COMMANDS  100
#define MAX_COMMANDS  100
 
 
extern unsigned long src_addr;
extern unsigned long src_addr;
 
 
Line 25... Line 26...
  case CT_NONE:
  case CT_NONE:
    break;
    break;
  case CT_UART:
  case CT_UART:
    uart_putc (c);
    uart_putc (c);
    break;
    break;
 
#ifdef CRT_ENABLED
  case CT_CRT:
  case CT_CRT:
 
#endif
    screen_putc (c);
    screen_putc (c);
    break;
    break;
  case CT_SIM:
  case CT_SIM:
    __printf ("%c", c);
    __printf ("%c", c);
    break;
    break;
  }
  }
}
}
 
 
int getc ()
int getc ()
{
{
 
  int ch = 0;
  debug ("getc %i\n", bd.bi_console_type);
  debug ("getc %i\n", bd.bi_console_type);
  switch (bd.bi_console_type) {
  switch (bd.bi_console_type) {
  case CT_NONE:
#if KBD_ENABLED
  case CT_CRT:
  case CT_CRT:
  case CT_SIM:
    while ((volatile int)kbd_head == (volatile int)kbd_tail);
    return -1;
    ch = kbd_buf[kbd_tail];
 
    kbd_tail = (kbd_tail + 1) % KBDBUF_SIZE;
 
    return ch;
 
#endif
  case CT_UART:
  case CT_UART:
    return uart_getc ();
    return uart_getc ();
  }
  }
  return -1;
  return -1;
}
}
 
 
int testc ()
int testc ()
{
{
  debug ("testc %i\n", bd.bi_console_type);
  debug ("testc %i\n", bd.bi_console_type);
  switch (bd.bi_console_type) {
  switch (bd.bi_console_type) {
  case CT_NONE:
#if KBD_ENABLED
  case CT_CRT:
  case CT_CRT:
  case CT_SIM:
    if (kbd_head == kbd_tail) return 0;
    return -1;
    else return getc ();
 
#endif
  case CT_UART:
  case CT_UART:
    return uart_testc ();
    return uart_testc ();
  }
  }
  return -1;
  return -1;
}
}
Line 108... Line 116...
    break;
    break;
  case CT_UART:
  case CT_UART:
    uart_init ();
    uart_init ();
    break;
    break;
  case CT_CRT:
  case CT_CRT:
 
#if CRT_ENABLED
    screen_init ();
    screen_init ();
 
#endif
 
#if KBD_ENABLED
 
    kbd_init ();
 
#endif
    break;
    break;
  case CT_SIM:
  case CT_SIM:
    break;
    break;
  }
  }
}
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.