Landfall

Annotated conf/landfall-examples/mips-letux400-keypad-driver.cfg

0:89a1bc19c1fc
2018-05-13 Paul Boddie Added device libraries and programs, configuration files and examples. Also added an installation script and copyright and licensing information.
paul@0 1
-- vim: ft=lua ts=2 et sw=2
paul@0 2
paul@0 3
-- Start Mag to multiplex the framebuffer showing only a single program.
paul@0 4
-- This example shows the key values produced by the keypad input driver.
paul@0 5
-- The target platform is the Letux 400 notebook computer.
paul@0 6
paul@0 7
local L4 = require("L4");
paul@0 8
paul@0 9
local l = L4.default_loader;
paul@0 10
paul@0 11
-- Define general access to peripherals.
paul@0 12
paul@0 13
local io_buses = {
paul@0 14
    cpm     = l:new_channel();
paul@0 15
    gpio    = l:new_channel();
paul@0 16
    lcd     = l:new_channel();
paul@0 17
    pwm     = l:new_channel(); -- exposes GPIO, PWM
paul@0 18
  };
paul@0 19
paul@0 20
l:start({
paul@0 21
    caps = {
paul@0 22
      cpm    = io_buses.cpm:svr(),
paul@0 23
      gpio   = io_buses.gpio:svr(),
paul@0 24
      lcd    = io_buses.lcd:svr(),
paul@0 25
      pwm    = io_buses.pwm:svr(),
paul@0 26
paul@0 27
      icu    = L4.Env.icu,
paul@0 28
      sigma0 = L4.cast(L4.Proto.Factory, L4.Env.sigma0):create(L4.Proto.Sigma0),
paul@0 29
    },
paul@0 30
  },
paul@0 31
  "rom/io rom/hw_devices.io rom/mips-letux400-keypad-driver.io");
paul@0 32
paul@0 33
-- Expose a PWM peripheral as a device.
paul@0 34
paul@0 35
local pwm = l:new_channel();
paul@0 36
paul@0 37
l:startv({
paul@0 38
    caps = {
paul@0 39
      vbus = io_buses.pwm,
paul@0 40
      pwm  = pwm:svr(),
paul@0 41
    },
paul@0 42
  },
paul@0 43
  "rom/dev_pwm_jz4730", "0", "250", "299", "47"); -- specifying peripheral number, parameters
paul@0 44
paul@0 45
-- Expose a PWM backlight device.
paul@0 46
paul@0 47
local backlight = l:new_channel(); -- exposes backlight device
paul@0 48
paul@0 49
l:startv({
paul@0 50
    caps = {
paul@0 51
      pwm       = pwm,
paul@0 52
      backlight = backlight:svr(),
paul@0 53
    },
paul@0 54
  },
paul@0 55
  "rom/dev_backlight_pwm", "0", "300"); -- specifying limits
paul@0 56
paul@0 57
-- Expose a display device for the Letux.
paul@0 58
paul@0 59
local display = l:new_channel(); -- exposes display device
paul@0 60
paul@0 61
l:start({
paul@0 62
    caps = {
paul@0 63
      backlight = backlight,
paul@0 64
      display   = display:svr(),
paul@0 65
      vbus      = io_buses.gpio,
paul@0 66
    },
paul@0 67
  },
paul@0 68
  "rom/dev_display_letux400");
paul@0 69
paul@0 70
-- Expose a panel definition for the Letux.
paul@0 71
paul@0 72
local panel = l:new_channel(); -- exposes panel
paul@0 73
paul@0 74
l:start({
paul@0 75
    caps = {
paul@0 76
      panel   = panel:svr(),
paul@0 77
    },
paul@0 78
  },
paul@0 79
  "rom/dev_panel_letux400");
paul@0 80
paul@0 81
-- Expose the CPM peripheral.
paul@0 82
paul@0 83
local cpm = l:new_channel();
paul@0 84
paul@0 85
l:start({
paul@0 86
  caps = {
paul@0 87
      vbus    = io_buses.cpm,
paul@0 88
      cpm     = cpm:svr(),
paul@0 89
    },
paul@0 90
  },
paul@0 91
  "rom/dev_cpm_jz4730");
paul@0 92
paul@0 93
-- Expose a framebuffer device.
paul@0 94
paul@0 95
local fbdrv_fb = l:new_channel();
paul@0 96
paul@0 97
l:start({
paul@0 98
    caps = {
paul@0 99
      vbus    = io_buses.lcd,
paul@0 100
      fb      = fbdrv_fb:svr(),
paul@0 101
      cpm     = cpm,
paul@0 102
      display = display, -- needed by LCD driver
paul@0 103
      panel   = panel,
paul@0 104
    },
paul@0 105
  },
paul@0 106
  "rom/fb-drv");
paul@0 107
paul@0 108
-- Multiplex the framebuffer.
paul@0 109
paul@0 110
local mag_caps = {
paul@0 111
    mag = l:new_channel(),
paul@0 112
    svc = l:new_channel(),
paul@0 113
  };
paul@0 114
paul@0 115
l:start({
paul@0 116
    caps = {
paul@0 117
      vbus = io_buses.gpio, -- needed by input driver
paul@0 118
      fb   = fbdrv_fb,
paul@0 119
      mag  = mag_caps.mag:svr(),
paul@0 120
      svc  = mag_caps.svc:svr(),
paul@0 121
    },
paul@0 122
  },
paul@0 123
  "rom/mag");
paul@0 124
paul@0 125
-- Expose the keypad matrix.
paul@0 126
paul@0 127
local keypad = l:new_channel();
paul@0 128
paul@0 129
l:start({
paul@0 130
    caps = {
paul@0 131
      vbus = io_buses.gpio,
paul@0 132
      keypad = keypad:svr(),
paul@0 133
    },
paul@0 134
  },
paul@0 135
  "rom/dev_keypad_letux400");
paul@0 136
paul@0 137
-- Show key event values.
paul@0 138
paul@0 139
l:start({
paul@0 140
    caps = {
paul@0 141
      fb = mag_caps.svc:create(L4.Proto.Goos, "g=800x460+0+0", "barheight=20"),
paul@0 142
      keypad = keypad,
paul@0 143
    },
paul@0 144
  },
paul@0 145
  "rom/ex_letux400_keypad_driver");