mirror of
git://projects.qi-hardware.com/iris.git
synced 2025-01-31 02:21:07 +02:00
make things work
This commit is contained in:
parent
d97f1a4ff2
commit
fdfaf07c51
@ -121,15 +121,14 @@ Kernel::Num start ():
|
|||||||
Kernel::free_cap (reply)
|
Kernel::free_cap (reply)
|
||||||
break
|
break
|
||||||
case Buzzer::STOP:
|
case Buzzer::STOP:
|
||||||
kdebug ("stop\n")
|
|
||||||
buzzer.stop ()
|
buzzer.stop ()
|
||||||
Kernel::recv.reply.invoke ()
|
Kernel::recv.reply.invoke ()
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
kdebug ("other\n")
|
kdebug ("Buzzer: other\n")
|
||||||
break
|
break
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
kdebug ("unknown num: ")
|
kdebug ("Buzzer: unknown num: ")
|
||||||
kdebug_num (Kernel::recv.protected_data.h)
|
kdebug_num (Kernel::recv.protected_data.h)
|
||||||
kdebug ("\n")
|
kdebug ("\n")
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -20,7 +20,7 @@
|
|||||||
#include "iris.hh"
|
#include "iris.hh"
|
||||||
|
|
||||||
static Keyboard sysreq
|
static Keyboard sysreq
|
||||||
static Device kbd_dev, buz_dev, backlight_dev
|
static Device kbd_dev, buz_dev, backlight_dev, rootfs_dev
|
||||||
static unsigned slot
|
static unsigned slot
|
||||||
|
|
||||||
// Event types.
|
// Event types.
|
||||||
@ -29,12 +29,12 @@ enum type:
|
|||||||
KBDDEV
|
KBDDEV
|
||||||
BUZDEV
|
BUZDEV
|
||||||
BACKLIGHTDEV
|
BACKLIGHTDEV
|
||||||
|
ROOTFSDEV
|
||||||
|
|
||||||
static void user_reply (Kernel::Cap target, unsigned dev):
|
static void user_reply (Kernel::Cap target, unsigned dev):
|
||||||
switch dev:
|
switch dev:
|
||||||
case Keyboard::ID:
|
case Keyboard::ID:
|
||||||
// keyboard user
|
// keyboard user
|
||||||
kdebug ("keyboard requested\n")
|
|
||||||
Kernel::Cap kbd = kbd_dev.create_user (Kernel::Cap ())
|
Kernel::Cap kbd = kbd_dev.create_user (Kernel::Cap ())
|
||||||
kbd_dev.use (kbd)
|
kbd_dev.use (kbd)
|
||||||
target.invoke (0, 0, kbd.copy ())
|
target.invoke (0, 0, kbd.copy ())
|
||||||
@ -42,12 +42,8 @@ static void user_reply (Kernel::Cap target, unsigned dev):
|
|||||||
break
|
break
|
||||||
case Buzzer::ID:
|
case Buzzer::ID:
|
||||||
// buzzer user
|
// buzzer user
|
||||||
kdebug ("buzzer requested\n")
|
|
||||||
Kernel::Cap buzzer = buz_dev.create_user (Kernel::Cap ())
|
Kernel::Cap buzzer = buz_dev.create_user (Kernel::Cap ())
|
||||||
buz_dev.use (buzzer)
|
buz_dev.use (buzzer)
|
||||||
kdebug ("invoking reply: ")
|
|
||||||
kdebug_num (target.code)
|
|
||||||
kdebug ("\n")
|
|
||||||
target.invoke (0, 0, buzzer.copy ())
|
target.invoke (0, 0, buzzer.copy ())
|
||||||
Kernel::free_cap (buzzer)
|
Kernel::free_cap (buzzer)
|
||||||
break
|
break
|
||||||
@ -98,8 +94,16 @@ static void setup ():
|
|||||||
reply.invoke ()
|
reply.invoke ()
|
||||||
Kernel::free_cap (reply)
|
Kernel::free_cap (reply)
|
||||||
break
|
break
|
||||||
|
case Directory::ID:
|
||||||
|
caps.set (ROOTFSDEV, arg.copy ())
|
||||||
|
rootfs_dev = Kernel::Cap (slot, ROOTFSDEV)
|
||||||
|
reply.invoke ()
|
||||||
|
Kernel::free_cap (reply)
|
||||||
|
break
|
||||||
default:
|
default:
|
||||||
kdebug ("unexpected device\n")
|
kdebug ("unexpected device: ")
|
||||||
|
kdebug_num (Kernel::recv.data[1].l)
|
||||||
|
kdebug_char ('\n')
|
||||||
break
|
break
|
||||||
break
|
break
|
||||||
case Parent::GET_DEVICE:
|
case Parent::GET_DEVICE:
|
||||||
@ -113,24 +117,20 @@ static void setup ():
|
|||||||
Kernel::free_cap (arg)
|
Kernel::free_cap (arg)
|
||||||
continue
|
continue
|
||||||
Kernel::free_cap (arg)
|
Kernel::free_cap (arg)
|
||||||
if ++state == 5:
|
if ++state == 6:
|
||||||
break
|
break
|
||||||
// sysreq
|
// sysreq
|
||||||
kdebug ("using sysreq\n")
|
|
||||||
Kernel::Cap cb = Kernel::my_receiver.create_capability (SYSREQ)
|
Kernel::Cap cb = Kernel::my_receiver.create_capability (SYSREQ)
|
||||||
sysreq.set_cb (cb.copy ())
|
sysreq.set_cb (cb.copy ())
|
||||||
Kernel::free_cap (cb)
|
Kernel::free_cap (cb)
|
||||||
// First user reply.
|
// First user reply.
|
||||||
kdebug ("sending first user reply\n")
|
|
||||||
user_reply (user, device)
|
user_reply (user, device)
|
||||||
Kernel::free_cap (user)
|
Kernel::free_cap (user)
|
||||||
|
|
||||||
Kernel::Num start ():
|
Kernel::Num start ():
|
||||||
Kernel::schedule ()
|
Kernel::schedule ()
|
||||||
setup ()
|
setup ()
|
||||||
kdebug ("init set up\n")
|
|
||||||
// claim backlight
|
// claim backlight
|
||||||
kdebug ("claiming backlight\n")
|
|
||||||
Setting backlight = backlight_dev.create_user (Kernel::Cap ())
|
Setting backlight = backlight_dev.create_user (Kernel::Cap ())
|
||||||
backlight_dev.use (backlight)
|
backlight_dev.use (backlight)
|
||||||
while true:
|
while true:
|
||||||
@ -138,12 +138,9 @@ Kernel::Num start ():
|
|||||||
switch Kernel::recv.protected_data.value ():
|
switch Kernel::recv.protected_data.value ():
|
||||||
case SYSREQ:
|
case SYSREQ:
|
||||||
unsigned code = Kernel::recv.data[0].l
|
unsigned code = Kernel::recv.data[0].l
|
||||||
kdebug ("\n\nSystem request ")
|
|
||||||
if code & Keyboard::RELEASE:
|
if code & Keyboard::RELEASE:
|
||||||
kdebug ("released.\n\n")
|
|
||||||
backlight.set (~0)
|
backlight.set (~0)
|
||||||
else:
|
else:
|
||||||
kdebug ("pressed.\n\n")
|
|
||||||
backlight.set (0)
|
backlight.set (0)
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
|
@ -21,8 +21,7 @@
|
|||||||
#include "arch.hh"
|
#include "arch.hh"
|
||||||
|
|
||||||
__asm__ volatile (".section .rodata\n.globl charset\ncharset:\n.incbin \"boot-programs/charset.data\"\n.section .text")
|
__asm__ volatile (".section .rodata\n.globl charset\ncharset:\n.incbin \"boot-programs/charset.data\"\n.section .text")
|
||||||
// charset is really the first character in the array. Its address is used as the start of the array.
|
extern unsigned char const charset[127-32][8][6]
|
||||||
extern unsigned char const charset[127-32][6]
|
|
||||||
|
|
||||||
#define assert(x) do { if (!(x)) { kdebug ("assertion failed " #x); while (true) {} } } while (0)
|
#define assert(x) do { if (!(x)) { kdebug ("assertion failed " #x); while (true) {} } } while (0)
|
||||||
|
|
||||||
@ -195,14 +194,14 @@ static void reset ():
|
|||||||
LCD_CTRL = (bpp << LCD_CTRL_BPP_BIT) | LCD_CTRL_BST_16 | LCD_CTRL_ENA
|
LCD_CTRL = (bpp << LCD_CTRL_BPP_BIT) | LCD_CTRL_BST_16 | LCD_CTRL_ENA
|
||||||
//lcd_enable_eof_intr ()
|
//lcd_enable_eof_intr ()
|
||||||
|
|
||||||
static void putchar (unsigned x, unsigned y, unsigned ch, unsigned fg = 0xffff, unsigned bg = 0x0000):
|
static void putchar (unsigned x, unsigned y, unsigned ch):
|
||||||
if ch < 32 || ch > 126:
|
if ch < 32 || ch > 126:
|
||||||
ch = 127
|
ch = 127
|
||||||
ch -= 32
|
ch -= 32
|
||||||
unsigned lookup[2] = { bg, fg }
|
|
||||||
for unsigned k = 0; k < 6; ++k:
|
for unsigned k = 0; k < 6; ++k:
|
||||||
for unsigned r = 0; r < 8; ++r:
|
for unsigned r = 0; r < 8; ++r:
|
||||||
LCD_FRAMEBUFFER_BASE[(y * 8 + r) * h + x * 6 + k] = lookup[charset[ch][k] & (1 << r) ? 1 : 0]
|
LCD_FRAMEBUFFER_BASE[(y * 8 + r) * h + x * 6 + k] = charset[ch][r][k] * 0x00010101
|
||||||
|
|
||||||
|
|
||||||
static unsigned log_x = LOG_X_BASE, log_y = LOG_Y_BASE
|
static unsigned log_x = LOG_X_BASE, log_y = LOG_Y_BASE
|
||||||
static void inc_logx ():
|
static void inc_logx ():
|
||||||
@ -314,8 +313,9 @@ Kernel::Num start ():
|
|||||||
unsigned backlight_user = 0
|
unsigned backlight_user = 0
|
||||||
Kernel::Num current_backlight = 0
|
Kernel::Num current_backlight = 0
|
||||||
while true:
|
while true:
|
||||||
|
log_str ("Wachten...\n")
|
||||||
Kernel::wait ()
|
Kernel::wait ()
|
||||||
//log_msg ()
|
log_msg ()
|
||||||
switch Kernel::recv.protected_data.h:
|
switch Kernel::recv.protected_data.h:
|
||||||
case 0:
|
case 0:
|
||||||
switch Kernel::recv.protected_data.l:
|
switch Kernel::recv.protected_data.l:
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
|
|
||||||
Kernel::Num start ():
|
Kernel::Num start ():
|
||||||
Kernel::schedule ()
|
Kernel::schedule ()
|
||||||
kdebug ("metronome started\n")
|
|
||||||
Buzzer buzzer = Kernel::my_parent.get_device <Buzzer> ()
|
Buzzer buzzer = Kernel::my_parent.get_device <Buzzer> ()
|
||||||
Keyboard kbd = Kernel::my_parent.get_device <Keyboard> ()
|
Keyboard kbd = Kernel::my_parent.get_device <Keyboard> ()
|
||||||
Kernel::Cap key = Kernel::my_receiver.create_capability (0)
|
Kernel::Cap key = Kernel::my_receiver.create_capability (0)
|
||||||
@ -68,5 +67,5 @@ Kernel::Num start ():
|
|||||||
break
|
break
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
kdebug ("huh?\n")
|
kdebug ("metronome: huh?\n")
|
||||||
break
|
break
|
||||||
|
@ -246,7 +246,6 @@ Kernel::Num start ():
|
|||||||
// Keyboard device control request.
|
// Keyboard device control request.
|
||||||
switch Kernel::recv.data[0].l:
|
switch Kernel::recv.data[0].l:
|
||||||
case Device::CREATE_USER:
|
case Device::CREATE_USER:
|
||||||
kdebug ("create\n")
|
|
||||||
Kernel::Cap reply = Kernel::get_reply ()
|
Kernel::Cap reply = Kernel::get_reply ()
|
||||||
Keyboard cap = Kernel::my_receiver.create_capability (Kernel::Num (next_user++, KBD_DEV))
|
Keyboard cap = Kernel::my_receiver.create_capability (Kernel::Num (next_user++, KBD_DEV))
|
||||||
reply.invoke (0, 0, cap.copy ())
|
reply.invoke (0, 0, cap.copy ())
|
||||||
@ -254,23 +253,20 @@ Kernel::Num start ():
|
|||||||
Kernel::free_cap (reply)
|
Kernel::free_cap (reply)
|
||||||
break
|
break
|
||||||
case Device::DESTROY_USER:
|
case Device::DESTROY_USER:
|
||||||
kdebug ("destroy\n")
|
|
||||||
Kernel::recv.reply.invoke ()
|
Kernel::recv.reply.invoke ()
|
||||||
break
|
break
|
||||||
case Device::UNUSE:
|
case Device::UNUSE:
|
||||||
kdebug ("unuse\n")
|
|
||||||
kbd.inactive ()
|
kbd.inactive ()
|
||||||
Kernel::recv.reply.invoke ()
|
Kernel::recv.reply.invoke ()
|
||||||
break
|
break
|
||||||
case Device::USE:
|
case Device::USE:
|
||||||
kdebug ("use\n")
|
|
||||||
Kernel::Cap reply = Kernel::get_reply ()
|
Kernel::Cap reply = Kernel::get_reply ()
|
||||||
user = Kernel::my_receiver.get_protected (Kernel::recv.arg).l
|
user = Kernel::my_receiver.get_protected (Kernel::recv.arg).l
|
||||||
reply.invoke ()
|
reply.invoke ()
|
||||||
Kernel::free_cap (reply)
|
Kernel::free_cap (reply)
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
kdebug ("other dev:")
|
kdebug ("gpio other dev:")
|
||||||
kdebug_num (Kernel::recv.data[0].l)
|
kdebug_num (Kernel::recv.data[0].l)
|
||||||
kdebug ("\n")
|
kdebug ("\n")
|
||||||
break
|
break
|
||||||
@ -286,25 +282,22 @@ Kernel::Num start ():
|
|||||||
break
|
break
|
||||||
switch Kernel::recv.data[0].l:
|
switch Kernel::recv.data[0].l:
|
||||||
case Keyboard::SET_CB:
|
case Keyboard::SET_CB:
|
||||||
kdebug ("set cb\n")
|
|
||||||
Kernel::Cap reply = Kernel::get_reply ()
|
Kernel::Cap reply = Kernel::get_reply ()
|
||||||
kbd.active (Kernel::get_arg ())
|
kbd.active (Kernel::get_arg ())
|
||||||
reply.invoke ()
|
reply.invoke ()
|
||||||
Kernel::free_cap (reply)
|
Kernel::free_cap (reply)
|
||||||
break
|
break
|
||||||
case Keyboard::GET_NUM_KEYS:
|
case Keyboard::GET_NUM_KEYS:
|
||||||
kdebug ("get #keys\n")
|
|
||||||
Kernel::recv.reply.invoke (kbd.size ())
|
Kernel::recv.reply.invoke (kbd.size ())
|
||||||
break
|
break
|
||||||
case Keyboard::GET_KEYS:
|
case Keyboard::GET_KEYS:
|
||||||
kdebug ("get keys\n")
|
|
||||||
kbd.send_keys (Kernel::recv.data[0].l, Kernel::recv.reply)
|
kbd.send_keys (Kernel::recv.data[0].l, Kernel::recv.reply)
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
kdebug ("other\n")
|
kdebug ("keyboard other\n")
|
||||||
break
|
break
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
kdebug ("unknown num: ")
|
kdebug ("keyboard unknown num: ")
|
||||||
kdebug_num (Kernel::recv.protected_data.h)
|
kdebug_num (Kernel::recv.protected_data.h)
|
||||||
kdebug ("\n")
|
kdebug ("\n")
|
||||||
|
@ -215,6 +215,9 @@ void Udc::init ():
|
|||||||
// enable interrupts on endpoint 0.
|
// enable interrupts on endpoint 0.
|
||||||
UDC_INTRINE |= 1 << 0
|
UDC_INTRINE |= 1 << 0
|
||||||
UDC_INDEX = 0
|
UDC_INDEX = 0
|
||||||
|
// Wait a while.
|
||||||
|
for unsigned w = 0; w < 10000; ++w:
|
||||||
|
Kernel::schedule ()
|
||||||
// Connect to the host.
|
// Connect to the host.
|
||||||
UDC_POWER |= UDC_POWER_SOFTCONN
|
UDC_POWER |= UDC_POWER_SOFTCONN
|
||||||
|
|
||||||
|
@ -47,7 +47,6 @@ static void log_message (char const *prefix, unsigned target, unsigned pdata, kC
|
|||||||
dbg_log ("\n")
|
dbg_log ("\n")
|
||||||
|
|
||||||
void kThread::raise (unsigned code, unsigned data):
|
void kThread::raise (unsigned code, unsigned data):
|
||||||
dpanic (code, "raise")
|
|
||||||
dbg_log ("raise ")
|
dbg_log ("raise ")
|
||||||
dbg_log_num (old_current->id, 2)
|
dbg_log_num (old_current->id, 2)
|
||||||
dbg_log_char (':')
|
dbg_log_char (':')
|
||||||
@ -61,6 +60,7 @@ void kThread::raise (unsigned code, unsigned data):
|
|||||||
dbg_log_char ('/')
|
dbg_log_char ('/')
|
||||||
dbg_log_num (data)
|
dbg_log_num (data)
|
||||||
dbg_log_char ('\n')
|
dbg_log_char ('\n')
|
||||||
|
dpanic (code, "raise")
|
||||||
unrun ()
|
unrun ()
|
||||||
if slots < 1 || !slot[0].caps || !slot[0].caps->cap (0)->target:
|
if slots < 1 || !slot[0].caps || !slot[0].caps->cap (0)->target:
|
||||||
return
|
return
|
||||||
|
@ -10,7 +10,7 @@ static void clear_page (unsigned page, unsigned num = 1):
|
|||||||
if *((unsigned *)page) != 0 || ((unsigned *)page)[(num << (PAGE_BITS - 2)) - 1] != 0:
|
if *((unsigned *)page) != 0 || ((unsigned *)page)[(num << (PAGE_BITS - 2)) - 1] != 0:
|
||||||
dpanic (0, "clear_page didn't work")
|
dpanic (0, "clear_page didn't work")
|
||||||
|
|
||||||
#if 1
|
#if 0
|
||||||
|
|
||||||
static unsigned free_begin
|
static unsigned free_begin
|
||||||
static unsigned free_end
|
static unsigned free_end
|
||||||
|
@ -260,11 +260,15 @@ void kMemory_arch_unmap (kMemory *mem, kPage *page, unsigned address):
|
|||||||
free_page (t, p)
|
free_page (t, p)
|
||||||
|
|
||||||
kPage *kMemory_arch_get_mapping (kMemory *mem, unsigned address, bool *readonly):
|
kPage *kMemory_arch_get_mapping (kMemory *mem, unsigned address, bool *readonly):
|
||||||
if address >= 0x80000000:
|
if address >= 0x80000000 || !mem->arch.directory:
|
||||||
return NULL
|
return NULL
|
||||||
unsigned *table = mem->arch.directory[address >> 21]
|
unsigned *table = mem->arch.directory[address >> 21]
|
||||||
|
if !table:
|
||||||
|
return NULL
|
||||||
unsigned idx = (address >> 12) & ((1 << 9) - 1)
|
unsigned idx = (address >> 12) & ((1 << 9) - 1)
|
||||||
arch_page *page = (arch_page *)table[idx + 0x200]
|
arch_page *page = (arch_page *)table[idx + 0x200]
|
||||||
|
if !page:
|
||||||
|
return NULL
|
||||||
if readonly:
|
if readonly:
|
||||||
*readonly = !(table[idx] & 4)
|
*readonly = !(table[idx] & 4)
|
||||||
return page->page
|
return page->page
|
||||||
|
@ -116,6 +116,9 @@ static void init_threads ():
|
|||||||
first_alarm = NULL
|
first_alarm = NULL
|
||||||
kReceiver *init_receiver = NULL
|
kReceiver *init_receiver = NULL
|
||||||
for unsigned i = 0; i < NUM_THREADS; ++i:
|
for unsigned i = 0; i < NUM_THREADS; ++i:
|
||||||
|
dbg_log ("Starting thread ")
|
||||||
|
dbg_log_num (i, 2)
|
||||||
|
dbg_log ("\n")
|
||||||
kMemory *mem = top_memory.alloc_memory ()
|
kMemory *mem = top_memory.alloc_memory ()
|
||||||
assert (mem)
|
assert (mem)
|
||||||
kThread *thread = mem->alloc_thread (NUM_SLOTS)
|
kThread *thread = mem->alloc_thread (NUM_SLOTS)
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
load = 0x80000000
|
load = 0x80000000
|
||||||
|
|
||||||
ARCH_CXXFLAGS = -DNUM_THREADS=6
|
ARCH_CXXFLAGS = -DNUM_THREADS=6
|
||||||
ARCH_CPPFLAGS = -I. -Imips -Imips/nanonote -Wa,-mips32 -DNANONOTE #-DUSE_SERIAL
|
ARCH_CPPFLAGS = -I. -Imips -Imips/nanonote -Wa,-mips32 -DNANONOTE -DUSE_SERIAL
|
||||||
CROSS = mipsel-linux-gnu-
|
CROSS = mipsel-linux-gnu-
|
||||||
OBJDUMP = $(CROSS)objdump
|
OBJDUMP = $(CROSS)objdump
|
||||||
junk = mdebug.abi32 reginfo comment pdr
|
junk = mdebug.abi32 reginfo comment pdr
|
||||||
@ -56,7 +56,7 @@ mips/init.o: TARGET_FLAGS = -I/usr/include
|
|||||||
$(addsuffix .elf,$(boot_threads)): TARGET_FLAGS = -I.
|
$(addsuffix .elf,$(boot_threads)): TARGET_FLAGS = -I.
|
||||||
$(addsuffix .elf,$(boot_threads)): LDFLAGS = -EL
|
$(addsuffix .elf,$(boot_threads)): LDFLAGS = -EL
|
||||||
$(addprefix boot-programs/,$(addsuffix .cc,$(boot_threads))): devices.hh keys.hh
|
$(addprefix boot-programs/,$(addsuffix .cc,$(boot_threads))): devices.hh keys.hh
|
||||||
lcd.elf: boot-programs/charset.data
|
boot-programs/lcd.o: boot-programs/charset.data
|
||||||
|
|
||||||
boot-programs/charset.data: boot-programs/charset
|
boot-programs/charset.data: boot-programs/charset
|
||||||
$< > $@
|
$< > $@
|
||||||
|
Loading…
x
Reference in New Issue
Block a user