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

Subversion Repositories plasma

[/] [plasma/] [trunk/] [tools/] [no_os.c] - Blame information for rev 137

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 137 rhoads
#include "plasma.h"
2
 
3
#define MemoryRead(A) (*(volatile unsigned int*)(A))
4
#define MemoryWrite(A,V) *(volatile unsigned int*)(A)=(V)
5
 
6
void putchar(int value)
7
{
8
   while((MemoryRead(IRQ_STATUS) & IRQ_UART_WRITE_AVAILABLE) == 0)
9
      ;
10
   MemoryWrite(UART_WRITE, value);
11
}
12
 
13
int puts(const char *string)
14
{
15
   while(*string)
16
   {
17
      if(*string == '\n')
18
         putchar('\r');
19
      putchar(*string++);
20
   }
21
   return 0;
22
}
23
 
24
void OS_InterruptServiceRoutine(unsigned int status)
25
{
26
   (void)status;
27
   putchar('I');
28
}
29
 
30
int kbhit(void)
31
{
32
   return MemoryRead(IRQ_STATUS) & IRQ_UART_READ_AVAILABLE;
33
}
34
 
35
int getch(void)
36
{
37
   while(!kbhit()) ;
38
   return MemoryRead(UART_READ);
39
}

powered by: WebSVN 2.1.0

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