//SPARTAN/trunk/arch/mips/src/putchar.c |
---|
File deleted |
//SPARTAN/trunk/arch/mips/src/console.c |
---|
0,0 → 1,67 |
/* |
* Copyright (C) 2005 Ondrej Palkovsky |
* All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
* are met: |
* |
* - Redistributions of source code must retain the above copyright |
* notice, this list of conditions and the following disclaimer. |
* - Redistributions in binary form must reproduce the above copyright |
* notice, this list of conditions and the following disclaimer in the |
* documentation and/or other materials provided with the distribution. |
* - The name of the author may not be used to endorse or promote products |
* derived from this software without specific prior written permission. |
* |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
#include <putchar.h> |
#include <arch/types.h> |
#include <arch/cp0.h> |
#include <arch/console.h> |
static void (*putchar_func)(const char ch) = NULL; |
static void cons_putchar(const char ch) |
{ |
*((char *) VIDEORAM) = ch; |
} |
static void serial_putchar(const char ch) |
{ |
int i; |
if (ch=='\n') |
putchar('\r'); |
/* Wait until transmit buffer empty */ |
while (! ((*SERIAL_LSR) & (1<<TRANSMIT_EMPTY_BIT))) |
; |
*(SERIAL_PORT_BASE) = ch; |
} |
void console_init(void) |
{ |
/* The LSR on the start usually contains this value */ |
if (*SERIAL_LSR == 0x60) |
putchar_func = serial_putchar; |
else |
putchar_func = cons_putchar; |
} |
void putchar(const char ch) |
{ |
putchar_func(ch); |
} |
//SPARTAN/trunk/arch/mips/src/cpu/cpu.c |
---|
34,12 → 34,14 |
#include <arch/cp0.h> |
#include <typedefs.h> |
#include <print.h> |
#include <print.h> |
struct { |
struct data_t { |
char *vendor; |
char *model; |
} imp_data[] = { |
}; |
static struct data_t imp_data[] = { |
{ "Invalid", "Invalid" }, /* 0x00 */ |
{ "MIPS", "R2000" }, /* 0x01 */ |
{ "MIPS", "R3000" }, /* 0x02 */ |
78,6 → 80,13 |
{ "NKK", "R3000" } /* 0x23 */ |
}; |
static struct data_t imp_data80[] = { |
{ "MIPS", "4Kc" }, /* 0x80 */ |
{"Invalid","Invalid"}, /* 0x81 */ |
{"Invalid","Invalid"}, /* 0x82 */ |
{"MIPS","4Km & 4Kp"} /* 0x83 */ |
}; |
void cpu_arch_init(void) |
{ |
} |
90,6 → 99,14 |
void cpu_print_report(cpu_t *m) |
{ |
struct data_t *data; |
if (m->arch.imp_num & 0x80) { |
data = &imp_data80[m->arch.imp_num & 0x7f]; |
} else |
data = &imp_data[m->arch.imp_num]; |
printf("cpu%d: %s %s (rev=%d.%d, imp=%d)\n", |
m->id, imp_data[m->arch.imp_num].vendor, imp_data[m->arch.imp_num].model, m->arch.rev_num >> 4, m->arch.rev_num & 0xf, m->arch.imp_num); |
m->id, data->vendor, data->model, m->arch.rev_num >> 4, |
m->arch.rev_num & 0xf, m->arch.imp_num); |
} |
//SPARTAN/trunk/arch/mips/src/mips.c |
---|
33,6 → 33,7 |
#include <arch/asm.h> |
#include <mm/vm.h> |
#include <userspace.h> |
#include <arch/console.h> |
void arch_pre_mm_init(void) |
{ |
50,8 → 51,9 |
/* |
* Start hardware clock. |
*/ |
cp0_compare_write(cp0_compare_value); |
cp0_count_write(0); |
cp0_compare_write(cp0_compare_value + cp0_count_read()); |
console_init(); |
} |
void arch_post_mm_init(void) |
//SPARTAN/trunk/arch/mips/src/mm/tlb.c |
---|
37,7 → 37,19 |
void tlb_refill(struct exception_regdump *pstate) |
{ |
panic("tlb_refill exception\n"); |
char *symbol = ""; |
char *sym2 = ""; |
if (THREAD) { |
char *s = get_symtab_entry(pstate->epc); |
if (s) |
symbol = s; |
s = get_symtab_entry(pstate->ra); |
if (s) |
sym2 = s; |
} |
panic("%X: tlb_refill exception at %X(%s<-%s)\n", cp0_badvaddr_read(), |
pstate->epc, symbol,sym2); |
} |
void tlb_invalid(struct exception_regdump *pstate) |
//SPARTAN/trunk/arch/mips/src/interrupt.c |
---|
57,7 → 57,6 |
return cp0_status_read(); |
} |
void interrupt(void) |
{ |
__u32 cause; |
83,9 → 82,8 |
panic("unhandled interrupt %d\n", i); |
break; |
case 7: /* Timer Interrupt */ |
cp0_compare_write(cp0_compare_value); /* clear timer interrupt */ |
cp0_compare_write(cp0_count_read() + cp0_compare_value); /* clear timer interrupt */ |
/* start counting over again */ |
cp0_count_write(0); |
clock(); |
break; |
} |