1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/conf/landfall-examples/mips-letux400-i2c.cfg Sat Jan 09 22:38:31 2021 +0100
1.3 @@ -0,0 +1,136 @@
1.4 +-- vim: ft=lua ts=2 et sw=2
1.5 +
1.6 +-- Start Mag to multiplex the framebuffer showing only a single program.
1.7 +-- This example shows a framebuffer terminal showing the hello example's output.
1.8 +-- The target platform is the Letux 400 notebook computer.
1.9 +
1.10 +local L4 = require("L4");
1.11 +
1.12 +local l = L4.default_loader;
1.13 +
1.14 +-- Define general access to peripherals.
1.15 +
1.16 +local io_buses = {
1.17 + cpm = l:new_channel();
1.18 + gpio = l:new_channel();
1.19 + i2c = l:new_channel();
1.20 + lcd = l:new_channel();
1.21 + pwm = l:new_channel(); -- exposes GPIO, PWM
1.22 + };
1.23 +
1.24 +l:start({
1.25 + caps = {
1.26 + cpm = io_buses.cpm:svr(),
1.27 + gpio = io_buses.gpio:svr(),
1.28 + i2c = io_buses.i2c:svr(),
1.29 + lcd = io_buses.lcd:svr(),
1.30 + pwm = io_buses.pwm:svr(),
1.31 +
1.32 + icu = L4.Env.icu,
1.33 + sigma0 = L4.cast(L4.Proto.Factory, L4.Env.sigma0):create(L4.Proto.Sigma0),
1.34 + },
1.35 + },
1.36 + "rom/io rom/hw_devices.io rom/mips-letux400-common.io");
1.37 +
1.38 +-- Expose a PWM peripheral as a device.
1.39 +
1.40 +local pwm = l:new_channel();
1.41 +
1.42 +l:startv({
1.43 + caps = {
1.44 + vbus = io_buses.pwm,
1.45 + pwm = pwm:svr(),
1.46 + },
1.47 + },
1.48 + "rom/dev_pwm_jz4730", "0", "250", "299", "47"); -- specifying peripheral number, parameters
1.49 +
1.50 +-- Expose a PWM backlight device.
1.51 +
1.52 +local backlight = l:new_channel(); -- exposes backlight device
1.53 +
1.54 +l:startv({
1.55 + caps = {
1.56 + pwm = pwm,
1.57 + backlight = backlight:svr(),
1.58 + },
1.59 + },
1.60 + "rom/dev_backlight_pwm", "0", "300"); -- specifying limits
1.61 +
1.62 +-- Expose a display device for the Letux.
1.63 +
1.64 +local display = l:new_channel(); -- exposes display device
1.65 +
1.66 +l:start({
1.67 + caps = {
1.68 + backlight = backlight,
1.69 + display = display:svr(),
1.70 + vbus = io_buses.gpio,
1.71 + },
1.72 + },
1.73 + "rom/dev_display_letux400");
1.74 +
1.75 +-- Expose the CPM peripheral.
1.76 +
1.77 +local cpm = l:new_channel();
1.78 +
1.79 +l:start({
1.80 + caps = {
1.81 + vbus = io_buses.cpm,
1.82 + cpm = cpm:svr(),
1.83 + },
1.84 + },
1.85 + "rom/dev_cpm_jz4730");
1.86 +
1.87 +-- Expose a framebuffer device.
1.88 +
1.89 +local fbdrv_fb = l:new_channel();
1.90 +
1.91 +l:start({
1.92 + caps = {
1.93 + vbus = io_buses.lcd,
1.94 + fb = fbdrv_fb:svr(),
1.95 + cpm = cpm,
1.96 + display = display, -- needed by LCD driver
1.97 + },
1.98 + },
1.99 + "rom/fb-drv");
1.100 +
1.101 +-- Multiplex the framebuffer.
1.102 +
1.103 +local mag_caps = {
1.104 + mag = l:new_channel(),
1.105 + svc = l:new_channel(),
1.106 + };
1.107 +
1.108 +l:start({
1.109 + caps = {
1.110 + vbus = io_buses.gpio, -- needed by input driver
1.111 + fb = fbdrv_fb,
1.112 + mag = mag_caps.mag:svr(),
1.113 + svc = mag_caps.svc:svr(),
1.114 + },
1.115 + },
1.116 + "rom/mag");
1.117 +
1.118 +-- Show the terminal.
1.119 +
1.120 +local term = l:new_channel();
1.121 +
1.122 +l:start({
1.123 + caps = {
1.124 + fb = mag_caps.svc:create(L4.Proto.Goos, "g=800x460+0+0", "barheight=20"),
1.125 + term = term:svr(),
1.126 + },
1.127 + },
1.128 + "rom/fbterminal");
1.129 +
1.130 +-- Show the I2C example.
1.131 +
1.132 +l:start({
1.133 + caps = {
1.134 + icu = L4.Env.icu,
1.135 + vbus = io_buses.i2c,
1.136 + },
1.137 + log_cap = term,
1.138 + },
1.139 + "rom/ex_letux400_i2c");