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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [or1ksim/] [testsuite/] [test-code-or1k/] [kbdtest/] [kbdtest.c] - Diff between revs 90 and 93

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

Rev 90 Rev 93
Line 67... Line 67...
 
 
}       /* fail () */
}       /* fail () */
 
 
 
 
/* --------------------------------------------------------------------------*/
/* --------------------------------------------------------------------------*/
 
/*!Print an escaped character
 
   Non-printable characters use their name:
 
   '\n' - ENTER
 
   ' '  - SPACE
 
   '\t' - TAB
 
 
 
   Any char > 127 (0x7f) is an error.
 
 
 
   Any other char less than 0x20 appears as ^<char>.                         */
 
/* --------------------------------------------------------------------------*/
 
static void
 
print_escaped_char (unsigned char  c)
 
{
 
  switch (c)
 
    {
 
    case '\n': printf ("Received: ENTER.\n"); return;
 
    case ' ':  printf ("Received: SPACE.\n"); return;
 
    case '\t': printf ("Received: TAB.\n");   return;
 
 
 
    default:
 
      if (c > 0x7f)
 
        {
 
          printf ("\nWarning: received erroneous character 0x%02x.\n",
 
                  (unsigned int) c);
 
        }
 
      else if (c < 0x20)
 
        {
 
          printf ("Received '^%c'.\n", '@' + c);
 
        }
 
      else
 
        {
 
          printf ("Received '%c'.\n", c);
 
        }
 
    }
 
}       /* print_escaped_char () */
 
 
 
 
 
/* --------------------------------------------------------------------------*/
/*!Utility to read a 32 bit memory mapped register
/*!Utility to read a 32 bit memory mapped register
 
 
   @param[in] addr  The address to read from
   @param[in] addr  The address to read from
 
 
   @return  The result of the read                                           */
   @return  The result of the read                                           */
Line 203... Line 241...
                {
                {
                  fail ("Unrecognized make scan code");
                  fail ("Unrecognized make scan code");
                }
                }
              else
              else
                {
                {
                  printf ("%c", c);
                  print_escaped_char (c);
                  char_scan_made = x;
                  char_scan_made = x;
                }
                }
            }
            }
 
 
          break;
          break;
Line 223... Line 261...
            {
            {
              fail ("Unrecognized make scan code");
              fail ("Unrecognized make scan code");
            }
            }
          else
          else
            {
            {
              printf ("%c", c);
              print_escaped_char (c);
              char_scan_made = x;
              char_scan_made = x;
            }
            }
 
 
          break;
          break;
 
 
Line 305... Line 343...
  printf ("Enabling interrupts.\n");
  printf ("Enabling interrupts.\n");
 
 
  mtspr (SPR_SR, mfspr(SPR_SR) | SPR_SR_IEE);
  mtspr (SPR_SR, mfspr(SPR_SR) | SPR_SR_IEE);
  mtspr (SPR_PICMR, mfspr(SPR_PICMR) | (0x00000001L << KBD_IRQ));
  mtspr (SPR_PICMR, mfspr(SPR_PICMR) | (0x00000001L << KBD_IRQ));
 
 
  /* Wait until the interrupt handler is finished */
  /* Wait until the interrupt handler is finished. */
  while (num_chars_done < MAX_CHARS_TO_READ)
  while (num_chars_done < MAX_CHARS_TO_READ)
    {
    {
    }
    }
 
 
  /* Usual end report */
  /* Usual end report */

powered by: WebSVN 2.1.0

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