1 -- vim: ft=lua ts=2 et sw=2 2 3 -- Test LCD driver code. The target platform is the Letux 400 notebook computer. 4 5 local L4 = require("L4"); 6 7 local l = L4.default_loader; 8 9 -- Define general access to peripherals. 10 11 local io_buses = { 12 cpm = l:new_channel(); 13 gpio = l:new_channel(); 14 lcd = l:new_channel(); 15 pwm = l:new_channel(); -- exposes GPIO, PWM 16 }; 17 18 l:start({ 19 caps = { 20 cpm = io_buses.cpm:svr(), 21 gpio = io_buses.gpio:svr(), 22 lcd = io_buses.lcd:svr(), 23 pwm = io_buses.pwm:svr(), 24 25 icu = L4.Env.icu, 26 sigma0 = L4.cast(L4.Proto.Factory, L4.Env.sigma0):create(L4.Proto.Sigma0), 27 }, 28 }, 29 "rom/io rom/hw_devices.io rom/mips-letux400-common.io"); 30 31 -- Expose a PWM peripheral as a device. 32 33 local pwm = l:new_channel(); 34 35 l:startv({ 36 caps = { 37 vbus = io_buses.pwm, 38 pwm = pwm:svr(), 39 }, 40 }, 41 "rom/dev_pwm_jz4730", "0", "250", "299", "47"); -- specifying peripheral number, parameters 42 43 -- Expose a PWM backlight device. 44 45 local backlight = l:new_channel(); -- exposes backlight device 46 47 l:startv({ 48 caps = { 49 pwm = pwm, 50 backlight = backlight:svr(), 51 }, 52 }, 53 "rom/dev_backlight_pwm", "0", "300"); -- specifying limits 54 55 -- Expose a display device for the Letux. 56 57 local display = l:new_channel(); -- exposes display device 58 59 l:start({ 60 caps = { 61 backlight = backlight, 62 display = display:svr(), 63 vbus = io_buses.gpio, 64 }, 65 }, 66 "rom/dev_display_letux400"); 67 68 -- Expose a panel definition for the Letux. 69 70 local panel = l:new_channel(); -- exposes panel 71 72 l:start({ 73 caps = { 74 panel = panel:svr(), 75 }, 76 }, 77 "rom/dev_panel_letux400"); 78 79 -- Expose the CPM peripheral. 80 81 local cpm = l:new_channel(); 82 83 l:start({ 84 caps = { 85 vbus = io_buses.cpm, 86 cpm = cpm:svr(), 87 }, 88 }, 89 "rom/dev_cpm_jz4730"); 90 91 -- Start and demonstrate the LCD driver. 92 93 l:start({ 94 caps = { 95 icu = L4.Env.icu, 96 vbus = io_buses.lcd, 97 cpm = cpm, 98 display = display, -- needed by LCD driver 99 panel = panel, 100 }, 101 }, 102 "rom/ex_jz4740_lcd_driver");