1 -- vim: ft=lua ts=2 et sw=2 2 3 -- Start Mag to multiplex the framebuffer showing only a single program. 4 -- This example shows a framebuffer terminal showing the hello example's output. 5 -- The target platform is the MIPS Creator CI20. 6 7 local L4 = require("L4"); 8 9 local l = L4.default_loader; 10 11 -- Define general access to peripherals. 12 13 local io_buses = { 14 common = l:new_channel(); 15 }; 16 17 l:start({ 18 caps = { 19 common = io_buses.common:svr(), 20 icu = L4.Env.icu, 21 sigma0 = L4.cast(L4.Proto.Factory, L4.Env.sigma0):create(L4.Proto.Sigma0), 22 }, 23 }, 24 "rom/io rom/hw_devices.io rom/mips-ci20-common.io"); 25 26 -- Expose the CPM peripheral. 27 28 local cpm = l:new_channel(); 29 30 l:start({ 31 caps = { 32 vbus = io_buses.common, 33 cpm = cpm:svr(), 34 }, 35 }, 36 "rom/dev_cpm_jz4780"); 37 38 -- Expose a display device for the CI20. 39 40 local display = l:new_channel(); -- exposes display device 41 42 l:start({ 43 caps = { 44 cpm = cpm, 45 display = display:svr(), 46 icu = L4.Env.icu, 47 vbus = io_buses.common, -- for HDMI resource access 48 }, 49 }, 50 "rom/dev_display_ci20_hdmi"); 51 52 -- Expose a framebuffer device. 53 54 local fbdrv_fb = l:new_channel(); 55 56 l:start({ 57 caps = { 58 vbus = io_buses.common, 59 fb = fbdrv_fb:svr(), 60 cpm = cpm, 61 display = display, -- needed by LCD driver 62 }, 63 }, 64 "rom/fb-drv"); 65 66 -- Multiplex the framebuffer. 67 68 local mag_caps = { 69 mag = l:new_channel(), 70 svc = l:new_channel(), 71 }; 72 73 l:start({ 74 caps = { 75 vbus = io_buses.common, -- needed by input driver 76 fb = fbdrv_fb, 77 mag = mag_caps.mag:svr(), 78 svc = mag_caps.svc:svr(), 79 }, 80 }, 81 "rom/mag"); 82 83 -- Show the terminal. 84 85 local term = l:new_channel(); 86 87 l:start({ 88 caps = { 89 fb = mag_caps.svc:create(L4.Proto.Goos, "g=1280x1014+0+0", "barheight=10"), 90 term = term:svr(), 91 }, 92 }, 93 "rom/fbterminal"); 94 95 -- Show the hello example. 96 97 l:start({ 98 log_cap = term, 99 }, 100 "rom/hello");