mirror of
git://projects.qi-hardware.com/iris.git
synced 2025-01-30 09:51:06 +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)
|
||||
break
|
||||
case Buzzer::STOP:
|
||||
kdebug ("stop\n")
|
||||
buzzer.stop ()
|
||||
Kernel::recv.reply.invoke ()
|
||||
break
|
||||
default:
|
||||
kdebug ("other\n")
|
||||
kdebug ("Buzzer: other\n")
|
||||
break
|
||||
break
|
||||
default:
|
||||
kdebug ("unknown num: ")
|
||||
kdebug ("Buzzer: unknown num: ")
|
||||
kdebug_num (Kernel::recv.protected_data.h)
|
||||
kdebug ("\n")
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -20,7 +20,7 @@
|
||||
#include "iris.hh"
|
||||
|
||||
static Keyboard sysreq
|
||||
static Device kbd_dev, buz_dev, backlight_dev
|
||||
static Device kbd_dev, buz_dev, backlight_dev, rootfs_dev
|
||||
static unsigned slot
|
||||
|
||||
// Event types.
|
||||
@ -29,12 +29,12 @@ enum type:
|
||||
KBDDEV
|
||||
BUZDEV
|
||||
BACKLIGHTDEV
|
||||
ROOTFSDEV
|
||||
|
||||
static void user_reply (Kernel::Cap target, unsigned dev):
|
||||
switch dev:
|
||||
case Keyboard::ID:
|
||||
// keyboard user
|
||||
kdebug ("keyboard requested\n")
|
||||
Kernel::Cap kbd = kbd_dev.create_user (Kernel::Cap ())
|
||||
kbd_dev.use (kbd)
|
||||
target.invoke (0, 0, kbd.copy ())
|
||||
@ -42,12 +42,8 @@ static void user_reply (Kernel::Cap target, unsigned dev):
|
||||
break
|
||||
case Buzzer::ID:
|
||||
// buzzer user
|
||||
kdebug ("buzzer requested\n")
|
||||
Kernel::Cap buzzer = buz_dev.create_user (Kernel::Cap ())
|
||||
buz_dev.use (buzzer)
|
||||
kdebug ("invoking reply: ")
|
||||
kdebug_num (target.code)
|
||||
kdebug ("\n")
|
||||
target.invoke (0, 0, buzzer.copy ())
|
||||
Kernel::free_cap (buzzer)
|
||||
break
|
||||
@ -98,8 +94,16 @@ static void setup ():
|
||||
reply.invoke ()
|
||||
Kernel::free_cap (reply)
|
||||
break
|
||||
case Directory::ID:
|
||||
caps.set (ROOTFSDEV, arg.copy ())
|
||||
rootfs_dev = Kernel::Cap (slot, ROOTFSDEV)
|
||||
reply.invoke ()
|
||||
Kernel::free_cap (reply)
|
||||
break
|
||||
default:
|
||||
kdebug ("unexpected device\n")
|
||||
kdebug ("unexpected device: ")
|
||||
kdebug_num (Kernel::recv.data[1].l)
|
||||
kdebug_char ('\n')
|
||||
break
|
||||
break
|
||||
case Parent::GET_DEVICE:
|
||||
@ -113,24 +117,20 @@ static void setup ():
|
||||
Kernel::free_cap (arg)
|
||||
continue
|
||||
Kernel::free_cap (arg)
|
||||
if ++state == 5:
|
||||
if ++state == 6:
|
||||
break
|
||||
// sysreq
|
||||
kdebug ("using sysreq\n")
|
||||
Kernel::Cap cb = Kernel::my_receiver.create_capability (SYSREQ)
|
||||
sysreq.set_cb (cb.copy ())
|
||||
Kernel::free_cap (cb)
|
||||
// First user reply.
|
||||
kdebug ("sending first user reply\n")
|
||||
user_reply (user, device)
|
||||
Kernel::free_cap (user)
|
||||
|
||||
Kernel::Num start ():
|
||||
Kernel::schedule ()
|
||||
setup ()
|
||||
kdebug ("init set up\n")
|
||||
// claim backlight
|
||||
kdebug ("claiming backlight\n")
|
||||
Setting backlight = backlight_dev.create_user (Kernel::Cap ())
|
||||
backlight_dev.use (backlight)
|
||||
while true:
|
||||
@ -138,12 +138,9 @@ Kernel::Num start ():
|
||||
switch Kernel::recv.protected_data.value ():
|
||||
case SYSREQ:
|
||||
unsigned code = Kernel::recv.data[0].l
|
||||
kdebug ("\n\nSystem request ")
|
||||
if code & Keyboard::RELEASE:
|
||||
kdebug ("released.\n\n")
|
||||
backlight.set (~0)
|
||||
else:
|
||||
kdebug ("pressed.\n\n")
|
||||
backlight.set (0)
|
||||
break
|
||||
default:
|
||||
|
@ -21,8 +21,7 @@
|
||||
#include "arch.hh"
|
||||
|
||||
__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][6]
|
||||
extern unsigned char const charset[127-32][8][6]
|
||||
|
||||
#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_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:
|
||||
ch = 127
|
||||
ch -= 32
|
||||
unsigned lookup[2] = { bg, fg }
|
||||
for unsigned k = 0; k < 6; ++k:
|
||||
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 void inc_logx ():
|
||||
@ -314,8 +313,9 @@ Kernel::Num start ():
|
||||
unsigned backlight_user = 0
|
||||
Kernel::Num current_backlight = 0
|
||||
while true:
|
||||
log_str ("Wachten...\n")
|
||||
Kernel::wait ()
|
||||
//log_msg ()
|
||||
log_msg ()
|
||||
switch Kernel::recv.protected_data.h:
|
||||
case 0:
|
||||
switch Kernel::recv.protected_data.l:
|
||||
|
@ -21,7 +21,6 @@
|
||||
|
||||
Kernel::Num start ():
|
||||
Kernel::schedule ()
|
||||
kdebug ("metronome started\n")
|
||||
Buzzer buzzer = Kernel::my_parent.get_device <Buzzer> ()
|
||||
Keyboard kbd = Kernel::my_parent.get_device <Keyboard> ()
|
||||
Kernel::Cap key = Kernel::my_receiver.create_capability (0)
|
||||
@ -68,5 +67,5 @@ Kernel::Num start ():
|
||||
break
|
||||
break
|
||||
default:
|
||||
kdebug ("huh?\n")
|
||||
kdebug ("metronome: huh?\n")
|
||||
break
|
||||
|
@ -246,7 +246,6 @@ Kernel::Num start ():
|
||||
// Keyboard device control request.
|
||||
switch Kernel::recv.data[0].l:
|
||||
case Device::CREATE_USER:
|
||||
kdebug ("create\n")
|
||||
Kernel::Cap reply = Kernel::get_reply ()
|
||||
Keyboard cap = Kernel::my_receiver.create_capability (Kernel::Num (next_user++, KBD_DEV))
|
||||
reply.invoke (0, 0, cap.copy ())
|
||||
@ -254,23 +253,20 @@ Kernel::Num start ():
|
||||
Kernel::free_cap (reply)
|
||||
break
|
||||
case Device::DESTROY_USER:
|
||||
kdebug ("destroy\n")
|
||||
Kernel::recv.reply.invoke ()
|
||||
break
|
||||
case Device::UNUSE:
|
||||
kdebug ("unuse\n")
|
||||
kbd.inactive ()
|
||||
Kernel::recv.reply.invoke ()
|
||||
break
|
||||
case Device::USE:
|
||||
kdebug ("use\n")
|
||||
Kernel::Cap reply = Kernel::get_reply ()
|
||||
user = Kernel::my_receiver.get_protected (Kernel::recv.arg).l
|
||||
reply.invoke ()
|
||||
Kernel::free_cap (reply)
|
||||
break
|
||||
default:
|
||||
kdebug ("other dev:")
|
||||
kdebug ("gpio other dev:")
|
||||
kdebug_num (Kernel::recv.data[0].l)
|
||||
kdebug ("\n")
|
||||
break
|
||||
@ -286,25 +282,22 @@ Kernel::Num start ():
|
||||
break
|
||||
switch Kernel::recv.data[0].l:
|
||||
case Keyboard::SET_CB:
|
||||
kdebug ("set cb\n")
|
||||
Kernel::Cap reply = Kernel::get_reply ()
|
||||
kbd.active (Kernel::get_arg ())
|
||||
reply.invoke ()
|
||||
Kernel::free_cap (reply)
|
||||
break
|
||||
case Keyboard::GET_NUM_KEYS:
|
||||
kdebug ("get #keys\n")
|
||||
Kernel::recv.reply.invoke (kbd.size ())
|
||||
break
|
||||
case Keyboard::GET_KEYS:
|
||||
kdebug ("get keys\n")
|
||||
kbd.send_keys (Kernel::recv.data[0].l, Kernel::recv.reply)
|
||||
break
|
||||
default:
|
||||
kdebug ("other\n")
|
||||
kdebug ("keyboard other\n")
|
||||
break
|
||||
break
|
||||
default:
|
||||
kdebug ("unknown num: ")
|
||||
kdebug ("keyboard unknown num: ")
|
||||
kdebug_num (Kernel::recv.protected_data.h)
|
||||
kdebug ("\n")
|
||||
|
@ -215,6 +215,9 @@ void Udc::init ():
|
||||
// enable interrupts on endpoint 0.
|
||||
UDC_INTRINE |= 1 << 0
|
||||
UDC_INDEX = 0
|
||||
// Wait a while.
|
||||
for unsigned w = 0; w < 10000; ++w:
|
||||
Kernel::schedule ()
|
||||
// Connect to the host.
|
||||
UDC_POWER |= UDC_POWER_SOFTCONN
|
||||
|
||||
|
@ -47,7 +47,6 @@ static void log_message (char const *prefix, unsigned target, unsigned pdata, kC
|
||||
dbg_log ("\n")
|
||||
|
||||
void kThread::raise (unsigned code, unsigned data):
|
||||
dpanic (code, "raise")
|
||||
dbg_log ("raise ")
|
||||
dbg_log_num (old_current->id, 2)
|
||||
dbg_log_char (':')
|
||||
@ -61,6 +60,7 @@ void kThread::raise (unsigned code, unsigned data):
|
||||
dbg_log_char ('/')
|
||||
dbg_log_num (data)
|
||||
dbg_log_char ('\n')
|
||||
dpanic (code, "raise")
|
||||
unrun ()
|
||||
if slots < 1 || !slot[0].caps || !slot[0].caps->cap (0)->target:
|
||||
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:
|
||||
dpanic (0, "clear_page didn't work")
|
||||
|
||||
#if 1
|
||||
#if 0
|
||||
|
||||
static unsigned free_begin
|
||||
static unsigned free_end
|
||||
|
@ -260,11 +260,15 @@ void kMemory_arch_unmap (kMemory *mem, kPage *page, unsigned address):
|
||||
free_page (t, p)
|
||||
|
||||
kPage *kMemory_arch_get_mapping (kMemory *mem, unsigned address, bool *readonly):
|
||||
if address >= 0x80000000:
|
||||
if address >= 0x80000000 || !mem->arch.directory:
|
||||
return NULL
|
||||
unsigned *table = mem->arch.directory[address >> 21]
|
||||
if !table:
|
||||
return NULL
|
||||
unsigned idx = (address >> 12) & ((1 << 9) - 1)
|
||||
arch_page *page = (arch_page *)table[idx + 0x200]
|
||||
if !page:
|
||||
return NULL
|
||||
if readonly:
|
||||
*readonly = !(table[idx] & 4)
|
||||
return page->page
|
||||
|
@ -116,6 +116,9 @@ static void init_threads ():
|
||||
first_alarm = NULL
|
||||
kReceiver *init_receiver = NULL
|
||||
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 ()
|
||||
assert (mem)
|
||||
kThread *thread = mem->alloc_thread (NUM_SLOTS)
|
||||
|
@ -18,7 +18,7 @@
|
||||
load = 0x80000000
|
||||
|
||||
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-
|
||||
OBJDUMP = $(CROSS)objdump
|
||||
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)): LDFLAGS = -EL
|
||||
$(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
|
||||
$< > $@
|
||||
|
Loading…
x
Reference in New Issue
Block a user