1
0
mirror of git://projects.qi-hardware.com/iris.git synced 2024-11-17 06:12:48 +02:00
iris/source/display-emu.ccp

66 lines
2.1 KiB
Plaintext
Raw Normal View History

2010-01-30 10:21:56 +02:00
#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)
2010-01-31 10:26:23 +02:00
Kernel::Caps ret = mem.create_caps (3)
2010-01-30 10:21:56 +02:00
Kernel::Cap target = Kernel::my_receiver.create_capability (Kernel::Num (0, 1))
2010-01-31 10:26:23 +02:00
ret.set (0, target.copy ())
ret.set (1, mem)
Kernel::free_cap (target)
2010-01-30 10:21:56 +02:00
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)
2010-01-31 10:26:23 +02:00
reply.invoke (0, 0, ret.copy ())
Kernel::free_cap (ret)
2010-01-30 10:21:56 +02:00
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)