Landfall

Annotated conf/landfall-examples/mips-qi_lb60-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 Ben NanoNote.
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
  };
paul@14 18
paul@14 19
l:start({
paul@14 20
    caps = {
paul@14 21
      cpm    = io_buses.cpm:svr(),
paul@14 22
      gpio   = io_buses.gpio:svr(),
paul@14 23
      lcd    = io_buses.lcd:svr(),
paul@14 24
paul@14 25
      icu    = L4.Env.icu,
paul@14 26
      sigma0 = L4.cast(L4.Proto.Factory, L4.Env.sigma0):create(L4.Proto.Sigma0),
paul@14 27
    },
paul@14 28
  },
paul@14 29
  "rom/io rom/hw_devices.io rom/mips-qi_lb60-common.io");
paul@14 30
paul@14 31
-- Expose a SPI peripheral as a device.
paul@14 32
paul@14 33
local spi = l:new_channel();
paul@14 34
paul@14 35
l:startv({
paul@14 36
    caps = {
paul@14 37
      vbus = io_buses.gpio,
paul@14 38
      spi  = spi:svr(),
paul@14 39
    },
paul@14 40
  },
paul@14 41
  "rom/dev_spi_jz4740", "C23", "C22", "C21"); -- specifying clock, data, enable pin details
paul@14 42
paul@14 43
-- Expose a SPI backlight device for the Ben.
paul@14 44
paul@14 45
local backlight = l:new_channel(); -- exposes backlight device
paul@14 46
paul@14 47
l:start({
paul@14 48
    caps = {
paul@14 49
      spi       = spi,
paul@14 50
      backlight = backlight:svr(),
paul@14 51
    },
paul@14 52
  },
paul@19 53
  "rom/dev_backlight_spi_ili8960");
paul@14 54
paul@14 55
-- Expose a display device for the Ben.
paul@14 56
paul@14 57
local display = l:new_channel(); -- exposes display device
paul@14 58
paul@14 59
l:start({
paul@14 60
    caps = {
paul@14 61
      backlight = backlight,
paul@14 62
      display   = display:svr(),
paul@14 63
      vbus      = io_buses.gpio,
paul@14 64
    },
paul@14 65
  },
paul@14 66
  "rom/dev_display_qi_lb60");
paul@14 67
paul@14 68
-- Expose the CPM peripheral.
paul@14 69
paul@14 70
local cpm = l:new_channel();
paul@14 71
paul@14 72
l:start({
paul@14 73
  caps = {
paul@14 74
      vbus    = io_buses.cpm,
paul@14 75
      cpm     = cpm:svr(),
paul@14 76
    },
paul@14 77
  },
paul@14 78
  "rom/dev_cpm_jz4740");
paul@14 79
paul@14 80
-- Expose a framebuffer device.
paul@14 81
paul@14 82
local fbdrv_fb = l:new_channel();
paul@14 83
paul@14 84
l:start({
paul@14 85
    caps = {
paul@14 86
      vbus    = io_buses.lcd,
paul@14 87
      fb      = fbdrv_fb:svr(),
paul@14 88
      cpm     = cpm,
paul@14 89
      display = display, -- needed by LCD driver
paul@14 90
    },
paul@14 91
  },
paul@14 92
  "rom/fb-drv");
paul@14 93
paul@14 94
-- Multiplex the framebuffer.
paul@14 95
paul@14 96
local mag_caps = {
paul@14 97
    mag = l:new_channel(),
paul@14 98
    svc = l:new_channel(),
paul@14 99
  };
paul@14 100
paul@14 101
l:start({
paul@14 102
    caps = {
paul@14 103
      vbus = io_buses.gpio, -- needed by input driver
paul@14 104
      fb   = fbdrv_fb,
paul@14 105
      mag  = mag_caps.mag:svr(),
paul@14 106
      svc  = mag_caps.svc:svr(),
paul@14 107
    },
paul@14 108
  },
paul@14 109
  "rom/mag");
paul@14 110
paul@14 111
-- Show the terminal.
paul@14 112
paul@14 113
local term = l:new_channel();
paul@14 114
paul@14 115
l:start({
paul@14 116
    caps = {
paul@14 117
      fb = mag_caps.svc:create(L4.Proto.Goos, "g=320x230+0+0", "barheight=10"),
paul@14 118
      term = term:svr(),
paul@14 119
    },
paul@14 120
  },
paul@14 121
  "rom/fbterminal");
paul@14 122
paul@14 123
-- Show the hello example.
paul@14 124
paul@14 125
l:start({
paul@14 126
    log_cap = term,
paul@14 127
  },
paul@14 128
  "rom/hello");