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