paul@231 | 1 | -- vim: ft=lua ts=2 et sw=2 |
paul@231 | 2 | |
paul@231 | 3 | -- Start Mag to multiplex the framebuffer showing only a single program. |
paul@231 | 4 | -- This example shows an animation showing off a spectrum of colours. |
paul@231 | 5 | -- The target platform is the MIPS Creator CI20. |
paul@231 | 6 | |
paul@231 | 7 | local L4 = require("L4"); |
paul@231 | 8 | |
paul@231 | 9 | local l = L4.default_loader; |
paul@231 | 10 | |
paul@231 | 11 | -- Define general access to peripherals. |
paul@231 | 12 | |
paul@231 | 13 | local io_buses = { |
paul@231 | 14 | common = l:new_channel(); |
paul@231 | 15 | }; |
paul@231 | 16 | |
paul@231 | 17 | l:start({ |
paul@231 | 18 | caps = { |
paul@231 | 19 | common = io_buses.common:svr(), |
paul@231 | 20 | icu = L4.Env.icu, |
paul@231 | 21 | sigma0 = L4.cast(L4.Proto.Factory, L4.Env.sigma0):create(L4.Proto.Sigma0), |
paul@231 | 22 | }, |
paul@231 | 23 | }, |
paul@231 | 24 | "rom/io rom/hw_devices.io rom/mips-ci20-common.io"); |
paul@231 | 25 | |
paul@231 | 26 | -- Expose a framebuffer device. |
paul@231 | 27 | |
paul@231 | 28 | local fbdrv_fb = l:new_channel(); |
paul@231 | 29 | |
paul@231 | 30 | l:start({ |
paul@231 | 31 | caps = { |
paul@231 | 32 | vbus = io_buses.common, |
paul@231 | 33 | fb = fbdrv_fb:svr(), |
paul@231 | 34 | }, |
paul@231 | 35 | }, |
paul@231 | 36 | "rom/fb-drv"); |
paul@231 | 37 | |
paul@231 | 38 | -- Multiplex the framebuffer. |
paul@231 | 39 | |
paul@231 | 40 | local mag_caps = { |
paul@231 | 41 | mag = l:new_channel(), |
paul@231 | 42 | svc = l:new_channel(), |
paul@231 | 43 | }; |
paul@231 | 44 | |
paul@231 | 45 | l:start({ |
paul@231 | 46 | caps = { |
paul@231 | 47 | vbus = io_buses.common, -- needed by input driver |
paul@231 | 48 | fb = fbdrv_fb, |
paul@231 | 49 | mag = mag_caps.mag:svr(), |
paul@231 | 50 | svc = mag_caps.svc:svr(), |
paul@231 | 51 | }, |
paul@231 | 52 | }, |
paul@231 | 53 | "rom/mag"); |
paul@231 | 54 | |
paul@231 | 55 | -- Show the spectrum example. |
paul@231 | 56 | |
paul@231 | 57 | l:start({ |
paul@231 | 58 | caps = { |
paul@231 | 59 | fb = mag_caps.svc:create(L4.Proto.Goos, "g=240x240+0+0", "barheight=10"), |
paul@231 | 60 | }, |
paul@231 | 61 | }, |
paul@231 | 62 | "rom/ex_fb_spectrum_cc"); |