mirror of
git://projects.qi-hardware.com/iris.git
synced 2024-11-17 07:38:06 +02:00
62 lines
2.0 KiB
COBOL
62 lines
2.0 KiB
COBOL
#pypp 0
|
|
#include <devices.hh>
|
|
#include <iris.hh>
|
|
|
|
Kernel::Num start ():
|
|
Device d = Kernel::my_receiver.create_capability (0)
|
|
Kernel::my_parent.provide_device <Display> (d.copy (), 0x10000)
|
|
Kernel::free_cap (d)
|
|
Kernel::my_parent.init_done ()
|
|
Display real = Kernel::my_parent.get_device <Display> (0)
|
|
while true:
|
|
Kernel::wait ()
|
|
Kernel::Cap arg = Kernel::get_arg ()
|
|
Kernel::Cap reply = Kernel::get_reply ()
|
|
switch Kernel::recv.protected_data.h:
|
|
case 0:
|
|
switch Kernel::recv.data[0].l:
|
|
case Device::CREATE_USER:
|
|
Kernel::Memory mem (arg)
|
|
Kernel::Cap target = Kernel::my_receiver.create_capability (Kernel::Num (0, 1))
|
|
for unsigned i = 0; i < 320 * 240 * 4; i += PAGE_SIZE:
|
|
Kernel::Page p = Kernel::my_memory.mapping ((void *)(0x15000 + i))
|
|
Kernel::Page t = mem.create_page ()
|
|
t.set_flags (Kernel::Page::PAYING, Kernel::Page::PAYING)
|
|
p.share (t, Kernel::Page::FORGET)
|
|
mem.map (t, 0x15000 + i)
|
|
Kernel::my_memory.destroy (t)
|
|
Kernel::free_cap (t)
|
|
Kernel::free_cap (p)
|
|
reply.invoke (0, 0, target)
|
|
Kernel::free_cap (target)
|
|
break
|
|
case Device::DESTROY_USER:
|
|
Kernel::panic (0, "destroying emulation user")
|
|
case Device::USE:
|
|
case Device::UNUSE:
|
|
reply.invoke ()
|
|
break
|
|
default:
|
|
kdebug_num (Kernel::recv.data[0].l)
|
|
kdebug ("\n")
|
|
Kernel::panic (0, "invalid emulation command")
|
|
break
|
|
case 1:
|
|
switch Kernel::recv.data[0].l:
|
|
case Display::SET_EOF_CB:
|
|
real.set_eof_cb (arg.copy ())
|
|
while Kernel::recv.data[0].l != 0:
|
|
Kernel::my_parent.wait <Display> (0)
|
|
real.set_eof_cb (arg.copy ())
|
|
reply.invoke ()
|
|
break
|
|
default:
|
|
kdebug_num (Kernel::recv.data[0].l)
|
|
kdebug_char ('\n')
|
|
Kernel::panic (Kernel::recv.data[0].l, "invalid operation on display emulation")
|
|
break
|
|
default:
|
|
Kernel::panic (0, "bug in display emulation")
|
|
Kernel::free_cap (arg)
|
|
Kernel::free_cap (reply)
|