1
0
mirror of git://projects.qi-hardware.com/iris.git synced 2025-04-21 12:27:27 +03:00

new directory organization

This commit is contained in:
Bas Wijnen
2013-05-14 18:30:50 -04:00
parent b06e011a07
commit fa021a80f0
62 changed files with 133 additions and 2572 deletions

View File

@@ -277,11 +277,11 @@ void arch_register_interrupt (unsigned num, kReceiver *r):
// And enable or disable the interrupt.
if r:
//if num != 0x18:
//kdebug ("enabled interrupt ")
//kdebug_num (num)
//kdebug (", state: ")
//kdebug_num (INTC_ISR)
//kdebug ("\n")
// kdebug ("enabled interrupt ")
// kdebug_num (num)
// kdebug (", state: ")
// kdebug_num (INTC_IMR)
// kdebug ("\n")
intc_unmask_irq (num)
else:
//kdebug ("disabled interrupt ")

View File

@@ -30,20 +30,20 @@
#include "arch.hh"
addr_000:
#if 0
#if 1
// TLB refill
lui $k0, 0x8000
lw $k1, 0x174($k0) // directory
mfc0 $k0, $CP0_ENTRY_HI
srl $k0, $k0, 19
and $k0, $k0, 0xffc
andi $k0, $k0, 0xffc
addu $k0, $k0, $k1
beq $zero, $k0, zero_refill
lw $k0, 0($k0)
beq $zero, $k0, zero_refill
mfc0 $k1, $CP0_ENTRY_HI
srl $k1, $k1, 10
and $k1, $k1, 0xff8
add $k0, $k0, $k1
andi $k1, $k1, 0x7f8
addu $k0, $k0, $k1
lw $k1, 0($k0)
mtc0 $k1, $CP0_ENTRY_LO0
lw $k1, 4($k0)

View File

@@ -20,7 +20,7 @@
// Also declare things which only work during kernel init.
#define INIT
#define ARCH
#include "../kernel.hh"
#include "kernel.hh"
#include <elf.h>
#define NUM_SLOTS 8

View File

@@ -18,7 +18,7 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
#define ARCH
#include "../kernel.hh"
#include "kernel.hh"
void arch_flush_cache ():
__asm__ volatile ("\t.set noreorder\n"
@@ -73,7 +73,6 @@ static kThread *handle_exit ():
/// Otherwise, the ultra-fast code in entry.S is used.
kThread *tlb_refill ():
++dbg_code.h
kdebug_num ((unsigned)directory)
old_current = current
if !directory:
unsigned addr
@@ -82,9 +81,6 @@ kThread *tlb_refill ():
return handle_exit ()
unsigned EntryHi
cp0_get (CP0_ENTRY_HI, EntryHi)
kdebug (" tlb ")
kdebug_num (EntryHi)
kdebug ("\n")
Table *t = directory[EntryHi >> 21]
if !t:
unsigned addr
@@ -116,15 +112,19 @@ kThread *interrupt ():
++dbg_code.h
old_current = current
unsigned ipr = INTC_IPR
//if ipr & ~((1 << TIMER_INTERRUPT) | (1 << 0x18)):
// kdebug ("interrupt: ")
// kdebug_num (ipr)
// kdebug ("&")
// kdebug_num (~INTC_IMR)
for unsigned i = 0; i < 32; ++i:
if ipr & (1 << i):
// Handle timer interrupts specially: don't disable them.
if i == TIMER_INTERRUPT:
continue
//if i != 0x18:
//kdebug ("interrupt: ")
//kdebug_num (i, 2)
//kdebug ("\n")
// kdebug (" ")
// kdebug_num (i, 2)
// Disable the interrupt while handling it.
intc_mask_irq (i)
intc_ack_irq (i)
@@ -135,6 +135,8 @@ kThread *interrupt ():
c.data[1] = 0
arch_interrupt_receiver[i]->send_message (0, &c)
arch_interrupt_receiver[i] = NULL
//if ipr & ~((1 << TIMER_INTERRUPT) | (1 << 0x18)):
// kdebug ("\n")
if ipr & (1 << TIMER_INTERRUPT):
#if defined (TRENDTAC)
ost_clear_uf (0)
@@ -155,7 +157,7 @@ void flush_tlb (unsigned asid):
cp0_get (CP0_ENTRY_HI, hi)
if (hi & 0x1f) == asid:
// Set asid to 0, which is only used by the idle task.
cp0_set (CP0_ENTRY_HI, 0x2000 * tlb)
cp0_set (CP0_ENTRY_HI, 0x2000 * (tlb + 2))
__asm__ volatile ("tlbwi")
static void arch_invoke ():

View File

@@ -23,9 +23,21 @@
void board_init ():
pll_init ()
cpm_start_all ()
// Timer interrupts and buzzer.
cpm_start_tcu ()
// Stop all clocks, except the RTC and timer interrupt source.
CPM_CLKGR = 0x7fff & ~(CPM_CLKGR_RTC | CPM_CLKGR_TCU)
// Make sure the rtc is able to boot the device.
while !rtc_write_ready ():
rtc_enabled ()
while !rtc_write_ready ():
// Set wakeup assertion time, so it actually wakes up.
rtc_set_hrcr_val (0xfe0)
while !rtc_write_ready ():
// Set glitch detection to a low value.
rtc_set_hwfcr_val (0x1e0)
while !rtc_write_ready ():
// Allow rtc alarm to wake up device.
rtc_enable_alarm_wakeup ()
while !rtc_write_ready ():
// sdram memory.
gpio_as_sdram_16bit ()
// flash memory.
@@ -86,26 +98,13 @@ void arch_reboot ():
while true:
void arch_poweroff ():
// Power off.
// First enable interrupts, so it can be awoken.
// Disable all interrupts which shouldn't wake it (only an issue while powering down, really).
INTC_IMSR = ~0
intc_unmask_irq (IRQ_RTC)
intc_unmask_irq (IRQ_GPIO3)
GPIO_PXIMS (3) = ~0
gpio_unmask_irq (3, 29)
// Clear interrupt flags.
gpio_ack_irq (3, 29)
intc_ack_irq (IRQ_GPIO3)
intc_ack_irq (IRQ_RTC)
// Clear pending interrupts and enable interrupts.
cp0_set (CP0_STATUS, 0x1000ff01)
// Make sure the rtc is running.
// Make sure the rtc is running; it wakes the device up.
cpm_start_rtc ()
while !rtc_write_ready ():
rtc_enabled ()
while !rtc_write_ready ():
rtc_set_hwfcr_val (0x1e0)
while !rtc_write_ready ():
rtc_set_hrcr_val (0x7f)
while !rtc_write_ready ():
kdebug ("Power down.\n")