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

Subversion Repositories mlite

[/] [mlite/] [trunk/] [tools/] [no_os.c] - Blame information for rev 270

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 270 rhoads
void print_hex(unsigned long num)
25
{
26
   long i;
27
   unsigned long j;
28
   for(i = 28; i >= 0; i -= 4)
29
   {
30
      j = (num >> i) & 0xf;
31
      if(j < 10)
32
         putchar('0' + j);
33
      else
34
         putchar('a' - 10 + j);
35
   }
36
}
37
 
38 137 rhoads
void OS_InterruptServiceRoutine(unsigned int status)
39
{
40
   (void)status;
41
   putchar('I');
42
}
43
 
44
int kbhit(void)
45
{
46
   return MemoryRead(IRQ_STATUS) & IRQ_UART_READ_AVAILABLE;
47
}
48
 
49
int getch(void)
50
{
51
   while(!kbhit()) ;
52
   return MemoryRead(UART_READ);
53
}

powered by: WebSVN 2.1.0

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