Rev 319 | Rev 326 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 319 | Rev 324 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | /* |
1 | /* |
2 | * Copyright (C) 2003-2004 Jakub Jermar |
2 | * Copyright (C) 2005 Ondrej Palkovsky |
3 | * All rights reserved. |
3 | * All rights reserved. |
4 | * |
4 | * |
5 | * Redistribution and use in source and binary forms, with or without |
5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions |
6 | * modification, are permitted provided that the following conditions |
7 | * are met: |
7 | * are met: |
Line 27... | Line 27... | ||
27 | */ |
27 | */ |
28 | 28 | ||
29 | #include <putchar.h> |
29 | #include <putchar.h> |
30 | #include <arch/types.h> |
30 | #include <arch/types.h> |
31 | #include <arch/cp0.h> |
31 | #include <arch/cp0.h> |
- | 32 | #include <arch/console.h> |
|
32 | 33 | ||
33 | #define VIDEORAM 0xB0000000 |
34 | static void (*putchar_func)(const char ch) = NULL; |
34 | 35 | ||
35 | void putchar(const char ch) |
36 | static void cons_putchar(const char ch) |
36 | { |
37 | { |
37 | // __u32 status = cp0_status_read(); |
- | |
38 | - | ||
39 | // cp0_status_write(cp0_status_read() | cp0_status_erl_error_bit); |
- | |
40 | *((char *) VIDEORAM) = ch; |
38 | *((char *) VIDEORAM) = ch; |
- | 39 | } |
|
- | 40 | ||
- | 41 | ||
- | 42 | static void serial_putchar(const char ch) |
|
- | 43 | { |
|
- | 44 | int i; |
|
- | 45 | ||
- | 46 | if (ch=='\n') |
|
- | 47 | putchar('\r'); |
|
- | 48 | ||
- | 49 | /* Wait until transmit buffer empty */ |
|
- | 50 | while (! ((*SERIAL_LSR) & (1<<TRANSMIT_EMPTY_BIT))) |
|
- | 51 | ; |
|
- | 52 | *(SERIAL_PORT_BASE) = ch; |
|
- | 53 | } |
|
- | 54 | ||
- | 55 | void console_init(void) |
|
- | 56 | { |
|
- | 57 | /* The LSR on the start usually contains this value */ |
|
- | 58 | if (*SERIAL_LSR == 0x60) |
|
- | 59 | putchar_func = serial_putchar; |
|
- | 60 | else |
|
41 | // cp0_status_write(status); |
61 | putchar_func = cons_putchar; |
- | 62 | } |
|
- | 63 | ||
- | 64 | void putchar(const char ch) |
|
- | 65 | { |
|
- | 66 | putchar_func(ch); |
|
42 | } |
67 | } |