Landfall

Annotated conf/landfall-examples/mips-letux400-fbterminal.cfg

84:21b57dd374bb
2020-06-17 Paul Boddie Added a mention of listlibs.sh which will need to be invoked for some examples. jz4780-lcd
paul@14 1
-- vim: ft=lua ts=2 et sw=2
paul@14 2
  
paul@14 3
-- Start Mag to multiplex the framebuffer showing only a single program.
paul@14 4
-- This example shows a framebuffer terminal showing the hello example's output.
paul@14 5
-- The target platform is the Letux 400 notebook computer.
paul@14 6
paul@14 7
local L4 = require("L4");
paul@14 8
paul@14 9
local l = L4.default_loader;
paul@14 10
paul@14 11
-- Define general access to peripherals.
paul@14 12
paul@14 13
local io_buses = {
paul@14 14
    cpm     = l:new_channel();
paul@14 15
    gpio    = l:new_channel();
paul@14 16
    lcd     = l:new_channel();
paul@14 17
    pwm     = l:new_channel(); -- exposes GPIO, PWM
paul@14 18
  };
paul@14 19
paul@14 20
l:start({
paul@14 21
    caps = {
paul@14 22
      cpm    = io_buses.cpm:svr(),
paul@14 23
      gpio   = io_buses.gpio:svr(),
paul@14 24
      lcd    = io_buses.lcd:svr(),
paul@14 25
      pwm    = io_buses.pwm:svr(),
paul@14 26
paul@14 27
      icu    = L4.Env.icu,
paul@14 28
      sigma0 = L4.cast(L4.Proto.Factory, L4.Env.sigma0):create(L4.Proto.Sigma0),
paul@14 29
    },
paul@14 30
  },
paul@14 31
  "rom/io rom/hw_devices.io rom/mips-letux400-common.io");
paul@14 32
paul@14 33
-- Expose a PWM peripheral as a device.
paul@14 34
paul@14 35
local pwm = l:new_channel();
paul@14 36
paul@14 37
l:startv({
paul@14 38
    caps = {
paul@14 39
      vbus = io_buses.pwm,
paul@14 40
      pwm  = pwm:svr(),
paul@14 41
    },
paul@14 42
  },
paul@14 43
  "rom/dev_pwm_jz4730", "0", "250", "299", "47"); -- specifying peripheral number, parameters
paul@14 44
paul@14 45
-- Expose a PWM backlight device.
paul@14 46
paul@14 47
local backlight = l:new_channel(); -- exposes backlight device
paul@14 48
paul@14 49
l:startv({
paul@14 50
    caps = {
paul@14 51
      pwm       = pwm,
paul@14 52
      backlight = backlight:svr(),
paul@14 53
    },
paul@14 54
  },
paul@14 55
  "rom/dev_backlight_pwm", "0", "300"); -- specifying limits
paul@14 56
paul@14 57
-- Expose a display device for the Letux.
paul@14 58
paul@14 59
local display = l:new_channel(); -- exposes display device
paul@14 60
paul@14 61
l:start({
paul@14 62
    caps = {
paul@14 63
      backlight = backlight,
paul@14 64
      display   = display:svr(),
paul@14 65
      vbus      = io_buses.gpio,
paul@14 66
    },
paul@14 67
  },
paul@14 68
  "rom/dev_display_letux400");
paul@14 69
paul@14 70
-- Expose the CPM peripheral.
paul@14 71
paul@14 72
local cpm = l:new_channel();
paul@14 73
paul@14 74
l:start({
paul@14 75
  caps = {
paul@14 76
      vbus    = io_buses.cpm,
paul@14 77
      cpm     = cpm:svr(),
paul@14 78
    },
paul@14 79
  },
paul@14 80
  "rom/dev_cpm_jz4730");
paul@14 81
paul@14 82
-- Expose a framebuffer device.
paul@14 83
paul@14 84
local fbdrv_fb = l:new_channel();
paul@14 85
paul@14 86
l:start({
paul@14 87
    caps = {
paul@14 88
      vbus    = io_buses.lcd,
paul@14 89
      fb      = fbdrv_fb:svr(),
paul@14 90
      cpm     = cpm,
paul@14 91
      display = display, -- needed by LCD driver
paul@14 92
    },
paul@14 93
  },
paul@14 94
  "rom/fb-drv");
paul@14 95
paul@14 96
-- Multiplex the framebuffer.
paul@14 97
paul@14 98
local mag_caps = {
paul@14 99
    mag = l:new_channel(),
paul@14 100
    svc = l:new_channel(),
paul@14 101
  };
paul@14 102
paul@14 103
l:start({
paul@14 104
    caps = {
paul@14 105
      vbus = io_buses.gpio, -- needed by input driver
paul@14 106
      fb   = fbdrv_fb,
paul@14 107
      mag  = mag_caps.mag:svr(),
paul@14 108
      svc  = mag_caps.svc:svr(),
paul@14 109
    },
paul@14 110
  },
paul@14 111
  "rom/mag");
paul@14 112
paul@14 113
-- Show the terminal.
paul@14 114
paul@14 115
local term = l:new_channel();
paul@14 116
paul@14 117
l:start({
paul@14 118
    caps = {
paul@14 119
      fb = mag_caps.svc:create(L4.Proto.Goos, "g=800x460+0+0", "barheight=20"),
paul@14 120
      term = term:svr(),
paul@14 121
    },
paul@14 122
  },
paul@14 123
  "rom/fbterminal");
paul@14 124
paul@14 125
-- Show the hello example.
paul@14 126
paul@14 127
l:start({
paul@14 128
    log_cap = term,
paul@14 129
  },
paul@43 130
  "rom/ex_hello_shared");