1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/conf/landfall-examples/mips-letux400-input-event-client.cfg Fri May 18 17:19:28 2018 +0200
1.3 @@ -0,0 +1,157 @@
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 the key values produced by the input event driver.
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 + lcd = l:new_channel();
1.20 + pwm = l:new_channel(); -- exposes GPIO, PWM
1.21 + };
1.22 +
1.23 +l:start({
1.24 + caps = {
1.25 + cpm = io_buses.cpm:svr(),
1.26 + gpio = io_buses.gpio:svr(),
1.27 + lcd = io_buses.lcd:svr(),
1.28 + pwm = io_buses.pwm:svr(),
1.29 +
1.30 + icu = L4.Env.icu,
1.31 + sigma0 = L4.cast(L4.Proto.Factory, L4.Env.sigma0):create(L4.Proto.Sigma0),
1.32 + },
1.33 + },
1.34 + "rom/io rom/hw_devices.io rom/mips-letux400-input-event-client.io");
1.35 +
1.36 +-- Expose a PWM peripheral as a device.
1.37 +
1.38 +local pwm = l:new_channel();
1.39 +
1.40 +l:startv({
1.41 + caps = {
1.42 + vbus = io_buses.pwm,
1.43 + pwm = pwm:svr(),
1.44 + },
1.45 + },
1.46 + "rom/dev_pwm_jz4730", "0", "250", "299", "47"); -- specifying peripheral number, parameters
1.47 +
1.48 +-- Expose a PWM backlight device.
1.49 +
1.50 +local backlight = l:new_channel(); -- exposes backlight device
1.51 +
1.52 +l:startv({
1.53 + caps = {
1.54 + pwm = pwm,
1.55 + backlight = backlight:svr(),
1.56 + },
1.57 + },
1.58 + "rom/dev_backlight_pwm", "0", "300"); -- specifying limits
1.59 +
1.60 +-- Expose a display device for the Letux.
1.61 +
1.62 +local display = l:new_channel(); -- exposes display device
1.63 +
1.64 +l:start({
1.65 + caps = {
1.66 + backlight = backlight,
1.67 + display = display:svr(),
1.68 + vbus = io_buses.gpio,
1.69 + },
1.70 + },
1.71 + "rom/dev_display_letux400");
1.72 +
1.73 +-- Expose a panel definition for the Letux.
1.74 +
1.75 +local panel = l:new_channel(); -- exposes panel
1.76 +
1.77 +l:start({
1.78 + caps = {
1.79 + panel = panel:svr(),
1.80 + },
1.81 + },
1.82 + "rom/dev_panel_letux400");
1.83 +
1.84 +-- Expose the CPM peripheral.
1.85 +
1.86 +local cpm = l:new_channel();
1.87 +
1.88 +l:start({
1.89 + caps = {
1.90 + vbus = io_buses.cpm,
1.91 + cpm = cpm:svr(),
1.92 + },
1.93 + },
1.94 + "rom/dev_cpm_jz4730");
1.95 +
1.96 +-- Expose a framebuffer device.
1.97 +
1.98 +local fbdrv_fb = l:new_channel();
1.99 +
1.100 +l:start({
1.101 + caps = {
1.102 + vbus = io_buses.lcd,
1.103 + fb = fbdrv_fb:svr(),
1.104 + cpm = cpm,
1.105 + display = display, -- needed by LCD driver
1.106 + panel = panel,
1.107 + },
1.108 + },
1.109 + "rom/fb-drv");
1.110 +
1.111 +-- Multiplex the framebuffer.
1.112 +
1.113 +local mag_caps = {
1.114 + mag = l:new_channel(),
1.115 + svc = l:new_channel(),
1.116 + };
1.117 +
1.118 +l:start({
1.119 + caps = {
1.120 + vbus = io_buses.gpio, -- needed by input driver
1.121 + fb = fbdrv_fb,
1.122 + mag = mag_caps.mag:svr(),
1.123 + svc = mag_caps.svc:svr(),
1.124 + },
1.125 + },
1.126 + "rom/mag");
1.127 +
1.128 +-- Expose the keypad matrix.
1.129 +
1.130 +local keypad = l:new_channel();
1.131 +
1.132 +l:start({
1.133 + caps = {
1.134 + vbus = io_buses.gpio,
1.135 + keypad = keypad:svr(),
1.136 + },
1.137 + },
1.138 + "rom/dev_keypad_letux400");
1.139 +
1.140 +-- Expose the keypad events.
1.141 +
1.142 +local ev = l:new_channel();
1.143 +
1.144 +l:start({
1.145 + caps = {
1.146 + keypad = keypad,
1.147 + ev = ev:svr(),
1.148 + },
1.149 + },
1.150 + "rom/dev_input_keypad_letux400");
1.151 +
1.152 +-- Show key event values.
1.153 +
1.154 +l:startv({
1.155 + caps = {
1.156 + fb = mag_caps.svc:create(L4.Proto.Goos, "g=800x460+0+0", "barheight=20"),
1.157 + ev = ev,
1.158 + },
1.159 + },
1.160 + "rom/ex_input_event_client", "chars");
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/conf/landfall-examples/mips-letux400-input-event-client.io Fri May 18 17:19:28 2018 +0200
2.3 @@ -0,0 +1,26 @@
2.4 +-- vim: ft=lua ts=2 et sw=2
2.5 +
2.6 +-- Configuration file for Io.
2.7 +
2.8 +local hw = Io.system_bus()
2.9 +
2.10 +Io.add_vbus("cpm", Io.Vi.System_bus
2.11 +{
2.12 + CPM = wrap(hw:match("jz4730-cpm"));
2.13 +})
2.14 +
2.15 +Io.add_vbus("gpio", Io.Vi.System_bus
2.16 +{
2.17 + GPIO = wrap(hw:match("jz4730-gpio"));
2.18 +})
2.19 +
2.20 +Io.add_vbus("lcd", Io.Vi.System_bus
2.21 +{
2.22 + LCD = wrap(hw:match("jz4740-lcd"));
2.23 +})
2.24 +
2.25 +Io.add_vbus("pwm", Io.Vi.System_bus
2.26 +{
2.27 + GPIO = wrap(hw:match("jz4730-gpio"));
2.28 + PWM = wrap(hw:match("jz4730-pwm"));
2.29 +})
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/conf/landfall-examples/mips-letux400-input-event-client.list Fri May 18 17:19:28 2018 +0200
3.3 @@ -0,0 +1,23 @@
3.4 +
3.5 +modaddr 0x1100000
3.6 +
3.7 +entry mips-letux400-input-event-client-example
3.8 +bootstrap bootstrap -serial
3.9 +kernel fiasco -serial_esc
3.10 +roottask moe rom/mips-letux400-input-event-client.cfg
3.11 +module mips-letux400-input-event-client.cfg
3.12 +module mips-letux400-input-event-client.io
3.13 +module plat-letux400/hw_devices.io
3.14 +module l4re
3.15 +module io
3.16 +module ned
3.17 +module fb-drv
3.18 +module mag
3.19 +module dev_pwm_jz4730
3.20 +module dev_backlight_pwm
3.21 +module dev_display_letux400
3.22 +module dev_panel_letux400
3.23 +module dev_cpm_jz4730
3.24 +module dev_keypad_letux400
3.25 +module dev_input_keypad_letux400
3.26 +module ex_input_event_client
4.1 --- a/conf/landfall-examples/mips-letux400-keypad-demo.cfg Fri May 18 15:35:58 2018 +0200
4.2 +++ b/conf/landfall-examples/mips-letux400-keypad-demo.cfg Fri May 18 17:19:28 2018 +0200
4.3 @@ -154,25 +154,49 @@
4.4 },
4.5 "rom/ex_letux400_keypad_physical");
4.6
4.7 +-- Expose the keypad events.
4.8 +
4.9 +local ev1 = l:new_channel();
4.10 +
4.11 +l:start({
4.12 + caps = {
4.13 + keypad = keypad,
4.14 + ev = ev1:svr(),
4.15 + },
4.16 + },
4.17 + "rom/dev_input_keypad_letux400");
4.18 +
4.19 -- Show key event values.
4.20
4.21 l:start({
4.22 caps = {
4.23 - fb = mag_caps.svc:create(L4.Proto.Goos, "g=400x220+0+240", "barheight=20"),
4.24 - keypad = keypad,
4.25 + fb = mag_caps.svc:create(L4.Proto.Goos, "g=400x220+0+240", "barheight=20"),
4.26 + ev = ev1,
4.27 },
4.28 },
4.29 - "rom/ex_letux400_keypad_driver");
4.30 + "rom/ex_input_event_client");
4.31 +
4.32 +-- Expose the keypad events.
4.33 +
4.34 +local ev2 = l:new_channel();
4.35 +
4.36 +l:start({
4.37 + caps = {
4.38 + keypad = keypad,
4.39 + ev = ev2:svr(),
4.40 + },
4.41 + },
4.42 + "rom/dev_input_keypad_letux400");
4.43
4.44 -- Show key strings.
4.45
4.46 l:startv({
4.47 caps = {
4.48 - fb = mag_caps.svc:create(L4.Proto.Goos, "g=400x220+400+240", "barheight=20"),
4.49 - keypad = keypad,
4.50 + fb = mag_caps.svc:create(L4.Proto.Goos, "g=400x220+400+240", "barheight=20"),
4.51 + ev = ev2,
4.52 },
4.53 },
4.54 - "rom/ex_letux400_keypad_driver", "chars");
4.55 + "rom/ex_input_event_client", "chars");
4.56
4.57 -- Control the backlight using the keyboard.
4.58
5.1 --- a/conf/landfall-examples/mips-letux400-keypad-demo.list Fri May 18 15:35:58 2018 +0200
5.2 +++ b/conf/landfall-examples/mips-letux400-keypad-demo.list Fri May 18 17:19:28 2018 +0200
5.3 @@ -19,7 +19,8 @@
5.4 module dev_panel_letux400
5.5 module dev_cpm_jz4730
5.6 module dev_keypad_letux400
5.7 -module ex_letux400_keypad_driver
5.8 +module dev_input_keypad_letux400
5.9 +module ex_input_event_client
5.10 module ex_keypad_ds_client
5.11 module ex_letux400_backlight
5.12 module ex_letux400_keypad_physical
6.1 --- a/tools/install.sh Fri May 18 15:35:58 2018 +0200
6.2 +++ b/tools/install.sh Fri May 18 17:19:28 2018 +0200
6.3 @@ -49,28 +49,89 @@
6.4 fi
6.5
6.6 for OBJTYPE in 'conf' 'pkg' ; do
6.7 - OBJDIR=`realpath "$L4DIR"`/$OBJTYPE
6.8 + TARGETDIR=`realpath "$L4DIR"`/$OBJTYPE
6.9 + SOURCEDIR="$DIRNAME/$OBJTYPE"
6.10 +
6.11 + # If cleaning, remove all objects.
6.12
6.13 - for OBJECT in "$DIRNAME/$OBJTYPE/"* ; do
6.14 - OBJNAME=`basename "$OBJECT"`
6.15 - ORIGIN=`realpath "$OBJECT"`
6.16 - TARGET="$OBJDIR/$OBJNAME"
6.17 + if [ "$CLEAN" ] ; then
6.18 + for OBJECT in "$SOURCEDIR/"* ; do
6.19 + OBJNAME=`basename "$OBJECT"`
6.20 + ORIGIN=`realpath "$OBJECT"`
6.21 + TARGET="$TARGETDIR/$OBJNAME"
6.22
6.23 - if [ "$CLEAN" ] ; then
6.24 if [ -d "$TARGET" ] ; then
6.25 rm -r --one-file-system "$TARGET"
6.26 else
6.27 rm "$TARGET"
6.28 fi
6.29 - else
6.30 - # With an existing target, attempt to update the installed objects.
6.31 - # Otherwise, just install the objects.
6.32 + done
6.33 +
6.34 + continue
6.35 + fi
6.36 +
6.37 + # Make directories.
6.38 +
6.39 + for OBJECT in `find "$SOURCEDIR" -type d -print` ; do
6.40 + ORIGIN=`realpath "$OBJECT"`
6.41 + RELPATH=${ORIGIN#$SOURCEDIR/}
6.42 +
6.43 + # Skip top-level directories.
6.44 +
6.45 + if [ "$RELPATH" = "$ORIGIN" ]; then
6.46 + continue
6.47 + fi
6.48
6.49 - if [ -d "$ORIGIN" ] ; then
6.50 - cp -u -R "$ORIGIN" `dirname "$TARGET"`
6.51 - else
6.52 - cp -u "$ORIGIN" "$TARGET"
6.53 - fi
6.54 + TARGET="$TARGETDIR/$RELPATH"
6.55 +
6.56 + if [ ! -e "$TARGET" ]; then
6.57 + mkdir "$TARGET"
6.58 + fi
6.59 + done
6.60 +
6.61 + # Copy new files.
6.62 +
6.63 + for OBJECT in `find "$SOURCEDIR" -type f -not -name '.*' -not -name '*.orig' -not -name '*.rej' -print` ; do
6.64 + ORIGIN=`realpath "$OBJECT"`
6.65 + RELPATH=${ORIGIN#$SOURCEDIR/}
6.66 + TARGET="$TARGETDIR/$RELPATH"
6.67 +
6.68 + if [ ! -e "$TARGET" ] || [ "$ORIGIN" -nt "$TARGET" ] ; then
6.69 + cp "$ORIGIN" "$TARGET"
6.70 fi
6.71 done
6.72 +
6.73 + # Remove obsolete files.
6.74 +
6.75 + for OBJECT in "$SOURCEDIR/"* ; do
6.76 + OBJNAME=`basename "$OBJECT"`
6.77 + ORIGIN=`realpath "$OBJECT"`
6.78 +
6.79 + # Examine the target object directory for files that are not provided
6.80 + # by the distribution.
6.81 +
6.82 + TARGET="$TARGETDIR/$OBJNAME"
6.83 +
6.84 + for FILENAME in `find "$TARGET" -type f -not -name '.*' -not -name '*.orig' -not -name '*.rej' -print` ; do
6.85 + PATHNAME=`realpath "$FILENAME"`
6.86 + RELPATH=${PATHNAME#$TARGET}
6.87 + SOURCE="$ORIGIN/$RELPATH"
6.88 +
6.89 + if [ ! -e "$SOURCE" ] ; then
6.90 + rm "$PATHNAME"
6.91 + fi
6.92 + done
6.93 +
6.94 + # Remove obsolete directories.
6.95 +
6.96 + for FILENAME in `find "$TARGET" -depth -type d -print` ; do
6.97 + PATHNAME=`realpath "$FILENAME"`
6.98 + RELPATH=${PATHNAME#$TARGET}
6.99 + SOURCE="$ORIGIN/$RELPATH"
6.100 +
6.101 + if [ ! -e "$SOURCE" ] ; then
6.102 + rmdir "$PATHNAME"
6.103 + fi
6.104 + done
6.105 + done
6.106 done