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 cpm = l:new_channel(); 15 gpio = l:new_channel(); 16 hdmi = l:new_channel(); 17 lcd = l:new_channel(); 18 }; 19 20 l:start({ 21 caps = { 22 cpm = io_buses.cpm:svr(), 23 gpio = io_buses.gpio:svr(), 24 hdmi = io_buses.hdmi:svr(), 25 lcd = io_buses.lcd:svr(), 26 27 icu = L4.Env.icu, 28 sigma0 = L4.cast(L4.Proto.Factory, L4.Env.sigma0):create(L4.Proto.Sigma0), 29 }, 30 }, 31 "rom/io rom/hw_devices.io rom/mips-ci20-common.io"); 32 33 -- Expose the CPM peripheral. 34 35 local cpm = l:new_channel(); 36 37 l:start({ 38 caps = { 39 vbus = io_buses.cpm, 40 cpm = cpm:svr(), 41 }, 42 }, 43 "rom/dev_cpm_jz4780"); 44 45 -- Expose a display device for the CI20. 46 47 local display = l:new_channel(); -- exposes display device 48 49 l:start({ 50 caps = { 51 cpm = cpm, 52 display = display:svr(), 53 icu = L4.Env.icu, 54 vbus = io_buses.hdmi, -- for HDMI resource access 55 }, 56 }, 57 "rom/dev_display_ci20_hdmi"); 58 59 -- Expose a framebuffer device. 60 61 local fbdrv_fb = l:new_channel(); 62 63 l:start({ 64 caps = { 65 vbus = io_buses.lcd, 66 fb = fbdrv_fb:svr(), 67 cpm = cpm, 68 display = display, -- needed by LCD driver 69 }, 70 }, 71 "rom/fb-drv"); 72 73 -- Multiplex the framebuffer. 74 75 local mag_caps = { 76 mag = l:new_channel(), 77 svc = l:new_channel(), 78 }; 79 80 l:start({ 81 caps = { 82 vbus = io_buses.gpio, -- needed by input driver 83 fb = fbdrv_fb, 84 mag = mag_caps.mag:svr(), 85 svc = mag_caps.svc:svr(), 86 }, 87 }, 88 "rom/mag"); 89 90 -- Show the terminal. 91 92 local term = l:new_channel(); 93 94 l:start({ 95 caps = { 96 fb = mag_caps.svc:create(L4.Proto.Goos, "g=1280x1014+0+0", "barheight=10"), 97 term = term:svr(), 98 }, 99 }, 100 "rom/fbterminal"); 101 102 -- Show the hello example. 103 104 l:start({ 105 log_cap = term, 106 }, 107 "rom/hello");