From 64e273d3888182b9ea4e999577ef45dd0e1a68d3 Mon Sep 17 00:00:00 2001 From: Adam Dunkels Date: Tue, 22 Feb 2011 17:35:05 +0100 Subject: [PATCH] Moved the backyard/ directory to contikiprojects --- backyard/Makefile | 292 ---- backyard/apps/editor/Makefile.editor | 2 - backyard/apps/editor/editor-dsc.c | 73 - backyard/apps/editor/editor-dsc.h | 42 - backyard/apps/editor/editor.c | 338 ----- backyard/apps/webserver/httpd-socket.c | 193 --- backyard/core/ctk/ctk-conio-service.c | 569 -------- backyard/core/ctk/ctk-conio-service.h | 42 - backyard/core/ctk/ctk-draw-service.h | 73 - backyard/core/ctk/ctk-draw.c | 173 --- backyard/core/ctk/ctk-graphic-draw.h | 96 -- backyard/core/ctk/ctk-graphic.c | 809 ----------- backyard/core/ctk/ctk-mouse.c | 323 ----- backyard/core/ctk/ctk-term-ascii.h | 123 -- backyard/core/ctk/ctk-term-in.c | 381 ------ backyard/core/ctk/ctk-term-int.h | 99 -- backyard/core/ctk/ctk-term-out.c | 350 ----- backyard/core/ctk/ctk-term-out.h | 42 - backyard/core/ctk/ctk-term.c | 1028 -------------- backyard/core/ctk/ctk-term.h | 46 - backyard/core/ctk/ctk-termarch.h | 58 - backyard/core/ctk/ctk-termserial.c | 110 -- backyard/core/ctk/ctk-termserial.h | 38 - backyard/core/ctk/ctk-termtelnet.c | 655 --------- backyard/core/ctk/ctk-termtelnet.h | 38 - backyard/core/ctk/ctk-vncserver-service.c | 1146 ---------------- backyard/core/dev/cc2420.c | 668 --------- backyard/core/dev/cc2420.h | 144 -- backyard/core/dev/cs8900a.c | 314 ----- backyard/core/dev/cs8900a.h | 44 - backyard/core/lib/crtk.c | 152 --- backyard/core/lib/crtk.h | 150 --- backyard/core/lib/ctk-textedit.c | 181 --- backyard/core/lib/ctk-textedit.h | 73 - backyard/core/lib/malloc.c | 434 ------ backyard/core/lib/malloc.h | 88 -- backyard/core/lib/malloc_compact.c | 133 -- backyard/core/lib/realloc.c | 159 --- backyard/core/net/adhoc-service.h | 54 - backyard/core/net/hc-service.c | 68 - backyard/core/net/hc-service.h | 45 - backyard/core/net/ppp/ahdlc.c | 381 ------ backyard/core/net/ppp/ahdlc.h | 57 - backyard/core/net/ppp/ipcp.c | 462 ------- backyard/core/net/ppp/ipcp.h | 95 -- backyard/core/net/ppp/lcp.c | 463 ------- backyard/core/net/ppp/lcp.h | 96 -- backyard/core/net/ppp/pap.c | 195 --- backyard/core/net/ppp/pap.h | 83 -- backyard/core/net/ppp/ppp-service.c | 91 -- backyard/core/net/ppp/ppp.c | 440 ------ backyard/core/net/ppp/ppp.h | 132 -- backyard/core/net/ppp/ppp_process.c | 234 ---- backyard/core/net/ppp/ppp_process.h | 3 - backyard/core/net/uipbuf.c | 134 -- backyard/core/net/uipbuf.h | 182 --- backyard/core/sys/service.c | 111 -- backyard/core/sys/service.h | 195 --- backyard/cpu/6502/apps/memstat-dsc.c | 73 - backyard/cpu/6502/apps/memstat-dsc.h | 42 - backyard/cpu/6502/apps/memstat.c | 127 -- backyard/cpu/6502/cc65-make-labels | 6 - backyard/cpu/6502/loader/loader-arch-dsc.c | 57 - backyard/cpu/6502/loader/loader-arch-dsc.h | 46 - .../cpu/6502/loader/loader-arch-module-dsc.S | 1 - backyard/cpu/6502/loader/loader-arch-module.S | 8 - backyard/cpu/6502/loader/loader-arch.c | 117 -- backyard/cpu/6502/loader/loader-arch.h | 47 - backyard/cpu/6502/net/rs232dev.c | 272 ---- backyard/cpu/6502/net/rs232dev.h | 48 - backyard/cpu/6502/net/slip-drv.c | 81 -- backyard/cpu/6502/net/slip-dsc.c | 71 - backyard/cpu/6502/net/slip-dump-drv.c | 120 -- backyard/cpu/avr/dev/rtl8019as-drv.c | 160 --- backyard/platform/apple2enh/lib/log-asm.S | 51 - backyard/platform/apple2enh/lib/log.c | 60 - backyard/platform/c64/Makefile | 77 -- backyard/platform/c64/apps/blueround-dsc.c | 73 - backyard/platform/c64/apps/cgterm-dsc.c | 73 - backyard/platform/c64/apps/cgterm.c | 242 ---- backyard/platform/c64/apps/config.c | 241 ---- backyard/platform/c64/apps/configedit-dsc.c | 73 - backyard/platform/c64/apps/configedit-dsc.h | 42 - backyard/platform/c64/apps/configedit.c | 418 ------ backyard/platform/c64/apps/default-dsc.c | 71 - backyard/platform/c64/apps/enabler-dsc.c | 73 - .../c64/apps/http-user-agent-string.c | 37 - .../c64/apps/http-user-agent-string.h | 35 - backyard/platform/c64/apps/memstat-dsc.c | 73 - backyard/platform/c64/apps/mtest.c | 54 - backyard/platform/c64/apps/plasma-dsc.c | 73 - backyard/platform/c64/apps/plasma.c | 224 ---- backyard/platform/c64/apps/ravenpine-dsc.c | 73 - backyard/platform/c64/apps/springlight-dsc.c | 73 - backyard/platform/c64/apps/ssfire-dsc.c | 73 - backyard/platform/c64/apps/ssfire.c | 163 --- backyard/platform/c64/apps/themeloader.c | 52 - backyard/platform/c64/apps/vnc-draw-asm.S | 16 - backyard/platform/c64/apps/vnc-draw-asm.h | 42 - backyard/platform/c64/apps/vnc-draw.c | 689 ---------- backyard/platform/c64/apps/warmboot.c | 54 - backyard/platform/c64/apps/welcome.c | 88 -- backyard/platform/c64/apps/wget-dsc.c | 73 - backyard/platform/c64/apps/wget-dsc.h | 42 - backyard/platform/c64/apps/wget.c | 528 -------- backyard/platform/c64/c64.cfg | 30 - backyard/platform/c64/contiki-conf.h | 611 --------- backyard/platform/c64/ctk/ctk-80col-asm.S | 986 -------------- backyard/platform/c64/ctk/ctk-80col-asm.h | 73 - backyard/platform/c64/ctk/ctk-80col-theme.h | 83 -- backyard/platform/c64/ctk/ctk-80col.c | 1190 ----------------- backyard/platform/c64/ctk/ctk-arch.h | 55 - backyard/platform/c64/ctk/ctk-hires-asm.S | 934 ------------- backyard/platform/c64/ctk/ctk-hires-asm.h | 70 - backyard/platform/c64/ctk/ctk-hires-service.c | 925 ------------- .../c64/ctk/ctk-hires-theme-blueround.c | 313 ----- .../c64/ctk/ctk-hires-theme-default.c | 303 ----- .../c64/ctk/ctk-hires-theme-enabler.c | 303 ----- .../c64/ctk/ctk-hires-theme-ravenpine.c | 288 ---- .../c64/ctk/ctk-hires-theme-springlight.c | 284 ---- backyard/platform/c64/ctk/ctk-hires-theme.h | 105 -- backyard/platform/c64/ctk/ctk-hires.c | 871 ------------ backyard/platform/c64/ctk/ctk-hires.h | 48 - backyard/platform/c64/ctk/ctk-mouse-1351.S | 149 --- backyard/platform/c64/ctk/ctk-mouse-arch.c | 122 -- backyard/platform/c64/ctk/ctk-mouse-asm.S | 48 - backyard/platform/c64/ctk/ctk-mouse-joy.S | 135 -- backyard/platform/c64/ctk/ctk-mouse.c | 122 -- backyard/platform/c64/lib/iconfield.c | 119 -- backyard/platform/c64/lib/mtarch-asm.S | 245 ---- backyard/platform/c64/lib/mtarch.c | 98 -- backyard/platform/c64/lib/mtarch.h | 51 - backyard/platform/c64/lib/save-driveunit.S | 7 - backyard/platform/c64/loader/c64-dio-asm.S | 505 ------- backyard/platform/c64/loader/c64-dio-asm.h | 47 - backyard/platform/c64/loader/c64-dio.c | 119 -- backyard/platform/c64/loader/c64-dio.h | 50 - backyard/platform/c64/loader/c64-fs-raw.c | 205 --- backyard/platform/c64/loader/c64-fs-raw.h | 46 - backyard/platform/c64/loader/c64-fs-write.c | 121 -- backyard/platform/c64/loader/c64-fs.c | 411 ------ backyard/platform/c64/loader/c64-fs.h | 97 -- backyard/platform/c64/loader/cfs-1541-asm.S | 571 -------- backyard/platform/c64/loader/cfs-1541.c | 67 - backyard/platform/c64/loader/cfs-cbm-posix.c | 146 -- backyard/platform/c64/loader/cfs-cbm.c | 123 -- backyard/platform/c64/loader/cfs-cbm.h | 39 - backyard/platform/c64/loader/cfs-init.c | 93 -- backyard/platform/c64/loader/cfs-init.h | 42 - backyard/platform/c64/loader/loader-arch.c | 140 -- backyard/platform/c64/main.c | 143 -- backyard/platform/c64/net/cs8900a.c | 297 ---- backyard/platform/c64/net/cs8900a.h | 44 - backyard/platform/c64/net/eth64-drv.c | 107 -- backyard/platform/c64/net/eth64-dsc.c | 73 - backyard/platform/c64/net/eth64-dump-drv.c | 146 -- backyard/platform/c64/net/lan91c96.c | 453 ------- backyard/platform/c64/net/lan91c96.h | 45 - backyard/platform/c64/net/rrnet-drv-asm.S | 17 - backyard/platform/c64/net/rrnet-drv.c | 117 -- backyard/platform/c64/net/rrnet-dsc.c | 73 - backyard/platform/c64/net/rrnet-dump-drv.c | 146 -- backyard/platform/c64/net/rs232dev-ss.c | 236 ---- backyard/platform/c64/net/rs232silversurfer.S | 329 ----- backyard/platform/c64/net/rs232silversurfer.h | 143 -- backyard/platform/c64/net/tfe-drv-asm.S | 17 - backyard/platform/c64/net/tfe-drv.c | 107 -- backyard/platform/c64/net/tfe-dsc.c | 73 - backyard/platform/c64/net/tfe-dump-drv.c | 141 -- backyard/platform/esb/Makefile | 21 - backyard/platform/gtk/Makefile | 38 - backyard/platform/gtk/Makefile.gtk | 29 - backyard/platform/gtk/background.png | Bin 95975 -> 0 bytes backyard/platform/gtk/clock.c | 56 - backyard/platform/gtk/contiki-conf.h | 187 --- backyard/platform/gtk/contiki-main.c | 185 --- backyard/platform/gtk/ctk/conio.h | 47 - backyard/platform/gtk/ctk/ctk-arch.h | 45 - backyard/platform/gtk/ctk/ctk-gtksim-conio.c | 359 ----- backyard/platform/gtk/ctk/ctk-gtksim-draw.c | 172 --- backyard/platform/gtk/ctk/ctk-gtksim-draw.h | 37 - .../platform/gtk/ctk/ctk-gtksim-service.c | 869 ------------ .../platform/gtk/ctk/ctk-gtksim-service.h | 8 - backyard/platform/gtk/ctk/ctk-gtksim.c | 371 ----- backyard/platform/gtk/ctk/ctk-gtksim.h | 73 - backyard/platform/gtk/menubar.png | Bin 4391 -> 0 bytes backyard/platform/gtk/vnc-draw.c | 210 --- backyard/platform/gtk/windowborder.png | Bin 24082 -> 0 bytes backyard/platform/minimal-ppp/Makefile | 118 -- .../platform/minimal-ppp/Makefile.minimal-ppp | 58 - backyard/platform/minimal-ppp/README | 5 - backyard/platform/minimal-ppp/clock.c | 61 - backyard/platform/minimal-ppp/contiki-conf.h | 223 --- backyard/platform/minimal-ppp/contiki-main.c | 99 -- backyard/platform/minimal-ppp/ctk-arch.h | 41 - backyard/platform/minimal-ppp/leds-arch.c | 61 - backyard/platform/minimal-ppp/ppp-arch.c | 62 - backyard/platform/minimal-ppp/ppp_arch.h | 0 backyard/platform/sky/Makefile | 118 -- backyard/platform/sky/client.c | 203 --- backyard/platform/sky/dhclient.c | 276 ---- backyard/platform/sky/gateway.c | 187 --- backyard/platform/sky/loadable_prg.c | 82 -- backyard/platform/sky/udprecv.c | 91 -- backyard/platform/sky/udpsend.c | 102 -- backyard/tools/chakana/CYGWIN_USERS.txt | 13 - backyard/tools/chakana/__init__.py | 1 - backyard/tools/chakana/build.xml | 30 - backyard/tools/chakana/command.py | 190 --- .../tools/chakana/cooja.chakana.properties | 1 - backyard/tools/chakana/cooja_plugin/README | 3 - backyard/tools/chakana/cooja_plugin/build.xml | 40 - .../tools/chakana/cooja_plugin/cooja.config | 2 - .../java/se/sics/chakana/ChakanaPlugin.java | 279 ---- .../se/sics/chakana/EventpointEvaluator.java | 169 --- .../se/sics/chakana/XMLCommandHandler.java | 1159 ---------------- .../sics/chakana/eventpoints/Eventpoint.java | 56 - .../eventpoints/IntegerWatchpoint.java | 43 - .../eventpoints/RadioMediumEventpoint.java | 90 -- .../chakana/eventpoints/RealTimepoint.java | 77 -- .../eventpoints/SimulationTimepoint.java | 80 -- .../sics/chakana/eventpoints/Timepoint.java | 38 - .../TransmissionRadioMediumEventpoint.java | 66 - .../eventpoints/VariableWatchpoint.java | 69 - .../sics/chakana/eventpoints/Watchpoint.java | 89 -- backyard/tools/chakana/debug.py | 279 ---- backyard/tools/chakana/error.py | 89 -- backyard/tools/chakana/event.py | 175 --- backyard/tools/chakana/harness.py | 126 -- backyard/tools/chakana/linux.py | 268 ---- backyard/tools/chakana/monitor.py | 184 --- backyard/tools/chakana/shepherd.py | 347 ----- .../tools/chakana/test_template/run_test.py | 143 -- .../test_template/simple_simulation.csc | 13 - backyard/tools/chakana/threads.py | 287 ---- backyard/tools/chakana/utils.py | 736 ---------- .../tools/cooja/apps/serial2pipe/build.xml | 36 - .../tools/cooja/apps/serial2pipe/cooja.config | 2 - .../se/sics/cooja/plugins/Serial2Pipe.java | 177 --- .../cooja/examples/project_debug/build.xml | 23 - .../cooja/examples/project_debug/cooja.config | 1 - .../project_debug/java/MoteDebugger.java | 172 --- 242 files changed, 42576 deletions(-) delete mode 100644 backyard/Makefile delete mode 100644 backyard/apps/editor/Makefile.editor delete mode 100644 backyard/apps/editor/editor-dsc.c delete mode 100644 backyard/apps/editor/editor-dsc.h delete mode 100644 backyard/apps/editor/editor.c delete mode 100644 backyard/apps/webserver/httpd-socket.c delete mode 100644 backyard/core/ctk/ctk-conio-service.c delete mode 100644 backyard/core/ctk/ctk-conio-service.h delete mode 100644 backyard/core/ctk/ctk-draw-service.h delete mode 100644 backyard/core/ctk/ctk-draw.c delete mode 100644 backyard/core/ctk/ctk-graphic-draw.h delete mode 100644 backyard/core/ctk/ctk-graphic.c delete mode 100644 backyard/core/ctk/ctk-mouse.c delete mode 100644 backyard/core/ctk/ctk-term-ascii.h delete mode 100644 backyard/core/ctk/ctk-term-in.c delete mode 100644 backyard/core/ctk/ctk-term-int.h delete mode 100644 backyard/core/ctk/ctk-term-out.c delete mode 100644 backyard/core/ctk/ctk-term-out.h delete mode 100644 backyard/core/ctk/ctk-term.c delete mode 100644 backyard/core/ctk/ctk-term.h delete mode 100644 backyard/core/ctk/ctk-termarch.h delete mode 100644 backyard/core/ctk/ctk-termserial.c delete mode 100644 backyard/core/ctk/ctk-termserial.h delete mode 100644 backyard/core/ctk/ctk-termtelnet.c delete mode 100644 backyard/core/ctk/ctk-termtelnet.h delete mode 100644 backyard/core/ctk/ctk-vncserver-service.c delete mode 100644 backyard/core/dev/cc2420.c delete mode 100644 backyard/core/dev/cc2420.h delete mode 100644 backyard/core/dev/cs8900a.c delete mode 100644 backyard/core/dev/cs8900a.h delete mode 100644 backyard/core/lib/crtk.c delete mode 100644 backyard/core/lib/crtk.h delete mode 100644 backyard/core/lib/ctk-textedit.c delete mode 100644 backyard/core/lib/ctk-textedit.h delete mode 100644 backyard/core/lib/malloc.c delete mode 100644 backyard/core/lib/malloc.h delete mode 100644 backyard/core/lib/malloc_compact.c delete mode 100644 backyard/core/lib/realloc.c delete mode 100644 backyard/core/net/adhoc-service.h delete mode 100644 backyard/core/net/hc-service.c delete mode 100644 backyard/core/net/hc-service.h delete mode 100644 backyard/core/net/ppp/ahdlc.c delete mode 100644 backyard/core/net/ppp/ahdlc.h delete mode 100644 backyard/core/net/ppp/ipcp.c delete mode 100644 backyard/core/net/ppp/ipcp.h delete mode 100644 backyard/core/net/ppp/lcp.c delete mode 100644 backyard/core/net/ppp/lcp.h delete mode 100644 backyard/core/net/ppp/pap.c delete mode 100644 backyard/core/net/ppp/pap.h delete mode 100644 backyard/core/net/ppp/ppp-service.c delete mode 100644 backyard/core/net/ppp/ppp.c delete mode 100644 backyard/core/net/ppp/ppp.h delete mode 100644 backyard/core/net/ppp/ppp_process.c delete mode 100644 backyard/core/net/ppp/ppp_process.h delete mode 100644 backyard/core/net/uipbuf.c delete mode 100644 backyard/core/net/uipbuf.h delete mode 100644 backyard/core/sys/service.c delete mode 100644 backyard/core/sys/service.h delete mode 100644 backyard/cpu/6502/apps/memstat-dsc.c delete mode 100644 backyard/cpu/6502/apps/memstat-dsc.h delete mode 100644 backyard/cpu/6502/apps/memstat.c delete mode 100755 backyard/cpu/6502/cc65-make-labels delete mode 100644 backyard/cpu/6502/loader/loader-arch-dsc.c delete mode 100644 backyard/cpu/6502/loader/loader-arch-dsc.h delete mode 100644 backyard/cpu/6502/loader/loader-arch-module-dsc.S delete mode 100644 backyard/cpu/6502/loader/loader-arch-module.S delete mode 100644 backyard/cpu/6502/loader/loader-arch.c delete mode 100644 backyard/cpu/6502/loader/loader-arch.h delete mode 100644 backyard/cpu/6502/net/rs232dev.c delete mode 100644 backyard/cpu/6502/net/rs232dev.h delete mode 100644 backyard/cpu/6502/net/slip-drv.c delete mode 100644 backyard/cpu/6502/net/slip-dsc.c delete mode 100644 backyard/cpu/6502/net/slip-dump-drv.c delete mode 100644 backyard/cpu/avr/dev/rtl8019as-drv.c delete mode 100644 backyard/platform/apple2enh/lib/log-asm.S delete mode 100644 backyard/platform/apple2enh/lib/log.c delete mode 100644 backyard/platform/c64/Makefile delete mode 100644 backyard/platform/c64/apps/blueround-dsc.c delete mode 100644 backyard/platform/c64/apps/cgterm-dsc.c delete mode 100644 backyard/platform/c64/apps/cgterm.c delete mode 100644 backyard/platform/c64/apps/config.c delete mode 100644 backyard/platform/c64/apps/configedit-dsc.c delete mode 100644 backyard/platform/c64/apps/configedit-dsc.h delete mode 100644 backyard/platform/c64/apps/configedit.c delete mode 100644 backyard/platform/c64/apps/default-dsc.c delete mode 100644 backyard/platform/c64/apps/enabler-dsc.c delete mode 100644 backyard/platform/c64/apps/http-user-agent-string.c delete mode 100644 backyard/platform/c64/apps/http-user-agent-string.h delete mode 100644 backyard/platform/c64/apps/memstat-dsc.c delete mode 100644 backyard/platform/c64/apps/mtest.c delete mode 100644 backyard/platform/c64/apps/plasma-dsc.c delete mode 100644 backyard/platform/c64/apps/plasma.c delete mode 100644 backyard/platform/c64/apps/ravenpine-dsc.c delete mode 100644 backyard/platform/c64/apps/springlight-dsc.c delete mode 100644 backyard/platform/c64/apps/ssfire-dsc.c delete mode 100644 backyard/platform/c64/apps/ssfire.c delete mode 100644 backyard/platform/c64/apps/themeloader.c delete mode 100644 backyard/platform/c64/apps/vnc-draw-asm.S delete mode 100644 backyard/platform/c64/apps/vnc-draw-asm.h delete mode 100644 backyard/platform/c64/apps/vnc-draw.c delete mode 100644 backyard/platform/c64/apps/warmboot.c delete mode 100644 backyard/platform/c64/apps/welcome.c delete mode 100644 backyard/platform/c64/apps/wget-dsc.c delete mode 100644 backyard/platform/c64/apps/wget-dsc.h delete mode 100644 backyard/platform/c64/apps/wget.c delete mode 100644 backyard/platform/c64/c64.cfg delete mode 100644 backyard/platform/c64/contiki-conf.h delete mode 100644 backyard/platform/c64/ctk/ctk-80col-asm.S delete mode 100644 backyard/platform/c64/ctk/ctk-80col-asm.h delete mode 100644 backyard/platform/c64/ctk/ctk-80col-theme.h delete mode 100644 backyard/platform/c64/ctk/ctk-80col.c delete mode 100644 backyard/platform/c64/ctk/ctk-arch.h delete mode 100644 backyard/platform/c64/ctk/ctk-hires-asm.S delete mode 100644 backyard/platform/c64/ctk/ctk-hires-asm.h delete mode 100644 backyard/platform/c64/ctk/ctk-hires-service.c delete mode 100644 backyard/platform/c64/ctk/ctk-hires-theme-blueround.c delete mode 100644 backyard/platform/c64/ctk/ctk-hires-theme-default.c delete mode 100644 backyard/platform/c64/ctk/ctk-hires-theme-enabler.c delete mode 100644 backyard/platform/c64/ctk/ctk-hires-theme-ravenpine.c delete mode 100644 backyard/platform/c64/ctk/ctk-hires-theme-springlight.c delete mode 100644 backyard/platform/c64/ctk/ctk-hires-theme.h delete mode 100644 backyard/platform/c64/ctk/ctk-hires.c delete mode 100644 backyard/platform/c64/ctk/ctk-hires.h delete mode 100644 backyard/platform/c64/ctk/ctk-mouse-1351.S delete mode 100644 backyard/platform/c64/ctk/ctk-mouse-arch.c delete mode 100644 backyard/platform/c64/ctk/ctk-mouse-asm.S delete mode 100644 backyard/platform/c64/ctk/ctk-mouse-joy.S delete mode 100644 backyard/platform/c64/ctk/ctk-mouse.c delete mode 100644 backyard/platform/c64/lib/iconfield.c delete mode 100644 backyard/platform/c64/lib/mtarch-asm.S delete mode 100644 backyard/platform/c64/lib/mtarch.c delete mode 100644 backyard/platform/c64/lib/mtarch.h delete mode 100644 backyard/platform/c64/lib/save-driveunit.S delete mode 100644 backyard/platform/c64/loader/c64-dio-asm.S delete mode 100644 backyard/platform/c64/loader/c64-dio-asm.h delete mode 100644 backyard/platform/c64/loader/c64-dio.c delete mode 100644 backyard/platform/c64/loader/c64-dio.h delete mode 100644 backyard/platform/c64/loader/c64-fs-raw.c delete mode 100644 backyard/platform/c64/loader/c64-fs-raw.h delete mode 100644 backyard/platform/c64/loader/c64-fs-write.c delete mode 100644 backyard/platform/c64/loader/c64-fs.c delete mode 100644 backyard/platform/c64/loader/c64-fs.h delete mode 100644 backyard/platform/c64/loader/cfs-1541-asm.S delete mode 100644 backyard/platform/c64/loader/cfs-1541.c delete mode 100644 backyard/platform/c64/loader/cfs-cbm-posix.c delete mode 100644 backyard/platform/c64/loader/cfs-cbm.c delete mode 100644 backyard/platform/c64/loader/cfs-cbm.h delete mode 100644 backyard/platform/c64/loader/cfs-init.c delete mode 100644 backyard/platform/c64/loader/cfs-init.h delete mode 100644 backyard/platform/c64/loader/loader-arch.c delete mode 100644 backyard/platform/c64/main.c delete mode 100644 backyard/platform/c64/net/cs8900a.c delete mode 100644 backyard/platform/c64/net/cs8900a.h delete mode 100644 backyard/platform/c64/net/eth64-drv.c delete mode 100644 backyard/platform/c64/net/eth64-dsc.c delete mode 100644 backyard/platform/c64/net/eth64-dump-drv.c delete mode 100644 backyard/platform/c64/net/lan91c96.c delete mode 100644 backyard/platform/c64/net/lan91c96.h delete mode 100644 backyard/platform/c64/net/rrnet-drv-asm.S delete mode 100644 backyard/platform/c64/net/rrnet-drv.c delete mode 100644 backyard/platform/c64/net/rrnet-dsc.c delete mode 100644 backyard/platform/c64/net/rrnet-dump-drv.c delete mode 100644 backyard/platform/c64/net/rs232dev-ss.c delete mode 100644 backyard/platform/c64/net/rs232silversurfer.S delete mode 100644 backyard/platform/c64/net/rs232silversurfer.h delete mode 100644 backyard/platform/c64/net/tfe-drv-asm.S delete mode 100644 backyard/platform/c64/net/tfe-drv.c delete mode 100644 backyard/platform/c64/net/tfe-dsc.c delete mode 100644 backyard/platform/c64/net/tfe-dump-drv.c delete mode 100644 backyard/platform/esb/Makefile delete mode 100644 backyard/platform/gtk/Makefile delete mode 100644 backyard/platform/gtk/Makefile.gtk delete mode 100644 backyard/platform/gtk/background.png delete mode 100644 backyard/platform/gtk/clock.c delete mode 100644 backyard/platform/gtk/contiki-conf.h delete mode 100644 backyard/platform/gtk/contiki-main.c delete mode 100644 backyard/platform/gtk/ctk/conio.h delete mode 100644 backyard/platform/gtk/ctk/ctk-arch.h delete mode 100644 backyard/platform/gtk/ctk/ctk-gtksim-conio.c delete mode 100644 backyard/platform/gtk/ctk/ctk-gtksim-draw.c delete mode 100644 backyard/platform/gtk/ctk/ctk-gtksim-draw.h delete mode 100644 backyard/platform/gtk/ctk/ctk-gtksim-service.c delete mode 100644 backyard/platform/gtk/ctk/ctk-gtksim-service.h delete mode 100644 backyard/platform/gtk/ctk/ctk-gtksim.c delete mode 100644 backyard/platform/gtk/ctk/ctk-gtksim.h delete mode 100644 backyard/platform/gtk/menubar.png delete mode 100644 backyard/platform/gtk/vnc-draw.c delete mode 100644 backyard/platform/gtk/windowborder.png delete mode 100644 backyard/platform/minimal-ppp/Makefile delete mode 100644 backyard/platform/minimal-ppp/Makefile.minimal-ppp delete mode 100644 backyard/platform/minimal-ppp/README delete mode 100644 backyard/platform/minimal-ppp/clock.c delete mode 100644 backyard/platform/minimal-ppp/contiki-conf.h delete mode 100644 backyard/platform/minimal-ppp/contiki-main.c delete mode 100644 backyard/platform/minimal-ppp/ctk-arch.h delete mode 100644 backyard/platform/minimal-ppp/leds-arch.c delete mode 100644 backyard/platform/minimal-ppp/ppp-arch.c delete mode 100644 backyard/platform/minimal-ppp/ppp_arch.h delete mode 100644 backyard/platform/sky/Makefile delete mode 100644 backyard/platform/sky/client.c delete mode 100644 backyard/platform/sky/dhclient.c delete mode 100644 backyard/platform/sky/gateway.c delete mode 100644 backyard/platform/sky/loadable_prg.c delete mode 100644 backyard/platform/sky/udprecv.c delete mode 100644 backyard/platform/sky/udpsend.c delete mode 100644 backyard/tools/chakana/CYGWIN_USERS.txt delete mode 100644 backyard/tools/chakana/__init__.py delete mode 100644 backyard/tools/chakana/build.xml delete mode 100644 backyard/tools/chakana/command.py delete mode 100644 backyard/tools/chakana/cooja.chakana.properties delete mode 100644 backyard/tools/chakana/cooja_plugin/README delete mode 100644 backyard/tools/chakana/cooja_plugin/build.xml delete mode 100644 backyard/tools/chakana/cooja_plugin/cooja.config delete mode 100644 backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/ChakanaPlugin.java delete mode 100644 backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/EventpointEvaluator.java delete mode 100644 backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/XMLCommandHandler.java delete mode 100644 backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/Eventpoint.java delete mode 100644 backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/IntegerWatchpoint.java delete mode 100644 backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/RadioMediumEventpoint.java delete mode 100644 backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/RealTimepoint.java delete mode 100644 backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/SimulationTimepoint.java delete mode 100644 backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/Timepoint.java delete mode 100644 backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/TransmissionRadioMediumEventpoint.java delete mode 100644 backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/VariableWatchpoint.java delete mode 100644 backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/Watchpoint.java delete mode 100644 backyard/tools/chakana/debug.py delete mode 100644 backyard/tools/chakana/error.py delete mode 100644 backyard/tools/chakana/event.py delete mode 100644 backyard/tools/chakana/harness.py delete mode 100644 backyard/tools/chakana/linux.py delete mode 100644 backyard/tools/chakana/monitor.py delete mode 100644 backyard/tools/chakana/shepherd.py delete mode 100644 backyard/tools/chakana/test_template/run_test.py delete mode 100644 backyard/tools/chakana/test_template/simple_simulation.csc delete mode 100644 backyard/tools/chakana/threads.py delete mode 100644 backyard/tools/chakana/utils.py delete mode 100644 backyard/tools/cooja/apps/serial2pipe/build.xml delete mode 100644 backyard/tools/cooja/apps/serial2pipe/cooja.config delete mode 100644 backyard/tools/cooja/apps/serial2pipe/java/se/sics/cooja/plugins/Serial2Pipe.java delete mode 100644 backyard/tools/cooja/examples/project_debug/build.xml delete mode 100644 backyard/tools/cooja/examples/project_debug/cooja.config delete mode 100644 backyard/tools/cooja/examples/project_debug/java/MoteDebugger.java diff --git a/backyard/Makefile b/backyard/Makefile deleted file mode 100644 index 78851e3c2..000000000 --- a/backyard/Makefile +++ /dev/null @@ -1,292 +0,0 @@ -################################################################### -# toplevel makefile for contiki 2.x -# -# 2006/06/24 gpz - initial creation -# -# todo: -# - add rules for other/more ports -# - add "dist-" rules (for creating tarballs) -# - create checks for required tools and give hints on where -# to get certain missing stuff -# - incase certain targets fail, print a error summary when -# all targets are done -################################################################### - -# uncomment this for less verbose output -#.SILENT: - -MAKE=make -ECHO=echo -en -CD=cd - -################################################################### -# this first rule prints usage info when the make is invoked -# without any arguments -################################################################### - -.PHONY: usage - -usage: - -@$(ECHO) "usage: make \n\n" - -@$(ECHO) "available targets are:\n\n" - -@$(ECHO) "docs build the documentation\n" - -@$(ECHO) "gtk build full featured GTK port\n" - -@$(ECHO) "gtk-examples build examples with GTK port\n" - -@$(ECHO) "esb build full featured ESB port\n" - -@$(ECHO) "esb-examples build examples with ESB port\n" - -@$(ECHO) "minimal-net-examples build examples with minimal-net port\n" - -@$(ECHO) "native-examples build examples with native port\n" - -@$(ECHO) "all build everything\n" - -@$(ECHO) "clean cleanup the sourcetree\n" - -@$(ECHO) "\nfor more targets and other details look at this makefile.\n" - -################################################################### -# the "all" rule can be used to make a clean build from all and -# everything. you will need to have all kinds of support tools -# installed for this to work! -################################################################### - -.PHONY: all dist examples - -all: source-dist docs docs-dist examples c64 esb ethernut1 ethernut2 gtk minimal-net minimal-ppp native netsim - -dist: source-dist docs-dist - -examples: c64-examples esb-examples ethernut1-examples ethernut2-examples gtk-examples minimal-net-examples minimal-ppp-examples native-examples netsim-examples -examples-clean: c64-examples-clean esb-examples-clean ethernut1-examples-clean ethernut2-examples-clean gtk-examples-clean minimal-net-examples-clean minimal-ppp-examples-clean native-examples-clean netsim-examples-clean - -################################################################### -# general cleanup rule -################################################################### - -.PHONY: clean - -clean: docs-clean examples-clean c64-clean esb-clean ethernut1-clean ethernut2-clean gtk-clean minimal-net-clean minimal-ppp-clean native-clean netsim-clean - -@$(ECHO) "sourcetree cleaned up.\n" - -################################################################### -# rules for building the documentation -################################################################### - -.PHONY: docs docs-clean docs-html docs-pdf docs-dist - -docs: docs-html docs-pdf - -docs-doxygen: - -@$(CD) doc; $(MAKE) dox - -docs-html: docs-doxygen - -docs-pdf: docs-doxygen - -@$(CD) doc; $(MAKE) pdf - -docs-clean: - -@$(CD) doc; $(MAKE) clean - -docs-dist: - -################################################################### -# rules for building the source distribution -################################################################### - -source-dist: - -################################################################### -# rules for the C64 port -################################################################### - -.PHONY: c64 c64-clean - -c64: - -@$(CD) platform/c64; $(MAKE) all - -c64-clean: - -@$(CD) platform/c64; $(MAKE) clean - -c64-dist: - -c64-examples: c64-example-webserver c64-example-telnet-server c64-example-test-ipv6 - -c64-example-telnet-server: - -@$(CD) examples/telnet-server; $(MAKE) TARGET=c64 -c64-example-webserver: - -@$(CD) examples/webserver; $(MAKE) TARGET=c64 -c64-example-test-ipv6: - -@$(CD) examples/test-ipv6; $(MAKE) TARGET=c64 - -c64-examples-clean: - -@$(CD) examples/telnet-server; $(MAKE) TARGET=c64 clean - -@$(CD) examples/webserver; $(MAKE) TARGET=c64 clean - -@$(CD) examples/test-ipv6; $(MAKE) TARGET=c64 clean - -################################################################### -# rules for the ESB port -################################################################### - -.PHONY: esb esb-clean - -esb: - -@$(CD) platform/esb; $(MAKE) all - -esb-clean: - -@$(CD) platform/esb; $(MAKE) clean - -esb-dist: - -esb-examples: -esb-examples-clean: - -################################################################### -# rules for the ethernut1 port -################################################################### - -.PHONY: ethernut1 ethernut1-clean - -ethernut1: -# -@$(CD) platform/ethernut1; $(MAKE) all - -ethernut1-clean: -# -@$(CD) platform/ethernut1; $(MAKE) clean - -ethernut1-dist: - -ethernut1-examples: -ethernut1-examples-clean: - -################################################################### -# rules for the ethernut2 port -################################################################### - -.PHONY: ethernut2 ethernut2-clean - -ethernut2: -# -@$(CD) platform/ethernut2; $(MAKE) all - -ethernut2-clean: -# -@$(CD) platform/ethernut2; $(MAKE) clean - -ethernut2-dist: - -ethernut2-examples: -ethernut2-examples-clean: - -################################################################### -# rules for the GTK port -################################################################### - -.PHONY: gtk gtk-clean - -gtk: - -@$(CD) platform/gtk; $(MAKE) all -gtk-clean: - -@$(CD) platform/gtk; $(MAKE) clean - -gtk-examples: gtk-example-webserver gtk-example-telnet-server gtk-example-test-ipv6 - -gtk-example-telnet-server: - -@$(CD) examples/telnet-server; $(MAKE) TARGET=gtk -gtk-example-webserver: - -@$(CD) examples/webserver; $(MAKE) TARGET=gtk -gtk-example-test-ipv6: - -@$(CD) examples/test-ipv6; $(MAKE) TARGET=gtk - -gtk-examples-clean: - -@$(CD) examples/telnet-server; $(MAKE) TARGET=gtk clean - -@$(CD) examples/webserver; $(MAKE) TARGET=gtk clean - -@$(CD) examples/test-ipv6; $(MAKE) TARGET=gtk clean - -gtk-dist: - -################################################################### -# rules for the minimal-net port -################################################################### - -.PHONY: minimal-net minimal-net-clean - -minimal-net: -# -@$(CD) platform/minimal-net; $(MAKE) all - -minimal-net-clean: -# -@$(CD) platform/minimal-net; $(MAKE) clean - -minimal-net-dist: - -minimal-net-examples: minimal-net-example-telnet-server minimal-net-example-webserver minimal-net-example-test-ipv6 - -minimal-net-example-telnet-server: - -@$(CD) examples/telnet-server; $(MAKE) TARGET=minimal-net -minimal-net-example-webserver: - -@$(CD) examples/webserver; $(MAKE) TARGET=minimal-net -minimal-net-example-test-ipv6: - -@$(CD) examples/test-ipv6; $(MAKE) TARGET=minimal-net - -minimal-net-examples-clean: - -@$(CD) examples/telnet-server; $(MAKE) TARGET=minimal-net clean - -@$(CD) examples/webserver; $(MAKE) TARGET=minimal-net clean - -@$(CD) examples/test-ipv6; $(MAKE) TARGET=minimal-net clean - -################################################################### -# rules for the minimal-ppp port -################################################################### - -.PHONY: minimal-ppp minimal-ppp-clean - -minimal-ppp: - -@$(CD) platform/minimal-ppp; $(MAKE) all - -minimal-ppp-clean: - -@$(CD) platform/minimal-ppp; $(MAKE) clean - -minimal-ppp-dist: - -minimal-ppp-examples: -minimal-ppp-examples-clean: - -################################################################### -# rules for the native port -################################################################### - -.PHONY: native native-clean - -native: -# -@$(CD) platform/native; $(MAKE) all - -native-clean: -# -@$(CD) platform/native; $(MAKE) clean - -native-dist: - -native-examples: native-example-telnet-server native-example-webserver native-example-test-ipv6 - -native-example-telnet-server: - -@$(CD) examples/telnet-server; $(MAKE) TARGET=native -native-example-webserver: - -@$(CD) examples/webserver; $(MAKE) TARGET=native -native-example-test-ipv6: - -@$(CD) examples/test-ipv6; $(MAKE) TARGET=native - -native-examples-clean: - -@$(CD) examples/telnet-server; $(MAKE) TARGET=native clean - -@$(CD) examples/webserver; $(MAKE) TARGET=native clean - -@$(CD) examples/test-ipv6; $(MAKE) TARGET=native clean - -################################################################### -# rules for the netsim port -################################################################### - -.PHONY: netsim netsim-clean - -netsim: -# -@$(CD) platform/netsim; $(MAKE) all - -netsim-clean: -# -@$(CD) platform/netsim; $(MAKE) clean - -netsim-dist: - -netsim-examples: - -netsim-examples-clean: - -@$(CD) examples/telnet-server; $(MAKE) TARGET=netsim clean - -@$(CD) examples/webserver; $(MAKE) TARGET=netsim clean - -@$(CD) examples/test-ipv6; $(MAKE) TARGET=netsim clean diff --git a/backyard/apps/editor/Makefile.editor b/backyard/apps/editor/Makefile.editor deleted file mode 100644 index c976cfe1e..000000000 --- a/backyard/apps/editor/Makefile.editor +++ /dev/null @@ -1,2 +0,0 @@ -editor_src = editor.c memb.c ctk-filedialog.c -editor_dsc = editor-dsc.c diff --git a/backyard/apps/editor/editor-dsc.c b/backyard/apps/editor/editor-dsc.c deleted file mode 100644 index e15606e97..000000000 --- a/backyard/apps/editor/editor-dsc.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: editor-dsc.c,v 1.2 2007/09/06 01:36:11 matsutsuka Exp $ - * - */ - -#include "sys/dsc.h" - -/*-----------------------------------------------------------------------------------*/ -#if CTK_CONF_ICON_BITMAPS -static unsigned char editoricon_bitmap[3*3*8] = { - 0x00, 0x7e, 0x40, 0x73, 0x46, 0x4c, 0x18, 0x13, - 0x00, 0x00, 0xff, 0x81, 0x34, 0xc9, 0x00, 0xb6, - 0x00, 0x7e, 0x02, 0xce, 0x72, 0x32, 0x18, 0x48, - - 0x30, 0x27, 0x24, 0x20, 0x37, 0x24, 0x20, 0x33, - 0x00, 0x7b, 0x42, 0x00, 0x7b, 0x42, 0x00, 0x3b, - 0x0c, 0x24, 0x24, 0x04, 0xa4, 0x24, 0x04, 0x4c, - - 0x12, 0x19, 0x4c, 0x46, 0x63, 0x40, 0x7c, 0x00, - 0x22, 0x91, 0x00, 0xc4, 0x81, 0xff, 0x00, 0x00, - 0x08, 0x18, 0x32, 0x62, 0xc6, 0x02, 0x3e, 0x00 -}; -#endif /* CTK_CONF_ICON_BITMAPS */ - -#if CTK_CONF_ICON_TEXTMAPS -static char editoricon_textmap[9] = { - 't', 'x', 't', - 'e', 'd', 'i', - 't', 'o', 'r' -}; -#endif /* CTK_CONF_ICON_TEXTMAPS */ - -#if CTK_CONF_ICONS -static struct ctk_icon editor_icon = - {CTK_ICON("Editor", editoricon_bitmap, editoricon_textmap)}; -#endif /* CTK_CONF_ICONS */ -/*-----------------------------------------------------------------------------------*/ -DSC(editor_dsc, - "A simple text editor", - "editor.prg", - editor_process, - &editor_icon); -/*-----------------------------------------------------------------------------------*/ diff --git a/backyard/apps/editor/editor-dsc.h b/backyard/apps/editor/editor-dsc.h deleted file mode 100644 index a044e0649..000000000 --- a/backyard/apps/editor/editor-dsc.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: editor-dsc.h,v 1.1 2007/05/23 23:34:33 oliverschmidt Exp $ - * - */ -#ifndef __EDITOR_DSC_H__ -#define __EDITOR_DSC_H__ - -#include "sys/dsc.h" - -DSC_HEADER(editor_dsc); - -#endif /* __EDITOR_DSC_H__ */ diff --git a/backyard/apps/editor/editor.c b/backyard/apps/editor/editor.c deleted file mode 100644 index eac43cd22..000000000 --- a/backyard/apps/editor/editor.c +++ /dev/null @@ -1,338 +0,0 @@ -/* - * Copyright (c) 2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - * $Id: editor.c,v 1.1 2007/05/23 23:34:33 oliverschmidt Exp $ - */ -#define EDITOR_CONF_WIDTH 32 -#define EDITOR_CONF_HEIGHT 16 -#define EDITOR_CONF_MAX_FILENAME_LEN 16 - -#include "contiki.h" -#include "contiki-lib.h" -#include "ctk/ctk.h" -#include "cfs/cfs.h" - -#include "lib/ctk-filedialog.h" - -#define ISO_nl 0x0a - -PROCESS(editor_process, "Editor"); - -static struct ctk_window window; - -#define LINE_LEN 60 -#define NUM_LINES EDITOR_CONF_HEIGHT - -struct line { - struct line *next, *prev; - char text[LINE_LEN]; -}; -MEMB(linesmem, struct line, NUM_LINES); - -static struct line *lines; - -static struct { - unsigned char x, y; - struct ctk_label labels[NUM_LINES]; - -} editor_state; - -static struct ctk_button openbutton = - {CTK_BUTTON(0, 0, 4, "Open")}; -static char statustext[EDITOR_CONF_WIDTH + 1]; -static struct ctk_label statuslabel = - {CTK_LABEL(0, EDITOR_CONF_HEIGHT + 2, EDITOR_CONF_WIDTH, 1, statustext)}; - -static struct ctk_menu menu; -static unsigned char menuitem_new, menuitem_open, menuitem_save; - -static char filename[EDITOR_CONF_MAX_FILENAME_LEN]; - - -static struct ctk_filedialog_state filedialog; - -enum { - OPEN_EVENT -}; - -/*---------------------------------------------------------------------------*/ -static void -show_statustext(char *text1, char *text2) -{ - int len; - - len = strlen(text1); - if(len < sizeof(statustext)) { - strncpy(statustext, text1, sizeof(statustext)); - strncpy(statustext + len, text2, sizeof(statustext) - len); - CTK_WIDGET_REDRAW(&statuslabel); - } - -} -/*---------------------------------------------------------------------------*/ -static void -editor_start(void) -{ - unsigned char i; - register struct ctk_label *label; - struct line *l, *m; - - m = NULL; - - for(i = 0; i < NUM_LINES; ++i) { - label = &editor_state.labels[i]; - l = (struct line *)memb_alloc(&linesmem); - - if(l != NULL) { - l->next = NULL; - l->prev = m; - if(m == NULL) { - /* First line */ - lines = l; - } else { - m->next = l; - } - CTK_LABEL_NEW(label, 0, i + 1, EDITOR_CONF_WIDTH, 1, l->text); - CTK_WIDGET_SET_FLAG(label, CTK_WIDGET_FLAG_MONOSPACE); - CTK_WIDGET_ADD(&window, label); - } - m = l; - } -} -/*---------------------------------------------------------------------------*/ -static void -editor_eventhandler(process_event_t ev, process_data_t data) -{ - char *textptr, *textptr2; - unsigned char len; - - if(ev == ctk_signal_keypress) { - /* CTK_WIDGET_FOCUS(t->label.window, &t->label);*/ - textptr = &(editor_state.labels[editor_state.y].text[editor_state.x]); - *textptr &= 0x7f; - CTK_WIDGET_REDRAW(&(editor_state.labels[editor_state.y])); - - switch((ctk_arch_key_t)data) { - case CH_CURS_DOWN: - ++editor_state.y; - if(editor_state.y >= EDITOR_CONF_HEIGHT) { - editor_state.y = EDITOR_CONF_HEIGHT - 1; - } - break; - case CH_CURS_UP: - if(editor_state.y > 0) { - --editor_state.y; - } - break; - case CH_CURS_RIGHT: - if(editor_state.x < strlen(editor_state.labels[editor_state.y].text)) { - ++editor_state.x; - } - break; - case CH_CURS_LEFT: - if(editor_state.x > 0) { - --editor_state.x; - } else { - if(editor_state.y > 0) { - --editor_state.y; - editor_state.x = strlen(editor_state.labels[editor_state.y].text); - } - } - break; - case CH_ENTER: - editor_state.x = 0; - ++editor_state.y; - if(editor_state.y >= EDITOR_CONF_HEIGHT) { - editor_state.y = EDITOR_CONF_HEIGHT - 1; - } - break; - case CH_DEL: - /* len = t->label.w - t->xpos; - if(t->xpos > 0 && len > 0) { - strncpy(textptr - 1, textptr, - len); - *(textptr + len - 1) = 0; - --t->xpos; - }*/ - break; - default: - len = EDITOR_CONF_WIDTH - editor_state.x; - if(len > 0) { - textptr2 = textptr + len - 1; - while(textptr2 + 1 > textptr) { - *(textptr2 + 1) = *textptr2; - --textptr2; - } - - *textptr = (char)data; - ++editor_state.x; - if(editor_state.x == EDITOR_CONF_WIDTH) { - editor_state.x = 0; - if(editor_state.y < EDITOR_CONF_HEIGHT - 1) { - ++editor_state.y; - } - } - } - break; - } - textptr = &(editor_state.labels[editor_state.y].text[editor_state.x]); - *textptr |= 0x80; - CTK_WIDGET_REDRAW(&(editor_state.labels[editor_state.y])); - /* } else if(s == ctk_signal_widget_activate && - data == (process_data_t)t) { - textptr = &(t->label.text[t->ypos * t->label.w + t->xpos]); - *textptr &= 0x7f; - t->xpos = 0; - if(t->ypos < t->label.h - 1) { - ++t->ypos; - } - textptr = &(t->label.text[t->ypos * t->label.w + t->xpos]); - *textptr |= 0x80; - CTK_WIDGET_REDRAW(&t->label);*/ - - - } -} -/*---------------------------------------------------------------------------*/ -static void -open_file(char *name) -{ - int fd; - struct line *l; - char line[LINE_LEN]; - char *cptr; - int i, len, clen; - - fd = cfs_open(name, 0); - if(fd < 0) { - show_statustext("Could not open file ", name); - return; - } - - l = lines; - cptr = l->text; - clen = LINE_LEN; - - do { - /* Read a portion of the input file */ - len = cfs_read(fd, line, LINE_LEN); - - /* Split the input into lines. */ - for(i = 0; i < len; ++i) { - if(line[i] == ISO_nl || - clen == 0) { - *cptr = 0; - l = l->next; - if(l != NULL) { - cptr = l->text; - clen = LINE_LEN; - } else { - len = -1; - break; - } - } else { - *cptr++ = line[i]; - --clen; - } - } - } while(len > 0); - - - cfs_close(fd); -} -/*---------------------------------------------------------------------------*/ -static void -quit(void) -{ - ctk_window_close(&window); - process_exit(&editor_process); - LOADER_UNLOAD(); -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(editor_process, ev, data) -{ - - PROCESS_BEGIN(); - - memb_init(&linesmem); - - ctk_window_new(&window, - EDITOR_CONF_WIDTH + 2, - EDITOR_CONF_HEIGHT + 3, - "Editor"); - - CTK_WIDGET_ADD(&window, &openbutton); - CTK_WIDGET_ADD(&window, &statuslabel); - - CTK_WIDGET_FOCUS(&window, &openbutton); - - editor_start(); - - ctk_window_open(&window); - - while(1) { - PROCESS_WAIT_EVENT(); - - if(ctk_filedialog_eventhandler(&filedialog, ev, data)) { - - } else { - if(ev == PROCESS_EVENT_EXIT) { - quit(); - } else if(ev == OPEN_EVENT) { - /* printf("Open file '%s'\n", (char *)data);*/ - open_file((char *)data); - ctk_window_redraw(&window); - } else { - - if(ev == ctk_signal_window_close && - data == (process_data_t)&window) { - quit(); - } else if(ev == ctk_signal_widget_activate) { - if(data == (process_data_t)&openbutton) { - ctk_filedialog_open(&filedialog, "Open", OPEN_EVENT); - } - } else { - editor_eventhandler(ev, data); - } - } - } - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ -/*LOADER_INIT_FUNC(editor_init, arg) -{ - arg_free(arg); - id = ek_start(&p); -}*/ -/*---------------------------------------------------------------------------*/ diff --git a/backyard/apps/webserver/httpd-socket.c b/backyard/apps/webserver/httpd-socket.c deleted file mode 100644 index 199fa9e3a..000000000 --- a/backyard/apps/webserver/httpd-socket.c +++ /dev/null @@ -1,193 +0,0 @@ -/* - * Copyright (c) 2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - * $Id: httpd-socket.c,v 1.2 2010/10/19 18:29:03 adamdunkels Exp $ - */ - -#include "contiki.h" -#include "cfs.h" -#include "socket.h" - -struct httpd_state { - struct socket sin, sout; - char inputbuf[100]; - char filename[40]; - char state; - int fd; - int ret; - char outputbuf[UIP_TCP_MSS]; -}; - -#define STATE_WAITING 0 -#define STATE_OUTPUT 1 - -#define SEND_STRING(s, str) SOCKET_SEND(s, str, strlen(str)) -MEMB(conns, struct httpd_state, 8); - - -/*---------------------------------------------------------------------------*/ -static unsigned short -generate(void *state) -{ - struct httpd_state *s = (struct httpd_state *)state; - - memcpy(uip_appdata, s->outputbuf, s->ret); - - return s->ret; -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(handle_output(struct httpd_state *s)) -{ - char *ptr; - - SOCKET_BEGIN(&s->sout); - - - s->fd = cfs_open(s->filename, CFS_READ); - if(s->fd < 0) { - SEND_STRING(&s->sout, "HTTP/1.0 404 Not found\r\n"); - SOCKET_CLOSE_EXIT(&s->sout); - } else { - SEND_STRING(&s->sout, "HTTP/1.0 200 Found\r\n"); - } - ptr = strrchr(s->filename, '.'); - if(strncmp(".html", ptr, 5) == 0) { - SEND_STRING(&s->sout, "Content-type: text/html\r\n"); - } else if(strncmp(".css", ptr, 4) == 0) { - SEND_STRING(&s->sout, "Content-type: text/css\r\n"); - } else if(strncmp(".png", ptr, 4) == 0) { - SEND_STRING(&s->sout, "Content-type: image/png\r\n"); - } else if(strncmp(".jpg", ptr, 4) == 0) { - SEND_STRING(&s->sout, "Content-type: image/jpeg\r\n"); - } else { - SEND_STRING(&s->sout, "Content-type: text/plain\r\n"); - } - SEND_STRING(&s->sout, "Server: Contiki/1.2-devel0\r\n\r\n"); - - do { - s->ret = cfs_read(s->fd, s->outputbuf, sizeof(s->outputbuf)); - if(s->ret > 0) { - SOCKET_GENERATE_SEND(&s->sout, generate, s); - /* SOCKET_SEND(&s->sout, s->outputbuf, s->ret);*/ - } - } while(s->ret > 0); - - - cfs_close(s->filename); - SOCKET_CLOSE(&s->sout); - - SOCKET_END(&s->sout); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(handle_input(struct httpd_state *s)) -{ - SOCKET_BEGIN(&s->sin); - - SOCKET_READTO(&s->sin, ' '); - - - if(strncmp(s->inputbuf, "GET ", 4) != 0) { - SOCKET_CLOSE_EXIT(&s->sin); - } - SOCKET_READTO(&s->sin, ' '); - - if(s->inputbuf[0] != '/') { - SOCKET_CLOSE_EXIT(&s->sin); - } - - if(s->inputbuf[1] == ' ') { - strncpy(s->filename, "index.html", sizeof(s->filename)); - } else { - s->inputbuf[SOCKET_DATALEN(&s->sin) - 1] = 0; - strncpy(s->filename, &s->inputbuf[1], sizeof(s->filename)); - } - - s->state = STATE_OUTPUT; - - while(1) { - SOCKET_READTO(&s->sin, '\n'); - - if(strncmp(s->inputbuf, "Referer:", 8) == 0) { - s->inputbuf[SOCKET_DATALEN(&s->sin) - 2] = 0; - webserver_log(&s->inputbuf[9]); - } - } - - SOCKET_END(&s->sin); -} -/*---------------------------------------------------------------------------*/ -static void -handle_connection(struct httpd_state *s) -{ - handle_input(s); - if(s->state == STATE_OUTPUT) { - handle_output(s); - } -} -/*---------------------------------------------------------------------------*/ -void -httpd_appcall(void *state) -{ - struct httpd_state *s = (struct httpd_state *)state; - - - if(uip_closed() || uip_aborted() || uip_timedout()) { - if(s != NULL) { - memb_free(&conns, s); - } - } else if(uip_connected()) { - s = (struct httpd_state *)memb_alloc(&conns); - if(s == NULL) { - uip_abort(); - return; - } - tcp_markconn(uip_conn, s); - SOCKET_INIT(&s->sin, s->inputbuf, sizeof(s->inputbuf) - 1); - SOCKET_INIT(&s->sout, s->inputbuf, sizeof(s->inputbuf) - 1); - s->state = STATE_WAITING; - handle_connection(s); - } else if(s != NULL) { - handle_connection(s); - } else { - uip_abort(); - } -} -/*---------------------------------------------------------------------------*/ -void -httpd_init(void) -{ - tcp_listen(UIP_HTONS(80)); - memb_init(&conns); -} -/*---------------------------------------------------------------------------*/ diff --git a/backyard/core/ctk/ctk-conio-service.c b/backyard/core/ctk/ctk-conio-service.c deleted file mode 100644 index 860d33585..000000000 --- a/backyard/core/ctk/ctk-conio-service.c +++ /dev/null @@ -1,569 +0,0 @@ -/* - * Copyright (c) 2002, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the "ctk" console GUI toolkit for cc65 - * - * $Id: ctk-conio-service.c,v 1.1 2007/05/23 23:19:10 oliverschmidt Exp $ - * - */ - -#include - -#include "ctk/ctk.h" -#include "ctk/ctk-draw.h" - -#include "ctk/ctk-draw-service.h" - -#include "contiki-conf.h" -#include - -#ifndef NULL -#define NULL (void *)0 -#endif /* NULL */ - -static unsigned char sizex, sizey; - -/*unsigned char ctk_draw_windowborder_height = 1; -unsigned char ctk_draw_windowborder_width = 1; -unsigned char ctk_draw_windowtitle_height = 1;*/ - - -/*-----------------------------------------------------------------------------------*/ -static void -cputsn(char *str, unsigned char len) -{ - char c; - - while(len > 0) { - --len; - c = *str; - if(c == 0) { - break; - } - cputc(c); - ++str; - } -} -/*-----------------------------------------------------------------------------------*/ -static void -s_ctk_draw_init(void) -{ - (void)bgcolor(SCREENCOLOR); - (void)bordercolor(BORDERCOLOR); - screensize(&sizex, &sizey); - ctk_draw_clear(0, sizey); -} -/*-----------------------------------------------------------------------------------*/ -static void -draw_widget(struct ctk_widget *w, - unsigned char x, unsigned char y, - unsigned char clipx, - unsigned char clipy, - unsigned char clipy1, unsigned char clipy2, - unsigned char focus) -{ - unsigned char xpos, ypos, xscroll; - unsigned char i, j; - char c, *text; - unsigned char len, wfocus; - - wfocus = 0; - if(focus & CTK_FOCUS_WINDOW) { - (void)textcolor(WIDGETCOLOR_FWIN); - if(focus & CTK_FOCUS_WIDGET) { - (void)textcolor(WIDGETCOLOR_FOCUS); - wfocus = 1; - } - } else if(focus & CTK_FOCUS_DIALOG) { - (void)textcolor(WIDGETCOLOR_DIALOG); - if(focus & CTK_FOCUS_WIDGET) { - (void)textcolor(WIDGETCOLOR_FOCUS); - wfocus = 1; - } - } else { - (void)textcolor(WIDGETCOLOR); - } - - xpos = x + w->x; - ypos = y + w->y; - - switch(w->type) { - case CTK_WIDGET_SEPARATOR: - if(ypos >= clipy1 && ypos < clipy2) { - chlinexy(xpos, ypos, w->w); - } - break; - case CTK_WIDGET_LABEL: - text = w->widget.label.text; - for(i = 0; i < w->h; ++i) { - if(ypos >= clipy1 && ypos < clipy2) { - gotoxy(xpos, ypos); - cputsn(text, w->w); - if(w->w - (wherex() - xpos) > 0) { - cclear(w->w - (wherex() - xpos)); - } - } - ++ypos; - text += w->w; - } - break; - case CTK_WIDGET_BUTTON: - if(ypos >= clipy1 && ypos < clipy2) { - revers(wfocus != 0); - cputcxy(xpos, ypos, '['); - cputsn(w->widget.button.text, w->w); - cputc(']'); - revers(0); - } - break; - case CTK_WIDGET_HYPERLINK: - if(ypos >= clipy1 && ypos < clipy2) { - revers(wfocus == 0); - gotoxy(xpos, ypos); - (void)textcolor(WIDGETCOLOR_HLINK); - cputsn(w->widget.button.text, w->w); - revers(0); - } - break; - case CTK_WIDGET_TEXTENTRY: - text = w->widget.textentry.text; - xscroll = 0; - if(w->widget.textentry.xpos >= w->w - 1) { - xscroll = w->widget.textentry.xpos - w->w + 1; - } - for(j = 0; j < w->h; ++j) { - if(ypos >= clipy1 && ypos < clipy2) { - if(w->widget.textentry.state == CTK_TEXTENTRY_EDIT && - w->widget.textentry.ypos == j) { - revers(0); - cputcxy(xpos, ypos, '>'); - c = 1; - for(i = 0; i < w->w; ++i) { - if(c != 0) { - c = text[i + xscroll]; - } - revers(i == w->widget.textentry.xpos - xscroll); - if(c == 0) { - cputc(' '); - } else { - cputc(c); - } - } - revers(0); - cputc('<'); - } else { - revers(wfocus != 0 && j == w->widget.textentry.ypos); - cvlinexy(xpos, ypos, 1); - gotoxy(xpos + 1, ypos); - cputsn(text, w->w); - i = wherex(); - if(i - xpos - 1 < w->w) { - cclear(w->w - (i - xpos) + 1); - } - cvline(1); - } - } - ++ypos; - text += w->widget.textentry.len + 1; - } - revers(0); - break; - case CTK_WIDGET_ICON: - if(ypos >= clipy1 && ypos < clipy2) { - revers(wfocus != 0); - gotoxy(xpos, ypos); - if(w->widget.icon.textmap != NULL) { - for(i = 0; i < 3; ++i) { - gotoxy(xpos, ypos); - if(ypos >= clipy1 && ypos < clipy2) { - cputc(w->widget.icon.textmap[0 + 3 * i]); - cputc(w->widget.icon.textmap[1 + 3 * i]); - cputc(w->widget.icon.textmap[2 + 3 * i]); - } - ++ypos; - } - } - x = xpos; - - len = (unsigned char)strlen(w->widget.icon.title); - if(x + len >= sizex) { - x = sizex - len; - } - - gotoxy(x, ypos); - if(ypos >= clipy1 && ypos < clipy2) { - cputs(w->widget.icon.title); - } - revers(0); - } - break; - - default: - break; - } -} -/*-----------------------------------------------------------------------------------*/ -static void -s_ctk_draw_widget(struct ctk_widget *w, - unsigned char focus, - unsigned char clipy1, - unsigned char clipy2) -{ - struct ctk_window *win = w->window; - unsigned char posx, posy; - - posx = win->x + 1; - posy = win->y + 2; - - if(w == win->focused) { - focus |= CTK_FOCUS_WIDGET; - } - - draw_widget(w, posx, posy, - posx + win->w, - posy + win->h, - clipy1, clipy2, - focus); - -#ifdef CTK_CONIO_CONF_UPDATE - CTK_CONIO_CONF_UPDATE(); -#endif /* CTK_CONIO_CONF_UPDATE */ -} -/*-----------------------------------------------------------------------------------*/ -static void -s_ctk_draw_clear_window(struct ctk_window *window, - unsigned char focus, - unsigned char clipy1, - unsigned char clipy2) -{ - unsigned char i; - unsigned char h; - - if(focus & CTK_FOCUS_WINDOW) { - (void)textcolor(WINDOWCOLOR_FOCUS); - } else { - (void)textcolor(WINDOWCOLOR); - } - - h = window->y + 2 + window->h; - - /* Clear window contents. */ - for(i = window->y + 2; i < h; ++i) { - if(i >= clipy1 && i < clipy2) { - cclearxy(window->x + 1, i, window->w); - } - } -} -/*-----------------------------------------------------------------------------------*/ -static void -draw_window_contents(struct ctk_window *window, unsigned char focus, - unsigned char clipy1, unsigned char clipy2, - unsigned char x1, unsigned char x2, - unsigned char y1, unsigned char y2) -{ - struct ctk_widget *w; - unsigned char wfocus; - - /* Draw inactive widgets. */ - for(w = window->inactive; w != NULL; w = w->next) { - draw_widget(w, x1, y1, x2, y2, - clipy1, clipy2, - focus); - } - - /* Draw active widgets. */ - for(w = window->active; w != NULL; w = w->next) { - wfocus = focus; - if(w == window->focused) { - wfocus |= CTK_FOCUS_WIDGET; - } - - draw_widget(w, x1, y1, x2, y2, - clipy1, clipy2, - wfocus); - } - -#ifdef CTK_CONIO_CONF_UPDATE - CTK_CONIO_CONF_UPDATE(); -#endif /* CTK_CONIO_CONF_UPDATE */ -} -/*-----------------------------------------------------------------------------------*/ -static void -s_ctk_draw_window(struct ctk_window *window, unsigned char focus, - unsigned char clipy1, unsigned char clipy2, - unsigned char draw_borders) -{ - unsigned char x, y; - unsigned char h; - unsigned char x1, y1, x2, y2; - - if(window->y + 1 >= clipy2) { - return; - } - - x = window->x; - y = window->y + 1; - x1 = x + 1; - y1 = y + 1; - x2 = x1 + window->w; - y2 = y1 + window->h; - - if(draw_borders) { - - /* Draw window frame. */ - if(focus & CTK_FOCUS_WINDOW) { - (void)textcolor(WINDOWCOLOR_FOCUS); - } else { - (void)textcolor(WINDOWCOLOR); - } - - if(y >= clipy1) { - cputcxy(x, y, CH_ULCORNER); - gotoxy(wherex() + window->titlelen + CTK_CONF_WINDOWMOVE * 2, wherey()); - chline(window->w - (wherex() - x) - 2); - cputcxy(x2, y, CH_URCORNER); - } - - h = window->h; - - if(clipy1 > y1) { - if(clipy1 - y1 < h) { - h = clipy1 - y1; - y1 = clipy1; - } else { - h = 0; - } - } - - if(clipy2 < y1 + h) { - if(y1 >= clipy2) { - h = 0; - } else { - h = clipy2 - y1; - } - } - - cvlinexy(x, y1, h); - cvlinexy(x2, y1, h); - - if(y + window->h >= clipy1 && - y + window->h < clipy2) { - cputcxy(x, y2, CH_LLCORNER); - chlinexy(x1, y2, window->w); - cputcxy(x2, y2, CH_LRCORNER); - } - } - - draw_window_contents(window, focus, clipy1, clipy2, - x1, x2, y + 1, y2); -} -/*-----------------------------------------------------------------------------------*/ -static void -s_ctk_draw_dialog(struct ctk_window *dialog) -{ - unsigned char x, y; - unsigned char i; - unsigned char x1, y1, x2, y2; - - (void)textcolor(DIALOGCOLOR); - - x = dialog->x; - y = dialog->y + 1; - - x1 = x + 1; - y1 = y + 1; - x2 = x1 + dialog->w; - y2 = y1 + dialog->h; - - /* Draw dialog frame. */ - cvlinexy(x, y1, - dialog->h); - cvlinexy(x2, y1, - dialog->h); - - chlinexy(x1, y, - dialog->w); - chlinexy(x1, y2, - dialog->w); - - cputcxy(x, y, CH_ULCORNER); - cputcxy(x, y2, CH_LLCORNER); - cputcxy(x2, y, CH_URCORNER); - cputcxy(x2, y2, CH_LRCORNER); - - /* Clear dialog contents. */ - for(i = y1; i < y2; ++i) { - cclearxy(x1, i, dialog->w); - } - - draw_window_contents(dialog, CTK_FOCUS_DIALOG, 0, sizey, - x1, x2, y1, y2); -} -/*-----------------------------------------------------------------------------------*/ -static void -s_ctk_draw_clear(unsigned char y1, unsigned char y2) -{ - unsigned char i; - - (void)textcolor(BACKGROUNDCOLOR); - for(i = y1; i < y2; ++i) { - cclearxy(0, i, sizex); - } -} -/*-----------------------------------------------------------------------------------*/ -static void -draw_menu(struct ctk_menu *m, unsigned char open) -{ - unsigned char x, x2, y; - - if(open) { - x = x2 = wherex(); - if(x2 + CTK_CONF_MENUWIDTH > sizex) { - x2 = sizex - CTK_CONF_MENUWIDTH; - } - - for(y = 0; y < m->nitems; ++y) { - if(y == m->active) { - (void)textcolor(ACTIVEMENUITEMCOLOR); - revers(0); - } else { - (void)textcolor(MENUCOLOR); - revers(1); - } - gotoxy(x2, y + 1); - if(m->items[y].title[0] == '-') { - chline(CTK_CONF_MENUWIDTH); - } else { - cputs(m->items[y].title); - } - if(x2 + CTK_CONF_MENUWIDTH > wherex()) { - cclear(x2 + CTK_CONF_MENUWIDTH - wherex()); - } - } - - gotoxy(x, 0); - (void)textcolor(OPENMENUCOLOR); - revers(0); - } - - cputs(m->title); - cputc(' '); - (void)textcolor(MENUCOLOR); - revers(1); -} -/*-----------------------------------------------------------------------------------*/ -static void -s_ctk_draw_menus(struct ctk_menus *menus) -{ - struct ctk_menu *m; - - /* Draw menus */ - (void)textcolor(MENUCOLOR); - gotoxy(0, 0); - revers(1); - cputc(' '); - for(m = menus->menus->next; m != NULL; m = m->next) { - draw_menu(m, m == menus->open); - } - - /* Draw desktopmenu */ - if(wherex() + strlen(menus->desktopmenu->title) + 1 >= sizex) { - gotoxy(sizex - (unsigned char)strlen(menus->desktopmenu->title) - 1, 0); - } else { - cclear(sizex - wherex() - - (unsigned char)strlen(menus->desktopmenu->title) - 1); - } - draw_menu(menus->desktopmenu, menus->desktopmenu == menus->open); - - revers(0); -} -/*-----------------------------------------------------------------------------------*/ -static unsigned char -s_ctk_draw_height(void) -{ - return sizey; -} -/*-----------------------------------------------------------------------------------*/ -static unsigned char -s_ctk_draw_width(void) -{ - return sizex; -} -/*-----------------------------------------------------------------------------------*/ -static unsigned short -s_ctk_mouse_xtoc(unsigned short x) -{ - return x / 8; -} -/*-----------------------------------------------------------------------------------*/ -static unsigned short -s_ctk_mouse_ytoc(unsigned short y) -{ - return y / 8; -} -/*-----------------------------------------------------------------------------------*/ - -SERVICE(ctk_conio_service, ctk_draw_service, -{ 1, - 1, - 1, - s_ctk_draw_init, - s_ctk_draw_clear, - s_ctk_draw_clear_window, - s_ctk_draw_window, - s_ctk_draw_dialog, - s_ctk_draw_widget, - s_ctk_draw_menus, - s_ctk_draw_width, - s_ctk_draw_height, - s_ctk_mouse_xtoc, - s_ctk_mouse_ytoc }); - -/*--------------------------------------------------------------------------*/ - -PROCESS(ctk_conio_service_process, "CTK CONIO service"); - -PROCESS_THREAD(ctk_conio_service_process, ev, data) { - PROCESS_BEGIN(); - - s_ctk_draw_init(); - ctk_restore(); - - SERVICE_REGISTER(ctk_conio_service); - - while(ev != PROCESS_EVENT_SERVICE_REMOVED && - ev != PROCESS_EVENT_EXIT) { - PROCESS_WAIT_EVENT(); - } - - SERVICE_REMOVE(ctk_conio_service); - - PROCESS_END(); -} -/*--------------------------------------------------------------------------*/ diff --git a/backyard/core/ctk/ctk-conio-service.h b/backyard/core/ctk/ctk-conio-service.h deleted file mode 100644 index ed29db18b..000000000 --- a/backyard/core/ctk/ctk-conio-service.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Oliver Schmidt - * - * $Id: ctk-conio-service.h,v 1.1 2007/05/23 23:19:13 oliverschmidt Exp $ - */ -#ifndef __CTK_CONIO_SERVICE_H__ -#define __CTK_CONIO_SERVICE_H__ - -#include "contiki.h" - -PROCESS_NAME(ctk_conio_service_process); - -#endif /* __CTK_CONIO_SERVICE_H__ */ diff --git a/backyard/core/ctk/ctk-draw-service.h b/backyard/core/ctk/ctk-draw-service.h deleted file mode 100644 index b323c9a9b..000000000 --- a/backyard/core/ctk/ctk-draw-service.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - * $Id: ctk-draw-service.h,v 1.1 2007/05/23 23:19:13 oliverschmidt Exp $ - */ -#ifndef __CTK_DRAW_SERVICE_H__ -#define __CTK_DRAW_SERVICE_H__ - - -#include "ctk/ctk.h" -#include "sys/service.h" - -#define ctk_draw_service_name "CTK driver" -SERVICE_INTERFACE(ctk_draw_service, { - unsigned char windowborder_width; - unsigned char windowborder_height; - unsigned char windowtitle_height; - - void (* draw_init)(void); - void (* draw_clear)(unsigned char clipy1, unsigned char clipy2); - void (* draw_clear_window)(struct ctk_window *window, - unsigned char focus, - unsigned char clipy1, - unsigned char clipy2); - void (* draw_window)(struct ctk_window *window, - unsigned char focus, - unsigned char clipy1, - unsigned char clipy2, - unsigned char draw_borders); - void (* draw_dialog)(struct ctk_window *dialog); - void (* draw_widget)(struct ctk_widget *widget, - unsigned char focus, - unsigned char clipy1, - unsigned char clipy2); - void (* draw_menus)(struct ctk_menus *menus); - - unsigned char (* width)(void); - unsigned char (* height)(void); - - unsigned short (* mouse_xtoc)(unsigned short); - unsigned short (* mouse_ytoc)(unsigned short); -}); - -#endif /* __CTK_DRAW_SERVICE_H__ */ diff --git a/backyard/core/ctk/ctk-draw.c b/backyard/core/ctk/ctk-draw.c deleted file mode 100644 index a5e811178..000000000 --- a/backyard/core/ctk/ctk-draw.c +++ /dev/null @@ -1,173 +0,0 @@ -/* - * Copyright (c) 2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - * $Id: ctk-draw.c,v 1.1 2007/05/23 23:19:13 oliverschmidt Exp $ - */ - - -#include "ctk/ctk-draw.h" -#include "ctk/ctk.h" - -#include "ctk/ctk-draw-service.h" - - -unsigned char ctk_draw_windowborder_width = 1, - ctk_draw_windowborder_height = 1, - ctk_draw_windowtitle_height = 1; - -/*---------------------------------------------------------------------------*/ -void -ctk_draw_init(void) -{ - const struct ctk_draw_service *i; - struct service *s; - - s = SERVICE_FIND(ctk_draw_service); - - if(s != NULL) { - i = s->interface; - - i->draw_init(); - ctk_draw_windowborder_width = i->windowborder_width; - ctk_draw_windowborder_height = i->windowborder_height; - ctk_draw_windowtitle_height = i->windowtitle_height; - } -} -/*---------------------------------------------------------------------------*/ -void -ctk_draw_clear(unsigned char clipy1, unsigned char clipy2) -{ - SERVICE_CALL(ctk_draw_service, draw_clear(clipy1, clipy2)); -} -/*---------------------------------------------------------------------------*/ -void -ctk_draw_clear_window(struct ctk_window *window, - unsigned char focus, - unsigned char clipy1, - unsigned char clipy2) -{ - SERVICE_CALL(ctk_draw_service, draw_clear_window(window, focus, - clipy1, clipy2)); -} -/*---------------------------------------------------------------------------*/ -void -ctk_draw_window(struct ctk_window *window, - unsigned char focus, - unsigned char clipy1, - unsigned char clipy2, - unsigned char draw_borders) -{ - SERVICE_CALL(ctk_draw_service, draw_window(window, focus, - clipy1, clipy2, draw_borders)); -} -/*---------------------------------------------------------------------------*/ -void -ctk_draw_dialog(struct ctk_window *dialog) -{ - SERVICE_CALL(ctk_draw_service, draw_dialog(dialog)); -} -/*---------------------------------------------------------------------------*/ -void -ctk_draw_widget(struct ctk_widget *widget, - unsigned char focus, - unsigned char clipy1, - unsigned char clipy2) -{ - SERVICE_CALL(ctk_draw_service, draw_widget(widget, focus, - clipy1, clipy2)); -} -/*---------------------------------------------------------------------------*/ -void -ctk_draw_menus(struct ctk_menus *menus) -{ - SERVICE_CALL(ctk_draw_service, draw_menus(menus)); -} -/*---------------------------------------------------------------------------*/ -unsigned char -ctk_draw_width(void) -{ - struct service *s; - - s = SERVICE_FIND(ctk_draw_service); - if(s != NULL) { - return ((struct ctk_draw_service *)s->interface)->width(); - } - - return 40; -} -/*---------------------------------------------------------------------------*/ -unsigned char -ctk_draw_height(void) -{ - struct service *s; - - s = SERVICE_FIND(ctk_draw_service); - if(s != NULL) { - return ((struct ctk_draw_service *)s->interface)->height(); - } - - return 24; -} -/*---------------------------------------------------------------------------*/ -unsigned short -ctk_mouse_xtoc(unsigned short x) -{ - struct service *s; - - s = SERVICE_FIND(ctk_draw_service); - if(s != NULL) { - return ((struct ctk_draw_service *)s->interface)->mouse_xtoc(x); - } - - return 0; -} -/*---------------------------------------------------------------------------*/ -unsigned short -ctk_mouse_ytoc(unsigned short y) -{ - struct service *s; - - s = SERVICE_FIND(ctk_draw_service); - if(s != NULL) { - return ((struct ctk_draw_service *)s->interface)->mouse_ytoc(y); - } - - return 0; -} -/*---------------------------------------------------------------------------*/ -void -ctk_draw_quit(void) -{ - /* process_post(service.id, EK_EVENT_REQUEST_EXIT, NULL);*/ - /* process_service_reset(&service); */ -} -/*---------------------------------------------------------------------------*/ diff --git a/backyard/core/ctk/ctk-graphic-draw.h b/backyard/core/ctk/ctk-graphic-draw.h deleted file mode 100644 index 30b18634c..000000000 --- a/backyard/core/ctk/ctk-graphic-draw.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - * $Id: ctk-graphic-draw.h,v 1.1 2007/05/23 23:19:13 oliverschmidt Exp $ - */ -#ifndef __CTK_GRAPHIC_DRAW_H__ -#define __CTK_GRAPHIC_DRAW_H__ - -enum { - CTK_GRAPHIC_DRAW_FONT_NORMAL, - CTK_GRAPHIC_DRAW_FONT_BOLD, - CTK_GRAPHIC_DRAW_FONT_MENU, - CTK_GRAPHIC_DRAW_FONT_MONOSPACE, - CTK_GRAPHIC_DRAW_FONT_MONOSPACE_BOLD, -}; - -enum { - CTK_GRAPHIC_DRAW_COLOR_WHITE, - CTK_GRAPHIC_DRAW_COLOR_LIGHTGRAY, - CTK_GRAPHIC_DRAW_COLOR_MIDGRAY, - CTK_GRAPHIC_DRAW_COLOR_DARKGRAY, - CTK_GRAPHIC_DRAW_COLOR_BLACK, - CTK_GRAPHIC_DRAW_COLOR_BLUE, -} - -/*struct ctk_graphic_draw_font; - -extern struct ctk_graphic_draw_font ctk_graphic_draw_font_normal, - ctk_graphic_draw_font_bold, - ctk_graphic_draw_font_menu, - ctk_graphic_draw_font_monospace, - ctk_graphic_draw_font_monospace_bold; - -struct ctk_graphic_draw_color; - -extern struct ctk_graphic_draw_color ctk_graphic_draw_color_white, - ctk_graphic_draw_color_lightgray, - ctk_graphic_draw_color_midgray, - ctk_graphic_draw_color_darkgray, - ctk_graphic_draw_color_ddarkgray, - ctk_graphic_draw_color_black, - ctk_graphic_draw_color_blue; -*/ - -void ctk_graphic_draw_init(void); - -int ctk_graphic_draw_string_width(unsigned char font, - char *str, unsigned char monospace); - -void ctk_graphic_draw_string(unsigned char font, - unsigned char color, - unsigned int x, - unsigned int y, - char *str, - unsigned char monospace); - -void ctk_graphic_draw_line(unsigned char color, - unsigned int x1, unsigned int y1, - unsigned int x2, unsigned int y2); - -void ctk_graphic_draw_rect(unsigned char color, - unsigned char filled, - unsigned int x1, unsigned int y1, - unsigned int width, unsigned int height); - - -#endif /* __CTK_GRAPHIC_DRAW_H__ */ diff --git a/backyard/core/ctk/ctk-graphic.c b/backyard/core/ctk/ctk-graphic.c deleted file mode 100644 index b075150d2..000000000 --- a/backyard/core/ctk/ctk-graphic.c +++ /dev/null @@ -1,809 +0,0 @@ -/* - * Copyright (c) 2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * $Id: ctk-graphic.c,v 1.1 2007/05/23 23:19:13 oliverschmidt Exp $ - * - */ - -#include "ctk-draw-service.h" - -#include "ctk-graphic-draw.h" - -#include "ctk-graphic.h" - -#include - - -#define WINDOWBORDER_WIDTH 1 -#define WINDOWBORDER_HEIGHT 1 -#define WINDOWTITLE_HEIGHT 3 -#define MENU_HEIGHT 1 -#define MENUBAR_HEIGHT 12 - -#define FONT_BASELINE 12 - -#define MENUBAR_FONT_BASELINE 7 - -#define RASTER_X 8 -#define RASTER_Y 14 - -#define BUTTON_HEIGHT 12 -#define BUTTON_X_BORDER 4 -#define BUTTON_Y_BORDER 1 - -#define TEXTENTRY_HEIGHT 12 -#define TEXTENTRY_X_BORDER 4 -#define TEXTENTRY_Y_BORDER 1 - -static GdkGC *white, *lightgray, *midgray, *darkgray, *ddarkgray, *black, - *blue; - -static GdkPixbuf *background, *windowborder, *menubar; - -static void -draw_widget(struct ctk_widget *w, - unsigned char winx, - unsigned char winy, - unsigned char clipx, - unsigned char clipy, - unsigned char clipy1, - unsigned char clipy2, - unsigned char focus); - - -/*--------------------------------------------------------------------------*/ -static void -s_ctk_draw_init(void) -{ - GtkWidget *image; - - image = gtk_image_new_from_file("background.png"); - background = gtk_image_get_pixbuf(GTK_IMAGE(image)); - - image = gtk_image_new_from_file("windowborder.png"); - windowborder = gtk_image_get_pixbuf(GTK_IMAGE(image)); - - image = gtk_image_new_from_file("menubar.png"); - menubar = gtk_image_get_pixbuf(GTK_IMAGE(image)); - - ctk_graphic_draw_init(); -} -/*--------------------------------------------------------------------------*/ -static void -s_ctk_draw_clear(unsigned char y1, unsigned char y2) -{ - if(background == NULL) { - gdk_draw_rectangle(ctk_gtksim_pixmap, - darkgray, - TRUE, - 0, - y1 * RASTER_Y + MENUBAR_HEIGHT, - CTK_GTKSIM_SCREEN_WIDTH, - (y2 - y1) * RASTER_Y); - } else { - gdk_draw_pixbuf(ctk_gtksim_pixmap, - darkgray, - background, - 0, - y1 * RASTER_Y, - 0, - y1 * RASTER_Y + MENUBAR_HEIGHT, - CTK_GTKSIM_SCREEN_WIDTH, - (y2 - y1) * RASTER_Y, - NULL, 0, 0); - } -} -/*--------------------------------------------------------------------------*/ -static void -s_ctk_draw_clear_window(struct ctk_window *window, - unsigned char focus, - unsigned char clipy1, - unsigned char clipy2) -{ - int x, y; - - x = window->x; - y = window->y + MENU_HEIGHT; - - /* Clear window */ - if(focus == CTK_FOCUS_WINDOW) { - gdk_draw_rectangle(ctk_gtksim_pixmap, - white, - TRUE, - x * RASTER_X - 1, - y * RASTER_Y - 1 + MENUBAR_HEIGHT, - (window->w + 2 * WINDOWBORDER_WIDTH) * RASTER_X + 2, - (window->h + WINDOWTITLE_HEIGHT + - WINDOWBORDER_HEIGHT) * RASTER_Y + 2); - } else { - gdk_draw_rectangle(ctk_gtksim_pixmap, - lightgray, - TRUE, - x * RASTER_X - 1, - y * RASTER_Y - 1 + MENUBAR_HEIGHT, - (window->w + 2 * WINDOWBORDER_WIDTH) * RASTER_X + 2, - (window->h + WINDOWTITLE_HEIGHT + - WINDOWBORDER_HEIGHT) * RASTER_Y + 2); - } -} -/*--------------------------------------------------------------------------*/ -static void -s_ctk_draw_window(struct ctk_window *window, - unsigned char focus, - unsigned char clipy1, - unsigned char clipy2) -{ - struct ctk_widget *w; - unsigned char wfocus; - int x, y, x1, y1, x2, y2; - - x = window->x; - y = window->y + MENU_HEIGHT; - - x1 = x + WINDOWBORDER_WIDTH; - y1 = y + WINDOWTITLE_HEIGHT; - x2 = x1 + window->w; - y2 = y1 + window->h; - - /* Draw window border */ - gdk_draw_rectangle(ctk_gtksim_pixmap, - darkgray, - FALSE, - x * RASTER_X, - y * RASTER_Y + MENUBAR_HEIGHT, - (window->w + 2 * WINDOWBORDER_WIDTH) * RASTER_X, - (window->h + WINDOWTITLE_HEIGHT + - WINDOWBORDER_HEIGHT) * RASTER_Y); - - if(ctk_mode_get() == CTK_MODE_WINDOWMOVE) { - if(focus == CTK_FOCUS_WINDOW) { - gdk_draw_rectangle(ctk_gtksim_pixmap, - white, - TRUE, - x * RASTER_X + 1, - y * RASTER_Y + MENUBAR_HEIGHT + 1, - (window->w + 2 * WINDOWBORDER_WIDTH) * RASTER_X - 2, - (window->h + WINDOWTITLE_HEIGHT + - WINDOWBORDER_HEIGHT) * RASTER_Y - 2); - } else { - gdk_draw_rectangle(ctk_gtksim_pixmap, - midgray, - TRUE, - x * RASTER_X + 1, - y * RASTER_Y + MENUBAR_HEIGHT + 1, - (window->w + 2 * WINDOWBORDER_WIDTH) * RASTER_X - 2, - (window->h + WINDOWTITLE_HEIGHT + - WINDOWBORDER_HEIGHT) * RASTER_Y - 2); - } - return; - } - - if(windowborder == NULL) { - gdk_draw_rectangle(ctk_gtksim_pixmap, - midgray, - TRUE, - x * RASTER_X, - y * RASTER_Y + MENUBAR_HEIGHT, - (window->w + 2 * WINDOWBORDER_WIDTH) * RASTER_X, - WINDOWTITLE_HEIGHT * RASTER_Y); - } else { - gdk_draw_pixbuf(ctk_gtksim_pixmap, - midgray, - windowborder, - 0, 0, - x * RASTER_X, - y * RASTER_Y + MENUBAR_HEIGHT, - (window->w + 2 * WINDOWBORDER_WIDTH) * RASTER_X, - WINDOWTITLE_HEIGHT * RASTER_Y, - NULL, 0, 0); - } - - - gdk_draw_line(ctk_gtksim_pixmap, - darkgray, - x * RASTER_X, - (y + WINDOWTITLE_HEIGHT) * RASTER_Y - 1 + MENUBAR_HEIGHT, - (x + window->w + 2 * WINDOWBORDER_WIDTH) * RASTER_X, - (y + WINDOWTITLE_HEIGHT) * RASTER_Y - 1 + MENUBAR_HEIGHT); - - - /* Draw inactive widgets. */ - for(w = window->inactive; w != NULL; w = w->next) { - draw_widget(w, x1, y1, x2, y2, - clipy1, clipy2, - focus); - } - - /* Draw active widgets. */ - for(w = window->active; w != NULL; w = w->next) { - wfocus = focus; - if(w == window->focused) { - wfocus |= CTK_FOCUS_WIDGET; - } - - draw_widget(w, x1, y1, x2, y2, - clipy1, clipy2, - wfocus); - } - - ctk_gtksim_set_redrawflag(); -} -/*--------------------------------------------------------------------------*/ -static void -s_ctk_draw_dialog(struct ctk_window *window) -{ - struct ctk_widget *w; - unsigned char wfocus, focus; - int x, y, x1, y1, x2, y2; - - focus = CTK_FOCUS_DIALOG; - - x = window->x; - y = window->y + MENU_HEIGHT; - - x1 = x + WINDOWBORDER_WIDTH; - y1 = y + WINDOWTITLE_HEIGHT; - x2 = x1 + window->w; - y2 = y1 + window->h; - - /* Draw window border */ - gdk_draw_rectangle(ctk_gtksim_pixmap, - black, - FALSE, - x * RASTER_X, - y * RASTER_Y + MENUBAR_HEIGHT, - (window->w + 2 * WINDOWBORDER_WIDTH) * RASTER_X, - (window->h + WINDOWTITLE_HEIGHT + - WINDOWBORDER_HEIGHT) * RASTER_Y); - - - - gdk_draw_rectangle(ctk_gtksim_pixmap, - white, - TRUE, - x * RASTER_X + 1, - y * RASTER_Y + 1 + MENUBAR_HEIGHT, - (window->w + 2 * WINDOWBORDER_WIDTH) * RASTER_X - 2, - (window->h + WINDOWTITLE_HEIGHT + - WINDOWBORDER_HEIGHT) * RASTER_Y - 2); - - /* Draw inactive widgets. */ - for(w = window->inactive; w != NULL; w = w->next) { - draw_widget(w, x1, y1, x2, y2, - y1, y2, - focus); - } - - /* Draw active widgets. */ - for(w = window->active; w != NULL; w = w->next) { - wfocus = focus; - if(w == window->focused) { - wfocus |= CTK_FOCUS_WIDGET; - } - - draw_widget(w, x1, y1, x2, y2, - y1, y2, - wfocus); - } - - ctk_gtksim_set_redrawflag(); - -} -/*--------------------------------------------------------------------------*/ -static void -draw_widget(struct ctk_widget *w, - unsigned char winx, unsigned char winy, - unsigned char clipx, - unsigned char clipy, - unsigned char clipy1, - unsigned char clipy2, - unsigned char focus) -{ - char text[1000]; - unsigned char x, y; - int width, xpos; - int i; - GdkGC *bgcol, *buttoncol; - struct ctk_gtksim_draw_font *buttonfont, *textfont, *textfont_bold; - int monospace; - - x = winx + w->x; - y = winy + w->y; - - if(focus & CTK_FOCUS_WINDOW) { - bgcol = white; - } else { - bgcol = lightgray; - } - - if(focus & CTK_FOCUS_WINDOW) { - buttoncol = lightgray; - } else { - buttoncol = midgray; - } - - monospace = w->flags & CTK_WIDGET_FLAG_MONOSPACE; - if(monospace) { - textfont = &ctk_gtksim_draw_font_monospace; - textfont_bold = &ctk_gtksim_draw_font_monospace_bold; - } else { - textfont = &ctk_gtksim_draw_font_normal; - textfont_bold = &ctk_gtksim_draw_font_bold; - } - - switch(w->type) { - case CTK_WIDGET_SEPARATOR: - gdk_draw_line(ctk_gtksim_pixmap, - darkgray, - x * RASTER_X, - y * RASTER_Y + RASTER_Y / 2 + MENUBAR_HEIGHT, - (x + w->w) * RASTER_X, - y * RASTER_Y + RASTER_Y / 2 + MENUBAR_HEIGHT); - break; - case CTK_WIDGET_LABEL: - gdk_draw_rectangle(ctk_gtksim_pixmap, - bgcol, - TRUE, - x * RASTER_X, - y * RASTER_Y + MENUBAR_HEIGHT, - w->w * RASTER_X, - w->h * RASTER_Y); - for(i = 0; i < w->h; ++i) { - strncpy(text, &w->widget.label.text[i * w->w], w->w); - text[w->w] = 0; - ctk_gtksim_draw_string(textfont, - &ctk_gtksim_draw_color_black, - RASTER_X * x, - RASTER_Y * (y + i) + MENUBAR_HEIGHT, - text, monospace); - } - - break; - case CTK_WIDGET_BUTTON: - if(w == (struct ctk_widget *)&w->window->titlebutton) { - buttonfont = &ctk_gtksim_draw_font_bold; - } else { - buttonfont = textfont; - } - - ++x; - - width = ctk_gtksim_draw_string_width(buttonfont, - w->widget.button.text, - monospace); - if(focus == (CTK_FOCUS_WIDGET|CTK_FOCUS_WINDOW)) { - gdk_draw_rectangle(ctk_gtksim_pixmap, - black, - FALSE, - x * RASTER_X - BUTTON_X_BORDER, - y * RASTER_Y - BUTTON_Y_BORDER + MENUBAR_HEIGHT, - w->w * RASTER_X + BUTTON_X_BORDER * 2, - BUTTON_HEIGHT + BUTTON_Y_BORDER); - /* gdk_draw_rectangle(ctk_gtksim_pixmap, - ctk_gtksim_drawing_area->style->black_gc, - FALSE, - x * RASTER_X - BUTTON_X_BORDER - 1, - y * RASTER_Y - BUTTON_Y_BORDER - 1, - w->w * RASTER_X + BUTTON_X_BORDER * 2 + 1, - RASTER_Y + BUTTON_Y_BORDER * 2 + 1);*/ - } else { - gdk_draw_rectangle(ctk_gtksim_pixmap, - darkgray, - FALSE, - x * RASTER_X - BUTTON_X_BORDER, - y * RASTER_Y - BUTTON_Y_BORDER + MENUBAR_HEIGHT, - w->w * RASTER_X + BUTTON_X_BORDER * 2, - BUTTON_HEIGHT + BUTTON_Y_BORDER); - } - gdk_draw_rectangle(ctk_gtksim_pixmap, - buttoncol, - TRUE, - x * RASTER_X - BUTTON_X_BORDER + 1, - y * RASTER_Y + MENUBAR_HEIGHT, - w->w * RASTER_X + BUTTON_X_BORDER * 2 - 2, - BUTTON_HEIGHT); - - gdk_draw_line(ctk_gtksim_pixmap, - ddarkgray, - x * RASTER_X - BUTTON_X_BORDER + 1, - y * RASTER_Y + BUTTON_HEIGHT - 1 + MENUBAR_HEIGHT, - x * RASTER_X + w->w * RASTER_X + BUTTON_X_BORDER - 1, - y * RASTER_Y + BUTTON_HEIGHT - 1 + MENUBAR_HEIGHT); - gdk_draw_line(ctk_gtksim_pixmap, - ddarkgray, - x * RASTER_X + w->w * RASTER_X + BUTTON_X_BORDER - 1, - y * RASTER_Y + BUTTON_HEIGHT - 1 + MENUBAR_HEIGHT, - x * RASTER_X + w->w * RASTER_X + BUTTON_X_BORDER - 1, - y * RASTER_Y + MENUBAR_HEIGHT); - - ctk_gtksim_draw_string(buttonfont, - &ctk_gtksim_draw_color_black, - RASTER_X * x + - (w->w * RASTER_X) / 2 - width / 2, - RASTER_Y * y + MENUBAR_HEIGHT, - w->widget.button.text, - monospace); - break; - case CTK_WIDGET_HYPERLINK: - strncpy(text, w->widget.hyperlink.text, w->w); - text[w->w] = 0; - width = ctk_gtksim_draw_string_width(textfont, text, monospace); - gdk_draw_rectangle(ctk_gtksim_pixmap, - bgcol, - TRUE, - x * RASTER_X, - y * RASTER_Y + MENUBAR_HEIGHT, - width, - RASTER_Y); - if(focus & CTK_FOCUS_WIDGET) { - ctk_gtksim_draw_string(textfont_bold, - &ctk_gtksim_draw_color_blue, - RASTER_X * x, - RASTER_Y * y + MENUBAR_HEIGHT, - text, monospace); - } else { - ctk_gtksim_draw_string(textfont, - &ctk_gtksim_draw_color_blue, - RASTER_X * x, - RASTER_Y * y + MENUBAR_HEIGHT, - text, monospace); - } - gdk_draw_line(ctk_gtksim_pixmap, - blue, - x * RASTER_X, - y * RASTER_Y + FONT_BASELINE + 1 + MENUBAR_HEIGHT, - x * RASTER_X + width, - y * RASTER_Y + FONT_BASELINE + 1 + MENUBAR_HEIGHT); - - break; - case CTK_WIDGET_TEXTENTRY: - strncpy(text, w->widget.textentry.text, sizeof(text)); - text[w->widget.textentry.xpos] = 0; - width = ctk_gtksim_draw_string_width(textfont, text, monospace); - gdk_draw_rectangle(ctk_gtksim_pixmap, - darkgray, - FALSE, - x * RASTER_X - TEXTENTRY_X_BORDER + RASTER_X, - y * RASTER_Y - TEXTENTRY_Y_BORDER + MENUBAR_HEIGHT, - w->w * RASTER_X + TEXTENTRY_X_BORDER * 2 - 1, - TEXTENTRY_HEIGHT + TEXTENTRY_Y_BORDER); - gdk_draw_rectangle(ctk_gtksim_pixmap, - bgcol, - TRUE, - x * RASTER_X + RASTER_X, - y * RASTER_Y + MENUBAR_HEIGHT, - w->w * RASTER_X, - TEXTENTRY_HEIGHT); - ctk_gtksim_draw_string(textfont, - &ctk_gtksim_draw_color_black, - RASTER_X * x + RASTER_X, - RASTER_Y * y + MENUBAR_HEIGHT, - w->widget.textentry.text, - monospace); - if(focus == (CTK_FOCUS_WIDGET|CTK_FOCUS_WINDOW)) { - gdk_draw_line(ctk_gtksim_pixmap, - black, - x * RASTER_X + width + RASTER_X, - y * RASTER_Y + MENUBAR_HEIGHT, - x * RASTER_X + width + RASTER_X, - y * RASTER_Y + TEXTENTRY_HEIGHT - 1 + MENUBAR_HEIGHT); - } - break; - case CTK_WIDGET_ICON: - width = ctk_gtksim_draw_string_width(&ctk_gtksim_draw_font_normal, - w->widget.icon.title, monospace); - - if(x * RASTER_X + width >= CTK_GTKSIM_SCREEN_WIDTH - RASTER_X) { - xpos = CTK_GTKSIM_SCREEN_WIDTH - width - RASTER_X; - } else { - xpos = x * RASTER_X; - } - if((focus & CTK_FOCUS_WIDGET) == 0) { - gdk_draw_rectangle(ctk_gtksim_pixmap, - bgcol, - TRUE, - x * RASTER_X, - y * RASTER_Y + MENUBAR_HEIGHT, - 24, 24); - } else { - gdk_draw_rectangle(ctk_gtksim_pixmap, - black, - TRUE, - x * RASTER_X, - y * RASTER_Y + MENUBAR_HEIGHT, - 24, 24); - } - - /* gdk_draw_rectangle(ctk_gtksim_pixmap, - white, - TRUE, - xpos, - RASTER_Y * y + 24 + 1 + MENUBAR_HEIGHT, - width, - RASTER_Y);*/ - - ctk_gtksim_draw_string(textfont, - &ctk_gtksim_draw_color_black, - xpos + 1, - RASTER_Y * y + 24 + 1 + MENUBAR_HEIGHT, - w->widget.icon.title, - monospace); - ctk_gtksim_draw_string(textfont, - &ctk_gtksim_draw_color_white, - xpos, - RASTER_Y * y + 24 + MENUBAR_HEIGHT, - w->widget.icon.title, - monospace); - - - break; - default: - break; - } -} - -/*--------------------------------------------------------------------------*/ -static void -s_ctk_draw_widget(struct ctk_widget *w, - unsigned char focus, - unsigned char clipy1, - unsigned char clipy2) -{ - struct ctk_window *win = w->window; - unsigned char posx, posy; - - posx = win->x + WINDOWBORDER_WIDTH; - posy = win->y + WINDOWTITLE_HEIGHT + MENU_HEIGHT; - - if(w == win->focused) { - focus |= CTK_FOCUS_WIDGET; - } - - draw_widget(w, posx, posy, - posx + win->w, - posy + win->h, - clipy1, clipy2, - focus); - - ctk_gtksim_set_redrawflag(); -} -/*--------------------------------------------------------------------------*/ -static void -draw_menu(struct ctk_menu *m, int x, int open) -{ - int i; - int xpos; - - if(x >= CTK_GTKSIM_SCREEN_WIDTH / RASTER_X - 16) { - xpos = CTK_GTKSIM_SCREEN_WIDTH / RASTER_X - 16; - } else { - xpos = x; - } - - if(open) { - - gdk_draw_rectangle(ctk_gtksim_pixmap, - black, - TRUE, - RASTER_X * x, 0, - m->titlelen * RASTER_X, - RASTER_Y + MENUBAR_HEIGHT); - - ctk_gtksim_draw_string(&ctk_gtksim_draw_font_menu, - &ctk_gtksim_draw_color_white, - RASTER_X * x + 2, - MENUBAR_FONT_BASELINE, - m->title, 0); - - gdk_draw_rectangle(ctk_gtksim_pixmap, - white, - TRUE, - xpos * RASTER_X, - RASTER_Y * MENU_HEIGHT + MENUBAR_HEIGHT, - (xpos + 16) * RASTER_X, - (m->nitems) * RASTER_Y); - - for(i = 0; i < m->nitems; ++i) { - if(i == m->active) { - gdk_draw_rectangle(ctk_gtksim_pixmap, - black, - TRUE, - RASTER_X * xpos, - (MENU_HEIGHT + i) * RASTER_Y + MENUBAR_HEIGHT, - (xpos + 16) * RASTER_X, - RASTER_Y); - ctk_gtksim_draw_string(&ctk_gtksim_draw_font_normal, - &ctk_gtksim_draw_color_white, - RASTER_X * xpos + 2, - (MENU_HEIGHT + i) * RASTER_Y + - MENUBAR_HEIGHT, - m->items[i].title, 0); - - } else { - ctk_gtksim_draw_string(&ctk_gtksim_draw_font_normal, - &ctk_gtksim_draw_color_black, - RASTER_X * xpos + 2, - (MENU_HEIGHT + i) * RASTER_Y + MENUBAR_HEIGHT, - m->items[i].title, 0); - } - - } - } else { - /* gdk_draw_rectangle(ctk_gtksim_pixmap, - white, - TRUE, - RASTER_X * x, 0, - m->titlelen * RASTER_X, RASTER_Y);*/ - - ctk_gtksim_draw_string(&ctk_gtksim_draw_font_menu, - &ctk_gtksim_draw_color_black, - RASTER_X * x, MENUBAR_FONT_BASELINE, - m->title, 0); - - } -} -/*--------------------------------------------------------------------------*/ -static void -s_ctk_draw_menus(struct ctk_menus *menus) -{ - struct ctk_menu *m; - int x; - - if(menubar != NULL) { - gdk_draw_pixbuf(ctk_gtksim_pixmap, - darkgray, - menubar, - 0, 0, - 0, 0, - CTK_GTKSIM_SCREEN_WIDTH, - RASTER_Y + MENUBAR_HEIGHT, - NULL, 0, 0); - } - - x = 1; - for(m = menus->menus->next; m != NULL; m = m->next) { - draw_menu(m, x, m == menus->open); - x += strlen(m->title); - } - - x = CTK_GTKSIM_SCREEN_WIDTH / RASTER_X - strlen(menus->menus->title); - draw_menu(menus->menus, x, menus->menus == menus->open); - - - - /* gdk_draw_line(ctk_gtksim_pixmap, - ctk_gtksim_drawing_area->style->black_gc, - 0, RASTER_Y, - CTK_GTKSIM_SCREEN_WIDTH, - RASTER_Y);*/ - - ctk_gtksim_set_redrawflag(); -} -/*--------------------------------------------------------------------------*/ -static unsigned char -s_ctk_draw_width(void) -{ - return CTK_GTKSIM_SCREEN_WIDTH / RASTER_X; -} -/*--------------------------------------------------------------------------*/ -static unsigned char -s_ctk_draw_height(void) -{ - return CTK_GTKSIM_SCREEN_HEIGHT / RASTER_Y; -} -/*--------------------------------------------------------------------------*/ -static unsigned short -s_ctk_mouse_xtoc(unsigned short x) -{ - return x / RASTER_X; -} -/*--------------------------------------------------------------------------*/ -static unsigned short -s_ctk_mouse_ytoc(unsigned short y) -{ - if(y < MENUBAR_HEIGHT) { - return 0; - } else { - return (y - MENUBAR_HEIGHT) / RASTER_Y; - } -} -/*--------------------------------------------------------------------------*/ -static const struct ctk_draw_service_interface interface = - {CTK_DRAW_SERVICE_VERSION, - WINDOWBORDER_WIDTH, - WINDOWBORDER_HEIGHT, - WINDOWTITLE_HEIGHT, - s_ctk_draw_init, - s_ctk_draw_clear, - s_ctk_draw_clear_window, - s_ctk_draw_window, - s_ctk_draw_dialog, - s_ctk_draw_widget, - s_ctk_draw_menus, - s_ctk_draw_width, - s_ctk_draw_height, - s_ctk_mouse_xtoc, - s_ctk_mouse_ytoc, - }; - -EK_EVENTHANDLER(eventhandler, ev, data); -EK_PROCESS(proc, CTK_DRAW_SERVICE_NAME, EK_PRIO_NORMAL, - eventhandler, NULL, (void *)&interface); - -/*--------------------------------------------------------------------------*/ -EK_PROCESS_INIT(ctk_gtksim_service_init, arg) -{ - ek_service_start(CTK_DRAW_SERVICE_NAME, &proc); -} -/*--------------------------------------------------------------------------*/ -static GdkGC * -get_color(unsigned short r, unsigned short g, unsigned short b) -{ - GdkGCValues values; - GdkColor color; - - color.pixel = 0; - color.red = r; - color.green = g; - color.blue = b; - - if(gdk_colormap_alloc_color(gdk_colormap_get_system(), - &color, FALSE, TRUE)) { - } - - values.foreground = color; - - return gdk_gc_new_with_values(ctk_gtksim_drawing_area->window, - &values, - GDK_GC_FOREGROUND); -} -/*--------------------------------------------------------------------------*/ -EK_EVENTHANDLER(eventhandler, ev, data) -{ - EK_EVENTHANDLER_ARGS(ev, data); - - switch(ev) { - case EK_EVENT_INIT: - blue = get_color(0, 0, 0xffff); - white = get_color(0xffff, 0xffff, 0xffff); - lightgray = get_color(0xefff, 0xefff, 0xefff); - midgray = get_color(0xdfff, 0xdfff, 0xdfff); - darkgray = get_color(0xcfff, 0xcfff, 0xcfff); - ddarkgray = get_color(0xafff, 0xafff, 0xafff); - black = get_color(0, 0, 0); - break; - case EK_EVENT_REQUEST_REPLACE: - ek_replace((struct ek_proc *)data, NULL); - LOADER_UNLOAD(); - break; - } -} -/*--------------------------------------------------------------------------*/ diff --git a/backyard/core/ctk/ctk-mouse.c b/backyard/core/ctk/ctk-mouse.c deleted file mode 100644 index 806458bf0..000000000 --- a/backyard/core/ctk/ctk-mouse.c +++ /dev/null @@ -1,323 +0,0 @@ -/* - * Copyright (c) 2002-2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * $Id: ctk-mouse.c,v 1.1 2007/05/26 21:38:53 oliverschmidt Exp $ - * - */ - -#include "process.h" -#include "cc.h" - -#include "ctk/ctk.h" -#include "ctk-draw.h" -#include "contiki-conf.h" -#include "ctk-mouse.h" - -unsigned short mouse_x, mouse_y, mouse_button; - -/*-----------------------------------------------------------------------------------*/ -EK_POLLHANDLER(ctk_poll) -{ - static ctk_arch_key_t c; - static unsigned char i; - register struct ctk_window *window; - register struct ctk_widget *widget; - register struct ctk_widget **widgetptr; - - static unsigned char mxc, myc, mouse_button_changed, mouse_moved, - mouse_clicked; - static unsigned char menux; - register struct ctk_menu *menu; - - mouse_button_changed = mouse_moved = mouse_clicked = 0; - - /* See if there is any change in the buttons. */ - if(ctk_mouse_button() != mouse_button) { - mouse_button = ctk_mouse_button(); - mouse_button_changed = 1; - if(mouse_button == 0) { - mouse_clicked = 1; - } - } - - /* Check if the mouse pointer has moved. */ - if(ctk_mouse_x() != mouse_x || - ctk_mouse_y() != mouse_y) { - mouse_x = ctk_mouse_x(); - mouse_y = ctk_mouse_y(); - mouse_moved = 1; - } - - mxc = ctk_mouse_xtoc(mouse_x); - myc = ctk_mouse_ytoc(mouse_y); - - if(mode == CTK_MODE_SCREENSAVER) { - if(mouse_moved || mouse_button_changed) { - ek_post(EK_BROADCAST, ctk_signal_screensaver_stop, NULL); - mode = CTK_MODE_NORMAL; - } - } else { - - /* If there is any change in the mouse conditions, find out in - which window the mouse pointer currently is in order to send - the correct signals, or bring a window to focus. */ - if(mouse_moved || mouse_button_changed) { - ctk_mouse_show(); - screensaver_timer = 0; - - if(myc == 0) { - /* Here we should do whatever needs to be done when the mouse - moves around and clicks in the menubar. */ - if(mouse_clicked) { - static unsigned char titlelen; - - /* Find out which menu that the mouse pointer is in. Start - with the ->next menu after the desktop menu. We assume - that the menus start one character from the left screen - side and that the desktop menu is farthest to the - right. */ - menux = 1; - for(menu = menus.menus->next; - menu != NULL; menu = menu->next) { - titlelen = menu->titlelen; - if(mxc >= menux && mxc <= menux + titlelen) { - break; - } - menux += titlelen; - } - - /* Also check desktop menu. */ - if(mxc >= width - 7 && - mxc <= width - 1) { - menu = &desktopmenu; - } - - menus.open = menu; - redraw |= REDRAW_MENUPART; - } - } else { - --myc; - - if(menus.open != NULL) { - static unsigned char nitems; - - /* Do whatever needs to be done when a menu is open. */ - - /* First check if the mouse pointer is in the currently open - menu. */ - if(menus.open == &desktopmenu) { - menux = width - CTK_CONF_MENUWIDTH; - } else { - menux = 1; - for(menu = menus.menus->next; menu != menus.open; - menu = menu->next) { - menux += menu->titlelen; - } - } - - nitems = menus.open->nitems; - /* Find out which of the menu items the mouse is pointing - to. */ - if(mxc >= menux && mxc <= menux + CTK_CONF_MENUWIDTH) { - if(myc <= nitems) { - menus.open->active = myc; - } else { - menus.open->active = nitems - 1; - } - } - - if(mouse_clicked) { - if(mxc >= menux && mxc <= menux + CTK_CONF_MENUWIDTH && - myc <= nitems) { - redraw |= activate_menu(); - } else { - lastmenu = menus.open; - menus.open = NULL; - redraw |= REDRAW_MENUPART; - } - } else { - redraw |= REDRAW_MENUS; - } - } else { - - /* Walk through the windows from top to bottom to see in - which window the mouse pointer is. */ - if(dialog != NULL) { - window = dialog; - } else { - for(window = windows; window != NULL; - window = window->next) { - - /* Check if the mouse is within the window. */ - if(mxc >= window->x && - mxc <= window->x + window->w + - 2 * ctk_draw_windowborder_width && - myc >= window->y && - myc <= window->y + window->h + - ctk_draw_windowtitle_height + - ctk_draw_windowborder_height) { - break; - } - } - } - - - /* If we didn't find any window, and there are no windows - open, the mouse pointer will definately be within the - background desktop window. */ - if(window == NULL) { - window = &desktop_window; - } - - /* If the mouse pointer moves around outside of the - currently focused window (or dialog), we should not have - any focused widgets in the focused window so we make sure - that there are none. */ - if(windows != NULL && - window != windows && - windows->focused != NULL){ - unfocus_widget(windows->focused); - } - - if(window != NULL) { - /* If the mouse was clicked outside of the current window, - we bring the clicked window to front. */ - if(dialog == NULL && - window != &desktop_window && - window != windows && - mouse_clicked) { - /* Bring window to front. */ - ctk_window_open(window); - redraw |= REDRAW_ALL; - } else { - - /* Find out which widget currently is under the mouse - pointer and give it focus, unless it already has - focus. */ - mxc = mxc - window->x - ctk_draw_windowborder_width; - myc = myc - window->y - ctk_draw_windowtitle_height; - - /* See if the mouse pointer is on a widget. If so, it - should be selected and, if the button is clicked, - activated. */ - for(widget = window->active; widget != NULL; - widget = widget->next) { - - if(mxc >= widget->x && - mxc <= widget->x + widget->w && - (myc == widget->y || - ((widget->type == CTK_WIDGET_BITMAP || - widget->type == CTK_WIDGET_ICON) && - (myc >= widget->y && - myc <= widget->y + - ((struct ctk_bitmap *)widget)->h)))) { - break; - } - } - - - /* if the mouse is moved in the focused window, we emit - a ctk_signal_pointer_move signal to the owner of the - window. */ - if(mouse_moved && - (window != &desktop_window || - windows == NULL)) { - - ek_post(window->owner, ctk_signal_pointer_move, NULL); - - /* If there was a focused widget that is not below the - mouse pointer, we remove focus from the widget and - redraw it. */ - if(window->focused != NULL && - widget != window->focused) { - unfocus_widget(window->focused); - } - redraw |= REDRAW_WIDGETS; - if(widget != NULL) { - select_widget(widget); - } - } - - if(mouse_button_changed) { - ek_post(window->owner, ctk_signal_pointer_button, - (ek_data_t)mouse_button); - if(mouse_clicked && widget != NULL) { - select_widget(widget); - redraw |= activate(widget); - } - } - } - } - } - } - } - - if(ctk_arch_keyavail()) { - ctk_mouse_hide(); - } - -#if CTK_CONF_WINDOWMOVE - } else if(mode == CTK_MODE_WINDOWMOVE) { - - /* If the mouse has moved, we move the window as well. */ - if(mouse_moved) { - - if(window->w + mxc + 2 >= width) { - window->x = width - 2 - window->w; - } else { - window->x = mxc; - } - - if(window->h + myc + ctk_draw_windowtitle_height + - ctk_draw_windowborder_height >= height) { - window->y = height - window->h - - ctk_draw_windowtitle_height - ctk_draw_windowborder_height; - } else { - window->y = myc; - } - if(window->y > 0) { - --window->y; - } - - redraw = REDRAW_ALL; - } - - /* Check if the mouse has been clicked, and stop moving the window - if so. */ - if(mouse_button_changed && - mouse_button == 0) { - mode = CTK_MODE_NORMAL; - redraw = REDRAW_ALL; - } -#endif /* CTK_CONF_WINDOWMOVE */ - } -} -/*-----------------------------------------------------------------------------------*/ diff --git a/backyard/core/ctk/ctk-term-ascii.h b/backyard/core/ctk/ctk-term-ascii.h deleted file mode 100644 index 50f4c932a..000000000 --- a/backyard/core/ctk/ctk-term-ascii.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * @(#)$Id: ctk-term-ascii.h,v 1.1 2007/05/26 21:54:33 oliverschmidt Exp $ - */ -/* ascii_control.h - * - * ASCII CONTROL CHARACTERS - * from American National Standard Code for Information Interchange X3.4-1977 - * - * Abbreviations - * - * CC: communication control - * FE: format effector - * IS: information separator - * Delim: delimiter - * Intro: introducer - */ - -/* ----------------------------------------------------------------------- */ -/* C0 (7-bit) set */ -/* ----------------------------------------------------------------------- */ -/* mnemonic octal decimal C meaning */ -/* ----------------------------------------------------------------------- */ - -#define ASCII_NUL (000) /* 0 '\0' Null */ -#define ASCII_SOH (001) /* 1 Start of Heading (CC) */ -#define ASCII_STX (002) /* 2 Start of Text (CC) */ -#define ASCII_ETX (003) /* 3 End of Text (CC) */ -#define ASCII_EOT (004) /* 4 End of Transmission (CC) */ -#define ASCII_ENQ (005) /* 5 Enquiry (CC) */ -#define ASCII_ACK (006) /* 6 Acknowledge (CC) */ -#define ASCII_BEL (007) /* 7 '\a' Bell / Alert */ -#define ASCII_BS (010) /* 8 '\b' Backspace (FE) */ -#define ASCII_HT (011) /* 9 '\t' Horizontal Tabulation (FE) */ -#define ASCII_LF (012) /* 10 '\n' Line Feed / Newline (FE) */ -#define ASCII_VT (013) /* 11 '\v' Vertical Tabulation (FE) */ -#define ASCII_FF (014) /* 12 '\f' Form Feed (FE) */ -#define ASCII_CR (015) /* 13 '\r' Carriage Return (FE) */ -#define ASCII_SO (016) /* 14 Shift Out */ -#define ASCII_SI (017) /* 15 Shift In */ -#define ASCII_DLE (020) /* 16 Data Link Escape (CC) */ -#define ASCII_DC1 (021) /* 17 Device Control 1 XON */ -#define ASCII_DC2 (022) /* 18 Device Control 2 */ -#define ASCII_DC3 (023) /* 19 Device Control 3 XOFF */ -#define ASCII_DC4 (024) /* 20 Device Control 4 */ -#define ASCII_NAK (025) /* 21 Negative Acknowledge (CC) */ -#define ASCII_SYN (026) /* 22 Synchronous Idle (CC) */ -#define ASCII_ETB (027) /* 23 End of Transmission Block (CC) */ -#define ASCII_CAN (030) /* 24 Cancel */ -#define ASCII_EM (031) /* 25 End of Medium */ -#define ASCII_SUB (032) /* 26 Substitute */ -#define ASCII_ESC (033) /* 27 Escape */ -#define ASCII_FS (034) /* 28 File Separator */ -#define ASCII_GS (035) /* 29 Group Separator */ -#define ASCII_RS (036) /* 30 Record Separator */ -#define ASCII_US (037) /* 31 Unit Separator */ - -#define ASCII_DEL (0177) /* 127 Delete */ - -#define ASCII_NL ASCII_LF /* 10 alias for Newline */ - -/* ----------------------------------------------------------------------- */ -/* C1 (8-bit) set (which have equivalent 7-bit multi-char sequences) */ -/* ----------------------------------------------------------------------- */ -/* mnemonic octal decimal 7-bit meaning */ -/* ----------------------------------------------------------------------- */ - -#define ASCII_IND (0204) /* 132 Esc D Index (FE) */ -#define ASCII_NEL (0205) /* 133 Esc E Next Line (FE) */ -#define ASCII_SSA (0206) /* 134 Esc F Start Selected Area */ -#define ASCII_ESA (0207) /* 135 Esc G End Selected Area */ -#define ASCII_HTS (0210) /* 136 Esc H Horizontal Tab Set (FE) */ -#define ASCII_HTJ (0211) /* 137 Esc I Horizontal Tab w/Justificat(FE)*/ -#define ASCII_VTS (0212) /* 138 Esc J Vertical Tab Set (FE) */ -#define ASCII_PLD (0213) /* 138 Esc K Partial Line Down (FE) */ -#define ASCII_PLU (0214) /* 140 Esc L Partial Line Up (FE) */ -#define ASCII_RI (0215) /* 141 Esc M Reverse Index (FE) */ -#define ASCII_SS2 (0216) /* 142 Esc N Single Shift G2 (Intro) */ -#define ASCII_SS3 (0217) /* 143 Esc O Single Shift G3 (Intro) */ -#define ASCII_DCS (0220) /* 144 Esc P Device Control String (Delim) */ -#define ASCII_PU1 (0221) /* 145 Esc Q Private Use 1 */ -#define ASCII_PU2 (0222) /* 146 Esc R Private Use 2 */ -#define ASCII_STS (0223) /* 147 Esc S Set Transmit State */ -#define ASCII_CCH (0224) /* 148 Esc T Cancel Previous Character */ -#define ASCII_MW (0225) /* 149 Esc U Message Waiting */ -#define ASCII_SPA (0226) /* 150 Esc V Start Protected Area */ -#define ASCII_EPA (0227) /* 151 Esc W End Protected Area */ - -#define ASCII_CSI (0233) /* 155 Esc [ Control Sequence Introducer */ -#define ASCII_ST (0234) /* 156 Esc \ String Terminator (Delim) */ -#define ASCII_OSC (0235) /* 157 Esc ] Operating System Control (Delim*/ -#define ASCII_PM (0236) /* 158 Esc ^ Privacy Message (Delim) */ -#define ASCII_APC (0237) /* 159 Esc _ Application Program Command (De*/ - -/* ------------------------------------------------------------------------- */ diff --git a/backyard/core/ctk/ctk-term-in.c b/backyard/core/ctk/ctk-term-in.c deleted file mode 100644 index c4f6c8aee..000000000 --- a/backyard/core/ctk/ctk-term-in.c +++ /dev/null @@ -1,381 +0,0 @@ -/* - * Copyright (c) 2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - * $Id: ctk-term-in.c,v 1.1 2007/05/26 21:54:33 oliverschmidt Exp $ - */ -#include -#include "ctk/ctk.h" -#include "ctk-term.h" -#include "ctk-term-int.h" -#include "ctk-term-ascii.h" - -#define PRINTF(x) - -/*-----------------------------------------------------------------------------------*/ -/* - * #defines and enums - */ -/*-----------------------------------------------------------------------------------*/ - -/* Size of input key buffer */ -#define NUMKEYS 20 - -/* ANSI character classes */ -enum {ACC_C0, ACC_INTERM, ACC_PARAM, ACC_LOWCASE, ACC_UPCASE,ACC_C1, ACC_G1, ACC_DEL, ACC_SPEC }; - -/*-----------------------------------------------------------------------------------*/ -/* - * Structures - */ -/*-----------------------------------------------------------------------------------*/ - -/* Structure for mapping a character sequence to a key */ -struct seqmap -{ - const char* seq; - const ctk_arch_key_t key; -}; - -/*-----------------------------------------------------------------------------------*/ -/* - * Local variables - */ -/*-----------------------------------------------------------------------------------*/ - -static ctk_arch_key_t keys[NUMKEYS]; -static int firstkey, lastkey; - -/* Sequences starting with ESC [ .... */ -const static struct seqmap ctrlmap[] = -{ - {"A",CH_CURS_UP}, - {"B",CH_CURS_DOWN}, - {"C",CH_CURS_RIGHT}, - {"D",CH_CURS_LEFT}, - - {"11~",CH_F1}, - {"12~",CH_F2}, - {"13~",CH_F3}, - {"14~",CH_F4}, - // linux console - {"[A",CH_F1}, - {"[B",CH_F2}, - {"[C",CH_F3}, - {"[D",CH_F4}, - {0,0} -}; - -/* Sequences starting with ESC O .... */ -const static struct seqmap ss3map[] = -{ - {"A",CH_CURS_UP}, - {"B",CH_CURS_DOWN}, - {"C",CH_CURS_RIGHT}, - {"D",CH_CURS_LEFT}, - {"P",CH_F1}, - {"Q",CH_F2}, - {"R",CH_F3}, - {"S",CH_F4}, - {0,0} -}; - - -/*-----------------------------------------------------------------------------------*/ -/* - * Add a key to the input buffer - */ -/*-----------------------------------------------------------------------------------*/ -static void -enqueue_key(ctk_arch_key_t k) -{ - keys[lastkey] = k; - ++lastkey; - if(lastkey >= NUMKEYS) { - lastkey = 0; - } -} - -/*-----------------------------------------------------------------------------------*/ -/* - * Classify a character - */ -/*-----------------------------------------------------------------------------------*/ -static unsigned char -classify(unsigned char c) -{ - if (0x00 <= c && c <=0x1f) return ACC_C0; - if (0x20 <= c && c <=0x2f) return ACC_INTERM; - if (0x30 <= c && c <=0x3f) return ACC_PARAM; - if (0x40 <= c && c <=0x5f) return ACC_UPCASE; - if (0x60 <= c && c <=0x7e) return ACC_LOWCASE; - if (c == 0x7f) return ACC_DEL; - if (0x90 <= c && c <=0x9f) return ACC_C1; - if (c == 0xa0) return ACC_SPEC; - if (0xA1 <= c && c <=0xfe) return ACC_G1; - if (0x90 <= c && c <=0x9f) return ACC_C1; - if (c == 0xff) return ACC_SPEC; - return ACC_SPEC; -} - -/*-----------------------------------------------------------------------------------*/ -/* - * Lookup a key sequence in a sequencemap and queue the key if sequence found - */ -/*-----------------------------------------------------------------------------------*/ -static void -lookup_seq(const char* str, const struct seqmap* map) -{ - while (map->seq != 0) { - if (strcmp(str,map->seq) == 0) { - enqueue_key(map->key); - return; - } - map++; - } -} - -/*-----------------------------------------------------------------------------------*/ -/* \internal - * Parse a character stream - * Returns -1 if c is consumed by the state machine 1 else. - */ -/*-----------------------------------------------------------------------------------*/ -static int -parse_input(struct ctk_term_state* st, unsigned char c) -{ - unsigned char cl = classify(c); - int ret = -1; - switch(st->inputstate) { - case ANS_IDLE: - switch(cl) { - case ACC_C0: - { - switch(c) { - case ASCII_ESC: st->inputstate = ANS_ESCSEQ; break; - case ASCII_BS: enqueue_key(CH_DEL); break; - case ASCII_HT: enqueue_key(CH_TAB); break; - case ASCII_FF: ctk_term_redraw(st); break; - case ASCII_CR: enqueue_key(CH_ENTER); break; - } - } - break; - - case ACC_INTERM: - case ACC_PARAM: - case ACC_LOWCASE: - case ACC_UPCASE: - case ACC_G1: - ret = 1; - break; - case ACC_C1: - if (c == ASCII_CSI) { - st->inputstate = ANS_CTRLSEQ; - st->ctrlCnt = 0; - } - else if (c == ASCII_SS3) { - st->inputstate = ANS_SS3; - st->ctrlCnt = 0; - } - break; - case ACC_DEL: - enqueue_key(CH_DEL); - break; - case ACC_SPEC: - break; - } - break; - - case ANS_ESCSEQ: - { - switch(cl) { - case ACC_C0: - case ACC_DEL: - break; - case ACC_INTERM: - st->inputstate = ANS_ESCSEQ_1; - break; - case ACC_UPCASE: - /* C1 control character */ - if (c == '[') { - st->inputstate = ANS_CTRLSEQ; - st->ctrlCnt = 0; - } - else if (c == 'O') { - st->inputstate = ANS_SS3; - st->ctrlCnt = 0; - } - else { - st->inputstate = ANS_IDLE; - } - break; - case ACC_PARAM: - /* Private 2-character sequence */ - case ACC_LOWCASE: - /* Standard 2-character sequence */ - default: - st->inputstate = ANS_IDLE; - break; - } - } - break; - - case ANS_ESCSEQ_1: - { - switch(cl) { - case ACC_C0: - case ACC_INTERM: - break; - case ACC_PARAM: - /* Private function*/ - case ACC_LOWCASE: - case ACC_UPCASE: - /* Standard function */ - default: - st->inputstate = ANS_IDLE; - break; - } - } - break; - case ANS_SS3: - { - switch(cl) { - case ACC_PARAM: - if (st->ctrlCnt < CTK_TERM_CTRLBUFLEN) st->ctrlbuf[st->ctrlCnt++]=c; - break; - case ACC_UPCASE: - /* VT100 PF seq */ - if (st->ctrlCnt < CTK_TERM_CTRLBUFLEN) st->ctrlbuf[st->ctrlCnt++]=c; - st->inputstate = ANS_IDLE; - st->ctrlbuf[st->ctrlCnt] = 0; - lookup_seq((const char*)(st->ctrlbuf), ss3map); - break; - default: - st->inputstate = ANS_IDLE; - break; - } - } - break; - case ANS_CTRLSEQ: - { - switch(cl) { - case ACC_C0: - break; - case ACC_INTERM: - case ACC_PARAM: - if (st->ctrlCnt < CTK_TERM_CTRLBUFLEN) st->ctrlbuf[st->ctrlCnt++]=c; - break; - case ACC_LOWCASE: - case ACC_UPCASE: - /* Standard control sequence */ - if (st->ctrlCnt < CTK_TERM_CTRLBUFLEN) st->ctrlbuf[st->ctrlCnt++]=c; - /* Cygwin console sends ESC [ [ A for function keys */ - if (c != '[') { - st->ctrlbuf[st->ctrlCnt] = 0; - lookup_seq((const char*)(st->ctrlbuf), ctrlmap); - st->inputstate = ANS_IDLE; - } - break; - default: - st->inputstate = ANS_IDLE; - break; - } - } - break; - } - return ret; -} - -/*-----------------------------------------------------------------------------------*/ -/* - * Initialize the input buffer - */ -/*-----------------------------------------------------------------------------------*/ -void ctk_term_input_init() -{ - firstkey = lastkey = 0; -} - -/*-----------------------------------------------------------------------------------*/ -/** - * Handles an input character provided by the client - * - * \param ts State information - * \param b Input character - */ -/*-----------------------------------------------------------------------------------*/ -void ctk_term_input(struct ctk_term_state* ts, unsigned char b) -{ - int ret = parse_input(ts, b); - PRINTF(("terminput: 0x%02x\n", b)); - if (ret > 0) { - enqueue_key((ctk_arch_key_t)b); - } -} - -/*-----------------------------------------------------------------------------------*/ -/** - * Checks the key press input queue to see if there are pending - * keys. Called by the CTK module. - * - * \return Zero if no key presses are in buffer, non-zero if there are - * key presses in input buffer. - */ -/*-----------------------------------------------------------------------------------*/ -unsigned char -ctk_arch_keyavail(void) -{ - return firstkey != lastkey; -} -/*-----------------------------------------------------------------------------------*/ -/** - * Retrieves key presses from the VNC client. Called by the CTK - * module. - * - * \return The next key in the input queue. - */ -/*-----------------------------------------------------------------------------------*/ -ctk_arch_key_t -ctk_arch_getkey(void) -{ - ctk_arch_key_t key; - key = keys[firstkey]; - - if(firstkey != lastkey) { - ++firstkey; - if(firstkey >= NUMKEYS) { - firstkey = 0; - } - } - - return key; -} - diff --git a/backyard/core/ctk/ctk-term-int.h b/backyard/core/ctk/ctk-term-int.h deleted file mode 100644 index 7a6cbba0e..000000000 --- a/backyard/core/ctk/ctk-term-int.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * @(#)$Id: ctk-term-int.h,v 1.1 2007/05/26 21:54:33 oliverschmidt Exp $ - */ -#ifndef __CTK_TERM_INT_H__ -#define __CTK_TERM_INT_H__ - -/* Color definitions */ - -#define TERM_BACKGROUNDCOLOR 0 -#define TERM_WINDOWCOLOR 1 -#define TERM_SEPARATORCOLOR 7 /*(TERM_WINDOWCOLOR + 6)*/ -#define TERM_LABELCOLOR 13 /*(TERM_SEPARATORCOLOR + 6)*/ -#define TERM_BUTTONCOLOR 19 /*(TERM_LABELCOLOR + 6)*/ -#define TERM_HYPERLINKCOLOR 25 /*(TERM_BUTTONCOLOR + 6)*/ -#define TERM_TEXTENTRYCOLOR 31 /*(TERM_HYPERLINKCOLOR + 6)*/ -#define TERM_ICONCOLOR 37 /*(TERM_TEXTENTRYCOLOR + 6)*/ -#define TERM_MENUCOLOR 43 /*(TERM_ICONCOLOR + 6)*/ -#define TERM_OPENMENUCOLOR 44/*(TERM_MENUCOLOR + 1)*/ -#define TERM_ACTIVEMENUCOLOR 45 /*(TERM_OPENMENUCOLOR + 1) */ - -/* Structure describing an updated region */ -struct ctk_term_update { - struct ctk_term_update *next; - -#define UPDATE_NONE 0 -#define UPDATE_PARTS 1 -#define UPDATE_FULL 2 - - unsigned char type; - - unsigned char x, y; - unsigned char w, h; -}; - -/* Character sequence parsing states */ -enum { ANS_IDLE, ANS_ESCSEQ,ANS_ESCSEQ_1,ANS_SS3, ANS_CTRLSEQ}; - -struct ctk_term_state { - unsigned char type; - unsigned char state; - unsigned char height, width; - - /* Variables used when sending screen updates. */ - unsigned char x, y, x1, y1, x2, y2; - unsigned char w, h; - unsigned char c1, c2; - -#define CTK_TERM_MAX_UPDATES 8 - struct ctk_term_update *updates_current; - struct ctk_term_update *updates_pending; - struct ctk_term_update *updates_free; - struct ctk_term_update updates_pool[CTK_TERM_MAX_UPDATES]; - - /* Variables used when parsing input sequences */ - unsigned char inputstate; -#define CTK_TERM_CTRLBUFLEN 5 - unsigned char ctrlbuf[CTK_TERM_CTRLBUFLEN+1]; - unsigned char ctrlCnt; -}; - -struct ctk_term_update * ctk_term_update_alloc(struct ctk_term_state *vs); -void ctk_term_update_free(struct ctk_term_state *ts, struct ctk_term_update *a); -void ctk_term_update_remove(struct ctk_term_state *ts, struct ctk_term_update *a); - -void ctk_term_update_add(struct ctk_term_state *ts, struct ctk_term_update *a); -struct ctk_term_update * ctk_term_update_dequeue(struct ctk_term_state *ts); - -void ctk_term_input_init(); - -#endif /* __CTK_TERM_INT_H__ */ diff --git a/backyard/core/ctk/ctk-term-out.c b/backyard/core/ctk/ctk-term-out.c deleted file mode 100644 index 376c04cce..000000000 --- a/backyard/core/ctk/ctk-term-out.c +++ /dev/null @@ -1,350 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * @(#)$Id: ctk-term-out.c,v 1.1 2007/05/26 21:54:33 oliverschmidt Exp $ - */ -#include "libconio.h" -#include "ctk-term-int.h" -#include -#include // sprintf - -#define PRINTF(x) - -/*-----------------------------------------------------------------------------------*/ -/* - * #defines and enums - */ -/*-----------------------------------------------------------------------------------*/ - -#define CHARS_WIDTH LIBCONIO_CONF_SCREEN_WIDTH -#define CHARS_HEIGHT LIBCONIO_CONF_SCREEN_HEIGHT - -/*-----------------------------------------------------------------------------------*/ -/* - * Local variables - */ -/*-----------------------------------------------------------------------------------*/ - -/* ANSI/VT100 colors - 0 - None - 1 - Bold (inc. inten) - 4 - Underscore - 7 - Reverse - x0 - black - x1 - red - x2 - green - x3 - yellow - x4 - blue - x5 - magenta - x6 - cyan - x7 - white - x = 3 fg x = 4 bg -*/ -#if 0 /* Colorfull theme */ -static const char backgroundcolor[] = "\033[0;37;40m"; - -static const char wincol[] = "\033[0;37;40m"; -static const char wincol_f[] = "\033[0;1;37;40m"; -static const char wincol_d[] = "\033[0;30;47m"; - -static const char sepcol[] = "\033[0;37;40m"; -static const char sepcol_f[] = "\033[0;1;37;40m"; -static const char sepcol_d[] = "\033[0;30;47m"; - -static const char labcol[] = "\033[0;37;40m"; -static const char labcol_f[] = "\033[1;37;40m"; -static const char labcol_d[] = "\033[0;30;47m"; - -static const char butcol[] = "\033[0;37;40m"; -static const char butcol_w[] = "\033[0;30;47m"; -static const char butcol_f[] = "\033[0;1;37;40m"; -static const char butcol_fw[] = "\033[0;1;37;46m"; -static const char butcol_d[] = "\033[0;30;47m"; -static const char butcol_dw[] = "\033[0;37;46m"; - -static const char hlcol[] = "\033[0;4;36;40m"; -static const char hlcol_w[] = "\033[0;4;30;47m"; -static const char hlcol_f[] = "\033[0;1;4;36;40m"; -static const char hlcol_fw[] = "\033[0;1;4;37;46m"; -static const char hlcol_d[] = "\033[0;4;34;47m"; -static const char hlcol_dw[] = "\033[0;4;37;46m"; - -static const char iconcol[] = "\033[0;32;40m"; -static const char iconcol_w[] = "\033[0;30;42m"; - -static const char menucolor[] = "\033[0;37;43m"; -static const char activemenucolor[] = "\033[0;1;37;43m"; -#endif - -#if 1 /* B/W theme */ -static const char backgroundcolor[] = "\033[0m"; - -static const char wincol[] = "\033[0m"; -static const char wincol_f[] = "\033[0;1m"; -static const char wincol_d[] = "\033[0;7m"; - -static const char sepcol[] = "\033[0m"; -static const char sepcol_f[] = "\033[0;1m"; -static const char sepcol_d[] = "\033[0;7m"; - -static const char labcol[] = "\033[0m"; -static const char labcol_f[] = "\033[0;1m"; -static const char labcol_d[] = "\033[0;7m"; - -static const char butcol[] = "\033[0m"; -static const char butcol_w[] = "\033[0m"; -static const char butcol_f[] = "\033[0;1m"; -static const char butcol_fw[] = "\033[0;1;7m"; -static const char butcol_d[] = "\033[0;7m"; -static const char butcol_dw[] = "\033[0m"; - -static const char hlcol[] = "\033[0;4m"; -static const char hlcol_w[] = "\033[0;4;7m"; -static const char hlcol_f[] = "\033[0;1;4m"; -static const char hlcol_fw[] = "\033[0;1;4;7m"; -static const char hlcol_d[] = "\033[0;4;7m"; -static const char hlcol_dw[] = "\033[0;4m"; - -static const char iconcol[] = "\033[0m"; -static const char iconcol_w[] = "\033[0;7m"; - -static const char menucolor[] = "\033[0;7m"; -static const char activemenucolor[] = "\033[0m"; - -#endif - -static const char* const colortheme[] = -{ - backgroundcolor, - - /* Window colors */ - wincol, wincol, wincol_f, wincol_f, wincol_d, wincol_d, - - /* Separator colors. */ - sepcol, sepcol, sepcol_f, sepcol_f, sepcol_d, sepcol_d, - - /* Label colors. */ - labcol, labcol, labcol_f, labcol_f, labcol_d, labcol_d, - - /* Button colors. */ - butcol, butcol_w, butcol_f, butcol_fw, butcol_d, butcol_dw, - - /* Hyperlink colors. */ - hlcol, hlcol_w, hlcol_f, hlcol_fw, hlcol_d, hlcol_dw, - - /* Textentry colors. */ - butcol, butcol_w, butcol_f, butcol_fw, butcol_d, butcol_dw, - - /* Icon colors */ - iconcol, iconcol_w, iconcol, iconcol_w, iconcol, iconcol_w, - - /* Menu colors. */ - menucolor, activemenucolor, activemenucolor - }; - -static unsigned char - screen[CHARS_WIDTH * CHARS_HEIGHT], - colorscreen[CHARS_WIDTH * CHARS_HEIGHT]; - -/*-----------------------------------------------------------------------------------*/ -/* - * Add a character to the screen buffer - */ -/*-----------------------------------------------------------------------------------*/ -void -ctk_term_out_update_screen(unsigned char xpos, - unsigned char ypos, - unsigned char c, - unsigned char color) -{ - if (c < 0x20) c = 0x20; - screen[xpos + ypos * CHARS_WIDTH] = c; - colorscreen[xpos + ypos * CHARS_WIDTH] = color; -} - -/*-----------------------------------------------------------------------------------*/ -/* - * Check if there are any updated pending. If so, make the first one current - */ -/*-----------------------------------------------------------------------------------*/ -static void -check_updates(struct ctk_term_state* ts) -{ - if (ts->updates_current != NULL) return; - ts->updates_current = ctk_term_update_dequeue(ts); - if (ts->updates_current != NULL) { - ts->x = ts->updates_current->x; - ts->y = ts->updates_current->y; - ts->w = ts->updates_current->w; - ts->h = ts->updates_current->h; - ts->x1 = ts->x2 = ts->x; - ts->y1 = ts->y2 = ts->y; - } -} - -/*-----------------------------------------------------------------------------------*/ -/** \internal - * Adds a cursor position change to buffer. Returns 0 if string doesn't fit else - * number of bytes actually written is returned. - * - * \param x X coordinate (screen coordinates) - * \param y Y coordinate (screen coordinates) - * \param buf Output buffer - * \param maxlen Maximum number of bytes to store in buffer - */ -/*-----------------------------------------------------------------------------------*/ -static unsigned short -move_to(unsigned char x, unsigned char y, unsigned char* buf, unsigned short maxlen) -{ - if (maxlen < 14) return 0; - return (unsigned short)sprintf((char*)buf, "\033[%d;%dH", y+1, x+1); -} - -/*-----------------------------------------------------------------------------------*/ -/** \internal - * Adds a attribute string to buffer. Returns 0 if string doesn't fit else - * number of bytes actually written is returned. - * - * \param c Color number - * \param buf Output buffer - * \param maxlen Maximum number of bytes to store in buffer - */ -/*-----------------------------------------------------------------------------------*/ -static unsigned short -set_color(unsigned char c, unsigned char* buf, unsigned short maxlen) -{ - int len = strlen((const char*)colortheme[c]); - if (maxlen < len) return 0; - memcpy(buf, colortheme[c], len); - return len; -} - -/*-----------------------------------------------------------------------------------*/ -/** - * Stores terminal data in buffer provided by caller. Returns number of bytes written - * to the output buffer. - * - * \param ts State information - * \param buf Output buffer - * \param maxlen Maximum number of bytes to store in buffer - */ -/*-----------------------------------------------------------------------------------*/ -unsigned short -ctk_term_send(struct ctk_term_state* ts, - unsigned char* buf, - unsigned short maxlen) -{ - unsigned char x, y, x0; - unsigned char col, c; - unsigned short tmp; - unsigned short totlen; - - check_updates(ts); - - if (ts->updates_current == NULL) return 0; - - x0 = ts->x1; - col = ts->c1; - totlen = 0; - /* Loop across the update region starting at (x1,y1) */ - for(y = ts->y1; y < ts->y + ts->h; ++y) { - for(x = x0; x < ts->x + ts->w; ++x) { - /* New line ? */ - if (x == ts->x) { - /* Move cursor to start of line */ - tmp = move_to(x,y,buf,maxlen); - if (tmp == 0) goto loopend; - buf += tmp; - totlen += tmp; - maxlen -= tmp; - } - /* Check color */ - c = colorscreen[x + y * CHARS_WIDTH]; - if (c != col) { - PRINTF(("colorchange at (%d, %d) to %d\n", x,y,c)); - /* Send new color information */ - tmp = set_color(c, buf, maxlen); - if (tmp == 0) goto loopend; - col = c; - buf += tmp; - totlen += tmp; - maxlen -= tmp; - } - /* Check remaining space */ - if (maxlen < 1) goto loopend; - /* Add character */ - *buf = screen[x + y * CHARS_WIDTH]; - buf++; - maxlen--; - totlen++; - } - x0 = ts->x; - } -loopend: - /* Always save current color state */ - ts->c2 = col; - PRINTF(("ending loop at (%d, %d)\n", x,y)); - /* Check if done */ - if (x == ts->x+ts->w && y == ts->y+ts->h) { - /* Signal done with this update */ - ts->x2 = ts->y2 = 0; - } - else { - /* Not done. Save state */ - ts->x2 = x; - ts->y2 = y; - } - return totlen; -} - -/*-----------------------------------------------------------------------------------*/ -/** - * Called by client when the data returned by ctk_term_send() are successfully sent. - * - * \param ts State information - */ -/*-----------------------------------------------------------------------------------*/ -void ctk_term_sent(struct ctk_term_state* ts) -{ - if (ts->updates_current != NULL) { - /* Check if current update done */ - if (ts->x2 == 0 && ts->y2 == 0) { - /* Yes, free it */ - ctk_term_update_free(ts, ts->updates_current); - ts->updates_current = NULL; - } - else { - /* Nop. Update start posititions */ - ts->x1 = ts->x2; - ts->y1 = ts->y2; - } - ts->c1 = ts->c2; - } -} diff --git a/backyard/core/ctk/ctk-term-out.h b/backyard/core/ctk/ctk-term-out.h deleted file mode 100644 index 5a496a820..000000000 --- a/backyard/core/ctk/ctk-term-out.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * @(#)$Id: ctk-term-out.h,v 1.1 2007/05/26 21:54:33 oliverschmidt Exp $ - */ -#ifndef __CTK_TERM_OUT_H__ -#define __CTK_TERM_OUT_H__ - -void -ctk_term_out_update_screen(unsigned char xpos, - unsigned char ypos, - unsigned char c, - unsigned char color); - -#endif /* __CTK_TERM_OUT_H__ */ diff --git a/backyard/core/ctk/ctk-term.c b/backyard/core/ctk/ctk-term.c deleted file mode 100644 index 39f475327..000000000 --- a/backyard/core/ctk/ctk-term.c +++ /dev/null @@ -1,1028 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * @(#)$Id: ctk-term.c,v 1.1 2007/05/26 21:54:33 oliverschmidt Exp $ - */ -#include "ctk/ctk.h" -#include "ctk-draw.h" - -#include "contiki.h" -#include "loader.h" -#include "ctk-term.h" -#include "ctk-term-int.h" -#include "ctk-term-out.h" -#include "contiki-conf.h" -#include "libconio.h" - -#define PRINTF(x) - -#define reverse(x) - -/*-----------------------------------------------------------------------------------*/ -/* - * #defines and enums - */ -/*-----------------------------------------------------------------------------------*/ -#define CH_ULCORNER '+' //0x00 -#define CH_TITLEBAR '-' //0x01 -#define CH_URCORNER '+' //0x02 -#define CH_WINDOWRBORDER '|' //0x03 -#define CH_LRCORNER '+' //0x04 -#define CH_WINDOWLOWERBORDER '-' //0x05 -#define CH_LLCORNER '+' //0x06 -#define CH_WINDOWLBORDER '|' //0x07 - -#define CH_DIALOG_ULCORNER '+' //0x12 -#define CH_DIALOGUPPERBORDER '-' //0x09 -#define CH_DIALOG_URCORNER '+' //0x0a -#define CH_DIALOGRBORDER '|' //0x0b -#define CH_DIALOG_LRCORNER '+' //0x0c -#define CH_DIALOGLOWERBORDER '-' //0x0d -#define CH_DIALOG_LLCORNER '+' //0x0e -#define CH_DIALOGLBORDER '|' //0x0f - -#define CH_BUTTONLEFT '[' //0x10 -#define CH_BUTTONRIGHT ']' //0x11 - -#define CH_SEPARATOR '=' //0x13 - -#ifdef CTK_TERM_CONF_MAX_CLIENTS -#define CTK_TERM_NUMCONNS CTK_TERM_CONF_MAX_CLIENTS -#else -#define CTK_TERM_NUMCONNS 1 -#endif - -unsigned char ctk_draw_windowborder_height = 1; -unsigned char ctk_draw_windowborder_width = 1; -unsigned char ctk_draw_windowtitle_height = 1; - - -/* Term context states */ -enum { - TERM_DEALLOCATED, - TERM_ALLOCATED -}; - -/*-----------------------------------------------------------------------------------*/ -/* - * Local variables - */ -/*-----------------------------------------------------------------------------------*/ - -static unsigned char sizex, sizey; -static struct ctk_term_state conns[CTK_TERM_NUMCONNS]; - -/*-----------------------------------------------------------------------------------*/ -/* - * Unconditionally add an update - */ -/*-----------------------------------------------------------------------------------*/ -void ctk_term_update_add(struct ctk_term_state *ts, struct ctk_term_update *a) -{ - /* XXX: test both head and tail placement!*/ - a->next = ts->updates_pending; - ts->updates_pending = a; -} - -/*-----------------------------------------------------------------------------------*/ -/* - * Allocate an update from the update pool - */ -/*-----------------------------------------------------------------------------------*/ -struct ctk_term_update * -ctk_term_update_alloc(struct ctk_term_state *vs) -{ - struct ctk_term_update *a; - - a = vs->updates_free; - if(a == NULL) { - return NULL; - } - vs->updates_free = a->next; - a->next = NULL; - return a; -} - -/*-----------------------------------------------------------------------------------*/ -/* - * Return an update to the pool - */ -/*-----------------------------------------------------------------------------------*/ -void -ctk_term_update_free(struct ctk_term_state *ts, struct ctk_term_update *a) -{ - a->next = ts->updates_free; - ts->updates_free = a; -} - -/*-----------------------------------------------------------------------------------*/ -/* - * Fetch update from the update list - */ -/*-----------------------------------------------------------------------------------*/ -struct ctk_term_update * -ctk_term_update_dequeue(struct ctk_term_state *ts) -{ - struct ctk_term_update *a; - - a = ts->updates_pending; - if(a == NULL) { - return a; - } - ts->updates_pending = a->next; - a->next = NULL; - return a; -} - -/*-----------------------------------------------------------------------------------*/ -/* - * Remove an update from the update list - */ -/*-----------------------------------------------------------------------------------*/ -void -ctk_term_update_remove(struct ctk_term_state *ts, struct ctk_term_update *a) -{ - struct ctk_term_update *b, *c; - - if(a == ts->updates_pending) { - ts->updates_pending = a->next; - } else { - b = ts->updates_pending; - for(c = ts->updates_pending; c != a; b = c, c = c->next); - - b->next = a->next; - } -} -/*-----------------------------------------------------------------------------------*/ -/* - * Add an area update for a specific connection. Overlapping updates are merged - */ -/*-----------------------------------------------------------------------------------*/ -static void -update_area_connection(struct ctk_term_state *ts, - unsigned char x, unsigned char y, unsigned char w, unsigned char h) -{ - unsigned char x2, y2, ax2, ay2; - struct ctk_term_update *a; - - PRINTF(("update_area_connection: should update (%d:%d) (%d:%d)\n", - x, y, w, h)); - - /* First check if we already have a full update queued. If so, there - is no need to put this update on the list. If there is a full - update, it is always the first one on the list, so there is no - need to go step the list in search for it. */ - - if(ts->updates_pending != NULL && - ts->updates_pending->type == UPDATE_FULL) { - PRINTF(("Update_area_connecion: full update already queued...\n")); - return; - } - -again: - - /* Check that we don't update the same area twice by going through - the list and search for an update with the same coordinates. */ - for(a = ts->updates_pending; a != NULL; a = a->next) { - if(a->x == x && a->y == y && - a->w == w && a->h == h) { - PRINTF(("Update_area_connecion: found equal area\n")); - return; - } - } - - /* Next we check if this update covers an existing update. If so, we - remove the old update, expand this update so that it covers both - areas to be updated and run through the process again. */ - for(a = ts->updates_pending; a != NULL; a = a->next) { - x2 = x + w; - y2 = y + h; - - ax2 = a->x + a->w; - ay2 = a->y + a->h; - - /* Test if updates overlaps */ - if(((x < ax2) && (a->x < x2)) && - ((y < ay2) && (a->y < y2))) { - - /* Remove the old update from the list. */ - ctk_term_update_remove(ts, a); - - /* Put it on the free list. */ - ctk_term_update_free(ts, a); - - PRINTF(("update_area_connection: inside (%d:%d, %d:%d)\n", - a->x, a->y, ax2, ay2)); - - /* Find the area that covers both updates. */ -#define MIN(a,b) ((a) < (b)? (a): (b)) -#define MAX(a,b) ((a) > (b)? (a): (b)) - x = MIN(a->x, x); - y = MIN(a->y, y); - ax2 = MAX(ax2, x2); - ay2 = MAX(ay2, y2); - w = ax2 - x; - h = ay2 - y; - - /* This should really be done by a recursive call to this - function: update_area_connection(vs, x, y, w, h); but because - some compilers might not be able to optimize away the - recursive call, we do it using a goto instead. */ - PRINTF(("Update_area_connecion: trying larger area (%d:%d) (%d:%d)\n", x, y, w, h)); - goto again; - } - } - - /* Allocate an update object by pulling it off the free list. If - there are no free objects, we go for a full update instead. */ - - a = ctk_term_update_alloc(ts); - if(a == NULL) { - PRINTF(("Update_area_connecion: no free updates, doing full\n")); - /* Put all pending updates, except for one, on the free list. Use - the remaining update as a full update. */ - while(ts->updates_pending != NULL) { - a = ts->updates_pending; - ctk_term_update_remove(ts, a); - ctk_term_update_free(ts, a); - } - - a = ctk_term_update_alloc(ts); - a->type = UPDATE_FULL; - ctk_term_update_add(ts, a); - - - } else { - - PRINTF(("Update_area_connecion: allocated update for (%d:%d) (%d:%d)\n", x, y, w, h)); - /* Else, we put the update object at the end of the pending - list. */ - a->type = UPDATE_PARTS; - a->x = x; - a->y = y; - a->w = w; - a->h = h; - ctk_term_update_add(ts, a); - } -} - -/*-----------------------------------------------------------------------------------*/ -/* - * Update an area for all connections. - */ -/*-----------------------------------------------------------------------------------*/ -static void -update_area(unsigned char x, unsigned char y, unsigned char w, unsigned char h) -{ - unsigned char i; - - if(h == 0 || w == 0) { - return; - } - - if ((x+w) > sizex) { - w = sizex - x; - } - - if ((y+h) > sizey) { - h = sizey - y; - } - - /* Update for all active terminal connections. */ - for(i = 0; i < CTK_TERM_NUMCONNS; ++i) { - if(conns[i].state != TERM_DEALLOCATED) { - update_area_connection(&conns[i],x, y, w, h); - } - } - -} -/*-----------------------------------------------------------------------------------*/ -/** - * Request a full update for a specific connections. Usefull when a new client is - * connected through telnet for example. - * - * \param ts Terminal connection state - */ -/*-----------------------------------------------------------------------------------*/ -void ctk_term_redraw(struct ctk_term_state *ts) -{ - update_area_connection(ts,0,0,ts->width, ts->height); -} - -/*-----------------------------------------------------------------------------------*/ -/* - * Initialize a terminal state structure - */ -/*-----------------------------------------------------------------------------------*/ -static void -init_state(struct ctk_term_state *ts) -{ - unsigned char i; - - ts->width = sizex; - ts->height = sizey; - ts->x = ts->y = ts->x1 = ts->y1 = ts->x2 = ts->y2 = 0; - ts->c1 = ts->c2 = 0; - ts->w = sizex; - ts->h = sizey; - ts->state = TERM_ALLOCATED; - ts->inputstate = ANS_IDLE; - - /* Initialize the linked list of updates. */ - for(i = 0; i < CTK_TERM_MAX_UPDATES - 1; ++i) { - ts->updates_pool[i].next = &(ts->updates_pool[i + 1]); - } - ts->updates_pool[CTK_TERM_MAX_UPDATES-1].next = NULL; - - ts->updates_free = &ts->updates_pool[0]; - ts->updates_pending = ts->updates_current = NULL; -} - -/*-----------------------------------------------------------------------------------*/ -/** - * Allocate a new state structure. Returns NULL if none available - */ -/*-----------------------------------------------------------------------------------*/ -struct ctk_term_state * -ctk_term_alloc_state(void) -{ - unsigned char i; - for(i = 0; i < CTK_TERM_NUMCONNS; ++i) { - if(conns[i].state == TERM_DEALLOCATED) { - init_state(&conns[i]); - return &conns[i]; - } - } - return NULL; -} - -/*-----------------------------------------------------------------------------------*/ -/** - * Free a state structure. - * - * \param ts Terminal connection state - */ -/*-----------------------------------------------------------------------------------*/ -void -ctk_term_dealloc_state(struct ctk_term_state *s) -{ - s->state = TERM_DEALLOCATED; -} -/*-----------------------------------------------------------------------------------*/ -static char tmp[40]; -static void -cputsn(char *str, unsigned char len) -{ - strncpy(tmp, str, len); - tmp[len] = 0; - cputs(tmp); -} - -/*-----------------------------------------------------------------------------------*/ -/** - * Initialize the terminal ctk-draw module. Called by the CTK module. - * - */ -/*-----------------------------------------------------------------------------------*/ -void -ctk_draw_init(void) -{ - int i; - bgcolor(TERM_BACKGROUNDCOLOR); - screensize(&sizex, &sizey); - ctk_draw_clear(0, sizey); - ctk_term_input_init(); - for(i = 0; i < CTK_TERM_NUMCONNS; ++i) { - conns[i].state = TERM_DEALLOCATED; - } -} - -/*-----------------------------------------------------------------------------------*/ -static void -draw_widget(struct ctk_widget *w, - unsigned char x, unsigned char y, - unsigned char clipx, - unsigned char clipy, - unsigned char clipy1, unsigned char clipy2, - unsigned char focus) -{ - unsigned char xpos, ypos, xscroll; - unsigned char i, j; - char c, *text; - unsigned char len; - - xpos = x + w->x; - ypos = y + w->y; - - switch(w->type) { - case CTK_WIDGET_SEPARATOR: - textcolor((unsigned char)(TERM_SEPARATORCOLOR + focus)); - if(ypos >= clipy1 && ypos < clipy2) { - gotoxy(xpos, ypos); - for(i = 0; i < w->w; ++i) { - cputc(CH_SEPARATOR); - } - } - break; - case CTK_WIDGET_LABEL: - textcolor((unsigned char)(TERM_LABELCOLOR + focus)); - text = w->widget.label.text; - for(i = 0; i < w->h; ++i) { - if(ypos >= clipy1 && ypos < clipy2) { - gotoxy(xpos, ypos); - cputsn(text, w->w); - if(w->w - (wherex() - xpos) > 0) { - cclear((unsigned char)(w->w - (wherex() - xpos))); - } - } - ++ypos; - text += w->w; - } - break; - case CTK_WIDGET_BUTTON: - textcolor((unsigned char)(TERM_BUTTONCOLOR + focus)); - if(ypos >= clipy1 && ypos < clipy2) { - if(focus & CTK_FOCUS_WIDGET) { - revers(1); - } else { - revers(0); - } - cputcxy(xpos, ypos, CH_BUTTONLEFT); - cputsn(w->widget.button.text, w->w); - cputc(CH_BUTTONRIGHT); - revers(0); - } - break; - case CTK_WIDGET_HYPERLINK: - textcolor((unsigned char)(TERM_HYPERLINKCOLOR + focus)); - if(ypos >= clipy1 && ypos < clipy2) { - if(focus & CTK_FOCUS_WIDGET) { - revers(0); - } else { - revers(1); - } - gotoxy(xpos, ypos); - cputsn(w->widget.button.text, w->w); - revers(0); - } - break; - case CTK_WIDGET_TEXTENTRY: - textcolor((unsigned char)(TERM_TEXTENTRYCOLOR + focus)); - text = w->widget.textentry.text; - xscroll = 0; - if(w->widget.textentry.xpos >= w->w - 1) { - xscroll = w->widget.textentry.xpos - w->w + 1; - } - for(j = 0; j < w->h; ++j) { - if(ypos >= clipy1 && ypos < clipy2) { - if(w->widget.textentry.state == CTK_TEXTENTRY_EDIT && - w->widget.textentry.ypos == j) { - revers(0); - cputcxy(xpos, ypos, '>'); - c = 1; - for(i = 0; i < w->w; ++i) { - if(c != 0) { - c = text[i + xscroll]; - } - if(i == w->widget.textentry.xpos - xscroll) { - textcolor((unsigned char)(TERM_TEXTENTRYCOLOR + (focus ^ 0x01))); - revers(1); - } else { - revers(0); - } - if(c == 0) { - cputc(' '); - } else { - cputc(c); - } - revers(0); - textcolor((unsigned char)(TERM_TEXTENTRYCOLOR + focus)); - } - cputc('<'); - } else { - if(focus & CTK_FOCUS_WIDGET && j == w->widget.textentry.ypos) { - revers(1); - } else { - revers(0); - } - cvlinexy(xpos, ypos, 1); - gotoxy((unsigned char)(xpos + 1), ypos); - cputsn(text, w->w); - i = wherex(); - if(i - xpos - 1 < w->w) { - cclear((unsigned char)(w->w - (i - xpos) + 1)); - } - cvline(1); - } - } - ++ypos; - text += w->widget.textentry.len + 1; - } - revers(0); - break; - case CTK_WIDGET_ICON: - if(ypos >= clipy1 && ypos < clipy2) { - textcolor((unsigned char)(TERM_ICONCOLOR + focus)); - if(focus & 1) { - revers(1); - } else { - revers(0); - } - - x = xpos; - len = strlen(w->widget.icon.title); - if(x + len >= sizex) { - x = sizex - len; - } - - gotoxy(x, (unsigned char)(ypos + 3)); - if(ypos >= clipy1 && ypos < clipy2) { - cputs(w->widget.icon.title); - } - - gotoxy(xpos, ypos); - - if (w->widget.icon.textmap != NULL) { - for(i = 0; i < 3; ++i) { - - if(ypos >= clipy1 && ypos < clipy2) { - gotoxy(xpos,ypos); - cputc(w->widget.icon.textmap[0 + 3 * i]); - cputc(w->widget.icon.textmap[1 + 3 * i]); - cputc(w->widget.icon.textmap[2 + 3 * i]); - } - ++ypos; - } - } - x = xpos; - revers(0); - } - break; - - default: - break; - } -} - -/*-----------------------------------------------------------------------------------*/ -/** - * Draw a widget on the VNC screen. Called by the CTK module. - * - * \param w The widget to be drawn. - * \param focus The focus of the widget. - * \param clipy1 The lower y coordinate bound. - * \param clipy2 The upper y coordinate bound. - */ -/*-----------------------------------------------------------------------------------*/ -void -ctk_draw_widget(struct ctk_widget *w, - unsigned char focus, - unsigned char clipy1, - unsigned char clipy2) -{ - struct ctk_window *win = w->window; - struct ctk_icon *icon; - unsigned char posx, posy, x, len; - - posx = win->x + 1; - posy = win->y + 2; - - if(w == win->focused) { - focus |= CTK_FOCUS_WIDGET; - } - - draw_widget(w, posx, posy, - (unsigned char)(posx + win->w), - (unsigned char)(posy + win->h), - clipy1, clipy2, - focus); - - if(w->type != CTK_WIDGET_ICON) { - update_area((unsigned char)(posx + w->x), - (unsigned char)(posy + w->y), - (unsigned char)(w->w + 2), - w->h); - } else { - icon = (struct ctk_icon *)w; - - len = strlen(icon->title); - x = posx + w->x; - if(x + len >= sizex) { - x = sizex - len; - } - - update_area(x, - (unsigned char)(posy + w->y), - (unsigned char)(len > 4? len: 4), - w->h); - } - -#ifdef CTK_CONIO_CONF_UPDATE - CTK_CONIO_CONF_UPDATE(); -#endif /* CTK_CONIO_CONF_UPDATE */ -} - -/*-----------------------------------------------------------------------------------*/ -/** - * Clear a window on the terminal screen. Called by the CTK module. - * - * \param window The window to be cleared. - * \param focus The focus of the window. - * \param clipy1 The lower y coordinate bound. - * \param clipy2 The upper y coordinate bound. - */ -/*-----------------------------------------------------------------------------------*/ -void -ctk_draw_clear_window(struct ctk_window *window, - unsigned char focus, - unsigned char clipy1, - unsigned char clipy2) -{ - unsigned char i; - unsigned char h; - - textcolor((unsigned char)(TERM_WINDOWCOLOR + focus)); - - h = window->y + 2 + window->h; - /* Clear window contents. */ - for(i = window->y + 2; i < h; ++i) { - if(i >= clipy1 && i < clipy2) { - cclearxy((unsigned char)(window->x + 1), i, window->w); - } - } - - update_area((unsigned char)(window->x + 1), - (unsigned char)(window->y + 2), - window->w, window->h); -} -/*-----------------------------------------------------------------------------------*/ -static void -draw_window_contents(struct ctk_window *window, unsigned char focus, - unsigned char clipy1, unsigned char clipy2, - unsigned char x1, unsigned char x2, - unsigned char y1, unsigned char y2) -{ - struct ctk_widget *w; - unsigned char wfocus; - - /* Draw inactive widgets. */ - for(w = window->inactive; w != NULL; w = w->next) { - draw_widget(w, x1, y1, x2, y2, - clipy1, clipy2, - focus); - } - - /* Draw active widgets. */ - for(w = window->active; w != NULL; w = w->next) { - wfocus = focus; - if(w == window->focused) { - wfocus |= CTK_FOCUS_WIDGET; - } - - draw_widget(w, x1, y1, x2, y2, - clipy1, clipy2, - wfocus); - } - -#ifdef CTK_CONIO_CONF_UPDATE - CTK_CONIO_CONF_UPDATE(); -#endif /* CTK_CONIO_CONF_UPDATE */ - -} - -/*-----------------------------------------------------------------------------------*/ -/** - * Draw a window on the terminal screen. Called by the CTK module. - * - * \param window The window to be drawn. - * \param focus The focus of the window. - * \param clipy1 The lower y coordinate bound. - * \param clipy2 The upper y coordinate bound. - * \param draw_borders The flag for border drawing. - */ -/*-----------------------------------------------------------------------------------*/ -void -ctk_draw_window(struct ctk_window *window, unsigned char focus, - unsigned char clipy1, unsigned char clipy2, - unsigned char draw_borders) -{ - unsigned char x, y; - unsigned char h; - unsigned char x1, y1, x2, y2; - unsigned char i; - - - if(window->y + 1 >= clipy2) { - return; - } - - x = window->x; - y = window->y + 1; - x1 = x + 1; - y1 = y + 1; - x2 = x1 + window->w; - y2 = y1 + window->h; - - if(draw_borders) { - - /* Draw window frame. */ - textcolor((unsigned char)(TERM_WINDOWCOLOR + focus)); - - if(y >= clipy1) { - cputcxy(x, y, CH_ULCORNER); - for(i = wherex() + window->titlelen + CTK_CONF_WINDOWMOVE * 2; i < x2; ++i) { - cputcxy(i, y, CH_TITLEBAR); - } - cputcxy(x2, y, CH_URCORNER); - } - - h = window->h; - - if(clipy1 > y1) { - if(clipy1 - y1 < h) { - h = clipy1 - y1; - y1 = clipy1; - } else { - h = 0; - } - } - - if(clipy2 < y1 + h) { - if(y1 >= clipy2) { - h = 0; - } else { - h = clipy2 - y1; - } - } - - for(i = y1; i < y1 + h; ++i) { - cputcxy(x, i, CH_WINDOWLBORDER); - cputcxy(x2, i, CH_WINDOWRBORDER); - } - - if(y2 >= clipy1 && - y2 < clipy2) { - cputcxy(x, y2, CH_LLCORNER); - for(i = x1; i < x2; ++i) { - cputcxy(i, y2, CH_WINDOWLOWERBORDER); - } - cputcxy(x2, y2, CH_LRCORNER); - } - } - - draw_window_contents(window, focus, clipy1, clipy2, - x1, x2, (unsigned char)(y + 1), y2); - - update_area(window->x, window->y, - (unsigned char)(window->w + 2), - (unsigned char)(window->h + 2)); -} -/*-----------------------------------------------------------------------------------*/ -/** - * Draw a dialog on the terminal screen. Called by the CTK module. - * - * \param dialog The dialog to be drawn. - */ -/*-----------------------------------------------------------------------------------*/ -void -ctk_draw_dialog(struct ctk_window *dialog) -{ - unsigned char x, y; - unsigned char i; - unsigned char x1, y1, x2, y2; - - textcolor(TERM_WINDOWCOLOR + CTK_FOCUS_DIALOG); - - x = dialog->x; - y = dialog->y + 1; - - - x1 = x + 1; - y1 = y + 1; - x2 = x1 + dialog->w; - y2 = y1 + dialog->h; - - - /* Draw dialog frame. */ - - for(i = y1; i < y1 + dialog->h; ++i) { - cputcxy(x, i, CH_DIALOGLBORDER); - cputcxy(x2, i, CH_DIALOGRBORDER); - } - - for(i = x1; i < x2; ++i) { - cputcxy(i, y, CH_DIALOGUPPERBORDER); - cputcxy(i, y2, CH_DIALOGLOWERBORDER); - } - - cputcxy(x, y, CH_DIALOG_ULCORNER); - cputcxy(x, y2, CH_DIALOG_LLCORNER); - cputcxy(x2, y, CH_DIALOG_URCORNER); - cputcxy(x2, y2, CH_DIALOG_LRCORNER); - - - /* Clear dialog contents. */ - for(i = y1; i < y2; ++i) { - cclearxy(x1, i, dialog->w); - } - - draw_window_contents(dialog, CTK_FOCUS_DIALOG, 0, sizey, - x1, x2, y1, y2); - - update_area(dialog->x, dialog->y, - (unsigned char)(dialog->w + 4), - (unsigned char)(dialog->h + 4)); -} -/*-----------------------------------------------------------------------------------*/ -/** - * Clear parts of the terminal desktop. Called by the CTK module. - * - * \param y1 The lower y coordinate bound. - * \param y2 The upped y coordinate bound. - */ -/*-----------------------------------------------------------------------------------*/ -void -ctk_draw_clear(unsigned char y1, unsigned char y2) -{ - unsigned char i; - - textcolor(TERM_BACKGROUNDCOLOR); - for(i = y1; i < y2; ++i) { - cclearxy(0, i, sizex); - } - - update_area(0, y1, sizex, (unsigned char)(y2 - y1)); -} -/*-----------------------------------------------------------------------------------*/ -/** \internal - * Draw one menu on the termainl desktop. - * - * \param m The CTK menu to be drawn. - */ -/*-----------------------------------------------------------------------------------*/ -static void -draw_menu(struct ctk_menu *m) -{ - unsigned char x, x2, y; - - textcolor(TERM_MENUCOLOR); - x = wherex(); - cputs(m->title); - cputc(' '); - x2 = wherex(); - if(x + CTK_CONF_MENUWIDTH > sizex) { - x = sizex - CTK_CONF_MENUWIDTH; - } - - - for(y = 0; y < m->nitems; ++y) { - if(y == m->active) { - textcolor(TERM_ACTIVEMENUCOLOR); - revers(0); - } else { - textcolor(TERM_MENUCOLOR); - } - gotoxy(x, (unsigned char)(y + 1)); - if(m->items[y].title[0] == '-') { - chline(CTK_CONF_MENUWIDTH); - } else { - cputs(m->items[y].title); - } - if(x + CTK_CONF_MENUWIDTH > wherex()) { - cclear((unsigned char)(x + CTK_CONF_MENUWIDTH - wherex())); - } - revers(1); - } - - gotoxy(x2, 0); - textcolor(TERM_MENUCOLOR); - - update_area(x, 0, CTK_CONF_MENUWIDTH, (unsigned char)(m->nitems + 1)); -} -/*-----------------------------------------------------------------------------------*/ -/** - * Draw the menus on the terminal desktop. Called by the CTK module. - * - * \param menus The CTK menubar. - */ -/*-----------------------------------------------------------------------------------*/ -void -ctk_draw_menus(struct ctk_menus *menus) -{ - struct ctk_menu *m; - - - /* Draw menus */ - textcolor(TERM_MENUCOLOR); - gotoxy(0, 0); - revers(1); - cputc(' '); - for(m = menus->menus->next; m != NULL; m = m->next) { - if(m != menus->open) { - update_area(wherex(), 0, (unsigned char)(strlen(m->title) + 1), 1); - cputs(m->title); - cputc(' '); - } else { - draw_menu(m); - } - } - - - if(wherex() + strlen(menus->desktopmenu->title) + 1>= sizex) { - gotoxy((unsigned char)(sizex - strlen(menus->desktopmenu->title) - 1), 0); - } else { - cclear((unsigned char)(sizex - wherex() - strlen(menus->desktopmenu->title) - 1)); - update_area(wherex(), 0, - (unsigned char)(sizex - wherex() -strlen(menus->desktopmenu->title) - 1), - 1); - } - - /* Draw desktopmenu */ - if(menus->desktopmenu != menus->open) { - update_area(wherex(), 0, (unsigned char)(strlen(menus->desktopmenu->title) + 1), 1); - cputs(menus->desktopmenu->title); - cputc(' '); - } else { - draw_menu(menus->desktopmenu); - } - - revers(0); -} - -/*-----------------------------------------------------------------------------------*/ -/** - * Obtain the height of the terminal desktop. Called by the CTK module. - * - * \return The height of the terminal desktop, in characters. - */ -/*-----------------------------------------------------------------------------------*/ -unsigned char -ctk_draw_height(void) -{ - return sizey; -} - -/*-----------------------------------------------------------------------------------*/ -/** - * Obtain the height of the terminal desktop. Called by the CTK module. - * - * \return The height of the terminal desktop, in characters. - */ -/*-----------------------------------------------------------------------------------*/ -unsigned char -ctk_draw_width(void) -{ - return sizex; -} - -/*-----------------------------------------------------------------------------------*/ -/** - * Draws a character on the virtual screen. Called by the libconio module. - * - * \param c The character to be drawn. - * \param xpos The x position of the character. - * \param ypos The y position of the character. - * \param reversedflag Determines if the character should be reversed or not. - * \param color The color of the character. - */ -/*-----------------------------------------------------------------------------------*/ -void -ctk_arch_draw_char(char c, - unsigned char xpos, - unsigned char ypos, - unsigned char reversedflag, - unsigned char color) -{ - /* Check if out of bounds */ - if (xpos >= sizex || ypos >= sizey) { - return; - } - ctk_term_out_update_screen(xpos,ypos, (unsigned char)(c & 0x7f), color); -} diff --git a/backyard/core/ctk/ctk-term.h b/backyard/core/ctk/ctk-term.h deleted file mode 100644 index bb9dda384..000000000 --- a/backyard/core/ctk/ctk-term.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * @(#)$Id: ctk-term.h,v 1.1 2007/05/26 21:54:33 oliverschmidt Exp $ - */ -#ifndef __CTK_TERM_H__ -#define __CTK_TERM_H__ - -struct ctk_term_state* ctk_term_alloc_state(void); -void ctk_term_dealloc_state(struct ctk_term_state *s); -void ctk_term_redraw(struct ctk_term_state *s); -void ctk_term_sent(struct ctk_term_state* ts); -unsigned short ctk_term_send(struct ctk_term_state* ts, - unsigned char* buf, - unsigned short maxlen); - -void ctk_term_input(struct ctk_term_state* ts, unsigned char b); - -#endif /* __CTK_TERM_H__ */ diff --git a/backyard/core/ctk/ctk-termarch.h b/backyard/core/ctk/ctk-termarch.h deleted file mode 100644 index 9313b394d..000000000 --- a/backyard/core/ctk/ctk-termarch.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * @(#)$Id: ctk-termarch.h,v 1.1 2007/05/26 21:54:33 oliverschmidt Exp $ - */ -#ifndef __CTK_TERMARCH_H__ -#define __CTK_TERMARCH_H__ - - -typedef char ctk_arch_key_t; - -unsigned char ctk_arch_keyavail(void); -ctk_arch_key_t ctk_arch_getkey(void); - -#define CH_ENTER 0x0d -#define CH_DEL 0x08 - -#define CH_TAB 0x09 - -#define CH_CURS_LEFT 0x11 -#define CH_CURS_UP 0x12 -#define CH_CURS_RIGHT 0x13 -#define CH_CURS_DOWN 0x14 - - -#define CH_F1 0x15 -#define CH_F2 0x16 -#define CH_F3 0x17 -#define CH_F4 0x18 - -#endif /* __CTK_TERMARCH_H__ */ diff --git a/backyard/core/ctk/ctk-termserial.c b/backyard/core/ctk/ctk-termserial.c deleted file mode 100644 index 90a55cb59..000000000 --- a/backyard/core/ctk/ctk-termserial.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * @(#)$Id: ctk-termserial.c,v 1.1 2007/05/26 21:46:28 oliverschmidt Exp $ - */ -#include "contiki.h" -#include "loader.h" -#include "ctk-term.h" -#include "serial32.h" - -/*-----------------------------------------------------------------------------------*/ -/* - * #defines and enums - */ -/*-----------------------------------------------------------------------------------*/ -#define SIO_POLL(c) (SerialRead(&c) == 1) -#define SIO_SEND(c) SerialWrite(c) -#define SIO_INIT SerialOpenPort("COM1") - -#ifdef CTK_TERM_CONF_SERIAL_BUFFER_SIZE -#define OUTPUT_BUFFER_SIZE CTK_TERM_CONF_SERIAL_BUFFER_SIZE -#else -#define OUTPUT_BUFFER_SIZE 200 -#endif - -/*-----------------------------------------------------------------------------------*/ -/* - * Local variables - */ -/*-----------------------------------------------------------------------------------*/ -static ek_id_t id = EK_ID_NONE; - -static struct ctk_term_state* termstate; -static unsigned char outbuffer[OUTPUT_BUFFER_SIZE]; - -EK_POLLHANDLER(pollhandler); -EK_EVENTHANDLER(eventhandler, ev, data); -EK_PROCESS(p, "CTK serial server", EK_PRIO_NORMAL, - eventhandler, pollhandler, NULL); - -/*-----------------------------------------------------------------------------------*/ -/* - * Idle function - */ -/*-----------------------------------------------------------------------------------*/ -EK_POLLHANDLER(pollhandler) -{ - unsigned char c; - unsigned short len; - while(SIO_POLL(c)) { - ctk_term_input(termstate, c); - } - - len = ctk_term_send(termstate, outbuffer, OUTPUT_BUFFER_SIZE); - if (len > 0) { - unsigned short i; - for (i=0; i < len; ++i) { - SIO_SEND(outbuffer[i]); - } - ctk_term_sent(termstate); - } -} - -/*-----------------------------------------------------------------------------------*/ -/* - * Init function - */ -/*-----------------------------------------------------------------------------------*/ -LOADER_INIT_FUNC(ctk_termserial_init, arg) -{ - arg_free(arg); - SIO_INIT; - termstate = ctk_term_alloc_state(); - if (termstate == NULL) return; - if(id == EK_ID_NONE) { - id = ek_start(&p); - } -} -/*-----------------------------------------------------------------------------------*/ -EK_EVENTHANDLER(eventhandler, ev, data) -{ - -} diff --git a/backyard/core/ctk/ctk-termserial.h b/backyard/core/ctk/ctk-termserial.h deleted file mode 100644 index 1772d4a63..000000000 --- a/backyard/core/ctk/ctk-termserial.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * @(#)$Id: ctk-termserial.h,v 1.1 2007/05/26 21:46:28 oliverschmidt Exp $ - */ -#ifndef __CTK_TERMSERIAL_H__ -#define __CTK_TERMSERIAL_H__ - -void ctk_termserial_init(char *arg); - -#endif /* __CTK_TERMSERIAL_H__ */ diff --git a/backyard/core/ctk/ctk-termtelnet.c b/backyard/core/ctk/ctk-termtelnet.c deleted file mode 100644 index 924535c8d..000000000 --- a/backyard/core/ctk/ctk-termtelnet.c +++ /dev/null @@ -1,655 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * @(#)$Id: ctk-termtelnet.c,v 1.2 2010/10/19 18:29:03 adamdunkels Exp $ - */ -#include "contiki.h" -#include "loader.h" -#include "memb.h" -#include "ctk-term.h" -#include "contiki-conf.h" - -/*-----------------------------------------------------------------------------------*/ -/* - * #defines and enums - */ -/*-----------------------------------------------------------------------------------*/ -/* Telnet special characters */ -#define TN_NULL 0 -#define TN_BL 7 -#define TN_BS 8 -#define TN_HT 9 -#define TN_LF 10 -#define TN_VT 11 -#define TN_FF 12 -#define TN_CR 13 - -/* Commands preceeded by TN_IAC */ -#define TN_SE 240 -#define TN_NOP 241 -#define TN_DM 242 -#define TN_BRK 243 -#define TN_IP 244 -#define TN_AO 245 -#define TN_AYT 246 -#define TN_EC 247 -#define TN_EL 248 -#define TN_GA 249 -#define TN_SB 250 -#define TN_WILL 251 -#define TN_WONT 252 -#define TN_DO 253 -#define TN_DONT 254 -#define TN_IAC 255 - -#define TNO_BIN 0 -#define TNO_ECHO 1 -#define TNO_SGA 3 -#define TNO_NAWS 31 - -/* Telnet parsing states */ -enum { - TNS_IDLE, - TNS_IAC, - TNS_OPT, - TNS_SB, - TNS_SBIAC -}; - -/* Telnet option negotiation states */ -enum { - TNOS_NO, - TNOS_WANTNO_EMPTY, - TNOS_WANTNO_OPPOSITE, - TNOS_WANTYES_EMPTY, - TNOS_WANTYES_OPPOSITE, - TNOS_YES -}; - -/* Telnet session states */ -enum { - TTS_FREE, /* Not allocated */ - TTS_IDLE, /* No data to send and nothing sent */ - TTS_SEND_TNDATA, /* Sending telnet data */ - TTS_SEND_APPDATA /* Sending data from upper layers */ -}; - -/* Number of options supported (we only need ECHO(1) and SGA(3) options) */ -#define TNSM_MAX_OPTIONS 4 - -/* Max option replies in output queue */ -#define TNQLEN 20 - -/* Number of option buffer */ -#define OPTION_POOL_SIZE 20 - -/* Maximum number of telnet sessions */ -#ifdef CTK_TERM_CONF_MAX_TELNET_CLIENTS -#define NUM_CONNS CTK_TERM_CONF_MAX_TELNET_CLIENTS -#else -#define NUM_CONNS 1 -#endif - -#ifdef CTK_TERM_CONF_TELNET_PORT -#define PORT CTK_TERM_CONF_TELNET_PORT -#else -#define PORT 23 -#endif - -/*-----------------------------------------------------------------------------------*/ -/* - * Structures - */ -/*-----------------------------------------------------------------------------------*/ -/* Telnet option state structure */ -struct TNOption { - unsigned char state; - unsigned char wants; -}; - -/* Telnet handling state structure */ -struct TNSMState -{ - struct TNOption myOpt[TNSM_MAX_OPTIONS]; - struct TNOption hisOpt[TNSM_MAX_OPTIONS]; - unsigned char cmd; - unsigned char state; -}; - -/* Telnet session state */ -struct telnet_state -{ - unsigned char state; - unsigned char* sendq[TNQLEN]; - struct TNSMState tnsm; - struct ctk_term_state* termstate; -}; - -/*-----------------------------------------------------------------------------------*/ -/* - * Local variables - */ -/*-----------------------------------------------------------------------------------*/ -/*static DISPATCHER_UIPCALL(ctk_termtelnet_appcall, state);*/ -static void ctk_termtelnet_appcall(void *state); - -EK_EVENTHANDLER(eventhandler, ev, data); -EK_PROCESS(p, "CTK telnet server", EK_PRIO_NORMAL, - eventhandler, NULL, NULL); -/*static struct dispatcher_proc p = - {DISPATCHER_PROC("CTK telnet server", NULL, NULL, - ctk_termtelnet_appcall)};*/ - -static ek_id_t id = EK_ID_NONE; - -/* Option negotiation buffer pool */ -struct size_3 { - char size[3]; -}; -MEMB(telnetbuf, struct size_3, OPTION_POOL_SIZE); - -static int i,j; -static struct telnet_state states[NUM_CONNS]; - -/*-----------------------------------------------------------------------------------*/ -/* - * Send an option reply on a connection - */ -/*-----------------------------------------------------------------------------------*/ -static void -Reply(struct telnet_state* tns, unsigned char cmd, unsigned char opt) -{ - unsigned char* buf = (unsigned char*)memb_alloc(&telnetbuf); - if (buf != 0) { - buf[0]=TN_IAC; - buf[1]=cmd; - buf[2]=opt; - for (i=0; i < TNQLEN; i++) { - if (tns->sendq[i] == 0) { - tns->sendq[i] = buf; - return; - } - } - /* Queue is full. Drop it */ - memb_free(&telnetbuf, (char*)buf); - } -} - -/*-----------------------------------------------------------------------------------*/ -/* - * Prepare for enabling one of remote side options. - */ -/*-----------------------------------------------------------------------------------*/ -static void -EnableHisOpt(struct telnet_state* tns, unsigned char opt) -{ - switch(tns->tnsm.hisOpt[opt].state) { - case TNOS_NO: - tns->tnsm.hisOpt[opt].wants = 1; - tns->tnsm.hisOpt[opt].state = TNOS_WANTYES_EMPTY; - Reply(tns, TN_DO, opt); - break; - case TNOS_WANTNO_EMPTY: - tns->tnsm.hisOpt[opt].state = TNOS_WANTNO_OPPOSITE; - break; - case TNOS_WANTNO_OPPOSITE: - break; - case TNOS_WANTYES_EMPTY: - tns->tnsm.hisOpt[opt].state = TNOS_YES; - break; - case TNOS_WANTYES_OPPOSITE: - tns->tnsm.hisOpt[opt].state = TNOS_WANTYES_EMPTY; - break; - case TNOS_YES: - break; - } -} - -/*-----------------------------------------------------------------------------------*/ -/* - * Prepare for enabling one of my options - */ -/*-----------------------------------------------------------------------------------*/ -static void -EnableMyOpt(struct telnet_state* tns, unsigned char opt) -{ - if (opt < TNSM_MAX_OPTIONS) { - switch(tns->tnsm.myOpt[opt].state) { - case TNOS_NO: - tns->tnsm.myOpt[opt].wants = 1; - tns->tnsm.myOpt[opt].state = TNOS_WANTYES_EMPTY; - Reply(tns, TN_WILL, opt); - break; - case TNOS_WANTNO_EMPTY: - tns->tnsm.myOpt[opt].state = TNOS_WANTNO_OPPOSITE; - break; - case TNOS_WANTNO_OPPOSITE: - break; - case TNOS_WANTYES_EMPTY: - tns->tnsm.myOpt[opt].state = TNOS_YES; - break; - case TNOS_WANTYES_OPPOSITE: - tns->tnsm.myOpt[opt].state = TNOS_WANTYES_EMPTY; - break; - case TNOS_YES: - break; - } - } -} - -/*-----------------------------------------------------------------------------------*/ -/* - * Implementation of option negotiation using the Q-method - */ -/*-----------------------------------------------------------------------------------*/ -static void -HandleCommand(struct telnet_state* tns, unsigned char cmd, unsigned char opt) -{ - if (opt < TNSM_MAX_OPTIONS) { - /* Handling according to RFC 1143 "Q Method" */ - switch(cmd) { - case TN_WILL: - switch(tns->tnsm.hisOpt[opt].state) { - case TNOS_NO: - if (tns->tnsm.hisOpt[opt].wants) { - tns->tnsm.hisOpt[opt].state = TNOS_YES; - Reply(tns, TN_DO, opt); - } - else { - Reply(tns, TN_DONT, opt); - } - break; - case TNOS_WANTNO_EMPTY: - tns->tnsm.hisOpt[opt].state = TNOS_NO; - break; - case TNOS_WANTNO_OPPOSITE: - tns->tnsm.hisOpt[opt].state = TNOS_YES; - break; - case TNOS_WANTYES_EMPTY: - tns->tnsm.hisOpt[opt].state = TNOS_YES; - break; - case TNOS_WANTYES_OPPOSITE: - tns->tnsm.hisOpt[opt].state = TNOS_WANTNO_EMPTY; - Reply(tns, TN_DONT, opt); - break; - case TNOS_YES: - break; - } - break; - case TN_WONT: - switch(tns->tnsm.hisOpt[opt].state) { - case TNOS_NO: - break; - case TNOS_WANTNO_EMPTY: - case TNOS_WANTYES_EMPTY: - case TNOS_WANTYES_OPPOSITE: - tns->tnsm.hisOpt[opt].state = TNOS_NO; - break; - case TNOS_WANTNO_OPPOSITE: - tns->tnsm.hisOpt[opt].state = TNOS_WANTYES_EMPTY; - Reply(tns, TN_DO, opt); - break; - case TNOS_YES: - tns->tnsm.hisOpt[opt].state = TNOS_NO; - Reply(tns, TN_DONT, opt); - break; - } - break; - case TN_DO: - switch(tns->tnsm.myOpt[opt].state) { - case TNOS_NO: - if (tns->tnsm.myOpt[opt].wants) { - tns->tnsm.myOpt[opt].state = TNOS_YES; - Reply(tns, TN_WILL, opt); - } - else { - Reply(tns, TN_WONT, opt); - } - break; - case TNOS_WANTNO_EMPTY: - tns->tnsm.myOpt[opt].state = TNOS_NO; - break; - case TNOS_WANTNO_OPPOSITE: - tns->tnsm.myOpt[opt].state = TNOS_YES; - break; - case TNOS_WANTYES_EMPTY: - tns->tnsm.myOpt[opt].state = TNOS_YES; - break; - case TNOS_WANTYES_OPPOSITE: - tns->tnsm.myOpt[opt].state = TNOS_WANTNO_EMPTY; - Reply(tns, TN_WONT, opt); - break; - case TNOS_YES: - break; - } - break; - case TN_DONT: - switch(tns->tnsm.myOpt[opt].state) { - case TNOS_NO: - break; - case TNOS_WANTNO_EMPTY: - case TNOS_WANTYES_EMPTY: - case TNOS_WANTYES_OPPOSITE: - tns->tnsm.myOpt[opt].state = TNOS_NO; - break; - case TNOS_WANTNO_OPPOSITE: - tns->tnsm.myOpt[opt].state = TNOS_WANTYES_EMPTY; - Reply(tns, TN_WILL, opt); - break; - case TNOS_YES: - tns->tnsm.myOpt[opt].state = TNOS_NO; - Reply(tns, TN_WONT, opt); - break; - } - break; - } - } - else { - switch(cmd) { - case TN_WILL: - Reply(tns, TN_DONT, opt); - break; - case TN_WONT: - break; - case TN_DO: - Reply(tns, TN_WONT, opt); - break; - case TN_DONT: - break; - } - } -} - -/*-----------------------------------------------------------------------------------*/ -/* - * Telnet data parsing - */ -/*-----------------------------------------------------------------------------------*/ -static unsigned char -parse_input(struct telnet_state* tns, unsigned char b) -{ - unsigned char ret = 0; - switch(tns->tnsm.state) { - case TNS_IDLE: - if (b == TN_IAC) tns->tnsm.state = TNS_IAC; - else ret = 1; - break; - case TNS_IAC: - switch(b) { - case TN_SE: - case TN_NOP: - case TN_DM: - case TN_BRK: - case TN_IP: - case TN_AO: - case TN_AYT: - case TN_EC: - case TN_EL: - case TN_GA: - tns->tnsm.state = TNS_IDLE; - break; - case TN_SB: - tns->tnsm.state = TNS_SB; - break; - case TN_WILL: - case TN_WONT: - case TN_DO: - case TN_DONT: - tns->tnsm.cmd = b; - tns->tnsm.state = TNS_OPT; - break; - case TN_IAC: - tns->tnsm.state = TNS_IDLE; - ret = 1; - break; - default: - /* Drop unknown IACs */ - tns->tnsm.state = TNS_IDLE; - break; - } - break; - case TNS_OPT: - HandleCommand(tns, tns->tnsm.cmd, b); - tns->tnsm.state = TNS_IDLE; - break; - case TNS_SB: - if (b == TN_IAC) { - tns->tnsm.state = TNS_SBIAC; - } - break; - case TNS_SBIAC: - if (b == TN_IAC) { - tns->tnsm.state = TNS_SB; - } - else if (b == TN_SE) { - tns->tnsm.state = TNS_IDLE; - } - else { - tns->tnsm.state = TNS_IDLE; - } - break; - } - return ret; -} - -/*-----------------------------------------------------------------------------------*/ -/* - * Initialize telnet machine - */ -/*-----------------------------------------------------------------------------------*/ -static void -telnet_init(struct telnet_state* tns) -{ - int i; - for (i = 0; i < TNSM_MAX_OPTIONS; i++) { - tns->tnsm.myOpt[i].state = TNOS_NO; - tns->tnsm.myOpt[i].wants = 0; - tns->tnsm.hisOpt[i].state = TNOS_NO; - tns->tnsm.hisOpt[i].wants = 0; - } - tns->tnsm.state = TNS_IDLE; -} - - -/*-----------------------------------------------------------------------------------*/ -/* - * Allocate a telnet session structure (including terminal state) - */ -/*-----------------------------------------------------------------------------------*/ -static struct telnet_state* -alloc_state() -{ - for (i=0; i < NUM_CONNS; i++) { - if (states[i].state == TTS_FREE) { - states[i].termstate = ctk_term_alloc_state(); - if (states[i].termstate != NULL) { - for (j = 0; j < TNQLEN; j++) { - states[i].sendq[j] = 0; - } - telnet_init(&states[i]); - states[i].state = TTS_IDLE; - return &(states[i]); - } - } - } - return NULL; -} - -/*-----------------------------------------------------------------------------------*/ -/* - * Free a telnet session structure (including terminal state) - */ -/*-----------------------------------------------------------------------------------*/ -static void -free_state(struct telnet_state* tns) -{ - if (tns != NULL) { - ctk_term_dealloc_state(tns->termstate); - tns->state = TTS_FREE; - } -} - -/*-----------------------------------------------------------------------------------*/ -/* - * A packet is successfully sent - */ -/*-----------------------------------------------------------------------------------*/ -static void -acked(struct telnet_state* tns) -{ - /* Were we sending a telnet option packet? */ - if (tns->state == TTS_SEND_TNDATA) { - /* Yes, free it and update queue */ - if (tns->sendq[0] != 0) { - memb_free(&telnetbuf, (char*)(tns->sendq[0])); - for (i=1; i < TNQLEN; i++) { - tns->sendq[i-1] = tns->sendq[i]; - } - tns->sendq[TNQLEN-1] = 0; - /* No options left. Go idle */ - if (tns->sendq[0] == 0) { - tns->state = TTS_IDLE; - } - } - } - /* Or were we sending application date ? */ - else if (tns->state == TTS_SEND_APPDATA) { - /* Inform application that data is sent successfully */ - ctk_term_sent(tns->termstate); - tns->state = TTS_IDLE; - } -} - -/*-----------------------------------------------------------------------------------*/ -/* - * Send data on a connections - */ -/*-----------------------------------------------------------------------------------*/ -static void -senddata(struct telnet_state* tns) -{ - /* Check if there are any option packets to send */ - if (tns->state == TTS_IDLE || tns->state == TTS_SEND_TNDATA) { - if (tns->sendq[0] != 0) { - tns->state = TTS_SEND_TNDATA; - uip_send(tns->sendq[0],3); - } - } - /* Check if terminal wants to send any data */ - if (tns->state == TTS_IDLE || tns->state == TTS_SEND_APPDATA) { - u16_t len = ctk_term_send(tns->termstate, (unsigned char*)uip_appdata, (unsigned short)uip_mss()); - if (len > 0) { - tns->state = TTS_SEND_APPDATA; - uip_send(uip_appdata, len); - } - } -} - -/*-----------------------------------------------------------------------------------*/ -/* - * uIP callback - */ -/*-----------------------------------------------------------------------------------*/ -static void -ctk_termtelnet_appcall(void *state) -{ - struct telnet_state *tns; - - tns = (struct telnet_state*)(state); - - if(uip_connected()) { - if(tns == NULL) { - tns = alloc_state(); - if(tns == NULL) { - uip_close(); - return; - } - tcp_markconn(uip_conn, (void *)tns); - } - /* Try to negotiate some options */ - EnableHisOpt(tns, TNO_SGA); - EnableMyOpt(tns,TNO_SGA); - EnableMyOpt(tns,TNO_ECHO); - /* Request update of screen */ - ctk_term_redraw(tns->termstate); - senddata(tns); - } else if(uip_closed() || uip_aborted()) { - free_state(tns); - return; - } - - if (uip_acked()) { - acked(tns); - } - - if (uip_newdata()) { - for(j = 0; j < uip_datalen(); j++) { - if (parse_input(tns, uip_appdata[j])) { - /* Pass it uppwards */ - ctk_term_input(tns->termstate, uip_appdata[j]); - } - } - } - - if(uip_rexmit() || - uip_newdata() || - uip_acked()) { - senddata(tns); - } else if(uip_poll()) { - if (tns->state == TTS_IDLE) { - senddata(tns); - } - } -} -/*-----------------------------------------------------------------------------------*/ -/* - * Init function - */ -/*-----------------------------------------------------------------------------------*/ -LOADER_INIT_FUNC(ctk_termtelnet_init, arg) -{ - arg_free(arg); - if(id == EK_ID_NONE) { - memb_init(&telnetbuf); - for (i=0; i < NUM_CONNS; i++) { - states[i].state = TTS_FREE; - } - id = ek_start(&p); - } -} -/*-----------------------------------------------------------------------------------*/ -EK_EVENTHANDLER(eventhandler, ev, data) -{ - if(ev == EK_EVENT_INIT) { - tcp_listen(UIP_HTONS(PORT)); - } else if(ev == tcpip_event) { - ctk_termtelnet_appcall(data); - } -} diff --git a/backyard/core/ctk/ctk-termtelnet.h b/backyard/core/ctk/ctk-termtelnet.h deleted file mode 100644 index ed2ac3db0..000000000 --- a/backyard/core/ctk/ctk-termtelnet.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * @(#)$Id: ctk-termtelnet.h,v 1.1 2007/05/26 21:46:28 oliverschmidt Exp $ - */ -#ifndef __CTK_TERMTELNET_H__ -#define __CTK_TERMTELNET_H__ - -void ctk_termtelnet_init(char *arg); - -#endif /* __CTK_TERMTELNET_H__ */ diff --git a/backyard/core/ctk/ctk-vncserver-service.c b/backyard/core/ctk/ctk-vncserver-service.c deleted file mode 100644 index f0e6b6279..000000000 --- a/backyard/core/ctk/ctk-vncserver-service.c +++ /dev/null @@ -1,1146 +0,0 @@ -/** - * \file - * The ctk-draw implementation for the CTK VNC server. - * \author Adam Dunkels - * - */ - -/** - * \defgroup CTKVNCServer The CTK VNC server - * @{ - */ - -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the "ctk" console GUI toolkit for cc65 - * - * $Id: ctk-vncserver-service.c,v 1.2 2010/10/19 18:29:03 adamdunkels Exp $ - * - */ - -#include "ctk/ctk.h" -#include "ctk-draw.h" -#include "ctk-draw-service.h" - -#include "contiki.h" - -#include "ek.h" -#include "loader.h" -#include "vnc-server.h" -#include "vnc-out.h" - -#include "ctk-vncfont.h" - -#include "ctk-vncserver.h" -#include "ctk-vncserver-conf.h" - -#include - -static unsigned char sizex, sizey; - -#define _CH_ULCORNER 0x00 -#define _CH_TITLEBAR 0x01 -#define _CH_URCORNER 0x02 -#define _CH_WINDOWRBORDER 0x03 -#define _CH_LRCORNER 0x04 -#define _CH_WINDOWLOWERBORDER 0x05 -#define _CH_LLCORNER 0x06 -#define _CH_WINDOWLBORDER 0x07 - -#define _CH_DIALOG_ULCORNER 0x12 -#define _CH_DIALOGUPPERBORDER 0x09 -#define _CH_DIALOG_URCORNER 0x0a -#define _CH_DIALOGRBORDER 0x0b -#define _CH_DIALOG_LRCORNER 0x0c -#define _CH_DIALOGLOWERBORDER 0x0d -#define _CH_DIALOG_LLCORNER 0x0e -#define _CH_DIALOGLBORDER 0x0f - -#define _CH_BUTTONLEFT 0x10 -#define _CH_BUTTONRIGHT 0x11 - -#define _CH_SEPARATOR 0x13 - -/*#include "libconio.h"*/ - -#define SCREENCOLOR 0 -#define BORDERCOLOR 1 - -#define WIDGETCOLOR 2 -#define WIDGETCOLOR_FWIN 3 -#define WIDGETCOLOR_FOCUS 4 -#define WIDGETCOLOR_DIALOG 5 -#define WIDGETCOLOR_HLINK 6 -#define WIDGETCOLOR_HLINK_FOCUS 7 - -#define WINDOWCOLOR 8 -#define WINDOWCOLOR_FOCUS 9 - -#define WINDOWBORDER 10 -#define WINDOWBORDER_FOCUS 11 - -#define DIALOGCOLOR 12 - -#define OPENMENUCOLOR 13 - -#define ACTIVEMENUITEMCOLOR 14 - -#define MENUCOLOR 15 - -/*static DISPATCHER_UIPCALL(ctk_vncserver_appcall, state); - -static struct dispatcher_proc p = - {DISPATCHER_PROC("CTK VNC server", NULL, NULL, - ctk_vncserver_appcall)}; - static ek_id_t id;*/ -EK_EVENTHANDLER(eventhandler, ev, data); -EK_PROCESS(p, "CTK VNC server", EK_PRIO_NORMAL, - eventhandler, NULL, NULL); -static ek_id_t id = EK_ID_NONE; - -static struct vnc_server_state conns[CTK_VNCSERVER_CONF_NUMCONNS]; - -#define PRINTF(x) - -#define revers(x) - -/*unsigned char ctk_draw_windowborder_height = 1; -unsigned char ctk_draw_windowborder_width = 1; -unsigned char ctk_draw_windowtitle_height = 1;*/ - - -/*-----------------------------------------------------------------------------------*/ -/** - * Add an update request from a client to the list of pending updates - * for the connection. - * - * This function is called from the vnc-out module. - * - * \param vs The VNC connection state. - * \param a The area that is requested to be updated. - */ -/*-----------------------------------------------------------------------------------*/ -void -vnc_server_update_add(struct vnc_server_state *vs, - struct vnc_server_update *a) -{ - /* XXX: test both head and tail placement!*/ - a->next = vs->updates_pending; - vs->updates_pending = a; -} -/*-----------------------------------------------------------------------------------*/ -/** - * Allocate an update request from the VNC connection state. - * - * This function is called from the vnc-out module. - * - * \param vs The VNC connection state. - * - * \return Memory for an update structure, or NULL if no update could - * be allocated. - */ -/*-----------------------------------------------------------------------------------*/ -struct vnc_server_update * -vnc_server_update_alloc(struct vnc_server_state *vs) -{ - struct vnc_server_update *a; - - a = vs->updates_free; - if(a == NULL) { - return NULL; - } - vs->updates_free = a->next; - a->next = NULL; - return a; -} -/*-----------------------------------------------------------------------------------*/ -/** - * Deallocate an update request from the VNC connection state. - * - * This function is called from the vnc-out module. - * - * \param vs The VNC connection state. - * - * \param a The update structure to be deallocated. - */ -/*-----------------------------------------------------------------------------------*/ -void -vnc_server_update_free(struct vnc_server_state *vs, - struct vnc_server_update *a) -{ - a->next = vs->updates_free; - vs->updates_free = a; -} -/*-----------------------------------------------------------------------------------*/ -/** - * Dequeue the first update on the queue of updates. - * - * This function is called from the vnc-out module. - * - * \param vs The VNC connection state. - * - * \return The first update on the queue, or NULL if the queue is empty. - */ -/*-----------------------------------------------------------------------------------*/ -struct vnc_server_update * -vnc_server_update_dequeue(struct vnc_server_state *vs) -{ - struct vnc_server_update *a; - - a = vs->updates_pending; - if(a == NULL) { - return a; - } - vs->updates_pending = a->next; - a->next = NULL; - return a; -} -/*-----------------------------------------------------------------------------------*/ -/** - * Remove a specific update on the queue of updates. - * - * \param vs The VNC connection state. - * \param a The update to be removed. - */ -/*-----------------------------------------------------------------------------------*/ -void -vnc_server_update_remove(struct vnc_server_state *vs, - struct vnc_server_update *a) -{ - struct vnc_server_update *b, *c; - - if(a == vs->updates_pending) { - vs->updates_pending = a->next; - } else { - b = vs->updates_pending; - for(c = vs->updates_pending; c != a; b = c, c = c->next); - - b->next = a->next; - } -} -/*-----------------------------------------------------------------------------------*/ -/** \internal - * Flag an area to be updated for all open VNC server connections. - * - */ -/*-----------------------------------------------------------------------------------*/ -static void -update_area(u8_t x, u8_t y, u8_t w, u8_t h) -{ - u8_t i; - - if(h == 0 || w == 0) { - return; - } - - /* Update for all active VNC connections. */ - for(i = 0; i < CTK_VNCSERVER_CONF_NUMCONNS; ++i) { - if(conns[i].state != VNC_DEALLOCATED) { - vnc_out_update_area(&conns[i], - x, y, w, h); - } - } - -} -/*-----------------------------------------------------------------------------------*/ -/** \internal - * Allocate a VNC server connection state from the array of available - * VNC connection states. - */ -/*-----------------------------------------------------------------------------------*/ -static struct vnc_server_state * -alloc_state(void) -{ - u8_t i; - for(i = 0; i < CTK_VNCSERVER_CONF_NUMCONNS; ++i) { - if(conns[i].state == VNC_DEALLOCATED) { - return &conns[i]; - } - } - - /* We are overloaded! XXX: we'll just kick all other connections! */ - for(i = 0; i < CTK_VNCSERVER_CONF_NUMCONNS; ++i) { - conns[i].state = VNC_DEALLOCATED; - } - - return NULL; -} -/*-----------------------------------------------------------------------------------*/ -/** \internal - * Deallocate a VNC connection state. - */ -/*-----------------------------------------------------------------------------------*/ -static void -dealloc_state(struct vnc_server_state *s) -{ - s->state = VNC_DEALLOCATED; -} -/*-----------------------------------------------------------------------------------*/ -static void -cputsn(char *str, unsigned char len) -{ - char c; - - while(len > 0) { - --len; - c = *str; - if(c == 0) { - break; - } - cputc(c); - ++str; - } -} -/*-----------------------------------------------------------------------------------*/ -/** - * Initialize the VNC ctk-draw module. Called by the CTK module. - * - */ -/*-----------------------------------------------------------------------------------*/ -static void -s_ctk_draw_init(void) -{ - bgcolor(SCREENCOLOR); - bordercolor(BORDERCOLOR); - screensize(&sizex, &sizey); - ctk_draw_clear(0, sizey); -} -/*-----------------------------------------------------------------------------------*/ -static void -draw_widget(register struct ctk_widget *w, - unsigned char x, unsigned char y, - unsigned char clipx, - unsigned char clipy, - unsigned char clipy1, unsigned char clipy2, - unsigned char focus) -{ - unsigned char xpos, ypos, xscroll; - unsigned char i, j; - unsigned char iconnum; - char c, *text; - unsigned char len; - - /* - if(focus & CTK_FOCUS_WINDOW) { - textcolor(WIDGETCOLOR_FWIN); - if(focus & CTK_FOCUS_WIDGET) { - textcolor(WIDGETCOLOR_FOCUS); - } - } else if(focus & CTK_FOCUS_DIALOG) { - textcolor(WIDGETCOLOR_DIALOG); - if(focus & CTK_FOCUS_WIDGET) { - textcolor(WIDGETCOLOR_FOCUS); - } - } else { - textcolor(WIDGETCOLOR); - } -*/ - xpos = x + w->x; - ypos = y + w->y; - - switch(w->type) { - case CTK_WIDGET_SEPARATOR: - textcolor(VNC_OUT_SEPARATORCOLOR + focus); - if(ypos >= clipy1 && ypos < clipy2) { - /* chlinexy(xpos, ypos, w->w);*/ - gotoxy(xpos, ypos); - for(i = 0; i < w->w; ++i) { - cputc(_CH_SEPARATOR); - } - } - break; - case CTK_WIDGET_LABEL: - textcolor(VNC_OUT_LABELCOLOR + focus); - text = w->widget.label.text; - for(i = 0; i < w->h; ++i) { - if(ypos >= clipy1 && ypos < clipy2) { - gotoxy(xpos, ypos); - cputsn(text, w->w); - if(w->w - (wherex() - xpos) > 0) { - cclear(w->w - (wherex() - xpos)); - } - } - ++ypos; - text += w->w; - } - break; - case CTK_WIDGET_BUTTON: - textcolor(VNC_OUT_BUTTONCOLOR + focus); - if(ypos >= clipy1 && ypos < clipy2) { - if(focus & CTK_FOCUS_WIDGET) { - revers(1); - } else { - revers(0); - } - cputcxy(xpos, ypos, _CH_BUTTONLEFT); - cputsn(w->widget.button.text, w->w); - cputc(_CH_BUTTONRIGHT); - revers(0); - } - break; - case CTK_WIDGET_HYPERLINK: - textcolor(VNC_OUT_HYPERLINKCOLOR + focus); - if(ypos >= clipy1 && ypos < clipy2) { - /* if(focus & CTK_FOCUS_WIDGET) { - textcolor(WIDGETCOLOR_HLINK_FOCUS); - revers(0); - } else { - textcolor(WIDGETCOLOR_HLINK); - revers(1); - }*/ - gotoxy(xpos, ypos); - cputsn(w->widget.button.text, w->w); - revers(0); - } - break; - case CTK_WIDGET_TEXTENTRY: - textcolor(VNC_OUT_TEXTENTRYCOLOR + focus); - text = w->widget.textentry.text; - if(focus & CTK_FOCUS_WIDGET) { - revers(1); - } else { - revers(0); - } - xscroll = 0; - if(w->widget.textentry.xpos >= w->w - 1) { - xscroll = w->widget.textentry.xpos - w->w + 1; - } - for(j = 0; j < w->h; ++j) { - if(ypos >= clipy1 && ypos < clipy2) { - if(w->widget.textentry.state == CTK_TEXTENTRY_EDIT && - w->widget.textentry.ypos == j) { - revers(0); - cputcxy(xpos, ypos, '>'); - c = 1; - for(i = 0; i < w->w; ++i) { - if(c != 0) { - c = text[i + xscroll]; - } - if(i == w->widget.textentry.xpos - xscroll) { - textcolor(VNC_OUT_TEXTENTRYCOLOR + (focus ^ 0x01)); - revers(1); - } else { - revers(0); - } - if(c == 0) { - cputc(' '); - } else { - cputc(c); - } - revers(0); - textcolor(VNC_OUT_TEXTENTRYCOLOR + focus); - } - cputc('<'); - } else { - cvlinexy(xpos, ypos, 1); - gotoxy(xpos + 1, ypos); - cputsn(text, w->w); - i = wherex(); - if(i - xpos - 1 < w->w) { - cclear(w->w - (i - xpos) + 1); - } - cvline(1); - } - } - ++ypos; - text += w->w; - } - revers(0); - break; -#if CTK_CONF_ICONS - case CTK_WIDGET_ICON: - if(ypos >= clipy1 && ypos < clipy2) { - textcolor(VNC_OUT_ICONCOLOR + focus); - if(focus & 1) { - revers(1); - } else { - revers(0); - } - - x = xpos; - len = strlen(w->widget.icon.title); - if(x + len >= sizex) { - x = sizex - len; - } - - gotoxy(x, ypos + 3); - if(ypos >= clipy1 && ypos < clipy2) { - cputs(w->widget.icon.title); - } - -#if CTK_CONF_ICON_BITMAPS - if(w->widget.icon.bitmap != NULL) { - iconnum = vnc_out_add_icon((struct ctk_icon *)w); - textcolor(iconnum | (focus << 6)); - gotoxy(xpos, ypos); - cputc(0x80); - cputc(0x81); - cputc(0x82); - cputc(0x83); - ++ypos; - gotoxy(xpos, ypos); - cputc(0x90); - cputc(0x91); - cputc(0x92); - cputc(0x93); - ++ypos; - gotoxy(xpos, ypos); - cputc(0xa0); - cputc(0xa1); - cputc(0xa2); - cputc(0xa3); - ++ypos; - textcolor(0); - /* for(i = 0; i < 3; ++i) { - - if(ypos >= clipy1 && ypos < clipy2) { - cputc(w->widget.icon.textmap[0 + 3 * i]); - cputc(w->widget.icon.textmap[1 + 3 * i]); - cputc(w->widget.icon.textmap[2 + 3 * i]); - } - ++ypos; - }*/ - } -#endif /* CTK_CONF_ICON_BITMAPS */ - - revers(0); - } - break; -#endif /* CTK_CONF_ICONS */ - - default: - break; - } -} -/*-----------------------------------------------------------------------------------*/ -/** - * Draw a widget on the VNC screen. Called by the CTK module. - * - * \param w The widget to be drawn. - * \param focus The focus of the widget. - * \param clipy1 The lower y coordinate bound. - * \param clipy2 The upper y coordinate bound. - */ -/*-----------------------------------------------------------------------------------*/ -static void -s_ctk_draw_widget(register struct ctk_widget *w, - unsigned char focus, - unsigned char clipy1, - unsigned char clipy2) -{ - struct ctk_window *win = w->window; - struct ctk_icon *icon; - unsigned char posx, posy, x, len; - - posx = win->x + 1; - posy = win->y + 2; - - if(w == win->focused) { - focus |= CTK_FOCUS_WIDGET; - } - - draw_widget(w, posx, posy, - posx + win->w, - posy + win->h, - clipy1, clipy2, - focus); - - if(w->type != CTK_WIDGET_ICON) { - update_area(posx + w->x, - posy + w->y, w->w + 2, w->h); - } else { - icon = (struct ctk_icon *)w; - - len = strlen(icon->title); - x = posx + w->x; - if(x + len >= sizex) { - x = sizex - len; - } - - update_area(x, posy + w->y, len > 4? len: 4, w->h); - } - -#ifdef CTK_CONIO_CONF_UPDATE - CTK_CONIO_CONF_UPDATE(); -#endif /* CTK_CONIO_CONF_UPDATE */ -} -/*-----------------------------------------------------------------------------------*/ -/** - * Clear a window on the VNC screen. Called by the CTK module. - * - * \param window The window to be cleared. - * \param focus The focus of the window. - * \param clipy1 The lower y coordinate bound. - * \param clipy2 The upper y coordinate bound. - */ -/*-----------------------------------------------------------------------------------*/ -static void -s_ctk_draw_clear_window(register struct ctk_window *window, - unsigned char focus, - unsigned char clipy1, - unsigned char clipy2) -{ - unsigned char i; - unsigned char h; - /* - if(focus & CTK_FOCUS_WINDOW){ - textcolor(WINDOWCOLOR_FOCUS); - } else { - textcolor(WINDOWCOLOR); - }*/ - textcolor(VNC_OUT_WINDOWCOLOR + focus); - - h = window->y + 2 + window->h; - /* Clear window contents. */ - for(i = window->y + 2; i < h; ++i) { - if(i >= clipy1 && i < clipy2) { - cclearxy(window->x + 1, i, window->w); - } - } - - update_area(window->x + 1, window->y + 2, window->w, window->h); -} -/*-----------------------------------------------------------------------------------*/ -static void -draw_window_contents(struct ctk_window *window, unsigned char focus, - unsigned char clipy1, unsigned char clipy2, - unsigned char x1, unsigned char x2, - unsigned char y1, unsigned char y2) -{ - struct ctk_widget *w; - unsigned char wfocus; - - /* Draw inactive widgets. */ - for(w = window->inactive; w != NULL; w = w->next) { - draw_widget(w, x1, y1, x2, y2, - clipy1, clipy2, - focus); - } - - /* Draw active widgets. */ - for(w = window->active; w != NULL; w = w->next) { - wfocus = focus; - if(w == window->focused) { - wfocus |= CTK_FOCUS_WIDGET; - } - - draw_widget(w, x1, y1, x2, y2, - clipy1, clipy2, - wfocus); - } - -#ifdef CTK_CONIO_CONF_UPDATE - CTK_CONIO_CONF_UPDATE(); -#endif /* CTK_CONIO_CONF_UPDATE */ - -} -/*-----------------------------------------------------------------------------------*/ -/** - * Draw a window on the VNC screen. Called by the CTK module. - * - * \param window The window to be drawn. - * \param focus The focus of the window. - * \param clipy1 The lower y coordinate bound. - * \param clipy2 The upper y coordinate bound. - */ -/*-----------------------------------------------------------------------------------*/ -static void -s_ctk_draw_window(register struct ctk_window *window, - unsigned char focus, - unsigned char clipy1, unsigned char clipy2) -{ - unsigned char x, y; - unsigned char h; - unsigned char x1, y1, x2, y2; - unsigned char i; - - - if(window->y + 1 >= clipy2) { - return; - } - - x = window->x; - y = window->y + 1; - - textcolor(VNC_OUT_WINDOWCOLOR + focus); - /* if(focus & CTK_FOCUS_WINDOW) { - textcolor(WINDOWCOLOR_FOCUS); - } else { - textcolor(WINDOWCOLOR); - }*/ - - x1 = x + 1; - y1 = y + 1; - x2 = x1 + window->w; - y2 = y1 + window->h; - - /* Draw window frame. */ - if(y >= clipy1) { - cputcxy(x, y, _CH_ULCORNER); - for(i = wherex() + window->titlelen + 2; i < x2; ++i) { - cputcxy(i, y, _CH_TITLEBAR); - } - cputcxy(x2, y, _CH_URCORNER); - } - - h = window->h; - - if(clipy1 > y1) { - if(clipy1 - y1 < h) { - h = clipy1 - y1; - y1 = clipy1; - } else { - h = 0; - } - } - - if(clipy2 < y1 + h) { - if(y1 >= clipy2) { - h = 0; - } else { - h = clipy2 - y1; - } - } - - for(i = y1; i < y1 + h; ++i) { - cputcxy(x, i, _CH_WINDOWLBORDER); - cputcxy(x2, i, _CH_WINDOWRBORDER); - } - - /* cvlinexy(x, y1, h); - cvlinexy(x2, y1, h); */ - - if(y + window->h >= clipy1 && - y + window->h < clipy2) { - cputcxy(x, y2, _CH_LLCORNER); - for(i = x1; i < x2; ++i) { - cputcxy(i, y2, _CH_WINDOWLOWERBORDER); - } - /* chlinexy(x1, y2, window->w);*/ - cputcxy(x2, y2, _CH_LRCORNER); - } - - draw_window_contents(window, focus & CTK_FOCUS_WINDOW, clipy1, clipy2, - x1, x2, y + 1, y2); - - update_area(window->x, window->y, window->w + 2, window->h + 2); -} -/*-----------------------------------------------------------------------------------*/ -/** - * Draw a dialog on the VNC screen. Called by the CTK module. - * - * \param dialog The dialog to be drawn. - */ -/*-----------------------------------------------------------------------------------*/ -static void -s_ctk_draw_dialog(register struct ctk_window *dialog) -{ - unsigned char x, y; - unsigned char i; - unsigned char x1, y1, x2, y2; - - /* textcolor(DIALOGCOLOR);*/ - textcolor(VNC_OUT_WINDOWCOLOR + CTK_FOCUS_DIALOG); - - x = dialog->x; - y = dialog->y + 1; - - - x1 = x + 1; - y1 = y + 1; - x2 = x1 + dialog->w; - y2 = y1 + dialog->h; - - - /* Draw dialog frame. */ - - for(i = y1; i < y1 + dialog->h; ++i) { - cputcxy(x, i, _CH_DIALOGLBORDER); - cputcxy(x2, i, _CH_DIALOGRBORDER); - } - /* cvlinexy(x, y1, - dialog->h); - cvlinexy(x2, y1, - dialog->h);*/ - - - for(i = x1; i < x2; ++i) { - cputcxy(i, y, _CH_DIALOGUPPERBORDER); - cputcxy(i, y2, _CH_DIALOGLOWERBORDER); - } - /* chlinexy(x1, y, - dialog->w); - chlinexy(x1, y2, - dialog->w);*/ - - cputcxy(x, y, _CH_DIALOG_ULCORNER); - cputcxy(x, y2, _CH_DIALOG_LLCORNER); - cputcxy(x2, y, _CH_DIALOG_URCORNER); - cputcxy(x2, y2, _CH_DIALOG_LRCORNER); - - - /* Clear dialog contents. */ - for(i = y1; i < y2; ++i) { - cclearxy(x1, i, dialog->w); - } - - draw_window_contents(dialog, CTK_FOCUS_DIALOG, 0, sizey, - x1, x2, y1, y2); - - update_area(dialog->x, dialog->y, dialog->w + 4, dialog->h + 4); -} -/*-----------------------------------------------------------------------------------*/ -/** - * Clear parts of the VNC desktop. Called by the CTK module. - * - * \param y1 The lower y coordinate bound. - * \param y2 The upped y coordinate bound. - */ -/*-----------------------------------------------------------------------------------*/ -static void -s_ctk_draw_clear(unsigned char y1, unsigned char y2) -{ - unsigned char i; - - textcolor(VNC_OUT_BACKGROUNDCOLOR); - for(i = y1; i < y2; ++i) { - cclearxy(0, i, sizex); - } - - update_area(0, y1, sizex, y2 - y1); -} -/*-----------------------------------------------------------------------------------*/ -/** \internal - * Draw one menu on the VNC desktop. - * - * \param m The CTK menu to be drawn. - */ -/*-----------------------------------------------------------------------------------*/ -static void -draw_menu(register struct ctk_menu *m) -{ - unsigned char x, x2, y; - - textcolor(VNC_OUT_MENUCOLOR); - x = wherex(); - cputs(m->title); - cputc(' '); - x2 = wherex(); - if(x + CTK_CONF_MENUWIDTH > sizex) { - x = sizex - CTK_CONF_MENUWIDTH; - } - - - for(y = 0; y < m->nitems; ++y) { - if(y == m->active) { - textcolor(VNC_OUT_ACTIVEMENUCOLOR); - revers(0); - } else { - textcolor(VNC_OUT_MENUCOLOR); - } - gotoxy(x, y + 1); - if(m->items[y].title[0] == '-') { - chline(CTK_CONF_MENUWIDTH); - } else { - cputs(m->items[y].title); - } - if(x + CTK_CONF_MENUWIDTH > wherex()) { - cclear(x + CTK_CONF_MENUWIDTH - wherex()); - } - revers(1); - } - - gotoxy(x2, 0); - textcolor(VNC_OUT_MENUCOLOR); - - update_area(x, 0, CTK_CONF_MENUWIDTH, m->nitems + 1); -} -/*-----------------------------------------------------------------------------------*/ -/** - * Draw the menus on the virtual VNC desktop. Called by the CTK module. - * - * \param menus The CTK menubar. - */ -/*-----------------------------------------------------------------------------------*/ -static void -s_ctk_draw_menus(register struct ctk_menus *menus) -{ - struct ctk_menu *m; - - - /* Draw menus */ - textcolor(VNC_OUT_MENUCOLOR); - gotoxy(0, 0); - revers(1); - cputc(' '); - for(m = menus->menus->next; m != NULL; m = m->next) { - if(m != menus->open) { - update_area(wherex(), 0, strlen(m->title) + 1, 1); - cputs(m->title); - cputc(' '); - } else { - draw_menu(m); - } - } - - - if(wherex() + strlen(menus->desktopmenu->title) + 1>= sizex) { - gotoxy(sizex - strlen(menus->desktopmenu->title) - 1, 0); - } else { - cclear(sizex - wherex() - - strlen(menus->desktopmenu->title) - 1); - update_area(wherex(), 0, sizex - wherex() - - strlen(menus->desktopmenu->title) - 1, 1); - } - - /* Draw desktopmenu */ - if(menus->desktopmenu != menus->open) { - update_area(wherex(), 0, strlen(menus->desktopmenu->title) + 1, 1); - cputs(menus->desktopmenu->title); - cputc(' '); - } else { - draw_menu(menus->desktopmenu); - } - - revers(0); - - - -} -/*-----------------------------------------------------------------------------------*/ -/** - * Obtain the height of the VNC desktop. Called by the CTK module. - * - * \return The height of the VNC desktop, in characters. - */ -/*-----------------------------------------------------------------------------------*/ -static unsigned char -s_ctk_draw_height(void) -{ - return sizey; -} -/*-----------------------------------------------------------------------------------*/ -/** - * Obtain the height of the VNC desktop. Called by the CTK module. - * - * \return The height of the VNC desktop, in characters. - */ -/*-----------------------------------------------------------------------------------*/ -static unsigned char -s_ctk_draw_width(void) -{ - return sizex; -} -/*-----------------------------------------------------------------------------------*/ -static unsigned short -s_ctk_mouse_xtoc(unsigned short x) -{ - return x / CTK_VNCFONT_WIDTH; -} -/*-----------------------------------------------------------------------------------*/ -static unsigned short -s_ctk_mouse_ytoc(unsigned short y) -{ - return y / CTK_VNCFONT_HEIGHT; -} -/*-----------------------------------------------------------------------------------*/ -/** \internal - * Converts between ASCII and the VNC screen character encoding. - */ -/*-----------------------------------------------------------------------------------*/ -static unsigned char -ascii2screen(unsigned char c) -{ - if(c == '|') { - return 0x68; - } - if(c < 0x20) { - return c + 0x60; - } - if(c > 0x20 && c < 0x40) { - return c; - } - if(c >= 0x40 && c < 0x60) { - return c; - } - if(c >= 0x60 && c < 0x80) { - return c - 0x60; - } - if(c >= 0x80) { - return c; - } - - return 32; -} -/*-----------------------------------------------------------------------------------*/ -/** - * Draws a character on the virtual VNC screen. Called by the libconio module. - * - * \param c The character to be drawn. - * \param xpos The x position of the character. - * \param ypos The y position of the character. - * \param reversedflag Determines if the character should be reversed or not. - * \param color The color of the character. - */ -/*-----------------------------------------------------------------------------------*/ -void -ctk_arch_draw_char(char c, - unsigned char xpos, - unsigned char ypos, - unsigned char reversedflag, - unsigned char color) -{ - - vnc_out_update_screen(xpos, ypos, ascii2screen(c), - color); - /* vnc_out_update_screen(xpos, ypos, c | - (reversedflag? 0x80: 0));*/ -} -/*-----------------------------------------------------------------------------------*/ -/** - * Checks the key press input queue to see if there are pending - * keys. Called by the CTK module. - * - * \return Zero if no key presses are in buffer, non-zero if there are - * key presses in input buffer. - */ -/*-----------------------------------------------------------------------------------*/ -/*unsigned char -ctk_arch_keyavail(void) -{ - return vnc_out_keyavail(); -}*/ -/*-----------------------------------------------------------------------------------*/ -/** - * Retrieves key presses from the VNC client. Called by the CTK - * module. - * - * \return The next key in the input queue. - */ -/*-----------------------------------------------------------------------------------*/ -/*ctk_arch_key_t -ctk_arch_getkey(void) -{ - return vnc_out_getkey() & 0x7f; -}*/ -/*-----------------------------------------------------------------------------------*/ -/** \internal - * The uIP event handler. - */ -/*-----------------------------------------------------------------------------------*/ -void -ctk_vncserver_appcall(void *state) -{ - static struct vnc_server_state *vs; - - vs = (struct vnc_server_state *)(state); - - if(uip_connected()) { - - /* Since we've just been connected, the state pointer should be - NULL and we need to allocate a new state object. If we have run - out of memory for state objects, we'll have to abort the - connection and return. */ - if(vs == NULL) { - vs = alloc_state(); - if(vs == NULL) { - uip_close(); - return; - } - tcp_markconn(uip_conn, (void *)vs); - } - } else if(uip_closed() || uip_aborted()) { - if(vs != NULL) { - dealloc_state(vs); - } - return; - } - vnc_server_appcall(vs); -} -/*-----------------------------------------------------------------------------------*/ - -static const struct ctk_draw_service_interface interface = - {CTK_DRAW_SERVICE_VERSION, - 1, - 1, - 1, - s_ctk_draw_init, - s_ctk_draw_clear, - s_ctk_draw_clear_window, - s_ctk_draw_window, - s_ctk_draw_dialog, - s_ctk_draw_widget, - s_ctk_draw_menus, - s_ctk_draw_width, - s_ctk_draw_height, - s_ctk_mouse_xtoc, - s_ctk_mouse_ytoc, - }; - -EK_EVENTHANDLER(eventhandler, ev, data); -EK_PROCESS(proc, CTK_DRAW_SERVICE_NAME ": VNC", EK_PRIO_NORMAL, - eventhandler, NULL, (void *)&interface); - -/*--------------------------------------------------------------------------*/ -LOADER_INIT_FUNC(ctk_vncserver_service_init, arg) -{ - arg_free(arg); - ek_service_start(CTK_DRAW_SERVICE_NAME, &proc); -} -/*--------------------------------------------------------------------------*/ -EK_EVENTHANDLER(eventhandler, ev, data) -{ - unsigned char i; - EK_EVENTHANDLER_ARGS(ev, data); - - switch(ev) { - case EK_EVENT_INIT: - case EK_EVENT_REPLACE: - tcp_listen(UIP_HTONS(5900)); - - for(i = 0; i < CTK_VNCSERVER_CONF_NUMCONNS; ++i) { - conns[i].state = VNC_DEALLOCATED; - } - ctk_restore(); - break; - case EK_EVENT_REQUEST_REPLACE: - ek_replace((struct ek_proc *)data, NULL); - LOADER_UNLOAD(); - break; - default: - if(ev == tcpip_event) { - ctk_vncserver_appcall(data); - } - } -} -/*--------------------------------------------------------------------------*/ - -void c80col_init(void) {} -/** @} */ diff --git a/backyard/core/dev/cc2420.c b/backyard/core/dev/cc2420.c deleted file mode 100644 index d5726fe8b..000000000 --- a/backyard/core/dev/cc2420.c +++ /dev/null @@ -1,668 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * @(#)$Id: cc2420.c,v 1.1 2008/02/24 22:29:08 adamdunkels Exp $ - */ -/* - * This code is almost device independent and should be easy to port. - */ - -#include -#include -#include - -#if defined(__AVR__) -#include -#elif defined(__MSP430__) -#include -#endif - -#include "contiki.h" - -#include "net/uip.h" -#include "net/uip-fw.h" -#define BUF ((struct uip_tcpip_hdr *)&uip_buf[UIP_LLH_LEN]) - -#include "dev/leds.h" - -#include "dev/spi.h" -#include "dev/cc2420.h" -#include "dev/cc2420_const.h" - -#define NDEBUG -#include "lib/assert.h" - -#ifdef NDEBUG -#define PRINTF(...) do {} while (0) -#else -#define PRINTF(...) printf(__VA_ARGS__) -#endif - -PROCESS(cc2420_process, "CC2420 driver"); -PROCESS(cc2420_retransmit_process, "CC2420 retransmit process"); - -int cc2420_resend(void); /* Not yet exported. */ - -static void neigbour_update(u16_t mac, int retransmissions); - -signed char cc2420_last_rssi; -u8_t cc2420_last_correlation; -u8_t cc2420_is_input; - -static u8_t receive_on; - -volatile u8_t cc2420_ack_received; /* Naive ACK management. */ -static u8_t last_used_seq; -static u16_t last_dst; - -/* Radio stuff in network byte order. */ -static u16_t pan_id; - -unsigned -cc2420_getreg(enum cc2420_register regname) -{ - unsigned reg; - int s = splhigh(); - FASTSPI_GETREG(regname, reg); - splx(s); - return reg; -} - -void -cc2420_setreg(enum cc2420_register regname, unsigned value) -{ - int s = splhigh(); - FASTSPI_SETREG(regname, value); - splx(s); -} - -void -cc2420_strobe(enum cc2420_register regname) -{ - int s = splhigh(); - FASTSPI_STROBE(regname); - splx(s); -} - -unsigned -cc2420_status(void) -{ - u8_t status; - int s = splhigh(); - FASTSPI_UPD_STATUS(status); - splx(s); - return status; -} - -#define AUTOACK (1 << 4) -#define RXFIFO_PROTECTION (1 << 9) -#define CORR_THR(n) (((n) & 0x1f) << 6) -#define FIFOP_THR(n) ((n) & 0x7f) -#define RXBPF_LOCUR (1 << 13); - -void -cc2420_init(void) -{ - u16_t reg; - { - int s = splhigh(); - __cc2420_arch_init(); /* Initalize ports and SPI. */ - DISABLE_FIFOP_INT(); - FIFOP_INT_INIT(); - splx(s); - } - - /* Turn on voltage regulator and reset. */ - SET_VREG_ACTIVE(); - //clock_delay(250); OK - SET_RESET_ACTIVE(); - clock_delay(127); - SET_RESET_INACTIVE(); - //clock_delay(125); OK - - - /* Turn on the crystal oscillator. */ - cc2420_strobe(CC2420_SXOSCON); - - /* Turn on automatic packet acknowledgment. */ - reg = cc2420_getreg(CC2420_MDMCTRL0); - reg |= AUTOACK; - cc2420_setreg(CC2420_MDMCTRL0, reg); - - /* Change default values as recomended in the data sheet, */ - /* correlation threshold = 20, RX bandpass filter = 1.3uA. */ - cc2420_setreg(CC2420_MDMCTRL1, CORR_THR(20)); - reg = cc2420_getreg(CC2420_RXCTRL1); - reg |= RXBPF_LOCUR; - cc2420_setreg(CC2420_RXCTRL1, reg); - - /* Set the FIFOP threshold to maximum. */ - cc2420_setreg(CC2420_IOCFG0, FIFOP_THR(127)); - - /* Turn off "Security enable" (page 32). */ - reg = cc2420_getreg(CC2420_SECCTRL0); - reg &= ~RXFIFO_PROTECTION; - cc2420_setreg(CC2420_SECCTRL0, reg); - - cc2420_set_chan_pan_addr(11, 0xffff, 0x0000, NULL); -} - -int -cc2420_send_data_ack(u16_t mac) -{ - struct hdr_802_15 h; - - PRINTF("send_data_ack to %u.%u\n", mac & 0xff, mac >> 8); - - h.len = MAC_HDR_LEN + 2; /* Including footer[2]. */ - h.fc0 = FC0_TYPE_DATA | FC0_INTRA_PAN; - h.fc1 = FC1_DST_16 | FC1_SRC_16; - - h.src = uip_hostaddr.u16[1]; - h.dst = mac; - - return cc2420_send(&h, 10, NULL, 0); -} - -int -cc2420_send(struct hdr_802_15 *hdr, u8_t hdr_len, - const u8_t *payload, u8_t payload_len) -{ - u8_t spiStatusByte; - int s; - - /* struct hdr_802_15::len shall *not* be counted, thus the -1. - * 2 == sizeof(footer). - */ - if (((hdr_len - 1) + payload_len + 2) > MAX_PACKET_LEN) - return -1; - - /* This code uses the CC2420 CCA (Clear Channel Assessment) to - * implement Carrier Sense Multiple Access with Collision Avoidance - * (CSMA-CA) and requires the receiver to be enabled and ready. - */ - if (!receive_on) - return -2; - - /* Wait for previous transmission to finish and RSSI. */ - do { - spiStatusByte = cc2420_status(); - if (!(spiStatusByte & BV(CC2420_RSSI_VALID))) /* RSSI needed by CCA */ - continue; - } while (spiStatusByte & BV(CC2420_TX_ACTIVE)); - - hdr->dst_pan = pan_id; /* Not at fixed position! xxx/bg */ - last_dst = hdr->dst; /* Not dst either. */ - last_used_seq++; - hdr->seq = last_used_seq; - cc2420_ack_received = 0; - - /* Write packet to TX FIFO, appending FCS if AUTOCRC is enabled. */ - cc2420_strobe(CC2420_SFLUSHTX); /* Cancel send that never started. */ - s = splhigh(); - FASTSPI_WRITE_FIFO(hdr, hdr_len); - FASTSPI_WRITE_FIFO(payload, payload_len); - splx(s); - - /* Send stuff from FIFO now! */ - process_post_synch(&cc2420_retransmit_process, PROCESS_EVENT_MSG, NULL); - - return UIP_FW_OK; -} - -/* - * Request packet to be sent using CSMA-CA. Requires that RSSI is - * valid. - * - * Return UIP_FW_DROPPED on failure. - */ -int -cc2420_resend(void) -{ - unsigned i; - - if (FIFOP_IS_1 && !FIFO_IS_1) { - process_poll(&cc2420_process); - PRINTF("rxfifo overflow!\n"); - } - - /* The TX FIFO can only hold one packet! Make sure to not overrun - * FIFO by waiting for transmission to start here and synchronizing - * with the CC2420_TX_ACTIVE check in cc2420_send. - * - * Note that we may have to wait up to 320 us (20 symbols) before - * transmission starts. - */ -#ifdef TMOTE_SKY -#define LOOP_20_SYMBOLS 100 /* 326us (msp430 @ 2.4576MHz) */ -#elif __AVR__ -#define LOOP_20_SYMBOLS 500 /* XXX */ -#endif - if (CCA_IS_1) { - cc2420_strobe(CC2420_STXONCCA); - for (i = LOOP_20_SYMBOLS; i > 0; i--) - if (SFD_IS_1) { - if (cc2420_status() & BV(CC2420_TX_ACTIVE)) - return UIP_FW_OK; /* Transmission has started. */ - else - break; /* We must be receiving. */ - } - } - - return UIP_FW_DROPPED; /* Transmission never started! */ -} - -void -cc2420_off(void) -{ - u8_t spiStatusByte; - - if (receive_on == 0) - return; - receive_on = 0; - /* Wait for transmission to end before turning radio off. */ - do { - spiStatusByte = cc2420_status(); - } while (spiStatusByte & BV(CC2420_TX_ACTIVE)); - - cc2420_strobe(CC2420_SRFOFF); - DISABLE_FIFOP_INT(); -} - -void -cc2420_on(void) -{ - if (receive_on) - return; - receive_on = 1; - - cc2420_strobe(CC2420_SRXON); - cc2420_strobe(CC2420_SFLUSHRX); - ENABLE_FIFOP_INT(); -} - -void -cc2420_set_chan_pan_addr(unsigned channel, /* 11 - 26 */ - unsigned pan, - unsigned addr, - const u8_t *ieee_addr) -{ - /* - * Subtract the base channel (11), multiply by 5, which is the - * channel spacing. 357 is 2405-2048 and 0x4000 is LOCK_THR = 1. - */ - u8_t spiStatusByte; - u16_t f = channel; - int s; - - f = 5*(f - 11) + 357 + 0x4000; - /* - * Writing RAM requires crystal oscillator to be stable. - */ - do { - spiStatusByte = cc2420_status(); - } while (!(spiStatusByte & (BV(CC2420_XOSC16M_STABLE)))); - - pan_id = pan; - cc2420_setreg(CC2420_FSCTRL, f); - s = splhigh(); - FASTSPI_WRITE_RAM_LE(&pan, CC2420RAM_PANID, 2, f); - FASTSPI_WRITE_RAM_LE(&addr, CC2420RAM_SHORTADDR, 2, f); - if (ieee_addr != NULL) - FASTSPI_WRITE_RAM_LE(ieee_addr, CC2420RAM_IEEEADDR, 8, f); - splx(s); -} - -static volatile u8_t rx_fifo_remaining_bytes; -static struct hdr_802_15 h; - -/* - * Interrupt either leaves frame intact in FIFO or reads *only* the - * MAC header and sets rx_fifo_remaining_bytes. - * - * In order to quickly empty the FIFO ack processing is done at - * interrupt priority rather than poll priority. - */ -int -__cc2420_intr(void) -{ - u8_t length; - const u8_t *const ack_footer = (u8_t *)&h.dst_pan; - - CLEAR_FIFOP_INT(); - - if (spi_busy || rx_fifo_remaining_bytes > 0) { - /* SPI bus hardware is currently used elsewhere (UART0 or I2C bus) - * or we already have a packet in the works and will have to defer - * interrupt processing of this packet in a fake interrupt. - */ - process_poll(&cc2420_process); - return 1; - } - - FASTSPI_READ_FIFO_BYTE(length); - if (length > MAX_PACKET_LEN) { - /* Oops, we must be out of sync. */ - FASTSPI_STROBE(CC2420_SFLUSHRX); - FASTSPI_STROBE(CC2420_SFLUSHRX); - return 0; - } - - h.len = length; - - if (length < ACK_PACKET_LEN) { - FASTSPI_READ_FIFO_GARBAGE(length); /* Rubbish */ - return 0; - } - - FASTSPI_READ_FIFO_NO_WAIT(&h.fc0, 5); /* fc0, fc1, seq, dst_pan */ - - /* Is this an ACK packet? */ - if (length == ACK_PACKET_LEN && (h.fc0 & FC0_TYPE_MASK) == FC0_TYPE_ACK) { - if (ack_footer[1] & FOOTER1_CRC_OK) { - if (h.seq == last_used_seq) { /* Matching ACK number? */ - cc2420_ack_received = 1; - process_poll(&cc2420_retransmit_process); -#if 0 - cc2420_last_rssi = ack_footer[0]; - cc2420_last_correlation = ack_footer[1] & FOOTER1_CORRELATION; -#endif - } - } - return 1; - } - - if (length < (MAC_HDR_LEN + 2)) { - FASTSPI_READ_FIFO_GARBAGE(length - 5); - return 0; - } - - FASTSPI_READ_FIFO_NO_WAIT(&h.dst, 4); /* dst and src */ - - /* The payload and footer is now left in the RX FIFO and will be - * picked up asynchronously at poll priority in the cc2420_process - * below. - */ - rx_fifo_remaining_bytes = length - MAC_HDR_LEN; - process_poll(&cc2420_process); - return 1; -} - -PROCESS_THREAD(cc2420_process, ev, data) -{ - PROCESS_BEGIN(); - - process_start(&cc2420_retransmit_process, NULL); - - while (1) { - unsigned len; - int s; - - PROCESS_YIELD(); - - len = rx_fifo_remaining_bytes; - if (len > 0) { - /* Read payload and two bytes of footer */ - if ((len - 2) > (UIP_BUFSIZE - UIP_LLH_LEN) || len < 2) { - PRINTF("cc2420_process too big len=%d\n", len); - s = splhigh(); - FASTSPI_READ_FIFO_GARBAGE(len); - rx_fifo_remaining_bytes = 0; /* RX FIFO emptied! */ - splx(s); - len = 0; - } else { - u8_t footer[2]; - uip_len = 0; - s = splhigh(); - if (len > 2) - FASTSPI_READ_FIFO_NO_WAIT(&uip_buf[UIP_LLH_LEN], len - 2); - FASTSPI_READ_FIFO_NO_WAIT(footer, 2); - rx_fifo_remaining_bytes = 0; /* RX FIFO emptied! */ - splx(s); - if (footer[1] & FOOTER1_CRC_OK) { - cc2420_last_rssi = footer[0]; - cc2420_last_correlation = footer[1] & FOOTER1_CORRELATION; - if ((h.fc0 & FC0_TYPE_MASK) == FC0_TYPE_DATA) - uip_len = len - 2; - } - } - } - - if (len == 2) - PRINTF("recv data_ack\n"); - - /* Clean up in case of FIFO overflow! This happens for every full - * length frame and is signaled by FIFOP = 1 and FIFO = 0. - */ - if (FIFOP_IS_1 && !FIFO_IS_1) { - cc2420_strobe(CC2420_SFLUSHRX); - cc2420_strobe(CC2420_SFLUSHRX); - } - - if (FIFOP_IS_1) { - s = splhigh(); - __cc2420_intr(); /* Fake interrupt! */ - splx(s); - } - - if (len == 2) { /* A DATA ACK packet. */ - if (last_dst == h.src) - cc2420_ack_received = 1; - neigbour_update(h.src, 0); - } else if (len > 2 && uip_len > 0 - && uip_len == (((u16_t)(BUF->len[0]) << 8) + BUF->len[1])) { - /* - * If we are the unique receiver send DATA ACK. - */ - if (h.dst == 0xffff - && uip_ipaddr_cmp(&BUF->destipaddr, &uip_hostaddr)) - cc2420_send_data_ack(h.src); - leds_toggle(LEDS_GREEN); - cc2420_is_input = 1; - tcpip_input(); - cc2420_is_input = 0; - leds_toggle(LEDS_GREEN); - } - } - - PROCESS_END(); -} - -unsigned neigbour_find(u16_t mac); - -/* Must be atleast 2 ticks and larger than 4ms. */ -#define RETRANSMIT_TIMEOUT 2 /* 31.25ms @ 64Hz */ -#define MAX_RETRANSMISSIONS 3 - -PROCESS_THREAD(cc2420_retransmit_process, ev, data) -{ - static char n; - static struct etimer etimer; - - switch (ev) { - default: - case PROCESS_EVENT_INIT: - return PT_WAITING; - - case PROCESS_EVENT_EXIT: - return PT_ENDED; - - case PROCESS_EVENT_POLL: /* Cancel future retransmissions. */ - etimer_stop(&etimer); - neigbour_update(last_dst, n); - return PT_WAITING; - - case PROCESS_EVENT_MSG: /* Send new packet. */ - n = -1; - - /* FALLTHROUGH */ - case PROCESS_EVENT_TIMER: - if (last_dst == 0xffff) { - n++; - clock_delay(1 + (rand() & (2048 - 1))); - if (cc2420_resend() == UIP_FW_OK) { - PRINTF("REBCAST %d\n", n); - return PT_WAITING; /* Final transmission attempt. */ - } - } else { - if (cc2420_resend() == UIP_FW_OK) { - n++; - PRINTF("RETRANS %d to %d.%d\n", n, last_dst & 0xff, last_dst >> 8); - } - if (n == MAX_RETRANSMISSIONS) { - neigbour_update(last_dst, n); - return PT_WAITING; /* Final transmission attempt. */ - } - } - /* - * Schedule retransmission. - */ - etimer_set(&etimer, RETRANSMIT_TIMEOUT); - return PT_WAITING; - } - /* NOTREACHED */ -} - -/* - * Retransmissions are negexp(alfa=0.5) weighted and stored as 4-bit - * fixnums with 2 binals (binary decimals). - */ -#define SCALE_RETRANS 4 -#define SCALE_RETRANS_THRESHOLD (3*4) -#define MAX_SCALE_RETRANS 15 - -/* - * Expiration timestamps are 4-bits wide, in units of 2 seconds, and - * relative to cc2420_check_remote::toff. - */ -#define SCALE_DIV_EXPIRE 2 -#define MAX_EXPIRE 15 /* 30 seconds */ -#define AGE_INTERVAL 5 /* 10 seconds */ - -struct cc2420_neigbour neigbours[NNEIGBOURS]; - -/* - * Double hash into 3 different positions using a constand step. If we - * don't find a match, return a pointer to the oldest entry and use - * this position for insertion. - */ -static struct cc2420_neigbour * -lookup(unsigned mac) -{ - unsigned h = (mac + (mac>>8)) % NNEIGBOURS; -#define next(h) (h += step, (h >= NNEIGBOURS) ? (h - NNEIGBOURS) : h) - - if (neigbours[h].mac == mac) /* FOUND1 */ - return &neigbours[h]; - else { - unsigned minexp = h; - const unsigned step = ((mac>>9)&0x3) + 1; - - h = next(h); - if (neigbours[h].mac == mac) /* FOUND2 */ - return &neigbours[h]; - else { - if (neigbours[h].expire < neigbours[minexp].expire) minexp = h; - h = next(h); - if (neigbours[h].mac == mac) /* FOUND3 */ - return &neigbours[h]; - else { - if (neigbours[h].expire < neigbours[minexp].expire) minexp = h; - return &neigbours[minexp]; - } - } - } -} - -static void -neigbour_update(u16_t mac, int nretrans) -{ - struct cc2420_neigbour *t; - - /* Always scale nretrans by constant factor. */ - if (nretrans == MAX_RETRANSMISSIONS) - nretrans = MAX_SCALE_RETRANS; - else - nretrans *= SCALE_RETRANS; /* xxx/bg overflow! */ - - t = lookup(mac); - if (t->mac != mac) { - t->mac = mac; - t->nretrans = nretrans; - } else { - if ((t->nretrans + nretrans)/2 > MAX_SCALE_RETRANS) - t->nretrans = MAX_SCALE_RETRANS; - else - t->nretrans = (t->nretrans + nretrans)/2; - } - t->expire = MAX_EXPIRE; - return; -} - -void -cc2420_recv_ok(uip_ipaddr_t *from) -{ - neigbour_update(from->u16[1], 0); -} - -/* - * +1: remote - * 0: local - * -1: unknown - */ -int -cc2420_check_remote(u16_t mac) -{ - struct cc2420_neigbour *t; - - /* - * Age neigbour table every 5*SCALE_DIV_EXPIRE=10 seconds. - */ - static clock_time_t toff; - unsigned now = ((clock_time() - toff)/CLOCK_SECOND)/SCALE_DIV_EXPIRE; - if (now >= AGE_INTERVAL) { - unsigned i; - - for (i = 0; i < NNEIGBOURS; i++) - if (neigbours[i].expire >= now) - neigbours[i].expire -= now; - else - neigbours[i].mac = 0xffff; /* expired! */ - toff = clock_time(); - } - - t = lookup(mac); - if (t->mac != mac) - return REMOTE_MAYBE; /* unknown */ - else if (t->nretrans >= SCALE_RETRANS_THRESHOLD) - return REMOTE_YES; /* remote */ - else - return REMOTE_NO; /* local */ -} diff --git a/backyard/core/dev/cc2420.h b/backyard/core/dev/cc2420.h deleted file mode 100644 index 143a6063f..000000000 --- a/backyard/core/dev/cc2420.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * @(#)$Id: cc2420.h,v 1.1 2008/02/24 22:29:08 adamdunkels Exp $ - */ - -#ifndef CC2420_H -#define CC2420_H - -#define MAX_PACKET_LEN 127 -#define ACK_PACKET_LEN 5 - -/* fc0 */ -#define FC0_TYPE_MASK 0x07 /* bit0-2 */ -#define FC0_TYPE_BEACON 0x00 /* bit0-2 */ -#define FC0_TYPE_DATA 0x01 /* bit0-2 */ -#define FC0_TYPE_ACK 0x02 /* bit0-2 */ -#define FC0_TYPE_MAC_CMD 0x03 /* bit0-2 */ -/* reserved 0x04-0x07 */ - -#define FC0_SECURE 0x08 /* bit3 */ -#define FC0_PENDING 0x10 /* bit4 */ -#define FC0_REQ_ACK 0x20 /* bit5 */ -#define FC0_INTRA_PAN 0x40 /* bit6 */ -/* reserved 0x80 bit7 */ - -/* fc1 */ -/* reserved 0x80 bit8-9 */ -#define FC1_DST_MASK 0x0c /* bit10-11 */ -#define FC1_DST_0 0x00 /* bit10-11 */ -#define FC1_DST_16 0x08 /* bit10-11 */ -#define FC1_DST_64 0x0c /* bit10-11 */ - -/* reserved 0x80 bit12-13 */ -#define FC1_SRC_MASK 0xc0 /* bit14-15 */ -#define FC1_SRC_0 0x00 /* bit14-15 */ -#define FC1_SRC_16 0x80 /* bit14-15 */ -#define FC1_SRC_64 0xc0 /* bit14-15 */ - -/* footer[0] == RSSI, footer[1] == ... */ -#define FOOTER1_CRC_OK 0x80 -#define FOOTER1_CORRELATION 0x7f - -/* The hdr_802_15::len byte does not count!!! */ -#define MAC_HDR_LEN (2 + 1 + 2 + 2 + 2) - -struct hdr_802_15 { - u8_t len; /* Not part of MAC header!!! */ - u8_t fc0; - u8_t fc1; - u8_t seq; - u16_t dst_pan; /* also u8_t ack_footer[2] */ - u16_t dst; - /* optional src_pan */ - u16_t src; - /* u8_t payload[uip_len] */ - /* u8_t footer[2] */ - /* no more */ -}; - -struct hdr_802_15_ack { - u8_t len; - u8_t fc0; - u8_t fc1; - u8_t seq; - u8_t footer[2]; - /* no more */ -}; - -struct cc2420_neigbour { - unsigned mac:16, nretrans:4, expire:4; /* expiration time */ -#if 0 - unsigned rssi:6, correlation:6; -#endif -}; - -#define NNEIGBOURS 16 -extern struct cc2420_neigbour neigbours[NNEIGBOURS]; - -PROCESS_NAME(cc2420_process); - -extern struct uip_fw_netif cc2420if; - -extern signed char cc2420_last_rssi; -extern u8_t cc2420_last_correlation; -extern u8_t cc2420_is_input; -extern volatile u8_t cc2420_ack_received; - -void cc2420_init(void); -void cc2420_set_chan_pan_addr(unsigned channel, unsigned pan, - unsigned addr, const u8_t *ieee_addr); -void cc2420_on(void); -void cc2420_off(void); - -u8_t cc2420_send_ip(void); -u8_t cc2420_send_uaodv(void); -int cc2420_send(struct hdr_802_15 *hdr, u8_t hdr_len, - const u8_t *p, u8_t p_len); - -/* Called at poll priority. */ -void cc2420_input(const struct hdr_802_15 *hdr, u8_t hdr_len, - const u8_t *payload, u8_t payload_len); - -/* Is mac far away? remote=1, local=0, don't know=-1. */ -enum { REMOTE_MAYBE = -1, REMOTE_NO = 0, REMOTE_YES = 1 }; -int cc2420_check_remote(u16_t mac); -void cc2420_recv_ok(uip_ipaddr_t *from); - -/* - * Machine dependent initialization function and an interrupt service - * routine must be provided externally. Call cc2420_intr from the - * interrupt service routine. - */ -void __cc2420_arch_init(void); -int __cc2420_intr(void); - -#endif /* CC2420_H */ diff --git a/backyard/core/dev/cs8900a.c b/backyard/core/dev/cs8900a.c deleted file mode 100644 index 749ae566a..000000000 --- a/backyard/core/dev/cs8900a.c +++ /dev/null @@ -1,314 +0,0 @@ -/* UNFINISHED CODE: the code works, but has yet to be converted into - proper C code. It is mostly 6502 assembler for now. */ - -/* - * Copyright (c) 2001, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the C64 RealAudio server demo project. - * - * $Id: cs8900a.c,v 1.1 2007/05/26 22:00:33 oliverschmidt Exp $ - * - */ - -/* cs8900a.c: device driver for the CS8900a chip in 8-bit mode. Mostly - written in 6502 assembler for speed. */ - -#include "cs8900a.h" -#include "uip.h" -#include "uip_arp.h" - -#define UIP_ETHADDR0 0x00 -#define UIP_ETHADDR1 0x00 -#define UIP_ETHADDR2 0x00 -#define UIP_ETHADDR3 0x64 -#define UIP_ETHADDR4 0x64 -#define UIP_ETHADDR5 0x64 - -extern u8_t *cs8900a_rxtxreg, - *cs8900a_txcmd, - *cs8900a_txlen, - *cs8900a_packetpp, - *cs8900a_ppdata; - -static u16_t len; -static u8_t r; - -#define WRITE(P, D) do { PACKETPP = (P); \ - PPDATA = (D); } while(0) - - -/*-----------------------------------------------------------------------------------*/ -void -cs8900a_init(void) -{ - /* Turn on transmission and reception of frames. */ - WRITE(0x0112, 0x00c0); - - /* Accept valid unicast+broadcast frames. */ - WRITE(0x0104, 0x0d05); - - /* Set MAC address. */ - WRITE(0x0158, (ETHADDR1 << 8) | (ETHADDR0)); - WRITE(0x015a, (ETHADDR3 << 8) | (ETHADDR2)); - WRITE(0x015c, (ETHADDR5 << 8) | (ETHADDR4)); - -} -/*-----------------------------------------------------------------------------------*/ -void -cs8900a_send(void) -{ - if(uip_len > UIP_BUFSIZE) { - return; - } - - /* Transmit command. */ - /* *cs8900a_txcmd = 0x00c0 */ - asm("lda #$c0"); - asm("sta %v", cs8900a_txcmd); - asm("lda #$00"); - asm("sta %v+1", cs8900a_txcmd); - - /* *cs8900a_txlen = uip_len */ - - asm("lda _uip_len"); - asm("sta %v", cs8900a_txlen); -#if UIP_BUFSIZE > 255 - asm("lda _uip_len+1"); -#else - asm("lda #0"); -#endif - asm("sta %v+1", cs8900a_txlen); - - asm("ldx #8"); - asm("tryagain:"); - /* Check for avaliable buffer space. */ - asm("lda #$38"); - asm("sta %v", cs8900a_packetpp); - asm("lda #$01"); - asm("sta %v+1", cs8900a_packetpp); - asm("lda %v+1", cs8900a_ppdata); - asm("and #1"); - asm("bne send"); - - /* No space avaliable, skip a received frame and try again. */ - asm("lda #$02"); - asm("sta %v", cs8900a_packetpp); - asm("lda #$01"); - asm("sta %v+1", cs8900a_packetpp); - asm("lda %v", cs8900a_ppdata); - asm("ora #$40"); - asm("sta %v", cs8900a_ppdata); - - asm("dex"); - asm("bne tryagain"); - - asm("bailout:"); - return; - - /* Send the frame. */ - asm("send:"); - - - /* First, send 40+14=54 bytes of header. */ - - asm("ldx #54"); - asm("ldy #0"); - asm("sendloop1:"); - asm("lda _uip_buf,y"); - asm("sta %v", cs8900a_rxtxreg); - asm("lda _uip_buf+1,y"); - asm("sta %v+1", cs8900a_rxtxreg); - asm("iny"); - asm("iny"); - asm("dex"); - asm("dex"); - asm("bne sendloop1"); - - if(uip_len <= 54) { - return; - } - - /* Next, send rest of the packet. */ - - uip_len -= 54; - - - asm("lda ptr1"); - asm("pha"); - asm("lda ptr1+1"); - asm("pha"); - - asm("lda _uip_appdata"); - asm("sta ptr1"); - asm("lda _uip_appdata+1"); - asm("sta ptr1+1"); - - asm("sendloop2:"); - asm("lda _uip_len"); - asm("tax"); - asm("and #1"); - asm("beq noinc"); - asm("inx"); - asm("noinc:"); -#if UIP_BUFSIZE > 255 - asm("lda _uip_len+1"); -#else - asm("lda #0"); -#endif - asm("beq nozero"); - asm("ldx #0"); - asm("nozero:"); - asm("ldy #0"); - asm("sendloop:"); - asm("lda (ptr1),y"); - asm("sta %v", cs8900a_rxtxreg); - asm("iny"); - asm("lda (ptr1),y"); - asm("sta %v+1", cs8900a_rxtxreg); - asm("iny"); - asm("dex"); - asm("dex"); - asm("bne sendloop"); - asm("inc ptr1+1"); -#if UIP_BUFSIZE > 255 - asm("dec _uip_len+1"); - asm("bpl sendloop2"); -#endif - - asm("pla"); - asm("sta ptr1+1"); - asm("pla"); - asm("sta ptr1"); -} -/*-----------------------------------------------------------------------------------*/ -static void -skip_frame(void) -{ - WRITE(0x0102, PPDATA | 0x0040); -} -/*-----------------------------------------------------------------------------------*/ -u8_t -cs8900a_poll(void) -{ - /* Check receiver event register to see if there are any valid - unicast frames avaliable. */ - /* PACKETPP = 0x0124; - if(PPDATA & 0x000d == 0x0000) { - return 0; - } - */ - asm("lda #$24"); - asm("sta %v", cs8900a_packetpp); - asm("lda #$01"); - asm("sta %v+1", cs8900a_packetpp); - asm("lda %v+1", cs8900a_ppdata); - asm("and #$0d"); - asm("cmp #$00"); - asm("bne noreturn"); - /* No frame ready. */ - return 0; - - asm("noreturn:"); - /* Process the incoming frame. */ - - /* Read receiver event and discard it. */ - /* dummy = RXTXREG; */ - - asm("lda %v+1", cs8900a_rxtxreg); - asm("sta _len+1"); - asm("lda %v", cs8900a_rxtxreg); - asm("sta _len"); - - /* Read frame length. */ - /* len = uip_len = RXTXREG; */ - asm("lda %v+1", cs8900a_rxtxreg); - asm("sta _len+1"); - asm("sta _uip_len+1"); - asm("lda %v", cs8900a_rxtxreg); - asm("sta _len"); - asm("sta _uip_len"); - - - if(len > UIP_BUFSIZE) { - skip_frame(); - return 0; - } - - /* Read bytes into uip_buf. */ - asm("lda ptr1"); - asm("pha"); - asm("lda ptr1+1"); - asm("pha"); - - asm("lda #<_uip_buf"); - asm("sta ptr1"); - asm("lda #>_uip_buf"); - asm("sta ptr1+1"); - - asm("lda _len+1"); - asm("beq read256"); - - /* Read first 256*n bytes. */ - asm("ldy #0"); - asm("read256loop:"); - asm("lda %v", cs8900a_rxtxreg); - asm("sta (ptr1),y"); - asm("iny"); - asm("lda %v+1", cs8900a_rxtxreg); - asm("sta (ptr1),y"); - asm("iny"); - asm("bne read256loop"); - asm("inc ptr1+1"); - - asm("dec _len+1"); - asm("bne read256loop"); - - /* Read last 255 or less bytes. */ - asm("read256:"); - asm("lda _len"); - asm("lsr"); - asm("bcc noinc"); - asm("inc _len"); - asm("noinc:"); - asm("ldy #$0"); - asm("readloop:"); - asm("lda %v", cs8900a_rxtxreg); - asm("sta (ptr1),y"); - asm("iny"); - asm("lda %v+1", cs8900a_rxtxreg); - asm("sta (ptr1),y"); - asm("iny"); - asm("cpy _len"); - asm("bne readloop"); - - asm("pla"); - asm("sta ptr1+1"); - asm("pla"); - asm("sta ptr1"); - return len; -} diff --git a/backyard/core/dev/cs8900a.h b/backyard/core/dev/cs8900a.h deleted file mode 100644 index d1f79c00d..000000000 --- a/backyard/core/dev/cs8900a.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - * $Id: cs8900a.h,v 1.1 2007/05/26 22:00:33 oliverschmidt Exp $ - */ -#ifndef __CS8900A_H__ -#define __CS8900A_H__ - -#include "uip_arch.h" - -void cs8900a_init(void); -void cs8900a_send(void); -u8_t cs8900a_poll(void); - -#endif /* __CS8900A_H__ */ diff --git a/backyard/core/lib/crtk.c b/backyard/core/lib/crtk.c deleted file mode 100644 index b8186e2c0..000000000 --- a/backyard/core/lib/crtk.c +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)$Id: crtk.c,v 1.1 2007/05/23 23:23:23 oliverschmidt Exp $ - */ - -/* - * RUNES CRTK Implementation - * Version 0.3 - * - * Stefanos Zachariadis, UCL, s.zachariadis@cs.ucl.ac.uk - */ - -#include -#include - -#include "crtk.h" - -static Attribute a = { "Author", "Stefanos Zachariadis", NULL }; -static Entity attributes = { 0, COMPONENT, "crtk", &a, NULL }; -static int entities; - -static void construct(void) { - printf("Instantiating RUNES middleware\n"); -} - -static void destroy(void) { - printf("RUNES Middleware going away...\n"); -} - -static void printregistry(void) { - printf("The Registry Currently Contains:\n"); - Entity *current; - current=&attributes; - while(current!=NULL) { - Attribute *attrs; - attrs=current->attributes; - printf("Entity (%d,%d) \n",current->id, current->type); - while(attrs!=NULL) { - printf(" (%s,%s)\n",attrs->key,(char *)(attrs->value)); - attrs=attrs->next; - } - current=current->next; - } -} - - -static void delent(Entity *e) { - Entity *previous = &attributes; /* Not allowed to delete first! */ - Entity *current = previous->next; - while(current != NULL) { - if(e->id == current->id) { - previous->next = current->next; - current->next = NULL; - return; - } - previous = current; - current = current->next; - } -} - - -static void putattr(Entity *e, Attribute *a) { - Entity *current, *previous = NULL; - current=&attributes; - while(NULL!=current) { - //printf("looping\n"); - if(e->id==current->id) { //the entity already exists in our databas - //we need to see if an attribute with the same key exists - Attribute *tmp; - for(tmp=current->attributes;tmp->next!=NULL;tmp=tmp->next) { - if(strcmp(tmp->key,a->key)==0) { //it does exist - tmp->value=a->value; - return; - } - } - //we need to add this attribute - tmp->next=a; - a->next=NULL; - return; - } - previous=current; - current=current->next; - } - e->next=NULL; - previous->next=e; - e->attributes=a; - a->next=NULL; -} - -static void getattr(Entity e, char *key, Attribute **atr) { - //right, so we're going to go through our registry. - Entity *current; - current=&attributes; - while(current!=NULL) { - if(e.id==current->id) { //we found the element - Attribute *tmp; - for(tmp=current->attributes;tmp!=NULL;tmp=tmp->next) { - if(strcmp(tmp->key,key)==0) { //the key does exist - *atr=tmp; - return; - } - } - } - current=current->next; - } - atr=NULL; -} - -static void connect(Interface i, Receptacle *r) { - *r=i; -} - - - -static void instantiate(Entity *e, Attribute *init) { - e->id=entities++; - putattr(e,init); -} - - -static void getentities(Entity **e) { - *e=&attributes; -} - -IMPLEMENT_COMPONENT(crtk, { printregistry, delent, putattr, getattr, - connect, instantiate, getentities }); diff --git a/backyard/core/lib/crtk.h b/backyard/core/lib/crtk.h deleted file mode 100644 index 00e192ea6..000000000 --- a/backyard/core/lib/crtk.h +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)$Id: crtk.h,v 1.1 2007/05/23 23:23:23 oliverschmidt Exp $ - */ - -/* - * RUNES CRTK header, version 0.3 - * - * Stefanos Zachariadis, UCL, s.zachariadis@cs.ucl.ac.uk - */ - -#ifndef CRTK_H -#define CRTK_H - -/* For now this file is intimately dependent on sys/service.h. Really - * mysterious error messages are generated if one forgets to include - * sys/service.h, for this reason it is included here! - */ -#include "sys/service.h" - -#define COMPONENT 0 - -#define INTERFACE 1 - -#define RECEPTACLE 2 - -typedef const char *Receptacle; - -typedef const void *Interface; - -#if 0 -typedef struct INTERFACES { - Interface *i; - struct INTERFACES *next; -} Interfaces; -#endif - -#if 0 -typedef struct RECEPTACLES { - Receptacle *r; - struct RECEPTACLES *next; -} Receptacles; -#endif - -typedef struct ATTRIBUTE { - char *key; - void *value; - struct ATTRIBUTE *next; -} Attribute; - -typedef struct ENTITY { - int id; - int type; - char *name; - Attribute *attributes; - struct ENTITY *next; -} Entity; - -#define INVOKE(receptacle, iface, function) \ - { \ - struct service *service_s; \ - service_s = service_find(receptacle); \ - if(service_s != NULL) { \ - ((struct iface *)service_s->interface)->function; \ - } \ - } - -#define DECLARE_COMPONENT(compname,interface) \ -extern struct process compname##_process; \ -struct compname interface; - -#define DECLARE_INTERFACE(intname,interface)\ - struct intname interface; - -#define IMPLEMENT_COMPONENT(compname, ...)\ - static const struct compname compname##_implementation_interface = __VA_ARGS__;\ - static struct service compname##_implementation = { NULL, NULL, #compname, & compname##_implementation_interface }; \ - static Entity compname##_entity;\ - static void construct(void);\ - static void destroy(void);\ - PROCESS(compname##_process, #compname"_process"); \ - PROCESS_THREAD(compname##_process, ev, data) {\ - static Attribute name = { "template", #compname, NULL };\ - PROCESS_EXITHANDLER(goto exit);\ - PROCESS_BEGIN();\ - compname##_entity.type = COMPONENT;\ - compname##_entity.name = #compname;\ - construct();\ - SERVICE_REGISTER(compname##_implementation);\ - INVOKE("crtk", crtk, instantiate(&compname##_entity,&name));\ - PROCESS_YIELD_UNTIL(ev == PROCESS_EVENT_SERVICE_REMOVED);\ - exit:\ - destroy();\ - SERVICE_REMOVE(compname##_implementation);\ - INVOKE("crtk", crtk, delent(&compname##_entity));\ - PROCESS_END(); \ - } - -/* Registry crtk is built upon. */ -DECLARE_COMPONENT(crtk, -{ - /* prints the contents of the registry. */ - void (* printregistry)(void); - - /* delete the given entity. */ - void (* delent)(Entity *e); - - /* adds a new attribute for the given entity. */ - void (* putattr)(Entity *e, Attribute *a); - - /* searches for an attribute with the given key, for the given entity. */ - void (* getattr)(Entity e, char *key, Attribute **a); - - /* connects an interface and a receptacle. */ - void (* connect) (Interface i, Receptacle *r); - - /* instantiates a new component. */ - void (* instantiate) (Entity *e, Attribute *init); - - /* returns on e all the entities (and their attributes) available. */ - void (* getentities) (Entity **e); -}); - -#endif /* CRTK_H */ diff --git a/backyard/core/lib/ctk-textedit.c b/backyard/core/lib/ctk-textedit.c deleted file mode 100644 index c07a74eed..000000000 --- a/backyard/core/lib/ctk-textedit.c +++ /dev/null @@ -1,181 +0,0 @@ -/** - * \file - * An experimental CTK text edit widget. - * \author Adam Dunkels - * - * This module contains an experimental CTK widget which is - * implemented in the application process rather than in the CTK - * process. The widget is instantiated in a similar fashion as other - * CTK widgets, but is different from other widgets in that it - * requires a signal handler function to be called by the process - * signal handler function. - * - */ - -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: ctk-textedit.c,v 1.1 2007/11/20 20:41:54 oliverschmidt Exp $ - * - */ - - -#include "ctk-textedit.h" - -#include - -/*-----------------------------------------------------------------------------------*/ -void -ctk_textedit_init(struct ctk_textedit *t) -{ - t->xpos = t->ypos = 0; -} -/*-----------------------------------------------------------------------------------*/ -/** - * Add a CTK textedit widget to a window. - * - * \param w A pointer to the window to which the entry is to be added. - * \param t A pointer to the CTK textentry structure. - */ -/*-----------------------------------------------------------------------------------*/ -void -ctk_textedit_add(struct ctk_window *w, - struct ctk_textedit *t) -{ - CTK_WIDGET_SET_FLAG(t, CTK_WIDGET_FLAG_MONOSPACE); - CTK_WIDGET_ADD(w, t); -} -/*-----------------------------------------------------------------------------------*/ -/** - * The CTK textedit signal handler. - * - * This function must be called as part of the normal signal handler - * of the process that contains the CTK textentry structure. - * - * \param t A pointer to the CTK textentry structure. - * \param s The signal number. - * \param data The signal data. - */ -/*-----------------------------------------------------------------------------------*/ -void -ctk_textedit_eventhandler(struct ctk_textedit *t, - process_event_t s, - process_data_t data) -{ - char *textptr, *textptr2; - unsigned char len; - - if(s == ctk_signal_keypress) { - CTK_WIDGET_FOCUS(t->label.window, &t->label); - textptr = &(t->label.text[t->ypos * t->label.w + t->xpos]); - *textptr &= 0x7f; - switch((ctk_arch_key_t)data) { - case CH_CURS_DOWN: - if(t->ypos < t->label.h - 1) { - ++t->ypos; - } - break; - case CH_CURS_UP: - if(t->ypos > 0) { - --t->ypos; - } - break; - case CH_CURS_RIGHT: - len = strlen(&t->label.text[t->ypos * t->label.w]); - if(t->xpos < len) { - /* if(t->xpos < t->label.w) {*/ - ++t->xpos; - } else { - t->xpos = len; - } - break; - case CH_CURS_LEFT: - if(t->xpos > 0) { - --t->xpos; - } else { - if(t->ypos > 0) { - --t->ypos; - t->xpos = t->label.w - 1; - } - } - break; - case CH_ENTER: - t->xpos = 0; - if(t->ypos < t->label.h - 1) { - ++t->ypos; - } - break; - case CH_DEL: - len = t->label.w - t->xpos; - if(t->xpos > 0 && len > 0) { - strncpy(textptr - 1, textptr, - len); - *(textptr + len - 1) = 0; - --t->xpos; - } - break; - default: - len = t->label.w - t->xpos; - if(len > 0) { - textptr2 = textptr + len - 1; - while(textptr2 + 1 > textptr) { - *(textptr2 + 1) = *textptr2; - --textptr2; - } - - *textptr = (char)data; - ++t->xpos; - if(t->xpos == t->label.w) { - t->xpos = 0; - if(t->ypos < t->label.h - 1) { - ++t->ypos; - } - } - } - break; - } - textptr = &(t->label.text[t->ypos * t->label.w + t->xpos]); - *textptr |= 0x80; - CTK_WIDGET_REDRAW(&t->label); - } else if(s == ctk_signal_widget_activate && - data == (process_data_t)t) { - textptr = &(t->label.text[t->ypos * t->label.w + t->xpos]); - *textptr &= 0x7f; - t->xpos = 0; - if(t->ypos < t->label.h - 1) { - ++t->ypos; - } - textptr = &(t->label.text[t->ypos * t->label.w + t->xpos]); - *textptr |= 0x80; - CTK_WIDGET_REDRAW(&t->label); - } -} -/*-----------------------------------------------------------------------------------*/ diff --git a/backyard/core/lib/ctk-textedit.h b/backyard/core/lib/ctk-textedit.h deleted file mode 100644 index e06486295..000000000 --- a/backyard/core/lib/ctk-textedit.h +++ /dev/null @@ -1,73 +0,0 @@ -/** - * \file - * Header file for the experimental application level CTK textedit widget. - * \author Adam Dunkels - * - */ - -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: ctk-textedit.h,v 1.1 2007/11/20 20:41:54 oliverschmidt Exp $ - * - */ -#ifndef __CTK_TEXTEDIT_H__ -#define __CTK_TEXTEDIT_H__ - -#include "ctk/ctk.h" - -/** - * Instantiating macro for the CTK textedit widget. - * - * - * \param tx The x position of the widget. - * \param ty The y position of the widget. - * \param tw The width of the widget. - * \param th The height of the widget. - * \param ttext The text buffer to be edited. - */ -#define CTK_TEXTEDIT(tx, ty, tw, th, ttext) \ - {CTK_LABEL(tx, ty, tw, th, ttext)}, 0, 0 -struct ctk_textedit { - struct ctk_label label; - unsigned char xpos, ypos; -}; - -void ctk_textedit_init(struct ctk_textedit *t); - -void ctk_textedit_add(struct ctk_window *w, - struct ctk_textedit *t); - -void ctk_textedit_eventhandler(struct ctk_textedit *t, - process_event_t s, - process_data_t data); - -#endif /* __CTK_TEXTEDIT_H__ */ diff --git a/backyard/core/lib/malloc.c b/backyard/core/lib/malloc.c deleted file mode 100644 index b4d6c860a..000000000 --- a/backyard/core/lib/malloc.c +++ /dev/null @@ -1,434 +0,0 @@ -/* Copyright (c) 2002, 2004 Joerg Wunsch - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - * Neither the name of the copyright holders nor the names of - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*/ - - -/* $Id: malloc.c,v 1.1 2008/08/15 19:05:17 adamdunkels Exp $ */ - -#include - -#ifdef MALLOC_TEST -#include "malloc.h" -char mymem[256]; -#else -#include "contiki.h" -#include "lib/malloc.h" -#endif /* !MALLOC_TEST */ - -/* - * Exported interface: - * - * When extending the data segment, the allocator will not try to go - * beyond the current stack limit, decreased by __malloc_margin bytes. - * Thus, all possible stack frames of interrupt routines that could - * interrupt the current function, plus all further nested function - * calls must not require more stack space, or they'll risk to collide - * with the data segment. - */ - -char *__malloc_heap_end; - -char *__brkval; -struct __freelist *__flp; - -#define handle nx - -void * -malloc(size_t len) -{ - struct __freelist *fp1, *fp2; - char *cp; - size_t s; - - if (len <= 0) - return 0; - - len = (len + MALLOC_ROUNDUP) & ~MALLOC_ROUNDUP; - - /* - * First, walk the free list and try finding a chunk that - * would match exactly. If we found one, we are done. While - * walking, note down the size of the largest chunk we found - * that would still fit the request -- we need it for step 2. - * - */ - for (s = 0, fp1 = __flp, fp2 = 0; - fp1; - fp2 = fp1, fp1 = fp1->nx) { - if (fp1->sz == len) { - /* - * Found it. Disconnect the chunk from the - * freelist, and return it. - */ - if (fp2) - fp2->nx = fp1->nx; - else - __flp = fp1->nx; - fp1->handle = NULL; - return &fp1[1]; - } - if (fp1->sz > len) { - if (s == 0 || fp1->sz < s) - s = fp1->sz; - } - } - /* - * Step 2: If we found a chunk on the freelist that would fit - * (but was too large), look it up again and use it, since it - * is our closest match now. Since the freelist entry needs - * to be split into two entries then, watch out that the - * difference between the requested size and the size of the - * chunk found is large enough for another freelist entry; if - * not, just enlarge the request size to what we have found, - * and use the entire chunk. - */ - if (s) { - if (s - len < sizeof(struct __freelist)) - len = s; - for (fp1 = __flp, fp2 = 0; - fp1; - fp2 = fp1, fp1 = fp1->nx) { - if (fp1->sz == s) { - if (len == s) { - /* - * Use entire chunk; same as - * above. - */ - if (fp2) - fp2->nx = fp1->nx; - else - __flp = fp1->nx; - fp1->handle = NULL; - return &fp1[1]; - } - /* - * Split them up. Note that we leave - * the first part as the new (smaller) - * freelist entry, and return the - * upper portion to the caller. This - * saves us the work to fix up the - * freelist chain; we just need to - * fixup the size of the current - * entry, and note down the size of - * the new chunk before returning it - * to the caller. - */ - cp = (char *)fp1; - s -= len; - cp += s; - fp2 = (struct __freelist *)cp; - fp2->sz = len; - fp1->sz = s - sizeof(struct __freelist); - fp2->handle = NULL; - return &fp2[1]; - } - } - } - /* - * Step 3: If the request could not be satisfied from a - * freelist entry, just prepare a new chunk. This means we - * need to obtain more memory first. The largest address just - * not allocated so far is remembered in the brkval variable. - * Under Unix, the "break value" was the end of the data - * segment as dynamically requested from the operating system. - * Since we don't have an operating system, just make sure - * that we don't collide with the stack. - */ - if (__brkval == 0) - __brkval = sbrk(len + sizeof(struct __freelist)); - else if (sbrk(len + sizeof(struct __freelist)) == (void *)-1) - return 0; /* There's no help, just fail. :-/ */ - - __malloc_heap_end = sbrk(0); - - fp1 = (struct __freelist *)__brkval; - __brkval += len + sizeof(struct __freelist); - fp1->sz = len; - fp1->handle = NULL; - return &fp1[1]; -} - -void -free(void *p) -{ - struct __freelist *fp1, *fp2, *fpnew; - char *cp1, *cp2, *cpnew; - - /* ISO C says free(NULL) must be a no-op */ - if (p == 0) - return; - - cpnew = p; - cpnew -= sizeof(struct __freelist); - fpnew = (struct __freelist *)cpnew; - fpnew->nx = 0; - - /* - * Trivial case first: if there's no freelist yet, our entry - * will be the only one on it. - */ - if (__flp == 0) { - __flp = fpnew; - return; - } - - /* - * Now, find the position where our new entry belongs onto the - * freelist. Try to aggregate the chunk with adjacent chunks - * if possible. - */ - for (fp1 = __flp, fp2 = 0; - fp1; - fp2 = fp1, fp1 = fp1->nx) { - if (fp1 < fpnew) - continue; - cp1 = (char *)fp1; - fpnew->nx = fp1; - if (((char *)&fpnew[1]) + fpnew->sz == cp1) { - /* upper chunk adjacent, assimilate it */ - fpnew->sz += fp1->sz + sizeof(struct __freelist); - fpnew->nx = fp1->nx; - } - if (fp2 == 0) { - /* new head of freelist */ - __flp = fpnew; - return; - } - break; - } - /* - * Note that we get here either if we hit the "break" above, - * or if we fell off the end of the loop. The latter means - * we've got a new topmost chunk. Either way, try aggregating - * with the lower chunk if possible. - */ - fp2->nx = fpnew; - cp2 = (char *)&fp2[1]; - if (cp2 + fp2->sz == cpnew) { - /* lower junk adjacent, merge */ - fp2->sz += fpnew->sz + sizeof(struct __freelist); - fp2->nx = fpnew->nx; - } -} - -#ifdef MALLOC_TEST - -#include -#include -#include -#include - -void *handles[32]; -size_t sizes[32]; - - -void * -alloc(size_t s) -{ - void *p; - - if ((p = malloc(s)) == 0) { - malloc_compact(); - if ((p = malloc(s)) == 0) - return 0; - } - memset(p, 0xd0, s); - return p; -} - -void -printfreelist(void) -{ - struct __freelist *fp1; - int i; - - if (!__flp) { - printf("no free list\n"); - return; - } - - for (i = 0, fp1 = __flp; fp1; i++, fp1 = fp1->nx) { - printf("free %d @ %u: size %u, next ", - i, (char *)fp1 - mymem, fp1->sz); - if (fp1->nx) - printf("%u\n", (char *)fp1->nx - mymem); - else - printf("NULL\n"); - } -} - -int -compare(const void *p1, const void *p2) -{ - return *((size_t *)p1) - *((size_t *)p2); -} - -void -printalloc(void) -{ - int j, k; - size_t i; - size_t sum, sum2; - void *sortedhandles[32]; - struct __freelist *fp; - char *cp; - - for (i = j = k = sum = sum2 = 0; - i < sizeof handles / sizeof (void *); - i++) - if (sizes[i]) { - j++; - sum += sizes[i]; - if (handles[i]) { - k++; - sum2 += sizes[i]; - } - } - printf("brkval: %d, %d request%s => sum %u bytes " - "(actually %d reqs => %u bytes)\n", - (char *)__brkval - mymem, j, j == 1? "": "s", sum, k, sum2); - memcpy(sortedhandles, handles, sizeof sortedhandles); - qsort(sortedhandles, 32, sizeof(void *), compare); - for (i = j = 0; i < sizeof sortedhandles / sizeof (void *); i++) - if ((cp = sortedhandles[i])) { - cp -= sizeof(struct __freelist); - fp = (struct __freelist *)cp; - printf("alloc %d @ %u: %u bytes, handle %p\n", - j, (char *)fp - mymem, fp->sz, fp->handle); - j++; - } - -} - - -void -printblk(void) -{ - struct __freelist *fp = __flp; - struct __freelist *ap = (struct __freelist *)__malloc_heap_start; - struct __freelist *end = (struct __freelist *)__brkval; - int b = 0; - int e = 0; - - if (fp == 0) - fp = end; - - alloclist: - while (ap < fp) { - printf("Alloc %d @ %u: %u bytes, handle %p\n", - b, (char *)ap - mymem, ap->sz, ap->handle); - ap = (void *)(((char *)ap) + sizeof(struct __freelist) + ap->sz); - b++; - } - - if (fp < end) { - printf("Free %d @ %u: size %u, next ", - e, (char *)fp - mymem, fp->sz); - if (fp->nx) - printf("%u\n", (char *)fp->nx - mymem); - else - printf("NULL\n"); - ap = (void *)(((char *)fp) + sizeof(struct __freelist) + fp->sz); - fp = fp->nx; - if (fp == 0) - fp = end; - e++; - } - - if (ap < end) - goto alloclist; -} - -int -main(void) -{ - int i, j, k, l, m, om, p, f; - size_t s; - - srand(time(0) ^ getpid()); - - for (k = 0; k < 100; k++) { - memset(handles, 0, sizeof handles); - memset(sizes, 0, sizeof sizes); - - j = rand() % 16 + 15; - l = rand() % 80 + 7; - - for (i = s = 0; i < j && s < 256; i++) { - sizes[i] = rand() % l + 1; - s += sizes[i]; - } - j = i; - for (m = om = 1, p = 1, f = 0; m < 1000; m++) { - for (i = s = 0; i < j; i++) - if (handles[i]) - s++; - if (s == (unsigned)j) - break; - - if (m / om > 10) { - p <<= 1; - p |= 1; - } - - for (i = 0; i < j; i++) - if (rand() & p) { - if (!handles[i]) { - if ((handles[i] = alloc(sizes[i])) == 0) - f++; - else if (sizes[i] & 1) - malloc_unlock(&handles[i]); - } - } - for (i = 0; i < j; i++) { - if (rand() & 1) { - free(handles[i]); - handles[i] = 0; - } - } - } - if (f) - printf("%d alloc failure%s total\n", - f, f == 1? "": "s"); - printf("After alloc:\n"); - printalloc(); - //printfreelist(); - printblk(); - for (i = 0; i < j; i++) - free(handles[i]); - printf("After cleanup:\n"); - printfreelist(); - //printblk(); - } - - return 0; -} - -#endif /* MALLOC_TEST */ diff --git a/backyard/core/lib/malloc.h b/backyard/core/lib/malloc.h deleted file mode 100644 index 4c8d7151d..000000000 --- a/backyard/core/lib/malloc.h +++ /dev/null @@ -1,88 +0,0 @@ -/* Copyright (c) 2004, Joerg Wunsch - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - * Neither the name of the copyright holders nor the names of - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*/ - -/* $Id: malloc.h,v 1.1 2008/08/15 19:05:17 adamdunkels Exp $ */ - -#ifndef MALLOC_H -#define MALLOC_H - -#if !defined(__DOXYGEN__) - -struct __freelist { - size_t sz; - struct __freelist *nx; -}; - -#endif - -/* - * Only unlocked memory can be subject to compaction. - * - * Malloc and realloc return locked memory. - */ -void malloc_unlock(void **h); -void malloc_lock(void **h); -void malloc_compact(void); -void malloc_compact_one(void); - -void *malloc(size_t size); -void *realloc(void *ptr, size_t size); -void free(void *ptr); - -extern char *__brkval; /* first location not yet allocated */ -extern struct __freelist *__flp; /* freelist pointer (head of freelist) */ -extern char *__malloc_heap_end; - -#define MALLOC_ROUNDUP (sizeof(int) - 1) - -#ifdef MALLOC_TEST -/* - * When compiling malloc.c/realloc.c natively on a host machine, it will - * include a main() that performs a regression test. This is meant as - * a debugging aid, where a normal source-level debugger will help to - * verify that the various allocator structures have the desired - * appearance at each stage. - * - */ - -extern void *mymalloc(size_t); -extern void myfree(void *); -extern void *myrealloc(void *, size_t); - -#define malloc mymalloc -#define free myfree -#define realloc myrealloc - -#define __malloc_heap_start &mymem[0] -#define __malloc_heap_end &mymem[256] -extern char mymem[]; - -#endif /* MALLOC_TEST */ - -#endif /* MALLOC_H */ diff --git a/backyard/core/lib/malloc_compact.c b/backyard/core/lib/malloc_compact.c deleted file mode 100644 index b4cd0a946..000000000 --- a/backyard/core/lib/malloc_compact.c +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)$Id: malloc_compact.c,v 1.1 2008/08/15 19:05:17 adamdunkels Exp $ - */ - -#include -#include - -#ifdef MALLOC_TEST -#include "malloc.h" -#else -#include "contiki.h" -#include "lib/malloc.h" -#endif /* !MALLOC_TEST */ - -#define handle nx - -void -malloc_unlock(void **h) -{ - struct __freelist *t = *h; - t = &t[-1]; - t->handle = (void *)h; -} - -void -malloc_lock(void **h) -{ - struct __freelist *t = *h; - t = &t[-1]; - t->handle = NULL; -} - -static int -compact1(struct __freelist **flp) -{ - struct __freelist *fp = *flp, *fp2; - struct __freelist *ap1, *ap2; - struct __freelist *end = (struct __freelist *)__brkval; - - ap1 = (void *)(((char *)fp) + sizeof(struct __freelist) + fp->sz); - if (ap1 >= end) - return 0; - if (ap1->handle == NULL) - return 0; - - ap2 = (void *)(((char *)ap1) + sizeof(struct __freelist) + ap1->sz); - fp2 = fp->nx; - - if (ap2 != fp2) { /* 2 blocks become 2 */ - size_t s = fp->sz; - - fp->sz = ap1->sz; - fp->handle = ap1->handle; - memcpy(&fp[1], &ap1[1], ap1->sz); - *(void **)(fp->handle) = &fp[1]; - - fp = (void *)(((char *)fp) + sizeof(struct __freelist) + fp->sz); - fp->sz = s; - fp->nx = fp2; - *flp = fp; - return 1; - } - - if (ap2 == fp2) { /* 3 blocks become 2 */ - size_t s = fp->sz + fp2->sz + sizeof(struct __freelist); - - fp->sz = ap1->sz; - fp->handle = ap1->handle; - memcpy(&fp[1], &ap1[1], ap1->sz); - *(void **)(fp->handle) = &fp[1]; - - fp = (void *)(((char *)fp) + sizeof(struct __freelist) + fp->sz); - fp->sz = s; - fp->nx = fp2->nx; - *flp = fp; - return 1; - } - - return 0; -} - -void -malloc_compact(void) -{ - struct __freelist **flp; - - flp = &__flp; - while (*flp != NULL) { - while (compact1(flp)) - ; - flp = &((*flp)->nx); - } -} - -void -malloc_compact_one(void) -{ - struct __freelist **flp; - - flp = &__flp; - while (*flp != NULL) { - if (compact1(flp)) - return ; - flp = &((*flp)->nx); - } -} diff --git a/backyard/core/lib/realloc.c b/backyard/core/lib/realloc.c deleted file mode 100644 index 6344bf649..000000000 --- a/backyard/core/lib/realloc.c +++ /dev/null @@ -1,159 +0,0 @@ -/* Copyright (c) 2004 Joerg Wunsch - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in - the documentation and/or other materials provided with the - distribution. - - * Neither the name of the copyright holders nor the names of - contributors may be used to endorse or promote products derived - from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -*/ -/* $Id: realloc.c,v 1.1 2008/08/15 19:57:13 adamdunkels Exp $ */ - -#include -#include - -#ifdef MALLOC_TEST -#include "malloc.h" -#else -#include "contiki.h" -#include "lib/malloc.h" -#endif /* !MALLOC_TEST */ - -void * -realloc(void *ptr, size_t len) -{ - struct __freelist *fp1, *fp2, *fp3, *ofp3; - char *cp, *cp1; - void *memp; - size_t s, incr; - - /* Trivial case, required by C standard. */ - if (ptr == 0) - return malloc(len); - - if (len < 0) - return 0; - - len = (len + MALLOC_ROUNDUP) & ~MALLOC_ROUNDUP; - - cp1 = (char *)ptr; - cp1 -= sizeof(struct __freelist); - fp1 = (struct __freelist *)cp1; - - cp = (char *)ptr + len; /* new next pointer */ - if (cp < cp1) - /* Pointer wrapped across top of RAM, fail. */ - return 0; - fp2 = (struct __freelist *)cp; - - /* - * See whether we are growing or shrinking. When shrinking, - * we split off a chunk for the released portion, and call - * free() on it. Therefore, we can only shrink if the new - * size is at least sizeof(struct __freelist) smaller than the - * previous size. - */ - if (len <= fp1->sz) { - /* The first test catches a possible unsigned int - * rollover condition. */ - if (fp1->sz <= sizeof(struct __freelist) || - len > fp1->sz - sizeof(struct __freelist)) - return ptr; - fp2->sz = fp1->sz - len - sizeof(struct __freelist); - fp1->sz = len; - free(&fp2[1]); - return ptr; - } - - /* - * If we get here, we are growing. First, see whether there - * is space in the free list on top of our current chunk. - */ - incr = len - fp1->sz - sizeof(struct __freelist); - cp = (char *)ptr + fp1->sz; - fp2 = (struct __freelist *)cp; - for (s = 0, ofp3 = 0, fp3 = __flp; - fp3; - ofp3 = fp3, fp3 = fp3->nx) { - if (fp3 == fp2 && fp3->sz >= incr) { - /* found something that fits */ - if (incr <= fp3->sz && - incr > fp3->sz - sizeof(struct __freelist)) { - /* it just fits, so use it entirely */ - fp1->sz += fp3->sz + sizeof(struct __freelist); - if (ofp3) - ofp3->nx = fp3->nx; - else - __flp = fp3->nx; - return ptr; - } - /* split off a new freelist entry */ - cp = (char *)ptr + len; - fp2 = (struct __freelist *)cp; - fp2->nx = fp3->nx; - fp2->sz = fp3->sz - incr - sizeof(struct __freelist); - if (ofp3) - ofp3->nx = fp2; - else - __flp = fp2; - fp1->sz = len; - return ptr; - } - /* - * Find the largest chunk on the freelist while - * walking it. - */ - if (fp3->sz > s) - s = fp3->sz; - } - /* - * If we are the topmost chunk in memory, and there was no - * large enough chunk on the freelist that could be re-used - * (by a call to malloc() below), quickly extend the - * allocation area if possible, without need to copy the old - * data. - */ - if (__brkval == (char *)ptr + fp1->sz && len > s) { - cp1 = __malloc_heap_end; - cp = (char *)ptr + len; - if (cp < cp1) { - __brkval = cp; - fp1->sz = len; - return ptr; - } - /* If that failed, we are out of luck. */ - return 0; - } - - /* - * Call malloc() for a new chunk, then copy over the data, and - * release the old region. - */ - if ((memp = malloc(len)) == 0) - return 0; - memcpy(memp, ptr, fp1->sz); - free(ptr); - return memp; -} - diff --git a/backyard/core/net/adhoc-service.h b/backyard/core/net/adhoc-service.h deleted file mode 100644 index 84ef75019..000000000 --- a/backyard/core/net/adhoc-service.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * $Id: adhoc-service.h,v 1.1 2007/05/23 23:28:19 oliverschmidt Exp $ - */ - -/** - * \file - * Header file for the ad hoc routing service - * \author - * Adam Dunkels - */ - -#ifndef __ADHOC_SERVICE_H__ -#define __ADHOC_SERVICE_H__ - -#include "contiki.h" - -SERVICE_INTERFACE(adhoc_service, -{ - void (* send)(uip_ipaddr_t addr, char *buf, int len); - process_event_t sent; -}); - -#define adhoc_service_name "Ad hoc routing service" - -#endif /* __ADHOC_SERVICE_H__ */ diff --git a/backyard/core/net/hc-service.c b/backyard/core/net/hc-service.c deleted file mode 100644 index e3e2418fb..000000000 --- a/backyard/core/net/hc-service.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * @(#)$Id: hc-service.c,v 1.1 2007/05/23 23:28:19 oliverschmidt Exp $ - */ - -#include "hc-service.h" - -static void -compress(void) -{ - -} - -static void -decompress(void) -{ - -} - -SERVICE(hc_service, { compress, decompress }); - - -PROCESS(hc_service_process, "Header compression"); - -PROCESS_THREAD(hc_service_process, ev, data) -{ - PROCESS_BEGIN(); - - PROCESS_SET_FLAGS(PROCESS_NO_BROADCAST); - - SERVICE_REGISTER(hc_service); - - while(1) { - PROCESS_WAIT_EVENT_UNTIL(ev == PROCESS_EVENT_EXIT); - } - - SERVICE_REMOVE(hc_service); - - PROCESS_END(); -} diff --git a/backyard/core/net/hc-service.h b/backyard/core/net/hc-service.h deleted file mode 100644 index 809bd16d5..000000000 --- a/backyard/core/net/hc-service.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * @(#)$Id: hc-service.h,v 1.1 2007/05/23 23:28:19 oliverschmidt Exp $ - */ -#ifndef __HC_SERVICE_H__ -#define __HC_SERVICE_H__ - -#include "service.h" - -SERVICE_INTERFACE(hc_service, { - void (* compress)(void); - void (* decompress)(void); -}); - -#define hc_service_name "Header compression" - -#endif /* __HC_SERVICE_H__ */ diff --git a/backyard/core/net/ppp/ahdlc.c b/backyard/core/net/ppp/ahdlc.c deleted file mode 100644 index fce965c30..000000000 --- a/backyard/core/net/ppp/ahdlc.c +++ /dev/null @@ -1,381 +0,0 @@ -/* www.mycal.com - *--------------------------------------------------------------------------- - * ahdlc.c - Ahdlc receive and transmit processor for PPP engine. - * - *--------------------------------------------------------------------------- - * Version - * 0.1 Original Version Jan 11, 1998 - * - *--------------------------------------------------------------------------- - * - * Copyright (C) 1998, Mycal Labs www.mycal.com - * - *--------------------------------------------------------------------------- - */ -/* - * Copyright (c) 2003, Mike Johnson, Mycal Labs, www.mycal.net - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Mike Johnson/Mycal Labs - * www.mycal.net. - * 4. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Mycal Modified uIP TCP/IP stack. - * - * $Id: ahdlc.c,v 1.1 2007/05/26 07:14:39 oliverschmidt Exp $ - * - */ - -/* */ -/* include files */ -/* */ - -#include "net/uip.h" -#include "ppp.h" - -#if 0 -#define DEBUG1(x) -#else -#include -#define DEBUG1(x) debug_printf x -#endif - -#define PACKET_TX_DEBUG 1 - -/*--------------------------------------------------------------------------- - * ahdlc flags bit defins, for ahdlc_flags variable - ---------------------------------------------------------------------------*/ -/* Escaped mode bit */ -#define AHDLC_ESCAPED 0x1 -/* Frame is ready bit */ -#define AHDLC_RX_READY 0x2 -#define AHDLC_RX_ASYNC_MAP 0x4 -#define AHDLC_TX_ASYNC_MAP 0x8 -#define AHDLC_PFC 0x10 -#define AHDLC_ACFC 0x20 - -/*--------------------------------------------------------------------------- - * Private Local Globals - * 10 bytes - standard - * - with counters - ---------------------------------------------------------------------------*/ -/* running tx CRC */ -u16_t ahdlc_tx_crc; -/* running rx CRC */ -u16_t ahdlc_rx_crc; -/* number of rx bytes processed, cur frame */ -u16_t ahdlc_rx_count; -/* ahdlc state flags, see above */ -u8_t ahdlc_flags; - -u8_t ahdlc_tx_offline; - -/* - * The following can be optimized out - */ -u8_t *ahdlc_rx_buffer; /* What to do here? +++ */ -u16_t ahdlc_max_rx_buffer_size; - -/* - * Optional statistics counters. - */ -#ifdef AHDLC_COUNTERS -u8_t ahdlc_rx_tobig_error; -#endif - -/*---------------------------------------------------------------------------*/ -/* Simple and fast CRC16 routine for embedded processors. - * Just slightly slower than the table lookup method but consumes - * almost no space. Much faster and smaller than the loop and - * shift method that is widely used in the embedded space. - * Can be optimized even more in .ASM - * - * data = (crcvalue ^ inputchar) & 0xff; - * data = (data ^ (data << 4)) & 0xff; - * crc = (crc >> 8) ^ ((data << 8) ^ (data <<3) ^ (data >> 4)) - */ -/*---------------------------------------------------------------------------*/ -static u16_t -crcadd(u16_t crcvalue, u8_t c) -{ - u16_t b; - - b = (crcvalue ^ c) & 0xFF; - b = (b ^ (b << 4)) & 0xFF; - b = (b << 8) ^ (b << 3) ^ (b >> 4); - - return ((crcvalue >> 8) ^ b); -} -/*---------------------------------------------------------------------------*/ -/* ahdlc_init(buffer, buffersize) - this initializes the ahdlc engine to - * allow for rx frames. - */ -/*---------------------------------------------------------------------------*/ -void -ahdlc_init(u8_t *buffer, u16_t maxrxbuffersize) -{ - ahdlc_flags = 0 | AHDLC_RX_ASYNC_MAP; - ahdlc_rx_buffer = buffer; - ahdlc_max_rx_buffer_size = maxrxbuffersize; - /* ahdlc_async_map = 0; */ -#ifdef AHDLC_COUNTERS - ahdlc_rx_tobig_error = 0; - ahdl_tx_offline = 0; -#endif -} -/*---------------------------------------------------------------------------*/ -/* ahdlc_rx_ready() - resets the ahdlc engine to the beginning of frame - * state. - */ -/*---------------------------------------------------------------------------*/ -void -ahdlc_rx_ready(void) -{ - ahdlc_rx_count = 0; - ahdlc_rx_crc = 0xffff; - ahdlc_flags |= AHDLC_RX_READY; -} -/*---------------------------------------------------------------------------*/ -/* ahdlc receive function - This routine processes incoming bytes and tries - * to build a PPP frame. - * - * Two possible reasons that ahdlc_rx will not process characters: - * o Buffer is locked - in this case ahdlc_rx returns 1, char - * sending routing should retry. - */ -/*---------------------------------------------------------------------------*/ -u8_t -ahdlc_rx(u8_t c) -{ - static u16_t protocol; - - /* check to see if PPP packet is useable, we should have hardware - flow control set, but if host ignores it and sends us a char when - the PPP Receive packet is in use, discard the character. +++ */ - - if(ahdlc_flags & AHDLC_RX_READY) { - /* check to see if character is less than 0x20 hex we really - should set AHDLC_RX_ASYNC_MAP on by default and only turn it - off when it is negotiated off to handle some buggy stacks. */ - if((c < 0x20) && - ((ahdlc_flags & AHDLC_RX_ASYNC_MAP) == 0)) { - /* discard character */ - DEBUG1(("Discard because char is < 0x20 hex and asysnc map is 0\n")); - return 0; - } - /* are we in escaped mode? */ - if(ahdlc_flags & AHDLC_ESCAPED) { - /* set escaped to FALSE */ - ahdlc_flags &= ~AHDLC_ESCAPED; - - /* if value is 0x7e then silently discard and reset receive packet */ - if(c == 0x7e) { - ahdlc_rx_ready(); - return 0; - } - /* incomming char = itself xor 20 */ - c = c ^ 0x20; - } else if(c == 0x7e) { - /* handle frame end */ - if(ahdlc_rx_crc == CRC_GOOD_VALUE) { - DEBUG1(("\nReceiving packet with good crc value, len %d\n",ahdlc_rx_count)); - /* we hae a good packet, turn off CTS until we are done with - this packet */ - /*CTS_OFF();*/ - /* remove CRC bytes from packet */ - ahdlc_rx_count -= 2; - - /* lock PPP buffer */ - ahdlc_flags &= ~AHDLC_RX_READY; - /* - * upcall routine must fully process frame before return - * as returning signifies that buffer belongs to AHDLC again. - */ - if((c & 0x1) && (ahdlc_flags & PPP_PFC)) { - /* Send up packet */ - ppp_upcall((u16_t)ahdlc_rx_buffer[0], - (u8_t *)&ahdlc_rx_buffer[1], - (u16_t)(ahdlc_rx_count - 1)); - } else { - /* Send up packet */ - ppp_upcall((u16_t)(ahdlc_rx_buffer[0] << 8 | ahdlc_rx_buffer[1]), - (u8_t *)&ahdlc_rx_buffer[2], (u16_t)(ahdlc_rx_count - 2)); - } - ahdlc_tx_offline = 0; // The remote side is alive - ahdlc_rx_ready(); - return 0; - } else if(ahdlc_rx_count > 3) { - DEBUG1(("\nReceiving packet with bad crc value, was 0x%04x len %d\n",ahdlc_rx_crc, ahdlc_rx_count)); -#ifdef AHDLC_COUNTERS - ++ahdlc_crc_error; -#endif - /* Shouldn't we dump the packet and not pass it up? */ - /*ppp_upcall((u16_t)ahdlc_rx_buffer[0], - (u8_t *)&ahdlc_rx_buffer[0], (u16_t)(ahdlc_rx_count+2)); - dump_ppp_packet(&ahdlc_rx_buffer[0],ahdlc_rx_count);*/ - - } - ahdlc_rx_ready(); - return 0; - } else if(c == 0x7d) { - /* handle escaped chars*/ - ahdlc_flags |= PPP_ESCAPED; - return 0; - } - - /* try to store char if not to big */ - if(ahdlc_rx_count >= ahdlc_max_rx_buffer_size /*PPP_RX_BUFFER_SIZE*/) { -#ifdef AHDLC_COUNTERS - ++ahdlc_rx_tobig_error; -#endif - ahdlc_rx_ready(); - } else { - /* Add CRC in */ - ahdlc_rx_crc = crcadd(ahdlc_rx_crc, c); - /* do auto ACFC, if packet len is zero discard 0xff and 0x03 */ - if(ahdlc_rx_count == 0) { - if((c == 0xff) || (c == 0x03)) - return 0; - } - /* Store char */ - ppp_rx_buffer[ahdlc_rx_count++] = c; - } - } else { - /* we are busy and didn't process the character. */ - DEBUG1(("Busy/not active\n")); - return 1; - } - return 0; -} -/*---------------------------------------------------------------------------*/ -/* ahdlc_tx_char(char) - write a character to the serial device, - * escape if necessary. - * - * Relies on local global vars : ahdlc_tx_crc, ahdlc_flags. - * Modifies local global vars : ahdlc_tx_crc. - */ -/*---------------------------------------------------------------------------*/ -void -ahdlc_tx_char(u16_t protocol, u8_t c) -{ - /* add in crc */ - ahdlc_tx_crc = crcadd(ahdlc_tx_crc, c); - /* - * See if we need to escape char, we always escape 0x7d and 0x7e, in the case - * of char < 0x20 we only support async map of default or none, so escape if - * ASYNC map is not set. We may want to modify this to support a bitmap set - * ASYNC map. - */ - if((c == 0x7d) || (c == 0x7e) || - ((c < 0x20) && ((protocol == LCP) || - (ahdlc_flags & PPP_TX_ASYNC_MAP) == 0))) { - /* send escape char and xor byte by 0x20 */ - ppp_arch_putchar(0x7d); - c ^= 0x20; - } - ppp_arch_putchar(c); -} -/*---------------------------------------------------------------------------*/ -/* ahdlc_tx(protocol,buffer,len) - Transmit a PPP frame. - * Buffer contains protocol data, ahdlc_tx addes address, control and - * protocol data. - * - * Relies on local global vars : ahdlc_tx_crc, ahdlc_flags. - * Modifies local global vars : ahdlc_tx_crc. - */ -/*---------------------------------------------------------------------------*/ -u8_t -ahdlc_tx(u16_t protocol, u8_t *header, u8_t *buffer, - u16_t headerlen, u16_t datalen) -{ - u16_t i; - u8_t c; - - DEBUG1(("\nAHDLC_TX - transmit frame, protocol 0x%04x, length %d offline %d\n",protocol,datalen+headerlen,ahdlc_tx_offline)); - if (AHDLC_TX_OFFLINE && (ahdlc_tx_offline++ > AHDLC_TX_OFFLINE)) { - ahdlc_tx_offline = 0; - DEBUG1(("\nAHDLC_TX to many outstanding TX packets => ppp_reconnect()\n")); - ppp_reconnect(); - return 0; - } - -#if PACKET_TX_DEBUG - DEBUG1(("\n")); - for(i = 0; i < headerlen; ++i) { - DEBUG1(("0x%02x ", header[i])); - } - for(i = 0; i < datalen; ++i) { - DEBUG1(("0x%02x ", buffer[i])); - } - DEBUG1(("\n\n")); -#endif - - /* Check to see that physical layer is up, we can assume is some - cases */ - - /* write leading 0x7e */ - ppp_arch_putchar(0x7e); - - /* set initial CRC value */ - ahdlc_tx_crc = 0xffff; - /* send HDLC control and address if not disabled or of LCP frame type */ - /*if((0==(ahdlc_flags & PPP_ACFC)) || ((0xc0==buffer[0]) && (0x21==buffer[1]))) */ - if((0 == (ahdlc_flags & PPP_ACFC)) || (protocol == LCP)) { - ahdlc_tx_char(protocol, 0xff); - ahdlc_tx_char(protocol, 0x03); - } - - /* Write Protocol */ - ahdlc_tx_char(protocol,(u8_t)(protocol >> 8)); - ahdlc_tx_char(protocol,(u8_t)(protocol & 0xff)); - - /* write header if it exists */ - for(i = 0; i < headerlen; ++i) { - /* Get next byte from buffer */ - c = header[i]; - /* Write it...*/ - ahdlc_tx_char(protocol, c); - } - - /* Write frame bytes */ - for(i = 0; i < datalen; ++i) { - /* Get next byte from buffer */ - c = buffer[i]; - /* Write it...*/ - ahdlc_tx_char(protocol, c); - } - - /* send crc, lsb then msb */ - i = ahdlc_tx_crc ^ 0xffff; - ahdlc_tx_char(protocol, (u8_t)(i & 0xff)); - ahdlc_tx_char(protocol, (u8_t)((i >> 8) & 0xff)); - - /* write trailing 0x7e, probably not needed but it doesn't hurt*/ - ppp_arch_putchar(0x7e); - return 0; -} -/*---------------------------------------------------------------------------*/ diff --git a/backyard/core/net/ppp/ahdlc.h b/backyard/core/net/ppp/ahdlc.h deleted file mode 100644 index 4bb8ef644..000000000 --- a/backyard/core/net/ppp/ahdlc.h +++ /dev/null @@ -1,57 +0,0 @@ -#ifndef __AHDLC_H__ -#define __AHDLC_H__ - -/*--------------------------------------------------------------------------- - ahdlc.h - ahdlc header file ---------------------------------------------------------------------------- - Version - 0.1 Original Version Jan 11, 1998 - (c)1998 Mycal Labs, All Rights Reserved - ---------------------------------------------------------------------------*/ -/* - * Copyright (c) 2003, Mike Johnson, Mycal Labs, www.mycal.net - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Mike Johnson/Mycal Labs - * www.mycal.net. - * 4. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Mycal Modified uIP TCP/IP stack. - * - * $Id: ahdlc.h,v 1.1 2007/05/26 07:14:39 oliverschmidt Exp $ - * - */ - -#include "net/uip.h" - -void ahdlc_init(u8_t *, u16_t); -void ahdlc_rx_ready(void); -u8_t ahdlc_rx(u8_t); -u8_t ahdlc_tx(u16_t protocol, u8_t *header, u8_t *buffer, - u16_t headerlen, u16_t datalen); - -#endif /* __AHDLC_H__ */ diff --git a/backyard/core/net/ppp/ipcp.c b/backyard/core/net/ppp/ipcp.c deleted file mode 100644 index 24e51e75b..000000000 --- a/backyard/core/net/ppp/ipcp.c +++ /dev/null @@ -1,462 +0,0 @@ -/* - *--------------------------------------------------------------------------- - * ipcp.c - PPP IPCP (intrnet protocol) Processor/Handler - * - *--------------------------------------------------------------------------- - * - * Version - * 0.1 Original Version Jun 3, 2000 - * - *--------------------------------------------------------------------------- - * - * Copyright (C) 2000, Mycal Labs www.mycal.com - * - *--------------------------------------------------------------------------- - */ -/* - * Copyright (c) 2003, Mike Johnson, Mycal Labs, www.mycal.net - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Mike Johnson/Mycal Labs - * www.mycal.net. - * 4. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Mycal Modified uIP TCP/IP stack. - * - * $Id: ipcp.c,v 1.2 2010/10/19 18:29:03 adamdunkels Exp $ - * - */ - -/* */ -/* include files */ -/* */ - -#if 0 -#define DEBUG1(x) -#else -#include -#define DEBUG1(x) debug_printf x -#endif - -#include "net/uip.h" -/*#include "time.h"*/ -#include "ipcp.h" -#include "ppp.h" -#include "ahdlc.h" - -#define TIMER_expire() -#define TIMER_set() -#define TIMER_timeout(x) 1 - -#ifdef IPCP_GET_PEER_IP -uip_ipaddr_t peer_ip_addr; -#endif - -#ifdef IPCP_GET_PRI_DNS -uip_ipaddr_t pri_dns_addr; -#endif - -#ifdef IPCP_GET_SEC_DNS -uip_ipaddr_t sec_dns_addr; -#endif - -static unsigned long prev_ipcp_seconds = 0; - -/* - * Local IPCP state - */ -u8_t ipcp_state; - -/* - * in the future add copression protocol and name servers (possibly for servers only) - */ -u8_t ipcplist[] = {0x3, 0}; - -/*---------------------------------------------------------------------------*/ -#if 1 -void -printip(uip_ipaddr_t ip2) -{ - char *ip = (u8_t*)ip2; - DEBUG1((" %d.%d.%d.%d ",ip[0],ip[1],ip[2],ip[3])); -} -#else -#define printip(x) -#endif -/*---------------------------------------------------------------------------*/ -void -ipcp_init(void) -{ - DEBUG1(("ipcp init\n")); - ipcp_state = 0; - ppp_retry = 0; - pppif.ipaddr[0] = pppif.ipaddr[1] = 0; -} -/*---------------------------------------------------------------------------*/ -/* - * IPCP RX protocol Handler - */ -void -ipcp_rx(u8_t *buffer, u16_t count) -{ - u8_t *bptr = buffer; - IPCPPKT *pkt=(IPCPPKT *)buffer; - u16_t len; - - DEBUG1(("IPCP len %d\n",count)); - - switch(*bptr++) { - case CONF_REQ: - /* parce request and see if we can ACK it */ - ++bptr; - len = (*bptr++ << 8); - len |= *bptr++; - /* len-=2; */ - - DEBUG1(("check lcplist\n")); - if(scan_packet(IPCP, ipcplist, buffer, bptr, (u16_t)(len - 4))) { - DEBUG1(("option was bad\n")); - } else { - DEBUG1(("IPCP options are good\n")); - /* - * Parse out the results - */ - /* lets try to implement what peer wants */ - /* Reject any protocol not */ - /* Error? if we we need to send a config Reject ++++ this is - good for a subroutine*/ - /* All we should get is the peer IP address */ - if(IPCP_IPADDRESS == *bptr++) { - /* dump length */ - ++bptr; -#ifdef IPCP_GET_PEER_IP - ((u8_t*)peer_ip_addr)[0] = *bptr++; - ((u8_t*)peer_ip_addr)[1] = *bptr++; - ((u8_t*)peer_ip_addr)[2] = *bptr++; - ((u8_t*)peer_ip_addr)[3] = *bptr++; - DEBUG1(("Peer IP ")); - /* printip(peer_ip_addr);*/ - DEBUG1(("\n")); -#else - bptr += 4; -#endif - } else { - DEBUG1(("HMMMM this shouldn't happen IPCP1\n")); - } - -#if 0 - if(error) { - /* write the config NAK packet we've built above, take on the header */ - bptr = buffer; - *bptr++ = CONF_NAK; /* Write Conf_rej */ - *bptr++; - /*tptr++;*/ /* skip over ID */ - - /* Write new length */ - *bptr++ = 0; - *bptr = tptr - buffer; - - /* write the reject frame */ - DEBUG1(("Writing NAK frame \n")); - ahdlc_tx(IPCP, buffer, (u16_t)(tptr - buffer)); - DEBUG1(("- End NAK Write frame\n")); - - } else { - } -#endif - /* - * If we get here then we are OK, lets send an ACK and tell the rest - * of our modules our negotiated config. - */ - ipcp_state |= IPCP_RX_UP; - DEBUG1(("Send IPCP ACK!\n")); - bptr = buffer; - *bptr++ = CONF_ACK; /* Write Conf_ACK */ - bptr++; /* Skip ID (send same one) */ - /* - * Set stuff - */ - /* ppp_flags |= tflag; */ - DEBUG1(("SET- stuff -- are we up? c=%d dif=%d \n", count, (u16_t)(bptr-buffer))); - - /* write the ACK frame */ - DEBUG1(("Writing ACK frame \n")); - /* Send packet ahdlc_txz(procol,header,data,headerlen,datalen); */ - ahdlc_tx(IPCP, 0, buffer, 0, count /*bptr-buffer*/); - DEBUG1(("- End ACK Write frame\n")); - - /* expire the timer to make things happen after a state change */ - /*timer_expire(); */ - - /* } */ - } - break; - case CONF_ACK: /* config Ack */ - DEBUG1(("CONF ACK\n")); - /* - * Parse out the results - * - * Dump the ID and get the length. - */ - /* dump the ID */ - bptr++; - - /* get the length */ - len = (*bptr++ << 8); - len |= *bptr++; -#if 0 - /* Parse ACK and set data */ - while(bptr < buffer + len) { - switch(*bptr++) { - case IPCP_IPADDRESS: - /* dump length */ - bptr++; - ((u8_t*)ipaddr)[0] = *bptr++; - ((u8_t*)ipaddr)[1] = *bptr++; - ((u8_t*)ipaddr)[2] = *bptr++; - ((u8_t*)ipaddr)[3] = *bptr++; - break; - case IPCP_PRIMARY_DNS: - bptr++; - ((u8_t*)pri_dns_addr)[0] = *bptr++; - ((u8_t*)pri_dns_addr)[1] = *bptr++; - ((u8_t*)pri_dns_addr)[2] = *bptr++; - ((u8_t*)pri_dns_addr)[3] = *bptr++; - break; - case IPCP_SECONDARY_DNS: - bptr++; - ((u8_t*)sec_dns_addr)[0] = *bptr++; - ((u8_t*)sec_dns_addr)[1] = *bptr++; - ((u8_t*)sec_dns_addr)[2] = *bptr++; - ((u8_t*)sec_dns_addr)[3] = *bptr++; - break; - default: - DEBUG1(("IPCP CONFIG_ACK problem1\n")); - } - } -#endif - ipcp_state |= IPCP_TX_UP; - /*ipcp_state &= ~IPCP_RX_UP;*/ - DEBUG1(("were up! \n")); - printip(pppif.ipaddr); -#ifdef IPCP_GET_PRI_DNS - printip(pri_dns_addr); -#endif -#ifdef IPCP_GET_SEC_DNS - printip(sec_dns_addr); -#endif - DEBUG1(("\n")); - - /* expire the timer to make things happen after a state change */ - TIMER_expire(); - break; - case CONF_NAK: /* Config Nack */ - DEBUG1(("CONF NAK\n")); - /* dump the ID */ - bptr++; - /* get the length */ - len = (*bptr++ << 8); - len |= *bptr++; - - /* Parse ACK and set data */ - while(bptr < buffer + len) { - switch(*bptr++) { - case IPCP_IPADDRESS: - /* dump length */ - bptr++; - ((u8_t*)pppif.ipaddr)[0] = *bptr++; - ((u8_t*)pppif.ipaddr)[1] = *bptr++; - ((u8_t*)pppif.ipaddr)[2] = *bptr++; - ((u8_t*)pppif.ipaddr)[3] = *bptr++; - uip_fw_register( &pppif ); - DEBUG1(("My PPP-ipno: (%d.%d.%d.%d)\n", ((u8_t*)pppif.ipaddr)[0], ((u8_t*)pppif.ipaddr)[1], ((u8_t*)pppif.ipaddr)[2], ((u8_t*)pppif.ipaddr)[3])); - break; -#ifdef IPCP_GET_PRI_DNS - case IPCP_PRIMARY_DNS: - bptr++; - ((u8_t*)pri_dns_addr)[0] = *bptr++; - ((u8_t*)pri_dns_addr)[1] = *bptr++; - ((u8_t*)pri_dns_addr)[2] = *bptr++; - ((u8_t*)pri_dns_addr)[3] = *bptr++; - break; -#endif -#ifdef IPCP_GET_SEC_DNS - case IPCP_SECONDARY_DNS: - bptr++; - ((u8_t*)sec_dns_addr)[0] = *bptr++; - ((u8_t*)sec_dns_addr)[1] = *bptr++; - ((u8_t*)sec_dns_addr)[2] = *bptr++; - ((u8_t*)sec_dns_addr)[3] = *bptr++; - break; -#endif - default: - DEBUG1(("IPCP CONFIG_ACK problem 2\n")); - } - } - ppp_id++; - printip(pppif.ipaddr); -#ifdef IPCP_GET_PRI_DNS - printip(pri_dns_addr); -#endif -#ifdef IPCP_GET_PRI_DNS - printip(sec_dns_addr); -#endif - DEBUG1(("\n")); - /* expire the timer to make things happen after a state change */ - TIMER_expire(); - break; - case CONF_REJ: /* Config Reject */ - DEBUG1(("CONF REJ\n")); - /* Remove the offending options*/ - ppp_id++; - /* dump the ID */ - bptr++; - /* get the length */ - len = (*bptr++ << 8); - len |= *bptr++; - - /* Parse ACK and set data */ - while(bptr < buffer + len) { - switch(*bptr++) { - case IPCP_IPADDRESS: - ipcp_state |= IPCP_IP_BIT; - bptr += 5; - break; -#ifdef IPCP_GET_PRI_DNS - case IPCP_PRIMARY_DNS: - ipcp_state |= IPCP_PRI_DNS_BIT; - bptr += 5; - break; -#endif -#ifdef IPCP_GET_PRI_DNS - case IPCP_SECONDARY_DNS: - ipcp_state |= IPCP_SEC_DNS_BIT; - bptr += 5; - break; -#endif - default: - DEBUG1(("IPCP this shoudln't happen 3\n")); - } - } - /* expire the timer to make things happen after a state change */ - /*timer_expire(); */ - break; - default: - DEBUG1(("-Unknown 4\n")); - } -} - -/*---------------------------------------------------------------------------*/ -void -ipcp_task(u8_t *buffer) -{ - u8_t *bptr; - u16_t t; - IPCPPKT *pkt; - - /* IPCP tx not up and hasn't timed out then lets see if we need to - send a request */ - if(!(ipcp_state & IPCP_TX_UP) && !(ipcp_state & IPCP_TX_TIMEOUT)) { - /* Check if we have a request pending */ - /*t=get_seconds()-ipcp_tx_time;*/ -#if 0 - if(TIMER_timeout(IPCP_TIMEOUT)) { -#else - if((clock_seconds() - prev_ipcp_seconds) > IPCP_TIMEOUT) { - prev_ipcp_seconds = clock_seconds(); -#endif - - /* - * No pending request, lets build one - */ - pkt=(IPCPPKT *)buffer; - - /* Configure-Request only here, write id */ - pkt->code = CONF_REQ; - pkt->id = ppp_id; - - bptr = pkt->data; - - /* - * Write options, we want IP address, and DNS addresses if set. - */ - - /* Write zeros for IP address the first time */ - *bptr++ = IPCP_IPADDRESS; - *bptr++ = 0x6; - *bptr++ = ((u8_t*)pppif.ipaddr)[0]; - *bptr++ = ((u8_t*)pppif.ipaddr)[1]; - *bptr++ = ((u8_t*)pppif.ipaddr)[2]; - *bptr++ = ((u8_t*)pppif.ipaddr)[3]; - -#ifdef IPCP_GET_PRI_DNS - if(!(ipcp_state & IPCP_PRI_DNS_BIT)) { - /* Write zeros for IP address the first time */ - *bptr++ = IPCP_PRIMARY_DNS; - *bptr++ = 0x6; - *bptr++ = ((u8_t*)pri_dns_addr)[0]; - *bptr++ = ((u8_t*)pri_dns_addr)[1]; - *bptr++ = ((u8_t*)pri_dns_addr)[2]; - *bptr++ = ((u8_t*)pri_dns_addr)[3]; - } -#endif -#ifdef IPCP_GET_SEC_DNS - if(!(ipcp_state & IPCP_SEC_DNS_BIT)) { - /* Write zeros for IP address the first time */ - *bptr++ = IPCP_SECONDARY_DNS; - *bptr++ = 0x6; - *bptr++ = ((u8_t*)sec_dns_addr)[0]; - *bptr++ = ((u8_t*)sec_dns_addr)[1]; - *bptr++ = ((u8_t*)sec_dns_addr)[2]; - *bptr++ = ((u8_t*)sec_dns_addr)[3]; - } -#endif - /* Write length */ - t = bptr - buffer; - /* length here - code and ID + */ - pkt->len = uip_htons(t); - - DEBUG1(("\n**Sending IPCP Request packet\n")); - - /* Send packet ahdlc_txz(procol,header,data,headerlen,datalen); */ - ahdlc_tx(IPCP, 0, buffer, 0, t); - - /* Set timer */ - /*ipcp_tx_time=get_seconds();*/ - TIMER_set(); - /* Inc retry */ - /*ipcp_retry++;*/ - ppp_retry++; - /* - * Have we timed out? (combide the timers?) - */ - if(ppp_retry > IPCP_RETRY_COUNT) - ipcp_state &= IPCP_TX_TIMEOUT; - } - } -} -/*---------------------------------------------------------------------------*/ diff --git a/backyard/core/net/ppp/ipcp.h b/backyard/core/net/ppp/ipcp.h deleted file mode 100644 index 58a89977e..000000000 --- a/backyard/core/net/ppp/ipcp.h +++ /dev/null @@ -1,95 +0,0 @@ -#ifndef __IPCP_H__ -#define __IPCP_H__ -/* www.mycal.com - --------------------------------------------------------------------------- - IPCP.h - Internet Protocol Control Protocol header file - --------------------------------------------------------------------------- - Version - 0.1 Original Version June 3, 2000 - (c)2000 Mycal Labs, All Rights Reserved - --------------------------------------------------------------------------- -*/ -/* - * Copyright (c) 2003, Mike Johnson, Mycal Labs, www.mycal.net - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Mike Johnson/Mycal Labs - * www.mycal.net. - * 4. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Mycal Modified uIP TCP/IP stack. - * - * $Id: ipcp.h,v 1.1 2007/05/26 07:14:39 oliverschmidt Exp $ - * - */ -#include "net/uip.h" -#include "contiki-conf.h" - -/* Config options (move to pppconfig) - #define IPCP_RETRY_COUNT 5 - #define IPCP_TIMEOUT 5 -*/ - -/* IPCP Option Types */ -#define IPCP_IPADDRESS 0x03 -#define IPCP_PRIMARY_DNS 0x81 -#define IPCP_SECONDARY_DNS 0x83 - -/* IPCP state machine flags */ -#define IPCP_TX_UP 0x01 -#define IPCP_RX_UP 0x02 -#define IPCP_IP_BIT 0x04 -#define IPCP_TX_TIMEOUT 0x08 -#define IPCP_PRI_DNS_BIT 0x08 -#define IPCP_SEC_DNS_BIT 0x10 - -typedef struct _ipcp -{ - u8_t code; - u8_t id; - u16_t len; - u8_t data[0]; -} IPCPPKT; - -/* - * Export IP addresses. - */ -#if 0 /* moved to mip.c */ -extern IPAddr our_ipaddr; -extern IPAddr peer_ip_addr; -extern IPAddr pri_dns_addr; -extern IPAddr sec_dns_addr; -#endif - -extern u8_t ipcp_state; - -void ipcp_init(void); -void ipcp_task(u8_t *buffer); -void ipcp_rx(u8_t *, u16_t); - -#endif /* __IPCP_H__ */ - diff --git a/backyard/core/net/ppp/lcp.c b/backyard/core/net/ppp/lcp.c deleted file mode 100644 index 5b095e86c..000000000 --- a/backyard/core/net/ppp/lcp.c +++ /dev/null @@ -1,463 +0,0 @@ -/* www.mycal.com - *--------------------------------------------------------------------------- - *lcp.c - Link Configuration Protocol Handler. - - - *--------------------------------------------------------------------------- - *Version - 0.1 Original Version June 3, 2000 - - * - *--------------------------------------------------------------------------- - *- Copyright (C) 2000, Mycal Labs www.mycal.com - - - *--------------------------------------------------------------------------- - * - * -*/ -/* - * Copyright (c) 2003, Mike Johnson, Mycal Labs, www.mycal.net - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Mike Johnson/Mycal Labs - * www.mycal.net. - * 4. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Mycal Modified uIP TCP/IP stack. - * - * $Id: lcp.c,v 1.2 2010/10/19 18:29:03 adamdunkels Exp $ - * - */ - -/* */ -/* include files */ -/* */ - -#include "contiki-conf.h" - -/*#include "time.h"*/ -#include "ppp.h" -#include "ahdlc.h" -#include "lcp.h" - -#if 0 -#define DEBUG1(x) -#define DEBUG2(x) -#else -#include -#define DEBUG1(x) debug_printf x -#define DEBUG2(x) debug_printf x -#endif - -#define TIMER_expire() -#define TIMER_set() -#define TIMER_timeout(x) 1 -static unsigned long prev_lcp_seconds = 0; - - -/*u8_t tflag; -u8_t *lcp_buffer; -u16_t lcp_tx_time; -u8_t lcp_retry; -u16_t lcp_timeout=5;*/ - -u8_t lcp_state; -u16_t ppp_tx_mru = 0; - -/* We need this when we neg our direction. - u8_t lcp_tx_options; */ - -/* - * Define the supported paramets for this module here. - */ -u8_t lcplist[] = { - LPC_MAGICNUMBER, - LPC_PFC, - LPC_ACFC, - LPC_AUTH, - LPC_ACCM, - LPC_MRU, - 0}; - - -/*---------------------------------------------------------------------------*/ -/* lcp_init() - Initialize the LCP engine to startup values */ -/*---------------------------------------------------------------------------*/ -void -lcp_init(void) -{ - lcp_state = 0; - ppp_retry = 0; - TIMER_expire(); -} -/*---------------------------------------------------------------------------*/ -/* lcp_rx() - Receive an LCP packet and process it. - * This routine receives a LCP packet in buffer of length count. - * Process it here, support for CONF_REQ, CONF_ACK, CONF_NACK, CONF_REJ or - * TERM_REQ. - */ -/*---------------------------------------------------------------------------*/ -void -lcp_rx(u8_t *buffer, u16_t count) -{ - u8_t *bptr = buffer, *tptr; - u8_t error = 0; - u8_t id; - u16_t len, j; - - switch(*bptr++) { - case CONF_REQ: /* config request */ - /* parce request and see if we can ACK it */ - id = *bptr++; - len = (*bptr++ << 8); - len |= *bptr++; - /*len -= 2;*/ - DEBUG1(("received [LCP Config Request id %u\n",id)); - if(scan_packet((u16_t)LCP, lcplist, buffer, bptr, (u16_t)(len-4))) { - /* must do the -4 here, !scan packet */ - - DEBUG1((" options were rejected\n")); - } else { - /* lets try to implement what peer wants */ - tptr = bptr = buffer; - bptr += 4; /* skip code, id, len */ - error = 0; - /* first scan for unknown values */ - while(bptr < buffer+len) { - switch(*bptr++) { - case LPC_MRU: /* mru */ - j = *bptr++; - j -= 2; - if(j == 2) { - ppp_tx_mru = ((int)*bptr++) << 8; - ppp_tx_mru |= *bptr++; - DEBUG1((" ",ppp_tx_mru)); - } else { - DEBUG1((" ")); - } - break; - case LPC_ACCM: /* */ - bptr++; /* skip length */ - j = *bptr++; - j += *bptr++; - j += *bptr++; - j += *bptr++; - if(j==0) { - // ok - DEBUG1(("",j)); - //ahdlc_flags |= PPP_TX_ASYNC_MAP; - } else if(j!=0) { - // ok - DEBUG1((", assume 0xffffffff",j)); - } else { - /* - * fail we only support default or all zeros - */ - DEBUG1(("We only support default or all zeros for ACCM ")); - error = 1; - *tptr++ = LPC_ACCM; - *tptr++ = 0x6; - *tptr++ = 0; - *tptr++ = 0; - *tptr++ = 0; - *tptr++ = 0; - } - break; - case LPC_AUTH: - bptr++; - if((*bptr++ == 0xc0) && (*bptr++ == 0x23)) { - /* negotiate PAP */ - if (strlen(pap_username) > 0) { - DEBUG1((" ")); - lcp_state |= LCP_RX_AUTH; - } else { - DEBUG1((" ")); - - *tptr++ = CONF_REJ; - *tptr++; // Keep ID - *tptr++ = 0; - *tptr++ = 8; - *tptr++ = LPC_AUTH; - *tptr++ = 0x4; - *tptr++ = 0xc0; - *tptr++ = 0x23; - ahdlc_tx(LCP, 0, buffer, 0, (u16_t)(tptr-buffer)); - return; - } - } else { - /* we only support PAP */ - DEBUG1(("")); - error = 1; - *tptr++ = LPC_AUTH; - *tptr++ = 0x4; - *tptr++ = 0xc0; - *tptr++ = 0x23; - } - break; - case LPC_MAGICNUMBER: - DEBUG1((" ")); - /* - * Compair incoming number to our number (not implemented) - */ - bptr++; /* for now just dump */ - bptr++; - bptr++; - bptr++; - bptr++; - break; - case LPC_PFC: - bptr++; - DEBUG1((" ")); - /*tflag|=PPP_PFC;*/ - break; - case LPC_ACFC: - bptr++; - DEBUG1((" ")); - /*tflag|=PPP_ACFC;*/ - break; - - } - } - /* Error? if we we need to send a config Reject ++++ this is good for a subroutine */ - if(error) { - /* write the config NAK packet we've built above, take on the header */ - bptr = buffer; - *bptr++ = CONF_NAK; /* Write Conf_rej */ - *bptr++;/*tptr++;*/ /* skip over ID */ - - /* Write new length */ - *bptr++ = 0; - *bptr = tptr - buffer; - - /* write the reject frame */ - DEBUG1(("\nWriting NAK frame \n")); - // Send packet ahdlc_txz(procol,header,data,headerlen,datalen); - ahdlc_tx(LCP, 0, buffer, 0, (u16_t)(tptr-buffer)); - DEBUG1(("- end NAK Write frame\n")); - - } else { - /* - * If we get here then we are OK, lets send an ACK and tell the rest - * of our modules our negotiated config. - */ - DEBUG1(("\nSend ACK!\n")); - bptr = buffer; - *bptr++ = CONF_ACK; /* Write Conf_ACK */ - bptr++; /* Skip ID (send same one) */ - /* - * Set stuff - */ - /*ppp_flags|=tflag;*/ - /* DEBUG2("SET- stuff -- are we up? c=%d dif=%d \n", count, (u16_t)(bptr-buffer)); */ - - /* write the ACK frame */ - DEBUG2(("Writing ACK frame \n")); - /* Send packet ahdlc_txz(procol,header,data,headerlen,datalen); */ - ahdlc_tx(LCP, 0, buffer, 0, count /*bptr-buffer*/); - DEBUG2(("- end ACK Write frame\n")); - lcp_state |= LCP_RX_UP; - - /* expire the timer to make things happen after a state change */ - /*timer_expire();*/ - - } - } - break; - case CONF_ACK: /* config Ack Anytime we do an ack reset the timer to force send. */ - DEBUG1(("LCP-ACK - ")); - /* check that ID matches one sent */ - if(*bptr++ == ppp_id) { - /* Change state to PPP up. */ - DEBUG1((">>>>>>>> good ACK id up! %d\n",ppp_id)); - /* copy negotiated values over */ - - lcp_state |= LCP_TX_UP; - - /* expire the timer to make things happen after a state change */ - TIMER_expire(); - } - else - DEBUG1(("*************++++++++++ bad id %d\n",ppp_id)); - break; - case CONF_NAK: /* Config Nack */ - DEBUG1(("LCP-CONF NAK\n")); - ppp_id++; - break; - case CONF_REJ: /* Config Reject */ - DEBUG1(("LCP-CONF REJ\n")); - ppp_id++; - break; - case TERM_REQ: /* Terminate Request */ - DEBUG1(("LCP-TERM-REQ -")); - bptr = buffer; - *bptr++ = TERM_ACK; /* Write TERM_ACK */ - /* write the reject frame */ - DEBUG1(("Writing TERM_ACK frame \n")); - /* Send packet ahdlc_txz(procol,header,data,headerlen,datalen); */ - ahdlc_tx(LCP, 0, buffer, 0, count); - lcp_state &= ~LCP_TX_UP; - lcp_state |= LCP_TERM_PEER; - break; - case TERM_ACK: - DEBUG1(("LCP-TERM ACK\n")); - break; - default: - break; - } -} - - -void lcp_disconnect(u8_t id) { - u8_t buffer[4]; - u8_t *bptr = buffer; - *bptr++ = TERM_REQ; - *bptr++ = id; - *bptr++ = 0; - *bptr++ = 4; - ahdlc_tx(LCP, 0, buffer, 0, bptr - buffer); -} - -/*---------------------------------------------------------------------------*/ -/* lcp_task(buffer) - This routine see if a lcp request needs to be sent - * out. It uses the passed buffer to form the packet. This formed LCP - * request is what we negotiate for sending options on the link. - * - * Currently we negotiate : Magic Number Only, but this will change. - */ -/*---------------------------------------------------------------------------*/ -void -lcp_task(u8_t *buffer) -{ - u8_t *bptr; - u16_t t; - LCPPKT *pkt; - - /* lcp tx not up and hasn't timed out then lets see if we need to send a request */ - if(!(lcp_state & LCP_TX_UP) && !(lcp_state & LCP_TX_TIMEOUT)) { - /* Check if we have a request pending */ - /*t=get_seconds()-lcp_tx_time;*/ -#if 0 - if(1 == TIMER_timeout(LCP_TX_TIMEOUT)) { -#else - if((clock_seconds() - prev_lcp_seconds) > LCP_TIMEOUT) { - prev_lcp_seconds = clock_seconds(); -#endif - DEBUG1(("\nSending LCP request packet - ")); - /* - * No pending request, lets build one - */ - pkt = (LCPPKT *)buffer; - - /* Configure-Request only here, write id */ - pkt->code = CONF_REQ; - pkt->id = ppp_id; - - bptr = pkt->data; - - /* Write options */ - - /* ACCM */ - //if((lcp_tx_options & LCP_OPT_ACCM) & 0) { - *bptr++ = LPC_ACCM; - *bptr++ = 0x6; - *bptr++ = 0xff; - *bptr++ = 0xff; - *bptr++ = 0xff; - *bptr++ = 0xff; - //} - -#if 0 - /* Write magic number */ - DEBUG1(("LPC_MAGICNUMBER -")); - *bptr++ = LPC_MAGICNUMBER; - *bptr++ = 0x6; - /* - *bptr++ = random_rand() & 0xff; - *bptr++ = random_rand() & 0xff; - *bptr++ = random_rand() & 0xff; - *bptr++ = random_rand() & 0xff; - */ - *bptr++ = 0x11; - *bptr++ = 0x11; - *bptr++ = 0x11; - *bptr++ = 0x11; -#endif - -#if 0 - /* - * Authentication protocol - */ - if((lcp_tx_options & LCP_OPT_AUTH) && 0) { - /* - * If turned on, we only negotiate PAP - */ - *bptr++ = LPC_AUTH; - *bptr++ = 0x4; - *bptr++ = 0xc0; - *bptr++ = 0x23; - } - /* - * PFC - */ - if((lcp_tx_options & LCP_OPT_PFC) && 0) { - /* - * If turned on, we only negotiate PAP - */ - *bptr++ = LPC_PFC; - *bptr++ = 0x2; - } - /* - * ACFC - */ - if((lcp_tx_options & LCP_OPT_ACFC) && 0) { - /* - * If turned on, we only negotiate PAP - */ - *bptr++ = LPC_ACFC; - *bptr++ = 0x2; - } -#endif - /* Write length */ - t = bptr - buffer; - pkt->len = uip_htons(t); /* length here - code and ID + */ - - DEBUG1((" len %d\n",t)); - - /* Send packet */ - /* Send packet ahdlc_txz(procol,header,data,headerlen,datalen); */ - ahdlc_tx(LCP, 0, buffer, 0, t); - - /* Set timer */ - TIMER_set(); - /*lcp_tx_time=get_seconds();*/ - /* Inc retry */ - ppp_retry++; - /* - * Have we timed out? - */ - if(ppp_retry > LCP_RETRY_COUNT) { - lcp_state &= LCP_TX_TIMEOUT; - } - } - } -} -/*---------------------------------------------------------------------------*/ diff --git a/backyard/core/net/ppp/lcp.h b/backyard/core/net/ppp/lcp.h deleted file mode 100644 index b39e15936..000000000 --- a/backyard/core/net/ppp/lcp.h +++ /dev/null @@ -1,96 +0,0 @@ -#ifndef __LCP_H__ -#define __LCP_H__ -/* www.mycal.com - --------------------------------------------------------------------------- - LCP.h - LCP header file - --------------------------------------------------------------------------- - Version - - 0.1 Original Version June 3, 2000 - (c)2000 Mycal Labs, All Rights Reserved - --------------------------------------------------------------------------- -*/ -/* - * Copyright (c) 2003, Mike Johnson, Mycal Labs, www.mycal.net - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Mike Johnson/Mycal Labs - * www.mycal.net. - * 4. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Mycal Modified uIP TCP/IP stack. - * - * $Id: lcp.h,v 1.1 2007/05/26 07:14:39 oliverschmidt Exp $ - * - */ - -#include "net/uip.h" -#include "contiki-conf.h" - -/* LCP Option Types */ -#define LPC_VENDERX 0x0 -#define LPC_MRU 0x1 -#define LPC_ACCM 0x2 -#define LPC_AUTH 0x3 -#define LPC_QUALITY 0x4 -#define LPC_MAGICNUMBER 0x5 -#define LPC_PFC 0x7 -#define LPC_ACFC 0x8 - -/* LCP Negotiated options flag equates */ -#define LCP_OPT_ACCM 0x1 -#define LCP_OPT_AUTH 0x2 -#define LCP_OPT_PFC 0x4 -#define LCP_OPT_ACFC 0x4 - -/* LCP state machine flags */ -#define LCP_TX_UP 0x1 -#define LCP_RX_UP 0x2 - -#define LCP_RX_AUTH 0x10 -/* LCP request for auth */ -#define LCP_TERM_PEER 0x20 -/* LCP Terminated by peer */ -#define LCP_RX_TIMEOUT 0x40 -#define LCP_TX_TIMEOUT 0x80 - -typedef struct _lcppkt -{ - u8_t code; - u8_t id; - u16_t len; - u8_t data[0]; -} LCPPKT; - -/* Exported Vars */ -extern u8_t lcp_state; - -void lcp_init(void); -void lcp_rx(u8_t *, u16_t); -void lcp_task(u8_t *buffer); -void lcp_disconnect(u8_t id); - -#endif /* __LCP_H__ */ diff --git a/backyard/core/net/ppp/pap.c b/backyard/core/net/ppp/pap.c deleted file mode 100644 index d75fae5f8..000000000 --- a/backyard/core/net/ppp/pap.c +++ /dev/null @@ -1,195 +0,0 @@ -/*www.mycal.net - *--------------------------------------------------------------------------- - *pap.c - PAP processor for the PPP module - - - *--------------------------------------------------------------------------- - *Version - 0.1 Original Version Jun 3, 2000 - - - *--------------------------------------------------------------------------- - *- Copyright (C) 2000, Mycal Labs www.mycal.com - - - *--------------------------------------------------------------------------- -*/ -/* - * Copyright (c) 2003, Mike Johnson, Mycal Labs, www.mycal.net - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Mike Johnson/Mycal Labs - * www.mycal.net. - * 4. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Mycal Modified uIP TCP/IP stack. - * - * $Id: pap.c,v 1.2 2010/10/19 18:29:03 adamdunkels Exp $ - * - */ - -/* */ -/* include files */ -/* */ - -#include -#include "ppp.h" -#include "pap.h" -#include "lcp.h" - -#if 0 -#define DEBUG1(x) -#else -#include -#define DEBUG1(x) debug_printf x -#endif - -/*#include "time.h"*/ -/*#include "utils.h" */ -#define TIMER_expire() -#define TIMER_set() -#define TIMER_timeout(x) 1 - - -u8_t pap_state; - -#ifdef PAP_USERNAME -u8_t pap_username[] = PAP_USERNAME; -#else -u8_t pap_username[PAP_USERNAME_SIZE]; -#endif - -#ifdef PAP_PASSWORD -u8_t pap_password[] = PAP_PASSWORD; -#else -u8_t pap_password[PAP_PASSWORD_SIZE]; -#endif - -/*u16_t pap_tx_time; - u8_t pap_timeout;*/ - -/*---------------------------------------------------------------------------*/ -void -pap_init(void) -{ - ppp_retry = 0; /* We reuse ppp_retry */ - pap_state = 0; -} -/*---------------------------------------------------------------------------*/ -/* pap_rx() - PAP RX protocol Handler */ -/*---------------------------------------------------------------------------*/ -void -pap_rx(u8_t *buffer, u16_t count) -{ - u8_t *bptr=buffer; - u8_t len; - - switch(*bptr++) { - case CONF_REQ: - DEBUG1(("CONF ACK - only for server, no support\n")); - break; - case CONF_ACK: /* config Ack */ - DEBUG1(("CONF ACK - PAP good - ")); - /* Display message if debug */ - len = *bptr++; - *(bptr + len) = 0; - DEBUG1((" %s \n",bptr)); - pap_state |= PAP_TX_UP; - /* expire the timer to make things happen after a state change */ - TIMER_expire(); - break; - case CONF_NAK: - DEBUG1(("CONF NAK - Failed Auth - ")); - pap_state |= PAP_TX_AUTH_FAIL; - /* display message if debug */ - len = *bptr++; - *(bptr + len)=0; - DEBUG1((" %s \n",bptr)); - break; - } -} -/*---------------------------------------------------------------------------*/ -/* pap_task() - This task needs to be called every so often during the PAP - * negotiation phase. This task sends PAP REQ packets. - */ -/*---------------------------------------------------------------------------*/ -void -pap_task(u8_t *buffer) -{ - u8_t *bptr; - u16_t t; - PAPPKT *pkt; - - /* If LCP is up and PAP negotiated, try to bring up PAP */ - if(!(pap_state & PAP_TX_UP) && !(pap_state & PAP_TX_TIMEOUT)) { - /* Do we need to send a PAP auth packet? - Check if we have a request pending*/ - if(1 == TIMER_timeout(PAP_TIMEOUT)) { - /* Check if we have a request pending */ - /* t=get_seconds()-pap_tx_time; - if( t > pap_timeout) - { - */ - /* We need to send a PAP authentication request */ - DEBUG1(("\nSending PAP Request packet - ")); - - /* Build a PAP request packet */ - pkt = (PAPPKT *)buffer; - - /* Configure-Request only here, write id */ - pkt->code = CONF_REQ; - pkt->id = ppp_id; - bptr = pkt->data; - - /* Write options */ - t = strlen(pap_username); - /* Write peer length */ - *bptr++ = (u8_t)t; - bptr = memcpy(bptr, pap_username, t); - - t = strlen(pap_password); - *bptr++ = (u8_t)t; - bptr = memcpy(bptr, pap_password, t); - - /* Write length */ - t = bptr - buffer; - /* length here - code and ID + */ - pkt->len = uip_htons(t); - - DEBUG1((" Len %d\n",t)); - - /* Send packet */ - ahdlc_tx(PAP, buffer, 0, t, 0); - - /* Set timer */ - TIMER_set(); - - ppp_retry++; - - /* Have we failed? */ - if(ppp_retry > 3) { - DEBUG1(("PAP - timout\n")); - pap_state &= PAP_TX_TIMEOUT; - - } - } - } -} -/*---------------------------------------------------------------------------*/ diff --git a/backyard/core/net/ppp/pap.h b/backyard/core/net/ppp/pap.h deleted file mode 100644 index 6ed0bdaab..000000000 --- a/backyard/core/net/ppp/pap.h +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef __PAP_H__ -#define __PAP_H__ -/* - www.mycal.com - --------------------------------------------------------------------------- - pap.h - pap header file - --------------------------------------------------------------------------- - Version - 0.1 Original Version June 3, 2000 - (c)2000 Mycal Labs, All Rights Reserved - --------------------------------------------------------------------------- -*/ -/* - * Copyright (c) 2003, Mike Johnson, Mycal Labs, www.mycal.net - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Mike Johnson/Mycal Labs - * www.mycal.net. - * 4. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Mycal Modified uIP TCP/IP stack. - * - * $Id: pap.h,v 1.1 2007/05/26 07:14:40 oliverschmidt Exp $ - * - */ - -#include "net/uip.h" - -/* PAP state machine flags */ -/* client only */ -#define PAP_TX_UP 0x01 -/* server only */ -#define PAP_RX_UP 0x02 - -#define PAP_RX_AUTH_FAIL 0x10 -#define PAP_TX_AUTH_FAIL 0x20 -#define PAP_RX_TIMEOUT 0x80 -#define PAP_TX_TIMEOUT 0x80 - -typedef struct _pappkt { - u8_t code; - u8_t id; - u16_t len; - u8_t data[0]; -} PAPPKT; - -/* Export pap_state */ -extern u8_t pap_state; - -extern u8_t pap_username[]; -extern u8_t pap_password[]; - -/* Function prototypes */ -void pap_init(void); -void pap_rx(u8_t *, u16_t); -void pap_task(u8_t *buffer); - -#endif /* __PAP_H__ */ - diff --git a/backyard/core/net/ppp/ppp-service.c b/backyard/core/net/ppp/ppp-service.c deleted file mode 100644 index af777d119..000000000 --- a/backyard/core/net/ppp/ppp-service.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * @(#)$Id: ppp-service.c,v 1.1 2007/05/26 07:14:40 oliverschmidt Exp $ - */ - -#if 0 -#include "net/packet-service.h" -#include "ppp.h" - -static void output(u8_t *hdr, u16_t hdrlen, u8_t *data, u16_t datalen); - -static const struct packet_service_state state = - { - PACKET_SERVICE_VERSION, - output - }; - -EK_EVENTHANDLER(eventhandler, ev, data); -EK_POLLHANDLER(pollhandler); -EK_PROCESS(proc, PACKET_SERVICE_NAME, EK_PRIO_NORMAL, - eventhandler, pollhandler, (void *)&state); - -/*---------------------------------------------------------------------------*/ -EK_PROCESS_INIT(ppp_service_init, arg) -{ - ek_service_start(PACKET_SERVICE_NAME, &proc); -} -/*---------------------------------------------------------------------------*/ -static void -output(u8_t *hdr, u16_t hdrlen, u8_t *data, u16_t datalen) -{ - ppp_send(); -} -/*---------------------------------------------------------------------------*/ -EK_EVENTHANDLER(eventhandler, ev, data) -{ - switch(ev) { - case EK_EVENT_INIT: - case EK_EVENT_REPLACE: -// ppp_init(); - break; - case EK_EVENT_REQUEST_REPLACE: - ek_replace((struct ek_proc *)data, NULL); - LOADER_UNLOAD(); - break; - case EK_EVENT_REQUEST_EXIT: - ek_exit(); - LOADER_UNLOAD(); - break; - default: - break; - } -} -/*---------------------------------------------------------------------------*/ -EK_POLLHANDLER(pollhandler) -{ - ppp_poll(); - if(uip_len > 0) { - tcpip_input(); - } -} -/*---------------------------------------------------------------------------*/ -#endif diff --git a/backyard/core/net/ppp/ppp.c b/backyard/core/net/ppp/ppp.c deleted file mode 100644 index d0c1aa288..000000000 --- a/backyard/core/net/ppp/ppp.c +++ /dev/null @@ -1,440 +0,0 @@ -/* - *--------------------------------------------------------------------------- - * ppp.c - PPP Processor/Handler - - * - - *--------------------------------------------------------------------------- - * - * Version - - * 0.1 Original Version Jun 3, 2000 - - * - - *--------------------------------------------------------------------------- - */ -/* - * Copyright (c) 2003, Mike Johnson, Mycal Labs, www.mycal.net - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Mike Johnson/Mycal Labs - * www.mycal.net. - * 4. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Mycal Modified uIP TCP/IP stack. - * - * $Id: ppp.c,v 1.2 2010/10/19 18:29:03 adamdunkels Exp $ - * - */ - -/* */ -/* include files */ -/* */ - - -#include "lcp.h" -#include "pap.h" -#include "ipcp.h" -/*#include "time.h"*/ -/*#include "mip.h"*/ - -#if 0 -#define DEBUG1(x) -#else -#include -#define DEBUG1(x) debug_printf x -#endif - -/* - Set the debug message level -*/ -#define PACKET_RX_DEBUG 1 - -/* - Include stuff -*/ -/*#include "mTypes.h"*/ -#include "ppp.h" -#include "ahdlc.h" -#include "ipcp.h" -#include "lcp.h" - -extern int ppp_arch_getchar(u8_t *p); - - -/* - Buffers that this layer needs (this can be optimized out) -*/ -u8_t ppp_rx_buffer[PPP_RX_BUFFER_SIZE]; -/*u8_t ppp_tx_buffer[PPP_TX_BUFFER_SIZE];*/ - -/* - * Other state storage (this can be placed in a struct and this could could - * support multiple PPP connections, would have to embedded the other ppp - * module state also) - */ -u8_t ppp_flags; -u8_t ppp_id; -u8_t ppp_retry; - -#if PACKET_RX_DEBUG -u16_t ppp_rx_frame_count=0; -u16_t ppp_rx_tobig_error; -u8_t done; /* temporary variable */ -#endif - -/*---------------------------------------------------------------------------*/ -static u8_t -check_ppp_errors(void) -{ - u8_t ret = 0; - - /* Check Errors */ - if(lcp_state & LCP_TX_TIMEOUT) { - ret = 1; - } - if(lcp_state & LCP_RX_TIMEOUT) { - ret = 2; - } - - if(pap_state & PAP_TX_AUTH_FAIL) { - ret = 3; - } - if(pap_state & PAP_RX_AUTH_FAIL) { - ret = 4; - } - - if(pap_state & PAP_TX_TIMEOUT) { - ret = 5; - } - if(pap_state & PAP_RX_TIMEOUT) { - ret = 6; - } - - if(ipcp_state & IPCP_TX_TIMEOUT) { - ret = 7; - } - - return ret; -} -/*---------------------------------------------------------------------------*/ -/* - * Unknown Protocol Handler, sends reject - */ -static void -ppp_reject_protocol(u16_t protocol, u8_t *buffer, u16_t count) -{ - u16_t i; - u8_t *dptr, *sptr; - LCPPKT *pkt; - - /* first copy rejected packet back, start from end and work forward, - +++ Pay attention to buffer managment when updated. Assumes fixed - PPP blocks. */ - DEBUG1(("Rejecting Protocol\n")); - if((count + 6) > PPP_RX_BUFFER_SIZE) { - /* This is a fatal error +++ do somthing about it. */ - DEBUG1(("Cannot Reject Protocol, PKT to big\n")); - return; - } - dptr = buffer + count + 6; - sptr = buffer + count; - for(i = 0; i < count; ++i) { - *dptr-- = *sptr--; - } - - pkt = (LCPPKT *)buffer; - pkt->code = PROT_REJ; /* Write Conf_rej */ - /*pkt->id = tid++;*/ /* write tid */ - pkt->len = uip_htons(count + 6); - *((u16_t *)(&pkt->data[0])) = uip_htons(protocol); - - ahdlc_tx(LCP, buffer, 0, (u16_t)(count + 6), 0); -} -/*---------------------------------------------------------------------------*/ -#if PACKET_RX_DEBUG -void -dump_ppp_packet(u8_t *buffer, u16_t len) -{ - int i; - - DEBUG1(("\n")); - for(i = 0;i < len; ++i) { - if((i & 0x1f) == 0x10) { - DEBUG1(("\n")); - } - DEBUG1(("0x%02x ",buffer[i])); - } - DEBUG1(("\n\n")); -} -#endif -/*---------------------------------------------------------------------------*/ -/* Initialize and start PPP engine. This just sets things up to - * starting values. This can stay a private method. - */ -/*---------------------------------------------------------------------------*/ -void -ppp_init() -{ -#if PACKET_RX_DEBUG - ppp_rx_frame_count = 0; - done = 0; -#endif - ppp_flags = 0; - pap_init(); - ipcp_init(); - lcp_init(); - ppp_flags = 0; - - ahdlc_init(ppp_rx_buffer, PPP_RX_BUFFER_SIZE); - ahdlc_rx_ready(); -} -/*---------------------------------------------------------------------------*/ -/* raise_ppp() - This routine will try to bring up a PPP connection, - * It is blocking. In the future we probably want to pass a - * structure with all the options on bringing up a PPP link, like - * server/client, DSN server, username password for PAP... +++ for - * now just use config and bit defines - */ -/*---------------------------------------------------------------------------*/ -#if 0 -u16_t -ppp_raise(u8_t config, u8_t *username, u8_t *password) -{ - u16_t status = 0; - - /* Initialize PPP engine */ - /* init_ppp(); */ - pap_init(); - ipcp_init(); - lcp_init(); - - /* Enable PPP */ - ppp_flags = PPP_RX_READY; - - /* Try to bring up the layers */ - while(status == 0) { -#ifdef SYSTEM_POLLER - /* If the the serial interrupt is not hooked to ahdlc_rx, or the - system needs to handle other stuff while were blocking, call - the system poller.*/ - system_poller(); -#endif - - /* call the lcp task to bring up the LCP layer */ - lcp_task(ppp_tx_buffer); - - /* If LCP is up, neg next layer */ - if(lcp_state & LCP_TX_UP) { - /* If LCP wants PAP, try to authenticate, else bring up IPCP */ - if((lcp_state & LCP_RX_AUTH) && (!(pap_state & PAP_TX_UP))) { - pap_task(ppp_tx_buffer,username,password); - } else { - ipcp_task(ppp_tx_buffer); - } - } - - - /* If IPCP came up then our link should be up. */ - if((ipcp_state & IPCP_TX_UP) && (ipcp_state & IPCP_RX_UP)) { - break; - } - - status = check_ppp_errors(); - } - - return status; -} -#endif -/*---------------------------------------------------------------------------*/ -void -ppp_connect(void) -{ - /* Initialize PPP engine */ - /* init_ppp(); */ - pap_init(); - ipcp_init(); - lcp_init(); - - /* Enable PPP */ - ppp_flags = PPP_RX_READY; -} -/*---------------------------------------------------------------------------*/ -void -ppp_send(void) -{ - /* If IPCP came up then our link should be up. */ - if((ipcp_state & IPCP_TX_UP) && (ipcp_state & IPCP_RX_UP)) { - ahdlc_tx(IPV4, &uip_buf[ UIP_LLH_LEN ], uip_appdata, - UIP_TCPIP_HLEN, uip_len - UIP_TCPIP_HLEN); - } -} -/*---------------------------------------------------------------------------*/ -void -ppp_poll(void) -{ - u8_t c; - - uip_len = 0; - - if(!(ppp_flags & PPP_RX_READY)) { - return; - } - - while(uip_len == 0 && ppp_arch_getchar(&c)) { - ahdlc_rx(c); - } - - /* If IPCP came up then our link should be up. */ - if((ipcp_state & IPCP_TX_UP) && (ipcp_state & IPCP_RX_UP)) { - return; - } - - /* call the lcp task to bring up the LCP layer */ - lcp_task( &uip_buf[ UIP_LLH_LEN ]); - - /* If LCP is up, neg next layer */ - if((lcp_state & LCP_TX_UP) && (lcp_state & LCP_RX_UP)) { - /* If LCP wants PAP, try to authenticate, else bring up IPCP */ - if((lcp_state & LCP_RX_AUTH) && (!(pap_state & PAP_TX_UP))) { - pap_task( &uip_buf[ UIP_LLH_LEN ]); - } else { - ipcp_task( &uip_buf[ UIP_LLH_LEN ]); - } - } -} -/*---------------------------------------------------------------------------*/ -/* ppp_upcall() - this is where valid PPP frames from the ahdlc layer are - * sent to be processed and demuxed. - */ -/*---------------------------------------------------------------------------*/ -void -ppp_upcall(u16_t protocol, u8_t *buffer, u16_t len) -{ -#if PACKET_RX_DEBUG - ++ppp_rx_frame_count; - dump_ppp_packet(buffer, len); - if(ppp_rx_frame_count > 18) { - done = 1; - } -#endif - - /* check to see if we have a packet waiting to be processed */ - if(ppp_flags & PPP_RX_READY) { - /* demux on protocol field */ - switch(protocol) { - case LCP: /* We must support some level of LCP */ - DEBUG1(("LCP Packet - ")); - lcp_rx(buffer, len); - DEBUG1(("\n")); - break; - case PAP: /* PAP should be compile in optional */ - DEBUG1(("PAP Packet - ")); - pap_rx(buffer, len); - DEBUG1(("\n")); - break; - case IPCP: /* IPCP should be compile in optional. */ - DEBUG1(("IPCP Packet - ")); - ipcp_rx(buffer, len); - DEBUG1(("\n")); - break; - case IPV4: /* We must support IPV4 */ - DEBUG1(("IPV4 Packet---\n")); - memcpy( &uip_buf[ UIP_LLH_LEN ], buffer, len); - uip_len = len; - DEBUG1(("\n")); - break; - default: - DEBUG1(("Unknown PPP Packet Type 0x%04x - ",protocol)); - ppp_reject_protocol(protocol, buffer, len); - DEBUG1(("\n")); - break; - } - } -} -/*---------------------------------------------------------------------------*/ -/* scan_packet(list,buffer,len) - * - * list = list of supported ID's - * *buffer pointer to the first code in the packet - * length of the codespace - */ -u16_t -scan_packet(u16_t protocol, u8_t *list, u8_t *buffer, u8_t *options, u16_t len) -{ - u8_t *tlist, *bptr; - u8_t *tptr; - u8_t bad = 0; - u8_t i, j, good; - - bptr = tptr = options; - /* scan through the packet and see if it has any unsupported codes */ - while(bptr < options + len) { - /* get code and see if it matches somwhere in the list, if not - we don't support it */ - i = *bptr++; - - /* DEBUG2("%x - ",i);*/ - tlist = list; - good = 0; - while(*tlist) { - /* DEBUG2("%x ",*tlist);*/ - if(i == *tlist++) { - good = 1; - break; - } - } - if(!good) { - /* we don't understand it, write it back */ - DEBUG1(("We don't understand option 0x%02x\n",i)); - bad = 1; - *tptr++ = i; - j = *tptr++ = *bptr++; - for(i = 0; i < j - 2; ++i) { - *tptr++ = *bptr++; - } - } else { - /* advance over to next option */ - bptr += *bptr - 1; - } - } - - /* Bad? if we we need to send a config Reject */ - if(bad) { - /* write the config Rej packet we've built above, take on the header */ - bptr = buffer; - *bptr++ = CONF_REJ; /* Write Conf_rej */ - bptr++; /* skip over ID */ - *bptr++ = 0; - *bptr = tptr - buffer; - /* length right here? */ - - /* write the reject frame */ - DEBUG1(("Writing Reject frame --\n")); - ahdlc_tx(protocol, buffer, 0, (u16_t)(tptr - buffer), 0); - DEBUG1(("\nEnd writing reject \n")); - - } - return bad; -} -/*---------------------------------------------------------------------------*/ diff --git a/backyard/core/net/ppp/ppp.h b/backyard/core/net/ppp/ppp.h deleted file mode 100644 index 4b81d28aa..000000000 --- a/backyard/core/net/ppp/ppp.h +++ /dev/null @@ -1,132 +0,0 @@ -#ifndef __PPP_H__ -#define __PPP_H__ -/* www.mycal.net ---------------------------------------------------------------------------- - ppp.h - ppp header file ---------------------------------------------------------------------------- - Version - 0.1 Original Version June 3, 2000 - (c)2000 Mycal Labs, All Rights Reserved - --------------------------------------------------------------------------- */ -/* - * Copyright (c) 2003, Mike Johnson, Mycal Labs, www.mycal.net - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Mike Johnson/Mycal Labs - * www.mycal.net. - * 4. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Mycal Modified uIP TCP/IP stack. - * - * $Id: ppp.h,v 1.1 2007/05/26 07:14:40 oliverschmidt Exp $ - * - */ -#include "net/uip.h" -#include "net/uip-fw.h" -#include "contiki-conf.h" -#include "ahdlc.h" -#include "lcp.h" -#include "ipcp.h" -#include "pap.h" -#include "ppp_arch.h" -#include "ppp_process.h" -/*#include "mip.h"*/ - -/* moved to pppconfig.h -#define PPP_RX_BUFFER_SIZE 1024 -#define PPP_TX_BUFFER_SIZE 64*/ - -#define CRC_GOOD_VALUE 0xf0b8 - -/* ppp_rx_status values */ -#define PPP_RX_IDLE 0 -#define PPP_READY 1 - -/* ppp flags */ -#define PPP_ESCAPED 0x1 -#define PPP_RX_READY 0x2 -#define PPP_RX_ASYNC_MAP 0x8 -#define PPP_TX_ASYNC_MAP 0x8 -#define PPP_PFC 0x10 -#define PPP_ACFC 0x20 - -/* Supported PPP Protocols */ -#define LCP 0xc021 -#define PAP 0xc023 -#define IPCP 0x8021 -#define IPV4 0x0021 - -/* LCP codes packet types */ -#define CONF_REQ 0x1 -#define CONF_ACK 0x2 -#define CONF_NAK 0x3 -#define CONF_REJ 0x4 -#define TERM_REQ 0x5 -#define TERM_ACK 0x6 -#define PROT_REJ 0x8 - -/* Raise PPP config bits */ -#define USE_PAP 0x1 -#define USE_NOACCMBUG 0x2 -#define USE_GETDNS 0x4 - -#define ppp_setusername(un) strncpy(pap_username, (un), PAP_USERNAME_SIZE) -#define ppp_setpassword(pw) strncpy(pap_password, (pw), PAP_PASSWORD_SIZE) - -/* - * Export Variables - */ -/*extern u8_t ppp_tx_buffer[PPP_TX_BUFFER_SIZE];*/ -extern u8_t ppp_rx_buffer[]; -extern u8_t ppp_rx_count; - -extern struct uip_fw_netif pppif; - -/*extern u16_t ppp_crc_error;*/ - -extern u8_t ppp_flags; -extern u8_t ppp_status; -/*extern u16_t ppp_rx_crc; */ -extern u16_t ppp_rx_tobig_error; -extern u8_t ppp_lcp_state; - -extern u8_t ppp_id; -extern u8_t ppp_retry; - -/* - * Function Prototypes - */ -void ppp_init(void); -void ppp_connect(void); - -void ppp_send(void); -void ppp_poll(void); - -void ppp_upcall(u16_t, u8_t *, u16_t); -u16_t scan_packet(u16_t, u8_t *list, u8_t *buffer, u8_t *options, u16_t len); - -#endif /* __PPP_H__ */ diff --git a/backyard/core/net/ppp/ppp_process.c b/backyard/core/net/ppp/ppp_process.c deleted file mode 100644 index 730d791b7..000000000 --- a/backyard/core/net/ppp/ppp_process.c +++ /dev/null @@ -1,234 +0,0 @@ -/* - * $Id: ppp_process.c,v 1.1 2007/05/26 07:14:40 oliverschmidt Exp $ - */ - -#include "contiki.h" -#include "contiki-net.h" -#include "net/ppp/ppp.h" - -PROCESS(ppp_process, "PPP"); - -//----------------------------------------------------------------------------- -// Note, that the UART RX-FIFO must be polled often enough so we don't get an -// overrun at the used baudrate. -//----------------------------------------------------------------------------- -#define PPP_POLL_INTERVAL (CLOCK_SECOND / 256) -#define AT_TIMEOUT (2 * CLOCK_SECOND / PPP_POLL_INTERVAL) -#define AT_RX_BUF 64 - -enum { - AT_CONNECT_DIRECT, - AT_CONNECT_AUTO, - AT_CONNECT_MANUAL -} At_connect; - -enum { - AT_IDLE, - AT_CONNECT, - AT_CONNECT1, - AT_CONNECT2, - AT_CONNECTED, - AT_RESET, - AT_RESET1, - AT_RESET2, - AT_RESET3, - AT_RESET4, - AT_RESET5 -}; - -static struct etimer pppTimer; -static u8_t at_state; -static u8_t at_connect_mode = AT_CONNECT_MODE; -static int at_timeout = -1; -static u8_t at_rxBuf[ AT_RX_BUF ]; - - -static void -at_puts(char *s) { - while(*s) { - ppp_arch_putchar(*s); - s++; - } -} - - -static u8_t -*at_gets() { - static u8_t consumed; - int len; - int i; - - if (consumed) { - consumed = 0; - at_rxBuf[0] = 0; - } - len = strlen(at_rxBuf); - - for (i=len; i reset the buf - at_rxBuf[0] = 0; - return NULL; -} - - -static void -at_poll() { - - static u8_t loopCnt = 0; - u8_t *s; - - if (at_timeout > 0) { - at_timeout--; - } - - if (at_state == AT_CONNECTED) { - ppp_poll(); - if(uip_len > 0) { - tcpip_input(); - } - - if (loopCnt++ > 16) { - int i; - loopCnt = 0; - for (i=0; i 0) { - tcpip_output(); - } - } - } - } else { - - switch (at_state) { - - case AT_IDLE: - switch (at_connect_mode) { - - case AT_CONNECT_DIRECT: - at_state = AT_CONNECTED; - ppp_connect(); - break; - - case AT_CONNECT_AUTO: - at_state = AT_CONNECT; - break; - } - break; - - case AT_CONNECT: - at_gets(); // make the input buffer empty - at_puts("ATE1\r\n"); - at_state = AT_CONNECT1; - at_timeout = AT_TIMEOUT; - break; - - case AT_CONNECT1: - if (at_timeout == 0) { - at_state = AT_RESET; - } else if ((s=at_gets())) { - if (strcmp(s,"OK\r\n") == 0) { - at_puts("AT+CGDCONT=1,\"IP\",\"online.telia.se\",\"\",0,0\r\n"); - at_timeout = AT_TIMEOUT; - at_state = AT_CONNECT2; - } - } - break; - - case AT_CONNECT2: - if (at_timeout == 0) { - at_state = AT_RESET; - } else if ((s=at_gets())) { - if (strcmp(s,"OK\r\n") == 0) { - at_puts("ATD*99***1#\r\n"); - at_state = AT_CONNECTED; - ppp_connect(); - } - } - break; - - case AT_RESET: -//printf("AT_RESET\n"); - at_timeout = AT_TIMEOUT; - at_state = AT_RESET1; - break; - - case AT_RESET1: - if (at_timeout == 0) { - lcp_disconnect(random_rand() & 0xff); - at_timeout = AT_TIMEOUT; - at_state = AT_RESET2; - } - break; - - case AT_RESET2: - if (at_timeout == 0) { - lcp_disconnect(random_rand() & 0xff); - at_timeout = AT_TIMEOUT; - at_state = AT_RESET3; - } - break; - - case AT_RESET3: - if (at_timeout == 0) { - at_puts("+++"); - at_timeout = AT_TIMEOUT; - at_state = AT_RESET4; - } - break; - - case AT_RESET4: - if (at_timeout == 0) { - at_puts("ATZ\r\n"); - at_timeout = AT_TIMEOUT; - at_state = AT_RESET5; - } - break; - - case AT_RESET5: - at_gets(); // make the input buffer empty - if (at_timeout == 0) { - at_state = AT_IDLE; - } - break; - } - } -} - -void ppp_reconnect() { - at_state = AT_RESET; - uip_fw_unregister(&pppif); -} - - -PROCESS_THREAD(ppp_process, ev, data) -{ - PROCESS_BEGIN(); - - at_state = AT_IDLE; - at_rxBuf[0] = 0; - - ppp_init(); - etimer_set(&pppTimer, PPP_POLL_INTERVAL); - - while(1) { - PROCESS_WAIT_EVENT_UNTIL(ev == PROCESS_EVENT_TIMER); - - if(etimer_expired(&pppTimer)) { - etimer_set(&pppTimer, PPP_POLL_INTERVAL); - at_poll(); - } - } - - PROCESS_END(); -} diff --git a/backyard/core/net/ppp/ppp_process.h b/backyard/core/net/ppp/ppp_process.h deleted file mode 100644 index 57d1b45a9..000000000 --- a/backyard/core/net/ppp/ppp_process.h +++ /dev/null @@ -1,3 +0,0 @@ -#include "contiki.h" - -PROCESS_NAME(ppp_process); diff --git a/backyard/core/net/uipbuf.c b/backyard/core/net/uipbuf.c deleted file mode 100644 index d1d0173ab..000000000 --- a/backyard/core/net/uipbuf.c +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2004, Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - * $Id: uipbuf.c,v 1.1 2007/11/18 01:18:50 oliverschmidt Exp $ - */ - -#if 0 /* This whole file is #ifdef'd out - the contents are to be removed */ - -#include "net/uipbuf.h" - -#include - -/*---------------------------------------------------------------------------*/ -void -uipbuf_setup(struct uipbuf_buffer *buf, - u8_t *bufptr, u16_t bufsize) -{ - buf->buffer = buf->ptr = bufptr; - buf->bufsize = buf->left = bufsize; -} -/*---------------------------------------------------------------------------*/ -u8_t -uipbuf_bufdata(struct uipbuf_buffer *buf, u16_t len, - u8_t **dataptr, u16_t *datalen) -{ - if(*datalen < buf->left) { - memcpy(buf->ptr, *dataptr, *datalen); - buf->ptr += *datalen; - buf->left -= *datalen; - *dataptr += *datalen; - *datalen = 0; - return UIPBUF_NOT_FULL; - } else if(*datalen == buf->left) { - memcpy(buf->ptr, *dataptr, *datalen); - buf->ptr += *datalen; - buf->left = 0; - *dataptr += *datalen; - *datalen = 0; - return UIPBUF_FULL; - } else { - memcpy(buf->ptr, *dataptr, buf->left); - buf->ptr += buf->left; - *datalen -= buf->left; - *dataptr += buf->left; - buf->left = 0; - return UIPBUF_FULL; - } - -} -/*---------------------------------------------------------------------------*/ -u8_t -uipbuf_bufto(CC_REGISTER_ARG struct uipbuf_buffer *buf, u8_t endmarker, - CC_REGISTER_ARG u8_t **dataptr, CC_REGISTER_ARG u16_t *datalen) -{ - u8_t c; - /* - int len; - - ptr = memchr(*dataptr, endmarker, *datalen); - if(ptr != NULL) { - len = ptr - *dataptr; - } else { - len = *datalen; - } - memcpy(buf->ptr, *dataptr, len); - *dataptr += len; - *datalen -= len; - buf->ptr += len; - */ - while(buf->left > 0 && *datalen > 0) { - c = *buf->ptr = **dataptr; - ++*dataptr; - ++buf->ptr; - --*datalen; - --buf->left; - - if(c == endmarker) { - return UIPBUF_FOUND; - } - } - - if(*datalen == 0) { - return UIPBUF_NOT_FOUND; - } - - while(*datalen > 0) { - c = **dataptr; - --*datalen; - ++*dataptr; - - if(c == endmarker) { - return UIPBUF_FOUND | UIPBUF_FULL; - } - } - - return UIPBUF_FULL; -} -/*----------------------------------------------------------------------------*/ -u16_t -uipbuf_len(struct uipbuf_buffer *buf) -{ - return buf->bufsize - buf->left; -} -/*----------------------------------------------------------------------------*/ -#endif /* 0 */ diff --git a/backyard/core/net/uipbuf.h b/backyard/core/net/uipbuf.h deleted file mode 100644 index d90144c92..000000000 --- a/backyard/core/net/uipbuf.h +++ /dev/null @@ -1,182 +0,0 @@ -/* - * Copyright (c) 2004, Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - * $Id: uipbuf.h,v 1.1 2007/11/18 01:18:50 oliverschmidt Exp $ - */ -/** - * \file - * uIP data buffering helper functions. - * \author - * Adam Dunkels - * - */ - -#if 0 /* This whole file is #ifdef'd out - the contents are to be removed */ - -#ifndef __UIPBUF_H__ -#define __UIPBUF_H__ - -#include "net/uip.h" - -/** - * \defgroup uipbuf uIP data buffering helper library. - * - * The event driven API that uIP uses can be tricky to use when - * dealing with incoming TCP data. The data can be split over any - * number of incoming segments and uIP does not provide any stream - * abstraction by itself. To remedy this, the uIP data buffering - * helper library provides a set of functions that make buffering data - * easier. - * - * The data buffering library provides a structure that holds a - * pointer to a buffer and the state of the buffer, as well as a set - * of functions for manipulating the buffer state. The functions are - * intended to facilitate buffering of both data that is of a known - * size and data that is terminated by a specified byte. - * - * @{ - */ - -/** - * Return value of the buffering functions that indicates that a - * buffer was not filled by incoming data. - * - * \hideinitializer - */ -#define UIPBUF_NOT_FULL 0 -#define UIPBUF_NOT_FOUND 0 - -/** - * Return value of the buffering functions that indicates that a - * buffer was completely filled by incoming data. - * - * \hideinitializer - */ -#define UIPBUF_FULL 1 - -/** - * Return value of the buffering functions that indicates that an - * end-marker byte was found. - * - * \hideinitializer - */ -#define UIPBUF_FOUND 2 - -/** - * The structure that holds the state of a uIP buffer. - * - * This structure holds the state of a uIP buffer. The structure has - * no user-visible elements, but is used through the functions - * provided by the library. - * - * \hideinitializer - */ -struct uipbuf_buffer { - u8_t *ptr, *buffer; - unsigned short left, bufsize; -}; - -/** - * Set up a new uIP buffer structure. - * - * This function is used for setting up a uIP buffer structure with a - * specified size. The function should be called the first time a uIP - * buffer is used. The caller must provide the memory for holding the - * buffered bytes and the size of the buffer memory. - * - * \param buf A pointer to a uipbuf_buffer structure that is to be - * initialized. - * - * \param bufptr A pointer to the memory for holding the buffered - * data. - * - * \param size The size of the buffer memory. - * - */ -void uipbuf_setup(struct uipbuf_buffer *buf, - u8_t *bufptr, u16_t size); - -/** - * Buffer data until the buffer is full. - * - * This function puts data into the buffer, but no more than the - * buffer can hold. - * - * \param buf A pointer to the ::uipbuf_buffer structure that holds - * the state of the buffer. - * - * \param dataptr A pointer to the data that is to be buffered. - * - * \param datalen The length of the data that is to be buffered. - * - * \return If the buffer was not filled, the value UIPBUF_NOT_FULL - * is returned. If the buffer was filled, the number of bytes that - * could not be buffered is returned. If the buffer was exactly filled - * with the data, the value of 0 is returned. - * - */ -u8_t uipbuf_bufdata(struct uipbuf_buffer *buf, u16_t len, - u8_t **dataptr, u16_t *datalen); - -/** - * Buffer data until a specific character is found or the buffer is full. - * - * This function puts data into the buffer until a specific marker - * byte is found. The marker byte is put into the buffer at the end of - * the data. - * - * \param buf A pointer to the ::uipbuf_buffer structure that holds - * the state of the buffer. - * - * \param dataptr A pointer to the data that is to be buffered. - * - * \param datalen The length of the data that is to be buffered. - * - * \param byte The end-marker byte that indicates the end of the data - * that is to be buffered. - * - * \return This function returns the number of protruding bytes after - * the end-marker byte, if the marker was found. If the marker was not - * found and all of the data was buffered, the value of - * UIPBUF_NOT_FOUND is returned. If the marker was not found, but the - * data made the buffer fill up, the value of UIPBUF_FULL is returned. - * - */ -u8_t uipbuf_bufto(struct uipbuf_buffer *buf, u8_t endmarker, - u8_t **dataptr, u16_t *datalen); - -u16_t uipbuf_len(struct uipbuf_buffer *buf); - -/** @} */ - -#endif /* __UIPBUF_H__ */ -#endif /* 0 */ diff --git a/backyard/core/sys/service.c b/backyard/core/sys/service.c deleted file mode 100644 index 7a5447e85..000000000 --- a/backyard/core/sys/service.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * @(#)$Id: service.c,v 1.1 2007/05/26 23:24:24 oliverschmidt Exp $ - */ - -#include - -#include "contiki.h" - -/** - * \addtogroup service - * @{ - */ - -/** - * \file - * Implementation of the Contiki service mechanism. - * \author - * Adam Dunkels - */ - -static struct service *services_list = NULL; - -/*---------------------------------------------------------------------------*/ -void -service_register(struct service *s) -{ - struct service *existing; - - - s->p = PROCESS_CURRENT(); - - existing = service_find(s->name); - if(existing != NULL) { - service_remove(existing); - } - - s->next = services_list; - services_list = s; -} -/*---------------------------------------------------------------------------*/ -void -service_remove(struct service *s) -{ - struct service *t; - - - /* Check if service is first on the list. */ - if(s == services_list) { - services_list = s->next; - - /* Post a notification to the owner process. */ - process_post(s->p, PROCESS_EVENT_SERVICE_REMOVED, s); - - } else { - for(t = services_list; t != NULL && t->next != s; t = t->next); - if(t != NULL) { - t->next = s->next; - - /* Post a notification to the owner process. */ - process_post(s->p, PROCESS_EVENT_SERVICE_REMOVED, s); - } - } - - s->next = NULL; -} -/*---------------------------------------------------------------------------*/ -struct service * -service_find(const char *name) -{ - struct service *s; - - - for(s = services_list; s != NULL; s = s->next) { - if(strcmp(s->name, name) == 0) { - return s; - } - } - return NULL; -} -/*---------------------------------------------------------------------------*/ - -/** @} */ diff --git a/backyard/core/sys/service.h b/backyard/core/sys/service.h deleted file mode 100644 index 76e16d1a2..000000000 --- a/backyard/core/sys/service.h +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * @(#)$Id: service.h,v 1.1 2007/05/26 23:24:24 oliverschmidt Exp $ - */ - -/** \addtogroup sys - * @{ - */ - -/** - * \defgroup service The Contiki service mechanism - * - * The Contiki service mechanism enables cross-process functions. A - * service that is registered by one process can be accessed by other - * processes in the system. Services can be transparently replaced at - * run-time. - * - * A service has an interface that callers use to access the service's - * functions. This interface typically is defined in a header file - * that is included by all users of the service. A service interface - * is defined with the SERVICE_INTERFACE() macro. - * - * A service implementation is declared with the SERVICE() macro. The - * SERVICE() statement specifies the actual functions that are used to - * implement the service. - * - * Every service has a controlling process. The controlling process - * registers the service with the system when it starts, and is also - * notified if the service is removed or replaced. A process may - * register any number of services. - * - * Service registration is done with a SERVICE_REGISTER() - * statement. If a service with the same name is already registered, - * this is removed before the new service is registered. - * - * The SERVICE_CALL() macro is used to call a service. If the service - * to be called is not registered, the SERVICE_CALL() statement does - * nothing. The SERVICE_FIND() function can be used to check if a - * particular service exists before calling SERVICE_CALL(). - * - * @{ - */ - -/** - * \file - * Header file for the Contiki service mechanism. - * \author - * Adam Dunkels - */ - -#ifndef __SERVICE_H__ -#define __SERVICE_H__ - -#include "contiki.h" - -struct service { - struct service *next; - struct process *p; - const char *name; - const void *interface; -}; - -/** - * \name Service declaration and defition - * @{ - */ - -/** - * Define the name and interface of a service. - * - * This statement defines the name and interface of a service. - * - * \param name The name of the service. - * - * \param interface A list of function declarations that comprises the - * service interface. This list must be enclosed by curly brackets and - * consist of declarations of function pointers separated by - * semicolons. - * - * \hideinitializer - */ -#define SERVICE_INTERFACE(name, interface) struct name interface; - -#if ! CC_NO_VA_ARGS -/** - * \brief Define an implementation of a service interface. - * \param name The name of this particular instance of the service, for use with SERVICE_REGISTER(). - * \param service_name The name of the service, from the SERVICE_INTERFACE(). - * \param ... A structure containing the functions that implements the service. - * - * This statement defines the name of this implementation - * of the service and defines the functions that actually - * implement the functions offered by the service. - * - * \hideinitializer - */ -#define SERVICE(name, service_name, ...) \ - static struct service_name name##_interface = __VA_ARGS__ ; \ - struct service name = { NULL, NULL, service_name##_name, & name##_interface } -#endif - -/** @} */ - -/** - * \name Calling a service - * @{ - */ - -/** - * Call a function from a specified service, if it is registered. - * - * - * \param service_name The name of the service that is to be called. - * - * \param function The function that is to be called. This is a full - * function call, including parameters. - * - * \hideinitializer - */ -#define SERVICE_CALL(service_name, function) \ - { \ - struct service *service_s; \ - service_s = service_find(service_name##_name); \ - if(service_s != NULL) { \ - ((const struct service_name *)service_s->interface)->function; \ - } \ - } - -/* @} */ - -#define SERVICE_EXISTS(service_name) (service_find(service_name##_name) != NULL) - -/** - * \name Service registration and removal - * @{ - */ - -/** - * Register a service. - * - * \hideinitializer - */ -#define SERVICE_REGISTER(name) service_register(&name) - -/** - * Remove a service. - * - * \hideinitializer - */ -#define SERVICE_REMOVE(service_name) service_remove(&service_name) - -/** @} */ - -/** - * Find service. - * - * \hideinitializer - */ -#define SERVICE_FIND(service_name) service_find(service_name##_name) - -CCIF void service_register(struct service *s); -CCIF void service_remove(struct service *s); -struct service *service_find(const char *name); - -#endif /* __SERVICE_H__ */ -/** @} */ -/** @} */ diff --git a/backyard/cpu/6502/apps/memstat-dsc.c b/backyard/cpu/6502/apps/memstat-dsc.c deleted file mode 100644 index 72af2d9ab..000000000 --- a/backyard/cpu/6502/apps/memstat-dsc.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: memstat-dsc.c,v 1.2 2007/09/06 01:36:12 matsutsuka Exp $ - * - */ - -#include "sys/dsc.h" - -/*-----------------------------------------------------------------------------------*/ -#if CTK_CONF_ICON_BITMAPS -static unsigned char memstaticon_bitmap[3*3*8] = { - 0x00, 0x7f, 0x43, 0x4c, 0x58, 0x53, 0x60, 0x6f, - 0x00, 0xff, 0x00, 0x7e, 0x00, 0xff, 0x00, 0xff, - 0x00, 0xfe, 0xc2, 0x32, 0x1a, 0xca, 0x06, 0xf6, - - 0x40, 0x5f, 0x40, 0x5f, 0x40, 0x5f, 0x40, 0x4f, - 0x00, 0xff, 0x00, 0xff, 0x00, 0xfc, 0x01, 0xf3, - 0x02, 0xfa, 0x02, 0x82, 0x3e, 0xfe, 0xfe, 0xfe, - - 0x60, 0x67, 0x50, 0x59, 0x4c, 0x43, 0x7f, 0x00, - 0x07, 0xe7, 0x0f, 0xef, 0x0f, 0x0f, 0xff, 0x00, - 0x8e, 0x06, 0x06, 0x06, 0x8e, 0xfe, 0xfe, 0x00 -}; -#endif /* CTK_CONF_ICON_BITMAPS */ - -#if CTK_CONF_ICON_TEXTMAPS -static char memstaticon_textmap[9] = { - '0', '0', '1', - '0', '1', '0', - '1', '0', '1' -}; -#endif /* CTK_CONF_ICON_TEXTMAPS */ - -#if CTK_CONF_ICONS -static struct ctk_icon memstat_icon = - {CTK_ICON("Memory stats", memstaticon_bitmap, memstaticon_textmap)}; -#endif /* CTK_CONF_ICONS */ -/*-----------------------------------------------------------------------------------*/ -DSC(memstat_dsc, - "Memory stats", - "memstat.prg", - memstat_init, - &memstat_icon); -/*-----------------------------------------------------------------------------------*/ diff --git a/backyard/cpu/6502/apps/memstat-dsc.h b/backyard/cpu/6502/apps/memstat-dsc.h deleted file mode 100644 index 5ca90f173..000000000 --- a/backyard/cpu/6502/apps/memstat-dsc.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: memstat-dsc.h,v 1.1 2007/05/23 23:47:44 oliverschmidt Exp $ - * - */ -#ifndef __MEMSTAT_DSC_H__ -#define __MEMSTAT_DSC_H__ - -#include "sys/dsc.h" - -DSC_HEADER(memstat_dsc); - -#endif /* __MEMSTAT_DSC_H__ */ diff --git a/backyard/cpu/6502/apps/memstat.c b/backyard/cpu/6502/apps/memstat.c deleted file mode 100644 index 4bc622b63..000000000 --- a/backyard/cpu/6502/apps/memstat.c +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2002, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: memstat.c,v 1.1 2007/05/23 23:47:44 oliverschmidt Exp $ - * - */ - -#include - -#include "contiki.h" -#include "ctk/ctk.h" - -static struct ctk_window window; -static struct ctk_label freemsg = - {CTK_LABEL(2, 0, 12, 1, "Free memory:")}; -static char freemem[6]; -static struct ctk_label freenum = - {CTK_LABEL(18, 0, 5, 1, freemem)}; - -static struct ctk_label lblockmsg = - {CTK_LABEL(2, 2, 14, 1, "Largest block:")}; -static char lblock[6]; -static struct ctk_label lblocknum = - {CTK_LABEL(18, 2, 5, 1, lblock)}; - -static struct ctk_button updatebutton = - {CTK_BUTTON(0, 4, 6, "Update")}; -static struct ctk_button closebutton = - {CTK_BUTTON(17, 4, 5, "Close")}; - -PROCESS(memstat_process, "Memory statistics"); - -/*-----------------------------------------------------------------------------------*/ -static void -update(void) -{ - int mem; - - mem = _heapmemavail(); - freemem[0] = (mem/10000) % 10 + '0'; - freemem[1] = (mem/1000) % 10 + '0'; - freemem[2] = (mem/100) % 10 + '0'; - freemem[3] = (mem/10) % 10 + '0'; - freemem[4] = (mem) % 10 + '0'; - - mem = _heapmaxavail(); - lblock[0] = (mem/10000) % 10 + '0'; - lblock[1] = (mem/1000) % 10 + '0'; - lblock[2] = (mem/100) % 10 + '0'; - lblock[3] = (mem/10) % 10 + '0'; - lblock[4] = (mem) % 10 + '0'; - -} -/*-----------------------------------------------------------------------------------*/ -PROCESS_THREAD(memstat_process, ev, data) -{ - PROCESS_BEGIN(); - - ctk_window_new(&window, 24, 5, "Memory stats"); - /* ctk_window_move(&window, 0, 1);*/ - - CTK_WIDGET_ADD(&window, &freemsg); - CTK_WIDGET_ADD(&window, &freenum); - - CTK_WIDGET_ADD(&window, &lblockmsg); - CTK_WIDGET_ADD(&window, &lblocknum); - - CTK_WIDGET_ADD(&window, &updatebutton); - CTK_WIDGET_ADD(&window, &closebutton); - - CTK_WIDGET_FOCUS(&window, &updatebutton); - - update(); - - ctk_window_open(&window); - - while(1) { - - PROCESS_WAIT_EVENT(); - - if(ev == ctk_signal_button_activate) { - if(data == &updatebutton) { - update(); - ctk_window_redraw(&window); - } else if(data == &closebutton) { - ctk_window_close(&window); - break; - } - } else if((ev == ctk_signal_window_close && - data == &window) || - ev == PROCESS_EVENT_EXIT) { - break; - } - } - - PROCESS_END(); - -} -/*-----------------------------------------------------------------------------------*/ diff --git a/backyard/cpu/6502/cc65-make-labels b/backyard/cpu/6502/cc65-make-labels deleted file mode 100755 index 6dd73e680..000000000 --- a/backyard/cpu/6502/cc65-make-labels +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - - -egrep -v 'ZP|BSS' contiki-labels | perl -n -e 'if(/^al 0000(.+) \.([^@]+)\n/){if($l{$2} eq ""){$l{$2}=$1;print ".exportzp $2\n$2=\$$1\n";}} elsif(/^al 00(.+) \.([^@]+)\n/){if($l{$2} eq ""){$l{$2}=$1;print ".export $2\n$2=\$$1\n";}}' > contiki-labels.s - -echo '.segment "EXTZP": zeropage' >> contiki-labels.s \ No newline at end of file diff --git a/backyard/cpu/6502/loader/loader-arch-dsc.c b/backyard/cpu/6502/loader/loader-arch-dsc.c deleted file mode 100644 index 57ddfa3d9..000000000 --- a/backyard/cpu/6502/loader/loader-arch-dsc.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop OS - * - * $Id: loader-arch-dsc.c,v 1.1 2007/05/23 23:50:02 oliverschmidt Exp $ - * - */ - -#include -#include - -#include "sys/loader.h" - -extern struct mod_ctrl ctrl; - -unsigned char load(const char *name); - -/*-----------------------------------------------------------------------------------*/ -struct dsc * -loader_arch_load_dsc(const char *name) -{ - unsigned char r; - - r = load(name); - if(r == MLOAD_OK) { - return (struct dsc *)ctrl.module; - } - return NULL; -} -/*-----------------------------------------------------------------------------------*/ diff --git a/backyard/cpu/6502/loader/loader-arch-dsc.h b/backyard/cpu/6502/loader/loader-arch-dsc.h deleted file mode 100644 index 704d8c40b..000000000 --- a/backyard/cpu/6502/loader/loader-arch-dsc.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop OS - * - * $Id: loader-arch-dsc.h,v 1.1 2007/05/23 23:50:02 oliverschmidt Exp $ - * - */ -#ifndef __LOADER_ARCH_DSC_H__ -#define __LOADER_ARCH_DSC_H__ - -#include "sys/dsc.h" -#include - -struct dsc *loader_arch_load_dsc(const char *name); - -#define LOADER_LOAD_DSC(name) loader_arch_load_dsc(name) -#define LOADER_UNLOAD_DSC(dsc) mod_free(dsc) - -#endif /* __LOADER_ARCH_DSC_H__ */ diff --git a/backyard/cpu/6502/loader/loader-arch-module-dsc.S b/backyard/cpu/6502/loader/loader-arch-module-dsc.S deleted file mode 100644 index dd82301c2..000000000 --- a/backyard/cpu/6502/loader/loader-arch-module-dsc.S +++ /dev/null @@ -1 +0,0 @@ -.segment "JUMPTABLE" diff --git a/backyard/cpu/6502/loader/loader-arch-module.S b/backyard/cpu/6502/loader/loader-arch-module.S deleted file mode 100644 index 0746bf750..000000000 --- a/backyard/cpu/6502/loader/loader-arch-module.S +++ /dev/null @@ -1,8 +0,0 @@ -.segment "JUMPTABLE" - .import _loader_appinit - .export _loader_arch_loadaddr -_loader_arch_loadaddr: -arch: .byte 0,0,0,0,0,0,0,0 -version: .byte 0,0,0,0,0,0,0,0 -; jmp _loader_appinit - diff --git a/backyard/cpu/6502/loader/loader-arch.c b/backyard/cpu/6502/loader/loader-arch.c deleted file mode 100644 index bb7417908..000000000 --- a/backyard/cpu/6502/loader/loader-arch.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop OS - * - * $Id: loader-arch.c,v 1.1 2007/05/23 23:50:02 oliverschmidt Exp $ - * - */ - -#include -#include -#include -#include - -#include "loader.h" - -struct mod_ctrl ctrl = { - read /* Read from disk */ -}; - -struct loader_arch_hdr { - char arch[8]; - char version[8]; - - char initfunc[1]; -}; - -/*-----------------------------------------------------------------------------------*/ -/* load(name) - * - * Loads a program from disk and executes it. Code originally written by - * Ullrich von Bassewitz. - */ -/*-----------------------------------------------------------------------------------*/ -unsigned char -load(const char *name) -{ - unsigned char res; - - /* Now open the file */ - ctrl.callerdata = open(name, O_RDONLY); - if(ctrl.callerdata < 0) { - /* Could not open the file, display an error and return */ - /* ### */ - return LOADER_ERR_OPEN; - } - - /* Load the module */ - res = mod_load(&ctrl); - - /* Close the input file */ - close(ctrl.callerdata); - - /* Check the return code */ - if(res != MLOAD_OK) { - /* Wrong module, out of memory or whatever. Print an error - * message and return. - */ - /* ### */ - return res; - } - - /* We've successfully loaded the module. */ - - return LOADER_OK; -} -/*-----------------------------------------------------------------------------------*/ -unsigned char -loader_arch_load(const char *name, char *arg) -{ - unsigned char r; - struct loader_arch_hdr *hdr; - - r = load(name); - if(r != MLOAD_OK) { - return r; - } - hdr = (struct loader_arch_hdr *)ctrl.module; - - /* Check the program header and see that version and architecture - matches. */ - - /* Call the init function. */ - - if(*hdr->initfunc == 0x4c) { - ((void (*)(char *))hdr->initfunc)(arg); - } - - return LOADER_OK; -} -/*-----------------------------------------------------------------------------------*/ diff --git a/backyard/cpu/6502/loader/loader-arch.h b/backyard/cpu/6502/loader/loader-arch.h deleted file mode 100644 index 41b01da5d..000000000 --- a/backyard/cpu/6502/loader/loader-arch.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop OS - * - * $Id: loader-arch.h,v 1.1 2007/05/23 23:50:02 oliverschmidt Exp $ - * - */ -#ifndef __LOADER_ARCH_H__ -#define __LOADER_ARCH_H__ - -#include - -unsigned char loader_arch_load(const char *name, char *arg); - -extern void *loader_arch_loadaddr; - -#define LOADER_LOAD(name, arg) loader_arch_load(name, arg) -#define LOADER_UNLOAD() mod_free(&loader_arch_loadaddr) - -#endif /* __LOADER_ARCH_H__ */ diff --git a/backyard/cpu/6502/net/rs232dev.c b/backyard/cpu/6502/net/rs232dev.c deleted file mode 100644 index 790fd0d24..000000000 --- a/backyard/cpu/6502/net/rs232dev.c +++ /dev/null @@ -1,272 +0,0 @@ -/* - * Copyright (c) 2001, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the uIP TCP/IP stack. - * - * $Id: rs232dev.c,v 1.1 2007/11/19 23:00:56 oliverschmidt Exp $ - * - */ - -/* - * This is a generic implementation of the SLIP protocol over an RS232 - * (serial) device. While initially intented for the C64, the code can - * easily be ported to other platforms as well. - * - * Huge thanks to Ullrich von Bassewitz of cc65 fame for - * and endless supply of bugfixes, insightsful comments and - * suggestions, and improvements to this code! - */ - -#include -#include -#include - - /* This will include the system specific header files as well */ -#if defined(__CBM__) -# include -#elif defined(__ATARI__) -# include -#endif - -#include "net/uip.h" - -#define SLIP_END 0300 -#define SLIP_ESC 0333 -#define SLIP_ESC_END 0334 -#define SLIP_ESC_ESC 0335 - - -#define SIO_RECV(c) while(ser_get(&c) == SER_ERR_NO_DATA) -#define SIO_POLL(c) (ser_get(&c) != SER_ERR_NO_DATA) -#define SIO_SEND(c) ser_put(c) - -#define MAX_SIZE (UIP_BUFSIZE - UIP_LLH_LEN) - -static u8_t slip_buf[MAX_SIZE + 2]; - -static u16_t len, tmplen; - -static char loaded = 0; - -#if 1 -#define printf(x) -#else -#include -#endif - - -/*-----------------------------------------------------------------------------------*/ -/*static void -rs232_err(char err) -{ - switch(err) { - case RS_ERR_OK: - printf("RS232 OK\n"); - break; - case RS_ERR_NOT_INITIALIZED: - printf("RS232 not initialized\n"); - break; - case RS_ERR_BAUD_TOO_FAST: - printf("RS232 baud too fast\n"); - break; - case RS_ERR_BAUD_NOT_AVAIL: - printf("RS232 baud rate not available\n"); - break; - case RS_ERR_NO_DATA: - printf("RS232 nothing to read\n"); - break; - case RS_ERR_OVERFLOW: - printf("RS232 overflow\n"); - break; - } -}*/ -/*-----------------------------------------------------------------------------------*/ -/* - * rs232dev_send(): - * - * Sends the packet in the uip_buf and uip_appdata buffers. The first - * 40 bytes of the packet (the IP and TCP headers) are read from the - * uip_buf buffer, and the following bytes (the application data) are - * read from the uip_appdata buffer. - * - */ -/*-----------------------------------------------------------------------------------*/ -void -rs232dev_send(void) -{ - u16_t i; - u8_t *ptr; - u8_t c; - - SIO_SEND(SLIP_END); - - ptr = &uip_buf[UIP_LLH_LEN]; - for(i = 0; i < uip_len; ++i) { - if(i == UIP_TCPIP_HLEN) { - ptr = uip_appdata; - } - c = *ptr++; - switch(c) { - case SLIP_END: - SIO_SEND(SLIP_ESC); - SIO_SEND(SLIP_ESC_END); - break; - case SLIP_ESC: - SIO_SEND(SLIP_ESC); - SIO_SEND(SLIP_ESC_ESC); - break; - default: - SIO_SEND(c); - break; - } - } - SIO_SEND(SLIP_END); -} -/*-----------------------------------------------------------------------------------*/ -/* - * rs232dev_poll(): - * - * Read all avaliable bytes from the RS232 interface into the slip_buf - * buffer. If no more bytes are avaliable, it returns with 0 to - * indicate that no packet was immediately ready. When a full packet - * has been read into the buffer, the packet is copied into the - * uip_buf buffer and the length of the packet is returned. - * - */ -/*-----------------------------------------------------------------------------------*/ -u16_t -rs232dev_poll(void) -{ - u8_t c; - static u8_t lastc; - - if(loaded == 0) { - return 0; - } - - while(SIO_POLL(c)) { - - switch(c) { - case SLIP_ESC: - lastc = c; - break; - - case SLIP_END: - lastc = c; - /* End marker found, we copy our input buffer to the uip_buf - buffer and return the size of the packet we copied. */ - memcpy(&uip_buf[UIP_LLH_LEN], slip_buf, len); - tmplen = len; - len = 0; - return tmplen; - - default: - if(lastc == SLIP_ESC) { - lastc = c; - /* Previous read byte was an escape byte, so this byte will be - interpreted differently from others. */ - switch(c) { - case SLIP_ESC_END: - c = SLIP_END; - break; - case SLIP_ESC_ESC: - c = SLIP_ESC; - break; - } - } else { - lastc = c; - } - - slip_buf[len] = c; - ++len; - - if(len > MAX_SIZE) { - len = 0; - } - - break; - } - } - return 0; -} -/*-----------------------------------------------------------------------------------*/ -/* - * rs232dev_init(): - * - * Initializes the RS232 device and sets the parameters of the device. - * - */ -/*-----------------------------------------------------------------------------------*/ -void -rs232dev_init(void) -{ - char err; - struct ser_params p; - - err = ser_load_driver("c64-swlink.ser"); - - if(err != SER_ERR_OK) { - asm("inc $d020"); - return; - } - - p.baudrate = SER_BAUD_9600; - p.databits = SER_BITS_8; - p.stopbits = SER_STOP_1; - p.parity = SER_PAR_NONE; - p.handshake = SER_HS_HW; - - err = ser_open(&p); - - if(err != SER_ERR_OK) { - asm("inc $d020"); - return; - } - - - loaded = 1; - - /* err = rs232_init(0); */ - /* rs232_err(err);*/ - /* err = rs232_params(RS_BAUD_9600 | RS_BITS_8 | RS_STOP_1, RS_PAR_NONE);*/ - /* rs232_err(err);*/ - - len = 0; - - return; -} -/*-----------------------------------------------------------------------------------*/ -void -rs232dev_unload(void) -{ - if(loaded){ - ser_unload(); - } -} -/*-----------------------------------------------------------------------------------*/ - diff --git a/backyard/cpu/6502/net/rs232dev.h b/backyard/cpu/6502/net/rs232dev.h deleted file mode 100644 index b2b9b693a..000000000 --- a/backyard/cpu/6502/net/rs232dev.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2001, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the uIP TCP/IP stack. - * - * $Id: rs232dev.h,v 1.1 2007/11/19 23:00:56 oliverschmidt Exp $ - * - */ - -#ifndef __RS232DEV_H__ -#define __RS232DEV_H__ - -#include "net/uip.h" - -void rs232dev_init(void); -u8_t rs232dev_read(void); -void rs232dev_send(void); - -u16_t rs232dev_poll(void); - -void rs232dev_unload(void); - -#endif /* __RS232DEV_H__ */ diff --git a/backyard/cpu/6502/net/slip-drv.c b/backyard/cpu/6502/net/slip-drv.c deleted file mode 100644 index 524ca1ee4..000000000 --- a/backyard/cpu/6502/net/slip-drv.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki OS - * - * $Id: slip-drv.c,v 1.1 2007/11/19 23:00:56 oliverschmidt Exp $ - * - */ - -#include "contiki-net.h" -#include "rs232dev.h" - -static u8_t output(void); - -SERVICE(slip_drv_service, packet_service, { output };); - -PROCESS(slip_drv_process, "SLIP driver"); - -/*---------------------------------------------------------------------------*/ -static u8_t -output(void) -{ - rs232dev_send(); - return 0; -} -/*---------------------------------------------------------------------------*/ -static void -pollhandler(void) -{ - uip_len = rs232dev_poll(); - if(uip_len > 0) { - tcpip_input(); - } - -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(slip_drv_process, ev, data) -{ - PROCESS_POLLHANDLER(pollhandler()); - PROCESS_EXITHANDLER(rs232dev_unload()); - - PROCESS_BEGIN(); - - rs232dev_init(); - - SERVICE_REGISTER(slip_drv_service); - - process_poll(&slip_drv_process); - - while(1) { - PROCESS_YIELD(); - } - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/backyard/cpu/6502/net/slip-dsc.c b/backyard/cpu/6502/net/slip-dsc.c deleted file mode 100644 index d718413c6..000000000 --- a/backyard/cpu/6502/net/slip-dsc.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: slip-dsc.c,v 1.1 2007/11/19 23:00:56 oliverschmidt Exp $ - * - */ - -#include "sys/dsc.h" - -/*-----------------------------------------------------------------------------------*/ -#if CTK_CONF_ICON_BITMAPS -static unsigned char slipicon_bitmap[3*3*8] = { - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, -}; -#endif /* CTK_CONF_ICON_BITMAPS */ - -#if CTK_CONF_ICON_TEXTMAPS -static char slipicon_textmap[9] = { - 'R', 'S', ' ', - '2', '3', '2', - '/', 'I', 'P' -}; -#endif /* CTK_CONF_ICON_TEXTMAPS */ - -#if CTK_CONF_ICONS -static struct ctk_icon slip_icon = - {CTK_ICON("SLIP driver", slipicon_bitmap, slipicon_textmap)}; -#endif /* CTK_CONF_ICONS */ -/*-----------------------------------------------------------------------------------*/ -DSC(slip_dsc, - "SLIP driver", - "slip.drv", - slip_init, - &slip_icon); -/*-----------------------------------------------------------------------------------*/ diff --git a/backyard/cpu/6502/net/slip-dump-drv.c b/backyard/cpu/6502/net/slip-dump-drv.c deleted file mode 100644 index 391ea382c..000000000 --- a/backyard/cpu/6502/net/slip-dump-drv.c +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki OS - * - * $Id: slip-dump-drv.c,v 1.1 2007/11/19 23:00:56 oliverschmidt Exp $ - * - */ - -#include "contiki.h" -#include "rs232dev.h" - -#include "packet-service.h" - -#include "tcpdump.h" -#include -#include "ctk/ctk.h" - -static void output(u8_t *hdr, u16_t hdrlen, u8_t *data, u16_t datalen); - -static const struct packet_service_state state = - { - PACKET_SERVICE_VERSION, - output - }; - -EK_EVENTHANDLER(eventhandler, ev, data); -EK_POLLHANDLER(pollhandler); -EK_PROCESS(proc, PACKET_SERVICE_NAME ": SLIP", EK_PRIO_HIGH, - eventhandler, pollhandler, (void *)&state); - -#define DUMP_WIDTH 38 -#define DUMP_HEIGHT 20 -static struct ctk_window window; -static char dump[DUMP_WIDTH * DUMP_HEIGHT]; -static struct ctk_label dumplabel = - {CTK_LABEL(0, 0, DUMP_WIDTH, DUMP_HEIGHT, dump)}; -static void -dump_packet(void) -{ - memcpy(dump, &dump[DUMP_WIDTH], DUMP_WIDTH * (DUMP_HEIGHT - 1)); - tcpdump_print(&dump[DUMP_WIDTH * (DUMP_HEIGHT - 1)], DUMP_WIDTH); - CTK_WIDGET_REDRAW(&dumplabel); -} -/*---------------------------------------------------------------------------*/ -LOADER_INIT_FUNC(slip_service_init, arg) -{ - arg_free(arg); - ek_service_start(PACKET_SERVICE_NAME, &proc); -} -/*---------------------------------------------------------------------------*/ -static void -output(u8_t *hdr, u16_t hdrlen, u8_t *data, u16_t datalen) -{ - rs232dev_send(); - dump_packet(); -} -/*---------------------------------------------------------------------------*/ -EK_EVENTHANDLER(eventhandler, ev, data) -{ - switch(ev) { - case EK_EVENT_INIT: - case EK_EVENT_REPLACE: - ctk_window_new(&window, DUMP_WIDTH, DUMP_HEIGHT, "SLIP dump"); - CTK_WIDGET_ADD(&window, &dumplabel); - ctk_window_open(&window); - rs232dev_init(); - break; - case EK_EVENT_REQUEST_REPLACE: - ctk_window_close(&window); - ek_replace((struct ek_proc *)data, NULL); - rs232dev_unload(); - LOADER_UNLOAD(); - break; - case EK_EVENT_REQUEST_EXIT: - ctk_window_close(&window); - ek_exit(); - rs232dev_unload(); - LOADER_UNLOAD(); - break; - default: - break; - } -} -/*---------------------------------------------------------------------------*/ -EK_POLLHANDLER(pollhandler) -{ - uip_len = rs232dev_poll(); - if(uip_len > 0) { - dump_packet(); - tcpip_input(); - } - -} -/*---------------------------------------------------------------------------*/ diff --git a/backyard/cpu/avr/dev/rtl8019as-drv.c b/backyard/cpu/avr/dev/rtl8019as-drv.c deleted file mode 100644 index 6d9c03389..000000000 --- a/backyard/cpu/avr/dev/rtl8019as-drv.c +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Adam Dunkels. - * 4. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the uIP TCP/IP stack. - * - * $Id: rtl8019as-drv.c,v 1.2 2010/10/19 18:29:03 adamdunkels Exp $ - * - */ - - -/* uip_main.c: initialization code and main event loop. */ - -#define NULL (void *)0 - - - -#include "uip.h" -#include "uip_arp.h" -#include "uip-signal.h" -#include "loader.h" -#include "rtl8019dev.h" - -#include "dispatcher.h" -#include "ek.h" - -#include "debug.h" - -#define BUF ((struct uip_eth_hdr *)&uip_buf[0]) - -static u8_t i, arptimer; -static u16_t start, current; - -static void rtl8019_drv_idle(void); -static DISPATCHER_SIGHANDLER(rtl8019_drv_sighandler, s, data); -static struct dispatcher_proc p = - {DISPATCHER_PROC("TCP/IP/RTL8019 driver", rtl8019_drv_idle, - rtl8019_drv_sighandler, NULL)}; -ek_id_t id = EK_ID_NONE; - - -/*-----------------------------------------------------------------------------------*/ -static void -timer(void) -{ - for(i = 0; i < UIP_CONNS; ++i) { - uip_periodic(i); - if(uip_len > 0) { - uip_arp_out(); - rtl8019as_send(); - } - } - - for(i = 0; i < UIP_UDP_CONNS; i++) { - uip_udp_periodic(i); - /* If the above function invocation resulted in data that - should be sent out on the network, the global variable - uip_len is set to a value > 0. */ - if(uip_len > 0) { - uip_arp_out(); - rtl8019as_send(); - } - } -} -/*-----------------------------------------------------------------------------------*/ -static void -rtl8019_drv_idle(void) -{ - /* Poll Ethernet device to see if there is a frame avaliable. */ - uip_len = rtl8019as_poll(); - if(uip_len > 0) { - /* A frame was avaliable (and is now read into the uip_buf), so - we process it. */ - if(BUF->type == uip_htons(UIP_ETHTYPE_IP)) { - /* debug_print16(uip_len);*/ - uip_arp_ipin(); - uip_len -= sizeof(struct uip_eth_hdr); - uip_input(); - /* If the above function invocation resulted in data that - should be sent out on the network, the global variable - uip_len is set to a value > 0. */ - if(uip_len > 0) { - /* debug_print(PSTR("Sending packet\n"));*/ - uip_arp_out(); - rtl8019as_send(); - } - } else if(BUF->type == uip_htons(UIP_ETHTYPE_ARP)) { - uip_arp_arpin(); - /* If the above function invocation resulted in data that - should be sent out on the network, the global variable - uip_len is set to a value > 0. */ - if(uip_len > 0) { - rtl8019as_send(); - } - } - } - /* Check the clock so see if we should call the periodic uIP - processing. */ - current = ek_clock(); - - if((current - start) >= CLK_TCK/2 || - (current - start) < 0) { - timer(); - start = current; - } -} -/*-----------------------------------------------------------------------------------*/ -LOADER_INIT_FUNC(rtl8019_drv_init) -{ - if(id == EK_ID_NONE) { - id = dispatcher_start(&p); - - arptimer = 0; - start = ek_clock(); - - rtl8019as_init(); - - dispatcher_listen(uip_signal_uninstall); - } -} -/*-----------------------------------------------------------------------------------*/ -static -DISPATCHER_SIGHANDLER(rtl8019_drv_sighandler, s, data) -{ - DISPATCHER_SIGHANDLER_ARGS(s, data); - - if(s == uip_signal_uninstall) { - dispatcher_exit(&p); - id = EK_ID_NONE; - LOADER_UNLOAD(); - } -} -/*-----------------------------------------------------------------------------------*/ diff --git a/backyard/platform/apple2enh/lib/log-asm.S b/backyard/platform/apple2enh/lib/log-asm.S deleted file mode 100644 index b5935e3a6..000000000 --- a/backyard/platform/apple2enh/lib/log-asm.S +++ /dev/null @@ -1,51 +0,0 @@ -; -; Copyright (c) 2007, Swedish Institute of Computer Science. -; All rights reserved. -; -; Redistribution and use in source and binary forms, with or without -; modification, are permitted provided that the following conditions -; are met: -; 1. Redistributions of source code must retain the above copyright -; notice, this list of conditions and the following disclaimer. -; 2. Redistributions in binary form must reproduce the above copyright -; notice, this list of conditions and the following disclaimer in the -; documentation and/or other materials provided with the distribution. -; 3. Neither the name of the Institute nor the names of its contributors -; may be used to endorse or promote products derived from this software -; without specific prior written permission. -; -; THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND -; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -; IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -; ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE -; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -; DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -; OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -; HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -; LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -; OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -; SUCH DAMAGE. -; -; This file is part of the Contiki operating system. -; -; Author: Oliver Schmidt -; -; $Id: log-asm.S,v 1.1 2010/02/10 07:43:25 oliverschmidt Exp $ -; -;--------------------------------------------------------------------- - .importzp ptr1 - .import COUT - .export _log_write -;--------------------------------------------------------------------- -_log_write: - sta ptr1 - stx ptr1+1 - ldy #$00 -: lda (ptr1),y - bne :+ - rts -: ora #$80 - jsr COUT - iny - bne :-- -;--------------------------------------------------------------------- diff --git a/backyard/platform/apple2enh/lib/log.c b/backyard/platform/apple2enh/lib/log.c deleted file mode 100644 index 38d14732c..000000000 --- a/backyard/platform/apple2enh/lib/log.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Oliver Schmidt - * - * $Id: log.c,v 1.1 2010/02/10 07:43:25 oliverschmidt Exp $ - */ - -#include "net/uip.h" -#include "sys/log.h" - -void __fastcall__ log_write(const char *message); - -/*-----------------------------------------------------------------------------------*/ -#if UIP_LOGGING -void -uip_log(char *message) -{ - log_write(message); - log_write("\r"); -} -#endif /* UIP_LOGGING */ -/*-----------------------------------------------------------------------------------*/ -#if LOG_CONF_ENABLED -void -log_message(const char *part1, const char *part2) -{ - log_write(part1); - log_write(part2); - log_write("\r"); -} -#endif /* LOG_CONF_ENABLED */ -/*-----------------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/Makefile b/backyard/platform/c64/Makefile deleted file mode 100644 index 5219a814b..000000000 --- a/backyard/platform/c64/Makefile +++ /dev/null @@ -1,77 +0,0 @@ -# Copyright (c) 2002, Adam Dunkels. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. The name of the author may not be used to endorse or promote -# products derived from this software without specific prior -# written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS -# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE -# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# This file is part of the Contiki desktop environment -# -# $Id: Makefile,v 1.1 2007/05/23 23:11:23 oliverschmidt Exp $ -# - -CONTIKI=../.. -CONTIKICC65=../../cpu/6502 - -usage: - @echo "Make sure the Contiki sources is in the directory $(CONTIKI)" - @echo 'To compile Contiki, use "'$(MAKE)' target" where target' - @echo 'is one of the following:' - @echo all - @echo c64 - @echo programs - @echo d64 - @echo programs - @echo '(Also check the Makefile for more targets to try...)' - -all: clean c64 programs - -programs: - $(MAKE) CONTIKI=$(CONTIKI) CONTIKICC65=$(CONTIKICC65) -f Makefile.programs -c64: - $(MAKE) CONTIKI=$(CONTIKI) CONTIKICC65=$(CONTIKICC65) -f Makefile.c64 - -c64-exo: - $(MAKE) CONTIKI=$(CONTIKI) CONTIKICC65=$(CONTIKICC65) -f Makefile.c64 contiki-exo - -wget: - $(MAKE) CONTIKI=$(CONTIKI) CONTIKICC65=$(CONTIKICC65) -f Makefile.c64-wget - -installer: clean - $(MAKE) CONTIKI=$(CONTIKI) CONTIKICC65=$(CONTIKICC65) -f Makefile.installer - - -CCDEPFLAGS=-D__CBM__ -D__C64__ -DCTK_HIRES -DWITH_UIP -DWITH_LOADER_ARCH -I/usr/local/lib/cc65/include - -include $(CONTIKICC65)/Makefile.cc65 - -d64: - c1541 -format contiki,00 d64 contiki.d64 - c1541 -attach contiki.d64 -write contiki - c1541 -attach contiki.d64 -write config.cfg - c1541 -attach contiki.d64 $(foreach dsc, $(wildcard *.dsc), -write $(dsc)) - c1541 -attach contiki.d64 $(foreach prg, $(wildcard *.prg), -write $(prg)) - c1541 -attach contiki.d64 $(foreach sav, $(wildcard *.sav), -write $(sav)) - c1541 -attach contiki.d64 $(foreach drv, $(wildcard *.drv), -write $(drv)) - c1541 -attach contiki.d64 $(foreach ser, $(wildcard *.ser), -write $(ser)) - c1541 -attach contiki.d64 -list diff --git a/backyard/platform/c64/apps/blueround-dsc.c b/backyard/platform/c64/apps/blueround-dsc.c deleted file mode 100644 index a6afa0526..000000000 --- a/backyard/platform/c64/apps/blueround-dsc.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: blueround-dsc.c,v 1.2 2007/09/06 01:36:11 matsutsuka Exp $ - * - */ - -#include "sys/dsc.h" - -/*-----------------------------------------------------------------------------------*/ -#if CTK_CONF_ICON_BITMAPS -static unsigned char blueroundicon_bitmap[3*3*8] = { - 0xfe,0xf8,0xe0,0xc0,0xc0,0x80,0x80,0x00, - 0x00,0x55,0xaa,0x00,0xaa,0x00,0x00,0x00, - 0x7f,0x1f,0x07,0x03,0x03,0x01,0x01,0x00, - - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - - 0x00,0x80,0x80,0xc0,0xc0,0xe0,0xf8,0xfe, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x01,0x01,0x03,0x03,0x07,0x1f,0x7f -}; -#endif /* CTK_CONF_ICON_BITMAPS */ - -#if CTK_CONF_ICON_TEXTMAPS -static char blueroundicon_textmap[9] = { - '(', '=', ')', - '|', 'o', '|', - '(', '-', ')' -}; -#endif /* CTK_CONF_ICON_TEXTMAPS */ - -#if CTK_CONF_ICONS -static struct ctk_icon blueround_icon = - {CTK_ICON("Blueround", blueroundicon_bitmap, blueroundicon_textmap)}; -#endif /* CTK_CONF_ICONS */ -/*-----------------------------------------------------------------------------------*/ -DSC(blueround_dsc, - "Blueround CTK theme", - "blueround.prg", - blueround_init, - &blueround_icon); -/*-----------------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/apps/cgterm-dsc.c b/backyard/platform/c64/apps/cgterm-dsc.c deleted file mode 100644 index 12cb65705..000000000 --- a/backyard/platform/c64/apps/cgterm-dsc.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: cgterm-dsc.c,v 1.2 2007/09/06 01:36:11 matsutsuka Exp $ - * - */ - -#include "sys/dsc.h" - -/*-----------------------------------------------------------------------------------*/ -#if CTK_CONF_ICON_BITMAPS -static unsigned char cgtermicon_bitmap[3*3*8] = { - 0x00, 0x7e, 0x40, 0x73, 0x46, 0x4c, 0x18, 0x13, - 0x00, 0x00, 0xff, 0x81, 0x34, 0xc9, 0x00, 0xb6, - 0x00, 0x7e, 0x02, 0xce, 0x72, 0x32, 0x18, 0x48, - - 0x30, 0x27, 0x24, 0x20, 0x37, 0x24, 0x20, 0x33, - 0x00, 0x7b, 0x42, 0x00, 0x7b, 0x42, 0x00, 0x3b, - 0x0c, 0x24, 0x24, 0x04, 0xa4, 0x24, 0x04, 0x4c, - - 0x12, 0x19, 0x4c, 0x46, 0x63, 0x40, 0x7c, 0x00, - 0x22, 0x91, 0x00, 0xc4, 0x81, 0xff, 0x00, 0x00, - 0x08, 0x18, 0x32, 0x62, 0xc6, 0x02, 0x3e, 0x00 -}; -#endif /* CTK_CONF_ICON_BITMAPS */ - -#if CTK_CONF_ICON_TEXTMAPS -static char cgtermicon_textmap[9] = { - 'T', 'e', 'l', - 'n', 'e', 't', - 'B', 'B', 'S' -}; -#endif /* CTK_CONF_ICON_TEXTMAPS */ - -#if CTK_CONF_ICONS -static struct ctk_icon cgterm_icon = - {CTK_ICON("C/G terminal", cgtermicon_bitmap, cgtermicon_textmap)}; -#endif /* CTK_CONF_ICONS */ -/*-----------------------------------------------------------------------------------*/ -DSC(cgterm_dsc, - "Program for connecting to C64 Telnet BBSes", - "cgterm.prg", - cgterm_init, - &cgterm_icon); -/*-----------------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/apps/cgterm.c b/backyard/platform/c64/apps/cgterm.c deleted file mode 100644 index 3e4000e30..000000000 --- a/backyard/platform/c64/apps/cgterm.c +++ /dev/null @@ -1,242 +0,0 @@ -#include "contiki-net.h" -#include "ctk/ctk-draw.h" - -#include -#include -#include - -static struct { - struct psock sout, sin; - struct pt inpt, outpt; - char outputbuf[200]; - char inputbuf[200]; - unsigned short len; -} s; - -#define CURSOR_ON() *(char *)0xcc = 0 -#define CURSOR_OFF() *(char *)0xcc = 1 -static void ctkmode(void); -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(send(void)) -{ - PSOCK_BEGIN(&s.sout); - - PSOCK_SEND(&s.sout, s.outputbuf, s.len); - PSOCK_END(&s.sout); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(handle_output(void)) -{ - ctk_arch_key_t c; - char *ptr; - - PT_BEGIN(&s.outpt); - - while(1) { - PT_WAIT_UNTIL(&s.outpt, (ctk_mode_get() == CTK_MODE_EXTERNAL) && - kbhit()); - - - ptr = s.outputbuf; - s.len = 0; - while(kbhit() && s.len < sizeof(s.outputbuf)) { - c = cgetc(); - *ptr = c; - ++ptr; - ++s.len; - } - - PT_WAIT_THREAD(&s.outpt, send()); - } - PT_END(&s.outpt); -} -/*---------------------------------------------------------------------------*/ -static -PT_THREAD(handle_input(void)) -{ - unsigned short i; - char *ptr; - char next; - - next = 1; - PT_BEGIN(&s.inpt); - - while(1) { - /* Wait until data arrives. */ - next = 0; - PT_WAIT_UNTIL(&s.inpt, next && uip_newdata()); - - CURSOR_OFF(); - /* Print it out on the screen. */ - ptr = (char *)uip_appdata; - for(i = 0; i < uip_len; ++i) { - cbm_k_bsout(*ptr); - ++ptr; - } - CURSOR_ON(); - } - PT_END(&s.inpt); -} -/*---------------------------------------------------------------------------*/ -static void -appcall(void *state) -{ - if(uip_closed() || uip_aborted() || uip_timedout()) { - ctkmode(); - } else if(uip_connected()) { - } else { - handle_input(); - handle_output(); - } -} -/*---------------------------------------------------------------------------*/ -static struct uip_conn * -connect(u16_t *host, u16_t port) -{ - PSOCK_INIT(&s.sin, s.inputbuf, sizeof(s.inputbuf)); - PSOCK_INIT(&s.sout, s.inputbuf, sizeof(s.inputbuf)); - PT_INIT(&s.inpt); - PT_INIT(&s.outpt); - return tcp_connect(host, uip_htons(port), NULL); -} -/*---------------------------------------------------------------------------*/ -PROCESS(cgterm_process, "C/G terminal"); - -static struct uip_conn *conn; -static u16_t serveraddr[2]; -static u16_t serverport; -/*---------------------------------------------------------------------------*/ -static struct ctk_window window; -static struct ctk_label hostlabel = - {CTK_LABEL(0, 0, 4, 1, "Host")}; -static char host[32]; -static struct ctk_textentry hostentry = - {CTK_TEXTENTRY(5, 0, 20, 1, host, sizeof(host) - 1)}; -static struct ctk_label portlabel = - {CTK_LABEL(27, 0, 4, 1, "Port")}; -static char port[7]; -static struct ctk_textentry portentry = - {CTK_TEXTENTRY(32, 0, 4, 1, port, sizeof(port) - 1)}; -static struct ctk_button connectbutton = - {CTK_BUTTON(0, 2, 7, "Connect")}; -static struct ctk_button switchbutton = - {CTK_BUTTON(30, 2, 6, "Switch")}; -static struct ctk_label helplabel = - {CTK_LABEL(0, 4, 37, 1, "RUN/STOP to return from terminal view")}; -/*---------------------------------------------------------------------------*/ -static void -ctkmode(void) -{ - ctk_mode_set(CTK_MODE_NORMAL); - ctk_draw_init(); - ctk_desktop_redraw(NULL); -} -/*---------------------------------------------------------------------------*/ -static void -textmode(void) -{ - ctk_mode_set(CTK_MODE_EXTERNAL); - - VIC.ctrl1 = 0x1b; /* $D011 */ - VIC.addr = 0x17; /* $D018 */ - VIC.ctrl2 = 0xc8; /* $D016 */ - CIA2.pra = 0x03; /* $DD00 */ - - VIC.bordercolor = 0x00; /* $D020 */ - VIC.bgcolor0 = 0x00; /* $D021 */ - - CURSOR_ON(); -} -/*---------------------------------------------------------------------------*/ -static void -pollhandler(void) -{ - if(ctk_mode_get() == CTK_MODE_EXTERNAL) { - if(CIA1.prb == 0x7f) { - ctkmode(); - } else if(kbhit() && conn != NULL) { - tcpip_poll_tcp(conn); - } - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(cgterm_process, ev, data) -{ - u16_t *ipaddr; - char *cptr; - - PROCESS_POLLHANDLER(pollhandler()); - - PROCESS_BEGIN(); - - ctk_window_new(&window, 38, 5, "C/G term"); - CTK_WIDGET_ADD(&window, &hostlabel); - CTK_WIDGET_ADD(&window, &hostentry); - CTK_WIDGET_ADD(&window, &portlabel); - CTK_WIDGET_ADD(&window, &portentry); - CTK_WIDGET_ADD(&window, &connectbutton); - CTK_WIDGET_ADD(&window, &switchbutton); - CTK_WIDGET_ADD(&window, &helplabel); - ctk_window_open(&window); - - while(1) { - PROCESS_WAIT_EVENT(); - - if(ev == tcpip_event) { - appcall(data); - } else if(ev == ctk_signal_widget_activate) { - - if(data == &switchbutton) { - textmode(); - } else if(data == &connectbutton) { - serverport = 0; - for(cptr = port; *cptr != ' ' && *cptr != 0; ++cptr) { - if(*cptr < '0' || *cptr > '9') { - continue; - } - serverport = 10 * serverport + *cptr - '0'; - } - - ipaddr = serveraddr; - if(uiplib_ipaddrconv(host, (u8_t *)serveraddr) == 0) { - ipaddr = resolv_lookup(host); - if(ipaddr == NULL) { - resolv_query(host); - } else { - uip_ipaddr_copy(serveraddr, ipaddr); - } - } - if(ipaddr != NULL) { - conn = connect(serveraddr, serverport); - if(conn != NULL) { - memset((char *)0x0400, 0x20, 40*25); - memset((char *)0xd800, 0x01, 40*25); - textmode(); - } - } - } - } else if(ev == resolv_event_found) { - ipaddr = resolv_lookup(host); - if(ipaddr != NULL) { - uip_ipaddr_copy(serveraddr, ipaddr); - - conn = connect(serveraddr, serverport); - if(conn != NULL) { - memset((char *)0x0400, 0x20, 40*25); - memset((char *)0xd800, 0x01, 40*25); - textmode(); - } - } - } else if(ev == PROCESS_EVENT_EXIT || - ev == ctk_signal_window_close) { - - break; - } - } - ctk_window_close(&window); - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/apps/config.c b/backyard/platform/c64/apps/config.c deleted file mode 100644 index 8a268bc23..000000000 --- a/backyard/platform/c64/apps/config.c +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop OS. - * - * $Id: config.c,v 1.1 2007/05/23 23:11:24 oliverschmidt Exp $ - * - */ - -#include "program-handler.h" -#include "contiki-net.h" -#include "cfs/cfs.h" - -struct ptentry { - char c; - char * (* pfunc)(char *str); -}; - -/*-----------------------------------------------------------------------------------*/ -static char * -parse(char *str, struct ptentry *t) -{ - struct ptentry *p; - - /* Loop over the parse table entries in t in order to find one that - matches the first character in str. */ - for(p = t; p->c != 0; ++p) { - if(*str == p->c) { - /* Skip rest of the characters up to the first space. */ - while(*str != ' ') { - ++str; - } - - /* Skip all spaces.*/ - while(*str == ' ') { - ++str; - } - - /* Call parse table entry function and return. */ - return p->pfunc(str); - } - } - - /* Did not find matching entry in parse table. We just call the - default handler supplied by the caller and return. */ - return p->pfunc(str); -} -/*-----------------------------------------------------------------------------------*/ -static char * -skipnewline(char *str) -{ - /* Skip all characters until the newline. */ - while(*str != '\n') { - ++str; - } - - /* Return a pointer to the first character after the newline. */ - return str + 1; -} -/*-----------------------------------------------------------------------------------*/ -static char * -nullterminate(char *str) -{ - char *nt; - - /* Nullterminate string. Start with finding newline character. */ - for(nt = str; *nt != '\r' && - *nt != '\n'; ++nt); - - /* Replace newline with a null char. */ - *nt = 0; - - /* Remove trailing spaces. */ - while(nt > str && *(nt - 1) == ' ') { - *(nt - 1) = 0; - --nt; - } - - /* Return pointer to null char. */ - return nt; -} -/*-----------------------------------------------------------------------------------*/ -static char * -loadfile(char *str) -{ - char *nt; - - nt = nullterminate(str); - - /* Call loader function. */ - program_handler_load(str, NULL); - - return nt + 1; -} -/*-----------------------------------------------------------------------------------*/ -static char * -screensaverconf(char *str) -{ - char *nt; - - nt = nullterminate(str); - program_handler_setscreensaver(str); - - return nt + 1; -} -/*-----------------------------------------------------------------------------------*/ -static u16_t addr[2]; -static char * -ipaddrconf(char *str) -{ - char *nt; - - nt = nullterminate(str); - if(uiplib_ipaddrconv(str, (unsigned char *)addr)) { - uip_sethostaddr(addr); - } - - return nt + 1; -} -/*-----------------------------------------------------------------------------------*/ -static char * -netmaskconf(char *str) -{ - char *nt; - - nt = nullterminate(str); - if(uiplib_ipaddrconv(str, (unsigned char *)addr)) { - uip_setnetmask(addr); - } - - return nt + 1; -} -/*-----------------------------------------------------------------------------------*/ -static char * -drconf(char *str) -{ - char *nt; - - nt = nullterminate(str); - if(uiplib_ipaddrconv(str, (unsigned char *)addr)) { - uip_setdraddr(addr); - } - - return nt + 1; -} -/*-----------------------------------------------------------------------------------*/ -static char * -dnsconf(char *str) -{ - char *nt; - - nt = nullterminate(str); - if(uiplib_ipaddrconv(str, (unsigned char *)addr)) { - resolv_conf(addr); - } - - return nt + 1; -} -/*-----------------------------------------------------------------------------------*/ -static struct ptentry configparsetab[] = - {{'n', loadfile}, - {'t', loadfile}, - {'c', loadfile}, - {'s', screensaverconf}, - {'i', ipaddrconf}, - {'m', netmaskconf}, - {'r', drconf}, - {'d', dnsconf}, - {'#', skipnewline}, - - /* Default action */ - {0, skipnewline}}; -static void -configscript(void) -{ - static char line[40], *lineptr; - /* static struct c64_fs_file f;*/ - int f; - - if((f = cfs_open("config.cfg", 0)) == -1) { - return; - } - - line[0] = ' '; - while(line[0] != '.' && - line[0] != 0) { - lineptr = line; - do { - if(cfs_read(f, lineptr, 1) != 1) { - cfs_close(f); - return; - } - ++lineptr; - } while(*(lineptr - 1) != '\n' && - *(lineptr - 1) != '\r'); - - *lineptr = 0; - - if(line[0] != '.' && - line[0] != 0) { - parse(line, configparsetab); - } - - } - cfs_close(f); - return; -} -/*-----------------------------------------------------------------------------------*/ -LOADER_INIT_FUNC(config_init, arg) -{ - arg_free(arg); - program_handler_setscreensaver(NULL); - configscript(); - LOADER_UNLOAD(); -} -/*-----------------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/apps/configedit-dsc.c b/backyard/platform/c64/apps/configedit-dsc.c deleted file mode 100644 index 589e2d29b..000000000 --- a/backyard/platform/c64/apps/configedit-dsc.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: configedit-dsc.c,v 1.2 2007/09/06 01:36:11 matsutsuka Exp $ - * - */ - -#include "sys/dsc.h" - -/*-----------------------------------------------------------------------------------*/ -#if CTK_CONF_ICON_BITMAPS -static unsigned char tcpipconficon_bitmap[3*3*8] = { - 0x00, 0x79, 0x43, 0x73, 0x47, 0x77, 0x47, 0x6f, - 0x00, 0xfe, 0xfe, 0xfc, 0xfc, 0xfc, 0xf8, 0xfb, - 0x00, 0x16, 0x02, 0x00, 0x02, 0x00, 0x00, 0xc2, - - 0x48, 0x4c, 0x5f, 0x5f, 0x1f, 0x3f, 0x3f, 0x03, - 0x79, 0xf0, 0xf0, 0xf0, 0xe0, 0xe0, 0xfe, 0xfc, - 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - - 0x77, 0x47, 0x70, 0x43, 0x79, 0x41, 0x7c, 0x00, - 0xfc, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xf7, 0x00, - 0x00, 0x80, 0x00, 0x00, 0x00, 0x84, 0xf0, 0x00 -}; -#endif /* CTK_CONF_ICON_BITMAPS */ - -#if CTK_CONF_ICON_TEXTMAPS -static char tcpipconficon_textmap[9] = { - 'C', 'F', 'G', - ' ', ' ', ' ', - 'C', 'F', 'G' -}; -#endif /* CTK_CONF_ICON_TEXTMAPS */ - -#if CTK_CONF_ICONS -static struct ctk_icon configedit_icon = - {CTK_ICON("Configuration", tcpipconficon_bitmap, tcpipconficon_textmap)}; -#endif /* CTK_CONF_ICONS */ -/*-----------------------------------------------------------------------------------*/ -DSC(configedit_dsc, - "Edit Contiki configuration", - "configedit.prg", - configedit_init, - &configedit_icon); -/*-----------------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/apps/configedit-dsc.h b/backyard/platform/c64/apps/configedit-dsc.h deleted file mode 100644 index 2282b36a6..000000000 --- a/backyard/platform/c64/apps/configedit-dsc.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: configedit-dsc.h,v 1.1 2007/05/23 23:11:24 oliverschmidt Exp $ - * - */ -#ifndef __CONFIGEDIT_DSC_H__ -#define __CONFIGEDIT_DSC_H__ - -#include "sys/dsc.h" - -DSC_HEADER(configedit_dsc); - -#endif /* __CONFIGEDIT_DSC_H__ */ diff --git a/backyard/platform/c64/apps/configedit.c b/backyard/platform/c64/apps/configedit.c deleted file mode 100644 index c42009800..000000000 --- a/backyard/platform/c64/apps/configedit.c +++ /dev/null @@ -1,418 +0,0 @@ -/* - * Copyright (c) 2002, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: configedit.c,v 1.1 2007/05/23 23:11:24 oliverschmidt Exp $ - * - */ - -#include "contiki.h" -#include "contiki-net.h" - -#include "ctk/ctk-draw-service.h" -#include "net/packet-service.h" - -#include "ctk/ctk.h" -#include "ctk/ctk-draw.h" - -#include "program-handler.h" - -#include "cfs/cfs.h" - -#include - -#include - -/* TCP/IP configuration window. */ -static struct ctk_window window; - -#define LABELMAXWIDTH 12 - -static struct ctk_label cfslabel = - {CTK_LABEL(0, 1, LABELMAXWIDTH, 1, "Disk driver")}; -static char cfs[25]; -static struct ctk_textentry cfstextentry = - {CTK_TEXTENTRY(LABELMAXWIDTH + 1, 1, 16, 1, cfs, 24)}; - -static struct ctk_label themelabel = - {CTK_LABEL(0, 3, LABELMAXWIDTH, 1, "CTK theme")}; -static char theme[25]; -static struct ctk_textentry themetextentry = - {CTK_TEXTENTRY(LABELMAXWIDTH + 1, 3, 16, 1, theme, 24)}; - -static struct ctk_label driverlabel = - {CTK_LABEL(0, 5, LABELMAXWIDTH, 1, "Net driver")}; -static char driver[25]; -static struct ctk_textentry drivertextentry = - {CTK_TEXTENTRY(LABELMAXWIDTH + 1, 5, 16, 1, driver, 24)}; - -static struct ctk_label screensaverlabel = - {CTK_LABEL(0, 7, LABELMAXWIDTH, 1, "Screensaver")}; -static char screensaver[25]; -static struct ctk_textentry screensavertextentry = - {CTK_TEXTENTRY(LABELMAXWIDTH + 1, 7, 16, 1, screensaver, 24)}; - - -static struct ctk_label ipaddrlabel = - {CTK_LABEL(0, 9, LABELMAXWIDTH, 1, "IP address")}; -static char ipaddr[25]; -static struct ctk_textentry ipaddrtextentry = - {CTK_TEXTENTRY(LABELMAXWIDTH + 1, 9, 16, 1, ipaddr, 24)}; -static struct ctk_label netmasklabel = - {CTK_LABEL(0, 11, LABELMAXWIDTH, 1, "Netmask")}; -static char netmask[25]; -static struct ctk_textentry netmasktextentry = - {CTK_TEXTENTRY(LABELMAXWIDTH + 1, 11, 16, 1, netmask, 24)}; -static struct ctk_label gatewaylabel = - {CTK_LABEL(0, 13, LABELMAXWIDTH, 1, "Gateway")}; -static char gateway[25]; -static struct ctk_textentry gatewaytextentry = - {CTK_TEXTENTRY(LABELMAXWIDTH + 1, 13, 16, 1, gateway, 24)}; -static struct ctk_label dnsserverlabel = - {CTK_LABEL(0, 15, LABELMAXWIDTH, 1, "DNS server")}; -static char dnsserver[25]; -static struct ctk_textentry dnsservertextentry = - {CTK_TEXTENTRY(LABELMAXWIDTH + 1, 15, 16, 1, dnsserver, 24)}; - -static struct ctk_button savebutton = - {CTK_BUTTON(0, 17, 12, "Save & close")}; -static struct ctk_button cancelbutton = - {CTK_BUTTON(24, 17, 6, "Cancel")}; - -PROCESS(configedit_process, "Configuration editor"); -/*-----------------------------------------------------------------------------------*/ -struct ptentry { - char c; - char * (* pfunc)(char *str); -}; - -/*-----------------------------------------------------------------------------------*/ -static char * -parse(char *str, struct ptentry *t) -{ - struct ptentry *p; - - /* Loop over the parse table entries in t in order to find one that - matches the first character in str. */ - for(p = t; p->c != 0; ++p) { - if(*str == p->c) { - /* Skip rest of the characters up to the first space. */ - while(*str != ' ') { - ++str; - } - - /* Skip all spaces.*/ - while(*str == ' ') { - ++str; - } - - /* Call parse table entry function and return. */ - return p->pfunc(str); - } - } - - /* Did not find matching entry in parse table. We just call the - default handler supplied by the caller and return. */ - return p->pfunc(str); -} -/*-----------------------------------------------------------------------------------*/ -static char * -skipnewline(char *str) -{ - /* Skip all characters until the newline. */ - while(*str != '\n') { - ++str; - } - - /* Return a pointer to the first character after the newline. */ - return str + 1; -} -/*-----------------------------------------------------------------------------------*/ -static char * -nullterminate(char *str) -{ - char *nt; - - /* Nullterminate string. Start with finding newline character. */ - for(nt = str; *nt != '\r' && - *nt != '\n'; ++nt); - - /* Replace newline with a null char. */ - *nt = 0; - - /* Remove trailing spaces. */ - while(nt > str && *(nt - 1) == ' ') { - *(nt - 1) = 0; - --nt; - } - - /* Return pointer to null char. */ - return nt; -} -/*-----------------------------------------------------------------------------------*/ -static char * __fastcall__ -copystr(char *dst, char *src, int len) -{ - char *nt = nullterminate(src); - strncpy(dst, src, len); - return nt + 1; -} -/*-----------------------------------------------------------------------------------*/ -static char * -loaddriver(char *str) -{ - return copystr(driver, str, sizeof(driver)); -} -/*-----------------------------------------------------------------------------------*/ -static char * -loadtheme(char *str) -{ - return copystr(theme, str, sizeof(theme)); -} -/*-----------------------------------------------------------------------------------*/ -static char * -loadcfs(char *str) -{ - return copystr(cfs, str, sizeof(cfs)); -} -/*-----------------------------------------------------------------------------------*/ -static char * -loadscreensaver(char *str) -{ - return copystr(screensaver, str, sizeof(screensaver)); -} -/*-----------------------------------------------------------------------------------*/ -static char * -ipaddrconf(char *str) -{ - return copystr(ipaddr, str, sizeof(ipaddr)); -} -/*-----------------------------------------------------------------------------------*/ -static char * -netmaskconf(char *str) -{ - return copystr(netmask, str, sizeof(netmask)); -} -/*-----------------------------------------------------------------------------------*/ -static char * -drconf(char *str) -{ - return copystr(gateway, str, sizeof(gateway)); -} -/*-----------------------------------------------------------------------------------*/ -static char * -dnsconf(char *str) -{ - return copystr(dnsserver, str, sizeof(dnsserver)); -} -/*-----------------------------------------------------------------------------------*/ -static struct ptentry initparsetab[] = - {{'n', loaddriver}, - {'t', loadtheme}, - {'c', loadcfs}, - {'s', loadscreensaver}, - {'i', ipaddrconf}, - {'m', netmaskconf}, - {'r', drconf}, - {'d', dnsconf}, - {'#', skipnewline}, - - /* Default action */ - {0, skipnewline}}; -static void -initscript(void) -{ - char line[40], *lineptr; - /* struct c64_fs_file f;*/ - int f; - - if((f = cfs_open("config.cfg", 0)) == -1) { - return; - } - line[0] = ' '; - while(line[0] != '.' && - line[0] != 0) { - lineptr = line; - do { - if(cfs_read(f, lineptr, 1) != 1) { - cfs_close(f); - return; - } - ++lineptr; - } while(*(lineptr - 1) != '\n' && - *(lineptr - 1) != '\r'); - - *lineptr = 0; - - if(line[0] != '.' && - line[0] != 0) { - parse(line, initparsetab); - } - - } - cfs_close(f); - return; -} -/*-----------------------------------------------------------------------------------*/ -static int -makeline(char *line, char c, char *str) -{ - int len; - - len = strlen(str); - - line[0] = c; - line[1] = ' '; - strcpy(&line[2], str); - line[2 + len] = '\n'; - line[3 + len] = 0; - return len + 3; -} -/*-----------------------------------------------------------------------------------*/ -static void -savescript(void) -{ - char line[40]; - /* struct c64_fs_file f;*/ - int f; - - f = cfs_open("@:config.cfg", CFS_WRITE); - if(f == -1) { - log_message("Could not open config.cfg", ""); - return; - } - if(cfs[0] != 0) { - cfs_write(f, line, makeline(line, 'c', cfs)); - } - if(theme[0] != 0) { - cfs_write(f, line, makeline(line, 't', theme)); - } - if(driver[0] != 0) { - cfs_write(f, line, makeline(line, 'n', driver)); - } - if(ipaddr[0] != 0) { - cfs_write(f, line, makeline(line, 'i', ipaddr)); - } - if(netmask[0] != 0) { - cfs_write(f, line, makeline(line, 'm', netmask)); - } - if(gateway[0] != 0) { - cfs_write(f, line, makeline(line, 'r', gateway)); - } - if(dnsserver[0] != 0) { - cfs_write(f, line, makeline(line, 'd', dnsserver)); - } - - if(screensaver[0] != 0) { - cfs_write(f, line, makeline(line, 's', screensaver)); - } - - strcpy(line, ".\n\0\n\n\n"); - cfs_write(f, line, strlen(line)); - - cfs_close(f); - -} -/*-----------------------------------------------------------------------------------*/ -static void -quit_services(void) -{ - /* cfs_init_init(NULL); - ctk_draw_quit(); - - if(ek_service_find(&packetservice) == EK_ERR_OK) { - ek_post(packetservice.id, EK_EVENT_REQUEST_EXIT, NULL); - ek_service_reset(&packetservice); - }*/ -} -/*-----------------------------------------------------------------------------------*/ -PROCESS_THREAD(configedit_process, ev, data) -{ - PROCESS_BEGIN(); - - /* Create window. */ - ctk_window_new(&window, 32, 18, "Config editor"); - - CTK_WIDGET_ADD(&window, &cfslabel); - CTK_WIDGET_ADD(&window, &cfstextentry); - - CTK_WIDGET_ADD(&window, &themelabel); - CTK_WIDGET_ADD(&window, &themetextentry); - - CTK_WIDGET_ADD(&window, &driverlabel); - CTK_WIDGET_ADD(&window, &drivertextentry); - - CTK_WIDGET_ADD(&window, &screensaverlabel); - CTK_WIDGET_ADD(&window, &screensavertextentry); - - CTK_WIDGET_ADD(&window, &ipaddrlabel); - CTK_WIDGET_ADD(&window, &ipaddrtextentry); - CTK_WIDGET_ADD(&window, &netmasklabel); - CTK_WIDGET_ADD(&window, &netmasktextentry); - CTK_WIDGET_ADD(&window, &gatewaylabel); - CTK_WIDGET_ADD(&window, &gatewaytextentry); - CTK_WIDGET_ADD(&window, &dnsserverlabel); - CTK_WIDGET_ADD(&window, &dnsservertextentry); - - CTK_WIDGET_ADD(&window, &savebutton); - CTK_WIDGET_ADD(&window, &cancelbutton); - - CTK_WIDGET_FOCUS(&window, &cfstextentry); - - /* Fill the configuration strings with values from the current - configuration */ - initscript(); - - ctk_window_open(&window); - - while(1) { - PROCESS_WAIT_EVENT(); - - if(ev == ctk_signal_button_activate) { - if(data == &savebutton) { - savescript(); - quit_services(); - ctk_window_close(&window); - program_handler_load("config.prg", NULL); - break; - } else if(data == &cancelbutton) { - ctk_window_close(&window); - break; - } - } else if(ev == ctk_signal_window_close || - ev == PROCESS_EVENT_EXIT) { - ctk_window_close(&window); - break; - } - } - - PROCESS_END(); -} -/*-----------------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/apps/default-dsc.c b/backyard/platform/c64/apps/default-dsc.c deleted file mode 100644 index 35e39247c..000000000 --- a/backyard/platform/c64/apps/default-dsc.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: default-dsc.c,v 1.2 2007/09/06 01:36:11 matsutsuka Exp $ - * - */ - -#include "sys/dsc.h" - -/*-----------------------------------------------------------------------------------*/ -#if CTK_CONF_ICON_BITMAPS -static unsigned char defaulticon_bitmap[3*3*8] = { - 0xff,0xff,0xc0,0xcf,0xc0,0xc3,0xc0,0xc0, - 0xff,0xff,0x00,0xff,0x00,0xff,0x00,0x00, - 0xff,0xfc,0x00,0xf0,0x00,0xc0,0x00,0x00, - 0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x0b,0x0b,0x0b,0x0b,0x0b,0x0b,0x0b,0x0b, - 0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x80,0x00, - 0x00,0x00,0x00,0x00,0xff,0x00,0xff,0xff, - 0x0b,0x0b,0x0b,0x0b,0xfb,0x03,0xff,0xff -}; -#endif /* CTK_CONF_ICON_BITMAPS */ - -#if CTK_CONF_ICON_TEXTMAPS -static char defaulticon_textmap[9] = { - '+', '=', '+', - '|', 'D', '|', - '+', '-', '+' -}; -#endif /* CTK_CONF_ICON_TEXTMAPS */ - -#if CTK_CONF_ICONS -static struct ctk_icon default_icon = - {CTK_ICON("Default", defaulticon_bitmap, defaulticon_textmap)}; -#endif /* CTK_CONF_ICONS */ -/*-----------------------------------------------------------------------------------*/ -DSC(default_dsc, - "Default CTK theme", - "default.prg", - default_init, - &default_icon); -/*-----------------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/apps/enabler-dsc.c b/backyard/platform/c64/apps/enabler-dsc.c deleted file mode 100644 index a8ed02ce6..000000000 --- a/backyard/platform/c64/apps/enabler-dsc.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: enabler-dsc.c,v 1.2 2007/09/06 01:36:11 matsutsuka Exp $ - * - */ - -#include "sys/dsc.h" - -/*-----------------------------------------------------------------------------------*/ -#if CTK_CONF_ICON_BITMAPS -static unsigned char enablericon_bitmap[3*3*8] = { - 0xff,0xff,0xff,0xfc,0xf0,0xf0,0xe0,0xe0, - 0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00, - 0xff,0xff,0xff,0x3f,0x0f,0x0f,0x07,0x07, - - 0xe0,0xe0,0xe0,0xe0,0xe0,0xe0,0xe0,0xe0, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07, - - 0xe0,0xe0,0xf0,0xf0,0xfc,0xff,0xff,0xff, - 0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff, - 0x07,0x07,0x0f,0x0f,0x3f,0xff,0xff,0xff -}; -#endif /* CTK_CONF_ICON_BITMAPS */ - -#if CTK_CONF_ICON_TEXTMAPS -static char enablericon_textmap[9] = { - '(', '=', ')', - '|', 'o', '|', - '(', '-', ')' -}; -#endif /* CTK_CONF_ICON_TEXTMAPS */ - -#if CTK_CONF_ICONS -static struct ctk_icon enabler_icon = - {CTK_ICON("Enabler", enablericon_bitmap, enablericon_textmap)}; -#endif /* CTK_CONF_ICONS */ -/*-----------------------------------------------------------------------------------*/ -DSC(enabler_dsc, - "Colorless grayish CTK theme", - "enabler.prg", - enabler_init, - &enabler_icon); -/*-----------------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/apps/http-user-agent-string.c b/backyard/platform/c64/apps/http-user-agent-string.c deleted file mode 100644 index 1e1f8fe84..000000000 --- a/backyard/platform/c64/apps/http-user-agent-string.c +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - * $Id: http-user-agent-string.c,v 1.1 2007/05/23 23:11:24 oliverschmidt Exp $ - */ -char http_user_agent_fields[100] = -/* "Connection: close\r\nUser-Agent: Contiki/1.1-rc0 (Commodore 64; http://dunkels.com/adam/contiki/)\r\n\r\n" */ -{0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x3a, 0x20, 0x63, 0x6c, 0x6f, 0x73, 0x65, 0xd, 0xa, 0x55, 0x73, 0x65, 0x72, 0x2d, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x3a, 0x20, 0x43, 0x6f, 0x6e, 0x74, 0x69, 0x6b, 0x69, 0x2f, 0x31, 0x2e, 0x31, 0x2d, 0x72, 0x63, 0x30, 0x20, 0x28, 0x43, 0x6f, 0x6d, 0x6d, 0x6f, 0x64, 0x6f, 0x72, 0x65, 0x20, 0x36, 0x34, 0x3b, 0x20, 0x68, 0x74, 0x74, 0x70, 0x3a, 0x2f, 0x2f, 0x64, 0x75, 0x6e, 0x6b, 0x65, 0x6c, 0x73, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x64, 0x61, 0x6d, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6b, 0x69, 0x2f, 0x29, 0xd, 0xa, 0xd, 0xa, }; diff --git a/backyard/platform/c64/apps/http-user-agent-string.h b/backyard/platform/c64/apps/http-user-agent-string.h deleted file mode 100644 index 484f82e8c..000000000 --- a/backyard/platform/c64/apps/http-user-agent-string.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - * $Id: http-user-agent-string.h,v 1.1 2007/05/23 23:11:24 oliverschmidt Exp $ - */ -extern char http_user_agent_fields[100]; diff --git a/backyard/platform/c64/apps/memstat-dsc.c b/backyard/platform/c64/apps/memstat-dsc.c deleted file mode 100644 index e588dbf83..000000000 --- a/backyard/platform/c64/apps/memstat-dsc.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: memstat-dsc.c,v 1.2 2007/09/06 01:36:11 matsutsuka Exp $ - * - */ - -#include "sys/dsc.h" - -/*-----------------------------------------------------------------------------------*/ -#if CTK_CONF_ICON_BITMAPS -static unsigned char memstaticon_bitmap[3*3*8] = { - 0x00, 0x7f, 0x43, 0x4c, 0x58, 0x53, 0x60, 0x6f, - 0x00, 0xff, 0x00, 0x7e, 0x00, 0xff, 0x00, 0xff, - 0x00, 0xfe, 0xc2, 0x32, 0x1a, 0xca, 0x06, 0xf6, - - 0x40, 0x5f, 0x40, 0x5f, 0x40, 0x5f, 0x40, 0x4f, - 0x00, 0xff, 0x00, 0xff, 0x00, 0xfc, 0x01, 0xf3, - 0x02, 0xfa, 0x02, 0x82, 0x3e, 0xfe, 0xfe, 0xfe, - - 0x60, 0x67, 0x50, 0x59, 0x4c, 0x43, 0x7f, 0x00, - 0x07, 0xe7, 0x0f, 0xef, 0x0f, 0x0f, 0xff, 0x00, - 0x8e, 0x06, 0x06, 0x06, 0x8e, 0xfe, 0xfe, 0x00 -}; -#endif /* CTK_CONF_ICON_BITMAPS */ - -#if CTK_CONF_ICON_TEXTMAPS -static char memstaticon_textmap[9] = { - '0', '0', '1', - '0', '1', '0', - '1', '0', '1' -}; -#endif /* CTK_CONF_ICON_TEXTMAPS */ - -#if CTK_CONF_ICONS -static struct ctk_icon memstat_icon = - {CTK_ICON("Memory stats", memstaticon_bitmap, memstaticon_textmap)}; -#endif /* CTK_CONF_ICONS */ -/*-----------------------------------------------------------------------------------*/ -DSC(memstat_dsc, - "Memory statistics", - "memstat.prg", - memstat_init, - &memstat_icon); -/*-----------------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/apps/mtest.c b/backyard/platform/c64/apps/mtest.c deleted file mode 100644 index 9908a5068..000000000 --- a/backyard/platform/c64/apps/mtest.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - * $Id: mtest.c,v 1.1 2007/05/23 23:11:24 oliverschmidt Exp $ - */ -#include "mt.h" - -MTP(t, p, "Test thread"); -/*--------------------------------------------------------------------------*/ -#pragma optimize(push, off) -static void -test(void *data) -{ - while(1) { - asm("inc $d020"); - } -} -#pragma optimize(pop) -/*--------------------------------------------------------------------------*/ -LOADER_INIT_FUNC(mtest_init, arg) -{ - arg_free(arg); - mtp_start(&t, test, NULL); -} -/*--------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/apps/plasma-dsc.c b/backyard/platform/c64/apps/plasma-dsc.c deleted file mode 100644 index ec27e2859..000000000 --- a/backyard/platform/c64/apps/plasma-dsc.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: plasma-dsc.c,v 1.2 2007/09/06 01:36:11 matsutsuka Exp $ - * - */ - -#include "sys/dsc.h" - -/*-----------------------------------------------------------------------------------*/ -#if CTK_CONF_ICON_BITMAPS -static unsigned char plasmaicon_bitmap[3*3*8] = { - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 -}; -#endif /* CTK_CONF_ICON_BITMAPS */ - -#if CTK_CONF_ICON_TEXTMAPS -static char plasmaicon_textmap[9] = { - '.', ' ', '.', - ' ', 'O', ' ', - '.', ' ', '.' -}; -#endif /* CTK_CONF_ICON_TEXTMAPS */ - -#if CTK_CONF_ICONS -static struct ctk_icon plasma_icon = - {CTK_ICON("Plasma", plasmaicon_bitmap, plasmaicon_textmap)}; -#endif /* CTK_CONF_ICONS */ -/*-----------------------------------------------------------------------------------*/ -DSC(plasma_dsc, - "Screensaver with a plasma", - "plasma.sav", - plasma_init, - &plasma_icon); -/*-----------------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/apps/plasma.c b/backyard/platform/c64/apps/plasma.c deleted file mode 100644 index befc58e6b..000000000 --- a/backyard/platform/c64/apps/plasma.c +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Copyright (c) 2002-2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: plasma.c,v 1.1 2007/05/23 23:11:24 oliverschmidt Exp $ - * - */ - -#include - -#include "ctk/ctk.h" -#include "ctk/ctk-draw.h" -#include "ctk/ctk-mouse.h" -#include "contiki.h" - -static unsigned char sinetab1[256] = { - 128, 131, 134, 137, 140, 143, 146, 149, - 152, 156, 159, 162, 165, 168, 171, 174, - 176, 179, 182, 185, 188, 191, 193, 196, - 199, 201, 204, 206, 209, 211, 213, 216, - 218, 220, 222, 224, 226, 228, 230, 232, - 234, 236, 237, 239, 240, 242, 243, 245, - 246, 247, 248, 249, 250, 251, 252, 252, - 253, 254, 254, 255, 255, 255, 255, 255, - 255, 255, 255, 255, 255, 255, 254, 254, - 253, 252, 252, 251, 250, 249, 248, 247, - 246, 245, 243, 242, 240, 239, 237, 236, - 234, 232, 230, 228, 226, 224, 222, 220, - 218, 216, 213, 211, 209, 206, 204, 201, - 199, 196, 193, 191, 188, 185, 182, 179, - 176, 174, 171, 168, 165, 162, 159, 156, - 152, 149, 146, 143, 140, 137, 134, 131, - 128, 124, 121, 118, 115, 112, 109, 106, - 103, 99, 96, 93, 90, 87, 84, 81, - 79, 76, 73, 70, 67, 64, 62, 59, - 56, 54, 51, 49, 46, 44, 42, 39, - 37, 35, 33, 31, 29, 27, 25, 23, - 21, 19, 18, 16, 15, 13, 12, 10, - 9, 8, 7, 6, 5, 4, 3, 3, - 2, 1, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 1, - 2, 3, 3, 4, 5, 6, 7, 8, - 9, 10, 12, 13, 15, 16, 18, 19, - 21, 23, 25, 27, 29, 31, 33, 35, - 37, 39, 42, 44, 46, 49, 51, 54, - 56, 59, 62, 64, 67, 70, 73, 76, - 78, 81, 84, 87, 90, 93, 96, 99, - 103, 106, 109, 112, 115, 118, 121, 124, -}; - -static unsigned char sinetab2[256]; -static unsigned char sinetab3[256]; - -static unsigned char colortab[256]; - -static unsigned char colors[16] = - { - 0x00, 0x06, 0x0b, 0x04, - 0x0a, 0x0f, 0x07, 0x01, - 0x07, 0x0f, 0x0a, 0x08, - 0x02, 0x09, 0x00, 0x00, - }; - -#define XSIZE 25 -#define YSIZE 25 - -#define XADD01 0xfe -#define YADD01 0x05 - -#define XADD1 0x04 -#define YADD1 0x02 -#define XADD2 0xfc -#define YADD2 0xf9 - -#define XADD 0x03 -#define YADD 0xfe - -#define MOVADD 0xfb - -static unsigned char xplasma[XSIZE], yplasma[YSIZE]; -static unsigned char xcnt, ycnt; -static unsigned char xcnt01, xcnt02, xcnt1, xcnt2; -static unsigned char ycnt01, ycnt02, ycnt1, ycnt2; - -static unsigned char xadd02 = 0x01; -static unsigned char yadd02 = 0xfb; - -static unsigned char movcnt; - -PROCESS(plasma_process, "Plasma screensaver"); -/*---------------------------------------------------------------------------*/ -static void -scrninit(void) -{ - unsigned char *ptr, *cptr; - static int i; - - /* Make sine tables */ - for(i = 0; i < 256; ++i) { - sinetab2[(unsigned char)i] = sinetab1[(unsigned char)i] / 2; - sinetab3[(unsigned char)i] = sinetab1[(unsigned char)i] / 4; - } - - /* Make color table */ - for(i = 0; i < 256; ++i) { - colortab[(unsigned char)i] = colors[(unsigned char)i / 16]; - } - - - /* Fill screen with inverted spaces. */ - cptr = COLOR_RAM; - for(ptr = (unsigned char *)0x0400; - ptr != (unsigned char *)0x07e8; - ++ptr) { - *ptr = 0xa0; - *cptr++ = 0x00; - } - - VIC.ctrl1 = 0x1b; /* $D011 */ - VIC.addr = 0x17; /* $D018 */ - VIC.ctrl2 = 0xc8; /* $D016 */ - VIC.bordercolor = 0x00; /* $D020 */ - VIC.bgcolor0 = 0x00; /* $D021 */ - CIA2.pra = 0x03; /* $DD00 */ - -} -/*---------------------------------------------------------------------------*/ -static void -pollhandler(void) -{ - static unsigned char i, x, y; - register unsigned char *cptr; - - if(ctk_mode_get() == CTK_MODE_SCREENSAVER) { - - - xcnt1 = xcnt01; - xcnt2 = xcnt02; - - for(i = 0; i < XSIZE; ++i) { - xplasma[i] = sinetab1[xcnt1] + sinetab2[xcnt2]; - xcnt1 += XADD1; - xcnt2 += XADD2; - } - - ycnt1 = ycnt01; - ycnt2 = ycnt02; - - for(i = 0; i < YSIZE; ++i) { - yplasma[i] = sinetab1[ycnt1] + sinetab3[ycnt2]; - ycnt1 += YADD1; - ycnt2 += YADD2; - } - - xcnt01 += XADD01; - xcnt02 += xadd02; - ycnt01 += YADD01; - ycnt02 += yadd02; - - - yadd02 = sinetab3[ycnt] / 4; - xadd02 = sinetab3[xcnt] / 4; - - ycnt += YADD; - xcnt += XADD; - - movcnt += MOVADD; - cptr = (unsigned char *)(COLOR_RAM + sinetab1[movcnt]/16); - for(y = 0; y < YSIZE; ++y) { - for(x = 0; x < XSIZE; ++x) { - *cptr = colortab[(xplasma[x] + yplasma[y]) & 0xff]; - ++cptr; - } - cptr += 40 - XSIZE; - } - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(plasma_process, ev, data) -{ - PROCESS_POLLHANDLER(pollhandler()); - - PROCESS_BEGIN(); - - ctk_mode_set(CTK_MODE_SCREENSAVER); - ctk_mouse_hide(); - - scrninit(); - - PROCESS_WAIT_EVENT_UNTIL(ev == ctk_signal_screensaver_stop || - ev == PROCESS_EVENT_EXIT); - ctk_draw_init(); - ctk_desktop_redraw(NULL); - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/apps/ravenpine-dsc.c b/backyard/platform/c64/apps/ravenpine-dsc.c deleted file mode 100644 index c6873648d..000000000 --- a/backyard/platform/c64/apps/ravenpine-dsc.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: ravenpine-dsc.c,v 1.2 2007/09/06 01:36:11 matsutsuka Exp $ - * - */ - -#include "sys/dsc.h" - -/*-----------------------------------------------------------------------------------*/ -#if CTK_CONF_ICON_BITMAPS -static unsigned char ravenpineicon_bitmap[3*3*8] = { - 0x00,0x3f,0x6a,0x40,0x60,0x40,0x60,0x40, - 0x00,0xff,0xaa,0x00,0x00,0x00,0x00,0x00, - 0x00,0xf0,0x20,0x00,0x00,0x00,0x00,0x00, - - 0x60,0x40,0x60,0x40,0x60,0x40,0x60,0x40, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, - - 0x60,0x40,0x40,0x40,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00, - 0x02,0x02,0x02,0x02,0x02,0x06,0xfc,0x00 -}; -#endif /* CTK_CONF_ICON_BITMAPS */ - -#if CTK_CONF_ICON_TEXTMAPS -static char ravenpineicon_textmap[9] = { - '(', '=', ')', - '|', 'o', '|', - '(', '-', ')' -}; -#endif /* CTK_CONF_ICON_TEXTMAPS */ - -#if CTK_CONF_ICONS -static struct ctk_icon ravenpine_icon = - {CTK_ICON("Ravenpine", ravenpineicon_bitmap, ravenpineicon_textmap)}; -#endif /* CTK_CONF_ICONS */ -/*-----------------------------------------------------------------------------------*/ -DSC(ravenpine_dsc, - "Terminal green CTK theme", - "ravenpine.prg", - ravenpine_init, - &ravenpine_icon); -/*-----------------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/apps/springlight-dsc.c b/backyard/platform/c64/apps/springlight-dsc.c deleted file mode 100644 index 175d3acbf..000000000 --- a/backyard/platform/c64/apps/springlight-dsc.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: springlight-dsc.c,v 1.2 2007/09/06 01:36:11 matsutsuka Exp $ - * - */ - -#include "sys/dsc.h" - -/*-----------------------------------------------------------------------------------*/ -#if CTK_CONF_ICON_BITMAPS -static unsigned char springlighticon_bitmap[3*3*8] = { - 0x00,0x3f,0x6a,0x40,0x60,0x40,0x60,0x40, - 0x00,0xff,0xaa,0x00,0x00,0x00,0x00,0x00, - 0x00,0xf0,0x20,0x00,0x00,0x00,0x00,0x00, - - 0x60,0x40,0x60,0x40,0x60,0x40,0x60,0x40, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02, - - 0x60,0x40,0x40,0x40,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00, - 0x02,0x02,0x02,0x02,0x02,0x06,0xfc,0x00 -}; -#endif /* CTK_CONF_ICON_BITMAPS */ - -#if CTK_CONF_ICON_TEXTMAPS -static char springlighticon_textmap[9] = { - '(', '=', ')', - '|', 'o', '|', - '(', '-', ')' -}; -#endif /* CTK_CONF_ICON_TEXTMAPS */ - -#if CTK_CONF_ICONS -static struct ctk_icon springlight_icon = - {CTK_ICON("Springlight", springlighticon_bitmap, springlighticon_textmap)}; -#endif /* CTK_CONF_ICONS */ -/*-----------------------------------------------------------------------------------*/ -DSC(springlight_dsc, - "Spring green CTK theme", - "springlight.prg", - springlight_init, - &springlight_icon); -/*-----------------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/apps/ssfire-dsc.c b/backyard/platform/c64/apps/ssfire-dsc.c deleted file mode 100644 index 0eb5f4de3..000000000 --- a/backyard/platform/c64/apps/ssfire-dsc.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: ssfire-dsc.c,v 1.2 2007/09/06 01:36:11 matsutsuka Exp $ - * - */ - -#include "sys/dsc.h" - -/*-----------------------------------------------------------------------------------*/ -#if CTK_CONF_ICON_BITMAPS -static unsigned char ssfireicon_bitmap[3*3*8] = { - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 -}; -#endif /* CTK_CONF_ICON_BITMAPS */ - -#if CTK_CONF_ICON_TEXTMAPS -static char ssfireicon_textmap[9] = { - '.', ' ', '.', - 'o', ' ', 'o', - 'O', ' ', 'O' -}; -#endif /* CTK_CONF_ICON_TEXTMAPS */ - -#if CTK_CONF_ICONS -static struct ctk_icon ssfire_icon = - {CTK_ICON("Fire", ssfireicon_bitmap, ssfireicon_textmap)}; -#endif /* CTK_CONF_ICONS */ -/*-----------------------------------------------------------------------------------*/ -DSC(ssfire_dsc, - "Screensaver with two fires", - "ssfire.sav", - ssfire_init, - &ssfire_icon); -/*-----------------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/apps/ssfire.c b/backyard/platform/c64/apps/ssfire.c deleted file mode 100644 index b77a4e716..000000000 --- a/backyard/platform/c64/apps/ssfire.c +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright (c) 2002-2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: ssfire.c,v 1.1 2007/05/23 23:11:24 oliverschmidt Exp $ - * - */ - -#include - -#include "ctk/ctk.h" -#include "ctk/ctk-draw.h" -#include "ctk/ctk-mouse.h" -#include "contiki.h" -#include "sys/loader.h" - -PROCESS(ssfire_process, "Fire screensaver"); - -static unsigned char flames[8*17]; - - -static const unsigned char flamecolors[16] = - {COLOR_BLACK, COLOR_BLACK, COLOR_BLACK, COLOR_RED, - COLOR_LIGHTRED, COLOR_YELLOW, COLOR_WHITE, COLOR_WHITE, - COLOR_WHITE, COLOR_WHITE, COLOR_WHITE, COLOR_WHITE, - COLOR_WHITE, COLOR_WHITE, COLOR_WHITE, COLOR_WHITE}; - - -/*---------------------------------------------------------------------------*/ -static void -fire_init(void) -{ - unsigned char *ptr, *cptr; - - /* Fill screen with inverted spaces. */ - cptr = COLOR_RAM; - for(ptr = (unsigned char *)0x0400; - ptr != (unsigned char *)0x07e8; - ++ptr) { - *ptr = 0xa0; - *cptr++ = 0x00; - } - - SID.v3.freq = 0xffff; - SID.v3.ctrl = 0x80; - SID.amp = 0; - - VIC.ctrl1 = 0x1b; /* $D011 */ - VIC.addr = 0x17; /* $D018 */ - VIC.ctrl2 = 0xc8; /* $D016 */ - VIC.bordercolor = 0x00; /* $D020 */ - VIC.bgcolor0 = 0x00; /* $D021 */ - CIA2.pra = 0x03; /* $DD00 */ -} -/*---------------------------------------------------------------------------*/ -#pragma optimize(push, off) -static void -fire_burn(void) -{ - /* Calculate new flames. */ - asm("ldy #$00"); -loop1: - asm("lda %v+7,y", flames); - asm("clc"); - asm("adc %v+8,y", flames); - asm("adc %v+9,y", flames); - asm("adc %v+16,y", flames); - asm("lsr"); - asm("lsr"); - asm("sta %v,y", flames); - asm("iny"); - asm("cpy #(8*15)"); - asm("bne %g", loop1); - - /* Fill last line with pseudo-random data from noise generator on - voice 3. */ - asm("ldy #$05"); -loop2: - asm("ldx #$20"); -delay: - asm("dex"); - asm("bne %g", delay); - asm("lda $D41B"); - asm("and #$0F"); - asm("sta %v+8*15+1,y", flames); - asm("dey"); - asm("bpl %g", loop2); -} -#pragma optimize(pop) -/*---------------------------------------------------------------------------*/ -static unsigned char *flameptr, *colorptr1, *colorptr2; -static unsigned char x, y; - -static void -pollhandler(void) -{ - - if(ctk_mode_get() == CTK_MODE_SCREENSAVER) { - - fire_burn(); - - /* Display flames on screen. */ - flameptr = flames; - colorptr1 = COLOR_RAM + 40*10; - colorptr2 = colorptr1 + 0x20; - for(y = 0; y < 15; ++y) { - for(x = 0; x < 8; ++x) { - colorptr1[x] = colorptr2[x] = flamecolors[flameptr[x]]; - } - colorptr1 += 0x28; - colorptr2 += 0x28; - flameptr += 8; - } - } -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(ssfire_process, ev, data) -{ - PROCESS_POLLHANDLER(pollhandler()); - - PROCESS_BEGIN(); - - ctk_mode_set(CTK_MODE_SCREENSAVER); - ctk_mouse_hide(); - fire_init(); - - - PROCESS_WAIT_EVENT_UNTIL(ev == ctk_signal_screensaver_stop || - ev == PROCESS_EVENT_EXIT); - - ctk_draw_init(); - ctk_desktop_redraw(NULL); - - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/apps/themeloader.c b/backyard/platform/c64/apps/themeloader.c deleted file mode 100644 index 68d60ea42..000000000 --- a/backyard/platform/c64/apps/themeloader.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: themeloader.c,v 1.1 2007/05/23 23:11:25 oliverschmidt Exp $ - * - */ - -#include - -#include "loader.h" -#include "ctk-draw.h" -#include "ctk-hires-theme.h" - -/*-----------------------------------------------------------------------------------*/ -LOADER_INIT_FUNC(themeloader_init, arg) -{ - arg_free(arg); - - memcpy(ctk_hires_theme_ptr, &ctk_hires_theme, - sizeof(struct ctk_hires_theme)); - ctk_draw_init(); - LOADER_UNLOAD(); -} -/*-----------------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/apps/vnc-draw-asm.S b/backyard/platform/c64/apps/vnc-draw-asm.S deleted file mode 100644 index 7522a4335..000000000 --- a/backyard/platform/c64/apps/vnc-draw-asm.S +++ /dev/null @@ -1,16 +0,0 @@ - -;--------------------------------------------------------------------- - .importzp ptr1, ptr2, ptr3, ptr4, sreg - .importzp sp - - .import _vnc_draw_datalen - .import _vnc_draw_dataptr - .import _vnc_draw_bitmapptr - .import _vnc_draw_x - .import _vnc_draw_y -;--------------------------------------------------------------------- -.bss -;--------------------------------------------------------------------- -.data -;--------------------------------------------------------------------- -.code diff --git a/backyard/platform/c64/apps/vnc-draw-asm.h b/backyard/platform/c64/apps/vnc-draw-asm.h deleted file mode 100644 index 4c4d5a28b..000000000 --- a/backyard/platform/c64/apps/vnc-draw-asm.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki VNC client - * - * $Id: vnc-draw-asm.h,v 1.1 2007/05/23 23:11:26 oliverschmidt Exp $ - * - */ -#ifndef __VNC_DRAW_ASM_H__ -#define __VNC_DRAW_ASM_H__ - -#include "vnc-draw.h" - -void vnc_draw_asm_pixelline(void); - -#endif /* __VNC_DRAW_ASM_H__ */ diff --git a/backyard/platform/c64/apps/vnc-draw.c b/backyard/platform/c64/apps/vnc-draw.c deleted file mode 100644 index a7af00730..000000000 --- a/backyard/platform/c64/apps/vnc-draw.c +++ /dev/null @@ -1,689 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki VNC client - * - * $Id: vnc-draw.c,v 1.1 2007/05/23 23:11:26 oliverschmidt Exp $ - * - */ - - - -#include "vnc-draw.h" -#include "vnc-draw-asm.h" - -#include "vnc-conf.h" - - -static unsigned char conv[256]; - -static unsigned char oratab[8] = - { 0x80, 0x40, 0x20, 0x10, - 0x08, 0x04, 0x02, 0x01 }; -static unsigned char andtab[8] = - { 0x7f, 0xbf, 0xdf, 0xef, - 0xf7, 0xfb, 0xfd, 0xfe }; - -static u8_t *bitmapptrtab[VNC_CONF_VIEWPORT_HEIGHT]; - -static unsigned short viewport_x, - viewport_y, viewport_w, viewport_h; - -u8_t vnc_draw_bitmap[(VNC_CONF_VIEWPORT_WIDTH / 8) * - VNC_CONF_VIEWPORT_HEIGHT]; - - - -u16_t vnc_draw_x; -u16_t vnc_draw_y; -u8_t *vnc_draw_dataptr; -u8_t *vnc_draw_bitmapptr; -u16_t vnc_draw_datalen; - -/*-----------------------------------------------------------------------------------*/ -void -vnc_draw_pixel(u16_t x, u8_t y, u8_t c) -{ - u8_t o, a; - - vnc_draw_bitmapptr = bitmapptrtab[y] + (x & 0x1f8); - - if(c) { - o = oratab[x & 7]; - *vnc_draw_bitmapptr = *vnc_draw_bitmapptr | o; - } else { - a = andtab[x & 7]; - *vnc_draw_bitmapptr = *vnc_draw_bitmapptr & a; - } -} -/*-----------------------------------------------------------------------------------*/ -void -vnc_draw_pixelline(u16_t x, u16_t y, u8_t *data, u16_t datalen) -{ - u8_t o, a; - register u8_t *bitmapptr; - - vnc_draw_x = x - viewport_x; - vnc_draw_y = y - viewport_y; - - /* if(vnc_draw_y & 1) { - return; - } else { - vnc_draw_y /= 2; - }*/ - - - - if(vnc_draw_y >= VNC_CONF_VIEWPORT_HEIGHT || - vnc_draw_x >= VNC_CONF_VIEWPORT_WIDTH) { - return; - } - - vnc_draw_datalen = datalen; - - if(vnc_draw_datalen + vnc_draw_x >= VNC_CONF_VIEWPORT_WIDTH) { - vnc_draw_datalen = VNC_CONF_VIEWPORT_WIDTH - vnc_draw_x; - if(vnc_draw_datalen == 0) { - return; - } - } - - vnc_draw_dataptr = data; - - /* vnc_draw_bitmapptr = bitmaptab[vnc_draw_y] + - (vnc_draw_x & 0x1f8);*/ - - for(; vnc_draw_datalen > 0; --vnc_draw_datalen) { - /* vnc_draw_pixel(vnc_draw_x, vnc_draw_y, - conv[*vnc_draw_dataptr]);*/ - - bitmapptr = bitmapptrtab[vnc_draw_y] + (vnc_draw_x & 0x1f8); - - if(conv[*vnc_draw_dataptr]) { - o = oratab[vnc_draw_x & 7]; - *bitmapptr = *bitmapptr | o; - } else { - a = andtab[vnc_draw_x & 7]; - *bitmapptr = *bitmapptr & a; - } - ++vnc_draw_dataptr; - ++vnc_draw_x; - } -} -/*-----------------------------------------------------------------------------------*/ -void -vnc_draw_init(void) -{ - unsigned int tmp; - unsigned int i; - unsigned short ptr; - - - /* Create color conversion table. */ - for(i = 0; i < 256; ++i) { - if(((i & 0xc0) > 0xc0) || - ((i & 0x38) > 0x18) || - ((i & 0x07) > 0x03)) { - conv[i] = 0; - } else { - conv[i] = 1; - } - } - - memset(vnc_draw_bitmap, 0, sizeof(vnc_draw_bitmap)); - - for(i = 0; i < VNC_CONF_VIEWPORT_HEIGHT; ++i) { - bitmapptrtab[i] = (u8_t *)((u16_t)vnc_draw_bitmap + - ((i & 0xfff8)/8) * VNC_CONF_VIEWPORT_WIDTH + - (i & 7)); - } - - viewport_x = 0; - viewport_y = 0; - - viewport_w = VNC_CONF_VIEWPORT_WIDTH; - viewport_h = VNC_CONF_VIEWPORT_HEIGHT; - - return; -} -/*-----------------------------------------------------------------------------------*/ -u16_t -vnc_draw_viewport_x(void) -{ - return viewport_x; -} -/*-----------------------------------------------------------------------------------*/ -u16_t -vnc_draw_viewport_y(void) -{ - return viewport_y; -} -/*-----------------------------------------------------------------------------------*/ -u16_t -vnc_draw_viewport_w(void) -{ - return viewport_w; -} -/*-----------------------------------------------------------------------------------*/ -u16_t -vnc_draw_viewport_h(void) -{ - return viewport_h; -} -/*-----------------------------------------------------------------------------------*/ -#if 0 -signed short -c64_mouse_x(void) -{ - return 0; -} -/*-----------------------------------------------------------------------------------*/ -signed short -c64_mouse_y(void) -{ - return 0; -} -/*-----------------------------------------------------------------------------------*/ -u8_t -c64_mouse_buttons(void) -{ - return firebutton; -} -/*-----------------------------------------------------------------------------------*/ -void -c64_set_mouse_x(unsigned short x) -{ - joyx = x; -} -/*-----------------------------------------------------------------------------------*/ -void -c64_set_mouse_y(unsigned short y) -{ - joyy = y; -} -/*-----------------------------------------------------------------------------------*/ -void -c64_set_viewport_x(unsigned short x) -{ - viewport_x = x; -} -/*-----------------------------------------------------------------------------------*/ -void -c64_set_viewport_y(unsigned short y) -{ - viewport_y = y; -} -/*-----------------------------------------------------------------------------------*/ - -#endif /* 0 */ -#if 0 -#pragma optimize(push, off) -void -c64_scroll_up(unsigned char c) -{ - asm("lda $f7"); - asm("pha"); - asm("lda $f8"); - asm("pha"); - asm("lda $f9"); - asm("pha"); - asm("lda $fa"); - asm("pha"); - asm("lda $fb"); - asm("pha"); - asm("lda $fc"); - asm("pha"); - asm("lda $fd"); - asm("pha"); - asm("lda $fe"); - asm("pha"); - - asm("lda $01"); - asm("pha"); - asm("lda #$35"); - asm("sta $01"); - - asm("lda #$80"); - asm("sta $f7"); - asm("lda #$a2"); - asm("sta $f8"); - asm("lda #$00"); - asm("sta $f9"); - asm("lda #$a0"); - asm("sta $fa"); - - asm("lda #$80"); - asm("sta $fb"); - asm("lda #$e2"); - asm("sta $fc"); - asm("lda #$00"); - asm("sta $fd"); - asm("lda #$e0"); - asm("sta $fe"); - - asm("ldy #0"); - asm("loop:"); - asm("lda ($f7),y"); - asm("sta ($f9),y"); - asm("lda ($fb),y"); - asm("sta ($fd),y"); - asm("iny"); - asm("bne loop"); - - asm("inc $f8"); - asm("inc $fa"); - asm("inc $fc"); - asm("inc $fe"); - - asm("lda $fc"); - asm("cmp #$00"); - asm("bne loop"); - - asm("ldy #0"); - asm("lda #0"); - asm("sta $fe00,y"); - asm("sta $be00,y"); - asm("sta $fcc0,y"); - asm("sta $bcc0,y"); - asm("iny"); - asm("bne *-13"); - asm("sta $ff00,y"); - asm("sta $bf00,y"); - asm("sta $fdc0,y"); - asm("sta $bdc0,y"); - asm("iny"); - asm("cpy #$40"); - asm("bne *-15"); - - - asm("pla"); - asm("sta $01"); - asm("pla"); - asm("sta $fe"); - asm("pla"); - asm("sta $fd"); - asm("pla"); - asm("sta $fc"); - asm("pla"); - asm("sta $fb"); - asm("pla"); - asm("sta $fa"); - asm("pla"); - asm("sta $f9"); - asm("pla"); - asm("sta $f8"); - asm("pla"); - asm("sta $f7"); -} -#pragma optimize(pop) -/*-----------------------------------------------------------------------------------*/ -#pragma optimize(push, off) -void -c64_scroll_down(unsigned char c) -{ - asm("lda $f7"); - asm("pha"); - asm("lda $f8"); - asm("pha"); - asm("lda $f9"); - asm("pha"); - asm("lda $fa"); - asm("pha"); - asm("lda $fb"); - asm("pha"); - asm("lda $fc"); - asm("pha"); - asm("lda $fd"); - asm("pha"); - asm("lda $fe"); - asm("pha"); - - - asm("lda $01"); - asm("pha"); - asm("lda #$35"); - asm("sta $01"); - - asm("lda #$c0"); - asm("sta $fb"); - asm("lda #$fb"); - asm("sta $fc"); - asm("lda #$40"); - asm("sta $fd"); - asm("lda #$fe"); - asm("sta $fe"); - - asm("lda #$c0"); - asm("sta $f7"); - asm("lda #$bb"); - asm("sta $f8"); - asm("lda #$40"); - asm("sta $f9"); - asm("lda #$be"); - asm("sta $fa"); - - - asm("ldy #0"); - asm("loop:"); - asm("lda ($fb),y"); - asm("sta ($fd),y"); - asm("lda ($f7),y"); - asm("sta ($f9),y"); - asm("iny"); - asm("bne loop"); - - asm("dec $f8"); - asm("dec $fa"); - asm("dec $fc"); - asm("dec $fe"); - - - asm("lda $fe"); - asm("cmp #$df"); - asm("bne loop"); - - asm("ldy #0"); - asm("lda #0"); - asm("sta $e000,y"); - asm("sta $a000,y"); - asm("sta $e140,y"); - asm("sta $a140,y"); - asm("iny"); - asm("bne *-13"); - asm("sta $e100,y"); - asm("sta $a100,y"); - asm("sta $e240,y"); - asm("sta $a240,y"); - asm("iny"); - asm("cpy #$40"); - asm("bne *-15"); - - asm("pla"); - asm("sta $01"); - asm("pla"); - asm("sta $fe"); - asm("pla"); - asm("sta $fd"); - asm("pla"); - asm("sta $fc"); - asm("pla"); - asm("sta $fb"); - asm("pla"); - asm("sta $fa"); - asm("pla"); - asm("sta $f9"); - asm("pla"); - asm("sta $f8"); - asm("pla"); - asm("sta $f7"); -} -#pragma optimize(pop) -/*-----------------------------------------------------------------------------------*/ -#pragma optimize(push, off) -void -c64_scroll_right(unsigned char c) -{ - asm("lda $f7"); - asm("pha"); - asm("lda $f8"); - asm("pha"); - asm("lda $f9"); - asm("pha"); - asm("lda $fa"); - asm("pha"); - asm("lda $fb"); - asm("pha"); - asm("lda $fc"); - asm("pha"); - asm("lda $fd"); - asm("pha"); - asm("lda $fe"); - asm("pha"); - - - asm("lda $01"); - asm("pha"); - asm("lda #$35"); - asm("sta $01"); - - asm("lda #$00"); - asm("sta $f7"); - asm("lda #$a0"); - asm("sta $f8"); - asm("lda #$10"); - asm("sta $f9"); - asm("lda #$a0"); - asm("sta $fa"); - - asm("lda #$00"); - asm("sta $fb"); - asm("lda #$e0"); - asm("sta $fc"); - asm("lda #$10"); - asm("sta $fd"); - asm("lda #$e0"); - asm("sta $fe"); - - asm("ldx #0"); - - asm("loop3:"); - - asm("ldy #$ff"); - asm("loop:"); - asm("lda ($f7),y"); - asm("sta ($f9),y"); - asm("lda ($fb),y"); - asm("sta ($fd),y"); - asm("dey"); - asm("cpy #$ff"); - asm("bne loop"); - - asm("inc $f8"); - asm("inc $fa"); - asm("inc $fc"); - asm("inc $fe"); - - asm("ldy #$30"); - asm("loop2:"); - asm("lda ($f7),y"); - asm("sta ($f9),y"); - asm("lda ($fb),y"); - asm("sta ($fd),y"); - asm("dey"); - asm("cpy #$ff"); - asm("bne loop2"); - - asm("lda $f7"); - asm("clc"); - asm("adc #$40"); - asm("sta $f7"); - asm("sta $fb"); - asm("bcc :+"); - asm("inc $f8"); - asm("inc $fc"); - asm(":"); - - asm("lda $f9"); - asm("clc"); - asm("adc #$40"); - asm("sta $f9"); - asm("sta $fd"); - asm("bcc :+"); - asm("inc $fa"); - asm("inc $fe"); - asm(":"); - - - - asm("inx"); - asm("cpx #24"); - asm("bne loop3"); - - asm("pla"); - asm("sta $01"); - asm("pla"); - asm("sta $fe"); - asm("pla"); - asm("sta $fd"); - asm("pla"); - asm("sta $fc"); - asm("pla"); - asm("sta $fb"); - asm("pla"); - asm("sta $fa"); - asm("pla"); - asm("sta $f9"); - asm("pla"); - asm("sta $f8"); - asm("pla"); - asm("sta $f7"); -} -#pragma optimize(pop) -/*-----------------------------------------------------------------------------------*/ -#pragma optimize(push, off) -void -c64_scroll_left(unsigned char c) -{ - asm("lda $f7"); - asm("pha"); - asm("lda $f8"); - asm("pha"); - asm("lda $f9"); - asm("pha"); - asm("lda $fa"); - asm("pha"); - asm("lda $fb"); - asm("pha"); - asm("lda $fc"); - asm("pha"); - asm("lda $fd"); - asm("pha"); - asm("lda $fe"); - asm("pha"); - - - asm("lda $01"); - asm("pha"); - asm("lda #$35"); - asm("sta $01"); - - asm("lda #$10"); - asm("sta $f7"); - asm("lda #$a0"); - asm("sta $f8"); - asm("lda #$00"); - asm("sta $f9"); - asm("lda #$a0"); - asm("sta $fa"); - - asm("lda #$10"); - asm("sta $fb"); - asm("lda #$e0"); - asm("sta $fc"); - asm("lda #$00"); - asm("sta $fd"); - asm("lda #$e0"); - asm("sta $fe"); - - asm("ldx #0"); - asm("loop3:"); - asm("ldy #0"); - asm("loop:"); - asm("lda ($f7),y"); - asm("sta ($f9),y"); - asm("lda ($fb),y"); - asm("sta ($fd),y"); - asm("iny"); - asm("bne loop"); - - asm("inc $f8"); - asm("inc $fa"); - asm("inc $fc"); - asm("inc $fe"); - - asm("ldy #0"); - asm("loop2:"); - asm("lda ($f7),y"); - asm("sta ($f9),y"); - asm("lda ($fb),y"); - asm("sta ($fd),y"); - asm("iny"); - asm("cpy #$30"); - asm("bne loop2"); - - asm("lda $f7"); - asm("clc"); - asm("adc #$40"); - asm("sta $f7"); - asm("sta $fb"); - asm("bcc :+"); - asm("inc $f8"); - asm("inc $fc"); - asm(":"); - - asm("lda $f9"); - asm("clc"); - asm("adc #$40"); - asm("sta $f9"); - asm("sta $fd"); - asm("bcc :+"); - asm("inc $fa"); - asm("inc $fe"); - asm(":"); - - - asm("inx"); - asm("cpx #24"); - asm("bne loop3"); - - asm("pla"); - asm("sta $01"); - asm("pla"); - asm("sta $fe"); - asm("pla"); - asm("sta $fd"); - asm("pla"); - asm("sta $fc"); - asm("pla"); - asm("sta $fb"); - asm("pla"); - asm("sta $fa"); - asm("pla"); - asm("sta $f9"); - asm("pla"); - asm("sta $f8"); - asm("pla"); - asm("sta $f7"); -} -#pragma optimize(pop) -/*-----------------------------------------------------------------------------------*/ - - - -#endif /* 0 */ diff --git a/backyard/platform/c64/apps/warmboot.c b/backyard/platform/c64/apps/warmboot.c deleted file mode 100644 index 10845b087..000000000 --- a/backyard/platform/c64/apps/warmboot.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - * $Id: warmboot.c,v 1.1 2007/05/23 23:11:26 oliverschmidt Exp $ - */ - -#include "contiki.h" - -#pragma optimize(push, off) - -LOADER_INIT_FUNC(warmboot_init, arg) -{ - - arg_free(arg); - - asm("jsr $fda3"); - asm("jsr $fd15"); - asm("jsr $ff5b"); - asm("ldx #$f8"); - asm("txs"); - asm("cli"); - asm("jmp 2061"); - -} -#pragma optimize(push, on) diff --git a/backyard/platform/c64/apps/welcome.c b/backyard/platform/c64/apps/welcome.c deleted file mode 100644 index 5c097f4dd..000000000 --- a/backyard/platform/c64/apps/welcome.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2002, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: welcome.c,v 1.1 2007/05/23 23:11:26 oliverschmidt Exp $ - * - */ - -#include "contiki.h" -#include "ctk/ctk.h" -#include - - -static struct ctk_window welcomedialog; -static struct ctk_label welcomelabel1 = - {CTK_LABEL(1, 1, 30, 1, "Welcome to " CONTIKI_VERSION_STRING "!")}; -static struct ctk_label welcomelabel2 = - {CTK_LABEL(2, 4, 28, 1, "F1 - open menus")}; -static struct ctk_label welcomelabel3 = - {CTK_LABEL(2, 6, 28, 1, "F3 - cycle windows")}; -static struct ctk_label welcomelabel4 = - {CTK_LABEL(2, 8, 28, 1, "F5 - select up")}; -static struct ctk_label welcomelabel5 = - {CTK_LABEL(2, 10, 28, 1, "F7 - select down")}; -static struct ctk_label welcomelabel6 = - {CTK_LABEL(2, 12, 28, 1, "Return - activate selected")}; -static struct ctk_label welcomelabel7 = - {CTK_LABEL(3, 15, 25, 1, "Press any key to continue")}; - - -PROCESS(welcome_process, "Welcome"); -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(welcome_process, ev, data) -{ - unsigned char width; - - PROCESS_BEGIN(); - - width = ctk_desktop_width(NULL); - - if(width > 34) { - ctk_dialog_new(&welcomedialog, 32, 17); - } else { - ctk_dialog_new(&welcomedialog, width - 2, 17); - } - CTK_WIDGET_ADD(&welcomedialog, &welcomelabel1); - CTK_WIDGET_ADD(&welcomedialog, &welcomelabel2); - CTK_WIDGET_ADD(&welcomedialog, &welcomelabel3); - CTK_WIDGET_ADD(&welcomedialog, &welcomelabel4); - CTK_WIDGET_ADD(&welcomedialog, &welcomelabel5); - CTK_WIDGET_ADD(&welcomedialog, &welcomelabel6); - CTK_WIDGET_ADD(&welcomedialog, &welcomelabel7); - - ctk_dialog_open(&welcomedialog); - - PROCESS_WAIT_EVENT_UNTIL(ev == PROCESS_EVENT_EXIT || - ev == ctk_signal_keypress); - ctk_dialog_close(); - PROCESS_END(); -} -/*---------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/apps/wget-dsc.c b/backyard/platform/c64/apps/wget-dsc.c deleted file mode 100644 index 31af4d0d2..000000000 --- a/backyard/platform/c64/apps/wget-dsc.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: wget-dsc.c,v 1.2 2007/09/06 01:36:11 matsutsuka Exp $ - * - */ - -#include "sys/dsc.h" - -/*-----------------------------------------------------------------------------------*/ -#if CTK_CONF_ICON_BITMAPS -static unsigned char wgeticon_bitmap[3*3*8] = { - 0x00, 0x7e, 0x40, 0x73, 0x46, 0x4c, 0x18, 0x13, - 0x00, 0x00, 0xff, 0x81, 0x34, 0xc9, 0x00, 0xb6, - 0x00, 0x7e, 0x02, 0xce, 0x72, 0x32, 0x18, 0x48, - - 0x30, 0x27, 0x24, 0x20, 0x37, 0x24, 0x20, 0x33, - 0x00, 0x7b, 0x42, 0x00, 0x7b, 0x42, 0x00, 0x3b, - 0x0c, 0x24, 0x24, 0x04, 0xa4, 0x24, 0x04, 0x4c, - - 0x12, 0x19, 0x4c, 0x46, 0x63, 0x40, 0x7c, 0x00, - 0x22, 0x91, 0x00, 0xc4, 0x81, 0xff, 0x00, 0x00, - 0x08, 0x18, 0x32, 0x62, 0xc6, 0x02, 0x3e, 0x00 -}; -#endif /* CTK_CONF_ICON_BITMAPS */ - -#if CTK_CONF_ICON_TEXTMAPS -static char wgeticon_textmap[9] = { - 'w', 'e', 'b', - 'p', 'r', 'g', - 'd', '6', '4' -}; -#endif /* CTK_CONF_ICON_TEXTMAPS */ - -#if CTK_CONF_ICONS -static struct ctk_icon wget_icon = - {CTK_ICON("Web downloader", wgeticon_bitmap, wgeticon_textmap)}; -#endif /* CTK_CONF_ICONS */ -/*-----------------------------------------------------------------------------------*/ -DSC(wget_dsc, - "Downloads files or D64 disks from the web", - "wget.prg", - wget_init, - &wget_icon); -/*-----------------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/apps/wget-dsc.h b/backyard/platform/c64/apps/wget-dsc.h deleted file mode 100644 index 23f1a2c3d..000000000 --- a/backyard/platform/c64/apps/wget-dsc.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: wget-dsc.h,v 1.1 2007/05/23 23:11:26 oliverschmidt Exp $ - * - */ -#ifndef __WGET_DSC_H__ -#define __WGET_DSC_H__ - -#include "sys/dsc.h" - -DSC_HEADER(wget_dsc); - -#endif /* __WGET_DSC_H__ */ diff --git a/backyard/platform/c64/apps/wget.c b/backyard/platform/c64/apps/wget.c deleted file mode 100644 index c915b7873..000000000 --- a/backyard/platform/c64/apps/wget.c +++ /dev/null @@ -1,528 +0,0 @@ -/* - * Copyright (c) 2002, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: wget.c,v 1.1 2007/05/23 23:11:27 oliverschmidt Exp $ - * - */ - - -#include "ctk/ctk.h" -#include "contiki-net.h" -#include "webclient.h" -#include "lib/petsciiconv.h" - -#include "program-handler.h" - -#include -#include -#include -#include -#include - -#include "c64-dio.h" - -#define USE_KERNAL 0 - -static struct ctk_window window; - -static struct ctk_label urllabel = - {CTK_LABEL(0, 1, 4, 1, "URL:")}; -static char url[80]; -static char urledit[80]; -struct ctk_textentry urltextentry = - {CTK_TEXTENTRY(5, 1, 29, 1, urledit, 78)}; - - -static struct ctk_label savefilenamelabel = - {CTK_LABEL(0, 3, 14, 1, "Save filename:")}; -static char savefilename[40]; -static struct ctk_textentry savefilenametextentry = - {CTK_TEXTENTRY(15, 3, 19, 1, savefilename, 38)}; - -static struct ctk_button filebutton = - {CTK_BUTTON(0, 5, 13, "Download file")}; - -static struct ctk_button d64button = - {CTK_BUTTON(17, 5, 18, "Download D64 disk")}; - -static struct ctk_label statustext = - {CTK_LABEL(0, 7, 36, 1, "")}; -static char statusmsg[40]; - -static struct ctk_window d64dialog; -static struct ctk_label overwritelabel = - {CTK_LABEL(0, 1, 36, 1, "This will overwrite the entire disk!")}; -static struct ctk_label makesurelabel1 = - {CTK_LABEL(7, 3, 22, 1, "Make sure you have the")}; -static struct ctk_label makesurelabel2 = - {CTK_LABEL(6, 4, 24, 1, "right disk in the drive!")}; -static struct ctk_button overwritebutton = - {CTK_BUTTON(2, 6, 14, "Overwrite disk")}; -static struct ctk_button cancelbutton = - {CTK_BUTTON(26, 6, 6, "Cancel")}; - -PROCESS(wget_process, "Web downloader"); -/* State */ - -#define DLOAD_NONE 0 -#define DLOAD_FILE 1 -#define DLOAD_D64 2 -static u8_t dload_state; -static unsigned long dload_bytes; - - - -struct drv_state { - u8_t track; - u8_t sect; -}; - -static struct drv_state ds; - -static char buffer[256]; -static u16_t bufferptr; - -/*-----------------------------------------------------------------------------------*/ -static void -show_statustext(char *text) -{ - ctk_label_set_text(&statustext, text); - CTK_WIDGET_REDRAW(&statustext); -} -/*-----------------------------------------------------------------------------------*/ -/* open_url(): - * - * Called when the URL present in the global "url" variable should be - * opened. It will call the hostname resolver as well as the HTTP - * client requester. - */ -static void -start_get(void) -{ - u16_t addr[2]; - unsigned char i; - static char host[32]; - char *file; - register char *urlptr; - unsigned short port; - - /* Trim off any spaces in the end of the url. */ - urlptr = url + strlen(url) - 1; - while(*urlptr == ' ' && urlptr > url) { - *urlptr = 0; - --urlptr; - } - - /* Don't even try to go further if the URL is empty. */ - if(urlptr == url) { - return; - } - - /* See if the URL starts with http://, otherwise prepend it. */ - if(strncmp(url, http_http, 7) != 0) { - while(urlptr >= url) { - *(urlptr + 7) = *urlptr; - --urlptr; - } - strncpy(url, http_http, 7); - } - - /* Find host part of the URL. */ - urlptr = &url[7]; - for(i = 0; i < sizeof(host); ++i) { - if(*urlptr == 0 || - *urlptr == '/' || - *urlptr == ' ' || - *urlptr == ':') { - host[i] = 0; - break; - } - host[i] = *urlptr; - ++urlptr; - } - - /* XXX: Here we should find the port part of the URL, but this isn't - currently done because of laziness from the programmer's side - :-) */ - - /* Find file part of the URL. */ - while(*urlptr != '/' && *urlptr != 0) { - ++urlptr; - } - if(*urlptr == '/') { - file = urlptr; - } else { - file = "/"; - } - - - /* First check if the host is an IP address. */ - if(uiplib_ipaddrconv(host, (unsigned char *)addr) == 0) { - - /* Try to lookup the hostname. If it fails, we initiate a hostname - lookup and print out an informative message on the - statusbar. */ - if(resolv_lookup(host) == NULL) { - resolv_query(host); - show_statustext("Resolving host..."); - return; - } - } - - /* The hostname we present in the hostname table, so we send out the - initial GET request. */ - if(webclient_get(host, 80, file) == 0) { - show_statustext("Out of memory error."); - } else { - show_statustext("Connecting..."); - } -} -/*-----------------------------------------------------------------------------------*/ -PROCESS_THREAD(wget_process, ev, data) -{ - int ret; - static unsigned char i; - - - - - PROCESS_BEGIN(); - - if(data != NULL) { - strncpy(url, data, sizeof(url)); - strncpy(urledit, data, sizeof(urledit)); - petsciiconv_topetscii(urledit, sizeof(urledit)); - arg_free(data); - } else { -#ifdef WGET_CONF_URL - strncpy(url, WGET_CONF_URL, sizeof(url)); - strncpy(urledit, WGET_CONF_URL, sizeof(urledit)); -#endif /* WGET_CONF_URL */ - } - - - /* Create the main window. */ - ctk_window_new(&window, 36, 8, "Web downloader"); - - - CTK_WIDGET_ADD(&window, &urllabel); - CTK_WIDGET_ADD(&window, &urltextentry); - - CTK_WIDGET_ADD(&window, &savefilenamelabel); - CTK_WIDGET_ADD(&window, &savefilenametextentry); - - /* CTK_WIDGET_ADD(&window, &filebutton);*/ - - CTK_WIDGET_ADD(&window, &d64button); - - CTK_WIDGET_ADD(&window, &statustext); - - dload_state = DLOAD_NONE; - - memset(savefilename, 0, sizeof(savefilename)); - memset(url, 0, sizeof(url)); - - ctk_dialog_new(&d64dialog, 36, 8); - CTK_WIDGET_ADD(&d64dialog, &overwritelabel); - CTK_WIDGET_ADD(&d64dialog, &makesurelabel1); - CTK_WIDGET_ADD(&d64dialog, &makesurelabel2); - CTK_WIDGET_ADD(&d64dialog, &overwritebutton); - CTK_WIDGET_ADD(&d64dialog, &cancelbutton); - - - ctk_window_open(&window); - - while(1) { - - PROCESS_WAIT_EVENT(); - - if(ev == tcpip_event) { - webclient_appcall(data); - } else if(ev == ctk_signal_button_activate) { - if(data == (void *)&filebutton) { - /* ret = cbm_open(2, 8, 2, savefilename); - if(ret == -1) {*/ - sprintf(statusmsg, "Open error with '%s'", savefilename); - show_statustext(statusmsg); - /* } else { - strncpy(url, urledit, sizeof(url)); - petsciiconv_toascii(url, sizeof(url)); - start_get(); - dload_bytes = 0; - dload_state = DLOAD_FILE; - }*/ - } else if(data == (void *)&d64button) { - ctk_dialog_open(&d64dialog); - } else if(data == (void *)&cancelbutton) { - ctk_dialog_close(); - } else if(data == (void *)&overwritebutton) { - ctk_dialog_close(); - - /* Turn of screensaver. */ - program_handler_setscreensaver(NULL); - - strncpy(url, urledit, sizeof(url)); - petsciiconv_toascii(url, sizeof(url)); - start_get(); - dload_bytes = 0; - dload_state = DLOAD_D64; - ds.track = 1; - ds.sect = 0; - bufferptr = 0; -#if USE_KERNAL -#else - c64_dio_init(_curunit); -#endif - - /* c64_dio_init(8);*/ - } - } else if(ev == ctk_signal_hyperlink_activate) { - if(dload_state == DLOAD_NONE) { - /* open_link(w->widget.hyperlink.url);*/ - strncpy(urledit, - ((struct ctk_widget *)data)->widget.hyperlink.url, sizeof(urledit)); - petsciiconv_topetscii(urledit, sizeof(urledit)); - CTK_WIDGET_REDRAW(&urltextentry); - CTK_WIDGET_FOCUS(&window, &urltextentry); - } - } else if(ev == resolv_event_found) { - /* Either found a hostname, or not. */ - if((char *)data != NULL && - resolv_lookup((char *)data) != NULL) { - start_get(); - } else { - show_statustext("Host not found."); - } - } else if(ev == ctk_signal_window_close) { - break; - } - } - - PROCESS_END(); -} -/*-----------------------------------------------------------------------------------*/ -/* webclient_aborted(): - * - * Callback function. Called from the webclient when the HTTP - * connection was abruptly aborted. - */ -void -webclient_aborted(void) -{ - show_statustext("Connection reset by peer"); -} -/*-----------------------------------------------------------------------------------*/ -/* webclient_timedout(): - * - * Callback function. Called from the webclient when the HTTP - * connection timed out. - */ -void -webclient_timedout(void) -{ - show_statustext("Connection timed out"); - if(dload_state == DLOAD_FILE) { - cbm_close(2); - } - -} -/*-----------------------------------------------------------------------------------*/ -/* webclient_closed(): - * - * Callback function. Called from the webclient when the HTTP - * connection was closed after a request from the "webclient_close()" - * function. . - */ -void -webclient_closed(void) -{ - show_statustext("Done."); -} -/*-----------------------------------------------------------------------------------*/ -/* webclient_closed(): - * - * Callback function. Called from the webclient when the HTTP - * connection is connected. - */ -void -webclient_connected(void) -{ - show_statustext("Request sent..."); -} -/*-----------------------------------------------------------------------------------*/ -static u8_t -next_sector(void) -{ - ++ds.sect; - if(ds.track < 18) { - if(ds.sect == 21) { - ++ds.track; - ds.sect = 0; - } - } else if(ds.track < 25) { - if(ds.sect == 19) { - ++ds.track; - ds.sect = 0; - } - } else if(ds.track < 31) { - if(ds.sect == 18) { - ++ds.track; - ds.sect = 0; - } - } else if(ds.track < 36) { - if(ds.sect == 17) { - ++ds.track; - ds.sect = 0; - } - } - - if(ds.track == 36) { - return 1; - } - return 0; -} -/*-----------------------------------------------------------------------------------*/ -static void -x_open(u8_t f, u8_t d, u8_t cmd, u8_t *fname) -{ - u8_t ret; - - ret = cbm_open(f, d, cmd, fname); - if(ret != 0) { - /* printf("open: error %d\n", ret);*/ - /* ctk_label_set_text(&statuslabel, "Open err"); - CTK_WIDGET_REDRAW(&statuslabel);*/ - show_statustext("Open error"); - } - -} -static void -write_sector(u8_t device, u8_t track, u8_t sect, void *mem) -{ - u16_t ret; - static u8_t cmd[32]; - - x_open(15, device, 15, NULL); - x_open(2, device, 2, "#"); - - ret = cbm_write(2, mem, 256); - - sprintf(cmd, "u2: 2 0 %d %d", track, sect); - cbm_write(15, cmd, strlen(cmd)); - /* printf("%s\n", cmd);*/ - - - /* ret = 0;*/ - if(ret == -1) { - sprintf(statusmsg, "Write error at %d:%d", track, sect); - show_statustext(statusmsg); - } else { - sprintf(statusmsg, "Wrote %d bytes to %d:%d", ret, track, sect); - show_statustext(statusmsg); - } - /* printf("write: wrote %d bytes\n", ret);*/ - - cbm_close(2); - cbm_close(15); -} - -static void -write_buffer(void) -{ -#if USE_KERNAL - write_sector(8, ds.track, ds.sect, buffer); -#else - c64_dio_write_block(ds.track, ds.sect, buffer); -#endif - if(next_sector() != 0) { - dload_state = DLOAD_NONE; - } -} -static void -handle_d64_data(char *data, u16_t len) -{ - u16_t bufferlen; - - while(dload_state == DLOAD_D64 && - len > 0) { - bufferlen = sizeof(buffer) - bufferptr; - if(len < bufferlen) { - bufferlen = len; - } - - memcpy(&buffer[bufferptr], data, bufferlen); - - data += bufferlen; - bufferptr += bufferlen; - len -= bufferlen; - - if(bufferptr == sizeof(buffer)) { - write_buffer(); - bufferptr = 0; - } - } -} -/*-----------------------------------------------------------------------------------*/ -/* webclient_datahandler(): - * - * Callback function. Called from the webclient module when HTTP data - * has arrived. - */ -void -webclient_datahandler(char *data, u16_t len) -{ - int ret; - - if(len > 0) { - dload_bytes += len; - sprintf(statusmsg, "Downloading (%lu bytes)", dload_bytes); - show_statustext(statusmsg); - if(dload_state == DLOAD_D64) { - handle_d64_data(data, len); - } else if(dload_state == DLOAD_FILE) { - ret = cbm_write(2, data, len); - if(ret != len) { - sprintf(statusmsg, "Wrote only %d bytes", ret); - show_statustext(statusmsg); - } - } - } - - if(data == NULL) { - if(dload_state == DLOAD_FILE) { - cbm_close(2); - } - dload_state = DLOAD_NONE; - sprintf(statusmsg, "Finished downloading %lu bytes", dload_bytes); - show_statustext(statusmsg); - } -} -/*-----------------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/c64.cfg b/backyard/platform/c64/c64.cfg deleted file mode 100644 index 76efb178a..000000000 --- a/backyard/platform/c64/c64.cfg +++ /dev/null @@ -1,30 +0,0 @@ -MEMORY { - ZP: start = $02, size = $1A, type = rw, define = yes; - RAM: start = $7FF, size = $c801, define = yes, file = %O; -} -SEGMENTS { - STARTUP: load = RAM, type = ro; - INIT: load = RAM, type = ro; - CODE: load = RAM, type = ro; - RODATA: load = RAM, type = ro; - DATA: load = RAM, type = rw; - BSS: load = RAM, type = bss, define = yes; - ZEROPAGE: load = ZP, type = zp; -} -FEATURES { - CONDES: segment = RODATA, - type = constructor, - label = __CONSTRUCTOR_TABLE__, - count = __CONSTRUCTOR_COUNT__; - CONDES: segment = RODATA, - type = destructor, - label = __DESTRUCTOR_TABLE__, - count = __DESTRUCTOR_COUNT__; - CONDES: segment = RODATA, - type = interruptor, - label = __INTERRUPTOR_TABLE__, - count = __INTERRUPTOR_COUNT__; -} -SYMBOLS { - __STACKSIZE__ = $100; -} diff --git a/backyard/platform/c64/contiki-conf.h b/backyard/platform/c64/contiki-conf.h deleted file mode 100644 index 2f485d889..000000000 --- a/backyard/platform/c64/contiki-conf.h +++ /dev/null @@ -1,611 +0,0 @@ -#ifndef __CONTIKI_CONF_H__ -#define __CONTIKI_CONF_H__ - -#define LC_CONF_INCLUDE "lib/lc-cc65.h" - -/*#pragma charmap(0, 0); -#pragma charmap(1, 1); -#pragma charmap(2, 2); -#pragma charmap(3, 3); -#pragma charmap(4, 4); -#pragma charmap(5, 5); -#pragma charmap(6, 6); -#pragma charmap(7, 7); -#pragma charmap(8, 8); -#pragma charmap(9, 9); -#pragma charmap(10, 10); -#pragma charmap(11, 11); -#pragma charmap(12, 12); -#pragma charmap(13, 13); -#pragma charmap(14, 14); -#pragma charmap(15, 15); -#pragma charmap(16, 16); -#pragma charmap(17, 17); -#pragma charmap(18, 18); -#pragma charmap(19, 19); -#pragma charmap(20, 20); -#pragma charmap(21, 21); -#pragma charmap(22, 22); -#pragma charmap(23, 23); -#pragma charmap(24, 24); -#pragma charmap(25, 25); -#pragma charmap(26, 26); -#pragma charmap(27, 27); -#pragma charmap(28, 28); -#pragma charmap(29, 29); -#pragma charmap(30, 30); -#pragma charmap(31, 31); -#pragma charmap(32, 32); -#pragma charmap(33, 33); -#pragma charmap(34, 34); -#pragma charmap(35, 35); -#pragma charmap(36, 36); -#pragma charmap(37, 37); -#pragma charmap(38, 38); -#pragma charmap(39, 39); -#pragma charmap(40, 40); -#pragma charmap(41, 41); -#pragma charmap(42, 42); -#pragma charmap(43, 43); -#pragma charmap(44, 44); -#pragma charmap(45, 45); -#pragma charmap(46, 46); -#pragma charmap(47, 47); -#pragma charmap(48, 48); -#pragma charmap(49, 49); -#pragma charmap(50, 50); -#pragma charmap(51, 51); -#pragma charmap(52, 52); -#pragma charmap(53, 53); -#pragma charmap(54, 54); -#pragma charmap(55, 55); -#pragma charmap(56, 56); -#pragma charmap(57, 57); -#pragma charmap(58, 58); -#pragma charmap(59, 59); -#pragma charmap(60, 60); -#pragma charmap(61, 61); -#pragma charmap(62, 62); -#pragma charmap(63, 63); -#pragma charmap(64, 64); -#pragma charmap(65, 65); -#pragma charmap(66, 66); -#pragma charmap(67, 67); -#pragma charmap(68, 68); -#pragma charmap(69, 69); -#pragma charmap(70, 70); -#pragma charmap(71, 71); -#pragma charmap(72, 72); -#pragma charmap(73, 73); -#pragma charmap(74, 74); -#pragma charmap(75, 75); -#pragma charmap(76, 76); -#pragma charmap(77, 77); -#pragma charmap(78, 78); -#pragma charmap(79, 79); -#pragma charmap(80, 80); -#pragma charmap(81, 81); -#pragma charmap(82, 82); -#pragma charmap(83, 83); -#pragma charmap(84, 84); -#pragma charmap(85, 85); -#pragma charmap(86, 86); -#pragma charmap(87, 87); -#pragma charmap(88, 88); -#pragma charmap(89, 89); -#pragma charmap(90, 90); -#pragma charmap(91, 91); -#pragma charmap(92, 92); -#pragma charmap(93, 93); -#pragma charmap(94, 94); -#pragma charmap(95, 95); -#pragma charmap(96, 96); -#pragma charmap(97, 97); -#pragma charmap(98, 98); -#pragma charmap(99, 99); -#pragma charmap(100, 100); -#pragma charmap(101, 101); -#pragma charmap(102, 102); -#pragma charmap(103, 103); -#pragma charmap(104, 104); -#pragma charmap(105, 105); -#pragma charmap(106, 106); -#pragma charmap(107, 107); -#pragma charmap(108, 108); -#pragma charmap(109, 109); -#pragma charmap(110, 110); -#pragma charmap(111, 111); -#pragma charmap(112, 112); -#pragma charmap(113, 113); -#pragma charmap(114, 114); -#pragma charmap(115, 115); -#pragma charmap(116, 116); -#pragma charmap(117, 117); -#pragma charmap(118, 118); -#pragma charmap(119, 119); -#pragma charmap(120, 120); -#pragma charmap(121, 121); -#pragma charmap(122, 122); -#pragma charmap(123, 123); -#pragma charmap(124, 124); -#pragma charmap(125, 125); -#pragma charmap(126, 126); -#pragma charmap(127, 127); -#pragma charmap(128, 128); -#pragma charmap(129, 129); -#pragma charmap(130, 130); -#pragma charmap(131, 131); -#pragma charmap(132, 132); -#pragma charmap(133, 133); -#pragma charmap(134, 134); -#pragma charmap(135, 135); -#pragma charmap(136, 136); -#pragma charmap(137, 137); -#pragma charmap(138, 138); -#pragma charmap(139, 139); -#pragma charmap(140, 140); -#pragma charmap(141, 141); -#pragma charmap(142, 142); -#pragma charmap(143, 143); -#pragma charmap(144, 144); -#pragma charmap(145, 145); -#pragma charmap(146, 146); -#pragma charmap(147, 147); -#pragma charmap(148, 148); -#pragma charmap(149, 149); -#pragma charmap(150, 150); -#pragma charmap(151, 151); -#pragma charmap(152, 152); -#pragma charmap(153, 153); -#pragma charmap(154, 154); -#pragma charmap(155, 155); -#pragma charmap(156, 156); -#pragma charmap(157, 157); -#pragma charmap(158, 158); -#pragma charmap(159, 159); -#pragma charmap(160, 160); -#pragma charmap(161, 161); -#pragma charmap(162, 162); -#pragma charmap(163, 163); -#pragma charmap(164, 164); -#pragma charmap(165, 165); -#pragma charmap(166, 166); -#pragma charmap(167, 167); -#pragma charmap(168, 168); -#pragma charmap(169, 169); -#pragma charmap(170, 170); -#pragma charmap(171, 171); -#pragma charmap(172, 172); -#pragma charmap(173, 173); -#pragma charmap(174, 174); -#pragma charmap(175, 175); -#pragma charmap(176, 176); -#pragma charmap(177, 177); -#pragma charmap(178, 178); -#pragma charmap(179, 179); -#pragma charmap(180, 180); -#pragma charmap(181, 181); -#pragma charmap(182, 182); -#pragma charmap(183, 183); -#pragma charmap(184, 184); -#pragma charmap(185, 185); -#pragma charmap(186, 186); -#pragma charmap(187, 187); -#pragma charmap(188, 188); -#pragma charmap(189, 189); -#pragma charmap(190, 190); -#pragma charmap(191, 191); -#pragma charmap(192, 192); -#pragma charmap(193, 193); -#pragma charmap(194, 194); -#pragma charmap(195, 195); -#pragma charmap(196, 196); -#pragma charmap(197, 197); -#pragma charmap(198, 198); -#pragma charmap(199, 199); -#pragma charmap(200, 200); -#pragma charmap(201, 201); -#pragma charmap(202, 202); -#pragma charmap(203, 203); -#pragma charmap(204, 204); -#pragma charmap(205, 205); -#pragma charmap(206, 206); -#pragma charmap(207, 207); -#pragma charmap(208, 208); -#pragma charmap(209, 209); -#pragma charmap(210, 210); -#pragma charmap(211, 211); -#pragma charmap(212, 212); -#pragma charmap(213, 213); -#pragma charmap(214, 214); -#pragma charmap(215, 215); -#pragma charmap(216, 216); -#pragma charmap(217, 217); -#pragma charmap(218, 218); -#pragma charmap(219, 219); -#pragma charmap(220, 220); -#pragma charmap(221, 221); -#pragma charmap(222, 222); -#pragma charmap(223, 223); -#pragma charmap(224, 224); -#pragma charmap(225, 225); -#pragma charmap(226, 226); -#pragma charmap(227, 227); -#pragma charmap(228, 228); -#pragma charmap(229, 229); -#pragma charmap(230, 230); -#pragma charmap(231, 231); -#pragma charmap(232, 232); -#pragma charmap(233, 233); -#pragma charmap(234, 234); -#pragma charmap(235, 235); -#pragma charmap(236, 236); -#pragma charmap(237, 237); -#pragma charmap(238, 238); -#pragma charmap(239, 239); -#pragma charmap(240, 240); -#pragma charmap(241, 241); -#pragma charmap(242, 242); -#pragma charmap(243, 243); -#pragma charmap(244, 244); -#pragma charmap(245, 245); -#pragma charmap(246, 246); -#pragma charmap(247, 247); -#pragma charmap(248, 248); -#pragma charmap(249, 249); -#pragma charmap(250, 250); -#pragma charmap(251, 251); -#pragma charmap(252, 252); -#pragma charmap(253, 253); -#pragma charmap(254, 254); -#pragma charmap(255, 255);*/ - -/* C compiler configuration. */ - -#define CC_CONF_REGISTER_ARGS 1 -#define CC_CONF_FUNCTION_POINTER_ARGS 1 - -#define CC_CONF_FASTCALL fastcall - -/* Interface configuration. */ - -#define CCIF -#define CLIF - -/* Clock configuration. */ - -#include - -typedef unsigned short clock_time_t; - -#define CLOCK_CONF_SECOND CLK_TCK - - -/* - * CTK GUI toolkit configuration. - */ - -#include "ctk-arch.h" - -/* Defines which key that is to be used for activating the menus */ -#define CTK_CONF_MENU_KEY CH_F1 - -/* Defines which key that is to be used for switching the frontmost - window. */ -#define CTK_CONF_WINDOWSWITCH_KEY CH_F3 - -/* Defines which key that is to be used for switching to the prevoius - widget. */ -#define CTK_CONF_WIDGETUP_KEY CH_F5 - -/* Defines which key that is to be used for switching to the next - widget. */ -#define CTK_CONF_WIDGETDOWN_KEY CH_F7 - -/* Toggles mouse support (must have support functions in the -architecture specific files to work). */ -#define CTK_CONF_MOUSE_SUPPORT 0 - -/* Toggles support for icons. */ -#define CTK_CONF_ICONS 1 - -/* Toggles support for icon bitmaps. */ -#define CTK_CONF_ICON_BITMAPS 1 - -/* Toggles support for icon textmaps. */ -#define CTK_CONF_ICON_TEXTMAPS 1 - -/* Toggles support for movable windows. */ -#define CTK_CONF_WINDOWMOVE 1 - -/* Toggles support for closable windows. */ -#define CTK_CONF_WINDOWCLOSE 1 - -/* Toggles support for menus. */ -#define CTK_CONF_MENUS 1 - -/* Defines the default width of a menu. */ -#define CTK_CONF_MENUWIDTH 16 -/* The maximum number of menu items in each menu. */ -#define CTK_CONF_MAXMENUITEMS 10 - -/* Toggles support for screen savers. */ -#define CTK_CONF_SCREENSAVER 1 - -/* - * CTK conio configuration. - */ - -#if 0 -/* Light gray inverted color scheme: */ -#define BORDERCOLOR COLOR_WHITE -#define SCREENCOLOR COLOR_WHITE -#define BACKGROUNDCOLOR COLOR_WHITE - -#define WINDOWCOLOR_FOCUS COLOR_BLACK -#define WINDOWCOLOR COLOR_GRAY2 - -#define DIALOGCOLOR COLOR_RED - -#define WIDGETCOLOR_HLINK COLOR_BLUE -#define WIDGETCOLOR_FWIN COLOR_BLACK -#define WIDGETCOLOR COLOR_GRAY1 -#define WIDGETCOLOR_DIALOG COLOR_RED -#define WIDGETCOLOR_FOCUS COLOR_BLACK - -#define MENUCOLOR COLOR_BLACK -#define OPENMENUCOLOR COLOR_BLACK -#define ACTIVEMENUITEMCOLOR COLOR_BLACK -#endif /* 0 */ - -#if 0 -/* Blue color scheme: */ -#define BORDERCOLOR COLOR_LIGHTBLUE -#define SCREENCOLOR COLOR_BLUE -#define BACKGROUNDCOLOR COLOR_BLUE - -#define WINDOWCOLOR_FOCUS COLOR_LIGHTBLUE -#define WINDOWCOLOR COLOR_GRAY1 - -#define DIALOGCOLOR COLOR_WHITE - -#define WIDGETCOLOR_HLINK COLOR_CYAN -#define WIDGETCOLOR_FWIN COLOR_LIGHTBLUE -#define WIDGETCOLOR COLOR_GRAY1 -#define WIDGETCOLOR_DIALOG COLOR_WHITE -#define WIDGETCOLOR_FOCUS COLOR_YELLOW - -#define MENUCOLOR COLOR_WHITE -#define OPENMENUCOLOR COLOR_LIGHTBLUE -#define ACTIVEMENUITEMCOLOR COLOR_YELLOW -#endif /* 0 */ - -#if 0 -/* Black and white monocrome color scheme: */ -#define BORDERCOLOR COLOR_BLACK -#define SCREENCOLOR COLOR_BLACK -#define BACKGROUNDCOLOR COLOR_BLACK - -#define WINDOWCOLOR_FOCUS COLOR_WHITE -#define WINDOWCOLOR COLOR_WHITE - -#define DIALOGCOLOR COLOR_WHITE - -#define WIDGETCOLOR_HLINK COLOR_WHITE -#define WIDGETCOLOR_FWIN COLOR_WHITE -#define WIDGETCOLOR COLOR_WHITE -#define WIDGETCOLOR_DIALOG COLOR_WHITE -#define WIDGETCOLOR_FOCUS COLOR_WHITE - -#define MENUCOLOR COLOR_WHITE -#define OPENMENUCOLOR COLOR_WHITE -#define ACTIVEMENUITEMCOLOR COLOR_WHITE -#endif /* 0 */ - -#if 0 -/* Blue monocrome color scheme: */ -#define BORDERCOLOR COLOR_BLUE -#define SCREENCOLOR COLOR_BLUE -#define BACKGROUNDCOLOR COLOR_BLUE - -#define WINDOWCOLOR_FOCUS COLOR_LIGHTBLUE -#define WINDOWCOLOR COLOR_LIGHTBLUE - -#define DIALOGCOLOR COLOR_LIGHTBLUE - -#define WIDGETCOLOR_HLINK COLOR_LIGHTBLUE -#define WIDGETCOLOR_FWIN COLOR_LIGHTBLUE -#define WIDGETCOLOR COLOR_LIGHTBLUE -#define WIDGETCOLOR_DIALOG COLOR_LIGHTBLUE -#define WIDGETCOLOR_FOCUS COLOR_LIGHTBLUE - -#define MENUCOLOR COLOR_LIGHTBLUE -#define OPENMENUCOLOR COLOR_LIGHTBLUE -#define ACTIVEMENUITEMCOLOR COLOR_LIGHTBLUE -#endif /* 0 */ - -#if 1 -/* Gray color scheme: */ -#define BORDERCOLOR COLOR_GRAY1 -#define SCREENCOLOR COLOR_GRAY1 -#define BACKGROUNDCOLOR COLOR_GRAY1 - -#define WINDOWCOLOR_FOCUS COLOR_GRAY3 -#define WINDOWCOLOR COLOR_GRAY2 - -#define DIALOGCOLOR COLOR_WHITE - -#define WIDGETCOLOR_HLINK COLOR_LIGHTBLUE -#define WIDGETCOLOR_FWIN COLOR_GRAY3 -#define WIDGETCOLOR COLOR_GRAY2 -#define WIDGETCOLOR_DIALOG COLOR_WHITE -#define WIDGETCOLOR_FOCUS COLOR_YELLOW - -#define MENUCOLOR COLOR_GRAY3 -#define OPENMENUCOLOR COLOR_WHITE -#define ACTIVEMENUITEMCOLOR COLOR_YELLOW -#endif /* 0 */ - -#if 0 -/* Red color scheme: */ -#define BORDERCOLOR COLOR_BLACK -#define SCREENCOLOR COLOR_BLACK -#define BACKGROUNDCOLOR COLOR_BLACK - -#define WINDOWCOLOR_FOCUS COLOR_LIGHTRED -#define WINDOWCOLOR COLOR_RED - -#define DIALOGCOLOR COLOR_WHITE - -#define WIDGETCOLOR_HLINK COLOR_LIGHTBLUE -#define WIDGETCOLOR_FWIN COLOR_YELLOW -#define WIDGETCOLOR COLOR_LIGHTRED -#define WIDGETCOLOR_DIALOG COLOR_WHITE -#define WIDGETCOLOR_FOCUS COLOR_YELLOW - -#define MENUCOLOR COLOR_LIGHTRED -#define OPENMENUCOLOR COLOR_WHITE -#define ACTIVEMENUITEMCOLOR COLOR_YELLOW -#endif /* 0 */ - -/* CTK VNC server configuration. */ - -#define CTK_VNCSERVER_CONF_NUMCONNS 1 - -#define CTK_VNCSERVER_CONF_MAX_ICONS 4 - -#define CTK_VNCSERVER_CONF_SCREEN (u8_t *)0x0400 - -/* Email program configuration. */ - -#define EMAIL_CONF_WIDTH 36 -#define EMAIL_CONF_HEIGHT 17 - -/* IRC program configuration. */ - -#define IRC_CONF_WIDTH 78 -#define IRC_CONF_HEIGHT 21 - -#define IRC_CONF_SYSTEM_STRING "c64" - -/* Libconio configuration. */ - -#define LIBCONIO_CONF_SCREEN_WIDTH 80 -#define LIBCONIO_CONF_SCREEN_HEIGHT 25 - -/* Logging configuration. */ - -#define LOG_CONF_ENABLED 1 - -/* Program handler configuration. */ - -#define PROGRAM_HANDLER_CONF_MAX_NUMDSCS 10 - -/* Shell GUI configuration. */ - -#define SHELL_GUI_CONF_XSIZE 26 -#define SHELL_GUI_CONF_YSIZE 12 - -/* Telnet daemon configuration. */ - -#define TELNETD_CONF_LINELEN 32 -#define TELNETD_CONF_NUMLINES 12 - -#define TELNETD_CONF_GUI 1 - -/* uIP configuration. */ - -#define UIP_CONF_MAX_CONNECTIONS 10 -#define UIP_CONF_MAX_LISTENPORTS 10 -#define UIP_CONF_BUFFER_SIZE 400 -#define UIP_CONF_RECEIVE_WINDOW 320 - -#define UIP_CONF_BYTE_ORDER UIP_LITTLE_ENDIAN - -#define UIP_CONF_ARBTAB_SIZE 4 - -#define UIP_CONF_RESOLV_ENTRIES 4 -#define UIP_CONF_PINGADDRCONF 0 - -#define UIP_CONF_LOGGING 0 -#define UIP_CONF_UDP_CONNS 6 -#define UIP_CONF_BROADCAST 0 - -#define UIP_CONF_UDP_CHECKSUMS 0 - -#define UIP_ARCH_ADD32 1 -#define UIP_ARCH_CHKSUM 1 - -/** - * The 8-bit unsigned data type. - * - * This may have to be tweaked for your particular compiler. "unsigned - * char" works for most compilers. - */ -typedef unsigned char u8_t; - -/** - * The 16-bit unsigned data type. - * - * This may have to be tweaked for your particular compiler. "unsigned - * short" works for most compilers. - */ -typedef unsigned short u16_t; - -/** - * The 32-bit unsigned data type. - * - * This may have to be tweaked for your particular compiler. "unsigned - * long" works for most compilers. - */ -typedef unsigned long u32_t; - -/** - * The statistics data type. - * - * This datatype determines how high the statistics counters are able - * to count. - */ -typedef unsigned short uip_stats_t; - - -/* VNC viewer configuration. */ - -#define VNC_CONF_VIEWPORT_WIDTH (32*8) -#define VNC_CONF_VIEWPORT_HEIGHT (16*8) - -#define VNC_CONF_REFRESH_ROWS 8 - -/* Web browser configuration. */ - -#define WWW_CONF_HOMEPAGE "http://contiki.c64.org/" - -/* The size of the HTML viewing area. */ -#define WWW_CONF_WEBPAGE_WIDTH 36 -#define WWW_CONF_WEBPAGE_HEIGHT 17 - -/* The size of the "Back" history. */ -#define WWW_CONF_HISTORY_SIZE 2 - -/* Defines the maximum length of an URL */ -#define WWW_CONF_MAX_URLLEN 55 - -/* The maxiumum number of widgets (i.e., hyperlinks, form elements) on - a page. */ -#define WWW_CONF_MAX_NUMPAGEWIDGETS 8 - -/* Turns
support on or off; must be on for forms to work. */ -#define WWW_CONF_RENDERSTATE 0 - -/* Toggles support for HTML forms. */ -#define WWW_CONF_FORMS 0 - -/* Maximum lengths for various HTML form parameters. */ -#define WWW_CONF_MAX_FORMACTIONLEN 30 -#define WWW_CONF_MAX_FORMNAMELEN 20 -#define WWW_CONF_MAX_INPUTNAMELEN 20 - -#define WWW_CONF_MAX_INPUTVALUELEN (WWW_CONF_WEBPAGE_WIDTH - 1) - - -#endif /* __CONTIKI_CONF_H__ */ diff --git a/backyard/platform/c64/ctk/ctk-80col-asm.S b/backyard/platform/c64/ctk/ctk-80col-asm.S deleted file mode 100644 index 4df6cad6b..000000000 --- a/backyard/platform/c64/ctk/ctk-80col-asm.S +++ /dev/null @@ -1,986 +0,0 @@ - -;--------------------------------------------------------------------- - .importzp ptr1, ptr2, ptr3, ptr4, sreg - .importzp sp - - .import pushax - .import incsp2 - - .import _ctk_80col_screencolors - .import _ctk_80col_screenpattern - - .import _ctk_80col_lefttab - .import _ctk_80col_righttab - - .import _ctk_80col_cursx - .import _ctk_80col_cursy - .import _ctk_80col_color - .import _ctk_80col_underline - .import _ctk_80col_reversed - - .import _ctk_80col_yscreenaddr - .import _ctk_80col_yhiresaddr - - .import _ctk_80col_windowparams - - .import _ctk_80col_bitmapptr - - .import _ctk_80col_versionstring - .import _ctk_80col_versionstring_len - - .import _ctk_80col_theme - - .export _ctk_80col_cclear - .export _ctk_80col_chline - .export _ctk_80col_cputc - .export _ctk_80col_cputsn - - .export _ctk_80col_clear_line - .export _ctk_80col_draw_bitmapline - - .export _ctk_80col_draw_windowborders - -;--------------------------------------------------------------------- - -ptr5 = sreg - - ;; Offsets in the theme struct - - ulcornerpattern = 8 - titlebarpattern = ulcornerpattern+8 - urcornerpattern = titlebarpattern+8 - rborderpattern = urcornerpattern+8 - lrcornerpattern = rborderpattern+8 - lowerborderpattern = lrcornerpattern+8 - llcornerpattern = lowerborderpattern+8 - lborderpattern = llcornerpattern+8 - - - buttonleftpattern = lborderpattern+8 - buttonrightpattern = buttonleftpattern+8 - - -.bss -tmp01: .res 1 -tmpl: .res 1 -tmpf: .res 1 -tmpc: .res 1 -tmpw: .res 1 -tmpptr: .res 2 - -tmpy: .res 1 -tmph: .res 1 - - ;; Window border parameters -w: .res 1 -wpw = 0 -h: .res 1 -wph = 1 -clipy1: .res 1 -wpclipy1 = 2 -clipy2: .res 1 -wpclipy2 = 3 -color1: .res 1 -wpcolor1 = 4 -color2: .res 1 -wpcolor2 = 5 -titlecolor: .res 1 -wptitlecolor = 6 -titlelen: .res 1 -wptitlelen = 7 -title: .res 2 -wptitle = 8 - -;--------------------------------------------------------------------- -.data -;--------------------------------------------------------------------- -.code -setupptrs: - ;; Find hires address. - lda _ctk_80col_cursy - asl - tax - lda _ctk_80col_yhiresaddr,x - sta ptr2 - lda _ctk_80col_yhiresaddr+1,x - sta ptr2+1 - - ;; Add X coordinate to the hires address. - lda #0 - sta ptr1+1 - lda _ctk_80col_cursx - asl - rol ptr1+1 -; asl -; rol ptr1+1 - asl - rol ptr1+1 - clc - adc ptr2 - and #$f8 - sta ptr2 - lda ptr2+1 - adc ptr1+1 - sta ptr2+1 - - ;; Find screen address. - lda _ctk_80col_cursy - asl - tax - lda _ctk_80col_cursx - lsr - clc - adc _ctk_80col_yscreenaddr,x - sta ptr1 - lda _ctk_80col_yscreenaddr+1,x - adc #0 - sta ptr1+1 - - ;; Turn off interrupts, prepare $01 to store color data in RAM - ;; under I/O area. - sei - lda $01 - sta tmp01 - and #$f8 - sta $01 - rts -;--------------------------------------------------------------------- -restore01: - lda tmp01 - sta $01 - cli - rts -;--------------------------------------------------------------------- -_ctk_80col_cclear: - sta tmpl - cmp #0 - bne @norts - rts -@norts: - - jsr setupptrs - - ldy tmpl - lda _ctk_80col_color -: - sta (ptr1),y - dey - bpl :- - - ;; Store either $00 or $ff in hires memory, depending on the - ;; reversed flag - - ldx tmpl - lda _ctk_80col_reversed - beq @noff - lda #$ff -@noff: - sta tmpf - - -@loop1: - ldy #7 - lda tmpf -@loop2: - sta (ptr2),y - dey - bpl @loop2 - - lda ptr2 - clc - adc #8 - sta ptr2 - bcc @noinc - inc ptr2+1 -@noinc: - - inc _ctk_80col_cursx - - dex - bpl @loop1 - - jmp restore01 -;--------------------------------------------------------------------- -_ctk_80col_chline: - sta tmpl - cmp #0 - bne @norts - rts -@norts: - - jsr setupptrs - - ;; Store horizontal line pattern in hires memory - ldx tmpl -@loop1: - ldy #0 - lda #$00 - sta (ptr2),y - iny - lda #$00 - sta (ptr2),y - iny - lda #$00 - sta (ptr2),y - iny - lda #$ff - sta (ptr2),y - iny - lda #$ff - sta (ptr2),y - iny - lda #$00 - sta (ptr2),y - iny - lda #$00 - sta (ptr2),y - iny - lda #$00 - sta (ptr2),y - - - lda ptr2 - clc - adc #8 - sta ptr2 - bcc @noinc - inc ptr2+1 -@noinc: - - inc _ctk_80col_cursx - - dex - bne @loop1 - - jmp restore01 -;--------------------------------------------------------------------- -_ctk_80col_cputc: - sta tmpc - - jsr setupptrs - - ;; Turn on font ROM - lda tmp01 - and #$f8 - ora #$01 - sta $01 - - lda #0 - sta ptr1+1 - - ;; Convert from PETSCII to screen encoding - lda tmpc - eor #$e0 - clc - adc #$20 - bpl @cont - adc #$40 - bpl @cont - eor #$a0 -@cont: - ldx _ctk_80col_reversed - beq :+ - eor #$80 -: - - ;; Convert to address in character ROM - asl - rol ptr1+1 - asl - rol ptr1+1 - asl - rol ptr1+1 - sta ptr1 - lda #$d8 - adc ptr1+1 - sta ptr1+1 - - lda _ctk_80col_cursx - and #1 - beq @left - - ;; Print on hires screen, bottom-up. If we should underline, - ;; we do this by eor:ing the bottom line with #$ff - ldy #7 - lda (ptr1),y - ldx _ctk_80col_underline - beq @rightnounderline - eor #$ff -@rightnounderline: - tax - lda (ptr2),y - and #$f0 - ora _ctk_80col_righttab,x - sta (ptr2),y - dey -@rightloop: - lda (ptr1),y - tax - lda (ptr2),y - and #$f0 - ora _ctk_80col_righttab,x - sta (ptr2),y - dey - bpl @rightloop - - inc _ctk_80col_cursx - - jmp restore01 - -@left: - ;; Print on hires screen, bottom-up. If we should underline, - ;; we do this by eor:ing the bottom line with #$ff - ldy #7 - lda (ptr1),y - ldx _ctk_80col_underline - beq @nounderline - eor #$ff -@nounderline: - tax - lda (ptr2),y - and #$0f - ora _ctk_80col_lefttab,x - sta (ptr2),y - dey -@loop: - lda (ptr1),y - tax - lda (ptr2),y - and #$0f - ora _ctk_80col_lefttab,x - sta (ptr2),y - dey - bpl @loop - - - - inc _ctk_80col_cursx - - jmp restore01 -;--------------------------------------------------------------------- -_ctk_80col_cputsn: - sta tmpl - cmp #0 - bne :+ - jmp incsp2 -: - - jsr setupptrs - - ;; Turn on font ROM - lda tmp01 - and #$f8 - ora #$01 - sta $01 - - ;; Output each character from the string - lda #0 - sta tmpc - ldy #0 - lda (sp),y - sta ptr3 - iny - lda (sp),y - sta ptr3+1 - -@loop1: - - - lda #0 - sta ptr1+1 - - ldy tmpc - lda (ptr3),y - bne :+ - jmp @end -: - - ;; Convert from PETSCII to screen encoding - eor #$e0 - clc - adc #$20 - bpl @cont - adc #$40 - bpl @cont - eor #$a0 -@cont: - ldx _ctk_80col_reversed - beq :+ - eor #$80 -: - - ;; Convert to address in character ROM - asl - rol ptr1+1 - asl - rol ptr1+1 - asl - rol ptr1+1 - sta ptr1 - lda #$d8 - adc ptr1+1 - sta ptr1+1 - - lda _ctk_80col_cursx - and #1 - beq @left - - ;; Print on hires screen, bottom-up. If we should underline, - ;; we do this by eor:ing the bottom line with #$ff - ldy #7 - lda (ptr1),y - ldx _ctk_80col_underline - beq @rightnounderline - eor #$ff -@rightnounderline: - tax - lda (ptr2),y - and #$f0 - ora _ctk_80col_righttab,x - sta (ptr2),y - dey -@rightloop: - lda (ptr1),y - tax - lda (ptr2),y - and #$f0 - ora _ctk_80col_righttab,x - sta (ptr2),y - dey - bpl @rightloop - - - lda ptr2 - clc - adc #8 - sta ptr2 - bcc :+ - inc ptr2+1 -: - - inc _ctk_80col_cursx - - jmp @loopend - -@left: - ;; Print on hires screen, bottom-up. If we should underline, - ;; we do this by eor:ing the bottom line with #$ff - ldy #7 - lda (ptr1),y - ldx _ctk_80col_underline - beq @nounderline - eor #$ff -@nounderline: - tax - lda (ptr2),y - and #$0f - ora _ctk_80col_lefttab,x - sta (ptr2),y - dey -@loop: - lda (ptr1),y - tax - lda (ptr2),y - and #$0f - ora _ctk_80col_lefttab,x - sta (ptr2),y - dey - bpl @loop - - inc _ctk_80col_cursx -@loopend: - inc tmpc - lda tmpc - cmp tmpl - beq :+ - jmp @loop1 -: - -@end: - jsr restore01 - - jmp incsp2 -;--------------------------------------------------------------------- -_ctk_80col_clear_line: - sta tmpl - asl - tax - lda _ctk_80col_yscreenaddr,x - sta ptr1 - lda _ctk_80col_yscreenaddr+1,x - sta ptr1+1 - lda _ctk_80col_yhiresaddr,x - sta ptr2 - lda _ctk_80col_yhiresaddr+1,x - sta ptr2+1 - - sei - lda $01 - sta tmp01 - and #$f8 - sta $01 - - ldy #39 - ldx tmpl - lda _ctk_80col_screencolors,x -: - sta (ptr1),y - dey - bpl :- - - lda tmpl - asl - asl - asl - tax - ldy #0 -: - lda _ctk_80col_screenpattern,x - sta (ptr2),y - iny - lda _ctk_80col_screenpattern+1,x - sta (ptr2),y - iny - lda _ctk_80col_screenpattern+2,x - sta (ptr2),y - iny - lda _ctk_80col_screenpattern+3,x - sta (ptr2),y - iny - lda _ctk_80col_screenpattern+4,x - sta (ptr2),y - iny - lda _ctk_80col_screenpattern+5,x - sta (ptr2),y - iny - lda _ctk_80col_screenpattern+6,x - sta (ptr2),y - iny - lda _ctk_80col_screenpattern+7,x - sta (ptr2),y - iny - bne :- - - inc ptr2+1 - -: - lda _ctk_80col_screenpattern,x - sta (ptr2),y - iny - lda _ctk_80col_screenpattern+1,x - sta (ptr2),y - iny - lda _ctk_80col_screenpattern+2,x - sta (ptr2),y - iny - lda _ctk_80col_screenpattern+3,x - sta (ptr2),y - iny - lda _ctk_80col_screenpattern+4,x - sta (ptr2),y - iny - lda _ctk_80col_screenpattern+5,x - sta (ptr2),y - iny - lda _ctk_80col_screenpattern+6,x - sta (ptr2),y - iny - lda _ctk_80col_screenpattern+7,x - sta (ptr2),y - iny - cpy #$40 - bne :- - - lda tmpl - cmp #24 - bne :+ - - sta _ctk_80col_cursy - lda #2 - sta _ctk_80col_cursx - - jsr restore01 - - lda #<_ctk_80col_versionstring - ldx #>_ctk_80col_versionstring - jsr pushax - lda _ctk_80col_versionstring_len - jmp _ctk_80col_cputsn -: - jmp restore01 -;--------------------------------------------------------------------- -_ctk_80col_draw_bitmapline: - sta tmpl - cmp #0 - bne :+ - rts -: - - jsr setupptrs - - ldy #0 - lda _ctk_80col_color -: - sta (ptr1),y - iny - cpy tmpl - bne :- - - lda _ctk_80col_bitmapptr - sta ptr1 - lda _ctk_80col_bitmapptr+1 - sta ptr1+1 - - ldy #0 - ldx #0 -: - lda (ptr1),y - sta (ptr2),y - iny - inx - cpx #8 - bne :- - - ldx #0 - - dec tmpl - bne :- - - jmp restore01 -;--------------------------------------------------------------------- -_ctk_80col_draw_windowborders: - - jsr setupptrs - - lda _ctk_80col_windowparams + wpclipy1 - beq :+ - jmp @nofirstline -: - - ;; Draw first line of the border, including the window title - - ;; Start with filling color memory - lda _ctk_80col_windowparams + wpw - sta tmpw - - - ldy #0 - lda _ctk_80col_windowparams + wptitlecolor -: - sta (ptr1),y - iny - cpy tmpw - bcc :- - - dec tmpw - - ;; Set color for upper right corner - sta (ptr1),y - iny - sta (ptr1),y - - - ;; Turn on font ROM for drawing the title - lda tmp01 - and #$f8 - ora #$01 - sta $01 - - ;; Use a temporary pointer (ptr3) rather than ptr2 so we can - ;; reuse it later. - lda ptr2 - sta ptr3 - lda ptr2+1 - sta ptr3+1 - - ;; Draw upper left corner - ldy #7 -: - lda _ctk_80col_theme+ulcornerpattern,y - sta (ptr3),y - dey - bpl :- - - lda ptr3 - clc - adc #$8 - sta ptr3 - bcc :+ - inc ptr3+1 -: - - - ;; Draw window title bar pattern -@titlebarloop: - ldy #7 -: - lda _ctk_80col_theme+titlebarpattern,y - sta (ptr3),y - dey - bpl :- - - lda ptr3 - clc - adc #$8 - sta ptr3 - bcc :+ - inc ptr3+1 -: - ;; Loop until we are three characters away from right border - ;; to avoid flickering since we would be overwriting the close - ;; button. - dec tmpw - bpl @titlebarloop - - ;; Draw upper right corner piece - ldy #7 -: - lda _ctk_80col_theme+urcornerpattern,y - sta (ptr3),y - dey - bpl :- - - -@nofirstline: - - - ldx _ctk_80col_windowparams + wph - inx - stx tmph - - ;; Draw left and right borders - - ;; Fill color memory (pointer in ptr1, setup by setupptrs) - - ;; First check how much we actually should draw by inspecting - ;; the clipy1 and clipy2 fields in the _ctk_80col_windowparams - ;; structure - - lda #1 - sta tmpy - - ldx _ctk_80col_windowparams + wpclipy1 -@clipy1loop: - cpx #0 - beq @clipy1loopend - lda ptr1 - clc - adc #$28 - sta ptr1 - bcc :+ - inc ptr1+1 -: - lda ptr3 - clc - adc #$40 - sta ptr3 - lda ptr3+1 - adc #1 - sta ptr3+1 - - inc tmpy - - dex - jmp @clipy1loop -@clipy1loopend: - - lda ptr1 - clc - adc #$28 - sta ptr1 - bcc :+ - inc ptr1+1 -: - - ldx tmpy - ldy _ctk_80col_windowparams + wpw - iny - sty tmpw -@bordercloop: - cpx _ctk_80col_windowparams + wpclipy2 - beq @bordercloopend - - ldy tmpw - lda _ctk_80col_windowparams + wpcolor2 - sta (ptr1),y - ldy #0 - lda _ctk_80col_windowparams + wpcolor1 - sta (ptr1),y - - lda ptr1 - clc - adc #$28 - sta ptr1 - bcc :+ - inc ptr1+1 -: - - inx - cpx tmph - bcc @bordercloop - beq @bordercloop -@bordercloopend: - - - ;; Fill color memory for lower border, if clipy2 allows - cpx _ctk_80col_windowparams + wpclipy2 - beq @noclowerborder - - lda ptr1 - sec - sbc #$28 - sta ptr1 - bcs :+ - dec ptr1+1 -: - - ldy _ctk_80col_windowparams + wpw - lda _ctk_80col_windowparams + wpcolor2 -@lbordercloop: - sta (ptr1),y - dey - bne @lbordercloop - -@noclowerborder: - - ;; Draw right border - ldx tmpy -@rborderloop: - cpx _ctk_80col_windowparams + wpclipy2 - beq @rborderloopend - - lda ptr3 - clc - adc #$40 - sta ptr3 - lda ptr3+1 - adc #1 - sta ptr3+1 - - ldy #7 -: - lda _ctk_80col_theme+rborderpattern,y - sta (ptr3),y - dey - bpl :- - - inx - cpx tmph - bne @rborderloop -@rborderloopend: - - cpx _ctk_80col_windowparams + wpclipy2 - beq @norbordercorner - - lda ptr3 - clc - adc #$40 - sta ptr3 - lda ptr3+1 - adc #1 - sta ptr3+1 - - ;; Draw lower right corner, if clipy2 allows it - ldy #7 -: - lda _ctk_80col_theme+lrcornerpattern,y - sta (ptr3),y - dey - bpl :- - -@norbordercorner: - - stx tmpy - - ;; Draw lower border - ldx _ctk_80col_windowparams + wpw - -@lowerborderloop: - lda ptr3 - sec - sbc #$8 - sta ptr3 - bcs :+ - dec ptr3+1 -: - - lda tmpy - cmp _ctk_80col_windowparams + wpclipy2 - beq @nolowerborder - - ldy #7 -: - lda _ctk_80col_theme+lowerborderpattern,y - sta (ptr3),y - dey - bpl :- -@nolowerborder: - - dex - bne @lowerborderloop - - lda ptr3 - sec - sbc #$8 - sta ptr3 - bcs :+ - dec ptr3+1 -: - - - ldx tmpy - cpx tmph - bne @nolbordercorner - - ;; Draw lower left corner, if clipy2 allows it - ldy #7 -: - lda _ctk_80col_theme+llcornerpattern,y - sta (ptr3),y - dey - bpl :- - - lda ptr3 - sec - sbc #$40 - sta ptr3 - lda ptr3+1 - sbc #1 - sta ptr3+1 - -@nolbordercorner: - - ;; Draw left border - - - -@lborderloop: - cpx #1 - beq @lborderloopend - cpx _ctk_80col_windowparams + wpclipy1 - bcc @lborderloopend - - ldy #7 -: - lda _ctk_80col_theme+lborderpattern,y - sta (ptr3),y - dey - bpl :- - - lda ptr3 - sec - sbc #$40 - sta ptr3 - lda ptr3+1 - sbc #1 - sta ptr3+1 - - dex - jmp @lborderloop - -@lborderloopend: - - - jmp restore01 -;--------------------------------------------------------------------- - \ No newline at end of file diff --git a/backyard/platform/c64/ctk/ctk-80col-asm.h b/backyard/platform/c64/ctk/ctk-80col-asm.h deleted file mode 100644 index 04a939657..000000000 --- a/backyard/platform/c64/ctk/ctk-80col-asm.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the "ctk" console GUI toolkit for cc65 - * - * $Id: ctk-80col-asm.h,v 1.1 2007/05/23 23:11:27 oliverschmidt Exp $ - * - */ - -#ifndef __CTK_80COL_ASM_H__ -#define __CTK_80COL_ASM_H__ - -void __fastcall__ ctk_80col_cclear(unsigned char len); -void __fastcall__ ctk_80col_chline(unsigned char len); -void __fastcall__ ctk_80col_cputc(unsigned char c); -void __fastcall__ ctk_80col_cputsn(unsigned char *str, - unsigned char len); - -void ctk_80col_draw_buttonleft(void); -void ctk_80col_draw_buttonright(void); - -struct ctk_80col_windowparams { - unsigned char w; - unsigned char h; - unsigned char clipy1; - unsigned char clipy2; - unsigned char color1; - unsigned char color2; - unsigned char titlecolor; - unsigned char titlelen; - char *title; -}; -extern struct ctk_80col_windowparams ctk_80col_windowparams; -void ctk_80col_draw_windowborders(void); - -extern unsigned char ctk_80col_cursx, - ctk_80col_cursy, - ctk_80col_color, - ctk_80col_reversed, - ctk_80col_underline; - - -void __fastcall__ ctk_80col_draw_bitmapline(unsigned char len); - -void __fastcall__ ctk_80col_clear_line(unsigned char len); - -#endif /* __CTK_80COL_ASM_H__ */ diff --git a/backyard/platform/c64/ctk/ctk-80col-theme.h b/backyard/platform/c64/ctk/ctk-80col-theme.h deleted file mode 100644 index 861deebdb..000000000 --- a/backyard/platform/c64/ctk/ctk-80col-theme.h +++ /dev/null @@ -1,83 +0,0 @@ - /* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop OS for the C64 - * - * $Id: ctk-80col-theme.h,v 1.1 2007/05/23 23:11:27 oliverschmidt Exp $ - * - */ -#ifndef __CTK_80COL_THEME_H__ -#define __CTK_80COL_THEME_H__ - -struct ctk_80col_theme { - /* Version string. */ - char version[8]; - - /* Window borders patterns. */ - unsigned char ulcorner[8], /* Upper left corner. */ - titlebar[8], /* Title bar pattern. */ - urcorner[8], /* Upper right corner. */ - rightborder[8], /* Right border. */ - lrcorner[8], /* Lower right corner. */ - lowerborder[8], /* Lower border. */ - llcorner[8], /* Lower left corner. */ - leftborder[8]; /* Left border. */ - - /* Button corner patterns. */ - unsigned char buttonleftpattern[8], - buttonrightpattern[8]; - - /* Menu border patterns. */ - unsigned char menuleftpattern[8], - menurightpattern[8]; - - - - /* Window and widget colors. */ - unsigned char windowcolors[6], - separatorcolors[6], - labelcolors[6], - buttoncolors[6], - hyperlinkcolors[6], - textentrycolors[6], - bitmapcolors[6], - textmapcolors[6], - iconcolors[6]; - - /* Menu colors. */ - unsigned char menucolor, - openmenucolor, - activemenucolor; - -}; - -extern struct ctk_80col_theme ctk_80col_theme; -extern struct ctk_80col_theme *ctk_80col_theme_ptr; - -#endif /* __CTK_80COL_THEME_H__ */ diff --git a/backyard/platform/c64/ctk/ctk-80col.c b/backyard/platform/c64/ctk/ctk-80col.c deleted file mode 100644 index b38a13700..000000000 --- a/backyard/platform/c64/ctk/ctk-80col.c +++ /dev/null @@ -1,1190 +0,0 @@ -/* - * Copyright (c) 2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - * $Id: ctk-80col.c,v 1.1 2007/05/23 23:11:27 oliverschmidt Exp $ - */ - -#include "contiki.h" - -#include "ctk/ctk.h" -#include "ctk/ctk-draw.h" -#include "ctk/ctk-draw-service.h" - -#include "ctk-80col-asm.h" -#include "ctk-80col-theme.h" - -#include - -unsigned char ctk_80col_cursx, ctk_80col_cursy; -unsigned char ctk_80col_reversed; -unsigned char ctk_80col_color; -unsigned char *ctk_80col_bitmapptr; -unsigned char ctk_80col_underline = 0; - -#define SCREEN_HEIGHT 25 -#define SCREEN_WIDTH 80 - -#define SCREENADDR 0xdc00 -#define HIRESADDR 0xe000 - -unsigned char ctk_80col_lefttab[256]; -unsigned char ctk_80col_righttab[256]; - -#define COLOR(bg, fg) ((fg << 4) | (bg)) - -#define COLOR_DIALOG 0x01 -#define COLOR_FOCUS_WINDOW 0xbf -#define COLOR_BACKGROUND_WINDOW 0x0c - -#define color(c) ctk_80col_color = c - -#define BGCOLOR1 7 -#define BGCOLOR2 10 -#define BGCOLOR3 4 -#define BGCOLOR4 6 - -unsigned char ctk_80col_screencolors[25] = - {COLOR(BGCOLOR4,BGCOLOR1), - COLOR(BGCOLOR2,BGCOLOR1), - COLOR(BGCOLOR2,BGCOLOR1),COLOR(BGCOLOR2,BGCOLOR1), - COLOR(BGCOLOR2,BGCOLOR1),COLOR(BGCOLOR2,BGCOLOR1), - COLOR(BGCOLOR2,BGCOLOR1),COLOR(BGCOLOR2,BGCOLOR1), - COLOR(BGCOLOR3,BGCOLOR2),COLOR(BGCOLOR3,BGCOLOR2), - COLOR(BGCOLOR3,BGCOLOR2),COLOR(BGCOLOR3,BGCOLOR2), - COLOR(BGCOLOR3,BGCOLOR2),COLOR(BGCOLOR3,BGCOLOR2), - COLOR(BGCOLOR3,BGCOLOR2),COLOR(BGCOLOR3,BGCOLOR2), - COLOR(BGCOLOR4,BGCOLOR3),COLOR(BGCOLOR4,BGCOLOR3), - COLOR(BGCOLOR4,BGCOLOR3),COLOR(BGCOLOR4,BGCOLOR3), - COLOR(BGCOLOR4,BGCOLOR3),COLOR(BGCOLOR4,BGCOLOR3), - COLOR(BGCOLOR4,BGCOLOR3),COLOR(BGCOLOR4,BGCOLOR3), - COLOR(BGCOLOR4,1)}; - -unsigned char ctk_80col_screenpattern[25*8] = - {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xdd,0xff,0x77,0xff,0xdd,0xff,0x77, - 0xff,0x55,0xff,0x55,0xff,0x55,0xff,0x55, - 0xee,0x55,0xbb,0x55,0xee,0x55,0xbb,0x55, - 0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55, - 0xaa,0x44,0xaa,0x11,0xaa,0x44,0xaa,0x11, - 0xaa,0x00,0xaa,0x00,0xaa,0x00,0xaa,0x00, - 0x88,0x00,0x22,0x00,0x88,0x00,0x22,0x00, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xdd,0xff,0x77,0xff,0xdd,0xff,0x77, - 0xff,0x55,0xff,0x55,0xff,0x55,0xff,0x55, - 0xee,0x55,0xbb,0x55,0xee,0x55,0xbb,0x55, - 0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55, - 0xaa,0x44,0xaa,0x11,0xaa,0x44,0xaa,0x11, - 0xaa,0x00,0xaa,0x00,0xaa,0x00,0xaa,0x00, - 0x88,0x00,0x22,0x00,0x88,0x00,0x22,0x00, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xdd,0xff,0x77,0xff,0xdd,0xff,0x77, - 0xff,0x55,0xff,0x55,0xff,0x55,0xff,0x55, - 0xee,0x55,0xbb,0x55,0xee,0x55,0xbb,0x55, - 0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55, - 0xaa,0x44,0xaa,0x11,0xaa,0x44,0xaa,0x11, - 0xaa,0x00,0xaa,0x00,0xaa,0x00,0xaa,0x00, - 0x88,0x00,0x22,0x00,0x88,0x00,0x22,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; - -unsigned short ctk_80col_yscreenaddr[25] = - {0 * 40 + SCREENADDR, 1 * 40 + SCREENADDR, - 2 * 40 + SCREENADDR, 3 * 40 + SCREENADDR, - 4 * 40 + SCREENADDR, 5 * 40 + SCREENADDR, - 6 * 40 + SCREENADDR, 7 * 40 + SCREENADDR, - 8 * 40 + SCREENADDR, 9 * 40 + SCREENADDR, - 10 * 40 + SCREENADDR, 11 * 40 + SCREENADDR, - 12 * 40 + SCREENADDR, 13 * 40 + SCREENADDR, - 14 * 40 + SCREENADDR, 15 * 40 + SCREENADDR, - 16 * 40 + SCREENADDR, 17 * 40 + SCREENADDR, - 18 * 40 + SCREENADDR, 19 * 40 + SCREENADDR, - 20 * 40 + SCREENADDR, 21 * 40 + SCREENADDR, - 22 * 40 + SCREENADDR, 23 * 40 + SCREENADDR, - 24 * 40 + SCREENADDR}; - -unsigned short ctk_80col_yhiresaddr[25] = - {0 * 320 + HIRESADDR, 1 * 320 + HIRESADDR, - 2 * 320 + HIRESADDR, 3 * 320 + HIRESADDR, - 4 * 320 + HIRESADDR, 5 * 320 + HIRESADDR, - 6 * 320 + HIRESADDR, 7 * 320 + HIRESADDR, - 8 * 320 + HIRESADDR, 9 * 320 + HIRESADDR, - 10 * 320 + HIRESADDR, 11 * 320 + HIRESADDR, - 12 * 320 + HIRESADDR, 13 * 320 + HIRESADDR, - 14 * 320 + HIRESADDR, 15 * 320 + HIRESADDR, - 16 * 320 + HIRESADDR, 17 * 320 + HIRESADDR, - 18 * 320 + HIRESADDR, 19 * 320 + HIRESADDR, - 20 * 320 + HIRESADDR, 21 * 320 + HIRESADDR, - 22 * 320 + HIRESADDR, 23 * 320 + HIRESADDR, - 24 * 320 + HIRESADDR}; - - -struct ctk_80col_theme ctk_80col_theme = - { - /* Version string. */ - /* char version[8]; */ - {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, - - /* Window borders patterns. */ - /* unsigned char ulcorner[8], */ /* Upper left corner. */ - {0xff,0xc0,0x80,0xbf,0x80,0xbf,0x80,0x80}, - - /* titlebar[8], */ /* Title bar pattern. */ - {0xff,0x00,0x00,0xff,0x00,0xff,0x00,0x00}, - - /* urcorner[8], */ /* Upper right corner. */ - {0xff,0x03,0x01,0xfd,0x01,0xfd,0x01,0x01}, - - /* rightborder[8], */ /* Right border. */ - {0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01}, - - /* lrcorner[8], */ /* Lower right corner. */ - {0x01,0x01,0x01,0x01,0x01,0x01,0x03,0xff}, - - /* lowerborder[8], */ /* Lower border. */ - {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff}, - - /* llcorner[8], */ /* Lower left corner. */ - {0x80,0x80,0x80,0x80,0x80,0x80,0xc0,0xff}, - - /* leftborder[8]; */ /* Left border. */ - {0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80}, - - /* Button corner patterns. */ - /* unsigned char buttonleft[8], */ - {0xc5,0xdf,0xdf,0xdf,0xdf,0xdf,0xdf,0xdf}, - - /* buttonright[8]; */ - {0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xa3}, - - /* Menu border patterns. */ - /* unsigned char menuleftpattern[8], */ - {0x0f,0x3f,0x3f,0x7f,0x7f,0xff,0xff,0xff}, - - /* menurightpatterns[8]; */ - {0xf0,0xfc,0xfc,0xfe,0xfe,0xff,0xff,0xff}, - - /* Window and widget colors. */ - /* unsigned char windowcolors[6], */ - {COLOR(COLOR_GRAY2, COLOR_BLACK), - COLOR(COLOR_GRAY2, COLOR_BLACK), - COLOR(COLOR_GRAY3, COLOR_GRAY1), - COLOR(COLOR_GRAY3, COLOR_GRAY1), - COLOR(COLOR_WHITE, COLOR_BLACK), - COLOR(COLOR_WHITE, COLOR_BLACK)}, - - /* separatorcolors[6], */ - {COLOR(COLOR_GRAY2, COLOR_GRAY1), - COLOR(COLOR_GRAY2, COLOR_GRAY1), - COLOR(COLOR_GRAY3, COLOR_GRAY2), - COLOR(COLOR_GRAY3, COLOR_GRAY2), - COLOR(COLOR_WHITE, COLOR_GRAY1), - COLOR(COLOR_WHITE, COLOR_GRAY1)}, - - /* labelcolors[6], */ - {COLOR(COLOR_GRAY2, COLOR_GRAY1), - COLOR(COLOR_GRAY2, COLOR_GRAY1), - COLOR(COLOR_WHITE, COLOR_BLACK), - COLOR(COLOR_WHITE, COLOR_BLACK), - COLOR(COLOR_WHITE, COLOR_BLACK), - COLOR(COLOR_WHITE, COLOR_BLACK)}, - - /* buttoncolors[6], */ - {COLOR(COLOR_GRAY2, COLOR_GRAY1), - COLOR(COLOR_GRAY1, COLOR_GRAY2), - COLOR(COLOR_GRAY3, COLOR_GRAY1), - COLOR(COLOR_GRAY1, COLOR_GRAY3), - COLOR(COLOR_GRAY3, COLOR_GRAY1), - COLOR(COLOR_GRAY1, COLOR_GRAY3)}, - - /* hyperlinkcolors[6], */ - {COLOR(COLOR_GRAY2, COLOR_LIGHTBLUE), - COLOR(COLOR_GRAY2, COLOR_LIGHTBLUE), - COLOR(COLOR_WHITE, COLOR_BLUE), - COLOR(COLOR_BLUE, COLOR_WHITE), - COLOR(COLOR_WHITE, COLOR_BLUE), - COLOR(COLOR_BLUE, COLOR_WHITE)}, - - /* textentrycolors[6], */ - {COLOR(COLOR_GRAY2, COLOR_GRAY1), - COLOR(COLOR_GRAY2, COLOR_BLACK), - COLOR(COLOR_WHITE, COLOR_BLACK), - COLOR(COLOR_WHITE, COLOR_BLACK), - COLOR(COLOR_GRAY3, COLOR_BLACK), - COLOR(COLOR_GRAY3, COLOR_BLACK)}, - - /* bitmapcolors[6], */ - {COLOR(COLOR_GRAY2, COLOR_GRAY1), - COLOR(COLOR_GRAY1, COLOR_BLACK), - COLOR(COLOR_WHITE, COLOR_GRAY1), - COLOR(COLOR_GRAY3, COLOR_BLACK), - COLOR(COLOR_GRAY3, COLOR_BLACK), - COLOR(COLOR_GRAY3, COLOR_BLACK)}, - - /* textmapcolors[6], */ - {COLOR(COLOR_GRAY2, COLOR_GRAY1), - COLOR(COLOR_GRAY2, COLOR_GRAY1), - COLOR(COLOR_WHITE, COLOR_BLACK), - COLOR(COLOR_WHITE, COLOR_BLACK), - COLOR(COLOR_WHITE, COLOR_BLACK), - COLOR(COLOR_WHITE, COLOR_BLACK)}, - - /* iconcolors[6]; */ - {COLOR(COLOR_GRAY3, COLOR_GRAY1), - COLOR(COLOR_GRAY1, COLOR_GRAY2), - COLOR(COLOR_WHITE, COLOR_BLACK), - COLOR(COLOR_BLUE, COLOR_WHITE), - COLOR(COLOR_WHITE, COLOR_BLACK), - COLOR(COLOR_BLACK, COLOR_YELLOW)}, - - /* Menu colors. */ - /* unsigned char menucolor,*/ - COLOR(COLOR_YELLOW, COLOR_BLACK), - - /* openmenucolor, */ - COLOR(COLOR_WHITE, COLOR_BLACK), - - /* activemenucolor; */ - COLOR(COLOR_BLACK, COLOR_WHITE), - - }; -char ctk_80col_versionstring[] = CONTIKI_VERSION_STRING; -char ctk_80col_versionstring_len = sizeof(CONTIKI_VERSION_STRING) - 1; - -struct ctk_80col_windowparams ctk_80col_windowparams; - -/*---------------------------------------------------------------------------*/ -/*void -ctk_arch_draw_char(char c, - unsigned char xpos, - unsigned char ypos, - unsigned char reversedflag, - unsigned char color) -{ - ctk_80col_cursx = xpos; - ctk_80col_cursy = ypos; - ctk_80col_reversed = reversedflag; - ctk_80col_color = color; - - ctk_80col_cputc(c); -}*/ -/*---------------------------------------------------------------------------*/ -#pragma optimize(push, off) -static void -nmi2(void) -{ - asm("pla"); - asm("sta $01"); - asm("pla"); - asm("rti"); -} -#pragma optimize(pop) -/*---------------------------------------------------------------------------*/ -#pragma optimize(push, off) -static void -nmi(void) -{ - asm("sei"); - asm("pha"); - asm("inc $d020"); - asm("lda $01"); - asm("pha"); - asm("lda #$36"); - asm("sta $01"); - asm("lda #>_nmi2"); - asm("pha"); - asm("lda #<_nmi2"); - asm("pha"); - asm("php"); - asm("jmp ($0318)"); - - nmi2(); -} -#pragma optimize(pop) -/*---------------------------------------------------------------------------*/ -#pragma optimize(push, off) -static void -setup_nmi(void) -{ - asm("lda #<_nmi"); - asm("sta $fffa"); - asm("lda #>_nmi"); - asm("sta $fffb"); - return; - nmi(); -} -#pragma optimize(pop) -/*---------------------------------------------------------------------------*/ -void reset(void); -void -quit(void) -{ - VIC.ctrl1 = 0x1b; /* $D011 */ - VIC.addr = 0x17; /* $D018 */ - VIC.ctrl2 = 0xc8; /* $D016 */ - CIA2.pra = 0x03; /* $DD00 */ - - VIC.bordercolor = 0x0e; /* $D020 */ - VIC.bgcolor0 = 0x06; /* $D021 */ - - memset((char *)0xd800, 0x0e, 40*25); - -} -/*-----------------------------------------------------------------------------------*/ -#pragma optimize(push, off) -static void -ctk_80col_init(void) -{ - int i; - - setup_nmi(); - - /* Turn on hires mode, bank 0 ($c000 - $ffff) and $e000/$c000 for - hires/colors. */ - VIC.ctrl1 = 0x3b; /* $D011 */ - VIC.addr = 0x78; /* $D018 */ - VIC.ctrl2 = 0xc8; /* $D016 */ - CIA2.pra = 0x00; /* $DD00 */ - - VIC.bordercolor = 0x06; /* $D020 */ - VIC.bgcolor0 = 0x0b; /* $D021 */ - - /* Fill color memory. */ - asm("sei"); - asm("lda $01"); - asm("pha"); - asm("lda #$30"); - asm("sta $01"); - asm("ldx #0"); - asm("lda #$0"); - asm("fillcolorloop:"); - asm("sta $dc00,x"); - asm("sta $dd00,x"); - asm("sta $de00,x"); - asm("sta $df00,x"); - asm("inx"); - asm("bne fillcolorloop"); - - /* Setup sprite pointers */ - asm("ldx #$fd"); - asm("stx $dff8"); - asm("inx"); - asm("stx $dff9"); - asm("pla"); - asm("sta $01"); - asm("cli"); - - /* Fill hires memory with 0. */ - - memset((char *)0xe000, 0, 8000); - - for(i = 0; i < 256; ++i) { -#if 0 - ctk_80col_lefttab[i] = - ((i & 0x40) << 1) | - ((i & 0x20) << 1) | - ((i & 0x08) << 2) | - ((i & 0x02) << 3); - ctk_80col_righttab[i] = - ((i & 0x40) >> 3) | - ((i & 0x20) >> 3) | - ((i & 0x08) >> 2) | - ((i & 0x02) >> 1); -#else - ctk_80col_lefttab[i] = - ((i & 0x40) << 1) | - ((i & 0x10) << 2) | - ((i & 0x04) << 3) | - ((i & 0x01) << 4); - ctk_80col_righttab[i] = - ((i & 0x40) >> 3) | - ((i & 0x10) >> 2) | - ((i & 0x04) >> 1) | - ((i & 0x01)); -#endif - } - -#if 0 - /* Setup mouse pointer sprite. */ - asm("lda %v+%w", ctk_80col_theme, - offsetof(struct ctk_80col_theme, pointermaskcolor)); - asm("sta $d027"); - asm("lda %v+%w", ctk_80col_theme, - offsetof(struct ctk_80col_theme, pointercolor)); - asm("sta $d028"); - - ptr1 = ctk_80col_theme.pointer; - ptr2 = (unsigned char *)0xff40; - - for(i = 0; i < 0x80; ++i) { - *ptr2++ = *ptr1++; - } -#endif - return; -} -#pragma optimize(pop) -/*---------------------------------------------------------------------------*/ -/*static unsigned char cursx, cursy; - static unsigned char reversed;*/ - -/*-----------------------------------------------------------------------------------*/ -static void CC_FASTCALL -cputc(char c) -{ - /* ctk_arch_draw_char(c, cursx, cursy, reversed, 0);*/ - ctk_80col_cputc(c); - /* ++cursx;*/ -} -/*-----------------------------------------------------------------------------------*/ -unsigned char -wherex(void) -{ - return ctk_80col_cursx; -} -/*-----------------------------------------------------------------------------------*/ -unsigned char -wherey(void) -{ - return ctk_80col_cursy; -} -/*-----------------------------------------------------------------------------------*/ -/*void -clrscr(void) -{ - unsigned char x, y; - - for(x = 0; x < SCREEN_WIDTH; ++x) { - for(y = 0; y < SCREEN_HEIGHT; ++y) { - gotoxy(x, y); - cputc(' '); - } - } -}*/ -/*-----------------------------------------------------------------------------------*/ -#define revers(c) ctk_80col_reversed = c -/*-----------------------------------------------------------------------------------*/ -static void CC_FASTCALL -_cputs(char *str) -{ - char *ptr = str; - - while(*ptr != 0) { - cputc(*ptr++); - } - - /* int i; - for(i = 0; i < strlen(str); ++i) { - cputc(str[i]); - }*/ -} -/*-----------------------------------------------------------------------------------*/ -static void CC_FASTCALL -cclear(unsigned char length) -{ - int i; - for(i = 0; i < length; ++i) { - cputc(' '); - } -} -/*-----------------------------------------------------------------------------------*/ -void CC_FASTCALL -chline(unsigned char length) -{ - int i; - for(i = 0; i < length; ++i) { - cputc('-'); - } -} -/*-----------------------------------------------------------------------------------*/ -void CC_FASTCALL -cvline(unsigned char length) -{ - int i; - for(i = 0; i < length; ++i) { - cputc('|'); - --ctk_80col_cursx; - ++ctk_80col_cursy; - } -} -/*-----------------------------------------------------------------------------------*/ -void CC_FASTCALL -gotoxy(unsigned char x, unsigned char y) -{ - ctk_80col_cursx = x; - ctk_80col_cursy = y; -} -/*-----------------------------------------------------------------------------------*/ -void CC_FASTCALL -cclearxy(unsigned char x, unsigned char y, unsigned char length) -{ - gotoxy(x, y); - cclear(length); -} -/*-----------------------------------------------------------------------------------*/ -void CC_FASTCALL -chlinexy(unsigned char x, unsigned char y, unsigned char length) -{ - gotoxy(x, y); - chline(length); -} -/*-----------------------------------------------------------------------------------*/ -void CC_FASTCALL -cvlinexy(unsigned char x, unsigned char y, unsigned char length) -{ - gotoxy(x, y); - cvline(length); -} -/*-----------------------------------------------------------------------------------*/ -void CC_FASTCALL -_cputsxy(unsigned char x, unsigned char y, char *str) -{ - gotoxy(x, y); - _cputs(str); -} -/*-----------------------------------------------------------------------------------*/ -void CC_FASTCALL -cputcxy(unsigned char x, unsigned char y, char c) -{ - gotoxy(x, y); - cputc(c); -} -/*-----------------------------------------------------------------------------------*/ -/*void CC_FASTCALL -screensize(unsigned char *x, unsigned char *y) -{ - *x = SCREEN_WIDTH; - *y = SCREEN_HEIGHT; -}*/ -/*-----------------------------------------------------------------------------------*/ -/*static unsigned char sizex, sizey;*/ -/*-----------------------------------------------------------------------------------*/ -static void -_cputsn(char *str, unsigned char len) -{ - /* char c; - - while(len > 0) { - --len; - c = *str; - if(c == 0) { - break; - } - cputc(c); - ++str; - }*/ - ctk_80col_cputsn(str, len); -} -/*-----------------------------------------------------------------------------------*/ -static void -s_ctk_draw_init(void) -{ - ctk_80col_init(); - - /* screensize(&sizex, &sizey);*/ - - ctk_draw_clear(0, SCREEN_HEIGHT); -} -/*-----------------------------------------------------------------------------------*/ -static void -draw_widget(struct ctk_widget *w, - unsigned char x, unsigned char y, - unsigned char clipx, - unsigned char clipy, - unsigned char clipy1, unsigned char clipy2, - unsigned char focus) -{ - unsigned char xpos, ypos, xscroll; - unsigned char i, j; - char c, *text; - unsigned char len, wfocus; - - wfocus = 0; - if(focus & CTK_FOCUS_WINDOW) { - if(focus & CTK_FOCUS_WIDGET) { - wfocus = 1; - } - } else if(focus & CTK_FOCUS_DIALOG) { - if(focus & CTK_FOCUS_WIDGET) { - wfocus = 1; - } - } else { - } - - xpos = x + w->x; - ypos = y + w->y; - - switch(w->type) { - case CTK_WIDGET_SEPARATOR: - if(ypos >= clipy1 && ypos < clipy2) { - chlinexy(xpos, ypos, w->w); - } - break; - case CTK_WIDGET_LABEL: - text = w->widget.label.text; - for(i = 0; i < w->h; ++i) { - if(ypos >= clipy1 && ypos < clipy2) { - gotoxy(xpos, ypos); - _cputsn(text, w->w); - if(w->w - (wherex() - xpos) > 0) { - cclear(w->w - (wherex() - xpos)); - } - } - ++ypos; - text += w->w; - } - break; - case CTK_WIDGET_BUTTON: - if(ypos >= clipy1 && ypos < clipy2) { - if(wfocus != 0) { - revers(1); - } else { - revers(0); - } - cputcxy(xpos, ypos, '['); - _cputsn(w->widget.button.text, w->w); - cputc(']'); - revers(0); - } - break; - case CTK_WIDGET_HYPERLINK: - if(ypos >= clipy1 && ypos < clipy2) { - if(wfocus != 0) { - revers(0); - } else { - revers(1); - } - gotoxy(xpos, ypos); - _cputsn(w->widget.button.text, w->w); - revers(0); - } - break; - case CTK_WIDGET_TEXTENTRY: - text = w->widget.textentry.text; - xscroll = 0; - if(w->widget.textentry.xpos >= w->w - 1) { - xscroll = w->widget.textentry.xpos - w->w + 1; - } - for(j = 0; j < w->h; ++j) { - if(ypos >= clipy1 && ypos < clipy2) { - if(w->widget.textentry.state == CTK_TEXTENTRY_EDIT && - w->widget.textentry.ypos == j) { - revers(0); - cputcxy(xpos, ypos, '>'); - c = 1; - for(i = 0; i < w->w; ++i) { - if(c != 0) { - c = text[i + xscroll]; - } - if(i == w->widget.textentry.xpos - xscroll) { - revers(1); - } else { - revers(0); - } - if(c == 0) { - cputc(' '); - } else { - cputc(c); - } - revers(0); - } - cputc('<'); - } else { - if(wfocus != 0 && j == w->widget.textentry.ypos) { - revers(1); - } else { - revers(0); - } - cvlinexy(xpos, ypos, 1); - gotoxy(xpos + 1, ypos); - _cputsn(text, w->w); - i = wherex(); - if(i - xpos - 1 < w->w) { - cclear(w->w - (i - xpos) + 1); - } - cvline(1); - } - } - ++ypos; - text += w->widget.textentry.len + 1; - } - revers(0); - break; - case CTK_WIDGET_ICON: - if(ypos >= clipy1 && ypos < clipy2) { - color(ctk_80col_theme.iconcolors[focus]); - - /* if(focus & 1) { - - revers(1); - } else { - revers(0); - }*/ - /* gotoxy(xpos, ypos);*/ - if(xpos >= 73) { - xpos = 73; - } - if(xpos <= 2) { - xpos = 2; - } - if(w->widget.icon.textmap != NULL) { - ctk_80col_bitmapptr = w->widget.icon.bitmap; - for(i = 0; i < 3; ++i) { - if(ypos >= clipy1 && ypos < clipy2) { - gotoxy(xpos, ypos); - ctk_80col_draw_bitmapline(3); - } - ctk_80col_bitmapptr += 3 * 8; - ++ypos; - } - } - x = xpos; - - len = strlen(w->widget.icon.title); - if(x + len >= SCREEN_WIDTH) { - x = SCREEN_WIDTH - len; - } - - if(ypos >= clipy1 && ypos < clipy2) { - len = strlen(w->widget.icon.title); - gotoxy((x & 0xfe) + 1, ypos); - ctk_80col_cclear((len - 1)/ 2); - gotoxy(x, ypos); - ctk_80col_cputsn(w->widget.icon.title, len); - } - revers(0); - } - break; - - default: - break; - } -} -/*-----------------------------------------------------------------------------------*/ -static void -s_ctk_draw_widget(struct ctk_widget *w, - unsigned char focus, - unsigned char clipy1, - unsigned char clipy2) -{ - struct ctk_window *win = w->window; - unsigned char posx, posy; - - posx = (win->x & 0xfe) + 1; - posy = win->y + 2; - - if(w == win->focused) { - focus |= CTK_FOCUS_WIDGET; - } - - draw_widget(w, posx, posy, - posx + win->w, - posy + win->h, - clipy1, clipy2, - focus); - -#ifdef CTK_CONIO_CONF_UPDATE - CTK_CONIO_CONF_UPDATE(); -#endif /* CTK_CONIO_CONF_UPDATE */ -} -/*-----------------------------------------------------------------------------------*/ -static void -s_ctk_draw_clear_window(struct ctk_window *window, - unsigned char focus, - unsigned char clipy1, - unsigned char clipy2) -{ - unsigned char i; - unsigned char h; - - if(focus & CTK_FOCUS_WINDOW) { - color(COLOR_FOCUS_WINDOW); - } else { - color(COLOR_BACKGROUND_WINDOW); - } - - h = window->y + 2 + window->h; - /* Clear window contents. */ - for(i = window->y + 2; i < h; ++i) { - if(i >= clipy1 && i < clipy2) { - gotoxy((window->x & 0xfe) + 1, i); - ctk_80col_cclear((window->w + 1)/2); - } - } -} -/*-----------------------------------------------------------------------------------*/ -static void -draw_window_contents(struct ctk_window *window, unsigned char focus, - unsigned char clipy1, unsigned char clipy2, - unsigned char x1, unsigned char x2, - unsigned char y1, unsigned char y2) -{ - struct ctk_widget *w; - unsigned char wfocus; - - /* Draw inactive widgets. */ - for(w = window->inactive; w != NULL; w = w->next) { - draw_widget(w, x1, y1, x2, y2, - clipy1, clipy2, - focus); - } - - /* Draw active widgets. */ - for(w = window->active; w != NULL; w = w->next) { - wfocus = focus; - if(w == window->focused) { - wfocus |= CTK_FOCUS_WIDGET; - } - - draw_widget(w, x1, y1, x2, y2, - clipy1, clipy2, - wfocus); - } - -#ifdef CTK_CONIO_CONF_UPDATE - CTK_CONIO_CONF_UPDATE(); -#endif /* CTK_CONIO_CONF_UPDATE */ - -} -/*-----------------------------------------------------------------------------------*/ -static void -s_ctk_draw_window(struct ctk_window *window, unsigned char focus, - unsigned char clipy1, unsigned char clipy2, - unsigned char draw_borders) -{ - unsigned char x, y; - unsigned char h; - unsigned char x1, y1, x2, y2; - - - if(window->y + 1 >= clipy2) { - return; - } - - x = window->x & 0xfe; - y = window->y + 1; - -/* if(focus & CTK_FOCUS_WINDOW) { - } else { - }*/ - - x1 = x + 1; - y1 = y + 1; - x2 = x1 + window->w; - y2 = y1 + window->h; - - /* Draw window frame. */ - gotoxy(x, y); - ctk_80col_windowparams.w = (window->w-1)/2; - ctk_80col_windowparams.h = window->h; - if(clipy1 < y) { - ctk_80col_windowparams.clipy1 = 0; - } else { - ctk_80col_windowparams.clipy1 = clipy1 - y; - } - ctk_80col_windowparams.clipy2 = clipy2 - y + 1; - ctk_80col_windowparams.color1 = ctk_80col_theme.windowcolors[focus]; - ctk_80col_windowparams.color2 = ctk_80col_theme.windowcolors[focus]; - ctk_80col_windowparams.titlecolor = ctk_80col_theme.windowcolors[focus+1]; - ctk_80col_windowparams.title = window->title; - ctk_80col_windowparams.titlelen = window->titlelen/2; - - if(ctk_80col_windowparams.clipy1 < ctk_80col_windowparams.clipy2 && - ctk_80col_windowparams.clipy2 > 0) { - ctk_80col_draw_windowborders(); - } - /* - if(y >= clipy1) { - cputcxy(x, y, CH_ULCORNER); - gotoxy(wherex() + window->titlelen + CTK_CONF_WINDOWMOVE * 2, wherey()); - chline(window->w - (wherex() - x) - 2); - cputcxy(x2, y, CH_URCORNER); - } - - h = window->h; - - if(clipy1 > y1) { - if(clipy1 - y1 < h) { - h = clipy1 - y1; - y1 = clipy1; - } else { - h = 0; - } - } - - if(clipy2 < y1 + h) { - if(y1 >= clipy2) { - h = 0; - } else { - h = clipy2 - y1; - } - } - - cvlinexy(x, y1, h); - cvlinexy(x2, y1, h); - - if(y + window->h >= clipy1 && - y + window->h < clipy2) { - cputcxy(x, y2, CH_LLCORNER); - chlinexy(x1, y2, window->w); - cputcxy(x2, y2, CH_LRCORNER); - } - */ - if(ctk_mode_get() != CTK_MODE_WINDOWMOVE) { - draw_window_contents(window, focus, clipy1, clipy2, - x1, x2, y + 1, y2); - } -} -/*-----------------------------------------------------------------------------------*/ -static void -s_ctk_draw_dialog(struct ctk_window *dialog) -{ - unsigned char x, y; - unsigned char i; - unsigned char x1, y1, x2, y2; - - - x = dialog->x & 0xfe; - y = dialog->y + 1; - - - x1 = x + 1; - y1 = y + 1; - x2 = x1 + dialog->w; - y2 = y1 + dialog->h; - - - /* Draw dialog frame. */ - - /* cvlinexy(x, y1, - dialog->h); - cvlinexy(x2, y1, - dialog->h); - - chlinexy(x1, y, - dialog->w); - chlinexy(x1, y2, - dialog->w); - - cputcxy(x, y, CH_ULCORNER); - cputcxy(x, y2, CH_LLCORNER); - cputcxy(x2, y, CH_URCORNER); - cputcxy(x2, y2, CH_LRCORNER); - */ - gotoxy(x, y); - ctk_80col_windowparams.w = (dialog->w-1)/2; - ctk_80col_windowparams.h = dialog->h; - ctk_80col_windowparams.clipy1 = 0; - ctk_80col_windowparams.clipy2 = SCREEN_HEIGHT; - ctk_80col_windowparams.color1 = ctk_80col_theme.windowcolors[4]; - ctk_80col_windowparams.color2 = ctk_80col_theme.windowcolors[4]; - ctk_80col_windowparams.titlecolor = ctk_80col_theme.windowcolors[5]; - - ctk_80col_draw_windowborders(); - - /* Clear dialog contents. */ - color(COLOR_DIALOG); - for(i = y1; i < y2; ++i) { - gotoxy((x1 & 0xfe) + 2, i); - ctk_80col_cclear((dialog->w + 1)/2 - 2); - /* cclearxy(x1, i, dialog->w);*/ - } - - draw_window_contents(dialog, CTK_FOCUS_DIALOG, 0, SCREEN_HEIGHT, - x1, x2, y1, y2); -} -/*-----------------------------------------------------------------------------------*/ -static void -s_ctk_draw_clear(unsigned char y1, unsigned char y2) -{ - unsigned char i; - - - for(i = y1; i < y2; ++i) { - - ctk_80col_clear_line(i); - } -} -/*-----------------------------------------------------------------------------------*/ -static void -draw_menu(struct ctk_menu *m) -{ - unsigned char x, x2, y; - - color(ctk_80col_theme.openmenucolor); - - revers(0); - x = wherex(); - _cputs(m->title); - cputc(' '); - x2 = wherex(); - if(x + CTK_CONF_MENUWIDTH > SCREEN_WIDTH) { - x = SCREEN_WIDTH - CTK_CONF_MENUWIDTH - 2; - } - - for(y = 0; y < m->nitems; ++y) { - if(y == m->active) { - color(ctk_80col_theme.activemenucolor); - } else { - color(ctk_80col_theme.openmenucolor); - } - gotoxy(x, y + 1); - ctk_80col_cclear(CTK_CONF_MENUWIDTH/2); - - gotoxy(x, y + 1); - if(m->items[y].title[0] == '-') { - chline(CTK_CONF_MENUWIDTH); - } else { - /* _cputs(m->items[y].title);*/ - ctk_80col_cputsn(m->items[y].title, m->items[y].titlelen); - } - /* if(x + CTK_CONF_MENUWIDTH > wherex()) { - cclear(x + CTK_CONF_MENUWIDTH - wherex()); - }*/ - - } - gotoxy(x2, 0); - revers(1); - -} -/*-----------------------------------------------------------------------------------*/ -static void -s_ctk_draw_menus(struct ctk_menus *menus) -{ - struct ctk_menu *m; - - memcpy((char *)0xe000, ctk_80col_theme.menuleftpattern, 8); - /* Draw menus */ - gotoxy(2, 0); - - revers(1); - for(m = menus->menus->next; m != NULL; m = m->next) { - color(ctk_80col_theme.menucolor); - if(m != menus->open) { - /* _cputs(m->title);*/ - ctk_80col_cputsn(m->title, m->titlelen); - cputc(' '); - } else { - draw_menu(m); - } - } - - color(ctk_80col_theme.menucolor); - - if(wherex() + strlen(menus->desktopmenu->title) + 2 >= SCREEN_WIDTH) { - gotoxy(SCREEN_WIDTH - strlen(menus->desktopmenu->title) - 2, 0); - } else { - cclear(SCREEN_WIDTH - wherex() - - strlen(menus->desktopmenu->title) - 2); - } - - /* Draw desktopmenu */ - if(menus->desktopmenu != menus->open) { - ctk_80col_cputsn(menus->desktopmenu->title, menus->desktopmenu->titlelen); - } else { - draw_menu(menus->desktopmenu); - } - - /* gotoxy(78, 0); - color(ctk_80col_screencolors[0]); - cputc(' '); - cputc(' '); */ - - revers(0); - memcpy((char *)0xe138, ctk_80col_theme.menurightpattern, 8); -} -/*-----------------------------------------------------------------------------------*/ -static unsigned char -s_ctk_draw_height(void) -{ - return SCREEN_HEIGHT; -} -/*-----------------------------------------------------------------------------------*/ -static unsigned char -s_ctk_draw_width(void) -{ - return SCREEN_WIDTH; -} -/*-----------------------------------------------------------------------------------*/ -static unsigned short -s_ctk_mouse_xtoc(unsigned short x) -{ - return x / 4; -} -/*-----------------------------------------------------------------------------------*/ -static unsigned short -s_ctk_mouse_ytoc(unsigned short y) -{ - return y / 8; -} -/*-----------------------------------------------------------------------------------*/ - -SERVICE(ctk_hires_service, ctk_draw_service, -{ 1, - 1, - 1, - s_ctk_draw_init, - s_ctk_draw_clear, - s_ctk_draw_clear_window, - s_ctk_draw_window, - s_ctk_draw_dialog, - s_ctk_draw_widget, - s_ctk_draw_menus, - s_ctk_draw_width, - s_ctk_draw_height, - s_ctk_mouse_xtoc, - s_ctk_mouse_ytoc }); - -/*--------------------------------------------------------------------------*/ - -PROCESS(ctk_hires_service_process, "CTK hires service"); - -PROCESS_THREAD(ctk_hires_service_process, ev, data) { - PROCESS_BEGIN(); - - s_ctk_draw_init(); - ctk_restore(); - - SERVICE_REGISTER(ctk_hires_service); - - while(ev != PROCESS_EVENT_SERVICE_REMOVED && - ev != PROCESS_EVENT_EXIT) { - PROCESS_WAIT_EVENT(); - } - - SERVICE_REMOVE(ctk_hires_service); - - VIC.ctrl1 = 0x1b; /* $D011 */ - VIC.addr = 0x17; /* $D018 */ - VIC.ctrl2 = 0xc8; /* $D016 */ - CIA2.pra = 0x03; /* $DD00 */ - - PROCESS_END(); -} -/*--------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/ctk/ctk-arch.h b/backyard/platform/c64/ctk/ctk-arch.h deleted file mode 100644 index a7b48760e..000000000 --- a/backyard/platform/c64/ctk/ctk-arch.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2002, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the "ctk" console GUI toolkit for cc65 - * - * $Id: ctk-arch.h,v 1.1 2007/05/23 23:11:27 oliverschmidt Exp $ - * - */ - -#ifndef __CTK_ARCH_H__ -#define __CTK_ARCH_H__ - -#if CTK_HIRES -#include "ctk-hires.h" -#endif - -#if CTK_CONIO -#include "ctk-conio.h" -#endif - -#if CTK_VNCSERVER -#include "ctk-vncarch.h" -#endif - -#include - -#define ctk_arch_isprint(c) isprint(c) - -#endif /* __CTK_ARCH_H__ */ diff --git a/backyard/platform/c64/ctk/ctk-hires-asm.S b/backyard/platform/c64/ctk/ctk-hires-asm.S deleted file mode 100644 index 8d5251044..000000000 --- a/backyard/platform/c64/ctk/ctk-hires-asm.S +++ /dev/null @@ -1,934 +0,0 @@ - -;--------------------------------------------------------------------- - .importzp ptr1, ptr2, ptr3, ptr4, sreg - .importzp sp - - .import incsp2 - - - .import _ctk_hires_cursx - .import _ctk_hires_cursy - .import _ctk_hires_color - .import _ctk_hires_underline - .import _ctk_hires_reversed - - .import _ctk_hires_yscreenaddr - .import _ctk_hires_yhiresaddr - - .import _ctk_hires_windowparams - - .import _ctk_hires_bitmapptr - - .import _ctk_hires_theme - - .export _ctk_hires_cclear - .export _ctk_hires_chline - .export _ctk_hires_cputc - .export _ctk_hires_cputsn - - .export _ctk_hires_draw_buttonleft - .export _ctk_hires_draw_buttonright - - .export _ctk_hires_draw_windowborders - - .export _ctk_hires_draw_bitmapline -;--------------------------------------------------------------------- - -ptr5 = sreg - - ;; Offsets in the theme struct - - ulcornerpattern = 8 - titlebarpattern = ulcornerpattern+8 - urcornerpattern = titlebarpattern+8 - rborderpattern = urcornerpattern+8 - lrcornerpattern = rborderpattern+8 - lowerborderpattern = lrcornerpattern+8 - llcornerpattern = lowerborderpattern+8 - lborderpattern = llcornerpattern+8 - - - buttonleftpattern = lborderpattern+8 - buttonrightpattern = buttonleftpattern+8 - - -.bss -tmp01: .res 1 -tmpl: .res 1 -tmpf: .res 1 -tmpc: .res 1 -tmpw: .res 1 -tmpptr: .res 2 - -tmpy: .res 1 -tmph: .res 1 - - ;; Window border parameters -w: .res 1 -wpw = 0 -h: .res 1 -wph = 1 -clipy1: .res 1 -wpclipy1 = 2 -clipy2: .res 1 -wpclipy2 = 3 -color1: .res 1 -wpcolor1 = 4 -color2: .res 1 -wpcolor2 = 5 -titlelen: .res 1 -wptitlelen = 6 -title: .res 2 -wptitle = 7 - -;--------------------------------------------------------------------- -.data -;--------------------------------------------------------------------- -.code -setupptrs: - ;; Find hires address. - lda _ctk_hires_cursy - asl - tax - lda _ctk_hires_yhiresaddr,x - sta ptr2 - lda _ctk_hires_yhiresaddr+1,x - sta ptr2+1 - - ;; Add X coordinate to the hires address. - lda #0 - sta ptr1+1 - lda _ctk_hires_cursx - asl - rol ptr1+1 - asl - rol ptr1+1 - asl - rol ptr1+1 - clc - adc ptr2 - sta ptr2 - lda ptr2+1 - adc ptr1+1 - sta ptr2+1 - - - ;; Find screen address. - lda _ctk_hires_cursy - asl - tax - lda _ctk_hires_yscreenaddr,x - clc - adc _ctk_hires_cursx - sta ptr1 - lda _ctk_hires_yscreenaddr+1,x - adc #0 - sta ptr1+1 - - ;; Turn off interrupts, prepare $01 to store color data in RAM - ;; under I/O area. - sei - lda $01 - sta tmp01 - and #$f8 - sta $01 - rts -;--------------------------------------------------------------------- -restore01: - lda tmp01 - sta $01 - cli - rts -;--------------------------------------------------------------------- -_ctk_hires_cclear: - sta tmpl - cmp #0 - bne @norts - rts -@norts: - - jsr setupptrs - - ;; Store color value in color memory - - ldy tmpl - dey - lda _ctk_hires_color -@loop0: - sta (ptr1),y - dey - bpl @loop0 - - ;; Store either $00 or $ff in hires memory, depending on the - ;; reversed flag - - ldx tmpl - lda _ctk_hires_reversed - beq @noff - lda #$ff -@noff: - sta tmpf -@loop1: - ldy #7 - lda tmpf -@loop2: - sta (ptr2),y - dey - bpl @loop2 - - lda ptr2 - clc - adc #8 - sta ptr2 - bcc @noinc - inc ptr2+1 -@noinc: - - inc _ctk_hires_cursx - - dex - bne @loop1 - - jmp restore01 -;--------------------------------------------------------------------- -_ctk_hires_chline: - sta tmpl - cmp #0 - bne @norts - rts -@norts: - - jsr setupptrs - - ;; Store color value in color memory - - ldy tmpl - dey - lda _ctk_hires_color -@loop0: - sta (ptr1),y - dey - bpl @loop0 - - ;; Store horizontal line pattern in hires memory - ldx tmpl -@loop1: - ldy #0 - lda #$00 - sta (ptr2),y - iny - lda #$00 - sta (ptr2),y - iny - lda #$00 - sta (ptr2),y - iny - lda #$ff - sta (ptr2),y - iny - lda #$ff - sta (ptr2),y - iny - lda #$00 - sta (ptr2),y - iny - lda #$00 - sta (ptr2),y - iny - lda #$00 - sta (ptr2),y - - - lda ptr2 - clc - adc #8 - sta ptr2 - bcc @noinc - inc ptr2+1 -@noinc: - - inc _ctk_hires_cursx - - dex - bne @loop1 - - jmp restore01 -;--------------------------------------------------------------------- -_ctk_hires_cputc: - sta tmpc - - jsr setupptrs - - ldy #0 - lda _ctk_hires_color - sta (ptr1),y - - ;; Turn on font ROM - lda tmp01 - and #$f8 - ora #$01 - sta $01 - - lda #0 - sta ptr1+1 - - ;; Convert from PETSCII to screen encoding - lda tmpc - eor #$e0 - clc - adc #$20 - bpl @cont - adc #$40 - bpl @cont - eor #$a0 -@cont: - ldx _ctk_hires_reversed - beq :+ - eor #$80 -: - - ;; Convert to address in character ROM - asl - rol ptr1+1 - asl - rol ptr1+1 - asl - rol ptr1+1 - sta ptr1 - lda #$d8 - adc ptr1+1 - sta ptr1+1 - - ;; Print on hires screen, bottom-up. If we should underline, - ;; we do this by eor:ing the bottom line with #$ff - ldy #7 - lda (ptr1),y - ldx _ctk_hires_underline - beq @nounderline - eor #$ff -@nounderline: - sta (ptr2),y - dey -@loop: - lda (ptr1),y - sta (ptr2),y - dey - bpl @loop - - inc _ctk_hires_cursx - - jmp restore01 -;--------------------------------------------------------------------- -_ctk_hires_cputsn: - sta tmpl - cmp #0 - bne :+ - rts -: - - jsr setupptrs - - ldy tmpl - dey - lda _ctk_hires_color -@loop0: - sta (ptr1),y - dey - bpl @loop0 - - ;; Turn on font ROM - lda tmp01 - and #$f8 - ora #$01 - sta $01 - - - ;; Output each character from the string - lda #0 - sta tmpc - ldy #0 - lda (sp),y - sta ptr3 - iny - lda (sp),y - sta ptr3+1 - -@loop1: - - lda #0 - sta ptr1+1 - - ldy tmpc - lda (ptr3),y - beq @end - - ;; Convert from PETSCII to screen encoding - eor #$e0 - clc - adc #$20 - bpl @cont - adc #$40 - bpl @cont - eor #$a0 -@cont: - ldx _ctk_hires_reversed - beq :+ - eor #$80 -: - - ;; Convert to address in character ROM - asl - rol ptr1+1 - asl - rol ptr1+1 - asl - rol ptr1+1 - sta ptr1 - lda #$d8 - adc ptr1+1 - sta ptr1+1 - - ;; Print on hires screen, bottom-up. If we should underline, - ;; we do this by eor:ing the bottom line with #$ff - ldy #7 - lda (ptr1),y - ldx _ctk_hires_underline - beq @nounderline - eor #$ff -@nounderline: - sta (ptr2),y - dey -@loop: - lda (ptr1),y - sta (ptr2),y - dey - bpl @loop - - inc _ctk_hires_cursx - - lda ptr2 - clc - adc #8 - sta ptr2 - bcc :+ - inc ptr2+1 -: - inc tmpc - lda tmpc - cmp tmpl - bne @loop1 - -@end: - jsr restore01 - - jmp incsp2 - -;--------------------------------------------------------------------- -_ctk_hires_draw_windowborders: - - jsr setupptrs - - lda _ctk_hires_windowparams + wpclipy1 - beq :+ - jmp @nofirstline -: - - ;; Draw first line of the border, including the window title - - ;; Start with filling color memory - ldy _ctk_hires_windowparams + wpw - iny - lda _ctk_hires_windowparams + wpcolor1 - sta (ptr1),y - dey - dey - dey - sty tmpw - - ldy _ctk_hires_windowparams + wptitlelen - iny - iny - iny -: - sta (ptr1),y - iny - cpy tmpw - bcc :- - - inc tmpw - - ;; Set color for upper left corner - ldy #0 - lda _ctk_hires_windowparams + wpcolor1 - sta (ptr1),y - - - ;; Turn on font ROM for drawing the title - lda tmp01 - and #$f8 - ora #$01 - sta $01 - - ;; Use a temporary pointer (ptr3) rather than ptr2 so we can - ;; reuse it later. - lda ptr2 - sta ptr3 - lda ptr2+1 - sta ptr3+1 - - ;; Draw upper left corner - ldy #7 -: - lda _ctk_hires_theme+ulcornerpattern,y - sta (ptr3),y - dey - bpl :- - - ;; Draw first empty char left of the title - ldy #8 - lda #0 -: -; sta (ptr3),y - iny - cpy #$10 - bne :- - - lda ptr3 - clc - adc #$10 - sta ptr3 - bcc :+ - inc ptr3+1 -: - dec tmpw - - ;; Draw the title - lda _ctk_hires_windowparams + wptitle - sta ptr4 - lda _ctk_hires_windowparams + wptitle+1 - sta ptr4+1 - - - lda #0 - sta tmpc -@titleloop: - lda #0 - sta ptr5+1 - - ldy tmpc - lda (ptr4),y - - - ;; Convert from PETSCII to screen encoding - eor #$e0 - clc - adc #$20 - bpl @cont - adc #$40 - bpl @cont - eor #$a0 -@cont: - ;; Convert to address in character ROM - asl - rol ptr5+1 - asl - rol ptr5+1 - asl - rol ptr5+1 - sta ptr5 - lda #$d8 - adc ptr5+1 - sta ptr5+1 - - ;; Print on hires screen, character by character, bottom-up. - ldy #7 -: - lda (ptr5),y -; sta (ptr3),y - dey - bpl :- - - lda ptr3 - clc - adc #8 - sta ptr3 - bcc :+ - inc ptr3+1 -: - dec tmpw - - inc tmpc - lda tmpc - cmp _ctk_hires_windowparams + wptitlelen - bne @titleloop - - ;; Draw empty char after the title - ldy #7 - lda #0 -: -; sta (ptr3),y - dey - bpl :- - - lda ptr3 - clc - adc #$8 - sta ptr3 - bcc :+ - inc ptr3+1 -: - dec tmpw - - ;; Draw window title bar pattern -@titlebarloop: - ldy #7 -: - lda _ctk_hires_theme+titlebarpattern,y - sta (ptr3),y - dey - bpl :- - - lda ptr3 - clc - adc #$8 - sta ptr3 - bcc :+ - inc ptr3+1 -: - ;; Loop until we are three characters away from right border - ;; to avoid flickering since we would be overwriting the close - ;; button. - dec tmpw - lda tmpw - cmp #3 - bcs @titlebarloop - - lda ptr3 - clc - adc #$18 - sta ptr3 - bcc :+ - inc ptr3+1 -: - ;; Draw upper right corner piece - ldy #7 -: - lda _ctk_hires_theme+urcornerpattern,y - sta (ptr3),y - dey - bpl :- - - -@nofirstline: - - - ldx _ctk_hires_windowparams + wph - inx - stx tmph - - ;; Draw left and right borders - - ;; Fill color memory (pointer in ptr1, setup by setupptrs) - - ;; First check how much we actually should draw by inspecting - ;; the clipy1 and clipy2 fields in the _ctk_hires_windowparams - ;; structure - - lda #1 - sta tmpy - - ldx _ctk_hires_windowparams + wpclipy1 -@clipy1loop: - cpx #0 - beq @clipy1loopend - lda ptr1 - clc - adc #$28 - sta ptr1 - bcc :+ - inc ptr1+1 -: - lda ptr3 - clc - adc #$40 - sta ptr3 - lda ptr3+1 - adc #1 - sta ptr3+1 - - inc tmpy - - dex - jmp @clipy1loop -@clipy1loopend: - - lda ptr1 - clc - adc #$28 - sta ptr1 - bcc :+ - inc ptr1+1 -: - - ldx tmpy - ldy _ctk_hires_windowparams + wpw - iny - sty tmpw -@bordercloop: - cpx _ctk_hires_windowparams + wpclipy2 - beq @bordercloopend - - ldy tmpw - lda _ctk_hires_windowparams + wpcolor2 - sta (ptr1),y - ldy #0 - lda _ctk_hires_windowparams + wpcolor1 - sta (ptr1),y - - lda ptr1 - clc - adc #$28 - sta ptr1 - bcc :+ - inc ptr1+1 -: - - inx - cpx tmph - bcc @bordercloop - beq @bordercloop -@bordercloopend: - - - ;; Fill color memory for lower border, if clipy2 allows - cpx _ctk_hires_windowparams + wpclipy2 - beq @noclowerborder - - lda ptr1 - sec - sbc #$28 - sta ptr1 - bcs :+ - dec ptr1+1 -: - - ldy _ctk_hires_windowparams + wpw - lda _ctk_hires_windowparams + wpcolor2 -@lbordercloop: - sta (ptr1),y - dey - bne @lbordercloop - -@noclowerborder: - - ;; Draw right border - ldx tmpy -@rborderloop: - cpx _ctk_hires_windowparams + wpclipy2 - beq @rborderloopend - - lda ptr3 - clc - adc #$40 - sta ptr3 - lda ptr3+1 - adc #1 - sta ptr3+1 - - ldy #7 -: - lda _ctk_hires_theme+rborderpattern,y - sta (ptr3),y - dey - bpl :- - - inx - cpx tmph - bne @rborderloop -@rborderloopend: - - cpx _ctk_hires_windowparams + wpclipy2 - beq @norbordercorner - - lda ptr3 - clc - adc #$40 - sta ptr3 - lda ptr3+1 - adc #1 - sta ptr3+1 - - ;; Draw lower right corner, if clipy2 allows it - ldy #7 -: - lda _ctk_hires_theme+lrcornerpattern,y - sta (ptr3),y - dey - bpl :- - -@norbordercorner: - - stx tmpy - - ;; Draw lower border - ldx _ctk_hires_windowparams + wpw - -@lowerborderloop: - lda ptr3 - sec - sbc #$8 - sta ptr3 - bcs :+ - dec ptr3+1 -: - - lda tmpy - cmp _ctk_hires_windowparams + wpclipy2 - beq @nolowerborder - - ldy #7 -: - lda _ctk_hires_theme+lowerborderpattern,y - sta (ptr3),y - dey - bpl :- -@nolowerborder: - - dex - bne @lowerborderloop - - lda ptr3 - sec - sbc #$8 - sta ptr3 - bcs :+ - dec ptr3+1 -: - - - ldx tmpy - cpx tmph - bne @nolbordercorner - - ;; Draw lower left corner, if clipy2 allows it - ldy #7 -: - lda _ctk_hires_theme+llcornerpattern,y - sta (ptr3),y - dey - bpl :- - - lda ptr3 - sec - sbc #$40 - sta ptr3 - lda ptr3+1 - sbc #1 - sta ptr3+1 - -@nolbordercorner: - - ;; Draw left border - - - -@lborderloop: - cpx #1 - beq @lborderloopend - cpx _ctk_hires_windowparams + wpclipy1 - bcc @lborderloopend - - ldy #7 -: - lda _ctk_hires_theme+lborderpattern,y - sta (ptr3),y - dey - bpl :- - - lda ptr3 - sec - sbc #$40 - sta ptr3 - lda ptr3+1 - sbc #1 - sta ptr3+1 - - dex - jmp @lborderloop - -@lborderloopend: - - - jmp restore01 -;--------------------------------------------------------------------- -_ctk_hires_draw_buttonleft: - jsr setupptrs - - ldy #0 - lda _ctk_hires_color - sta (ptr1),y - -: - lda _ctk_hires_theme+buttonleftpattern,y - sta (ptr2),y - iny - cpy #8 - bne :- - - jmp restore01 -;--------------------------------------------------------------------- -_ctk_hires_draw_buttonright: - jsr setupptrs - ldy #0 - lda _ctk_hires_color - sta (ptr1),y - -: - lda _ctk_hires_theme+buttonrightpattern,y - sta (ptr2),y - iny - cpy #8 - bne :- - - jmp restore01 -;--------------------------------------------------------------------- -_ctk_hires_draw_bitmapline: - sta tmpl - cmp #0 - bne :+ - rts -: - - jsr setupptrs - - ldy #0 - lda _ctk_hires_color -: - sta (ptr1),y - iny - cpy tmpl - bne :- - - lda _ctk_hires_bitmapptr - sta ptr1 - lda _ctk_hires_bitmapptr+1 - sta ptr1+1 - - ldy #0 - ldx #0 -: - lda (ptr1),y - sta (ptr2),y - iny - inx - cpx #8 - bne :- - - ldx #0 - - dec tmpl - bne :- - - jmp restore01 -;--------------------------------------------------------------------- - \ No newline at end of file diff --git a/backyard/platform/c64/ctk/ctk-hires-asm.h b/backyard/platform/c64/ctk/ctk-hires-asm.h deleted file mode 100644 index ec7d9f5be..000000000 --- a/backyard/platform/c64/ctk/ctk-hires-asm.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright (c) 2002, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the "ctk" console GUI toolkit for cc65 - * - * $Id: ctk-hires-asm.h,v 1.1 2007/05/23 23:11:27 oliverschmidt Exp $ - * - */ - -#ifndef __CTK_HIRES_ASM_H__ -#define __CTK_HIRES_ASM_H__ - -void __fastcall__ ctk_hires_cclear(unsigned char len); -void __fastcall__ ctk_hires_chline(unsigned char len); -void __fastcall__ ctk_hires_cputc(unsigned char c); -void __fastcall__ ctk_hires_cputsn(unsigned char *str, - unsigned char len); - -void ctk_hires_draw_buttonleft(void); -void ctk_hires_draw_buttonright(void); - -struct ctk_hires_windowparams { - unsigned char w; - unsigned char h; - unsigned char clipy1; - unsigned char clipy2; - unsigned char color1; - unsigned char color2; - unsigned char titlelen; - char *title; -}; -extern struct ctk_hires_windowparams ctk_hires_windowparams; -void ctk_hires_draw_windowborders(void); - -extern unsigned char ctk_hires_cursx, - ctk_hires_cursy, - ctk_hires_color, - ctk_hires_reversed, - ctk_hires_underline; - - -void __fastcall__ ctk_hires_draw_bitmapline(unsigned char len); - -#endif /* __CTK_HIRES_ASM_H__ */ diff --git a/backyard/platform/c64/ctk/ctk-hires-service.c b/backyard/platform/c64/ctk/ctk-hires-service.c deleted file mode 100644 index 67223c5d9..000000000 --- a/backyard/platform/c64/ctk/ctk-hires-service.c +++ /dev/null @@ -1,925 +0,0 @@ -/* - * Copyright (c) 2002, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the "ctk" console GUI toolkit for cc65 - * - * $Id: ctk-hires-service.c,v 1.1 2007/05/23 23:11:27 oliverschmidt Exp $ - * - */ - -#include "contiki-version.h" - -#include "ctk/ctk.h" -#include "ctk/ctk-draw.h" -#include "ctk/ctk-draw-service.h" - -#include "ctk-hires.h" -#include "ctk-hires-asm.h" -#include "ctk-hires-theme.h" - -#include - -#ifndef NULL -#define NULL (void *)0 -#endif /* NULL */ - -#define SCREEN_HEIGHT 25 -#define SCREEN_WIDTH 40 - -#define SCREENADDR 0xdc00 -#define HIRESADDR 0xe000 - -static unsigned char lineptr; - -unsigned char ctk_hires_cursx, ctk_hires_cursy; -unsigned char ctk_hires_reversed; -unsigned char ctk_hires_color; -unsigned char ctk_hires_underline; - -/*static unsigned char cchar; - -static unsigned char tmp01; -static unsigned char tmph, tmpl, tmpborder; -static unsigned char *tmpptr;*/ - - -static unsigned char x, y, i; -/*static unsigned char h;*/ -static unsigned char wfocus; -static unsigned char x1, y1, x2, y2; - -struct ctk_hires_windowparams ctk_hires_windowparams; -unsigned char *ctk_hires_bitmapptr; - -/*unsigned char ctk_draw_windowborder_height = 1; -unsigned char ctk_draw_windowborder_width = 1; -unsigned char ctk_draw_windowtitle_height = 1;*/ - -static void s_ctk_draw_clear(unsigned char y1, unsigned char y2); - - -/*-----------------------------------------------------------------------------------*/ -/* Tables. */ - -unsigned short ctk_hires_yscreenaddr[25] = - {0 * SCREEN_WIDTH + SCREENADDR, 1 * SCREEN_WIDTH + SCREENADDR, - 2 * SCREEN_WIDTH + SCREENADDR, 3 * SCREEN_WIDTH + SCREENADDR, - 4 * SCREEN_WIDTH + SCREENADDR, 5 * SCREEN_WIDTH + SCREENADDR, - 6 * SCREEN_WIDTH + SCREENADDR, 7 * SCREEN_WIDTH + SCREENADDR, - 8 * SCREEN_WIDTH + SCREENADDR, 9 * SCREEN_WIDTH + SCREENADDR, - 10 * SCREEN_WIDTH + SCREENADDR, 11 * SCREEN_WIDTH + SCREENADDR, - 12 * SCREEN_WIDTH + SCREENADDR, 13 * SCREEN_WIDTH + SCREENADDR, - 14 * SCREEN_WIDTH + SCREENADDR, 15 * SCREEN_WIDTH + SCREENADDR, - 16 * SCREEN_WIDTH + SCREENADDR, 17 * SCREEN_WIDTH + SCREENADDR, - 18 * SCREEN_WIDTH + SCREENADDR, 19 * SCREEN_WIDTH + SCREENADDR, - 20 * SCREEN_WIDTH + SCREENADDR, 21 * SCREEN_WIDTH + SCREENADDR, - 22 * SCREEN_WIDTH + SCREENADDR, 23 * SCREEN_WIDTH + SCREENADDR, - 24 * SCREEN_WIDTH + SCREENADDR}; - -unsigned short ctk_hires_yhiresaddr[25] = - {0 * 320 + HIRESADDR, 1 * 320 + HIRESADDR, - 2 * 320 + HIRESADDR, 3 * 320 + HIRESADDR, - 4 * 320 + HIRESADDR, 5 * 320 + HIRESADDR, - 6 * 320 + HIRESADDR, 7 * 320 + HIRESADDR, - 8 * 320 + HIRESADDR, 9 * 320 + HIRESADDR, - 10 * 320 + HIRESADDR, 11 * 320 + HIRESADDR, - 12 * 320 + HIRESADDR, 13 * 320 + HIRESADDR, - 14 * 320 + HIRESADDR, 15 * 320 + HIRESADDR, - 16 * 320 + HIRESADDR, 17 * 320 + HIRESADDR, - 18 * 320 + HIRESADDR, 19 * 320 + HIRESADDR, - 20 * 320 + HIRESADDR, 21 * 320 + HIRESADDR, - 22 * 320 + HIRESADDR, 23 * 320 + HIRESADDR, - 24 * 320 + HIRESADDR}; -extern struct ctk_hires_theme ctk_hires_theme; -struct ctk_hires_theme *ctk_hires_theme_ptr = &ctk_hires_theme; -/*-----------------------------------------------------------------------------------*/ -#define hires_wherex() ctk_hires_cursx -#define hires_revers(c) ctk_hires_reversed = c -#define hires_color(c) ctk_hires_color = c -#define hires_underline(c) ctk_hires_underline = c -/*-----------------------------------------------------------------------------------*/ -static void __fastcall__ -hires_cvline(unsigned char length) -{ - static unsigned char i; - - for(i = 0; i < length; ++i) { - ctk_hires_cputc('|'); - --ctk_hires_cursx; - ++ctk_hires_cursy; - } -} -/*-----------------------------------------------------------------------------------*/ -static void __fastcall__ -hires_gotoxy(unsigned char x, unsigned char y) -{ - ctk_hires_cursx = x; - ctk_hires_cursy = y; -} -/*-----------------------------------------------------------------------------------*/ -static void __fastcall__ -hires_cclearxy(unsigned char x, unsigned char y, unsigned char length) -{ - hires_gotoxy(x, y); - ctk_hires_cclear(length); -} -/*-----------------------------------------------------------------------------------*/ -static void __fastcall__ -hires_chlinexy(unsigned char x, unsigned char y, unsigned char length) -{ - hires_gotoxy(x, y); - ctk_hires_chline(length); -} -/*-----------------------------------------------------------------------------------*/ -static void __fastcall__ -hires_cvlinexy(unsigned char x, unsigned char y, unsigned char length) -{ - hires_gotoxy(x, y); - hires_cvline(length); -} -/*-----------------------------------------------------------------------------------*/ -static void __fastcall__ -hires_cputcxy(unsigned char x, unsigned char y, char c) -{ - hires_gotoxy(x, y); - ctk_hires_cputc(c); -} -/*-----------------------------------------------------------------------------------*/ -#pragma optimize(push, off) -static void -clear_line(unsigned char line) -{ - lineptr = line; - asm("lda %v", lineptr); - asm("asl"); - asm("tax"); - asm("lda %v,x", ctk_hires_yhiresaddr); - asm("sta ptr2"); - asm("lda %v+1,x", ctk_hires_yhiresaddr); - asm("sta ptr2+1"); - asm("lda %v,x", ctk_hires_yscreenaddr); - asm("sta ptr1"); - asm("lda %v+1,x", ctk_hires_yscreenaddr); - asm("sta ptr1+1"); - - - asm("sei"); - asm("lda $01"); - asm("pha"); - asm("lda #$30"); - asm("sta $01"); - asm("ldy #39"); - asm("ldx %v", lineptr); - asm("lda %v+%w,x", ctk_hires_theme, - offsetof(struct ctk_hires_theme, backgroundpatterncolors)); - asm("clearlineloop1:"); - asm("sta (ptr1),y"); - asm("dey"); - asm("bpl clearlineloop1"); - asm("pla"); - asm("sta $01"); - asm("cli"); - - - asm("lda %v", lineptr); - /* asm("and #7");*/ - asm("asl"); - asm("asl"); - asm("asl"); - asm("tax"); - asm("ldy #0"); - asm("clearlineloop2:"); - asm("lda %v+%w+0,x", ctk_hires_theme, - offsetof(struct ctk_hires_theme, backgroundpattern)); - asm("sta (ptr2),y"); - asm("iny"); - asm("lda %v+%w+1,x", ctk_hires_theme, - offsetof(struct ctk_hires_theme, backgroundpattern)); - asm("sta (ptr2),y"); - asm("iny"); - asm("lda %v+%w+2,x", ctk_hires_theme, - offsetof(struct ctk_hires_theme, backgroundpattern)); - asm("sta (ptr2),y"); - asm("iny"); - asm("lda %v+%w+3,x", ctk_hires_theme, - offsetof(struct ctk_hires_theme, backgroundpattern)); - asm("sta (ptr2),y"); - asm("iny"); - asm("lda %v+%w+4,x", ctk_hires_theme, - offsetof(struct ctk_hires_theme, backgroundpattern)); - asm("sta (ptr2),y"); - asm("iny"); - asm("lda %v+%w+5,x", ctk_hires_theme, - offsetof(struct ctk_hires_theme, backgroundpattern)); - asm("sta (ptr2),y"); - asm("iny"); - asm("lda %v+%w+6,x", ctk_hires_theme, - offsetof(struct ctk_hires_theme, backgroundpattern)); - asm("sta (ptr2),y"); - asm("iny"); - asm("lda %v+%w+7,x", ctk_hires_theme, - offsetof(struct ctk_hires_theme, backgroundpattern)); - asm("sta (ptr2),y"); - asm("iny"); - asm("bne clearlineloop2"); - - asm("inc ptr2+1"); - - asm("ldy #0"); - asm("clearlineloop3:"); - asm("lda %v+%w+0,x", ctk_hires_theme, - offsetof(struct ctk_hires_theme, backgroundpattern)); - asm("sta (ptr2),y"); - asm("iny"); - asm("lda %v+%w+1,x", ctk_hires_theme, - offsetof(struct ctk_hires_theme, backgroundpattern)); - asm("sta (ptr2),y"); - asm("iny"); - asm("lda %v+%w+2,x", ctk_hires_theme, - offsetof(struct ctk_hires_theme, backgroundpattern)); - asm("sta (ptr2),y"); - asm("iny"); - asm("lda %v+%w+3,x", ctk_hires_theme, - offsetof(struct ctk_hires_theme, backgroundpattern)); - asm("sta (ptr2),y"); - asm("iny"); - asm("lda %v+%w+4,x", ctk_hires_theme, - offsetof(struct ctk_hires_theme, backgroundpattern)); - asm("sta (ptr2),y"); - asm("iny"); - asm("lda %v+%w+5,x", ctk_hires_theme, - offsetof(struct ctk_hires_theme, backgroundpattern)); - asm("sta (ptr2),y"); - asm("iny"); - asm("lda %v+%w+6,x", ctk_hires_theme, - offsetof(struct ctk_hires_theme, backgroundpattern)); - asm("sta (ptr2),y"); - asm("iny"); - asm("lda %v+%w+7,x", ctk_hires_theme, - offsetof(struct ctk_hires_theme, backgroundpattern)); - asm("sta (ptr2),y"); - asm("iny"); - asm("cpy #$40"); - asm("bne clearlineloop3"); - - - if(lineptr == 24) { - hires_color(ctk_hires_theme.backgroundpatterncolors[24]); - hires_gotoxy(0, 24); - ctk_hires_cputsn(CONTIKI_VERSION_STRING, - sizeof(CONTIKI_VERSION_STRING) - 1); - } -} -#pragma optimize(pop) -/*-----------------------------------------------------------------------------------*/ -#pragma optimize(push, off) -static void -nmi2(void) -{ - asm("pla"); - asm("sta $01"); - asm("pla"); - asm("rti"); -} -#pragma optimize(pop) -/*-----------------------------------------------------------------------------------*/ -#pragma optimize(push, off) -static void -nmi(void) -{ - asm("sei"); - asm("pha"); - asm("inc $d020"); - asm("lda $01"); - asm("pha"); - asm("lda #$36"); - asm("sta $01"); - asm("lda #>_nmi2"); - asm("pha"); - asm("lda #<_nmi2"); - asm("pha"); - asm("php"); - asm("jmp ($0318)"); - - nmi2(); -} -#pragma optimize(pop) -/*-----------------------------------------------------------------------------------*/ -#pragma optimize(push, off) -static void -setup_nmi(void) -{ - asm("lda #<_nmi"); - asm("sta $fffa"); - asm("lda #>_nmi"); - asm("sta $fffb"); - return; - nmi(); -} -#pragma optimize(pop) -/*-----------------------------------------------------------------------------------*/ -#pragma optimize(push, off) -static void -s_ctk_draw_init(void) -{ - unsigned char i, *ptr1, *ptr2; - - - setup_nmi(); - - /* Turn on hires mode, bank 0 ($c000 - $ffff) and $e000/$c000 for - hires/colors. */ - VIC.ctrl1 = 0x3b; /* $D011 */ - VIC.addr = 0x78; /* $D018 */ - VIC.ctrl2 = 0xc8; /* $D016 */ - CIA2.pra = 0x00; /* $DD00 */ - - VIC.bordercolor = ctk_hires_theme.bordercolor; /* $D020 */ - VIC.bgcolor0 = ctk_hires_theme.screencolor; /* $D021 */ - - /* Fill color memory. */ - asm("sei"); - asm("lda $01"); - asm("pha"); - asm("lda #$30"); - asm("sta $01"); - asm("ldx #0"); - asm("lda #$c0"); - asm("fillcolorloop:"); - asm("sta $dc00,x"); - asm("sta $dd00,x"); - asm("sta $de00,x"); - asm("sta $df00,x"); - asm("inx"); - asm("bne fillcolorloop"); - - /* Setup sprite pointers */ - asm("ldx #$fd"); - asm("stx $dff8"); - asm("inx"); - asm("stx $dff9"); - asm("pla"); - asm("sta $01"); - asm("cli"); - - /* Fill hires memory with 0. */ - - asm("lda $fd"); - asm("pha"); - asm("lda $fe"); - asm("pha"); - asm("lda #0"); - asm("sta $fd"); - asm("lda #$e0"); - asm("sta $fe"); - asm("ldy #0"); - asm("lda #0"); - asm("clrscrnloop:"); - asm("lda #$55"); - asm("sta ($fd),y"); - asm("iny"); - asm("lda #$aa"); - asm("sta ($fd),y"); - asm("iny"); - asm("bne clrscrnloop"); - asm("inc $fe"); - asm("lda $fe"); - asm("cmp #$ff"); - asm("bne clrscrnloop"); - - asm("ldy #$00"); - asm("clrscrnloop2:"); - asm("lda #$55"); - asm("sta $ff00,y"); - asm("iny"); - asm("lda #$aa"); - asm("sta $ff00,y"); - asm("iny"); - asm("cpy #$40"); - asm("bne clrscrnloop2"); - - - asm("pla"); - asm("sta $fe"); - asm("pla"); - asm("sta $fd"); - - - s_ctk_draw_clear(0, SCREEN_HEIGHT); - - /* Setup mouse pointer sprite. */ - asm("lda %v+%w", ctk_hires_theme, - offsetof(struct ctk_hires_theme, pointermaskcolor)); - asm("sta $d027"); - asm("lda %v+%w", ctk_hires_theme, - offsetof(struct ctk_hires_theme, pointercolor)); - asm("sta $d028"); - - ptr1 = ctk_hires_theme.pointer; - ptr2 = (unsigned char *)0xff40; - - for(i = 0; i < 0x80; ++i) { - *ptr2++ = *ptr1++; - } - - return; -} -#pragma optimize(pop) -/*-----------------------------------------------------------------------------------*/ -static void __fastcall__ -draw_widget(register struct ctk_widget *w, - unsigned char x, unsigned char y, - unsigned char clipy1, unsigned char clipy2, - unsigned char afocus) -{ - static unsigned char xpos, ypos, xscroll; - static unsigned char i; - static char c; - static unsigned char len; - static unsigned char tmp; - static unsigned char yclipped; - static unsigned char focus; - char *text; - - xpos = x + w->x; - ypos = y + w->y; - - yclipped = 0; - if(ypos >= clipy1 && ypos < clipy2) { - yclipped = 1; - } - focus = afocus; - - - switch(w->type) { - case CTK_WIDGET_SEPARATOR: - hires_color(ctk_hires_theme.separatorcolors[focus]); - if(yclipped) { - hires_chlinexy(xpos, ypos, w->w); - } - break; - case CTK_WIDGET_LABEL: - hires_color(ctk_hires_theme.labelcolors[focus]); - text = w->widget.label.text; - for(i = 0; i < w->h; ++i) { - if(ypos >= clipy1 && ypos < clipy2) { - hires_gotoxy(xpos, ypos); - ctk_hires_cputsn(text, w->w); - tmp = w->w - (hires_wherex() - xpos); - if(tmp > 0) { - ctk_hires_cclear(tmp); - } - } - ++ypos; - text += w->w; - } - break; - case CTK_WIDGET_BUTTON: - if(yclipped) { - hires_color(ctk_hires_theme.buttonleftcolors[focus]); - hires_gotoxy(xpos, ypos); - ctk_hires_draw_buttonleft(); - hires_color(ctk_hires_theme.buttoncolors[focus]); - hires_gotoxy(xpos + 1, ypos); - ctk_hires_cputsn(w->widget.button.text, w->w); - hires_color(ctk_hires_theme.buttonrightcolors[focus]); - ctk_hires_draw_buttonright(); - } - break; - case CTK_WIDGET_HYPERLINK: - if(yclipped) { - hires_color(ctk_hires_theme.hyperlinkcolors[focus]); - hires_underline(1); - hires_gotoxy(xpos, ypos); - ctk_hires_cputsn(w->widget.button.text, w->w); - hires_underline(0); - } - break; - case CTK_WIDGET_TEXTENTRY: - if(yclipped) { - hires_color(ctk_hires_theme.textentrycolors[focus]); - - if((focus & CTK_FOCUS_WIDGET) && - w->widget.textentry.state != CTK_TEXTENTRY_EDIT) { - hires_revers(1); - } else { - hires_revers(0); - } - xscroll = 0; - tmp = w->w - 1; - if(w->widget.textentry.xpos >= tmp) { - xscroll = w->widget.textentry.xpos - tmp; - } - text = w->widget.textentry.text; - if(w->widget.textentry.state == CTK_TEXTENTRY_EDIT) { - hires_revers(0); - hires_cputcxy(xpos, ypos, '>'); - text += xscroll; - for(i = 0; i < w->w; ++i) { - c = *text; - if(i == w->widget.textentry.xpos - xscroll) { - hires_revers(1); - } else { - hires_revers(0); - } - if(c == 0) { - ctk_hires_cputc(' '); - } else { - ctk_hires_cputc(c); - } - hires_revers(0); - ++text; - } - ctk_hires_cputc('<'); - } else { - hires_cputcxy(xpos, ypos, '|'); - /* hires_gotoxy(xpos + 1, ypos); */ - ctk_hires_cputsn(text, w->w); - i = hires_wherex(); - tmp = i - xpos - 1; - if(tmp < w->w) { - ctk_hires_cclear(w->w - tmp); - } - ctk_hires_cputc('|'); - } - } - hires_revers(0); - break; - case CTK_WIDGET_ICON: - if(yclipped) { - hires_color(ctk_hires_theme.iconcolors[focus]); - - x = xpos; - len = strlen(w->widget.icon.title); - if(x + len >= SCREEN_WIDTH) { - x = SCREEN_WIDTH - len; - } - - tmp = ypos + 3; - - if(tmp < clipy2) { - hires_gotoxy(x, tmp); - ctk_hires_cputsn(w->widget.icon.title, len); - } - - hires_gotoxy(xpos, ypos); - if(w->widget.icon.bitmap != NULL) { - ctk_hires_bitmapptr = w->widget.icon.bitmap; - for(i = 0; i < 3; ++i) { - if(ypos >= clipy1 && ypos < clipy2) { - hires_gotoxy(xpos, ypos); - ctk_hires_draw_bitmapline(3); - } - ctk_hires_bitmapptr += 3 * 8; - ++ypos; - } - - /* draw_bitmap_icon(w->widget.icon.bitmap);*/ - } - - } - break; - case CTK_WIDGET_BITMAP: - hires_color(ctk_hires_theme.bitmapcolors[focus]); - ctk_hires_bitmapptr = w->widget.bitmap.bitmap; - for(i = 0; i < w->h; ++i) { - if(ypos >= clipy1 && ypos < clipy2) { - hires_gotoxy(xpos, ypos); - ctk_hires_draw_bitmapline(w->w); - } - ctk_hires_bitmapptr += w->w * 8; - ++ypos; - } - break; - - default: - break; - } -} -/*-----------------------------------------------------------------------------------*/ -static void -s_ctk_draw_widget(struct ctk_widget *w, - unsigned char focus, - unsigned char clipy1, - unsigned char clipy2) -{ - struct ctk_window *win = w->window; - unsigned char posx, posy; - - posx = win->x + 1; - posy = win->y + 2; - - if(w == win->focused) { - focus |= CTK_FOCUS_WIDGET; - } - - draw_widget(w, posx, posy, - clipy1, clipy2, - focus); -} -/*-----------------------------------------------------------------------------------*/ -static void -s_ctk_draw_clear_window(register struct ctk_window *window, - unsigned char focus, - unsigned char clipy1, - unsigned char clipy2) -{ - static unsigned char h; - - hires_color(ctk_hires_theme.windowcolors[focus]); - - h = window->y + 2 + window->h; - /* Clear window contents. */ - for(i = window->y + 2; i < h; ++i) { - if(i >= clipy1 && i <= clipy2) { - hires_cclearxy(window->x + 1, i, window->w); - } - } -} -/*-----------------------------------------------------------------------------------*/ -static void -s_ctk_draw_window(register struct ctk_window *window, - unsigned char focus, - unsigned char clipy1, unsigned char clipy2, - unsigned char draw_borders) -{ - register struct ctk_widget *w; - - x = window->x; - y = window->y + 1; - - ++clipy2; - - if(clipy2 <= y) { - return; - } - - /* hires_color(ctk_hires_theme.windowcolors[focus+1]);*/ - - x1 = x + 1; - y1 = y + 1; - /* x2 = x1 + window->w; - y2 = y1 + window->h;*/ - - hires_gotoxy(x, y); - ctk_hires_windowparams.w = window->w; - ctk_hires_windowparams.h = window->h; - if(clipy1 < y) { - ctk_hires_windowparams.clipy1 = 0; - } else { - ctk_hires_windowparams.clipy1 = clipy1 - y; - } - ctk_hires_windowparams.clipy2 = clipy2 - y; - ctk_hires_windowparams.color1 = ctk_hires_theme.windowcolors[focus+1]; - ctk_hires_windowparams.color2 = ctk_hires_theme.windowcolors[focus]; - ctk_hires_windowparams.title = window->title; - ctk_hires_windowparams.titlelen = window->titlelen; - - if(ctk_hires_windowparams.clipy1 < ctk_hires_windowparams.clipy2 && - ctk_hires_windowparams.clipy2 > 0) { - ctk_hires_draw_windowborders(); - } - - /* Draw inactive widgets. */ - for(w = window->inactive; w != NULL; w = w->next) { - draw_widget(w, x1, y1, - clipy1, clipy2, - focus); - } - - /* Draw active widgets. */ - for(w = window->active; w != NULL; w = w->next) { - wfocus = focus; - if(w == window->focused) { - wfocus |= CTK_FOCUS_WIDGET; - } - draw_widget(w, x1, y1, - clipy1, clipy2, - wfocus); - } -} -/*-----------------------------------------------------------------------------------*/ -static void -s_ctk_draw_dialog(register struct ctk_window *dialog) -{ - register struct ctk_widget *w; - - hires_color(ctk_hires_theme.windowcolors[CTK_FOCUS_DIALOG]); - - /* x = (SCREEN_WIDTH - dialog->w) / 2; - y = (SCREEN_HEIGHT - 1 - dialog->h) / 2; */ - x = dialog->x; - y = dialog->y + 1; - - - x1 = x + 1; - y1 = y + 1; - x2 = x1 + dialog->w; - y2 = y1 + dialog->h; - - - /* Draw dialog frame. */ - - hires_cvlinexy(x, y1, dialog->h); - hires_cvlinexy(x2, y1, dialog->h); - - hires_chlinexy(x1, y, dialog->w); - hires_chlinexy(x1, y2, dialog->w); - - hires_cputcxy(x, y, CH_ULCORNER); - hires_cputcxy(x, y2, CH_LLCORNER); - hires_cputcxy(x2, y, CH_URCORNER); - hires_cputcxy(x2, y2, CH_LRCORNER); - - - /* Clear window contents. */ - for(i = y1; i < y2; ++i) { - hires_cclearxy(x1, i, dialog->w); - } - - /* Draw inactive widgets. */ - for(w = dialog->inactive; w != NULL; w = w->next) { - draw_widget(w, x1, y1, - 0, SCREEN_HEIGHT, CTK_FOCUS_DIALOG); - } - - - /* Draw active widgets. */ - for(w = dialog->active; w != NULL; w = w->next) { - wfocus = CTK_FOCUS_DIALOG; - if(w == dialog->focused) { - wfocus |= CTK_FOCUS_WIDGET; - } - draw_widget(w, x1, y1, - 0, SCREEN_HEIGHT, wfocus); - } - -} -/*-----------------------------------------------------------------------------------*/ -static void -s_ctk_draw_clear(unsigned char y1, unsigned char y2) -{ - for(i = y1; i < y2; ++i) { - clear_line(i); - } -} -/*-----------------------------------------------------------------------------------*/ -static void -draw_menu(register struct ctk_menu *m) -{ - static unsigned char x, x2, y; - - hires_color(ctk_hires_theme.openmenucolor); - x = hires_wherex(); - ctk_hires_cputsn(m->title, m->titlelen); - ctk_hires_cputc(' '); - x2 = hires_wherex(); - if(x + CTK_CONF_MENUWIDTH > SCREEN_WIDTH) { - x = SCREEN_WIDTH - CTK_CONF_MENUWIDTH; - } - for(y = 0; y < m->nitems; ++y) { - if(y == m->active) { - hires_color(ctk_hires_theme.activemenucolor); - } else { - hires_color(ctk_hires_theme.menucolor); - } - hires_gotoxy(x, y + 1); - if(m->items[y].title[0] == '-') { - ctk_hires_chline(CTK_CONF_MENUWIDTH); - } else { - ctk_hires_cputsn(m->items[y].title, - strlen(m->items[y].title)); - } - ctk_hires_cclear(x + CTK_CONF_MENUWIDTH - hires_wherex()); - hires_revers(0); - } - hires_gotoxy(x2, 0); - hires_color(ctk_hires_theme.menucolor); -} -/*-----------------------------------------------------------------------------------*/ -static void -s_ctk_draw_menus(struct ctk_menus *menus) -{ - struct ctk_menu *m; - - /* Draw menus */ - hires_color(ctk_hires_theme.menucolor); - hires_gotoxy(0, 0); - hires_revers(0); - ctk_hires_cputc(' '); - for(m = menus->menus->next; m != NULL; m = m->next) { - if(m != menus->open) { - ctk_hires_cputsn(m->title, m->titlelen); - ctk_hires_cputc(' '); - } else { - draw_menu(m); - } - } - ctk_hires_cclear(SCREEN_WIDTH - hires_wherex() - - strlen(menus->desktopmenu->title) - 1); - - /* Draw desktopmenu */ - if(menus->desktopmenu != menus->open) { - ctk_hires_cputsn(menus->desktopmenu->title, - menus->desktopmenu->titlelen); - ctk_hires_cputc(' '); - } else { - draw_menu(menus->desktopmenu); - } - -} -/*-----------------------------------------------------------------------------------*/ -static unsigned char -s_ctk_draw_height(void) -{ - return SCREEN_HEIGHT; -} -/*-----------------------------------------------------------------------------------*/ -static unsigned char -s_ctk_draw_width(void) -{ - return SCREEN_WIDTH; -} -/*-----------------------------------------------------------------------------------*/ -static unsigned short -s_ctk_mouse_xtoc(unsigned short x) -{ - return x / 8; -} -/*-----------------------------------------------------------------------------------*/ -static unsigned short -s_ctk_mouse_ytoc(unsigned short y) -{ - return y / 8; -} -/*-----------------------------------------------------------------------------------*/ - -SERVICE(ctk_hires_service, ctk_draw_service, -{ 1, - 1, - 1, - s_ctk_draw_init, - s_ctk_draw_clear, - s_ctk_draw_clear_window, - s_ctk_draw_window, - s_ctk_draw_dialog, - s_ctk_draw_widget, - s_ctk_draw_menus, - s_ctk_draw_width, - s_ctk_draw_height, - s_ctk_mouse_xtoc, - s_ctk_mouse_ytoc }); - -/*--------------------------------------------------------------------------*/ - -PROCESS(ctk_hires_service_process, "CTK hires service"); - -PROCESS_THREAD(ctk_hires_service_process, ev, data) { - PROCESS_BEGIN(); - - s_ctk_draw_init(); - ctk_restore(); - - SERVICE_REGISTER(ctk_hires_service); - - while(ev != PROCESS_EVENT_SERVICE_REMOVED && - ev != PROCESS_EVENT_EXIT) { - PROCESS_WAIT_EVENT(); - } - - SERVICE_REMOVE(ctk_hires_service); - - VIC.ctrl1 = 0x1b; /* $D011 */ - VIC.addr = 0x17; /* $D018 */ - VIC.ctrl2 = 0xc8; /* $D016 */ - CIA2.pra = 0x03; /* $DD00 */ - - PROCESS_END(); -} -/*--------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/ctk/ctk-hires-theme-blueround.c b/backyard/platform/c64/ctk/ctk-hires-theme-blueround.c deleted file mode 100644 index 22ec1ab51..000000000 --- a/backyard/platform/c64/ctk/ctk-hires-theme-blueround.c +++ /dev/null @@ -1,313 +0,0 @@ - /* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop OS for the C64 - * - * $Id: ctk-hires-theme-blueround.c,v 1.1 2007/05/23 23:11:27 oliverschmidt Exp $ - * - */ - -#include -#include "ctk-hires-theme.h" - -#define COLOR(bg, fg) ((fg << 4) | (bg)) - -#define BGCOLOR1 0x06 -#define BGCOLOR2 0x00 -#define BGCOLOR3 0x06 -#define BGCOLOR4 0x00 - -struct ctk_hires_theme ctk_hires_theme = - { - /* Version string. */ - /* char version[8]; */ - {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, - - /* Window borders patterns. */ - /* unsigned char ulcorner[8], */ /* Upper left corner. */ - {0xfe,0xf8,0xe0,0xc0,0xc0,0x80,0x80,0x00}, - - /* titlebar[8], */ /* Title bar pattern. */ - {0x00,0x55,0xaa,0x00,0xaa,0x00,0x00,0x00}, - - /* urcorner[8], */ /* Upper right corner. */ - {0x7f,0x1f,0x07,0x03,0x03,0x01,0x01,0x00}, - - /* rightborder[8], */ /* Right border. */ - {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, - - /* lrcorner[8], */ /* Lower right corner. */ - {0x00,0x01,0x01,0x03,0x03,0x07,0x1f,0x7f}, - - /* lowerborder[8], */ /* Lower border. */ - {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, - - /* llcorner[8], */ /* Lower left corner. */ - {0x00,0x80,0x80,0xc0,0xc0,0xe0,0xf8,0xfe}, - - /* leftborder[8]; */ /* Left border. */ - {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, - - /* Button corner patterns. */ - /* unsigned char buttonleft[8], */ - {0x03,0x0f,0x1f,0x1f,0x1f,0x1f,0x0f,0x03}, - - /* buttonright[8]; */ - {0xc0,0xf0,0xf8,0xf8,0xf8,0xf8,0xf0,0xc0}, - - /* Menu border patterns. */ - /* unsigned char menuleftpattern[8], */ - {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}, - - /* menurightpatterns[8]; */ - {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}, - - /* Window and widget colors. */ - /* unsigned char windowcolors[6], */ - {COLOR(COLOR_BLACK, COLOR_BLACK), - COLOR(COLOR_BLACK, COLOR_BLACK), - COLOR(COLOR_BLUE, COLOR_BLACK), - COLOR(COLOR_BLUE, COLOR_BLACK), - COLOR(COLOR_LIGHTBLUE, COLOR_BLUE), - COLOR(COLOR_LIGHTBLUE, COLOR_BLUE)}, - - /* separatorcolors[6], */ - {COLOR(COLOR_BLACK, COLOR_BLUE), - COLOR(COLOR_BLACK, COLOR_BLUE), - COLOR(COLOR_BLUE, COLOR_BLACK), - COLOR(COLOR_BLUE, COLOR_BLACK), - COLOR(COLOR_LIGHTBLUE, COLOR_BLUE), - COLOR(COLOR_LIGHTBLUE, COLOR_BLUE)}, - - /* labelcolors[6], */ - {COLOR(COLOR_BLACK, COLOR_BLUE), - COLOR(COLOR_BLACK, COLOR_BLUE), - COLOR(COLOR_BLUE, COLOR_LIGHTBLUE), - COLOR(COLOR_BLUE, COLOR_LIGHTBLUE), - COLOR(COLOR_LIGHTBLUE, COLOR_BLUE), - COLOR(COLOR_LIGHTBLUE, COLOR_BLUE)}, - - /* buttoncolors[6], */ - {COLOR(COLOR_BLUE, COLOR_BLACK), - COLOR(COLOR_BLUE, COLOR_LIGHTBLUE), - COLOR(COLOR_LIGHTBLUE, COLOR_BLACK), - COLOR(COLOR_LIGHTBLUE, COLOR_CYAN), - COLOR(COLOR_BLUE, COLOR_BLACK), - COLOR(COLOR_BLUE, COLOR_CYAN)}, - - /* hyperlinkcolors[6], */ - {COLOR(COLOR_BLACK, COLOR_BLUE), - COLOR(COLOR_BLACK, COLOR_BLUE), - COLOR(COLOR_BLUE, COLOR_CYAN), - COLOR(COLOR_BLUE, COLOR_WHITE), - COLOR(COLOR_LIGHTBLUE, COLOR_CYAN), - COLOR(COLOR_LIGHTBLUE, COLOR_WHITE)}, - - /* textentrycolors[6], */ - {COLOR(COLOR_BLACK, COLOR_BLUE), - COLOR(COLOR_BLACK, COLOR_LIGHTBLUE), - COLOR(COLOR_BLACK, COLOR_LIGHTBLUE), - COLOR(COLOR_BLACK, COLOR_CYAN), - COLOR(COLOR_WHITE, COLOR_BLUE), - COLOR(COLOR_WHITE, COLOR_BLACK)}, - - /* bitmapcolors[6], */ - {COLOR(COLOR_BLUE, COLOR_BLACK), - COLOR(COLOR_BLUE, COLOR_LIGHTBLUE), - COLOR(COLOR_LIGHTBLUE, COLOR_BLACK), - COLOR(COLOR_LIGHTBLUE, COLOR_CYAN), - COLOR(COLOR_LIGHTBLUE, COLOR_BLACK), - COLOR(COLOR_LIGHTBLUE, COLOR_CYAN)}, - - /* textmapcolors[6], */ - {COLOR(COLOR_BLACK, COLOR_BLUE), - COLOR(COLOR_BLACK, COLOR_BLUE), - COLOR(COLOR_BLUE, COLOR_LIGHTBLUE), - COLOR(COLOR_BLUE, COLOR_LIGHTBLUE), - COLOR(COLOR_LIGHTBLUE, COLOR_BLUE), - COLOR(COLOR_LIGHTBLUE, COLOR_BLUE)}, - - /* iconcolors[6]; */ - {COLOR(COLOR_BLUE, COLOR_BLACK), - COLOR(COLOR_BLUE, COLOR_LIGHTBLUE), - COLOR(COLOR_LIGHTBLUE, COLOR_BLACK), - COLOR(COLOR_LIGHTGREEN, COLOR_LIGHTBLUE), - COLOR(COLOR_LIGHTBLUE, COLOR_BLACK), - COLOR(COLOR_LIGHTBLUE, COLOR_CYAN)}, - - - /* Button corner colors. */ - /* unsigned char buttonleftcolors[6], */ - {COLOR(COLOR_BLACK, COLOR_BLUE), - COLOR(COLOR_BLACK, COLOR_BLUE), - COLOR(COLOR_BLUE, COLOR_LIGHTBLUE), - COLOR(COLOR_BLUE, COLOR_LIGHTBLUE), - COLOR(COLOR_LIGHTBLUE, COLOR_BLUE), - COLOR(COLOR_LIGHTBLUE, COLOR_BLUE)}, - - /* buttonrightcolors[6]; */ - {COLOR(COLOR_BLACK, COLOR_BLUE), - COLOR(COLOR_BLACK, COLOR_BLUE), - COLOR(COLOR_BLUE, COLOR_LIGHTBLUE), - COLOR(COLOR_BLUE, COLOR_LIGHTBLUE), - COLOR(COLOR_LIGHTBLUE, COLOR_BLUE), - COLOR(COLOR_LIGHTBLUE, COLOR_BLUE)}, - - - /* Menu colors. */ - /* unsigned char menucolor,*/ - COLOR(COLOR_BLUE, COLOR_LIGHTBLUE), - - /* openmenucolor, */ - COLOR(COLOR_LIGHTBLUE, COLOR_BLUE), - - /* activemenucolor; */ - COLOR(COLOR_CYAN, COLOR_BLUE), - - /* Border and screen colors. */ - /* unsigned char bordercolor,*/ - 0, - - /* screencolor; */ - 0, - - /* Pointer sprite 0 color */ - /*unsigned char pointermaskcolor,*/ - 3, - - /* Pointer sprite 1 color */ - /* pointercolor; */ - 6, - - - /* Pointer sprite. */ - /* unsigned char pointer[128]; */ - {0x00, 0x00, 0x00, - 0x40, 0x00, 0x00, - 0x60, 0x00, 0x00, - 0x70, 0x00, 0x00, - 0x78, 0x00, 0x00, - 0x7c, 0x00, 0x00, - 0x70, 0x00, 0x00, - 0x58, 0x00, 0x00, - 0x18, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, - - 0xc0, 0x00, 0x00, - 0xe0, 0x00, 0x00, - 0xf0, 0x00, 0x00, - 0xf8, 0x00, 0x00, - 0xfc, 0x00, 0x00, - 0xfe, 0x00, 0x00, - 0xfe, 0x00, 0x00, - 0xfc, 0x00, 0x00, - 0xfc, 0x00, 0x00, - 0x3c, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00 }, - - - - /* Background pattern fill. */ - /* unsigned char backgroundpattern[8*25]; */ - {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00, - 0x00,0x00,0x10,0x38,0x10,0x00,0x00,0x00, - 0x00,0x00,0x18,0x3c,0x3c,0x18,0x00,0x00, - 0x00,0x18,0x3c,0x7e,0x7e,0x3c,0x18,0x00, - 0x00,0x3c,0x7e,0x7e,0x7e,0x7e,0x3c,0x00, - 0x3c,0x7e,0xff,0xff,0xff,0xff,0x7e,0x3c, - 0x7e,0xff,0xff,0xff,0xff,0xff,0xff,0x7e, - - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00, - 0x00,0x00,0x10,0x38,0x10,0x00,0x00,0x00, - 0x00,0x00,0x18,0x3c,0x3c,0x18,0x00,0x00, - 0x00,0x18,0x3c,0x7e,0x7e,0x3c,0x18,0x00, - 0x00,0x3c,0x7e,0x7e,0x7e,0x7e,0x3c,0x00, - 0x3c,0x7e,0xff,0xff,0xff,0xff,0x7e,0x3c, - 0x7e,0xff,0xff,0xff,0xff,0xff,0xff,0x7e, - - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00, - 0x00,0x00,0x10,0x38,0x10,0x00,0x00,0x00, - 0x00,0x00,0x18,0x3c,0x3c,0x18,0x00,0x00, - 0x00,0x18,0x3c,0x7e,0x7e,0x3c,0x18,0x00, - 0x00,0x3c,0x7e,0x7e,0x7e,0x7e,0x3c,0x00, - 0x3c,0x7e,0xff,0xff,0xff,0xff,0x7e,0x3c, - 0x7e,0xff,0xff,0xff,0xff,0xff,0xff,0x7e, - - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - }, - - /* Background colors. */ - /* unsigned char backgroundpatterncolors[25]; */ - { - COLOR(BGCOLOR1,BGCOLOR2),COLOR(BGCOLOR1,BGCOLOR2), - COLOR(BGCOLOR1,BGCOLOR2),COLOR(BGCOLOR1,BGCOLOR2), - COLOR(BGCOLOR1,BGCOLOR2),COLOR(BGCOLOR1,BGCOLOR2), - COLOR(BGCOLOR1,BGCOLOR2),COLOR(BGCOLOR1,BGCOLOR2), - - COLOR(BGCOLOR2,BGCOLOR3),COLOR(BGCOLOR2,BGCOLOR3), - COLOR(BGCOLOR2,BGCOLOR3),COLOR(BGCOLOR2,BGCOLOR3), - COLOR(BGCOLOR2,BGCOLOR3),COLOR(BGCOLOR2,BGCOLOR3), - COLOR(BGCOLOR2,BGCOLOR3),COLOR(BGCOLOR2,BGCOLOR3), - - COLOR(BGCOLOR3,BGCOLOR4),COLOR(BGCOLOR3,BGCOLOR4), - COLOR(BGCOLOR3,BGCOLOR4),COLOR(BGCOLOR3,BGCOLOR4), - COLOR(BGCOLOR3,BGCOLOR4),COLOR(BGCOLOR3,BGCOLOR4), - COLOR(BGCOLOR3,BGCOLOR4),COLOR(BGCOLOR3,BGCOLOR4), - - COLOR(BGCOLOR4,BGCOLOR4)}, - - - - }; diff --git a/backyard/platform/c64/ctk/ctk-hires-theme-default.c b/backyard/platform/c64/ctk/ctk-hires-theme-default.c deleted file mode 100644 index 51c17ed19..000000000 --- a/backyard/platform/c64/ctk/ctk-hires-theme-default.c +++ /dev/null @@ -1,303 +0,0 @@ - /* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop OS for the C64 - * - * $Id: ctk-hires-theme-default.c,v 1.1 2007/05/23 23:11:27 oliverschmidt Exp $ - * - */ - -#include -#include "ctk-hires-theme.h" - -#define COLOR(bg, fg) ((fg << 4) | (bg)) - -#define BGCOLOR1 7 -#define BGCOLOR2 10 -#define BGCOLOR3 4 -#define BGCOLOR4 6 - -struct ctk_hires_theme ctk_hires_theme = - { - /* Version string. */ - /* char version[8]; */ - {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, - - /* Window borders patterns. */ - /* unsigned char ulcorner[8], */ /* Upper left corner. */ - {0xff,0xff,0xc0,0xcf,0xc0,0xc3,0xc0,0xc0}, - - /* titlebar[8], */ /* Title bar pattern. */ - {0xff,0xff,0x00,0xff,0x00,0xff,0x00,0x00}, - - /* urcorner[8], */ /* Upper right corner. */ - {0xff,0xfc,0x00,0xf0,0x00,0xc0,0x00,0x00}, - - /* rightborder[8], */ /* Right border. */ - {0x0b,0x0b,0x0b,0x0b,0x0b,0x0b,0x0b,0x0b}, - - /* lrcorner[8], */ /* Lower right corner. */ - {0x0b,0x0b,0x0b,0x0b,0xfb,0x03,0xff,0xff}, - - /* lowerborder[8], */ /* Lower border. */ - {0x00,0x00,0x00,0x00,0xff,0x00,0xff,0xff}, - - /* llcorner[8], */ /* Lower left corner. */ - {0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0x80,0x00}, - - /* leftborder[8]; */ /* Left border. */ - {0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0,0xc0}, - - /* Button corner patterns. */ - /* unsigned char buttonleft[8], */ - {0xc5,0xdf,0xdf,0xdf,0xdf,0xdf,0xdf,0xdf}, - - /* buttonright[8]; */ - {0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xfb,0xa3}, - - /* Menu border patterns. */ - /* unsigned char menuleftpattern[8], */ - {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}, - - /* menurightpatterns[8]; */ - {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}, - - /* Window and widget colors. */ - /* unsigned char windowcolors[6], */ - {COLOR(COLOR_GRAY2, COLOR_GRAY1), - COLOR(COLOR_GRAY2, COLOR_GRAY3), - COLOR(COLOR_GRAY3, COLOR_GRAY1), - COLOR(COLOR_GRAY3, COLOR_WHITE), - COLOR(COLOR_WHITE, COLOR_BLACK), - COLOR(COLOR_WHITE, COLOR_BLACK)}, - - /* separatorcolors[6], */ - {COLOR(COLOR_GRAY2, COLOR_GRAY1), - COLOR(COLOR_GRAY2, COLOR_GRAY1), - COLOR(COLOR_GRAY3, COLOR_GRAY2), - COLOR(COLOR_GRAY3, COLOR_GRAY2), - COLOR(COLOR_WHITE, COLOR_GRAY1), - COLOR(COLOR_WHITE, COLOR_GRAY1)}, - - /* labelcolors[6], */ - {COLOR(COLOR_GRAY2, COLOR_GRAY1), - COLOR(COLOR_GRAY2, COLOR_GRAY1), - COLOR(COLOR_WHITE, COLOR_BLACK), - COLOR(COLOR_WHITE, COLOR_BLACK), - COLOR(COLOR_WHITE, COLOR_BLACK), - COLOR(COLOR_WHITE, COLOR_BLACK)}, - - /* buttoncolors[6], */ - {COLOR(COLOR_GRAY2, COLOR_GRAY1), - COLOR(COLOR_GRAY1, COLOR_GRAY2), - COLOR(COLOR_GRAY3, COLOR_GRAY1), - COLOR(COLOR_GRAY1, COLOR_GRAY3), - COLOR(COLOR_GRAY3, COLOR_GRAY1), - COLOR(COLOR_GRAY1, COLOR_GRAY3)}, - - /* hyperlinkcolors[6], */ - {COLOR(COLOR_GRAY2, COLOR_LIGHTBLUE), - COLOR(COLOR_GRAY2, COLOR_LIGHTBLUE), - COLOR(COLOR_WHITE, COLOR_BLUE), - COLOR(COLOR_BLUE, COLOR_WHITE), - COLOR(COLOR_WHITE, COLOR_BLUE), - COLOR(COLOR_BLUE, COLOR_WHITE)}, - - /* textentrycolors[6], */ - {COLOR(COLOR_GRAY2, COLOR_GRAY1), - COLOR(COLOR_GRAY2, COLOR_BLACK), - COLOR(COLOR_WHITE, COLOR_BLACK), - COLOR(COLOR_WHITE, COLOR_BLACK), - COLOR(COLOR_GRAY3, COLOR_BLACK), - COLOR(COLOR_GRAY3, COLOR_BLACK)}, - - /* bitmapcolors[6], */ - {COLOR(COLOR_GRAY2, COLOR_GRAY1), - COLOR(COLOR_GRAY1, COLOR_BLACK), - COLOR(COLOR_WHITE, COLOR_GRAY1), - COLOR(COLOR_GRAY3, COLOR_BLACK), - COLOR(COLOR_GRAY3, COLOR_BLACK), - COLOR(COLOR_GRAY3, COLOR_BLACK)}, - - /* textmapcolors[6], */ - {COLOR(COLOR_GRAY2, COLOR_GRAY1), - COLOR(COLOR_GRAY2, COLOR_GRAY1), - COLOR(COLOR_WHITE, COLOR_BLACK), - COLOR(COLOR_WHITE, COLOR_BLACK), - COLOR(COLOR_WHITE, COLOR_BLACK), - COLOR(COLOR_WHITE, COLOR_BLACK)}, - - /* iconcolors[6]; */ - {COLOR(COLOR_GRAY3, COLOR_GRAY1), - COLOR(COLOR_GRAY1, COLOR_GRAY2), - COLOR(COLOR_WHITE, COLOR_BLACK), - COLOR(COLOR_BLACK, COLOR_YELLOW), - COLOR(COLOR_WHITE, COLOR_BLACK), - COLOR(COLOR_BLACK, COLOR_YELLOW)}, - - - /* Button corner colors. */ - /* unsigned char buttonleftcolors[6], */ - {COLOR(COLOR_GRAY3, COLOR_GRAY2), - COLOR(COLOR_GRAY1, COLOR_GRAY2), - COLOR(COLOR_WHITE, COLOR_GRAY3), - COLOR(COLOR_GRAY1, COLOR_GRAY3), - COLOR(COLOR_WHITE, COLOR_GRAY3), - COLOR(COLOR_GRAY1, COLOR_GRAY3)}, - - /* buttonrightcolors[6]; */ - {COLOR(COLOR_GRAY1, COLOR_GRAY2), - COLOR(COLOR_GRAY3, COLOR_GRAY2), - COLOR(COLOR_GRAY1, COLOR_GRAY3), - COLOR(COLOR_WHITE, COLOR_GRAY3), - COLOR(COLOR_GRAY1, COLOR_GRAY3), - COLOR(COLOR_WHITE, COLOR_GRAY3)}, - - - /* Menu colors. */ - /* unsigned char menucolor,*/ - COLOR(COLOR_YELLOW, COLOR_BLACK), - - /* openmenucolor, */ - COLOR(COLOR_BLACK, COLOR_YELLOW), - - /* activemenucolor; */ - COLOR(COLOR_WHITE, COLOR_BLACK), - - /* Border and screen colors. */ - /* unsigned char bordercolor,*/ - 6, - - /* screencolor; */ - 0, - - /* Pointer sprite 0 color */ - 0, - - /* Pointer sprite 1 color */ - 1, - - - /* Pointer sprite. */ - /* unsigned char pointer[128]; */ - {0x00, 0x00, 0x00, - 0x40, 0x00, 0x00, - 0x60, 0x00, 0x00, - 0x70, 0x00, 0x00, - 0x78, 0x00, 0x00, - 0x7c, 0x00, 0x00, - 0x70, 0x00, 0x00, - 0x58, 0x00, 0x00, - 0x18, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, - - 0xc0, 0x00, 0x00, - 0xe0, 0x00, 0x00, - 0xf0, 0x00, 0x00, - 0xf8, 0x00, 0x00, - 0xfc, 0x00, 0x00, - 0xfe, 0x00, 0x00, - 0xfe, 0x00, 0x00, - 0xfc, 0x00, 0x00, - 0xfc, 0x00, 0x00, - 0x3c, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00 }, - - - - /* Background pattern fill. */ - /* unsigned char backgroundpattern[8*25]; */ - {0x88,0x00,0x22,0x00,0x88,0x00,0x22,0x00, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xdd,0xff,0x77,0xff,0xdd,0xff,0x77, - 0xff,0x55,0xff,0x55,0xff,0x55,0xff,0x55, - 0xee,0x55,0xbb,0x55,0xee,0x55,0xbb,0x55, - 0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55, - 0xaa,0x44,0xaa,0x11,0xaa,0x44,0xaa,0x11, - 0xaa,0x00,0xaa,0x00,0xaa,0x00,0xaa,0x00, - 0x88,0x00,0x22,0x00,0x88,0x00,0x22,0x00, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xdd,0xff,0x77,0xff,0xdd,0xff,0x77, - 0xff,0x55,0xff,0x55,0xff,0x55,0xff,0x55, - 0xee,0x55,0xbb,0x55,0xee,0x55,0xbb,0x55, - 0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55, - 0xaa,0x44,0xaa,0x11,0xaa,0x44,0xaa,0x11, - 0xaa,0x00,0xaa,0x00,0xaa,0x00,0xaa,0x00, - 0x88,0x00,0x22,0x00,0x88,0x00,0x22,0x00, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xdd,0xff,0x77,0xff,0xdd,0xff,0x77, - 0xff,0x55,0xff,0x55,0xff,0x55,0xff,0x55, - 0xee,0x55,0xbb,0x55,0xee,0x55,0xbb,0x55, - 0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55, - 0xaa,0x44,0xaa,0x11,0xaa,0x44,0xaa,0x11, - 0xaa,0x00,0xaa,0x00,0xaa,0x00,0xaa,0x00, - 0x88,0x00,0x22,0x00,0x88,0x00,0x22,0x00}, - - /* Background colors. */ - /* unsigned char backgroundpatterncolors[25]; */ - {COLOR(BGCOLOR1,BGCOLOR1), - COLOR(BGCOLOR2,BGCOLOR1),COLOR(BGCOLOR2,BGCOLOR1), - COLOR(BGCOLOR2,BGCOLOR1),COLOR(BGCOLOR2,BGCOLOR1), - COLOR(BGCOLOR2,BGCOLOR1),COLOR(BGCOLOR2,BGCOLOR1), - COLOR(BGCOLOR2,BGCOLOR1),COLOR(BGCOLOR2,BGCOLOR1), - COLOR(BGCOLOR3,BGCOLOR2),COLOR(BGCOLOR3,BGCOLOR2), - COLOR(BGCOLOR3,BGCOLOR2),COLOR(BGCOLOR3,BGCOLOR2), - COLOR(BGCOLOR3,BGCOLOR2),COLOR(BGCOLOR3,BGCOLOR2), - COLOR(BGCOLOR3,BGCOLOR2),COLOR(BGCOLOR3,BGCOLOR2), - COLOR(BGCOLOR4,BGCOLOR3),COLOR(BGCOLOR4,BGCOLOR3), - COLOR(BGCOLOR4,BGCOLOR3),COLOR(BGCOLOR4,BGCOLOR3), - COLOR(BGCOLOR4,BGCOLOR3),COLOR(BGCOLOR4,BGCOLOR3), - COLOR(BGCOLOR4,BGCOLOR3),COLOR(BGCOLOR4,BGCOLOR3)}, - - - - }; diff --git a/backyard/platform/c64/ctk/ctk-hires-theme-enabler.c b/backyard/platform/c64/ctk/ctk-hires-theme-enabler.c deleted file mode 100644 index c0574b226..000000000 --- a/backyard/platform/c64/ctk/ctk-hires-theme-enabler.c +++ /dev/null @@ -1,303 +0,0 @@ - /* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop OS for the C64 - * - * $Id: ctk-hires-theme-enabler.c,v 1.1 2007/05/23 23:11:27 oliverschmidt Exp $ - * - */ - -#include -#include "ctk-hires-theme.h" - -#define COLOR(bg, fg) ((fg << 4) | (bg)) - -#define BGCOLOR1 0x0f -#define BGCOLOR2 0x0c -#define BGCOLOR3 0x0b -#define BGCOLOR4 0x00 - -struct ctk_hires_theme ctk_hires_theme = - { - /* Version string. */ - /* char version[8]; */ - {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, - - /* Window borders patterns. */ - /* unsigned char ulcorner[8], */ /* Upper left corner. */ - {0xff,0xfc,0xf0,0xf0,0xe0,0xe0,0xe0,0xe0}, - - /* titlebar[8], */ /* Title bar pattern. */ - {0xff,0xff,0xff,0x00,0x00,0x00,0x00,0x00}, - - /* urcorner[8], */ /* Upper right corner. */ - {0xff,0x3f,0x0f,0x0f,0x07,0x07,0x07,0x07}, - - /* rightborder[8], */ /* Right border. */ - {0x07,0x07,0x07,0x07,0x07,0x07,0x07,0x07}, - - /* lrcorner[8], */ /* Lower right corner. */ - {0x07,0x07,0x0f,0x0f,0x3f,0xff,0xff,0xff}, - - /* lowerborder[8], */ /* Lower border. */ - {0x00,0x00,0x00,0x00,0x00,0xff,0xff,0xff}, - - /* llcorner[8], */ /* Lower left corner. */ - {0xe0,0xe0,0xf0,0xf0,0xfc,0xff,0xff,0xff}, - - /* leftborder[8]; */ /* Left border. */ - {0xe0,0xe0,0xe0,0xe0,0xe0,0xe0,0xe0,0xe0}, - - /* Button corner patterns. */ - /* unsigned char buttonleft[8], */ - {0x03,0x0f,0x1f,0x1f,0x1f,0x1f,0x0f,0x03}, - - /* buttonright[8]; */ - {0xc0,0xf0,0xf8,0xf8,0xf8,0xf8,0xf0,0xc0}, - - /* Menu border patterns. */ - /* unsigned char menuleftpattern[8], */ - {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}, - - /* menurightpatterns[8]; */ - {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}, - - /* Window and widget colors. */ - /* unsigned char windowcolors[6], */ - {COLOR(COLOR_GRAY1, COLOR_BLACK), - COLOR(COLOR_GRAY1, COLOR_BLACK), - COLOR(COLOR_GRAY2, COLOR_GRAY1), - COLOR(COLOR_GRAY2, COLOR_GRAY1), - COLOR(COLOR_WHITE, COLOR_BLACK), - COLOR(COLOR_WHITE, COLOR_BLACK)}, - - /* separatorcolors[6], */ - {COLOR(COLOR_GRAY1, COLOR_GRAY2), - COLOR(COLOR_GRAY1, COLOR_GRAY2), - COLOR(COLOR_GRAY2, COLOR_GRAY3), - COLOR(COLOR_GRAY2, COLOR_GRAY3), - COLOR(COLOR_WHITE, COLOR_GRAY1), - COLOR(COLOR_WHITE, COLOR_GRAY1)}, - - /* labelcolors[6], */ - {COLOR(COLOR_GRAY1, COLOR_BLACK), - COLOR(COLOR_GRAY1, COLOR_BLACK), - COLOR(COLOR_GRAY2, COLOR_GRAY1), - COLOR(COLOR_GRAY2, COLOR_GRAY1), - COLOR(COLOR_WHITE, COLOR_BLACK), - COLOR(COLOR_WHITE, COLOR_BLACK)}, - - /* buttoncolors[6], */ - {COLOR(COLOR_GRAY2, COLOR_GRAY1), - COLOR(COLOR_GRAY1, COLOR_GRAY2), - COLOR(COLOR_GRAY3, COLOR_GRAY1), - COLOR(COLOR_GRAY1, COLOR_GRAY3), - COLOR(COLOR_GRAY3, COLOR_GRAY1), - COLOR(COLOR_GRAY1, COLOR_GRAY3)}, - - /* hyperlinkcolors[6], */ - {COLOR(COLOR_GRAY2, COLOR_LIGHTBLUE), - COLOR(COLOR_GRAY2, COLOR_LIGHTBLUE), - COLOR(COLOR_GRAY2, COLOR_BLUE), - COLOR(COLOR_BLUE, COLOR_GRAY2), - COLOR(COLOR_WHITE, COLOR_BLUE), - COLOR(COLOR_BLUE, COLOR_WHITE)}, - - /* textentrycolors[6], */ - {COLOR(COLOR_GRAY1, COLOR_GRAY2), - COLOR(COLOR_GRAY1, COLOR_BLACK), - COLOR(COLOR_GRAY3, COLOR_BLACK), - COLOR(COLOR_GRAY3, COLOR_BLACK), - COLOR(COLOR_GRAY3, COLOR_BLACK), - COLOR(COLOR_GRAY3, COLOR_BLACK)}, - - /* bitmapcolors[6], */ - {COLOR(COLOR_GRAY2, COLOR_GRAY1), - COLOR(COLOR_GRAY1, COLOR_BLACK), - COLOR(COLOR_WHITE, COLOR_GRAY1), - COLOR(COLOR_GRAY3, COLOR_BLACK), - COLOR(COLOR_GRAY3, COLOR_BLACK), - COLOR(COLOR_GRAY3, COLOR_BLACK)}, - - /* textmapcolors[6], */ - {COLOR(COLOR_GRAY2, COLOR_GRAY1), - COLOR(COLOR_GRAY2, COLOR_GRAY1), - COLOR(COLOR_WHITE, COLOR_BLACK), - COLOR(COLOR_WHITE, COLOR_BLACK), - COLOR(COLOR_WHITE, COLOR_BLACK), - COLOR(COLOR_WHITE, COLOR_BLACK)}, - - /* iconcolors[6]; */ - {COLOR(COLOR_GRAY2, COLOR_GRAY1), - COLOR(COLOR_GRAY1, COLOR_GRAY2), - COLOR(COLOR_GRAY3, COLOR_GRAY1), - COLOR(COLOR_GRAY1, COLOR_GRAY3), - COLOR(COLOR_WHITE, COLOR_BLACK), - COLOR(COLOR_BLACK, COLOR_YELLOW)}, - - - /* Button corner colors. */ - /* unsigned char buttonleftcolors[6], */ - {COLOR(COLOR_GRAY1, COLOR_GRAY2), - COLOR(COLOR_GRAY1, COLOR_GRAY1), - COLOR(COLOR_GRAY2, COLOR_GRAY3), - COLOR(COLOR_GRAY2, COLOR_GRAY1), - COLOR(COLOR_WHITE, COLOR_GRAY3), - COLOR(COLOR_WHITE, COLOR_GRAY1)}, - - /* buttonrightcolors[6]; */ - {COLOR(COLOR_GRAY1, COLOR_GRAY2), - COLOR(COLOR_GRAY1, COLOR_GRAY1), - COLOR(COLOR_GRAY2, COLOR_GRAY3), - COLOR(COLOR_GRAY2, COLOR_GRAY1), - COLOR(COLOR_WHITE, COLOR_GRAY3), - COLOR(COLOR_WHITE, COLOR_GRAY1)}, - - - /* Menu colors. */ - /* unsigned char menucolor,*/ - COLOR(COLOR_GRAY3, COLOR_BLACK), - - /* openmenucolor, */ - COLOR(COLOR_GRAY1, COLOR_GRAY3), - - /* activemenucolor; */ - COLOR(COLOR_WHITE, COLOR_BLACK), - - /* Border and screen colors. */ - /* unsigned char bordercolor,*/ - 0, - - /* screencolor; */ - 0, - - /* Pointer sprite 0 color */ - 0, - - /* Pointer sprite 1 color */ - 1, - - - /* Pointer sprite. */ - /* unsigned char pointer[128]; */ - {0x00, 0x00, 0x00, - 0x40, 0x00, 0x00, - 0x60, 0x00, 0x00, - 0x70, 0x00, 0x00, - 0x78, 0x00, 0x00, - 0x7c, 0x00, 0x00, - 0x70, 0x00, 0x00, - 0x58, 0x00, 0x00, - 0x18, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, - - 0xc0, 0x00, 0x00, - 0xe0, 0x00, 0x00, - 0xf0, 0x00, 0x00, - 0xf8, 0x00, 0x00, - 0xfc, 0x00, 0x00, - 0xfe, 0x00, 0x00, - 0xfe, 0x00, 0x00, - 0xfc, 0x00, 0x00, - 0xfc, 0x00, 0x00, - 0x3c, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00 }, - - - - /* Background pattern fill. */ - /* unsigned char backgroundpattern[8*25]; */ - {0x88,0x00,0x22,0x00,0x88,0x00,0x22,0x00, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xdd,0xff,0x77,0xff,0xdd,0xff,0x77, - 0xff,0x55,0xff,0x55,0xff,0x55,0xff,0x55, - 0xee,0x55,0xbb,0x55,0xee,0x55,0xbb,0x55, - 0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55, - 0xaa,0x44,0xaa,0x11,0xaa,0x44,0xaa,0x11, - 0xaa,0x00,0xaa,0x00,0xaa,0x00,0xaa,0x00, - 0x88,0x00,0x22,0x00,0x88,0x00,0x22,0x00, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xdd,0xff,0x77,0xff,0xdd,0xff,0x77, - 0xff,0x55,0xff,0x55,0xff,0x55,0xff,0x55, - 0xee,0x55,0xbb,0x55,0xee,0x55,0xbb,0x55, - 0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55, - 0xaa,0x44,0xaa,0x11,0xaa,0x44,0xaa,0x11, - 0xaa,0x00,0xaa,0x00,0xaa,0x00,0xaa,0x00, - 0x88,0x00,0x22,0x00,0x88,0x00,0x22,0x00, - 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, - 0xff,0xdd,0xff,0x77,0xff,0xdd,0xff,0x77, - 0xff,0x55,0xff,0x55,0xff,0x55,0xff,0x55, - 0xee,0x55,0xbb,0x55,0xee,0x55,0xbb,0x55, - 0xaa,0x55,0xaa,0x55,0xaa,0x55,0xaa,0x55, - 0xaa,0x44,0xaa,0x11,0xaa,0x44,0xaa,0x11, - 0xaa,0x00,0xaa,0x00,0xaa,0x00,0xaa,0x00, - 0x88,0x00,0x22,0x00,0x88,0x00,0x22,0x00}, - - /* Background colors. */ - /* unsigned char backgroundpatterncolors[25]; */ - {COLOR(BGCOLOR1,BGCOLOR1), - COLOR(BGCOLOR2,BGCOLOR1),COLOR(BGCOLOR2,BGCOLOR1), - COLOR(BGCOLOR2,BGCOLOR1),COLOR(BGCOLOR2,BGCOLOR1), - COLOR(BGCOLOR2,BGCOLOR1),COLOR(BGCOLOR2,BGCOLOR1), - COLOR(BGCOLOR2,BGCOLOR1),COLOR(BGCOLOR2,BGCOLOR1), - COLOR(BGCOLOR3,BGCOLOR2),COLOR(BGCOLOR3,BGCOLOR2), - COLOR(BGCOLOR3,BGCOLOR2),COLOR(BGCOLOR3,BGCOLOR2), - COLOR(BGCOLOR3,BGCOLOR2),COLOR(BGCOLOR3,BGCOLOR2), - COLOR(BGCOLOR3,BGCOLOR2),COLOR(BGCOLOR3,BGCOLOR2), - COLOR(BGCOLOR4,BGCOLOR3),COLOR(BGCOLOR4,BGCOLOR3), - COLOR(BGCOLOR4,BGCOLOR3),COLOR(BGCOLOR4,BGCOLOR3), - COLOR(BGCOLOR4,BGCOLOR3),COLOR(BGCOLOR4,BGCOLOR3), - COLOR(BGCOLOR4,BGCOLOR3),COLOR(BGCOLOR4,BGCOLOR3)}, - - - - }; diff --git a/backyard/platform/c64/ctk/ctk-hires-theme-ravenpine.c b/backyard/platform/c64/ctk/ctk-hires-theme-ravenpine.c deleted file mode 100644 index 233504649..000000000 --- a/backyard/platform/c64/ctk/ctk-hires-theme-ravenpine.c +++ /dev/null @@ -1,288 +0,0 @@ - /* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop OS for the C64 - * - * $Id: ctk-hires-theme-ravenpine.c,v 1.1 2007/05/23 23:11:27 oliverschmidt Exp $ - * - */ - -#include -#include "ctk-hires-theme.h" - -#define COLOR(bg, fg) ((fg << 4) | (bg)) - -#define BGCOLOR1 0x00 -#define BGCOLOR2 0x05 - - -struct ctk_hires_theme ctk_hires_theme = - { - /* Version string. */ - /* char version[8]; */ - {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, - - /* Window borders patterns. */ - /* unsigned char ulcorner[8], */ /* Upper left corner. */ - {0x00,0x3f,0x3f,0x30,0x30,0x30,0x30,0x30}, - - /* titlebar[8], */ /* Title bar pattern. */ - {0x00,0xff,0xff,0x00,0x00,0x00,0x00,0x00}, - - /* urcorner[8], */ /* Upper right corner. */ - {0x00,0xfc,0xfc,0x0c,0x0c,0x0c,0x0c,0x0c}, - - /* rightborder[8], */ /* Right border. */ - {0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c}, - - /* lrcorner[8], */ /* Lower right corner. */ - {0x0c,0x0c,0x0c,0x0c,0x0c,0xfc,0xfc,0x00}, - - /* lowerborder[8], */ /* Lower border. */ - {0x00,0x00,0x00,0x00,0x00,0xff,0xff,0x00}, - - /* llcorner[8], */ /* Lower left corner. */ - {0x30,0x30,0x30,0x30,0x30,0x3f,0x3f,0x00}, - - /* leftborder[8]; */ /* Left border. */ - {0x30,0x30,0x30,0x30,0x30,0x30,0x30,0x30}, - - /* Button corner patterns. */ - /* unsigned char buttonleft[8], */ - {0x3e,0x30,0x30,0x30,0x30,0x30,0x30,0x3c}, - - /* buttonright[8]; */ - {0x1c,0x0c,0x0c,0x0c,0x0c,0x0c,0x0c,0x3c}, - - /* Menu border patterns. */ - /* unsigned char menuleftpattern[8], */ - {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}, - - /* menurightpatterns[8]; */ - {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}, - - /* Window and widget colors. */ - /* unsigned char windowcolors[6], */ - {COLOR(COLOR_BLACK, COLOR_GRAY1), - COLOR(COLOR_BLACK, COLOR_GRAY1), - COLOR(COLOR_BLACK, COLOR_GREEN), - COLOR(COLOR_BLACK, COLOR_GREEN), - COLOR(COLOR_LIGHTGREEN, COLOR_BLACK), - COLOR(COLOR_LIGHTGREEN, COLOR_BLACK)}, - - /* separatorcolors[6], */ - {COLOR(COLOR_BLACK, COLOR_GRAY1), - COLOR(COLOR_BLACK, COLOR_GRAY1), - COLOR(COLOR_BLACK, COLOR_GREEN), - COLOR(COLOR_BLACK, COLOR_GREEN), - COLOR(COLOR_LIGHTGREEN, COLOR_BLACK), - COLOR(COLOR_LIGHTGREEN, COLOR_BLACK)}, - - /* labelcolors[6], */ - {COLOR(COLOR_BLACK, COLOR_GRAY1), - COLOR(COLOR_BLACK, COLOR_GRAY1), - COLOR(COLOR_BLACK, COLOR_GREEN), - COLOR(COLOR_BLACK, COLOR_GREEN), - COLOR(COLOR_LIGHTGREEN, COLOR_BLACK), - COLOR(COLOR_LIGHTGREEN, COLOR_BLACK)}, - - /* buttoncolors[6], */ - {COLOR(COLOR_BLACK, COLOR_GRAY1), - COLOR(COLOR_BLACK, COLOR_GRAY1), - COLOR(COLOR_BLACK, COLOR_GREEN), - COLOR(COLOR_LIGHTGREEN, COLOR_BLACK), - COLOR(COLOR_LIGHTGREEN, COLOR_BLACK), - COLOR(COLOR_LIGHTGREEN, COLOR_WHITE)}, - - /* hyperlinkcolors[6], */ - {COLOR(COLOR_BLACK, COLOR_BLUE), - COLOR(COLOR_BLACK, COLOR_BLUE), - COLOR(COLOR_BLACK, COLOR_BLUE), - COLOR(COLOR_GREEN, COLOR_LIGHTBLUE), - COLOR(COLOR_LIGHTGREEN, COLOR_BLUE), - COLOR(COLOR_LIGHTGREEN, COLOR_LIGHTBLUE)}, - - /* textentrycolors[6], */ - {COLOR(COLOR_BLACK, COLOR_GRAY1), - COLOR(COLOR_BLACK, COLOR_GRAY1), - COLOR(COLOR_BLACK, COLOR_GREEN), - COLOR(COLOR_BLACK, COLOR_LIGHTGREEN), - COLOR(COLOR_LIGHTGREEN, COLOR_BLACK), - COLOR(COLOR_LIGHTGREEN, COLOR_WHITE)}, - - - /* bitmapcolors[6], */ - {COLOR(COLOR_BLACK, COLOR_GRAY1), - COLOR(COLOR_BLACK, COLOR_GRAY1), - COLOR(COLOR_BLACK, COLOR_GREEN), - COLOR(COLOR_GREEN, COLOR_LIGHTGREEN), - COLOR(COLOR_GREEN, COLOR_LIGHTGREEN), - COLOR(COLOR_GREEN, COLOR_WHITE)}, - - - /* textmapcolors[6], */ - {COLOR(COLOR_BLACK, COLOR_GRAY1), - COLOR(COLOR_BLACK, COLOR_GRAY1), - COLOR(COLOR_BLACK, COLOR_GREEN), - COLOR(COLOR_GREEN, COLOR_LIGHTGREEN), - COLOR(COLOR_GREEN, COLOR_LIGHTGREEN), - COLOR(COLOR_GREEN, COLOR_WHITE)}, - - /* iconcolors[6]; */ - {COLOR(COLOR_BLACK, COLOR_GRAY1), - COLOR(COLOR_BLACK, COLOR_GRAY1), - COLOR(COLOR_BLACK, COLOR_GREEN), - COLOR(COLOR_LIGHTGREEN, COLOR_BLACK), - COLOR(COLOR_GREEN, COLOR_LIGHTGREEN), - COLOR(COLOR_GREEN, COLOR_WHITE)}, - - - /* Button corner colors. */ - /* unsigned char buttonleftcolors[6], */ - {COLOR(COLOR_BLACK, COLOR_GRAY1), - COLOR(COLOR_BLACK, COLOR_GRAY1), - COLOR(COLOR_BLACK, COLOR_GREEN), - COLOR(COLOR_LIGHTGREEN, COLOR_BLACK), - COLOR(COLOR_LIGHTGREEN, COLOR_BLACK), - COLOR(COLOR_LIGHTGREEN, COLOR_WHITE)}, - - /* buttonrightcolors[6]; */ - {COLOR(COLOR_BLACK, COLOR_GRAY1), - COLOR(COLOR_BLACK, COLOR_GRAY1), - COLOR(COLOR_BLACK, COLOR_GREEN), - COLOR(COLOR_LIGHTGREEN, COLOR_BLACK), - COLOR(COLOR_LIGHTGREEN, COLOR_BLACK), - COLOR(COLOR_LIGHTGREEN, COLOR_WHITE)}, - - - /* Menu colors. */ - /* unsigned char menucolor,*/ - COLOR(COLOR_GREEN, COLOR_BLACK), - - /* openmenucolor, */ - COLOR(COLOR_BLACK, COLOR_GREEN), - - /* activemenucolor; */ - COLOR(COLOR_LIGHTGREEN, COLOR_GREEN), - - /* Border and screen colors. */ - /* unsigned char bordercolor,*/ - 0, - - /* screencolor; */ - 0, - - /* Pointer sprite 0 color */ - COLOR_LIGHTGREEN, - - /* Pointer sprite 1 color */ - COLOR_GREEN, - - - /* Pointer sprite. */ - /* unsigned char pointer[128]; */ - {0x00, 0x00, 0x00, - 0x40, 0x00, 0x00, - 0x60, 0x00, 0x00, - 0x70, 0x00, 0x00, - 0x78, 0x00, 0x00, - 0x7c, 0x00, 0x00, - 0x70, 0x00, 0x00, - 0x58, 0x00, 0x00, - 0x18, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, - - 0xc0, 0x00, 0x00, - 0xe0, 0x00, 0x00, - 0xf0, 0x00, 0x00, - 0xf8, 0x00, 0x00, - 0xfc, 0x00, 0x00, - 0xfe, 0x00, 0x00, - 0xfe, 0x00, 0x00, - 0xfc, 0x00, 0x00, - 0xfc, 0x00, 0x00, - 0x3c, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00 }, - - - - /* Background pattern fill. */ - /* unsigned char backgroundpattern[8*25]; */ - { - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0, - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0, - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0, - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0, - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0, - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0, - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0, - 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0, 0, - }, - /* Background colors. */ - /* unsigned char backgroundpatterncolors[25]; */ - {COLOR(BGCOLOR1,BGCOLOR2), - COLOR(BGCOLOR1,BGCOLOR2),COLOR(BGCOLOR1,BGCOLOR2), - COLOR(BGCOLOR1,BGCOLOR2),COLOR(BGCOLOR1,BGCOLOR2), - COLOR(BGCOLOR1,BGCOLOR2),COLOR(BGCOLOR1,BGCOLOR2), - COLOR(BGCOLOR1,BGCOLOR2),COLOR(BGCOLOR1,BGCOLOR2), - COLOR(BGCOLOR1,BGCOLOR2),COLOR(BGCOLOR1,BGCOLOR2), - COLOR(BGCOLOR1,BGCOLOR2),COLOR(BGCOLOR1,BGCOLOR2), - COLOR(BGCOLOR1,BGCOLOR2),COLOR(BGCOLOR1,BGCOLOR2), - COLOR(BGCOLOR1,BGCOLOR2),COLOR(BGCOLOR1,BGCOLOR2), - COLOR(BGCOLOR1,BGCOLOR2),COLOR(BGCOLOR1,BGCOLOR2), - COLOR(BGCOLOR1,BGCOLOR2),COLOR(BGCOLOR1,BGCOLOR2), - COLOR(BGCOLOR1,BGCOLOR2),COLOR(BGCOLOR1,BGCOLOR2), - COLOR(BGCOLOR1,BGCOLOR2),COLOR(BGCOLOR1,BGCOLOR2)}, - - - - }; diff --git a/backyard/platform/c64/ctk/ctk-hires-theme-springlight.c b/backyard/platform/c64/ctk/ctk-hires-theme-springlight.c deleted file mode 100644 index 75fe45f44..000000000 --- a/backyard/platform/c64/ctk/ctk-hires-theme-springlight.c +++ /dev/null @@ -1,284 +0,0 @@ - /* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop OS for the C64 - * - * $Id: ctk-hires-theme-springlight.c,v 1.1 2007/05/23 23:11:27 oliverschmidt Exp $ - * - */ - -#include -#include "ctk-hires-theme.h" - -#define COLOR(bg, fg) ((fg << 4) | (bg)) - -#define BGCOLOR1 0x05 -#define BGCOLOR2 0x0d - - -struct ctk_hires_theme ctk_hires_theme = - { - /* Version string. */ - /* char version[8]; */ - {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, - - /* Window borders patterns. */ - /* unsigned char ulcorner[8], */ /* Upper left corner. */ - {0x00,0x3f,0x6a,0x40,0x60,0x40,0x60,0x40}, - - /* titlebar[8], */ /* Title bar pattern. */ - {0x00,0xff,0xaa,0x00,0x00,0x00,0x00,0x00}, - - /* urcorner[8], */ /* Upper right corner. */ - {0x00,0xf0,0x20,0x00,0x00,0x00,0x00,0x00}, - - /* rightborder[8], */ /* Right border. */ - {0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02}, - - /* lrcorner[8], */ /* Lower right corner. */ - {0x02,0x02,0x02,0x02,0x02,0x06,0xfc,0x00}, - - /* lowerborder[8], */ /* Lower border. */ - {0x00,0x00,0x00,0x00,0x00,0x00,0xff,0x00}, - - /* llcorner[8], */ /* Lower left corner. */ - {0x60,0x40,0x40,0x40,0x00,0x00,0x00,0x00}, - - /* leftborder[8]; */ /* Left border. */ - {0x60,0x40,0x60,0x40,0x60,0x40,0x60,0x40}, - - /* Button corner patterns. */ - /* unsigned char buttonleft[8], */ - {0x0f,0x18,0x10,0x10,0x10,0x10,0x10,0x00}, - - /* buttonright[8]; */ - {0x00,0x08,0x08,0x08,0x08,0x08,0x18,0xf0}, - - /* Menu border patterns. */ - /* unsigned char menuleftpattern[8], */ - {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}, - - /* menurightpatterns[8]; */ - {0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff}, - - /* Window and widget colors. */ - /* unsigned char windowcolors[6], */ - {COLOR(COLOR_GRAY1, COLOR_BLACK), - COLOR(COLOR_GRAY1, COLOR_GREEN), - COLOR(COLOR_GREEN, COLOR_GRAY1), - COLOR(COLOR_GREEN, COLOR_LIGHTGREEN), - COLOR(COLOR_LIGHTGREEN, COLOR_BLACK), - COLOR(COLOR_LIGHTGREEN, COLOR_BLACK)}, - - /* separatorcolors[6], */ - {COLOR(COLOR_GRAY1, COLOR_GRAY2), - COLOR(COLOR_GRAY1, COLOR_GRAY2), - COLOR(COLOR_GREEN, COLOR_LIGHTGREEN), - COLOR(COLOR_GREEN, COLOR_LIGHTGREEN), - COLOR(COLOR_LIGHTGREEN, COLOR_GRAY1), - COLOR(COLOR_LIGHTGREEN, COLOR_GRAY1)}, - - /* labelcolors[6], */ - {COLOR(COLOR_GRAY1, COLOR_BLACK), - COLOR(COLOR_GRAY1, COLOR_BLACK), - COLOR(COLOR_GREEN, COLOR_LIGHTGREEN), - COLOR(COLOR_GREEN, COLOR_LIGHTGREEN), - COLOR(COLOR_LIGHTGREEN, COLOR_BLACK), - COLOR(COLOR_LIGHTGREEN, COLOR_BLACK)}, - - /* buttoncolors[6], */ - {COLOR(COLOR_GRAY1, COLOR_BLACK), - COLOR(COLOR_GRAY1, COLOR_GREEN), - COLOR(COLOR_GREEN, COLOR_GRAY1), - COLOR(COLOR_GREEN, COLOR_LIGHTGREEN), - COLOR(COLOR_LIGHTGREEN, COLOR_GRAY2), - COLOR(COLOR_LIGHTGREEN, COLOR_WHITE)}, - - /* hyperlinkcolors[6], */ - {COLOR(COLOR_GRAY2, COLOR_LIGHTBLUE), - COLOR(COLOR_GRAY2, COLOR_LIGHTBLUE), - COLOR(COLOR_GREEN, COLOR_CYAN), - COLOR(COLOR_GREEN, COLOR_BLUE), - COLOR(COLOR_LIGHTGREEN, COLOR_BLUE), - COLOR(COLOR_BLUE, COLOR_LIGHTGREEN)}, - - /* textentrycolors[6], */ - {COLOR(COLOR_GREEN, COLOR_GRAY1), - COLOR(COLOR_GREEN, COLOR_BLACK), - COLOR(COLOR_LIGHTGREEN, COLOR_BLACK), - COLOR(COLOR_LIGHTGREEN, COLOR_BLACK), - COLOR(COLOR_GRAY3, COLOR_BLACK), - COLOR(COLOR_GRAY3, COLOR_BLACK)}, - - /* bitmapcolors[6], */ - {COLOR(COLOR_GRAY2, COLOR_GRAY1), - COLOR(COLOR_GRAY1, COLOR_BLACK), - COLOR(COLOR_WHITE, COLOR_GRAY1), - COLOR(COLOR_GRAY3, COLOR_BLACK), - COLOR(COLOR_GRAY3, COLOR_BLACK), - COLOR(COLOR_GRAY3, COLOR_BLACK)}, - - /* textmapcolors[6], */ - {COLOR(COLOR_GRAY2, COLOR_GRAY1), - COLOR(COLOR_GRAY2, COLOR_GRAY1), - COLOR(COLOR_WHITE, COLOR_BLACK), - COLOR(COLOR_WHITE, COLOR_BLACK), - COLOR(COLOR_WHITE, COLOR_BLACK), - COLOR(COLOR_WHITE, COLOR_BLACK)}, - - /* iconcolors[6]; */ - {COLOR(COLOR_GREEN, COLOR_GRAY1), - COLOR(COLOR_GRAY1, COLOR_GREEN), - COLOR(COLOR_LIGHTGREEN, COLOR_GRAY1), - COLOR(COLOR_GRAY1, COLOR_LIGHTGREEN), - COLOR(COLOR_WHITE, COLOR_BLACK), - COLOR(COLOR_BLACK, COLOR_YELLOW)}, - - - /* Button corner colors. */ - /* unsigned char buttonleftcolors[6], */ - {COLOR(COLOR_GRAY1, COLOR_GREEN), - COLOR(COLOR_GRAY1, COLOR_BLACK), - COLOR(COLOR_GREEN, COLOR_LIGHTGREEN), - COLOR(COLOR_GREEN, COLOR_GRAY1), - COLOR(COLOR_LIGHTGREEN, COLOR_WHITE), - COLOR(COLOR_LIGHTGREEN, COLOR_GRAY2)}, - - /* buttonrightcolors[6]; */ - {COLOR(COLOR_GRAY1, COLOR_BLACK), - COLOR(COLOR_GRAY1, COLOR_GREEN), - COLOR(COLOR_GREEN, COLOR_GRAY1), - COLOR(COLOR_GREEN, COLOR_LIGHTGREEN), - COLOR(COLOR_LIGHTGREEN, COLOR_GRAY2), - COLOR(COLOR_LIGHTGREEN, COLOR_WHITE)}, - - - /* Menu colors. */ - /* unsigned char menucolor,*/ - COLOR(COLOR_LIGHTGREEN, COLOR_GRAY1), - - /* openmenucolor, */ - COLOR(COLOR_BLACK, COLOR_GREEN), - - /* activemenucolor; */ - COLOR(COLOR_BLACK, COLOR_LIGHTGREEN), - - /* Border and screen colors. */ - /* unsigned char bordercolor,*/ - 5, - - /* screencolor; */ - 0, - - /* Pointer sprite 0 color */ - COLOR_WHITE, - - /* Pointer sprite 1 color */ - COLOR_GREEN, - - - /* Pointer sprite. */ - /* unsigned char pointer[128]; */ - {0x00, 0x00, 0x00, - 0x40, 0x00, 0x00, - 0x60, 0x00, 0x00, - 0x70, 0x00, 0x00, - 0x78, 0x00, 0x00, - 0x7c, 0x00, 0x00, - 0x70, 0x00, 0x00, - 0x58, 0x00, 0x00, - 0x18, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, - - 0xc0, 0x00, 0x00, - 0xe0, 0x00, 0x00, - 0xf0, 0x00, 0x00, - 0xf8, 0x00, 0x00, - 0xfc, 0x00, 0x00, - 0xfe, 0x00, 0x00, - 0xfe, 0x00, 0x00, - 0xfc, 0x00, 0x00, - 0xfc, 0x00, 0x00, - 0x3c, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, - 0x00 }, - - - - /* Background pattern fill. */ - /* unsigned char backgroundpattern[8*25]; */ - {255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, -255, 255, 223, 255, 255, 247, 255, 255, 191, 247, 255, 255, 219, 255, 255, 187, -255, 239, 251, 191, 239, 253, 223, 251, 223, 253, 183, 255, 213, 127, 237, 191, -245, 95, 245, 223, 181, 255, 85, 255, 85, 219, 118, 219, 109, 219, 182, 109, 219, 182, 109, 219, 170, 109, 219, 170, 181, 173, 85, 218, 85, 173, 170, 85, 170, 85, 170, 85, 170, 85, 170, 85, 170, 146, 85, 146, 170, 82, 138, 50, 74, 164, 73, -146, 84, 137, 82, 4, 169, 18, 164, 2, 168, 18, 68, 18, 160, 10, 32, 74, 0, 42, 128, 18, 64, 20, 0, 82, 0, 4, 80, 4, 0, 72, 2, 0, 16, 132, 0, 0, 72, 0, 0, 4, 64, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - - /* Background colors. */ - /* unsigned char backgroundpatterncolors[25]; */ - {COLOR(BGCOLOR1,BGCOLOR2), - COLOR(BGCOLOR1,BGCOLOR2),COLOR(BGCOLOR1,BGCOLOR2), - COLOR(BGCOLOR1,BGCOLOR2),COLOR(BGCOLOR1,BGCOLOR2), - COLOR(BGCOLOR1,BGCOLOR2),COLOR(BGCOLOR1,BGCOLOR2), - COLOR(BGCOLOR1,BGCOLOR2),COLOR(BGCOLOR1,BGCOLOR2), - COLOR(BGCOLOR1,BGCOLOR2),COLOR(BGCOLOR1,BGCOLOR2), - COLOR(BGCOLOR1,BGCOLOR2),COLOR(BGCOLOR1,BGCOLOR2), - COLOR(BGCOLOR1,BGCOLOR2),COLOR(BGCOLOR1,BGCOLOR2), - COLOR(BGCOLOR1,BGCOLOR2),COLOR(BGCOLOR1,BGCOLOR2), - COLOR(BGCOLOR1,BGCOLOR2),COLOR(BGCOLOR1,BGCOLOR2), - COLOR(BGCOLOR1,BGCOLOR2),COLOR(BGCOLOR1,BGCOLOR2), - COLOR(BGCOLOR1,BGCOLOR2),COLOR(BGCOLOR1,BGCOLOR2), - COLOR(BGCOLOR1,BGCOLOR2),COLOR(BGCOLOR1,BGCOLOR2)}, - - - - }; diff --git a/backyard/platform/c64/ctk/ctk-hires-theme.h b/backyard/platform/c64/ctk/ctk-hires-theme.h deleted file mode 100644 index f522bed1e..000000000 --- a/backyard/platform/c64/ctk/ctk-hires-theme.h +++ /dev/null @@ -1,105 +0,0 @@ - /* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop OS for the C64 - * - * $Id: ctk-hires-theme.h,v 1.1 2007/05/23 23:11:27 oliverschmidt Exp $ - * - */ -#ifndef __CTK_HIRES_THEME_H__ -#define __CTK_HIRES_THEME_H__ - -struct ctk_hires_theme { - /* Version string. */ - char version[8]; - - /* Window borders patterns. */ - unsigned char ulcorner[8], /* Upper left corner. */ - titlebar[8], /* Title bar pattern. */ - urcorner[8], /* Upper right corner. */ - rightborder[8], /* Right border. */ - lrcorner[8], /* Lower right corner. */ - lowerborder[8], /* Lower border. */ - llcorner[8], /* Lower left corner. */ - leftborder[8]; /* Left border. */ - - /* Button corner patterns. */ - unsigned char buttonleftpattern[8], - buttonrightpattern[8]; - - /* Menu border patterns. */ - unsigned char menuleftpattern[8], - menurightpatterns[8]; - - - - /* Window and widget colors. */ - unsigned char windowcolors[6], - separatorcolors[6], - labelcolors[6], - buttoncolors[6], - hyperlinkcolors[6], - textentrycolors[6], - bitmapcolors[6], - textmapcolors[6], - iconcolors[6]; - - - /* Button corner colors. */ - unsigned char buttonleftcolors[6], - buttonrightcolors[6]; - - /* Menu colors. */ - unsigned char menucolor, - openmenucolor, - activemenucolor; - - /* Border and screen colors. */ - unsigned char bordercolor, - screencolor; - - /* Pointer sprite colors. */ - unsigned char pointermaskcolor, - pointercolor; - - /* Pointer sprite. */ - unsigned char pointer[128]; - - /* Background pattern fill. */ - unsigned char backgroundpattern[8*25]; - - /* Background colors. */ - unsigned char backgroundpatterncolors[25]; - -}; - -extern struct ctk_hires_theme ctk_hires_theme; -extern struct ctk_hires_theme *ctk_hires_theme_ptr; - -#endif /* __CTK_HIRES_THEME_H__ */ diff --git a/backyard/platform/c64/ctk/ctk-hires.c b/backyard/platform/c64/ctk/ctk-hires.c deleted file mode 100644 index eb4435ed6..000000000 --- a/backyard/platform/c64/ctk/ctk-hires.c +++ /dev/null @@ -1,871 +0,0 @@ -/* - * Copyright (c) 2002, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the "ctk" console GUI toolkit for cc65 - * - * $Id: ctk-hires.c,v 1.1 2007/05/23 23:11:27 oliverschmidt Exp $ - * - */ - -#include "contiki-version.h" - -#include "ctk/ctk.h" -#include "ctk-draw.h" -#include "ctk-hires.h" -#include "ctk-hires-asm.h" - -#include "ctk-hires-theme.h" - -#include -#include - -#ifndef NULL -#define NULL (void *)0 -#endif /* NULL */ - -#define SCREEN_HEIGHT 25 -#define SCREEN_WIDTH 40 - -#define SCREENADDR 0xdc00 -#define HIRESADDR 0xe000 - -static unsigned char lineptr; - -unsigned char ctk_hires_cursx, ctk_hires_cursy; -unsigned char ctk_hires_reversed; -unsigned char ctk_hires_color; -unsigned char ctk_hires_underline; - -/*static unsigned char cchar; - -static unsigned char tmp01; -static unsigned char tmph, tmpl, tmpborder; -static unsigned char *tmpptr;*/ - - -static unsigned char x, y, i; -/*static unsigned char h;*/ -static unsigned char wfocus; -static unsigned char x1, y1, x2, y2; - -struct ctk_hires_windowparams ctk_hires_windowparams; -unsigned char *ctk_hires_bitmapptr; - -unsigned char ctk_draw_windowborder_height = 1; -unsigned char ctk_draw_windowborder_width = 1; -unsigned char ctk_draw_windowtitle_height = 1; - -/*-----------------------------------------------------------------------------------*/ -/* Tables. */ - -unsigned short ctk_hires_yscreenaddr[25] = - {0 * SCREEN_WIDTH + SCREENADDR, 1 * SCREEN_WIDTH + SCREENADDR, - 2 * SCREEN_WIDTH + SCREENADDR, 3 * SCREEN_WIDTH + SCREENADDR, - 4 * SCREEN_WIDTH + SCREENADDR, 5 * SCREEN_WIDTH + SCREENADDR, - 6 * SCREEN_WIDTH + SCREENADDR, 7 * SCREEN_WIDTH + SCREENADDR, - 8 * SCREEN_WIDTH + SCREENADDR, 9 * SCREEN_WIDTH + SCREENADDR, - 10 * SCREEN_WIDTH + SCREENADDR, 11 * SCREEN_WIDTH + SCREENADDR, - 12 * SCREEN_WIDTH + SCREENADDR, 13 * SCREEN_WIDTH + SCREENADDR, - 14 * SCREEN_WIDTH + SCREENADDR, 15 * SCREEN_WIDTH + SCREENADDR, - 16 * SCREEN_WIDTH + SCREENADDR, 17 * SCREEN_WIDTH + SCREENADDR, - 18 * SCREEN_WIDTH + SCREENADDR, 19 * SCREEN_WIDTH + SCREENADDR, - 20 * SCREEN_WIDTH + SCREENADDR, 21 * SCREEN_WIDTH + SCREENADDR, - 22 * SCREEN_WIDTH + SCREENADDR, 23 * SCREEN_WIDTH + SCREENADDR, - 24 * SCREEN_WIDTH + SCREENADDR}; - -unsigned short ctk_hires_yhiresaddr[25] = - {0 * 320 + HIRESADDR, 1 * 320 + HIRESADDR, - 2 * 320 + HIRESADDR, 3 * 320 + HIRESADDR, - 4 * 320 + HIRESADDR, 5 * 320 + HIRESADDR, - 6 * 320 + HIRESADDR, 7 * 320 + HIRESADDR, - 8 * 320 + HIRESADDR, 9 * 320 + HIRESADDR, - 10 * 320 + HIRESADDR, 11 * 320 + HIRESADDR, - 12 * 320 + HIRESADDR, 13 * 320 + HIRESADDR, - 14 * 320 + HIRESADDR, 15 * 320 + HIRESADDR, - 16 * 320 + HIRESADDR, 17 * 320 + HIRESADDR, - 18 * 320 + HIRESADDR, 19 * 320 + HIRESADDR, - 20 * 320 + HIRESADDR, 21 * 320 + HIRESADDR, - 22 * 320 + HIRESADDR, 23 * 320 + HIRESADDR, - 24 * 320 + HIRESADDR}; -extern struct ctk_hires_theme ctk_hires_theme; -struct ctk_hires_theme *ctk_hires_theme_ptr = &ctk_hires_theme; -/*-----------------------------------------------------------------------------------*/ -#define hires_wherex() ctk_hires_cursx -#define hires_revers(c) ctk_hires_reversed = c -#define hires_color(c) ctk_hires_color = c -#define hires_underline(c) ctk_hires_underline = c -/*-----------------------------------------------------------------------------------*/ -static void __fastcall__ -hires_cvline(unsigned char length) -{ - static unsigned char i; - - for(i = 0; i < length; ++i) { - ctk_hires_cputc('|'); - --ctk_hires_cursx; - ++ctk_hires_cursy; - } -} -/*-----------------------------------------------------------------------------------*/ -static void __fastcall__ -hires_gotoxy(unsigned char x, unsigned char y) -{ - ctk_hires_cursx = x; - ctk_hires_cursy = y; -} -/*-----------------------------------------------------------------------------------*/ -static void __fastcall__ -hires_cclearxy(unsigned char x, unsigned char y, unsigned char length) -{ - hires_gotoxy(x, y); - ctk_hires_cclear(length); -} -/*-----------------------------------------------------------------------------------*/ -static void __fastcall__ -hires_chlinexy(unsigned char x, unsigned char y, unsigned char length) -{ - hires_gotoxy(x, y); - ctk_hires_chline(length); -} -/*-----------------------------------------------------------------------------------*/ -static void __fastcall__ -hires_cvlinexy(unsigned char x, unsigned char y, unsigned char length) -{ - hires_gotoxy(x, y); - hires_cvline(length); -} -/*-----------------------------------------------------------------------------------*/ -static void __fastcall__ -hires_cputcxy(unsigned char x, unsigned char y, char c) -{ - hires_gotoxy(x, y); - ctk_hires_cputc(c); -} -/*-----------------------------------------------------------------------------------*/ -#pragma optimize(push, off) -static void -clear_line(unsigned char line) -{ - lineptr = line; - asm("lda %v", lineptr); - asm("asl"); - asm("tax"); - asm("lda %v,x", ctk_hires_yhiresaddr); - asm("sta ptr2"); - asm("lda %v+1,x", ctk_hires_yhiresaddr); - asm("sta ptr2+1"); - asm("lda %v,x", ctk_hires_yscreenaddr); - asm("sta ptr1"); - asm("lda %v+1,x", ctk_hires_yscreenaddr); - asm("sta ptr1+1"); - - - asm("sei"); - asm("lda $01"); - asm("pha"); - asm("lda #$30"); - asm("sta $01"); - asm("ldy #39"); - asm("ldx %v", lineptr); - asm("lda %v+%w,x", ctk_hires_theme, - offsetof(struct ctk_hires_theme, backgroundpatterncolors)); - asm("clearlineloop1:"); - asm("sta (ptr1),y"); - asm("dey"); - asm("bpl clearlineloop1"); - asm("pla"); - asm("sta $01"); - asm("cli"); - - - asm("lda %v", lineptr); - /* asm("and #7");*/ - asm("asl"); - asm("asl"); - asm("asl"); - asm("tax"); - asm("ldy #0"); - asm("clearlineloop2:"); - asm("lda %v+%w+0,x", ctk_hires_theme, - offsetof(struct ctk_hires_theme, backgroundpattern)); - asm("sta (ptr2),y"); - asm("iny"); - asm("lda %v+%w+1,x", ctk_hires_theme, - offsetof(struct ctk_hires_theme, backgroundpattern)); - asm("sta (ptr2),y"); - asm("iny"); - asm("lda %v+%w+2,x", ctk_hires_theme, - offsetof(struct ctk_hires_theme, backgroundpattern)); - asm("sta (ptr2),y"); - asm("iny"); - asm("lda %v+%w+3,x", ctk_hires_theme, - offsetof(struct ctk_hires_theme, backgroundpattern)); - asm("sta (ptr2),y"); - asm("iny"); - asm("lda %v+%w+4,x", ctk_hires_theme, - offsetof(struct ctk_hires_theme, backgroundpattern)); - asm("sta (ptr2),y"); - asm("iny"); - asm("lda %v+%w+5,x", ctk_hires_theme, - offsetof(struct ctk_hires_theme, backgroundpattern)); - asm("sta (ptr2),y"); - asm("iny"); - asm("lda %v+%w+6,x", ctk_hires_theme, - offsetof(struct ctk_hires_theme, backgroundpattern)); - asm("sta (ptr2),y"); - asm("iny"); - asm("lda %v+%w+7,x", ctk_hires_theme, - offsetof(struct ctk_hires_theme, backgroundpattern)); - asm("sta (ptr2),y"); - asm("iny"); - asm("bne clearlineloop2"); - - asm("inc ptr2+1"); - - asm("ldy #0"); - asm("clearlineloop3:"); - asm("lda %v+%w+0,x", ctk_hires_theme, - offsetof(struct ctk_hires_theme, backgroundpattern)); - asm("sta (ptr2),y"); - asm("iny"); - asm("lda %v+%w+1,x", ctk_hires_theme, - offsetof(struct ctk_hires_theme, backgroundpattern)); - asm("sta (ptr2),y"); - asm("iny"); - asm("lda %v+%w+2,x", ctk_hires_theme, - offsetof(struct ctk_hires_theme, backgroundpattern)); - asm("sta (ptr2),y"); - asm("iny"); - asm("lda %v+%w+3,x", ctk_hires_theme, - offsetof(struct ctk_hires_theme, backgroundpattern)); - asm("sta (ptr2),y"); - asm("iny"); - asm("lda %v+%w+4,x", ctk_hires_theme, - offsetof(struct ctk_hires_theme, backgroundpattern)); - asm("sta (ptr2),y"); - asm("iny"); - asm("lda %v+%w+5,x", ctk_hires_theme, - offsetof(struct ctk_hires_theme, backgroundpattern)); - asm("sta (ptr2),y"); - asm("iny"); - asm("lda %v+%w+6,x", ctk_hires_theme, - offsetof(struct ctk_hires_theme, backgroundpattern)); - asm("sta (ptr2),y"); - asm("iny"); - asm("lda %v+%w+7,x", ctk_hires_theme, - offsetof(struct ctk_hires_theme, backgroundpattern)); - asm("sta (ptr2),y"); - asm("iny"); - asm("cpy #$40"); - asm("bne clearlineloop3"); - - - if(lineptr == 24) { - hires_color(ctk_hires_theme.backgroundpatterncolors[24]); - hires_gotoxy(0, 24); - ctk_hires_cputsn(CONTIKI_VERSION_STRING, - sizeof(CONTIKI_VERSION_STRING) - 1); - } -} -#pragma optimize(pop) -/*-----------------------------------------------------------------------------------*/ -#pragma optimize(push, off) -static void -nmi2(void) -{ - asm("pla"); - asm("sta $01"); - asm("pla"); - asm("rti"); -} -#pragma optimize(pop) -/*-----------------------------------------------------------------------------------*/ -#pragma optimize(push, off) -static void -nmi(void) -{ - asm("sei"); - asm("pha"); - asm("inc $d020"); - asm("lda $01"); - asm("pha"); - asm("lda #$36"); - asm("sta $01"); - asm("lda #>_nmi2"); - asm("pha"); - asm("lda #<_nmi2"); - asm("pha"); - asm("php"); - asm("jmp ($0318)"); - - nmi2(); -} -#pragma optimize(pop) -/*-----------------------------------------------------------------------------------*/ -#pragma optimize(push, off) -static void -setup_nmi(void) -{ - asm("lda #<_nmi"); - asm("sta $fffa"); - asm("lda #>_nmi"); - asm("sta $fffb"); - return; - nmi(); -} -#pragma optimize(pop) -/*-----------------------------------------------------------------------------------*/ -#pragma optimize(push, off) -void -ctk_draw_init(void) -{ - unsigned char i, *ptr1, *ptr2; - - - setup_nmi(); - - /* Turn on hires mode, bank 0 ($c000 - $ffff) and $e000/$c000 for - hires/colors. */ - VIC.ctrl1 = 0x3b; /* $D011 */ - VIC.addr = 0x78; /* $D018 */ - VIC.ctrl2 = 0xc8; /* $D016 */ - CIA2.pra = 0x00; /* $DD00 */ - - VIC.bordercolor = ctk_hires_theme.bordercolor; /* $D020 */ - VIC.bgcolor0 = ctk_hires_theme.screencolor; /* $D021 */ - - /* Fill color memory. */ - asm("sei"); - asm("lda $01"); - asm("pha"); - asm("lda #$30"); - asm("sta $01"); - asm("ldx #0"); - asm("lda #$c0"); - asm("fillcolorloop:"); - asm("sta $dc00,x"); - asm("sta $dd00,x"); - asm("sta $de00,x"); - asm("sta $df00,x"); - asm("inx"); - asm("bne fillcolorloop"); - - /* Setup sprite pointers */ - asm("ldx #$fd"); - asm("stx $dff8"); - asm("inx"); - asm("stx $dff9"); - asm("pla"); - asm("sta $01"); - asm("cli"); - - /* Fill hires memory with 0. */ - - asm("lda $fd"); - asm("pha"); - asm("lda $fe"); - asm("pha"); - asm("lda #0"); - asm("sta $fd"); - asm("lda #$e0"); - asm("sta $fe"); - asm("ldy #0"); - asm("lda #0"); - asm("clrscrnloop:"); - asm("lda #$55"); - asm("sta ($fd),y"); - asm("iny"); - asm("lda #$aa"); - asm("sta ($fd),y"); - asm("iny"); - asm("bne clrscrnloop"); - asm("inc $fe"); - asm("lda $fe"); - asm("cmp #$ff"); - asm("bne clrscrnloop"); - - asm("ldy #$00"); - asm("clrscrnloop2:"); - asm("lda #$55"); - asm("sta $ff00,y"); - asm("iny"); - asm("lda #$aa"); - asm("sta $ff00,y"); - asm("iny"); - asm("cpy #$40"); - asm("bne clrscrnloop2"); - - - asm("pla"); - asm("sta $fe"); - asm("pla"); - asm("sta $fd"); - - - ctk_draw_clear(0, SCREEN_HEIGHT); - - /* Setup mouse pointer sprite. */ - asm("lda %v+%w", ctk_hires_theme, - offsetof(struct ctk_hires_theme, pointermaskcolor)); - asm("sta $d027"); - asm("lda %v+%w", ctk_hires_theme, - offsetof(struct ctk_hires_theme, pointercolor)); - asm("sta $d028"); - - ptr1 = ctk_hires_theme.pointer; - ptr2 = (unsigned char *)0xff40; - - for(i = 0; i < 0x80; ++i) { - *ptr2++ = *ptr1++; - } - - return; -} -#pragma optimize(pop) -/*-----------------------------------------------------------------------------------*/ -static void __fastcall__ -draw_widget(register struct ctk_widget *w, - unsigned char x, unsigned char y, - unsigned char clipy1, unsigned char clipy2, - unsigned char afocus) -{ - static unsigned char xpos, ypos, xscroll; - static unsigned char i; - static char c; - static unsigned char len; - static unsigned char tmp; - static unsigned char yclipped; - static unsigned char focus; - char *text; - - xpos = x + w->x; - ypos = y + w->y; - - yclipped = 0; - if(ypos >= clipy1 && ypos < clipy2) { - yclipped = 1; - } - focus = afocus; - - - switch(w->type) { - case CTK_WIDGET_SEPARATOR: - hires_color(ctk_hires_theme.separatorcolors[focus]); - if(yclipped) { - hires_chlinexy(xpos, ypos, w->w); - } - break; - case CTK_WIDGET_LABEL: - hires_color(ctk_hires_theme.labelcolors[focus]); - text = w->widget.label.text; - for(i = 0; i < w->h; ++i) { - if(ypos >= clipy1 && ypos < clipy2) { - hires_gotoxy(xpos, ypos); - ctk_hires_cputsn(text, w->w); - tmp = w->w - (hires_wherex() - xpos); - if(tmp > 0) { - ctk_hires_cclear(tmp); - } - } - ++ypos; - text += w->w; - } - break; - case CTK_WIDGET_BUTTON: - if(yclipped) { - hires_color(ctk_hires_theme.buttonleftcolors[focus]); - hires_gotoxy(xpos, ypos); - ctk_hires_draw_buttonleft(); - hires_color(ctk_hires_theme.buttoncolors[focus]); - hires_gotoxy(xpos + 1, ypos); - ctk_hires_cputsn(w->widget.button.text, w->w); - hires_color(ctk_hires_theme.buttonrightcolors[focus]); - ctk_hires_draw_buttonright(); - } - break; - case CTK_WIDGET_HYPERLINK: - if(yclipped) { - hires_color(ctk_hires_theme.hyperlinkcolors[focus]); - hires_underline(1); - hires_gotoxy(xpos, ypos); - ctk_hires_cputsn(w->widget.button.text, w->w); - hires_underline(0); - } - break; - case CTK_WIDGET_TEXTENTRY: - if(yclipped) { - hires_color(ctk_hires_theme.textentrycolors[focus]); - - if((focus & CTK_FOCUS_WIDGET) && - w->widget.textentry.state != CTK_TEXTENTRY_EDIT) { - hires_revers(1); - } else { - hires_revers(0); - } - xscroll = 0; - tmp = w->w - 1; - if(w->widget.textentry.xpos >= tmp) { - xscroll = w->widget.textentry.xpos - tmp; - } - text = w->widget.textentry.text; - if(w->widget.textentry.state == CTK_TEXTENTRY_EDIT) { - hires_revers(0); - hires_cputcxy(xpos, ypos, '>'); - text += xscroll; - for(i = 0; i < w->w; ++i) { - c = *text; - if(i == w->widget.textentry.xpos - xscroll) { - hires_revers(1); - } else { - hires_revers(0); - } - if(c == 0) { - ctk_hires_cputc(' '); - } else { - ctk_hires_cputc(c); - } - hires_revers(0); - ++text; - } - ctk_hires_cputc('<'); - } else { - hires_cputcxy(xpos, ypos, '|'); - /* hires_gotoxy(xpos + 1, ypos); */ - ctk_hires_cputsn(text, w->w); - i = hires_wherex(); - tmp = i - xpos - 1; - if(tmp < w->w) { - ctk_hires_cclear(w->w - tmp); - } - ctk_hires_cputc('|'); - } - } - hires_revers(0); - break; - case CTK_WIDGET_ICON: - if(yclipped) { - hires_color(ctk_hires_theme.iconcolors[focus]); - - x = xpos; - len = strlen(w->widget.icon.title); - if(x + len >= SCREEN_WIDTH) { - x = SCREEN_WIDTH - len; - } - - tmp = ypos + 3; - - if(tmp < clipy2) { - hires_gotoxy(x, tmp); - ctk_hires_cputsn(w->widget.icon.title, len); - } - - hires_gotoxy(xpos, ypos); - if(w->widget.icon.bitmap != NULL) { - ctk_hires_bitmapptr = w->widget.icon.bitmap; - for(i = 0; i < 3; ++i) { - if(ypos >= clipy1 && ypos < clipy2) { - hires_gotoxy(xpos, ypos); - ctk_hires_draw_bitmapline(3); - } - ctk_hires_bitmapptr += 3 * 8; - ++ypos; - } - - /* draw_bitmap_icon(w->widget.icon.bitmap);*/ - } - - } - break; - case CTK_WIDGET_BITMAP: - hires_color(ctk_hires_theme.bitmapcolors[focus]); - ctk_hires_bitmapptr = w->widget.bitmap.bitmap; - for(i = 0; i < w->h; ++i) { - if(ypos >= clipy1 && ypos < clipy2) { - hires_gotoxy(xpos, ypos); - ctk_hires_draw_bitmapline(w->w); - } - ctk_hires_bitmapptr += w->w * 8; - ++ypos; - } - break; - - default: - break; - } -} -/*-----------------------------------------------------------------------------------*/ -void -ctk_draw_widget(struct ctk_widget *w, - unsigned char focus, - unsigned char clipy1, - unsigned char clipy2) -{ - struct ctk_window *win = w->window; - unsigned char posx, posy; - - posx = win->x + 1; - posy = win->y + 2; - - if(w == win->focused) { - focus |= CTK_FOCUS_WIDGET; - } - - draw_widget(w, posx, posy, - clipy1, clipy2, - focus); -} -/*-----------------------------------------------------------------------------------*/ -void -ctk_draw_clear_window(register struct ctk_window *window, - unsigned char focus, - unsigned char clipy1, - unsigned char clipy2) -{ - static unsigned char h; - - hires_color(ctk_hires_theme.windowcolors[focus]); - - h = window->y + 2 + window->h; - /* Clear window contents. */ - for(i = window->y + 2; i < h; ++i) { - if(i >= clipy1 && i <= clipy2) { - hires_cclearxy(window->x + 1, i, window->w); - } - } -} -/*-----------------------------------------------------------------------------------*/ -void -ctk_draw_window(register struct ctk_window *window, - unsigned char focus, - unsigned char clipy1, unsigned char clipy2, - unsigned char draw_borders) -{ - register struct ctk_widget *w; - - x = window->x; - y = window->y + 1; - - ++clipy2; - - if(clipy2 <= y) { - return; - } - - /* hires_color(ctk_hires_theme.windowcolors[focus+1]);*/ - - x1 = x + 1; - y1 = y + 1; - /* x2 = x1 + window->w; - y2 = y1 + window->h;*/ - - hires_gotoxy(x, y); - ctk_hires_windowparams.w = window->w; - ctk_hires_windowparams.h = window->h; - if(clipy1 < y) { - ctk_hires_windowparams.clipy1 = 0; - } else { - ctk_hires_windowparams.clipy1 = clipy1 - y; - } - ctk_hires_windowparams.clipy2 = clipy2 - y; - ctk_hires_windowparams.color1 = ctk_hires_theme.windowcolors[focus+1]; - ctk_hires_windowparams.color2 = ctk_hires_theme.windowcolors[focus]; - ctk_hires_windowparams.title = window->title; - ctk_hires_windowparams.titlelen = window->titlelen; - - if(ctk_hires_windowparams.clipy1 < ctk_hires_windowparams.clipy2 && - ctk_hires_windowparams.clipy2 > 0) { - ctk_hires_draw_windowborders(); - } - - /* Draw inactive widgets. */ - for(w = window->inactive; w != NULL; w = w->next) { - draw_widget(w, x1, y1, - clipy1, clipy2, - focus); - } - - /* Draw active widgets. */ - for(w = window->active; w != NULL; w = w->next) { - wfocus = focus; - if(w == window->focused) { - wfocus |= CTK_FOCUS_WIDGET; - } - draw_widget(w, x1, y1, - clipy1, clipy2, - wfocus); - } -} -/*-----------------------------------------------------------------------------------*/ -void -ctk_draw_dialog(register struct ctk_window *dialog) -{ - register struct ctk_widget *w; - - hires_color(ctk_hires_theme.windowcolors[CTK_FOCUS_DIALOG]); - - /* x = (SCREEN_WIDTH - dialog->w) / 2; - y = (SCREEN_HEIGHT - 1 - dialog->h) / 2; */ - x = dialog->x; - y = dialog->y + 1; - - - x1 = x + 1; - y1 = y + 1; - x2 = x1 + dialog->w; - y2 = y1 + dialog->h; - - - /* Draw dialog frame. */ - - hires_cvlinexy(x, y1, dialog->h); - hires_cvlinexy(x2, y1, dialog->h); - - hires_chlinexy(x1, y, dialog->w); - hires_chlinexy(x1, y2, dialog->w); - - hires_cputcxy(x, y, CH_ULCORNER); - hires_cputcxy(x, y2, CH_LLCORNER); - hires_cputcxy(x2, y, CH_URCORNER); - hires_cputcxy(x2, y2, CH_LRCORNER); - - - /* Clear window contents. */ - for(i = y1; i < y2; ++i) { - hires_cclearxy(x1, i, dialog->w); - } - - /* Draw inactive widgets. */ - for(w = dialog->inactive; w != NULL; w = w->next) { - draw_widget(w, x1, y1, - 0, SCREEN_HEIGHT, CTK_FOCUS_DIALOG); - } - - - /* Draw active widgets. */ - for(w = dialog->active; w != NULL; w = w->next) { - wfocus = CTK_FOCUS_DIALOG; - if(w == dialog->focused) { - wfocus |= CTK_FOCUS_WIDGET; - } - draw_widget(w, x1, y1, - 0, SCREEN_HEIGHT, wfocus); - } - -} -/*-----------------------------------------------------------------------------------*/ -void -ctk_draw_clear(unsigned char y1, unsigned char y2) -{ - for(i = y1; i < y2; ++i) { - clear_line(i); - } -} -/*-----------------------------------------------------------------------------------*/ -static void -draw_menu(register struct ctk_menu *m) -{ - static unsigned char x, x2, y; - - hires_color(ctk_hires_theme.openmenucolor); - x = hires_wherex(); - ctk_hires_cputsn(m->title, m->titlelen); - ctk_hires_cputc(' '); - x2 = hires_wherex(); - if(x + CTK_CONF_MENUWIDTH > SCREEN_WIDTH) { - x = SCREEN_WIDTH - CTK_CONF_MENUWIDTH; - } - for(y = 0; y < m->nitems; ++y) { - if(y == m->active) { - hires_color(ctk_hires_theme.activemenucolor); - } else { - hires_color(ctk_hires_theme.menucolor); - } - hires_gotoxy(x, y + 1); - if(m->items[y].title[0] == '-') { - ctk_hires_chline(CTK_CONF_MENUWIDTH); - } else { - ctk_hires_cputsn(m->items[y].title, - strlen(m->items[y].title)); - } - ctk_hires_cclear(x + CTK_CONF_MENUWIDTH - hires_wherex()); - hires_revers(0); - } - hires_gotoxy(x2, 0); - hires_color(ctk_hires_theme.menucolor); -} -/*-----------------------------------------------------------------------------------*/ -void -ctk_draw_menus(struct ctk_menus *menus) -{ - struct ctk_menu *m; - - /* Draw menus */ - hires_color(ctk_hires_theme.menucolor); - hires_gotoxy(0, 0); - hires_revers(0); - ctk_hires_cputc(' '); - for(m = menus->menus->next; m != NULL; m = m->next) { - if(m != menus->open) { - ctk_hires_cputsn(m->title, m->titlelen); - ctk_hires_cputc(' '); - } else { - draw_menu(m); - } - } - ctk_hires_cclear(SCREEN_WIDTH - hires_wherex() - - strlen(menus->desktopmenu->title) - 1); - - /* Draw desktopmenu */ - if(menus->desktopmenu != menus->open) { - ctk_hires_cputsn(menus->desktopmenu->title, - menus->desktopmenu->titlelen); - ctk_hires_cputc(' '); - } else { - draw_menu(menus->desktopmenu); - } - -} -/*-----------------------------------------------------------------------------------*/ -unsigned char -ctk_draw_height(void) -{ - return SCREEN_HEIGHT; -} -/*-----------------------------------------------------------------------------------*/ -unsigned char -ctk_draw_width(void) -{ - return SCREEN_WIDTH; -} -/*-----------------------------------------------------------------------------------*/ -/*unsigned char -ctk_arch_isprint(char c) -{ - return isprint(c); -}*/ diff --git a/backyard/platform/c64/ctk/ctk-hires.h b/backyard/platform/c64/ctk/ctk-hires.h deleted file mode 100644 index 00587599a..000000000 --- a/backyard/platform/c64/ctk/ctk-hires.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2002, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the "ctk" console GUI toolkit for cc65 - * - * $Id: ctk-hires.h,v 1.1 2007/05/23 23:11:27 oliverschmidt Exp $ - * - */ - -#ifndef __CTK_HIRES_H__ -#define __CTK_HIRES_H__ - -#include - -#define CTK_ARCH_KEY_T char - -#define ctk_arch_keyavail kbhit -#define ctk_arch_getkey cgetc - -#define CH_ENTER '\n' - -#endif /* __CTK_HIRES_H__ */ diff --git a/backyard/platform/c64/ctk/ctk-mouse-1351.S b/backyard/platform/c64/ctk/ctk-mouse-1351.S deleted file mode 100644 index eeef7b595..000000000 --- a/backyard/platform/c64/ctk/ctk-mouse-1351.S +++ /dev/null @@ -1,149 +0,0 @@ - -;--------------------------------------------------------------------- - ;; The 1351 mouse code was taken from the CC65 libraries, - ;; written by Ullrich von Bassewitz -;--------------------------------------------------------------------- - - .macpack generic - - .import _ctk_mouse_joyx, _ctk_mouse_joyy - .import _ctk_mouse_firebutton - .export _ctk_mouse_1351 -;--------------------------------------------------------------------- -.bss -OldValue: .res 1 ; Temp for MoveCheck routine -NewValue: .res 1 ; Temp for MoveCheck routine -YCorr: .res 1 ; Correction for Y coordinate - -OldPotX: .res 1 ; Old hw counter values -OldPotY: .res 1 - -SID_ADConv1 = $D419 -SID_ADConv2 = $D41A -CIA1_PRA = $DC00 -CIA1_PRB = $DC01 -CIA1_DDRB = $DC03 - - -;--------------------------------------------------------------------- -.data -XMin: .word 0 ; X1 value of bounding box -YMin: .word 0 ; Y1 value of bounding box -XMax: .word 319 ; X2 value of bounding box -YMax: .word 199 ; Y2 value of bounding box - -;--------------------------------------------------------------------- -.code - -;--------------------------------------------------------------------- -;--------------------------------------------------------------------- - ;; Most of the mouse code is taken from the CC65 libraries written by - ;; Ullrich von Bassewitz -MoveCheck: - sty OldValue - sta NewValue - ldx #$00 - - sub OldValue ; a = mod64 (new - old) - and #%01111111 - cmp #%01000000 ; if (a > 0) - bcs @L1 ; - lsr a ; a /= 2; - beq @L2 ; if (a != 0) - ldy NewValue ; y = NewValue - rts ; return - -@L1: ora #%11000000 ; else or in high order bits - cmp #$FF ; if (a != -1) - beq @L2 - sec - ror a ; a /= 2 - dex ; high byte = -1 (X = $FF) - ldy NewValue - rts - -@L2: txa ; A = $00 - rts - -;--------------------------------------------------------------------- -_ctk_mouse_1351: - lda SID_ADConv1 ; Get mouse X movement - ldy OldPotX - jsr MoveCheck ; Calculate movement vector - sty OldPotX - -; Calculate the new X coordinate (--> a/y) - - add _ctk_mouse_joyx - tay ; Remember low byte - txa - adc _ctk_mouse_joyx+1 - tax - -; Limit the X coordinate to the bounding box - - cpy XMin - sbc XMin+1 - bpl @L1 - ldy XMin - ldx XMin+1 - jmp @L2 -@L1: txa - - cpy XMax - sbc XMax+1 - bmi @L2 - ldy XMax - ldx XMax+1 -@L2: sty _ctk_mouse_joyx - stx _ctk_mouse_joyx+1 -; Calculate the Y movement vector - - lda SID_ADConv2 ; Get mouse Y movement - ldy OldPotY - jsr MoveCheck ; Calculate movement - sty OldPotY - -; Calculate the new Y coordinate (--> a/y) - - sta OldValue - lda _ctk_mouse_joyy - sub OldValue - tay - stx OldValue - lda _ctk_mouse_joyy+1 - sbc OldValue - tax - - cpy YMin - sbc YMin+1 - bpl @L3 - ldy YMin - ldx YMin+1 - jmp @L4 -@L3: txa - - cpy YMax - sbc YMax+1 - bmi @L4 - ldy YMax - ldx YMax+1 -@L4: sty _ctk_mouse_joyy - stx _ctk_mouse_joyy+1 - - ;; Get mouse button - lda #$7F - sta CIA1_PRA - lda CIA1_PRB ; Read joystick #0 - ldx #0 - and #$1F - eor #$1F - - ora _ctk_mouse_firebutton - sta _ctk_mouse_firebutton - - lda #0 - sta CIA1_PRA - sta CIA1_DDRB - rts -;--------------------------------------------------------------------- diff --git a/backyard/platform/c64/ctk/ctk-mouse-arch.c b/backyard/platform/c64/ctk/ctk-mouse-arch.c deleted file mode 100644 index 66f7775e5..000000000 --- a/backyard/platform/c64/ctk/ctk-mouse-arch.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the "ctk" console GUI toolkit for cc65 - * - * $Id: ctk-mouse-arch.c,v 1.1 2007/05/23 23:11:27 oliverschmidt Exp $ - * - */ - -#include "ctk/ctk.h" -#include "ctk-mouse.h" -#include "ctk-conf.h" - -#if CTK_CONF_MOUSE_SUPPORT - -unsigned short ctk_mouse_joyy, ctk_mouse_joyx; -unsigned char ctk_mouse_firebutton; - -extern void ctk_mouse_asm_irq(void); - -/*-----------------------------------------------------------------------------------*/ -#pragma optimize(push, off) -void -ctk_mouse_init(void) -{ - /* Place mouse pointer at the middle of the screen. */ - ctk_mouse_joyx = 160; - ctk_mouse_joyy = 100; - - /* Setup and start IRQ */ - asm("sei"); - asm("lda #<%v", ctk_mouse_asm_irq); - asm("sta $0314"); - asm("lda #>%v", ctk_mouse_asm_irq); - asm("sta $0315"); - asm("cli"); - -} -#pragma optimize(pop) -/*-----------------------------------------------------------------------------------*/ -unsigned short -ctk_mouse_x(void) -{ - if(ctk_mouse_joyx >= 342) { - ctk_mouse_joyx = 0; - } else if(ctk_mouse_joyx >= 320) { - ctk_mouse_joyx = 319; - } - return ctk_mouse_joyx; -} -/*-----------------------------------------------------------------------------------*/ -unsigned short -ctk_mouse_y(void) -{ - return ctk_mouse_joyy; -} -/*-----------------------------------------------------------------------------------*/ -unsigned char -ctk_mouse_button(void) -{ - return ctk_mouse_firebutton; -} -/*-----------------------------------------------------------------------------------*/ -unsigned char -ctk_mouse_xtoc(unsigned short x) -{ - return x / 8; -} -/*-----------------------------------------------------------------------------------*/ -unsigned char -ctk_mouse_ytoc(unsigned short y) -{ - return y / 8; -} -/*-----------------------------------------------------------------------------------*/ -#pragma optimize(push, off) -void -ctk_mouse_hide(void) -{ - /* Turn off sprites 0 and 1 */ - asm("lda #0"); - asm("sta $d015"); -} -#pragma optimize(pop) -/*-----------------------------------------------------------------------------------*/ -#pragma optimize(push, off) -void -ctk_mouse_show(void) -{ - /* Turn on sprites 0 and 1 */ - asm("lda #3"); - asm("sta $d015"); -} -#pragma optimize(pop) -/*-----------------------------------------------------------------------------------*/ -#endif /* CTK_CONF_MOUSE_SUPPORT */ diff --git a/backyard/platform/c64/ctk/ctk-mouse-asm.S b/backyard/platform/c64/ctk/ctk-mouse-asm.S deleted file mode 100644 index 6aa53b425..000000000 --- a/backyard/platform/c64/ctk/ctk-mouse-asm.S +++ /dev/null @@ -1,48 +0,0 @@ - -;--------------------------------------------------------------------- - ;; The 1351 mouse code was taken from the CC65 libraries, - ;; written by Ullrich von Bassewitz -;--------------------------------------------------------------------- - - .macpack generic - - .import _ctk_mouse_joyx, _ctk_mouse_joyy - .import _ctk_mouse_firebutton - .export _ctk_mouse_asm_irq - .import _ctk_mouse_joy, _ctk_mouse_1351 -;--------------------------------------------------------------------- - -;--------------------------------------------------------------------- -.code - -;--------------------------------------------------------------------- -_ctk_mouse_asm_irq: - lda #0 - sta _ctk_mouse_firebutton - - jsr _ctk_mouse_joy - ;; jsr_ctk_mouse_1351 - - ; lda _ctk_mouse_joybutton - ; ora _ctk_mouse_1351button - ; sta _ctk_mouse_firebutton - - lda _ctk_mouse_joyy - clc - adc #$32 - sta $d001 - sta $d003 - - lda _ctk_mouse_joyx - clc - adc #$18 - sta $d000 - sta $d002 - lda #0 - adc _ctk_mouse_joyx+1 - and #1 - beq :+ - lda #3 -: - sta $d010 - jmp $ea31 diff --git a/backyard/platform/c64/ctk/ctk-mouse-joy.S b/backyard/platform/c64/ctk/ctk-mouse-joy.S deleted file mode 100644 index 963ca3607..000000000 --- a/backyard/platform/c64/ctk/ctk-mouse-joy.S +++ /dev/null @@ -1,135 +0,0 @@ - -;--------------------------------------------------------------------- - - .macpack generic - - .import _ctk_mouse_joyx, _ctk_mouse_joyy - .import _ctk_mouse_firebutton - .export _ctk_mouse_joy -;--------------------------------------------------------------------- -.bss -lastjoydy: .res 1 -lastjoydx: .res 1 -joydycnt: .res 1 -joydxcnt: .res 1 - -;--------------------------------------------------------------------- -.code - -;--------------------------------------------------------------------- -_ctk_mouse_joy: - ldy $dc02 - lda #0 - sta $dc02 - lda $dc00 - sty $dc02 - ldy #0 - ldx #0 - lsr - bcs nodey - dey -nodey: - lsr - bcs noiny - iny -noiny: - lsr - bcs nodex - dex -nodex: - lsr - bcs noinx - inx -noinx: - and #1 - eor #1 - ora _ctk_mouse_firebutton - sta _ctk_mouse_firebutton - - cpy lastjoydy - sty lastjoydy - bne noydy - tya - pha - inc joydycnt - lda joydycnt - cmp #$1f - bmi nostajoydycnt - lda #$20 - sta joydycnt -nostajoydycnt: - lsr - lsr - lsr - lsr - tay - pla -asldeyloop: - asl - dey - bpl asldeyloop - tay - jmp ydy -noydy: - lda #0 - sta joydycnt -ydy: - - tya - clc - adc _ctk_mouse_joyy - - cmp #240 - bcc :+ - lda #0 -: - - cmp #200 - bcc :+ - lda #199 -: - sta _ctk_mouse_joyy - - cpx lastjoydx - stx lastjoydx - bne noxdx - txa - pha - inc joydxcnt - lda joydxcnt - cmp #$1f - bmi nostajoydxcnt - lda #$20 - sta joydxcnt -nostajoydxcnt: - lsr - lsr - lsr - lsr - tax - pla -asldexloop: - asl - dex - bpl asldexloop - tax - jmp xdx -noxdx: - lda #0 - sta joydxcnt -xdx: - - txa - clc - adc _ctk_mouse_joyx - sta _ctk_mouse_joyx - php - lda #$ff - cpx #0 - bmi nolda02 - lda #0 -nolda02: - plp - adc _ctk_mouse_joyx+1 - sta _ctk_mouse_joyx+1 - rts diff --git a/backyard/platform/c64/ctk/ctk-mouse.c b/backyard/platform/c64/ctk/ctk-mouse.c deleted file mode 100644 index 7d60deab0..000000000 --- a/backyard/platform/c64/ctk/ctk-mouse.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the "ctk" console GUI toolkit for cc65 - * - * $Id: ctk-mouse.c,v 1.1 2007/05/23 23:11:27 oliverschmidt Exp $ - * - */ - -#include "ctk/ctk.h" -#include "ctk-mouse.h" -#include "ctk-conf.h" - -#if CTK_CONF_MOUSE_SUPPORT - -unsigned short ctk_mouse_joyy, ctk_mouse_joyx; -unsigned char ctk_mouse_firebutton; - -extern void ctk_mouse_asm_irq(void); - -/*-----------------------------------------------------------------------------------*/ -#pragma optimize(push, off) -void -ctk_mouse_init(void) -{ - /* Place mouse pointer at the middle of the screen. */ - ctk_mouse_joyx = 160; - ctk_mouse_joyy = 100; - - /* Setup and start IRQ */ - asm("sei"); - asm("lda #<%v", ctk_mouse_asm_irq); - asm("sta $0314"); - asm("lda #>%v", ctk_mouse_asm_irq); - asm("sta $0315"); - asm("cli"); - -} -#pragma optimize(pop) -/*-----------------------------------------------------------------------------------*/ -unsigned short -ctk_mouse_x(void) -{ - if(ctk_mouse_joyx >= 342) { - ctk_mouse_joyx = 0; - } else if(ctk_mouse_joyx >= 320) { - ctk_mouse_joyx = 319; - } - return ctk_mouse_joyx; -} -/*-----------------------------------------------------------------------------------*/ -unsigned short -ctk_mouse_y(void) -{ - return ctk_mouse_joyy; -} -/*-----------------------------------------------------------------------------------*/ -unsigned char -ctk_mouse_button(void) -{ - return ctk_mouse_firebutton; -} -/*-----------------------------------------------------------------------------------*/ -unsigned char -ctk_mouse_xtoc(unsigned short x) -{ - return x / 8; -} -/*-----------------------------------------------------------------------------------*/ -unsigned char -ctk_mouse_ytoc(unsigned short y) -{ - return y / 8; -} -/*-----------------------------------------------------------------------------------*/ -#pragma optimize(push, off) -void -ctk_mouse_hide(void) -{ - /* Turn off sprites 0 and 1 */ - asm("lda #0"); - asm("sta $d015"); -} -#pragma optimize(pop) -/*-----------------------------------------------------------------------------------*/ -#pragma optimize(push, off) -void -ctk_mouse_show(void) -{ - /* Turn on sprites 0 and 1 */ - asm("lda #3"); - asm("sta $d015"); -} -#pragma optimize(pop) -/*-----------------------------------------------------------------------------------*/ -#endif /* CTK_CONF_MOUSE_SUPPORT */ diff --git a/backyard/platform/c64/lib/iconfield.c b/backyard/platform/c64/lib/iconfield.c deleted file mode 100644 index 8cfbe90ac..000000000 --- a/backyard/platform/c64/lib/iconfield.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: iconfield.c,v 1.1 2007/05/23 23:11:27 oliverschmidt Exp $ - * - */ - -/*-----------------------------------------------------------------------------------*/ -#define LFN 9 -static void -loaddirectory(char *ext) -{ - unsigned char i, j; - unsigned char extlen; - - extlen = strlen(ext); - - if(cbm_opendir(LFN, 8) != 0) { - show_statustext("Cannot open directory"); - } else { - i = 0; - while(cbm_readdir(LFN, &dirent) == 0) { - if(strcmp(&dirent.name[strlen(dirent.name) - extlen], - ext) == 0) { - strncpy(filenames[i], dirent.name, 16); - ++i; - if(i == MAX_NUMFILES) { - break; - } - } - cbm_closedir(LFN); - - numfiles = i; - - j = 0; - for(i = 0; i < numfiles; ++i) { - dscs[j] = LOADER_LOAD_DSC(filenames[i]); - if(dscs[j] != NULL) { - ++j; - } - } - } - } -} -/*-----------------------------------------------------------------------------------*/ -static void -makewindow(struct ctk_window *window) -{ - unsigned char x, y; - - ctk_window_clear(&window); - CTK_WIDGET_SET_YPOS(&description, height - 3); - CTK_WIDGET_SET_WIDTH(&description, width); - CTK_WIDGET_ADD(&window, &description); - - morestart = i; - - x = 0; y = 1; - for(; dscs[i] != NULL; ++i) { - - if(x + strlen(dscs[i]->icon->title) >= width) { - y += 5; - x = 0; - if(y >= height - 2 - 4) { - morestart = i; - break; - } - } - CTK_WIDGET_SET_XPOS(dscs[i]->icon, x); - CTK_WIDGET_SET_YPOS(dscs[i]->icon, y); - CTK_WIDGET_ADD(&window, dscs[i]->icon); - - x += strlen(dscs[i]->icon->title) + 1; - } - CTK_WIDGET_SET_YPOS(&autoexitbutton, height - 2); - CTK_WIDGET_ADD(&window, &autoexitbutton); - CTK_WIDGET_SET_YPOS(&autoexitlabel, height - 2); - CTK_WIDGET_ADD(&window, &autoexitlabel); - - if(i != morestart) { - CTK_WIDGET_SET_YPOS(&backbutton, height - 1); - CTK_WIDGET_ADD(&window, &backbutton); - } else { - CTK_WIDGET_SET_YPOS(&morebutton, height - 1); - CTK_WIDGET_ADD(&window, &morebutton); - } - CTK_WIDGET_SET_XPOS(&reloadbutton, width - 8); - CTK_WIDGET_SET_YPOS(&reloadbutton, height - 1); - CTK_WIDGET_ADD(&window, &reloadbutton); -} -/*-----------------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/lib/mtarch-asm.S b/backyard/platform/c64/lib/mtarch-asm.S deleted file mode 100644 index 22ab6095e..000000000 --- a/backyard/platform/c64/lib/mtarch-asm.S +++ /dev/null @@ -1,245 +0,0 @@ -;--------------------------------------------------------------------- - .importzp ptr1 - .importzp sp - .import __ZP_START__ - - - .import _mtarch_asm_threadstack - .import _mtarch_asm_threadsp - .import _mtarch_asm_threadspreg - .import _mtarch_asm_threadzp - - .export _mtarch_asm_exec - .export _mtarch_yield - .export _mtarch_asm_start - .export _mtarch_pstart, _mtarch_pstop - -;--------------------------------------------------------------------- -.bss -kernelsp: .res 2 -kernelspreg: .res 1 - -oldirq: .res 2 - - zpsize = 32 -.code -;--------------------------------------------------------------------- - ;; Switch to thread defined by threadsp, threadstack and threadspreg. - ;; The kernel stack is swapped onto the threadstack, and the - ;; sp and spreg are saved to the local variables "kernelsp" and - ;; "kernelspreg". Also, the zeropage variables are saved. - -_mtarch_asm_exec: - sei - ;; Save current stack pointer - lda sp - sta kernelsp - lda sp+1 - sta kernelsp+1 - - tsx - stx kernelspreg - - lda _mtarch_asm_threadzp - sta ptr1 - lda _mtarch_asm_threadzp+1 - sta ptr1+1 - - ldy #0 -: - lda <__ZP_START__,y - tax - lda (ptr1),y - sta <__ZP_START__,y - txa - sta (ptr1),y - iny - cpy #zpsize - bne :- - - lda _mtarch_asm_threadstack - sta ptr1 - lda _mtarch_asm_threadstack+1 - sta ptr1+1 - - ldy kernelspreg ; determine the smallest of the two stack pointers, - cpy _mtarch_asm_threadspreg ; as we only need to swap the used part of the stack - bcc :+ - ldy _mtarch_asm_threadspreg - -: - lda $0100,y - tax - lda (ptr1),y - sta $0100,y - txa - sta (ptr1),y - iny - bne :- - - lda _mtarch_asm_threadsp - sta sp - lda _mtarch_asm_threadsp+1 - sta sp+1 - - ldx _mtarch_asm_threadspreg - txs - -; jsr _mtarch_pstart - - lda $0314 - sta oldirq - lda $0315 - sta oldirq+1 - - lda #irq - sta $0315 - - - pla - tay - pla - tax - pla - - rti - - ;; Switch from thread defined by threadsp, threadstack and threadspreg. - ;; The kernel stack is swapped back from the threadstack, and the - ;; sp and spreg are restored from the local variables "kernelsp" and - ;; "kernelspreg". -yield: - sei - lda sp - sta _mtarch_asm_threadsp - lda sp+1 - sta _mtarch_asm_threadsp+1 - - tsx - stx _mtarch_asm_threadspreg - - lda _mtarch_asm_threadzp - sta ptr1 - lda _mtarch_asm_threadzp+1 - sta ptr1+1 - - ldy kernelspreg ; determine the smallest of the two stack pointers, - cpy _mtarch_asm_threadspreg ; as we only need to swap the used part of the stack - bcc :+ - ldy _mtarch_asm_threadspreg - -: - lda <__ZP_START__,y - tax - lda (ptr1),y - sta <__ZP_START__,y - txa - sta (ptr1),y - iny - cpy #zpsize - bne :- - - lda _mtarch_asm_threadstack - sta ptr1 - lda _mtarch_asm_threadstack+1 - sta ptr1+1 - - ldy #0 -: - lda $0100,y - tax - lda (ptr1),y - sta $0100,y - txa - sta (ptr1),y - iny - bne :- - - lda kernelsp - sta sp - lda kernelsp+1 - sta sp+1 - - ldx kernelspreg - txs - - cli - - rts -;--------------------------------------------------------------------- - ;; Simulate an IRQ by pushing CPU status and CPu registers - ;; onto the stack. Then call the yield function to yield the - ;; process. -_mtarch_yield: - php - pha - txa - pha - tya - pha - - tsx - - ; the rts adds 1 to the PC - ; saved on the stack. We want - lda $0105,x ; the stack to look like is would - clc ; do inside of an interrupt. - adc #1 ; (this is what the 'rts' does, - sta $0105,x ; but not the 'rti') - lda $0106,x - adc #0 - sta $0106,x - - - jmp yield -;--------------------------------------------------------------------- -_mtarch_asm_start: - lda _mtarch_asm_threadzp - sta ptr1 - lda _mtarch_asm_threadzp+1 - sta ptr1+1 - - ldy #0 -: - lda <__ZP_START__,y - sta (ptr1),y - iny - cpy #zpsize - bne :- - rts - -;--------------------------------------------------------------------- -irq: - lda oldirq - sta $0314 - lda oldirq+1 - sta $0315 - jmp yield -;--------------------------------------------------------------------- - ;; Setup preemption IRQ -_mtarch_pstart: - sei - lda $0314 - sta oldirq - lda $0315 - sta oldirq+1 - - lda #irq - sta $0315 - cli - rts -;--------------------------------------------------------------------- -_mtarch_pstop: - sei - lda oldirq - sta $0314 - lda oldirq+1 - sta $0315 - cli - rts -;--------------------------------------------------------------------- - diff --git a/backyard/platform/c64/lib/mtarch.c b/backyard/platform/c64/lib/mtarch.c deleted file mode 100644 index 19245bb82..000000000 --- a/backyard/platform/c64/lib/mtarch.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - * $Id: mtarch.c,v 1.1 2007/05/23 23:11:28 oliverschmidt Exp $ - */ -#include "mtarch.h" -#include - -unsigned char mtarch_asm_threadspreg; -unsigned char *mtarch_asm_threadsp; -unsigned char *mtarch_asm_threadzp; -unsigned char *mtarch_asm_threadstack; - -void mtarch_asm_start(void); -void mtarch_asm_exec(void); - - -/*--------------------------------------------------------------------------*/ -void -mtarch_start(struct mtarch_thread *thread, - void (* function)(void *data), - void *data) -{ - memset(thread->cpustack, 0, sizeof(thread->cpustack)); - memset(thread->cstack, 0, sizeof(thread->cstack)); - - /* Create a CPU stack frame with the appropriate values... */ - thread->cpustack[MTARCH_CPUSTACKSIZE - 2] = ((unsigned short)function) >> 8; /* high byte of return address. */ - thread->cpustack[MTARCH_CPUSTACKSIZE - 3] = ((unsigned short)function) & 0xff; /* low byte of return address. */ - thread->cpustack[MTARCH_CPUSTACKSIZE - 4] = 0x21; /* processor flags. */ - thread->cpustack[MTARCH_CPUSTACKSIZE - 5] = /* a register */ - thread->cpustack[MTARCH_CPUSTACKSIZE - 6] = /* x register */ - thread->cpustack[MTARCH_CPUSTACKSIZE - 7] = 0; /* y register */ - thread->spreg = MTARCH_CPUSTACKSIZE - 8; - - /* Setup the C stack with the data pointer. */ - thread->sp = &thread->cstack[MTARCH_CSTACKSIZE - 1]; - - mtarch_asm_threadzp = &(thread->zp); - mtarch_asm_start(); -} -/*--------------------------------------------------------------------------*/ -void -mtarch_exec(struct mtarch_thread *thread) -{ - /* Switch processor stack. The call to mtarch_asm_switch() will not - return until the process that we switch to calls yield(). */ - mtarch_asm_threadspreg = thread->spreg; - mtarch_asm_threadsp = thread->sp; - - mtarch_asm_threadstack = &(thread->cpustack[0]); - mtarch_asm_threadzp = &(thread->zp[0]); - - mtarch_asm_exec(); - - thread->sp = mtarch_asm_threadsp; - thread->spreg = mtarch_asm_threadspreg; -} -/*--------------------------------------------------------------------------*/ -void -mtarch_init(void) { - -} -/*--------------------------------------------------------------------------*/ -void -mtarch_remove(void) -{ - -} diff --git a/backyard/platform/c64/lib/mtarch.h b/backyard/platform/c64/lib/mtarch.h deleted file mode 100644 index 5fe7570a8..000000000 --- a/backyard/platform/c64/lib/mtarch.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - * $Id: mtarch.h,v 1.1 2007/05/23 23:11:28 oliverschmidt Exp $ - */ -#ifndef __MTARCH_H__ -#define __MTARCH_H__ - -#define MTARCH_CPUSTACKSIZE 256 -#define MTARCH_CSTACKSIZE 256 -#define MTARCH_ZPSIZE 32 - -struct mtarch_thread { - unsigned char spreg; - unsigned char *sp; - unsigned char cpustack[MTARCH_CPUSTACKSIZE]; - unsigned char cstack[MTARCH_CSTACKSIZE]; - unsigned char zp[MTARCH_ZPSIZE]; -}; - -#endif /* __MTARCH_H__ */ - diff --git a/backyard/platform/c64/lib/save-driveunit.S b/backyard/platform/c64/lib/save-driveunit.S deleted file mode 100644 index b9a8f1629..000000000 --- a/backyard/platform/c64/lib/save-driveunit.S +++ /dev/null @@ -1,7 +0,0 @@ - .import __curunit - .constructor saveunit, 32 -.code -saveunit: - lda $ba - sta __curunit - rts diff --git a/backyard/platform/c64/loader/c64-dio-asm.S b/backyard/platform/c64/loader/c64-dio-asm.S deleted file mode 100644 index d00dbf25e..000000000 --- a/backyard/platform/c64/loader/c64-dio-asm.S +++ /dev/null @@ -1,505 +0,0 @@ - - - .export _c64_dio_asm_init - .export _c64_dio_asm_read_block - .export _c64_dio_asm_write_block - - .export _c64_dio_asm_track, _c64_dio_asm_sector - - .export _c64_dio_asm_ptr - - .importzp ptr1, ptr2 - - ;; job code $80 read, $90 write - - -ciout = $ffa8 -listen = $ffb1 -second = $ff93 -unlsn = $ffae - -nbytes = 34 -esc = $42 - -blockread = 1 -blockwrite = 2 - -errok = 0 -errerr = 1 - -.data -_c64_dio_asm_track: .byte 0 -_c64_dio_asm_sector: .byte 0 -_c64_dio_asm_ptr: .byte 0,0 - -.code -;--------------------------------------- -_c64_dio_asm_read_block: - - lda #blockread - jsr send - - lda _c64_dio_asm_track - jsr send - lda _c64_dio_asm_sector - jsr send - - - jsr recv - cmp #errok - bne readerr - - lda _c64_dio_asm_ptr - sta ptr1 - lda _c64_dio_asm_ptr+1 - sta ptr1+1 - ldy #0 -readl: - jsr recv - sta (ptr1),y - iny - bne readl - clc - lda #0 - tax - rts -readerr: - ; sta $07c0 - jsr recv - ; sta $07c1 - ldx #0 - rts -;--------------------------------------- -_c64_dio_asm_write_block: - - lda #blockwrite - jsr send - - lda _c64_dio_asm_track - jsr send - lda _c64_dio_asm_sector - jsr send - - - lda _c64_dio_asm_ptr - sta ptr1 - lda _c64_dio_asm_ptr+1 - sta ptr1+1 - ldy #0 -writel: - lda (ptr1),y - jsr send - iny - bne writel - - jsr recv - cmp #errok - bne writeerr - lda #0 - tax - rts - -writeerr: - ; sta $07c0 - jsr recv - ; sta $07c1 - ldx #0 - rts -;--------------------------------------- -_c64_dio_asm_init: - sta devnr - lda #$00 - sta drvmem - lda #$05 - sta drvmem+1 - - lda #drive - sta ptr1+1 - - ; lda devnr - ; ldx #icmd - ; jsr drvcmd - ; jsr unlsn - -mwl: - lda devnr - ldx #mwcmd - jsr drvcmd - - ldy #0 - lda (ptr1),y - jsr ciout - iny - cpy #nbytes - bne *-8 - - jsr unlsn - - lda drvmem - clc - adc #nbytes - sta drvmem - lda drvmem+1 - adc #0 - sta drvmem+1 - - lda ptr1 - clc - adc #nbytes - sta ptr1 - tax - lda ptr1+1 - adc #0 - sta ptr1+1 - cpx #driveend - bcc mwl - - lda devnr - ldx #mecmd - jsr drvcmd - jsr unlsn - - rts -;--------------------------------------- -drvcmd: - stx ptr2 - sty ptr2+1 - jsr listen - lda #$6f - jsr second - - ldy #0 - lda (ptr2),y - sta drvcmdcmp+1 - inc ptr2 - bne *+4 - inc ptr2+1 - - ldy #0 - lda (ptr2),y - jsr ciout - iny -drvcmdcmp: cpy #0 - bne *-8 - rts -;--------------------------------------- -devnr: .byte 8 -mwcmd: .byte 6 - .byte $4d, $2d, $57 -drvmem: .word $0500 - .byte nbytes - .byte 0 -mecmd: .byte 2 - .byte $55, $33 - .byte 0 -;--------------------------------------- -send: - - sta ptr2 - ldx #7 -sendl: - lsr ptr2 - - - lda $dd00 - and #$df - ora #$10 - bcc *+4 - eor #$30 - sta $dd00 - - lda #$c0 - bit $dd00 - bne *-3 - - lda $dd00 - and #$cf - sta $dd00 - - lda $dd00 - and #$c0 - eor #$c0 - bne *-7 - - dex - bpl sendl - - ldx $d020 - lda #1 - sta $d020 - stx $d020 - - rts -;--------------------------------------- -recv: - ldx $d020 - lda #0 - sta $d020 - stx $d020 - - ldx #7 -recvl: - lda $dd00 - and #$c0 - eor #$c0 - beq *-7 - asl a - - lda $dd00 - and #$df - ora #$10 - bcs *+4 - eor #$30 - sta $dd00 - ror ptr2 - - lda #$c0 - bit $dd00 - beq *-3 - - lda $dd00 - and #$cf - sta $dd00 - - dex - bpl recvl - lda ptr2 - rts -;--------------------------------------- - -;--------------------------------------- -;the code residing in the drive: -;--------------------------------------- -dtmp = $46 -dtmp2 = $97 -dbuf = $0300 -dbufcmd = $00 -dbuftrack = $06 -dbufsect = $07 - -retries = 4 -bretries = 2 -;--------------------------------------- -drive : - .org $0500 - - - - cld - tsx - stx dstack - sei - jsr ledoff - -drivel: - jsr dload - jsr ledoff - cli - jmp drivel -;--------------------------------------- -ledon: - lda $1c00 - ora #$08 - sta $1c00 - rts -ledoff: - lda $1c00 - and #$f7 - sta $1c00 - rts -;--------------------------------------- -drecv: - ldx #7 -drecvl: - lda $1800 - bmi atn - and #5 - beq *-7 - lsr a - lda #2 - bcc *+4 - lda #8 - sta $1800 - ror dtmp - lda $1800 - bmi atn - and #5 - eor #5 - beq *-9 - lda #0 - sta $1800 - dex - bpl drecvl - lda dtmp - rts -;--------------------------------------- -atn: - ldx dstack - txs - cli - rts -;--------------------------------------- -dsend: - sta dtmp - ldx #7 -dsendl: - lsr dtmp - lda #2 - bcs *+4 - lda #8 - sta $1800 - - lda $1800 - bmi atn - and #5 - eor #5 - bne *-9 - - sta $1800 - - lda #5 - bit $1800 - bne *-3 - dex - bpl dsendl - rts -;--------------------------------------- -dload: - ldy #0 - - jsr drecv - sta dcmd - - jsr ledon - - jsr drecv - sta dbuftrack - - jsr drecv - sta dbufsect - - lda dcmd - cmp #blockwrite - bne dblockread -dblockwrite: - ldy #0 -drecvpl: - jsr drecv - sta dbuf,y - iny - bne drecvpl - - jmp dputsect - -dblockread: - jsr dgetsect - -dsendpage: - ldy #0 -dsendpl: - lda dbuf,y - jsr dsend - iny - bne dsendpl - rts -;--------------------------------------- -dgetsect: - ; stx dbuftrack - ; sty dbufsect - ldx #retries -dgetsectl: - lda #$80 - sta dbufcmd - - cli -: - lda dbufcmd - bmi :- - sei - cmp #1 - beq dgsnoerr - - cpx #0 - beq dgsserr - dex - cpx #bretries - bcs dgetsectl - pha - lda #$c0 - sta dbufcmd - cli -: - lda dbufcmd - bmi :- - pla - cpx #0 - bne dgetsectl - -dgsserr: - pha - lda #errerr - jsr dsend - pla - jsr dsend - rts -dgsnoerr: - lda #errok - jsr dsend - rts -;--------------------------------------- -dputsect: - ; stx dbuftrack - ; sty dbufsect - ldx #retries -dputsectl: - lda #$90 - sta dbufcmd - - cli -: - lda dbufcmd - bmi :- - sei - cmp #1 - beq dpsnoerr - - cpx #0 - beq dpsserr - dex - cpx #bretries - bcs dputsectl - pha - lda #$c0 - sta dbufcmd - cli -: - lda dbufcmd - bmi :- - pla - cpx #0 - bne dputsectl - -dpsserr: - pha - lda #errerr - jsr dsend - pla - jsr dsend - rts -dpsnoerr: - lda #errok - jsr dsend - rts -;--------------------------------------- -led: .byte 0,0 -dstack: .byte 0 -dcmd: .byte 0 -.RELOC -driveend: - diff --git a/backyard/platform/c64/loader/c64-dio-asm.h b/backyard/platform/c64/loader/c64-dio-asm.h deleted file mode 100644 index b04bb60fe..000000000 --- a/backyard/platform/c64/loader/c64-dio-asm.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop OS - * - * $Id: c64-dio-asm.h,v 1.1 2007/05/23 23:11:28 oliverschmidt Exp $ - * - */ -#ifndef __C64_DIO_ASM_H__ -#define __C64_DIO_ASM_H__ - -extern unsigned char c64_dio_asm_track, - c64_dio_asm_sector; - -extern unsigned char *c64_dio_asm_ptr; - -void __fastcall__ c64_dio_asm_init(unsigned char drive); -unsigned char c64_dio_asm_read_block(void); -unsigned char c64_dio_asm_write_block(void); - -#endif /* __C64_DIO_H__ */ diff --git a/backyard/platform/c64/loader/c64-dio.c b/backyard/platform/c64/loader/c64-dio.c deleted file mode 100644 index b4b24e743..000000000 --- a/backyard/platform/c64/loader/c64-dio.c +++ /dev/null @@ -1,119 +0,0 @@ -/** - * \addtogroup c64fs - * @{ - * - */ - -/** - * \file - * C64 direct disk I/O. - * \author Adam Dunkels - * - */ - -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop OS - * - * $Id: c64-dio.c,v 1.1 2007/05/23 23:11:28 oliverschmidt Exp $ - * - */ - -#include "c64-dio.h" -#include "c64-dio-asm.h" - -/*-----------------------------------------------------------------------------------*/ -/** - * Read a block of data (256 bytes) from the disk. - * - * \param track The track of the disk block to be read. - * - * \param sector The sector of the disk block to be read. - * - * \param ptr A pointer to a buffer than must be able to accomodate - * 256 bytes of data. - * - * \return An error code or C64_DIO_OK if the data was successfully - * read. - */ -/*-----------------------------------------------------------------------------------*/ -unsigned char -c64_dio_read_block(unsigned char track, - unsigned char sector, - unsigned char *ptr) -{ - c64_dio_asm_track = track; - c64_dio_asm_sector = sector; - c64_dio_asm_ptr = ptr; - return c64_dio_asm_read_block(); -} -/*-----------------------------------------------------------------------------------*/ -/** - * Write a block of data (256 bytes) to the disk. - * - * \param track The track of the disk block to be written. - * - * \param sector The sector of the disk block to be written. - * - * \param ptr A pointer to a buffer containing the 256 bytes of data - * to be written. - * - * \return An error code or C64_DIO_OK if the data was successfully - * written. - */ -/*-----------------------------------------------------------------------------------*/ -unsigned char -c64_dio_write_block(unsigned char track, - unsigned char sector, - unsigned char *ptr) -{ - c64_dio_asm_track = track; - c64_dio_asm_sector = sector; - c64_dio_asm_ptr = ptr; - return c64_dio_asm_write_block(); -} -/*-----------------------------------------------------------------------------------*/ -/** - * Initialize the direct disk I/O routines for a particular disk drive. - * - * This function must be called before any of the other direct disk - * I/O functions can be used. - * - * \param drive The drive number of the disk drive for which the - * direct disk I/O should be enabled. - */ -/*-----------------------------------------------------------------------------------*/ -void -c64_dio_init(unsigned char drive) -{ - c64_dio_asm_init(drive); -} -/*-----------------------------------------------------------------------------------*/ -/** @} */ diff --git a/backyard/platform/c64/loader/c64-dio.h b/backyard/platform/c64/loader/c64-dio.h deleted file mode 100644 index da8c6ea97..000000000 --- a/backyard/platform/c64/loader/c64-dio.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop OS - * - * $Id: c64-dio.h,v 1.1 2007/05/23 23:11:28 oliverschmidt Exp $ - * - */ -#ifndef __C64_DIO_H__ -#define __C64_DIO_H__ - -void c64_dio_init(unsigned char drive); - -unsigned char c64_dio_read_block(unsigned char track, - unsigned char sector, - unsigned char *buf); - -unsigned char c64_dio_write_block(unsigned char track, - unsigned char sector, - unsigned char *buf); - -#define C64_DIO_OK 0 - -#endif /* __C64_DIO_H__ */ diff --git a/backyard/platform/c64/loader/c64-fs-raw.c b/backyard/platform/c64/loader/c64-fs-raw.c deleted file mode 100644 index 172f25163..000000000 --- a/backyard/platform/c64/loader/c64-fs-raw.c +++ /dev/null @@ -1,205 +0,0 @@ -/** - * \addtogroup c64fs - * @{ - */ - -/** - * \file - * "Raw" C64 file system access. - * \author Adam Dunkels - * - * This file provides functions that allow reading data from files - * without updating the file descriptor pointer. The functions are not - * automatically included in the core Contiki code and therefore - * application programs that use tham must manually link with this - * file. - * - */ - - -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: c64-fs-raw.c,v 1.1 2007/05/23 23:11:28 oliverschmidt Exp $ - * - */ - -#include "c64-fs-raw.h" - -#include - -struct directory_entry { - unsigned char type; - unsigned char track, sect; - unsigned char name[16]; - unsigned char reltrack, relsect, relreclen; - unsigned char unused1, unused2, unused3, unused4; - unsigned char tmptrack, tmpsect; - unsigned char blockslo, blockshi; -}; - - -extern unsigned char _c64_fs_dirbuf[256]; -extern unsigned char _c64_fs_dirbuftrack, _c64_fs_dirbufsect; - -extern unsigned char _c64_fs_filebuf[256]; -extern unsigned char _c64_fs_filebuftrack, _c64_fs_filebufsect; - -void _c64_fs_readdirbuf(unsigned char track, unsigned char sect); - - -/*-----------------------------------------------------------------------------------*/ -/** - * Read data from a file without updating the file descriptor pointer. - * - * This function reads data from an open file into a buffer than must - * be allocated by the caller, but does not update the file - * description pointer like the c64_fs_read() function does. - * - * \param f A pointer to a file descriptor structure that must have - * been opened with c64_fs_open(). - * - * \param buf A pointer to the buffer in which the data should be placed. - * - * \param len The maxiumum amount of bytes to read. - * - * \return The number of bytes that actually was read, or 0 if an end - * of file was encountered. - * - */ -/*-----------------------------------------------------------------------------------*/ -int __fastcall__ -c64_fs_read_raw(register struct c64_fs_file *f, char *buf, int len) -{ - int i; - unsigned char fptr, ftrack, fsect; - - /* Check if current block is already in buffer, and if not read it - from disk. */ - if(_c64_fs_filebuftrack != f->track || - _c64_fs_filebufsect != f->sect) { - _c64_fs_filebuftrack = f->track; - _c64_fs_filebufsect = f->sect; - c64_dio_read_block(_c64_fs_filebuftrack, - _c64_fs_filebufsect, _c64_fs_filebuf); - } - - if(_c64_fs_filebuf[0] == 0 && - f->ptr == _c64_fs_filebuf[1]) { - return 0; /* EOF */ - } - - fptr = f->ptr; - ftrack = f->track; - fsect = f->sect; - - for(i = 0; i < len; ++i) { - *buf = _c64_fs_filebuf[fptr]; - - ++fptr; - if(_c64_fs_filebuf[0] == 0) { - if(fptr == _c64_fs_filebuf[1]) { - /* End of file reached, we return the amount of bytes read so - far. */ - return i + 1; - } - } else if(fptr == 0) { - - /* Read new block into buffer and set buffer state - accordingly. */ - _c64_fs_filebuftrack = ftrack = _c64_fs_filebuf[0]; - _c64_fs_filebufsect = fsect = _c64_fs_filebuf[1]; - fptr = 2; - c64_dio_read_block(_c64_fs_filebuftrack, - _c64_fs_filebufsect, _c64_fs_filebuf); - } - - ++buf; - } - return i; -} -/*-----------------------------------------------------------------------------------*/ -/** - * Move the file descriptior pointer forward in the file. - * - * - * \param f A pointer to a file descriptor structure that must have - * been opened with c64_fs_open(). - * - * \param len The number of bytes the pointer should be moved forward. - * - * \return The number of bytes that the pointer actually was moved, or - * 0 if an end of file was encountered. - */ -/*-----------------------------------------------------------------------------------*/ -int -c64_fs_read_next(register struct c64_fs_file *f, int len) -{ - int i; - - /* Check if current block is already in buffer, and if not read it - from disk. */ - if(_c64_fs_filebuftrack != f->track || - _c64_fs_filebufsect != f->sect) { - _c64_fs_filebuftrack = f->track; - _c64_fs_filebufsect = f->sect; - c64_dio_read_block(_c64_fs_filebuftrack, - _c64_fs_filebufsect, _c64_fs_filebuf); - } - - if(_c64_fs_filebuf[0] == 0 && - f->ptr == _c64_fs_filebuf[1]) { - return 0; /* EOF */ - } - - for(i = 0; i < len; ++i) { - - ++f->ptr; - if(_c64_fs_filebuf[0] == 0) { - if(f->ptr == _c64_fs_filebuf[1]) { - /* End of file reached, we return the amount of bytes read so - far. */ - return i + 1; - } - } else if(f->ptr == 0) { - /* Read new block into buffer and set buffer state - accordingly. */ - _c64_fs_filebuftrack = f->track = _c64_fs_filebuf[0]; - _c64_fs_filebufsect = f->sect = _c64_fs_filebuf[1]; - f->ptr = 2; - c64_dio_read_block(_c64_fs_filebuftrack, - _c64_fs_filebufsect, _c64_fs_filebuf); - } - } - return i; -} -/*-----------------------------------------------------------------------------------*/ -/** @} */ diff --git a/backyard/platform/c64/loader/c64-fs-raw.h b/backyard/platform/c64/loader/c64-fs-raw.h deleted file mode 100644 index 2330936de..000000000 --- a/backyard/platform/c64/loader/c64-fs-raw.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: c64-fs-raw.h,v 1.1 2007/05/23 23:11:28 oliverschmidt Exp $ - * - */ -#ifndef __C64_FS_RAW_H__ -#define __C64_FS_RAW_H__ - -#include "c64-fs.h" - -int __fastcall__ c64_fs_read_raw(struct c64_fs_file *f, - char *buf, int len); - -int c64_fs_read_next(struct c64_fs_file *f, int len); - - -#endif /* __C64_FS_H__ */ diff --git a/backyard/platform/c64/loader/c64-fs-write.c b/backyard/platform/c64/loader/c64-fs-write.c deleted file mode 100644 index 4a9f129b0..000000000 --- a/backyard/platform/c64/loader/c64-fs-write.c +++ /dev/null @@ -1,121 +0,0 @@ -/** - * \addtogroup c64fs - * @{ - */ - -/** - * \file - * Implementation of C64 file writes. - * \author Adam Dunkels - * - * The functions in this file are not included in the core Contiki - * code, but must be explicitly linked by an application that that - * wishes to be able to write to files. - */ - - -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: c64-fs-write.c,v 1.1 2007/05/23 23:11:28 oliverschmidt Exp $ - * - */ - -#include "c64-dio.h" -#include "c64-fs.h" -#include - -/* An *UGLY* implementation of c64_fs_write that only can be used to - overwrite a single block file. */ - -extern unsigned char _c64_fs_filebuf[256]; -extern unsigned char _c64_fs_filebuftrack, - _c64_fs_filebufsect; - - -/*-----------------------------------------------------------------------------------*/ -/** - * Write data to an open file. - * - * \note This function currently does not support writing to other than a single block file (cannot be more than 254 bytes long). - * - * \param f A pointer to a file descriptor previously opened with c64_fs_open(). - * - * \param buf A pointer to a buffer with data that should be written - * to the file. - * - * \param len The length of the data that should be written. - * - * \return The number of bytes actually written. - * - */ -/*-----------------------------------------------------------------------------------*/ -int __fastcall__ -c64_fs_write(register struct c64_fs_file *f, char *buf, int len) -{ - int i; - - if(len <= 0) { - return 0; - } - - /* Check if current block is already in buffer, and if not read it - from disk. */ - if(_c64_fs_filebuftrack != f->track || - _c64_fs_filebufsect != f->sect) { - _c64_fs_filebuftrack = f->track; - _c64_fs_filebufsect = f->sect; - c64_dio_read_block(_c64_fs_filebuftrack, - _c64_fs_filebufsect, - _c64_fs_filebuf); - } - - i = 256 - f->ptr; - if(len < i) { - i = len; - } - - memcpy(&_c64_fs_filebuf[f->ptr], buf, i); - - f->ptr += i; - if(_c64_fs_filebuf[0] == 0 && - f->ptr > _c64_fs_filebuf[1]) { - _c64_fs_filebuf[1] = f->ptr; - } - - c64_dio_write_block(_c64_fs_filebuftrack, - _c64_fs_filebufsect, - _c64_fs_filebuf); - - return i; -} -/*-----------------------------------------------------------------------------------*/ -/** @} */ diff --git a/backyard/platform/c64/loader/c64-fs.c b/backyard/platform/c64/loader/c64-fs.c deleted file mode 100644 index d1bccc716..000000000 --- a/backyard/platform/c64/loader/c64-fs.c +++ /dev/null @@ -1,411 +0,0 @@ -/** - * \defgroup c64fs C64 file system and disk functions. - * @{ - * - * The C64 file system functions are divided into two categories: - * those that deal with C64 files and the C64 disk directory, and - * those that allow direct block access to the disk. The former - * functions can be used for accessing regular files, whereas the - * latter functions are used e.g. to download D64 files onto 1541 - * disks. - * - * \note The C64 filesystem functions currently only work with the - * 1541/1541-II/1571 and compatible drives, and not with the IDE64 - * hard disks or the 1581/FD2000 3.5" drives. - * - * - */ - -/** - * \file - * C64 file system operations interface for Contiki. - * \author Adam Dunkels - * - */ - -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: c64-fs.c,v 1.1 2007/05/23 23:11:28 oliverschmidt Exp $ - * - */ - -#include "c64-dio.h" -#include "c64-dio-asm.h" -#include "c64-fs.h" - -#include -#include - -struct directory_entry { - unsigned char type; - unsigned char track, sect; - unsigned char name[16]; - unsigned char reltrack, relsect, relreclen; - unsigned char unused1, unused2, unused3, unused4; - unsigned char tmptrack, tmpsect; - unsigned char blockslo, blockshi; -}; - -unsigned char _c64_fs_dirbuf[256]; -unsigned char _c64_fs_dirbuftrack = 0, _c64_fs_dirbufsect = 0; - -unsigned char _c64_fs_filebuf[256]; -unsigned char _c64_fs_filebuftrack = 0, _c64_fs_filebufsect = 0; - -static struct c64_fs_dirent lastdirent; - -static struct c64_fs_dir opendir; -static struct c64_fs_dirent opendirent; - -/*-----------------------------------------------------------------------------------*/ -/** - * Open a file. - * - * The file description must be allocated by the caller and a pointer - * to it is passed to this function. - * - * \param name A pointer to the name of the file to be opened. - * \param f A pointer to the file descriptor struct. - * - * \retval 0 If the file was successfully opened. - * \retval -1 If the file does not exist. - */ -/*-----------------------------------------------------------------------------------*/ -int -c64_fs_open(const char *name, register struct c64_fs_file *f) -{ - /* First check if we already have the file cached. If so, we don't - need to do an expensive directory lookup. */ - if(strncmp(lastdirent.name, name, 16) == 0) { - f->track = lastdirent.track; - f->sect = lastdirent.sect; - f->ptr = 2; - return 0; - } - - /* Not in cache, so we walk through directory instead. */ - c64_fs_opendir(&opendir); - - do { - c64_fs_readdir_dirent(&opendir, &opendirent); - if(strncmp(opendirent.name, name, 16) == 0) { - f->track = opendirent.track; - f->sect = opendirent.sect; - f->ptr = 2; - return 0; - } - } while(c64_fs_readdir_next(&opendir) == 0); - - /* The file was not found in the directory. We flush the directory - buffer cache now in order to prevent a nasty problem from - happening: If the first directory block of an empty disk was - cached, *all* subsequent file opens would return "file not - found". */ - _c64_fs_dirbuftrack = 0; /* There are no disk blocks on track 0. */ - return -1; -} -/*-----------------------------------------------------------------------------------*/ -/** - * Read data from an open file. - * - * This function reads data from an open file into a buffer than must - * be allocated by the caller. - * - * \param f A pointer to a file descriptor structure that must have - * been opened with c64_fs_open(). - * - * \param buf A pointer to the buffer in which the data should be placed. - * - * \param len The maxiumum amount of bytes to read. - * - * \return The number of bytes that actually was read, or 0 if an end - * of file was encountered. - */ -/*-----------------------------------------------------------------------------------*/ -#if !NOASM -#pragma optimize(push, off) -#endif /* !NOASM */ -int __fastcall__ -c64_fs_read(register struct c64_fs_file *f, char *buf, int len) -{ - static int i; - - /* Check if current block is already in buffer, and if not read it - from disk. */ - -#if NOASM - if(f->track != _c64_fs_filebuftrack || - _c64_fs_filebufsect != f->sect) { - _c64_fs_filebuftrack = f->track; - _c64_fs_filebufsect = f->sect; - c64_dio_read_block(_c64_fs_filebuftrack, _c64_fs_filebufsect, - _c64_fs_filebuf); - } -#else /* NOASM */ - asm("ldy #%b", offsetof(struct c64_fs_file, track)); - asm("lda (regbank+%b),y", 4); - asm("cmp %v", _c64_fs_filebuftrack); - asm("bne doblock"); - - asm("ldy #%b", offsetof(struct c64_fs_file, sect)); - asm("lda (regbank+%b),y", 4); - asm("cmp %v", _c64_fs_filebufsect); - asm("bne doblock"); - - asm("jmp noblock"); - - asm("doblock:"); - - asm("ldy #%b", offsetof(struct c64_fs_file, track)); - asm("lda (regbank+%b),y", 4); - asm("sta %v", _c64_fs_filebuftrack); - asm("sta %v", c64_dio_asm_track); - - asm("ldy #%b", offsetof(struct c64_fs_file, sect)); - asm("lda (regbank+%b),y", 4); - asm("sta %v", _c64_fs_filebufsect); - asm("sta %v", c64_dio_asm_sector); - - asm("lda #<(%v)", _c64_fs_filebuf); - asm("sta %v", c64_dio_asm_ptr); - asm("lda #>(%v)", _c64_fs_filebuf); - asm("sta %v+1", c64_dio_asm_ptr); - - asm("jsr %v", c64_dio_asm_read_block); - - asm("noblock:"); - -#endif /* NOASM */ - - if(_c64_fs_filebuf[0] == 0 && - f->ptr == _c64_fs_filebuf[1]) { - return 0; /* EOF */ - } - - for(i = 0; i < len; ++i) { -#if NOASM - *buf = _c64_fs_filebuf[f->ptr]; - ++f->ptr; -#else /* NOASM */ - asm("ldy #%o+1", buf); - asm("jsr ldaxysp"); - asm("sta ptr2"); - asm("stx ptr2+1"); - - asm("ldy #%b", offsetof(struct c64_fs_file, ptr)); - asm("lda (regbank+%b),y", 4); - asm("tax"); - - asm("ldy #0"); - asm("lda %v,x", _c64_fs_filebuf); - asm("sta (ptr2),y"); - - asm("inx"); - asm("txa"); - asm("ldy #%b", offsetof(struct c64_fs_file, ptr)); - asm("sta (regbank+%b),y", 4); -#endif /* NOASM */ - - - if(_c64_fs_filebuf[0] == 0) { - if(f->ptr == _c64_fs_filebuf[1]) { - /* End of file reached, we return the amount of bytes read so - far. */ - return i + 1; - } - } else if(f->ptr == 0) { - - /* Read new block into buffer and set buffer state - accordingly. */ - _c64_fs_filebuftrack = f->track = _c64_fs_filebuf[0]; - _c64_fs_filebufsect = f->sect = _c64_fs_filebuf[1]; - f->ptr = 2; - c64_dio_read_block(_c64_fs_filebuftrack, - _c64_fs_filebufsect, _c64_fs_filebuf); - } - - ++buf; - } - return i; -} -#if !NOASM -#pragma optimize(pop) -#endif /* !NOASM */ -/*-----------------------------------------------------------------------------------*/ -/** - * Close an open file. - * - * \param f A pointer to a file descriptor struct that previously has - * been opened with c64_fs_open(). - */ -/*-----------------------------------------------------------------------------------*/ -void -c64_fs_close(struct c64_fs_file *f) -{ - -} -/*-----------------------------------------------------------------------------------*/ -/** - * \internal - * Read a directory buffer into the _c64_fs_dirbuf buffer. - * - * This function is shared between this and the c64-fs-raw module. - * - * \param track The track of the directory block. - * \param sect The sector of the directory block. - */ -/*-----------------------------------------------------------------------------------*/ -void -_c64_fs_readdirbuf(unsigned char track, unsigned char sect) -{ - if(_c64_fs_dirbuftrack == track && - _c64_fs_dirbufsect == sect) { - /* Buffer already contains requested block, return. */ - return; - } - c64_dio_read_block(track, sect, _c64_fs_dirbuf); - _c64_fs_dirbuftrack = track; - _c64_fs_dirbufsect = sect; -} -/*-----------------------------------------------------------------------------------*/ -/** - * Open the disk directory for reading. - * - * The caller must supply a pointer to a directory descriptor. - * - * \param d A pointer to a directory description that must be - * allocated by the caller. - */ -/*-----------------------------------------------------------------------------------*/ -unsigned char -c64_fs_opendir(register struct c64_fs_dir *d) -{ - d->track = 18; - d->sect = 1; - d->ptr = 2; - - return 0; -} -/*-----------------------------------------------------------------------------------*/ -/** - * Read the current directory entry. - * - * This function reads the directory entry to which the directory - * descriptor currently points into a struct c64_fs_dirent supplied by - * the caller. - * - * The function c64_fs_readdir_next() is used to move the directory - * entry pointer forward in the directory. - * - * \param d A pointer to a directory descriptor previously opened with c64_fs_opendir(). - * - * \param f A pointer to a directory entry that must have been - * previously allocated by the caller. - */ -/*-----------------------------------------------------------------------------------*/ -void -c64_fs_readdir_dirent(register struct c64_fs_dir *d, - register struct c64_fs_dirent *f) -{ - struct directory_entry *de; - int i; - register char *nameptr; - - _c64_fs_readdirbuf(d->track, d->sect); - de = (struct directory_entry *)&_c64_fs_dirbuf[d->ptr]; - nameptr = de->name; - for(i = 0; i < 16; ++i) { - if(*nameptr == 0xa0) { - *nameptr = 0; - break; - } - ++nameptr; - } - strncpy(f->name, de->name, 16); - f->track = de->track; - f->sect = de->sect; - f->size = de->blockslo + (de->blockshi >> 8); - memcpy(&lastdirent, f, sizeof(struct c64_fs_dirent)); -} -/*-----------------------------------------------------------------------------------*/ -/** - * Move the directory pointer forward. - * - * This function moves the directory entry pointer in the directory - * descriptor forward so that it points to the next file. - * - * \param d A pointer to a directory descriptor previously opened with - * c64_fs_opendir(). - * - * \retval 1 If there are no more directory entried in the directory. - * \retval 0 There were more directory entries and the pointer has - * been moved to point to the next one. - */ -/*-----------------------------------------------------------------------------------*/ -unsigned char -c64_fs_readdir_next(struct c64_fs_dir *d) -{ - struct directory_entry *de; - again: - _c64_fs_readdirbuf(d->track, d->sect); - if(d->ptr == 226) { - if(_c64_fs_dirbuf[0] == 0) { - return 1; - } - d->track = _c64_fs_dirbuf[0]; - d->sect = _c64_fs_dirbuf[1]; - d->ptr = 2; - } else { - d->ptr += 32; - } - - de = (struct directory_entry *)&_c64_fs_dirbuf[d->ptr]; - if(de->type == 0) { - goto again; - } - return 0; -} -/*-----------------------------------------------------------------------------------*/ -/** - * Close a directory descriptor previously opened by c64_fs_opendir(). - * - * \param d A poitner to a directory descriptor previously opened with - * c64_fs_opendir(). - */ -/*-----------------------------------------------------------------------------------*/ -void -c64_fs_closedir(struct c64_fs_dir *d) -{ - -} -/*-----------------------------------------------------------------------------------*/ -/** @} */ diff --git a/backyard/platform/c64/loader/c64-fs.h b/backyard/platform/c64/loader/c64-fs.h deleted file mode 100644 index 214c3f7b9..000000000 --- a/backyard/platform/c64/loader/c64-fs.h +++ /dev/null @@ -1,97 +0,0 @@ -/** - * \addtogroup c64fs - * @{ - */ - -/** - * \file - * Header file for the C64 filesystem functions. - * \author Adam Dunkels - * - */ - -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: c64-fs.h,v 1.1 2007/05/23 23:11:28 oliverschmidt Exp $ - * - */ -#ifndef __C64_FS_H__ -#define __C64_FS_H__ - -#include "c64-dio.h" - -/** - * An opaque structure with no user visible elements that represents - * an open file. - */ -struct c64_fs_file { - unsigned char track, sect, ptr; -}; - -int c64_fs_open(const char *name, struct c64_fs_file *f); -void c64_fs_close(struct c64_fs_file *f); -int __fastcall__ c64_fs_read(struct c64_fs_file *f, - char *buf, int len); - -int __fastcall__ c64_fs_write(struct c64_fs_file *f, - char *buf, int len); - -/** - * An opaque structure with no user visible elements that represents a - * directory descriptor. - */ -struct c64_fs_dir { - unsigned char track, sect, ptr; -}; - -/** - * A C64 directory entry. - */ -struct c64_fs_dirent { - char name[17]; /**< The name of the directory entry. */ - unsigned short size; /**< The size of the directory entry in 256 byte blocks. */ - unsigned char track, - sect; -}; - - -unsigned char c64_fs_opendir(struct c64_fs_dir *d); - -void c64_fs_readdir_dirent(struct c64_fs_dir *d, - struct c64_fs_dirent *f); -unsigned char c64_fs_readdir_next(struct c64_fs_dir *d); - -void c64_fs_closedir(struct c64_fs_dir *d); - -/** @} */ - -#endif /* __C64_FS_H__ */ diff --git a/backyard/platform/c64/loader/cfs-1541-asm.S b/backyard/platform/c64/loader/cfs-1541-asm.S deleted file mode 100644 index 3d48e04d1..000000000 --- a/backyard/platform/c64/loader/cfs-1541-asm.S +++ /dev/null @@ -1,571 +0,0 @@ - ;; - ;; - ;; 1541 CFS implementation - ;; - ;; Architecture: - ;; - ;; Functionality split between C64 and 1541: 1541 performs - ;; directory lookup and finding files. 1541 communicates track/sector - ;; address of file, C64 requests data to be read from track/sector. - ;; - ;; Example: reading directory - ;; - ;; C64: DIR - ;; 1541: directory entries in CFS format - ;; - ;; Example: opening file - ;; - ;; C64: FILE filename - ;; 1541: track/sector - ;; - ;; Example: reading file - ;; - ;; C64: track/sector, length - ;; 1541: length, data, track/sector - - - .export _c64_dio_asm_init - .export _c64_dio_asm_read_block - .export _c64_dio_asm_write_block - - .export _c64_dio_asm_track, _c64_dio_asm_sector - - .export _c64_dio_asm_ptr - - .importzp ptr1, ptr2 - - ;; job code $80 read, $90 write - - -ciout = $ffa8 -listen = $ffb1 -second = $ff93 -unlsn = $ffae - -nbytes = 34 -esc = $42 - -blockread = 1 -blockwrite = 2 - -errok = 0 -errerr = 1 - -.data -_c64_dio_asm_track: .byte 0 -_c64_dio_asm_sector: .byte 0 -_c64_dio_asm_ptr: .byte 0,0 - -.code -;--------------------------------------- -_cfs_1541_read: - ;; First send READ command to drive - - lda #READ_CMD - jsr send - - ;; If drive do not respond we must download drive code - cmp #ERR_NOT_RESPONDING - bne notload - - jsr download - lda #read - jsr send -notload: - ;; Send file descriptor and number of bytes to read - lda _cfs_1541_fd - jsr send - lda _cfs_1541_bytes - jsr send - - lda _cfs_1541_ptr - sta ptr1 - lda _cfs_1541_ptr + 1 - sta ptr1 + 1 - - ;; Read bytes from drive - - ldy #0 -: - jsr recv - sta (ptr1),y - iny - cpy _cfs_1541_bytes - bne - - - ;; Read the number of bytes that were actually read from the file - jsr recv - - ;; Return the number of bytes read - - rts -;--------------------------------------- -_c64_dio_asm_read_block: - - lda #BLOCKREAD_CMD - jsr send - - lda _c64_dio_asm_track - jsr send - lda _c64_dio_asm_sector - jsr send - - - jsr recv - cmp #errok - bne readerr - - lda _c64_dio_asm_ptr - sta ptr1 - lda _c64_dio_asm_ptr+1 - sta ptr1+1 - ldy #0 -readl: - jsr recv - sta (ptr1),y - iny - bne readl - clc - lda #0 - tax - rts -readerr: - ; sta $07c0 - jsr recv - ; sta $07c1 - ldx #0 - rts -;--------------------------------------- -_c64_dio_asm_write_block: - - lda #blockwrite - jsr send - - lda _c64_dio_asm_track - jsr send - lda _c64_dio_asm_sector - jsr send - - - lda _c64_dio_asm_ptr - sta ptr1 - lda _c64_dio_asm_ptr+1 - sta ptr1+1 - ldy #0 -writel: - lda (ptr1),y - jsr send - iny - bne writel - - jsr recv - cmp #errok - bne writeerr - lda #0 - tax - rts - -writeerr: - ; sta $07c0 - jsr recv - ; sta $07c1 - ldx #0 - rts -;--------------------------------------- -_c64_dio_asm_init: - sta devnr - lda #$00 - sta drvmem - lda #$05 - sta drvmem+1 - - lda #drive - sta ptr1+1 - - ; lda devnr - ; ldx #icmd - ; jsr drvcmd - ; jsr unlsn - -mwl: - lda devnr - ldx #mwcmd - jsr drvcmd - - ldy #0 - lda (ptr1),y - jsr ciout - iny - cpy #nbytes - bne *-8 - - jsr unlsn - - lda drvmem - clc - adc #nbytes - sta drvmem - lda drvmem+1 - adc #0 - sta drvmem+1 - - lda ptr1 - clc - adc #nbytes - sta ptr1 - tax - lda ptr1+1 - adc #0 - sta ptr1+1 - cpx #driveend - bcc mwl - - lda devnr - ldx #mecmd - jsr drvcmd - jsr unlsn - - rts -;--------------------------------------- -drvcmd: - stx ptr2 - sty ptr2+1 - jsr listen - lda #$6f - jsr second - - ldy #0 - lda (ptr2),y - sta drvcmdcmp+1 - inc ptr2 - bne *+4 - inc ptr2+1 - - ldy #0 - lda (ptr2),y - jsr ciout - iny -drvcmdcmp: cpy #0 - bne *-8 - rts -;--------------------------------------- -devnr: .byte 8 -mwcmd: .byte 6 - .byte $4d, $2d, $57 -drvmem: .word $0500 - .byte nbytes - .byte 0 -mecmd: .byte 2 - .byte $55, $33 - .byte 0 -;--------------------------------------- -send: - - sta ptr2 - ldx #7 -sendl: - lsr ptr2 - - - lda $dd00 - and #$df - ora #$10 - bcc *+4 - eor #$30 - sta $dd00 - - lda #$c0 - bit $dd00 - bne *-3 - - lda $dd00 - and #$cf - sta $dd00 - - lda $dd00 - and #$c0 - eor #$c0 - bne *-7 - - dex - bpl sendl - - ldx $d020 - lda #1 - sta $d020 - stx $d020 - - rts -;--------------------------------------- -recv: - ldx $d020 - lda #0 - sta $d020 - stx $d020 - - ldx #7 -recvl: - lda $dd00 - and #$c0 - eor #$c0 - beq *-7 - asl a - - lda $dd00 - and #$df - ora #$10 - bcs *+4 - eor #$30 - sta $dd00 - ror ptr2 - - lda #$c0 - bit $dd00 - beq *-3 - - lda $dd00 - and #$cf - sta $dd00 - - dex - bpl recvl - lda ptr2 - rts -;--------------------------------------- - -;--------------------------------------- -;the code residing in the drive: -;--------------------------------------- -dtmp = $46 -dtmp2 = $97 -dbuf = $0300 -dbufcmd = $00 -dbuftrack = $06 -dbufsect = $07 - -retries = 10 -bretries = 2 -;--------------------------------------- -drive : - .org $0500 - - - - cld - tsx - stx dstack - sei - jsr ledoff - -drivel: - jsr dload - jsr ledoff - cli - jmp drivel -;--------------------------------------- -ledon: - lda $1c00 - ora #$08 - sta $1c00 - rts -ledoff: - lda $1c00 - and #$f7 - sta $1c00 - rts -;--------------------------------------- -drecv: - ldx #7 -drecvl: - lda $1800 - bmi atn - and #5 - beq *-7 - lsr a - lda #2 - bcc *+4 - lda #8 - sta $1800 - ror dtmp - lda $1800 - bmi atn - and #5 - eor #5 - beq *-9 - lda #0 - sta $1800 - dex - bpl drecvl - lda dtmp - rts -;--------------------------------------- -atn: - ldx dstack - txs - cli - rts -;--------------------------------------- -dsend: - sta dtmp - ldx #7 -dsendl: - lsr dtmp - lda #2 - bcs *+4 - lda #8 - sta $1800 - - lda $1800 - bmi atn - and #5 - eor #5 - bne *-9 - - sta $1800 - - lda #5 - bit $1800 - bne *-3 - dex - bpl dsendl - rts -;--------------------------------------- -dload: - ldy #0 - - jsr drecv - sta dcmd - - jsr ledon - - jsr drecv - sta dbuftrack - - jsr drecv - sta dbufsect - - lda dcmd - cmp #blockwrite - bne dblockread -dblockwrite: - ldy #0 -drecvpl: - jsr drecv - sta dbuf,y - iny - bne drecvpl - - jmp dputsect - -dblockread: - jsr dgetsect - -dsendpage: - ldy #0 -dsendpl: - lda dbuf,y - jsr dsend - iny - bne dsendpl - rts -;--------------------------------------- -dgetsect: - ; stx dbuftrack - ; sty dbufsect - ldx #retries -dgetsectl: - lda #$80 - sta dbufcmd - - cli -: - lda dbufcmd - bmi :- - sei - cmp #1 - beq dgsnoerr - - cpx #0 - beq dgsserr - dex - cpx #bretries - bcs dgetsectl - pha - lda #$c0 - sta dbufcmd - cli -: - lda dbufcmd - bmi :- - pla - cpx #0 - bne dgetsectl - -dgsserr: - pha - lda #errerr - jsr dsend - pla - jsr dsend - rts -dgsnoerr: - lda #errok - jsr dsend - rts -;--------------------------------------- -dputsect: - ; stx dbuftrack - ; sty dbufsect - ldx #retries -dputsectl: - lda #$90 - sta dbufcmd - - cli -: - lda dbufcmd - bmi :- - sei - cmp #1 - beq dpsnoerr - - cpx #0 - beq dpsserr - dex - cpx #bretries - bcs dputsectl - pha - lda #$c0 - sta dbufcmd - cli -: - lda dbufcmd - bmi :- - pla - cpx #0 - bne dputsectl - -dpsserr: - pha - lda #errerr - jsr dsend - pla - jsr dsend - rts -dpsnoerr: - lda #errok - jsr dsend - rts -;--------------------------------------- -led: .byte 0,0 -dstack: .byte 0 -dcmd: .byte 0 -.RELOC -driveend: - diff --git a/backyard/platform/c64/loader/cfs-1541.c b/backyard/platform/c64/loader/cfs-1541.c deleted file mode 100644 index 1746b8d27..000000000 --- a/backyard/platform/c64/loader/cfs-1541.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - * $Id: cfs-1541.c,v 1.1 2007/05/23 23:11:28 oliverschmidt Exp $ - */ -#include "contiki.h" - -#include "cfs.h" -#include "cfs-service.h" - - -static int s_open(char *n, int f); -static void s_close(int f); -static int s_read(int f, char *b, int l); -static int s_write(int f, char *b, int l); -static int s_opendir(struct cfs_dir *p, const char *n); -static int s_readdir(struct cfs_dir *p, struct cfs_dirent *e); -static int s_closedir(struct cfs_dir *p); - -static const struct cfs_service_interface interface = - { - CFS_SERVICE_VERSION, - s_open, - s_close, - s_read, - s_write, - s_opendir, - s_readdir, - s_closedir - }; - -EK_EVENTHANDLER(eventhandler, ev, data); -EK_POLLHANDLER(pollhandler); -EK_PROCESS(proc, CFS_SERVICE_NAME, EK_PRIO_NORMAL, - eventhandler, pollhandler, (void *)&state); - -/*---------------------------------------------------------------------------*/ - diff --git a/backyard/platform/c64/loader/cfs-cbm-posix.c b/backyard/platform/c64/loader/cfs-cbm-posix.c deleted file mode 100644 index d0003a6cf..000000000 --- a/backyard/platform/c64/loader/cfs-cbm-posix.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - * $Id: cfs-cbm-posix.c,v 1.1 2007/05/23 23:11:28 oliverschmidt Exp $ - */ -#include "contiki.h" - -#include "log.h" -#include "cfs.h" -#include "cfs-service.h" - -#include -#include -#include -#include - - - -static int s_open(const char *n, int f); -static void s_close(int f); -static int s_read(int f, char *b, unsigned int l); -static int s_write(int f, char *b, unsigned int l); -static int s_opendir(struct cfs_dir *p, const char *n); -static int s_readdir(struct cfs_dir *p, struct cfs_dirent *e); -static int s_closedir(struct cfs_dir *p); - -static const struct cfs_service_interface interface = - { - CFS_SERVICE_VERSION, - s_open, - s_close, - s_read, - s_write, - s_opendir, - s_readdir, - s_closedir - }; - -EK_EVENTHANDLER(eventhandler, ev, data); -EK_PROCESS(proc, CFS_SERVICE_NAME ": KERNAL", EK_PRIO_NORMAL, - eventhandler, NULL, (void *)&interface); - -/*---------------------------------------------------------------------------*/ -LOADER_INIT_FUNC(cfs_cbm_init, arg) -{ - arg_free(arg); - ek_service_start(CFS_SERVICE_NAME, &proc); -} -/*---------------------------------------------------------------------------*/ -EK_EVENTHANDLER(eventhandler, ev, data) -{ - switch(ev) { - case EK_EVENT_INIT: - case EK_EVENT_REPLACE: - log_message("Starting KERNAL CFS", ""); - break; - case EK_EVENT_REQUEST_REPLACE: - ek_replace((struct ek_proc *)data, &interface); - break; - case EK_EVENT_REQUEST_EXIT: - ek_exit(); - break; - } -} -/*---------------------------------------------------------------------------*/ -static int -s_open(const char *n, int f) -{ - if(f == CFS_READ) { - return open(n, O_RDONLY); - } else { - return open(n, O_CREAT|O_RDWR); - } -} -/*---------------------------------------------------------------------------*/ -static void -s_close(int f) -{ - close(f); -} -/*---------------------------------------------------------------------------*/ -static int -s_read(int f, char *b, unsigned int l) -{ - return read(f, b, l); -} -/*---------------------------------------------------------------------------*/ -static int -s_write(int f, char *b, unsigned int l) -{ - return write(f, b, l); -} -/*---------------------------------------------------------------------------*/ -static int -s_opendir(struct cfs_dir *p, const char *n) -{ - return cbm_opendir(4, 8); -} -/*---------------------------------------------------------------------------*/ -static int -s_readdir(struct cfs_dir *p, struct cfs_dirent *e) -{ - struct cbm_dirent ce; - int ret; - ret = cbm_readdir(4, &ce); - strncpy(e->name, ce.name, sizeof(ce.name)); - e->size = ce.size; - return ret; -} -/*---------------------------------------------------------------------------*/ -static int -s_closedir(struct cfs_dir *p) -{ - cbm_closedir(4); - return 1; -} -/*---------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/loader/cfs-cbm.c b/backyard/platform/c64/loader/cfs-cbm.c deleted file mode 100644 index 8b43da4e2..000000000 --- a/backyard/platform/c64/loader/cfs-cbm.c +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) 2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - * $Id: cfs-cbm.c,v 1.1 2007/05/23 23:11:29 oliverschmidt Exp $ - */ -#include "contiki.h" - -#include "cfs/cfs.h" -#include "cfs/cfs-service.h" - -#include -#include - -static int s_open(const char *n, int f); -static void s_close(int f); -static int s_read(int f, char *b, unsigned int l); -static int s_write(int f, char *b, unsigned int l); -static int s_opendir(struct cfs_dir *p, const char *n); -static int s_readdir(struct cfs_dir *p, struct cfs_dirent *e); -static int s_closedir(struct cfs_dir *p); - -SERVICE(cfs_cbm_service, cfs_service, -{ s_open, s_close, s_read, s_write, s_opendir, s_readdir, s_closedir }); - - -PROCESS(cfs_cbm_process, "CFS KERNAL service"); -PROCESS_THREAD(cfs_cbm_process, ev, data) { - PROCESS_BEGIN(); - - log_message("Starting KERNAL CFS", ""); - SERVICE_REGISTER(cfs_cbm_service); - - while(ev != PROCESS_EVENT_SERVICE_REMOVED && - ev != PROCESS_EVENT_EXIT) { - PROCESS_WAIT_EVENT(); - } - - SERVICE_REMOVE(cfs_cbm_service); - - PROCESS_END(); -} - -/*---------------------------------------------------------------------------*/ -static int -s_open(const char *n, int f) -{ - if(cbm_open(2, _curunit, f, n) == 0) { - return 2; - } - return -1; -} -/*---------------------------------------------------------------------------*/ -static void -s_close(int f) -{ - cbm_close(f); -} -/*---------------------------------------------------------------------------*/ -static int -s_read(int f, char *b, unsigned int l) -{ - return cbm_read(f, b, l); -} -/*---------------------------------------------------------------------------*/ -static int -s_write(int f, char *b, unsigned int l) -{ - return cbm_write(f, b, l); -} -/*---------------------------------------------------------------------------*/ -static int -s_opendir(struct cfs_dir *p, const char *n) -{ - return cbm_opendir(4, _curunit); -} -/*---------------------------------------------------------------------------*/ -static int -s_readdir(struct cfs_dir *p, struct cfs_dirent *e) -{ - struct cbm_dirent ce; - int ret; - ret = cbm_readdir(4, &ce); - strncpy(e->name, ce.name, sizeof(ce.name)); - e->size = ce.size; - return ret; -} -/*---------------------------------------------------------------------------*/ -static int -s_closedir(struct cfs_dir *p) -{ - cbm_closedir(4); - return 1; -} -/*---------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/loader/cfs-cbm.h b/backyard/platform/c64/loader/cfs-cbm.h deleted file mode 100644 index 670e83988..000000000 --- a/backyard/platform/c64/loader/cfs-cbm.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - * $Id: cfs-cbm.h,v 1.1 2007/05/23 23:11:29 oliverschmidt Exp $ - */ -#ifndef __CFS_CBM_H__ -#define __CFS_CBM_H__ - - -#endif /* __CFS_CBM_H__ */ diff --git a/backyard/platform/c64/loader/cfs-init.c b/backyard/platform/c64/loader/cfs-init.c deleted file mode 100644 index d124e2133..000000000 --- a/backyard/platform/c64/loader/cfs-init.c +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) 2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - * $Id: cfs-init.c,v 1.1 2007/05/23 23:11:29 oliverschmidt Exp $ - */ -#include "contiki.h" - -#include "cfs/cfs.h" -#include "cfs/cfs-service.h" - -#include -#include - -static int s_open(const char *n, int f); -static void s_close(int f); -static int s_read(int f, char *b, unsigned int l); -static int s_write(int f, char *b, unsigned int l) {return -1;} -static int s_opendir(struct cfs_dir *p, const char *n) {return -1;} -static int s_readdir(struct cfs_dir *p, struct cfs_dirent *e) {return -1;} -static int s_closedir(struct cfs_dir *p) {return -1;} - -SERVICE(cfs_posix_service, cfs_service, -{ s_open, s_close, s_read, s_write, s_opendir, s_readdir, s_closedir }); - -PROCESS(cfs_posix_process, "CFS POSIX service"); -PROCESS_THREAD(cfs_posix_process, ev, data) { - PROCESS_BEGIN(); - - SERVICE_REGISTER(cfs_posix_service); - - while(ev != PROCESS_EVENT_SERVICE_REMOVED && - ev != PROCESS_EVENT_EXIT) { - PROCESS_WAIT_EVENT(); - } - - SERVICE_REMOVE(cfs_posix_service); - - PROCESS_END(); -} - -/*---------------------------------------------------------------------------*/ -#include -static int -s_open(const char *n, int f) -{ - if(cbm_open(2, _curunit, CBM_READ, n) == 0) { - /* printf("Opening with _curunit %d\n", _curunit);*/ - return 2; - } - return -1; -} -/*---------------------------------------------------------------------------*/ -static void -s_close(int f) -{ - cbm_close(f); -} -/*---------------------------------------------------------------------------*/ -static int -s_read(int f, char *b, unsigned int l) -{ - return cbm_read(f, b, l); -} -/*---------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/loader/cfs-init.h b/backyard/platform/c64/loader/cfs-init.h deleted file mode 100644 index b5dcb6eab..000000000 --- a/backyard/platform/c64/loader/cfs-init.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - * $Id: cfs-init.h,v 1.1 2007/05/23 23:11:29 oliverschmidt Exp $ - */ -#ifndef __CFS_INIT_H__ -#define __CFS_INIT_H__ - -#include "contiki.h" - -PROCESS_NAME(cfs_init_process); - -#endif /* __CFS_INIT_H__ */ diff --git a/backyard/platform/c64/loader/loader-arch.c b/backyard/platform/c64/loader/loader-arch.c deleted file mode 100644 index f1d562242..000000000 --- a/backyard/platform/c64/loader/loader-arch.c +++ /dev/null @@ -1,140 +0,0 @@ -/** - * \file - * File loader implementation. - * \author Adam Dunkels - * - * This file implements dynamically loadable files for Contiki using - * the cc65 module loading system. The actual file operations are - * implemented in other files. - */ - -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop OS - * - * $Id: loader-arch.c,v 1.1 2007/05/23 23:11:29 oliverschmidt Exp $ - * - */ - -#include -#include - -#include "cfs/cfs.h" - -#include "sys/loader.h" - -#include "loader-arch.h" - -static int __fastcall__ -do_read(int f, char *buf, unsigned int len) -{ - return cfs_read(f, buf, len); -} - -struct mod_ctrl ctrl = { - (void *)do_read /* Read from disk */ -}; - - -struct loader_arch_hdr { - char arch[8]; - char version[8]; - - char initfunc[1]; -}; - -/*-----------------------------------------------------------------------------------*/ -/** - * Load a program from disk and execute it. - * - * Code originally written by Ullrich von Bassewitz. - */ -/*-----------------------------------------------------------------------------------*/ -unsigned char -load(const char *name) -{ - unsigned char res; - - /* Now open the file */ - ctrl.callerdata = cfs_open(name, 0); - if(ctrl.callerdata < 0) { - /* Could not open the file, display an error and return */ - /* ### */ - return LOADER_ERR_OPEN; - } - - /* Load the module */ - res = mod_load(&ctrl); - - /* Close the input file */ - cfs_close(ctrl.callerdata); - - /* Check the return code */ - if(res != MLOAD_OK) { - /* Wrong module, out of memory or whatever. Print an error - * message and return. - */ - /* ### */ - return res; - } - - /* We've successfully loaded the module. */ - - return LOADER_OK; -} -/*-----------------------------------------------------------------------------------*/ -/** - * Load and start a program. - * - * \param name The name of the program file. - * \param arg A pointer that will be passed to the new process. - */ -/*-----------------------------------------------------------------------------------*/ -unsigned char -loader_arch_load(const char *name, char *arg) -{ - unsigned char r; - struct loader_arch_hdr *hdr; - - r = load(name); - if(r != MLOAD_OK) { - return r; - } - hdr = (struct loader_arch_hdr *)ctrl.module; - - /* Check the program header and see that version and architecture - matches. */ - - /* Call the init function. */ - ((void (*)(char *))hdr->initfunc)(arg); - - return LOADER_OK; -} -/*-----------------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/main.c b/backyard/platform/c64/main.c deleted file mode 100644 index 18f6f3764..000000000 --- a/backyard/platform/c64/main.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2002-2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki operating system - * - * $Id: main.c,v 1.1 2007/05/23 23:11:23 oliverschmidt Exp $ - * - */ - -#include "contiki.h" - -#include "ctk/ctk.h" -#include "ctk/ctk-draw.h" - -#include "program-handler.h" - - -#include "contiki-net.h" - -#include "configedit-dsc.h" -#include "directory-dsc.h" -#include "processes-dsc.h" - -#include "cfs-cbm.h" -#include "cfs-init.h" - - -#include - -PROCINIT(&tcpip_process, &resolv_process, /*&cfs_init_process,*/ - &ctk_process, &etimer_process, &program_handler_process); - -unsigned char -uip_fw_forward(void) -{ - return 0; -} -void -uip_fw_periodic(void) -{ - return; -} -/*---------------------------------------------------------------------------*/ -void -log_message(char *part1, char *part2) -{ - while(*part1 != 0) { - cbm_k_bsout(*part1++); - } - - while(*part2 != 0) { - cbm_k_bsout(*part2++); - } - - - cbm_k_bsout('\n'); -} -/*---------------------------------------------------------------------------*/ -clock_time_t -clock_time(void) -{ - return clock(); -} -/*---------------------------------------------------------------------------*/ -void -main(void) -{ - - log_message("Starting ", CONTIKI_VERSION_STRING); - - process_init(); - - log_message(": TCP/IP", ""); - - procinit_init(); - - /* tcpip_init(NULL); - - resolv_init(NULL); */ - - log_message(": CTK GUI", ""); - /* ctk_init();*/ - - log_message(": Initial filesystem", ""); - /* cfs_init_init(NULL);*/ - - /* program_handler_init();*/ - - /* - program_handler_add(&directory_dsc, "Directory", 1); - program_handler_add(&configedit_dsc, "Configuration", 1); - program_handler_add(&processes_dsc, "Processes", 1); */ - - - log_message("Starting process scheduling", ""); - - while(1) { - if(process_run() == 0) { - program_handler_load("welcome.prg", NULL); - break; - } - } - - - while(1) { - process_run(); - } -} -/*---------------------------------------------------------------------------*/ -void -reset(void) -{ - asm("lda #$36"); - asm("sta $01"); - asm("jmp $fce2"); -} -/*---------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/net/cs8900a.c b/backyard/platform/c64/net/cs8900a.c deleted file mode 100644 index dea1c6d36..000000000 --- a/backyard/platform/c64/net/cs8900a.c +++ /dev/null @@ -1,297 +0,0 @@ -/* - * Copyright (c) 2001, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the C64 RealAudio server demo project. - * - * $Id: cs8900a.c,v 1.1 2007/05/23 23:11:29 oliverschmidt Exp $ - * - */ - -/* cs8900a.c: device driver for the CS8900a chip in 8-bit mode. Mostly - written in 6502 assembler for speed. */ - -#include "cs8900a.h" -#include "contiki-net.h" - -extern u8_t *cs8900a_rxtxreg, - *cs8900a_txcmd, - *cs8900a_txlen, - *cs8900a_packetpp, - *cs8900a_ppdata; - -static u16_t len; -static u16_t cnt; - - -/*-----------------------------------------------------------------------------------*/ -#pragma optimize(push, off) -void -cs8900a_init(void) -{ - /* Turn on transmission and reception of frames. */ - /* PACKETPP = 0x0112; - PPDATA = 0x00c0; */ - asm("lda #$12"); - asm("sta %v", cs8900a_packetpp); - asm("lda #$01"); - asm("sta %v+1", cs8900a_packetpp); - asm("lda #$c0"); - asm("sta %v", cs8900a_ppdata); - asm("lda #$00"); - asm("sta %v+1", cs8900a_ppdata); - - /* Accept valid unicast+broadcast frames. */ - /* PACKETPP = 0x0104; - PPDATA = 0x0d05; */ - asm("lda #$04"); - asm("sta %v", cs8900a_packetpp); - asm("lda #$01"); - asm("sta %v+1", cs8900a_packetpp); - asm("lda #$05"); - asm("sta %v", cs8900a_ppdata); - asm("lda #$0d"); - asm("sta %v+1", cs8900a_ppdata); - - /* Set MAC address. */ - /* PACKETPP = 0x0158; - PPDATA = (ETHADDR1 << 8) | (ETHADDR0); */ - asm("lda #$58"); - asm("sta %v", cs8900a_packetpp); - asm("lda #$01"); - asm("sta %v+1", cs8900a_packetpp); - asm("lda %v", uip_ethaddr); - asm("sta %v", cs8900a_ppdata); - asm("lda %v+1", uip_ethaddr); - asm("sta %v+1", cs8900a_ppdata); - - /* PACKETPP = 0x015a; - PPDATA = (ETHADDR3 << 8) | (ETHADDR2); */ - asm("lda #$5a"); - asm("sta %v", cs8900a_packetpp); - asm("lda #$01"); - asm("sta %v+1", cs8900a_packetpp); - asm("lda %v+2", uip_ethaddr); - asm("sta %v", cs8900a_ppdata); - asm("lda %v+3", uip_ethaddr); - asm("sta %v+1", cs8900a_ppdata); - - /* PACKETPP = 0x015c; - PPDATA = (ETHADDR5 << 8) | (ETHADDR4); */ - asm("lda #$5c"); - asm("sta %v", cs8900a_packetpp); - asm("lda #$01"); - asm("sta %v+1", cs8900a_packetpp); - asm("lda %v+4", uip_ethaddr); - asm("sta %v", cs8900a_ppdata); - asm("lda %v+5", uip_ethaddr); - asm("sta %v+1", cs8900a_ppdata); -} -#pragma optimize(pop) -/*-----------------------------------------------------------------------------------*/ -#pragma optimize(push, off) -void -cs8900a_send(void) -{ - /* Transmit command. */ - asm("lda #$c0"); - asm("sta %v", cs8900a_txcmd); - asm("lda #$00"); - asm("sta %v+1", cs8900a_txcmd); - asm("lda %v", uip_len); - asm("sta %v", cs8900a_txlen); - asm("lda %v+1", uip_len); - asm("sta %v+1", cs8900a_txlen); - - asm("ldy #8"); -tryagain: - /* Check for avaliable buffer space. */ - asm("lda #$38"); - asm("sta %v", cs8900a_packetpp); - asm("lda #$01"); - asm("sta %v+1", cs8900a_packetpp); - asm("lda %v+1", cs8900a_ppdata); - asm("and #1"); - asm("bne %g", send); - - /* No space avaliable, skip a received frame and try again. */ - asm("lda #$02"); - asm("sta %v", cs8900a_packetpp); - asm("lda #$01"); - asm("sta %v+1", cs8900a_packetpp); - asm("lda %v", cs8900a_ppdata); - asm("ora #$40"); - asm("sta %v", cs8900a_ppdata); - - asm("dey"); - asm("bne %g", tryagain); - return; - - /* Send the frame. */ -send: - - /* First, send 14+40=54 bytes of header. */ - asm("ldy #0"); -sendloop1: - asm("lda %v,y", uip_buf); - asm("sta %v", cs8900a_rxtxreg); - asm("iny"); - asm("lda %v,y", uip_buf); - asm("sta %v+1", cs8900a_rxtxreg); - asm("iny"); - asm("cpy #%b", UIP_LLH_LEN + UIP_TCPIP_HLEN); - asm("bne %g", sendloop1); - - if(uip_len <= UIP_LLH_LEN + UIP_TCPIP_HLEN) { - return; - } - - /* Next, send rest of the packet. */ - cnt = uip_len - (UIP_LLH_LEN + UIP_TCPIP_HLEN); - - asm("lda %v", cnt); - asm("lsr"); - asm("bcc %g", noinc); - asm("inc %v", cnt); - asm("bne %g", noinc); - asm("inc %v+1", cnt); -noinc: - - asm("lda %v", uip_appdata); - asm("sta ptr1"); - asm("lda %v+1", uip_appdata); - asm("sta ptr1+1"); - - asm("ldy #0"); -sendloop2: - asm("lda (ptr1),y"); - asm("sta %v", cs8900a_rxtxreg); - asm("iny"); - asm("lda (ptr1),y"); - asm("sta %v+1", cs8900a_rxtxreg); - asm("iny"); - asm("bne %g", check); - asm("inc ptr1+1"); -check: - asm("cpy %v", cnt); - asm("bne %g", sendloop2); - asm("dec %v+1", cnt); - asm("bpl %g", sendloop2); -} -#pragma optimize(pop) -/*-----------------------------------------------------------------------------------*/ -#pragma optimize(push, off) -static void -skip_frame(void) -{ - /* PACKETPP = 0x0102; - PPDATA = PPDATA | 0x0040; */ - asm("lda #$02"); - asm("sta %v", cs8900a_packetpp); - asm("lda #$01"); - asm("sta %v+1", cs8900a_packetpp); - asm("lda %v", cs8900a_ppdata); - asm("ora #$40"); - asm("sta %v", cs8900a_ppdata); -} -#pragma optimize(pop) -/*-----------------------------------------------------------------------------------*/ -#pragma optimize(push, off) -u16_t -cs8900a_poll(void) -{ - /* Check receiver event register to see if there are any valid - unicast frames avaliable. */ - /* PACKETPP = 0x0124; - if(PPDATA & 0x000d == 0x0000) { - return 0; - } - */ - asm("lda #$24"); - asm("sta %v", cs8900a_packetpp); - asm("lda #$01"); - asm("sta %v+1", cs8900a_packetpp); - asm("lda %v+1", cs8900a_ppdata); - asm("and #$0d"); - asm("cmp #$00"); - asm("bne %g", noreturn); - /* No frame ready. */ - return 0; - -noreturn: - /* Process the incoming frame. */ - - /* Read receiver event and discard it. */ - /* RXTXREG; */ - asm("lda %v+1", cs8900a_rxtxreg); - asm("lda %v", cs8900a_rxtxreg); - - /* Read frame length. */ - /* cnt = len = RXTXREG; */ - asm("lda %v+1", cs8900a_rxtxreg); - asm("sta %v+1", len); - asm("sta %v+1", cnt); - asm("lda %v", cs8900a_rxtxreg); - asm("sta %v", len); - asm("sta %v", cnt); - - asm("lsr"); - asm("bcc %g", noinc); - asm("inc %v", cnt); - asm("bne %g", noinc); - asm("inc %v+1", cnt); -noinc: - - if(cnt > UIP_BUFSIZE) { - skip_frame(); - return 0; - } - - /* Read bytes into uip_buf. */ - asm("lda #<%v", uip_buf); - asm("sta ptr1"); - asm("lda #>%v", uip_buf); - asm("sta ptr1+1"); - - asm("ldy #0"); -readloop: - asm("lda %v", cs8900a_rxtxreg); - asm("sta (ptr1),y"); - asm("iny"); - asm("lda %v+1", cs8900a_rxtxreg); - asm("sta (ptr1),y"); - asm("iny"); - asm("bne %g", check); - asm("inc ptr1+1"); -check: - asm("cpy %v", cnt); - asm("bne %g", readloop); - asm("dec %v+1", cnt); - asm("bpl %g", readloop); - return len; -} -#pragma optimize(pop) diff --git a/backyard/platform/c64/net/cs8900a.h b/backyard/platform/c64/net/cs8900a.h deleted file mode 100644 index 6fda296ff..000000000 --- a/backyard/platform/c64/net/cs8900a.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - * $Id: cs8900a.h,v 1.1 2007/05/23 23:11:29 oliverschmidt Exp $ - */ -#ifndef __CS8900A_H__ -#define __CS8900A_H__ - -#include "uip_arch.h" - -void cs8900a_init(void); -void cs8900a_send(void); -u16_t cs8900a_poll(void); - -#endif /* __CS8900A_H__ */ diff --git a/backyard/platform/c64/net/eth64-drv.c b/backyard/platform/c64/net/eth64-drv.c deleted file mode 100644 index dea171167..000000000 --- a/backyard/platform/c64/net/eth64-drv.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2001-2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the uIP TCP/IP stack. - * - * $Id: eth64-drv.c,v 1.2 2010/10/19 18:29:04 adamdunkels Exp $ - * - */ - -#include "contiki-net.h" -#include "lan91c96.h" - -static u8_t output(void); - -static const struct uip_eth_addr addr = - {{0x00,0x00,0x00,0x64,0x64,0x64}}; - -SERVICE(eth64_drv_service, packet_service, { output };); - -PROCESS(eth64_drv_process, "ETH64 driver"); - -/*---------------------------------------------------------------------------*/ -static u8_t -output(void) -{ - uip_arp_out(); - lan91c96_send(); - - return 0; -} -/*---------------------------------------------------------------------------*/ -static void -pollhandler(void) -{ -#define BUF ((struct uip_eth_hdr *)&uip_buf[0]) - - /* Poll Ethernet device to see if there is a frame avaliable. */ - uip_len = lan91c96_poll(); - if(uip_len > 0) { - /* A frame was avaliable (and is now read into the uip_buf), so - we process it. */ - if(BUF->type == UIP_HTONS(UIP_ETHTYPE_IP)) { - uip_arp_ipin(); - uip_len -= sizeof(struct uip_eth_hdr); - tcpip_input(); - } else if(BUF->type == UIP_HTONS(UIP_ETHTYPE_ARP)) { - uip_arp_arpin(); - /* If the above function invocation resulted in data that - should be sent out on the network, the global variable - uip_len is set to a value > 0. */ - if(uip_len > 0) { - lan91c96_send(); - } - } - } - -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(eth64_drv_process, ev, data) -{ - PROCESS_POLLHANDLER(pollhandler()); - - PROCESS_BEGIN(); - - - uip_setethaddr(addr); - - lan91c96_init(); - - SERVICE_REGISTER(eth64_drv_service); - - process_poll(ð64_drv_process); - - while(1) { - PROCESS_YIELD(); - } - - PROCESS_END(); -} - - -/*---------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/net/eth64-dsc.c b/backyard/platform/c64/net/eth64-dsc.c deleted file mode 100644 index 3adc5f29f..000000000 --- a/backyard/platform/c64/net/eth64-dsc.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: eth64-dsc.c,v 1.2 2007/09/06 01:36:12 matsutsuka Exp $ - * - */ - -#include "sys/dsc.h" - -/*-----------------------------------------------------------------------------------*/ -#if CTK_CONF_ICON_BITMAPS -static unsigned char lan91c96icon_bitmap[3*3*8] = { - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 -}; -#endif /* CTK_CONF_ICON_BITMAPS */ - -#if CTK_CONF_ICON_TEXTMAPS -static char lan91c96icon_textmap[9] = { - 'I', 'D', 'E', - ' ', '6', '4', - 'E', 'T', 'H' -}; -#endif /* CTK_CONF_ICON_TEXTMAPS */ - -#if CTK_CONF_ICONS -static struct ctk_icon lan91c96_icon = - {CTK_ICON("ETH64 driver", lan91c96icon_bitmap, lan91c96icon_textmap)}; -#endif /* CTK_CONF_ICONS */ -/*-----------------------------------------------------------------------------------*/ -DSC(lan91c96_dsc, - "IDE64/ETH64 driver", - "lan91c96.drv", - lan91c96_init, - &lan91c96_icon); -/*-----------------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/net/eth64-dump-drv.c b/backyard/platform/c64/net/eth64-dump-drv.c deleted file mode 100644 index ad9cf82ee..000000000 --- a/backyard/platform/c64/net/eth64-dump-drv.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 2001-2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the uIP TCP/IP stack. - * - * $Id: eth64-dump-drv.c,v 1.2 2010/10/19 18:29:04 adamdunkels Exp $ - * - */ - -#include "contiki-net.h" -#include "ctk/ctk.h" - -#include "lan91c96.h" - -static u8_t output(void); - -static const struct uip_eth_addr addr = - {{0x00,0x00,0x00,0x64,0x64,0x64}}; - -SERVICE(eth64_drv_service, packet_service, { output };); - -PROCESS(eth64_drv_process, "Eth64 driver"); - -#define DUMP_WIDTH 38 -#define DUMP_HEIGHT 20 -static struct ctk_window window; -static char dump[DUMP_WIDTH * DUMP_HEIGHT]; -static struct ctk_label dumplabel = - {CTK_LABEL(0, 0, DUMP_WIDTH, DUMP_HEIGHT, dump)}; -static void -dump_packet(void) -{ - memcpy(dump, &dump[DUMP_WIDTH], DUMP_WIDTH * (DUMP_HEIGHT - 1)); - tcpdump_print(&dump[DUMP_WIDTH * (DUMP_HEIGHT - 1)], DUMP_WIDTH); - CTK_WIDGET_REDRAW(&dumplabel); -} - -/*---------------------------------------------------------------------------*/ -static u8_t -output(void) -{ - - uip_arp_out(); - lan91c96_send(); - - dump_packet(); - - return 0; -} -/*---------------------------------------------------------------------------*/ -static void -pollhandler(void) -{ -#define BUF ((struct uip_eth_hdr *)&uip_buf[0]) - - /* Poll Ethernet device to see if there is a frame avaliable. */ - uip_len = lan91c96_poll(); - if(uip_len > 0) { - - dump_packet(); - - /* A frame was avaliable (and is now read into the uip_buf), so - we process it. */ - if(BUF->type == UIP_HTONS(UIP_ETHTYPE_IP)) { - uip_arp_ipin(); - uip_len -= sizeof(struct uip_eth_hdr); - tcpip_input(); - } else if(BUF->type == UIP_HTONS(UIP_ETHTYPE_ARP)) { - uip_arp_arpin(); - /* If the above function invocation resulted in data that - should be sent out on the network, the global variable - uip_len is set to a value > 0. */ - if(uip_len > 0) { - lan91c96_send(); - } - } - } - -} -/*---------------------------------------------------------------------------*/ -#pragma optimize(push, off) -static void -init_eth64(void) -{ - asm("lda #1"); - asm("ora $de01"); - asm("sta $de01"); -} -#pragma optimize(pop) -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(eth64_drv_process, ev, data) -{ - PROCESS_POLLHANDLER(pollhandler()); - - PROCESS_BEGIN(); - - - uip_setethaddr(addr); - init_eth64(); - lan91c96_init(); - - ctk_window_new(&window, DUMP_WIDTH, DUMP_HEIGHT, "RR-Net dump"); - CTK_WIDGET_ADD(&window, &dumplabel); - ctk_window_open(&window); - - - SERVICE_REGISTER(eth64_drv_service); - - process_poll(ð64_drv_process); - - while(1) { - PROCESS_WAIT_EVENT_UNTIL(ev == PROCESS_EVENT_EXIT); - } - - ctk_window_close(&window); - - PROCESS_END(); -} - - -/*---------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/net/lan91c96.c b/backyard/platform/c64/net/lan91c96.c deleted file mode 100644 index 3ac60ccb2..000000000 --- a/backyard/platform/c64/net/lan91c96.c +++ /dev/null @@ -1,453 +0,0 @@ -/* - * uIP lan91c96 (smc9194) driver - * Based on cs8900a driver, copyrighted (c) 2001, by Adam Dunkels - * Copyright (c) 2003, Josef Soucek - * All rights reserved. - * - * Ethernet card for Commodore 64, based on lan91c96 chip - * is a device created by IDE64 Project team. - * More information: http://ide64.come.to - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $Id: lan91c96.c,v 1.1 2007/05/23 23:11:29 oliverschmidt Exp $ - * - */ - -#include "lan91c96.h" -#include "contiki-net.h" - -#include - -// #define DEBUG - -#define ETHBASE 0xde10 - -#define ETHBSR ETHBASE+0x0e /* Bank select register R/W (2B) */ - -/* Register bank 0 */ - -#define ETHTCR ETHBASE /* Transmition control register R/W (2B) */ -#define ETHEPHSR ETHBASE+2 /* EPH status register R/O (2B) */ -#define ETHRCR ETHBASE+4 /* Receive control register R/W (2B) */ -#define ETHECR ETHBASE+6 /* Counter register R/O (2B) */ -#define ETHMIR ETHBASE+8 /* Memory information register R/O (2B) */ -#define ETHMCR ETHBASE+0x0a /* Memory Config. reg. +0 R/W +1 R/O (2B) */ - -/* Register bank 1 */ - -#define ETHCR ETHBASE /* Configuration register R/W (2B) */ -#define ETHBAR ETHBASE+2 /* Base address register R/W (2B) */ -#define ETHIAR ETHBASE+4 /* Individual address register R/W (6B) */ -#define ETHGPR ETHBASE+0x0a /* General address register R/W (2B) */ -#define ETHCTR ETHBASE+0x0c /* Control register R/W (2B) */ - -/* Register bank 2 */ - -#define ETHMMUCR ETHBASE /* MMU command register W/O (1B) */ -#define ETHAUTOTX ETHBASE+1 /* AUTO TX start register R/W (1B) */ -#define ETHPNR ETHBASE+2 /* Packet number register R/W (1B) */ -#define ETHARR ETHBASE+3 /* Allocation result register R/O (1B) */ -#define ETHFIFO ETHBASE+4 /* FIFO ports register R/O (2B) */ -#define ETHPTR ETHBASE+6 /* Pointer register R/W (2B) */ -#define ETHDATA ETHBASE+8 /* Data register R/W (4B) */ -#define ETHIST ETHBASE+0x0c /* Interrupt status register R/O (1B) */ -#define ETHACK ETHBASE+0x0c /* Interrupt acknowledge register W/O (1B) */ -#define ETHMSK ETHBASE+0x0d /* Interrupt mask register R/W (1B) */ - -/* Register bank 3 */ - -#define ETHMT ETHBASE /* Multicast table R/W (8B) */ -#define ETHMGMT ETHBASE+8 /* Management interface R/W (2B) */ -#define ETHREV ETHBASE+0x0a /* Revision register R/W (2B) */ -#define ETHERCV ETHBASE+0x0c /* Early RCV register R/W (2B) */ - -#define BANK(num) asm("lda #%b", num); asm("sta %w", ETHBSR); - -#ifdef DEBUG -static void print_packet(u8_t *, u16_t); -#endif - -static u8_t packet_status; -static u16_t packet_length; - - -/*-----------------------------------------------------------------------------------*/ -#pragma optimize(push, off) -void lan91c96_init(void) -{ - /* Check if high byte is 0x33 */ - asm("lda %w", ETHBSR+1); - asm("cmp #$33"); - asm("beq %g", L1); - - asm("inc $d021"); /* Error */ - -L1: - /* Reset ETH card */ - BANK(0); - asm("lda #%%10000000"); /* Software reset */ - asm("sta %w", ETHRCR+1); - - asm("lda #0"); - asm("sta %w", ETHRCR); - asm("sta %w", ETHRCR+1); - - /* delay */ - asm("ldy #0"); -L2: - asm("cmp ($ff,x)"); /* 6 cycles */ - asm("cmp ($ff,x)"); /* 6 cycles */ - asm("dey"); /* 2 cycles */ - asm("bne %g", L2); /* 3 cycles */ - /* 17*256=4352 => 4,4 ms */ - - /* Enable transmit and receive */ - asm("lda #%%10000001"); /* Enable transmit TXENA, PAD_EN */ - asm("sta %w", ETHTCR); - asm("lda #%%00000011"); /* Enable receive, strip CRC ??? */ - asm("sta %w", ETHRCR+1); - - BANK(1); - asm("lda %w", ETHCR+1); - asm("ora #%%00010000"); /* No wait (IOCHRDY) */ - asm("sta %w", ETHCR+1); - - asm("lda #%%00001001"); /* Auto release */ - asm("sta %w", ETHCTR+1); - - /* Set MAC address */ - asm("lda %v", uip_ethaddr); - asm("sta %w", ETHIAR); - asm("lda %v+1", uip_ethaddr); - asm("sta %w", ETHIAR+1); - asm("lda %v+2", uip_ethaddr); - asm("sta %w", ETHIAR+2); - asm("lda %v+3", uip_ethaddr); - asm("sta %w", ETHIAR+3); - asm("lda %v+4", uip_ethaddr); - asm("sta %w", ETHIAR+4); - asm("lda %v+5", uip_ethaddr); - asm("sta %w", ETHIAR+5); - - BANK(2); - asm("lda #%%00001111"); /* RCV INT, ALLOC INT, TX INT, TX EMPTY */ - asm("sta %w", ETHMSK); -} -#pragma optimize(pop) -/*-----------------------------------------------------------------------------------*/ -#pragma optimize(push, off) -u16_t lan91c96_poll(void) -{ -#ifdef DEBUG - BANK(0); - printf("RAM: %d ", ((*(unsigned int *)(ETHMIR)) & 0xff00)); - BANK(2); -#endif - - asm("lda %w", ETHIST); - asm("and #%%00000001"); /* RCV INT */ - asm("bne %g", L1); - - /* No packet available */ - return 0; - -L1: - -#ifdef DEBUG - printf("RCV: IRQ\n"); -#endif - - asm("lda #0"); - asm("sta %w", ETHPTR); - asm("lda #%%11100000"); /* RCV,AUTO INCR.,READ */ - asm("sta %w", ETHPTR+1); - - asm("lda %w", ETHDATA); /* Status word */ - asm("lda %w", ETHDATA); - asm("sta %v", packet_status); /* High byte only */ - - asm("lda %w", ETHDATA); /* Total number of bytes */ - asm("sta %v", packet_length); - asm("lda %w", ETHDATA); - asm("sta %v+1", packet_length); - - /* Last word contain 'last data byte' and 0x60 */ - /* or 'fill byte' and 0x40 */ - - packet_length -= 6; /* The packet contains 3 extra words */ - - asm("lda %v", packet_status); - asm("and #$10"); - asm("beq %g", L2); - - packet_length++; - -#ifdef DEBUG - printf("RCV: odd number of bytes\n"); -#endif - -L2: - -#ifdef DEBUG - printf("RCV: L:%d ST-HIGH:0x%02x ", packet_length, packet_status); -#endif - - if(packet_length > UIP_BUFSIZE) { - - /* Remove and release RX packet from FIFO */ - asm("lda #%%10000000"); - asm("sta %w", ETHMMUCR); - -#ifdef DEBUG - printf("RCV: UIP_BUFSIZE exceeded - packet dropped!\n"); -#endif - - return 0; - } - - asm("lda #<%v", uip_buf); - asm("sta ptr1"); - asm("lda #>%v", uip_buf); - asm("sta ptr1+1"); - - asm("lda %v+1", packet_length); - asm("sta tmp1"); - - asm("ldy #0"); -L3: - asm("lda %w", ETHDATA); - asm("sta (ptr1),y"); - asm("iny"); - asm("bne %g", L4); - asm("inc ptr1+1"); -L4: - asm("cpy %v", packet_length); - asm("bne %g", L3); - asm("dec tmp1"); - asm("bpl %g", L3); - - /* Remove and release RX packet from FIFO */ - asm("lda #%%10000000"); - asm("sta %w", ETHMMUCR); - -#ifdef DEBUG - print_packet(uip_buf, packet_length); -#endif - - return packet_length; -} -#pragma optimize(pop) -/*-----------------------------------------------------------------------------------*/ -#pragma optimize(push, off) -void lan91c96_send(void) -{ - /* First 14+40 (IP and TCP header) is send from uip_buf */ - /* than data from uip_appdata */ - -#ifdef DEBUG - printf("SND: send packet\n"); -#endif - - asm("lda %v+1", uip_len); - asm("ora #%%00100000"); /* Allocate memory for TX */ - asm("sta %w", ETHMMUCR); - - asm("ldy #8"); /* Wait... */ -L1: /* Wait for allocation ready */ - asm("lda %w", ETHIST); - asm("and #%%00001000"); /* ALLOC INT */ - asm("bne %g", L2); - asm("dey"); - asm("bne %g", L1); - -#ifdef DEBUG - printf("SND: ERR: memory alloc timeout\n"); -#endif - - return; - -L2: - -#ifdef DEBUG - printf("SND: packet memory allocated\n"); -#endif - - asm("lda #%%00001000"); /* Acknowledge int, is it necessary ??? */ - asm("sta %w", ETHACK); - - asm("lda %w", ETHARR); - asm("sta %w", ETHPNR); /* Set packet address */ - - asm("lda #0"); - asm("sta %w", ETHPTR); - asm("lda #%%01000000"); /* AUTO INCR. */ - asm("sta %w", ETHPTR+1); - -#ifdef DEBUG - printf("SND: L:%d ", uip_len); -#endif - - asm("lda #0"); /* Status written by CSMA */ - asm("sta %w", ETHDATA); - asm("sta %w", ETHDATA); - - asm("lda %v", uip_len); - asm("and #$01"); - asm("beq %g", L3); - - packet_length = uip_len + 5; - asm("jmp %g", L4); - -L3: - packet_length = uip_len + 6; /* +6 for status word, length and ctl byte */ - -L4: - -#ifdef DEBUG - printf("SND: L:%d ", packet_length); -#endif - - asm("lda %v", packet_length); - asm("sta %w", ETHDATA); - asm("lda %v+1", packet_length); - asm("sta %w", ETHDATA); - -#ifdef DEBUG - print_packet(uip_buf, uip_len); -#endif - - /* Send 14+40=54 bytes of header */ - - if(uip_len <= UIP_LLH_LEN + UIP_TCPIP_HLEN) { - -#ifdef DEBUG - printf("SND: short packet sent.\n"); -#endif - - asm("ldy #0"); -L5: - asm("lda %v,y", uip_buf); - asm("sta %w", ETHDATA); - asm("iny"); - asm("cpy %v", uip_len); - asm("bne %g", L5); - - } else { - - asm("ldy #0"); -L6: - asm("lda %v,y", uip_buf); - asm("sta %w", ETHDATA); - asm("iny"); - asm("cpy #%b", UIP_LLH_LEN + UIP_TCPIP_HLEN); - asm("bne %g", L6); - - packet_length = uip_len - (UIP_LLH_LEN + UIP_TCPIP_HLEN); - - asm("lda %v", uip_appdata); /* uip_appdata is pointer */ - asm("sta ptr1"); - asm("lda %v+1", uip_appdata); - asm("sta ptr1+1"); - - asm("ldy #0"); -L7: - asm("lda (ptr1),y"); - asm("sta %w", ETHDATA); - asm("iny"); - asm("bne %g", L8); - asm("inc ptr1+1"); -L8: - asm("cpy %v", packet_length); - asm("bne %g", L7); - asm("dec %v+1", packet_length); - asm("bpl %g", L7); - } - - asm("lda %v", packet_length); - asm("and #$01"); - asm("beq %g", L9); - - asm("lda #%%00100000"); - asm("sta %w", ETHDATA); /* Control byte */ - - asm("lda #%%11000000"); /* ENQUEUE PACKET - transmit packet */ - asm("sta %w", ETHMMUCR); - -#ifdef DEBUG - printf("\n## %02x", *(unsigned char *)(ETHIST)); -#endif - - return; - -L9: - asm("lda #0"); - asm("sta %w", ETHDATA); /* Fill byte */ - asm("sta %w", ETHDATA); /* Control byte */ - - asm("lda #%%11000000"); /* ENQUEUE PACKET - transmit packet */ - asm("sta %w", ETHMMUCR); - -#ifdef DEBUG - printf("\n## %02x\n", *(unsigned char *)(ETHIST)); -#endif - -} -#pragma optimize(pop) -/*-----------------------------------------------------------------------------------*/ -#ifdef DEBUG -static void print_packet(u8_t *buf, u16_t length) -{ - int i; - int remainder; - int lines; - u8_t a; - int cur; - int address=0; - - printf("\nPacket of length %d \n", length); - - lines = length / 8; - remainder = length % 8; - - for(i = 0; i < lines; i++) { - printf(":%04x ", address=i*8); - - for(cur = 0; cur < 8; cur++) { - a = *(buf++); - printf("%02x ", a); - } - printf("\n"); - } - - printf(":%04x ", address+8); - - for (i = 0; i < remainder; i++) { - a = *(buf++); - printf("%02x ", a); - } - printf("\n"); -} -#endif /* DEBUG */ diff --git a/backyard/platform/c64/net/lan91c96.h b/backyard/platform/c64/net/lan91c96.h deleted file mode 100644 index 5651aa53b..000000000 --- a/backyard/platform/c64/net/lan91c96.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * Author: Adam Dunkels - * - * $Id: lan91c96.h,v 1.1 2007/05/23 23:11:30 oliverschmidt Exp $ - */ - -#ifndef __LAN91C96_H__ -#define __LAN91C96_H__ - -#include "uip_arch.h" - -void lan91c96_init(void); -void lan91c96_send(void); -u16_t lan91c96_poll(void); - -#endif /* __LAN91C96_H__ */ diff --git a/backyard/platform/c64/net/rrnet-drv-asm.S b/backyard/platform/c64/net/rrnet-drv-asm.S deleted file mode 100644 index 595c00ccf..000000000 --- a/backyard/platform/c64/net/rrnet-drv-asm.S +++ /dev/null @@ -1,17 +0,0 @@ - -;--------------------------------------------------------------------- - .export _cs8900a_rxtxreg - .export _cs8900a_txcmd - .export _cs8900a_txlen - .export _cs8900a_packetpp - .export _cs8900a_ppdata - - -;--------------------------------------------------------------------- - - _cs8900a_rxtxreg = $de08 - _cs8900a_txcmd = $de0c - _cs8900a_txlen = $de0e - _cs8900a_packetpp = $de02 - _cs8900a_ppdata = $de04 - diff --git a/backyard/platform/c64/net/rrnet-drv.c b/backyard/platform/c64/net/rrnet-drv.c deleted file mode 100644 index cc04d894e..000000000 --- a/backyard/platform/c64/net/rrnet-drv.c +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright (c) 2001-2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the uIP TCP/IP stack. - * - * $Id: rrnet-drv.c,v 1.2 2010/10/19 18:29:04 adamdunkels Exp $ - * - */ - -#include "contiki-net.h" -#include "cs8900a.h" - - -static u8_t output(void); - -static const struct uip_eth_addr addr = - {{0x00,0x00,0x00,0x64,0x64,0x64}}; - -SERVICE(rrnet_drv_service, packet_service, { output };); - -PROCESS(rrnet_drv_process, "RRNet driver"); - -/*---------------------------------------------------------------------------*/ -static u8_t -output(void) -{ - uip_arp_out(); - cs8900a_send(); - - return 0; -} -/*---------------------------------------------------------------------------*/ -static void -pollhandler(void) -{ -#define BUF ((struct uip_eth_hdr *)&uip_buf[0]) - - /* Poll Ethernet device to see if there is a frame avaliable. */ - uip_len = cs8900a_poll(); - if(uip_len > 0) { - /* A frame was avaliable (and is now read into the uip_buf), so - we process it. */ - if(BUF->type == UIP_HTONS(UIP_ETHTYPE_IP)) { - uip_arp_ipin(); - uip_len -= sizeof(struct uip_eth_hdr); - tcpip_input(); - } else if(BUF->type == UIP_HTONS(UIP_ETHTYPE_ARP)) { - uip_arp_arpin(); - /* If the above function invocation resulted in data that - should be sent out on the network, the global variable - uip_len is set to a value > 0. */ - if(uip_len > 0) { - cs8900a_send(); - } - } - } - -} -/*---------------------------------------------------------------------------*/ -#pragma optimize(push, off) -static void -init_rrnet(void) -{ - asm("lda #1"); - asm("ora $de01"); - asm("sta $de01"); -} -#pragma optimize(pop) -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(rrnet_drv_process, ev, data) -{ - PROCESS_POLLHANDLER(pollhandler()); - - PROCESS_BEGIN(); - - uip_setethaddr(addr); - init_rrnet(); - cs8900a_init(); - - SERVICE_REGISTER(rrnet_drv_service); - - process_poll(&rrnet_drv_process); - - while(1) { - PROCESS_YIELD(); - } - - PROCESS_END(); -} - - -/*---------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/net/rrnet-dsc.c b/backyard/platform/c64/net/rrnet-dsc.c deleted file mode 100644 index 84262ee79..000000000 --- a/backyard/platform/c64/net/rrnet-dsc.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: rrnet-dsc.c,v 1.2 2007/09/06 01:36:12 matsutsuka Exp $ - * - */ - -#include "sys/dsc.h" - -/*-----------------------------------------------------------------------------------*/ -#if CTK_CONF_ICON_BITMAPS -static unsigned char rrneticon_bitmap[3*3*8] = { - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 -}; -#endif /* CTK_CONF_ICON_BITMAPS */ - -#if CTK_CONF_ICON_TEXTMAPS -static char rrneticon_textmap[9] = { - 'R', 'R', '-', - 'N', 'e', 't', - 'D', 'R', 'V' -}; -#endif /* CTK_CONF_ICON_TEXTMAPS */ - -#if CTK_CONF_ICONS -static struct ctk_icon rrnet_icon = - {CTK_ICON("RR-Net driver", rrneticon_bitmap, rrneticon_textmap)}; -#endif /* CTK_CONF_ICONS */ -/*-----------------------------------------------------------------------------------*/ -DSC(rrnet_dsc, - "RR-Net driver", - "rrnet.drv", - rrnet_init, - &rrnet_icon); -/*-----------------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/net/rrnet-dump-drv.c b/backyard/platform/c64/net/rrnet-dump-drv.c deleted file mode 100644 index b15694504..000000000 --- a/backyard/platform/c64/net/rrnet-dump-drv.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) 2001-2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the uIP TCP/IP stack. - * - * $Id: rrnet-dump-drv.c,v 1.2 2010/10/19 18:29:04 adamdunkels Exp $ - * - */ - -#include "contiki-net.h" -#include "cs8900a.h" - -#include "ctk/ctk.h" - -static u8_t output(void); - -static const struct uip_eth_addr addr = - {{0x00,0x00,0x00,0x64,0x64,0x64}}; - -SERVICE(rrnet_drv_service, packet_service, { output };); - -PROCESS(rrnet_drv_process, "RRNet driver"); - -#define DUMP_WIDTH 38 -#define DUMP_HEIGHT 20 -static struct ctk_window window; -static char dump[DUMP_WIDTH * DUMP_HEIGHT]; -static struct ctk_label dumplabel = - {CTK_LABEL(0, 0, DUMP_WIDTH, DUMP_HEIGHT, dump)}; -static void -dump_packet(void) -{ - memcpy(dump, &dump[DUMP_WIDTH], DUMP_WIDTH * (DUMP_HEIGHT - 1)); - tcpdump_print(&dump[DUMP_WIDTH * (DUMP_HEIGHT - 1)], DUMP_WIDTH); - CTK_WIDGET_REDRAW(&dumplabel); -} - -/*---------------------------------------------------------------------------*/ -static u8_t -output(void) -{ - - uip_arp_out(); - cs8900a_send(); - - dump_packet(); - - return 0; -} -/*---------------------------------------------------------------------------*/ -static void -pollhandler(void) -{ -#define BUF ((struct uip_eth_hdr *)&uip_buf[0]) - - /* Poll Ethernet device to see if there is a frame avaliable. */ - uip_len = cs8900a_poll(); - if(uip_len > 0) { - - dump_packet(); - - /* A frame was avaliable (and is now read into the uip_buf), so - we process it. */ - if(BUF->type == UIP_HTONS(UIP_ETHTYPE_IP)) { - uip_arp_ipin(); - uip_len -= sizeof(struct uip_eth_hdr); - tcpip_input(); - } else if(BUF->type == UIP_HTONS(UIP_ETHTYPE_ARP)) { - uip_arp_arpin(); - /* If the above function invocation resulted in data that - should be sent out on the network, the global variable - uip_len is set to a value > 0. */ - if(uip_len > 0) { - cs8900a_send(); - } - } - } - -} -/*---------------------------------------------------------------------------*/ -#pragma optimize(push, off) -static void -init_rrnet(void) -{ - asm("lda #1"); - asm("ora $de01"); - asm("sta $de01"); -} -#pragma optimize(pop) -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(rrnet_drv_process, ev, data) -{ - PROCESS_POLLHANDLER(pollhandler()); - - PROCESS_BEGIN(); - - - uip_setethaddr(addr); - init_rrnet(); - cs8900a_init(); - - ctk_window_new(&window, DUMP_WIDTH, DUMP_HEIGHT, "RR-Net dump"); - CTK_WIDGET_ADD(&window, &dumplabel); - ctk_window_open(&window); - - - SERVICE_REGISTER(rrnet_drv_service); - - process_poll(&rrnet_drv_process); - - while(1) { - PROCESS_WAIT_EVENT_UNTIL(ev == PROCESS_EVENT_EXIT); - } - - ctk_window_close(&window); - - PROCESS_END(); -} - - -/*---------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/net/rs232dev-ss.c b/backyard/platform/c64/net/rs232dev-ss.c deleted file mode 100644 index 122b53a79..000000000 --- a/backyard/platform/c64/net/rs232dev-ss.c +++ /dev/null @@ -1,236 +0,0 @@ -/* - * Copyright (c) 2001, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the uIP TCP/IP stack. - * - * $Id: rs232dev-ss.c,v 1.1 2007/05/23 23:11:30 oliverschmidt Exp $ - * - */ - -/* - * This is a generic implementation of the SLIP protocol over an RS232 - * (serial) device. While initially intented for the C64, the code can - * easily be ported to other platforms as well. - * - * Huge thanks to Ullrich von Bassewitz of cc65 fame for - * and endless supply of bugfixes, insightsful comments and - * suggestions, and improvements to this code! - */ - -#include "rs232silversurfer.h" -#include -#include - - /* This will include the system specific header files as well */ -#if defined(__CBM__) -# include -#elif defined(__ATARI__) -# include -#endif - -#include "uip.h" - -#define SLIP_END 0300 -#define SLIP_ESC 0333 -#define SLIP_ESC_END 0334 -#define SLIP_ESC_ESC 0335 - - -#define SIO_RECV(c) while(rs232_get(&c) == RS_ERR_NO_DATA) -#define SIO_POLL(c) (rs232_get(&c) != RS_ERR_NO_DATA) -#define SIO_SEND(c) while(rs232_put(c) == RS_ERR_OVERFLOW) - -#define MAX_SIZE (UIP_BUFSIZE - UIP_LLH_LEN) - -static u8_t slip_buf[MAX_SIZE + 2]; - -static u16_t len, tmplen; - -#if 1 -#define printf(x) -#else -#include -#endif - - -/*-----------------------------------------------------------------------------------*/ -static void -rs232_err(char err) -{ - switch(err) { - case RS_ERR_OK: - printf("RS232 OK\n"); - break; - case RS_ERR_NOT_INITIALIZED: - printf("RS232 not initialized\n"); - break; - case RS_ERR_BAUD_TOO_FAST: - printf("RS232 baud too fast\n"); - break; - case RS_ERR_BAUD_NOT_AVAIL: - printf("RS232 baud rate not available\n"); - break; - case RS_ERR_NO_DATA: - printf("RS232 nothing to read\n"); - break; - case RS_ERR_OVERFLOW: - printf("RS232 overflow\n"); - break; - } - -} -/*-----------------------------------------------------------------------------------*/ -/* - * rs232dev_send(): - * - * Sends the packet in the uip_buf and uip_appdata buffers. The first - * 40 bytes of the packet (the IP and TCP headers) are read from the - * uip_buf buffer, and the following bytes (the application data) are - * read from the uip_appdata buffer. - * - */ -/*-----------------------------------------------------------------------------------*/ -void -rs232dev_send(void) -{ - u16_t i; - u8_t *ptr; - u8_t c; - - SIO_SEND(SLIP_END); - - ptr = &uip_buf[UIP_LLH_LEN]; - for(i = 0; i < uip_len; ++i) { - if(i == UIP_TCPIP_HLEN) { - ptr = uip_appdata; - } - c = *ptr++; - switch(c) { - case SLIP_END: - SIO_SEND(SLIP_ESC); - SIO_SEND(SLIP_ESC_END); - break; - case SLIP_ESC: - SIO_SEND(SLIP_ESC); - SIO_SEND(SLIP_ESC_ESC); - break; - default: - SIO_SEND(c); - break; - } - } - SIO_SEND(SLIP_END); -} -/*-----------------------------------------------------------------------------------*/ -/* - * rs232dev_poll(): - * - * Read all avaliable bytes from the RS232 interface into the slip_buf - * buffer. If no more bytes are avaliable, it returns with 0 to - * indicate that no packet was immediately ready. When a full packet - * has been read into the buffer, the packet is copied into the - * uip_buf buffer and the length of the packet is returned. - * - */ -/*-----------------------------------------------------------------------------------*/ -u16_t -rs232dev_poll(void) -{ - u8_t c; - static u8_t lastc; - - while(SIO_POLL(c)) { - /* printf("c %x\n", c);*/ - switch(c) { - case SLIP_ESC: - lastc = c; - break; - - case SLIP_END: - lastc = c; - /* End marker found, we copy our input buffer to the uip_buf - buffer and return the size of the packet we copied. */ - memcpy(&uip_buf[UIP_LLH_LEN], slip_buf, len); - tmplen = len; - len = 0; - return tmplen; - - default: - if(lastc == SLIP_ESC) { - lastc = c; - /* Previous read byte was an escape byte, so this byte will be - interpreted differently from others. */ - switch(c) { - case SLIP_ESC_END: - c = SLIP_END; - break; - case SLIP_ESC_ESC: - c = SLIP_ESC; - break; - } - } else { - lastc = c; - } - - - slip_buf[len] = c; - ++len; - - if(len > MAX_SIZE) { - len = 0; - } - - break; - } - } - return 0; -} -/*-----------------------------------------------------------------------------------*/ -/* - * rs232dev_init(): - * - * Initializes the RS232 device and sets the parameters of the device. - * - */ -/*-----------------------------------------------------------------------------------*/ -void -rs232dev_init(void) -{ - char err; - - err = rs232_init(0); - rs232_err(err); - err = rs232_params(RS_BAUD_9600 | RS_BITS_8 | RS_STOP_1, RS_PAR_NONE); - rs232_err(err); - - len = 0; - - return; -} -/*-----------------------------------------------------------------------------------*/ - diff --git a/backyard/platform/c64/net/rs232silversurfer.S b/backyard/platform/c64/net/rs232silversurfer.S deleted file mode 100644 index 89bbf9db9..000000000 --- a/backyard/platform/c64/net/rs232silversurfer.S +++ /dev/null @@ -1,329 +0,0 @@ - ;; The following code is written and is copyrighted by - ;; Groepaz/Hitmen - - ;; Small changes by Adam Dunkels (renamed ss232 -> rs232) - -;---------------------------------------------------------------------------------------------- -; silver surfer polling mode driver for cc65 -; - work from here to create a full featured driver with interupts. -; gpz fixed 20020828: fatal bug fixed in _rs232_params -;---------------------------------------------------------------------------------------------- - -rs16550base = $de08 - -fifo_rxd = rs16550base+$00 ;8 (r) -fifo_txd = rs16550base+$00 ;8 (w) - -fifo_dll = rs16550base+$00 ;8 (r/w) -fifo_dlm = rs16550base+$01 ;9 (r/w) - -fifo_ier = rs16550base+$01 ;9 - -fifo_fcr = rs16550base+$02 ;a (w) -fifo_iir = rs16550base+$02 ;a (r) -fifo_lcr = rs16550base+$03 ;b -fifo_mcr = rs16550base+$04 ;c -fifo_lsr = rs16550base+$05 ;d -fifo_msr = rs16550base+$06 ;e (r) -fifo_scratch = rs16550base+$07 ;f (r/w) - - - - .export _rs232_init - .export _rs232_done - .export _rs232_params - .export _rs232_put - .export _rs232_get - - .importzp ptr1, ptr2 - .import popa, popax - -;---------------------------------------------------------------------------------------------- -; Error codes. Beware: The codes must match the codes in the C header file - -ErrNotInitialized = $01 -ErrBaudTooFast = $02 -ErrBaudNotAvail = $03 -ErrNoData = $04 -ErrOverflow = $05 - -;---------------------------------------------------------------------------------------------- -;unsigned char __fastcall__ rs232_init (char hacked); -;/* Initialize the serial port, install the interrupt handler. The parameter -; * has no effect for now and should be set to 0. -; */ -;---------------------------------------------------------------------------------------------- - - .code - -_rs232_init: - ; enable ssurfer-port - lda $de01 - ora #$01 - sta $de01 - - ; disable nmi's from ssurfer - lda #%00000000 - sta fifo_ier - - ; activate dtr - lda #%00000001 - sta fifo_mcr - - lda #$00 ; ok - tax - rts - -;---------------------------------------------------------------------------------------------- -;unsigned char __fastcall__ rs232_done (void); -;/* Close the port, deinstall the interrupt hander. You MUST call this function -; * before terminating the program, otherwise the machine may crash later. If -; * in doubt, install an exit handler using atexit(). The function will do -; * nothing, if it was already called. -; */ -;---------------------------------------------------------------------------------------------- - -_rs232_done: - ; disable nmi's from ssurfer - lda #%00000000 - sta fifo_ier - - ; deactivate dtr - sta fifo_mcr - - ; disable ssurfer-port - lda $de01 - and #$fe - sta $de01 - - lda #$00 ; ok - tax - rts - -;---------------------------------------------------------------------------------------------- -;unsigned char __fastcall__ rs232_params (unsigned char params, unsigned char parity); -;/* Set the port parameters. Use a combination of the #defined values above. */ -;---------------------------------------------------------------------------------------------- - - .data - -_rs232_baudrates: - - .word (7372800 / ( 50 * 16)) - .word (7372800 / ( 110 * 16)) - .word (7372800 / ( 269 * 8)) - .word (7372800 / ( 300 * 16)) - .word (7372800 / ( 600 * 16)) - .word (7372800 / ( 1200 * 16)) - .word (7372800 / ( 2400 * 16)) - .word (7372800 / ( 4800 * 16)) - .word (7372800 / ( 9600 * 16)) - .word (7372800 / ( 19200 * 16)) - .word (7372800 / ( 38400 * 16)) - .word (7372800 / ( 57600 * 16)) - .word (7372800 / ( 115200 * 16)) - .word (7372800 / ( 230400 * 16)) - - .bss - -_rs232_tmp1: - .res 1 - - .code - -_rs232_params: - - sta _rs232_tmp1 ; save parity - - ; reset fifo - lda #%10000111 - sta fifo_fcr - - ; that delay thing really needed ?! - ; (original datasheet mentions a delay here) - ; ldy #$00 - ; dey - ; bny *-1 - - ; set dlab - lda #%10000011 ; we assmume 8n1 - sta fifo_lcr - - jsr popa - tay ; save param - - ; set baudrate - clc - lsr a - lsr a - lsr a - lsr a - asl a - tax - lda _rs232_baudrates,x - sta fifo_dll - lda _rs232_baudrates+1,x - sta fifo_dlm - - tya ; param - and #$0f - ora _rs232_tmp1 ; parity - - ; reset dlab - sta fifo_lcr - - lda #$00 ; ok - tax - rts - -;---------------------------------------------------------------------------------------------- -; check if byte available, returns AKKU=0 if none - -ss_getlsr: - lda fifo_lsr - and #$01 - rts - -;---------------------------------------------------------------------------------------------- -;unsigned char __fastcall__ rs232_get (char* b); -;/* Get a character from the serial port. If no characters are available, the -; * function will return RS_ERR_NO_DATA, so this is not a fatal error. -; */ -;---------------------------------------------------------------------------------------------- -; get byte (non blocking, returns byte in A or CARRY=1 - error) - -_rs232_get: - sta ptr1 - stx ptr1+1 - - jsr ss_getlsr ; check if byte available -; bne sk32 ; yes - bne sk33 ; yes - - ; activate rts - lda #%00000011 - sta fifo_mcr -sk32: - - ; deactivate rts -; lda #%00000001 -; sta fifo_mcr - - jsr ss_getlsr ; check if byte available - bne sk33 ; yes - - ; deactivate rts - lda #%00000001 - sta fifo_mcr - - lda #ErrNoData ; no data - ldx #0 - rts -sk33: - ; deactivate rts - lda #%00000001 - sta fifo_mcr - - ; get byte - ldy #$00 - lda fifo_rxd - sta (ptr1),y - - lda #0 ; ok - tax - rts - -;---------------------------------------------------------------------------------------------- -;unsigned char __fastcall__ rs232_put (char b); -;/* Send a character via the serial port. There is a transmit buffer, but -; * transmitting is not done via interrupt. The function returns -; * RS_ERR_OVERFLOW if there is no space left in the transmit buffer. -; */ -;---------------------------------------------------------------------------------------------- - -_rs232_put: - tax - ; transmit buf ready? - lda fifo_lsr - and #%00100000 - bne @sk1 -@sk2: - lda #ErrOverflow ; overflow - ldx #$00 - rts -@sk1: - ; reciever ready? - lda fifo_msr - and #%00010000 - beq @sk2 - - stx fifo_txd - - lda #$00 ; ok - tax - rts - -;---------------------------------------------------------------------------------------------- -;unsigned char __fastcall__ rs232_pause (void); -;/* Assert flow control and disable interrupts. */ -;---------------------------------------------------------------------------------------------- - -_rs232_pause: - ; activate rts - lda #%00000011 - sta fifo_mcr - - lda #$00 ; ok - tax - rts - -;---------------------------------------------------------------------------------------------- -;unsigned char __fastcall__ rs232_unpause (void); -;/* Re-enable interrupts and release flow control */ -;---------------------------------------------------------------------------------------------- - -_rs232_unpause: - ; deactivate rts - lda #%00000001 - sta fifo_mcr - - lda #$00 ; ok - tax - rts - -;---------------------------------------------------------------------------------------------- -;unsigned char __fastcall__ rs232_status (unsigned char* status, -; unsigned char* errors); -;/* Return the serial port status. */ -;---------------------------------------------------------------------------------------------- - -_rs232_status: - sta ptr2 - stx ptr2+1 - jsr popax - sta ptr1 - stx ptr1+1 - - ldy #$00 - - ; Get status - lda fifo_iir - and #%00000001 - sta _rs232_tmp1 - lda fifo_msr - lsr a - and #%01010000 - ora _rs232_tmp1 - sta _rs232_tmp1 - lda fifo_lsr - and #%00101110 - ora _rs232_tmp1 - sta (ptr1),y - - ; Get errors - lda #$00 ; ok - sta (ptr2),y - - lda #$00 ; ok - tax - rts diff --git a/backyard/platform/c64/net/rs232silversurfer.h b/backyard/platform/c64/net/rs232silversurfer.h deleted file mode 100644 index 9e9a49ffe..000000000 --- a/backyard/platform/c64/net/rs232silversurfer.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2003, Groepaz/Hitmen. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * rs232silversurfer.h - * - * Groepaz/Hitmen, 16.12.2001 - * - * This defines for the SilverSurver (16c550 UART) what Ullrichs rs232 module - * defines for the Swithlink/Turbo232 - * - * this driver operates in polling mode only atm ! - * - */ - -#ifndef _RS232silversurfer_H -#define _RS232silversurfer_H - -/*****************************************************************************/ -/* Data */ -/*****************************************************************************/ - -/* Baudrate settings */ -#define RS_BAUD_50 0x00 -#define RS_BAUD_110 0x10 -#define RS_BAUD_134_5 0x20 -#define RS_BAUD_300 0x30 -#define RS_BAUD_600 0x40 -#define RS_BAUD_1200 0x50 -#define RS_BAUD_2400 0x60 -#define RS_BAUD_4800 0x70 -#define RS_BAUD_9600 0x80 -#define RS_BAUD_19200 0x90 -#define RS_BAUD_38400 0xa0 -#define RS_BAUD_57600 0xb0 -#define RS_BAUD_115200 0xc0 -#define RS_BAUD_230400 0xd0 - -/* Stop bit settings */ -#define RS_STOP_1 0x00 -#define RS_STOP_2 0x04 - -/* Data bit settings */ -#define RS_BITS_5 0x00 -#define RS_BITS_6 0x01 -#define RS_BITS_7 0x02 -#define RS_BITS_8 0x03 - -/* Parity settings */ -#define RS_PAR_NONE 0x00 -#define RS_PAR_ODD 0x28 -#define RS_PAR_EVEN 0x38 -#define RS_PAR_MARK 0x48 -#define RS_PAR_SPACE 0x48 - -/* Bit masks to mask out things from the status returned by rs232_status */ -#define RS_STATUS_IRQ 0x01 /* (iir) IRQ condition */ -#define RS_STATUS_OVERRUN 0x02 /* (lsr) Overrun error */ -#define RS_STATUS_PE 0x04 /* (lsr) Parity error */ -#define RS_STATUS_FE 0x08 /* (lsr) Framing error */ -#define RS_STATUS_DSR 0x10 /* (msr>>1) NOT data set ready */ -#define RS_STATUS_THRE 0x20 /* (lsr) Transmit holding reg. empty */ -#define RS_STATUS_DCD 0x40 /* (msr>>1) NOT data carrier detect */ -#define RS_STATUS_RDRF 0x80 /* Receiver data register full */ - -/* Error codes returned by all functions */ -#define RS_ERR_OK 0x00 /* Not an error - relax */ -#define RS_ERR_NOT_INITIALIZED 0x01 /* Module not initialized */ -#define RS_ERR_BAUD_TOO_FAST 0x02 /* Cannot handle baud rate */ -#define RS_ERR_BAUD_NOT_AVAIL 0x03 /* Baud rate not available */ -#define RS_ERR_NO_DATA 0x04 /* Nothing to read */ -#define RS_ERR_OVERFLOW 0x05 /* No room in send buffer */ - -/*****************************************************************************/ -/* Code */ -/*****************************************************************************/ - -unsigned char __fastcall__ rs232_init (char hacked); -/* Initialize the serial port, install the interrupt handler. The parameter - * has no effect for now and should be set to 0. - */ - -unsigned char __fastcall__ rs232_params (unsigned char params, unsigned char parity); -/* Set the port parameters. Use a combination of the #defined values above. */ - -unsigned char __fastcall__ rs232_done (void); -/* Close the port, deinstall the interrupt hander. You MUST call this function - * before terminating the program, otherwise the machine may crash later. If - * in doubt, install an exit handler using atexit(). The function will do - * nothing, if it was already called. - */ - -unsigned char __fastcall__ rs232_get (char* b); -/* Get a character from the serial port. If no characters are available, the - * function will return RS_ERR_NO_DATA, so this is not a fatal error. - */ - -unsigned char __fastcall__ rs232_put (char b); -/* Send a character via the serial port. There is a transmit buffer, but - * transmitting is not done via interrupt. The function returns - * RS_ERR_OVERFLOW if there is no space left in the transmit buffer. - */ - -unsigned char __fastcall__ rs232_pause (void); -/* Assert flow control and disable interrupts. */ - -unsigned char __fastcall__ rs232_unpause (void); -/* Re-enable interrupts and release flow control */ - -unsigned char __fastcall__ rs232_status (unsigned char* status, - unsigned char* errors); -/* Return the serial port status. */ - -/* End of rs232silversurfer.h */ -#endif - - - diff --git a/backyard/platform/c64/net/tfe-drv-asm.S b/backyard/platform/c64/net/tfe-drv-asm.S deleted file mode 100644 index d31c32010..000000000 --- a/backyard/platform/c64/net/tfe-drv-asm.S +++ /dev/null @@ -1,17 +0,0 @@ - -;--------------------------------------------------------------------- - .export _cs8900a_rxtxreg - .export _cs8900a_txcmd - .export _cs8900a_txlen - .export _cs8900a_packetpp - .export _cs8900a_ppdata - - -;--------------------------------------------------------------------- - - _cs8900a_rxtxreg = $de00 - _cs8900a_txcmd = $de04 - _cs8900a_txlen = $de06 - _cs8900a_packetpp = $de0a - _cs8900a_ppdata = $de0c - diff --git a/backyard/platform/c64/net/tfe-drv.c b/backyard/platform/c64/net/tfe-drv.c deleted file mode 100644 index bc7a9832d..000000000 --- a/backyard/platform/c64/net/tfe-drv.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - * Copyright (c) 2001-2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the uIP TCP/IP stack. - * - * $Id: tfe-drv.c,v 1.2 2010/10/19 18:29:04 adamdunkels Exp $ - * - */ - -#include "contiki-net.h" -#include "cs8900a.h" - -static u8_t output(void); - -static const struct uip_eth_addr addr = - {{0x00,0x00,0x00,0x64,0x64,0x64}}; - -SERVICE(tfe_drv_service, packet_service, { output };); - -PROCESS(tfe_drv_process, "TFE driver"); - -/*---------------------------------------------------------------------------*/ -static u8_t -output(void) -{ - uip_arp_out(); - cs8900a_send(); - - return 0; -} -/*---------------------------------------------------------------------------*/ -static void -pollhandler(void) -{ -#define BUF ((struct uip_eth_hdr *)&uip_buf[0]) - - /* Poll Ethernet device to see if there is a frame avaliable. */ - uip_len = cs8900a_poll(); - if(uip_len > 0) { - /* A frame was avaliable (and is now read into the uip_buf), so - we process it. */ - if(BUF->type == UIP_HTONS(UIP_ETHTYPE_IP)) { - uip_arp_ipin(); - uip_len -= sizeof(struct uip_eth_hdr); - tcpip_input(); - } else if(BUF->type == UIP_HTONS(UIP_ETHTYPE_ARP)) { - uip_arp_arpin(); - /* If the above function invocation resulted in data that - should be sent out on the network, the global variable - uip_len is set to a value > 0. */ - if(uip_len > 0) { - cs8900a_send(); - } - } - } - -} -/*---------------------------------------------------------------------------*/ -PROCESS_THREAD(tfe_drv_process, ev, data) -{ - PROCESS_POLLHANDLER(pollhandler()); - - PROCESS_BEGIN(); - - - uip_setethaddr(addr); - - cs8900a_init(); - - SERVICE_REGISTER(tfe_drv_service); - - process_poll(&tfe_drv_process); - - while(1) { - PROCESS_YIELD(); - } - - PROCESS_END(); -} - - -/*---------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/net/tfe-dsc.c b/backyard/platform/c64/net/tfe-dsc.c deleted file mode 100644 index c4e9b36b6..000000000 --- a/backyard/platform/c64/net/tfe-dsc.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: tfe-dsc.c,v 1.2 2007/09/06 01:36:12 matsutsuka Exp $ - * - */ - -#include "sys/dsc.h" - -/*-----------------------------------------------------------------------------------*/ -#if CTK_CONF_ICON_BITMAPS -static unsigned char tfeicon_bitmap[3*3*8] = { - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 -}; -#endif /* CTK_CONF_ICON_BITMAPS */ - -#if CTK_CONF_ICON_TEXTMAPS -static char tfeicon_textmap[9] = { - 'T', 'C', 'P', - '/', 'I', 'P', - 'T', 'F', 'E' -}; -#endif /* CTK_CONF_ICON_TEXTMAPS */ - -#if CTK_CONF_ICONS -static struct ctk_icon tfe_icon = - {CTK_ICON("TFE driver", tfeicon_bitmap, tfeicon_textmap)}; -#endif /* CTK_CONF_ICONS */ -/*-----------------------------------------------------------------------------------*/ -DSC(tfe_dsc, - "The Final Ethernet driver", - "tfe.drv", - tfe_init, - &tfe_icon); -/*-----------------------------------------------------------------------------------*/ diff --git a/backyard/platform/c64/net/tfe-dump-drv.c b/backyard/platform/c64/net/tfe-dump-drv.c deleted file mode 100644 index 9710a8b6c..000000000 --- a/backyard/platform/c64/net/tfe-dump-drv.c +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright (c) 2001-2004, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the uIP TCP/IP stack. - * - * $Id: tfe-dump-drv.c,v 1.2 2010/10/19 18:29:04 adamdunkels Exp $ - * - */ - -#include "contiki-net.h" -#include "cs8900a.h" - -static void output(u8_t *hdr, u16_t hdrlen, u8_t *data, u16_t datalen); - -/* 00:0E:3A is the OUI of Cirrus Logic, 64:64:64 just means C64 */ -static const struct uip_eth_addr addr = - {{0x00,0x0e,0x3a,0x64,0x64,0x64}}; - -static const struct packet_service_state state = - { - PACKET_SERVICE_VERSION, - output - }; - -EK_EVENTHANDLER(eventhandler, ev, data); -EK_POLLHANDLER(pollhandler); -EK_PROCESS(proc, PACKET_SERVICE_NAME ": TFE", EK_PRIO_NORMAL, - eventhandler, pollhandler, (void *)&state); - -#include "tcpdump.h" -#include -#include "ctk/ctk.h" - -#define DUMP_WIDTH 38 -#define DUMP_HEIGHT 20 -static struct ctk_window window; -static char dump[DUMP_WIDTH * DUMP_HEIGHT]; -static struct ctk_label dumplabel = - {CTK_LABEL(0, 0, DUMP_WIDTH, DUMP_HEIGHT, dump)}; -static void -dump_packet(void) -{ - memcpy(dump, &dump[DUMP_WIDTH], DUMP_WIDTH * (DUMP_HEIGHT - 1)); - tcpdump_print(&dump[DUMP_WIDTH * (DUMP_HEIGHT - 1)], DUMP_WIDTH); - CTK_WIDGET_REDRAW(&dumplabel); -} -/*---------------------------------------------------------------------------*/ -LOADER_INIT_FUNC(tfe_dump_drv_init, arg) -{ - arg_free(arg); - ek_service_start(PACKET_SERVICE_NAME, &proc); -} -/*---------------------------------------------------------------------------*/ -static void -output(u8_t *hdr, u16_t hdrlen, u8_t *data, u16_t datalen) -{ - uip_arp_out(); - cs8900a_send(); - dump_packet(); -} -/*---------------------------------------------------------------------------*/ - -EK_EVENTHANDLER(eventhandler, ev, data) -{ - switch(ev) { - case EK_EVENT_INIT: - case EK_EVENT_REPLACE: - ctk_window_new(&window, DUMP_WIDTH, DUMP_HEIGHT, "TFE dump"); - CTK_WIDGET_ADD(&window, &dumplabel); - ctk_window_open(&window); - uip_setethaddr(addr); - cs8900a_init(); - break; - case EK_EVENT_REQUEST_REPLACE: - ctk_window_close(&window); - ek_replace((struct ek_proc *)data, NULL); - LOADER_UNLOAD(); - break; - case EK_EVENT_REQUEST_EXIT: - ctk_window_close(&window); - ek_exit(); - LOADER_UNLOAD(); - break; - default: - break; - } -} - -/*---------------------------------------------------------------------------*/ -EK_POLLHANDLER(pollhandler) -{ -#define BUF ((struct uip_eth_hdr *)&uip_buf[0]) - - /* Poll Ethernet device to see if there is a frame avaliable. */ - uip_len = cs8900a_poll(); - if(uip_len > 0) { - dump_packet(); - /* A frame was avaliable (and is now read into the uip_buf), so - we process it. */ - if(BUF->type == UIP_HTONS(UIP_ETHTYPE_IP)) { - uip_arp_ipin(); - uip_len -= sizeof(struct uip_eth_hdr); - tcpip_input(); - } else if(BUF->type == UIP_HTONS(UIP_ETHTYPE_ARP)) { - uip_arp_arpin(); - /* If the above function invocation resulted in data that - should be sent out on the network, the global variable - uip_len is set to a value > 0. */ - if(uip_len > 0) { - cs8900a_send(); - } - } - } - -} -/*---------------------------------------------------------------------------*/ diff --git a/backyard/platform/esb/Makefile b/backyard/platform/esb/Makefile deleted file mode 100644 index d1944cc1a..000000000 --- a/backyard/platform/esb/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -# $Id: Makefile,v 1.1 2008/07/08 11:21:53 nifi Exp $ - -all: core -upload: core core.u - -core: - $(MAKE) core.firmware && \ - $(MAKE) core.firmware && \ - $(MAKE) core.firmware - -CONTIKI=../.. -TARGET=esb - -blinker.cm: blinker.co blinker2.co - -ifdef ENABLE_BACNET -APPS += bacnet -APPDIRS += apps/bacnet -endif - -include $(CONTIKI)/Makefile.include diff --git a/backyard/platform/gtk/Makefile b/backyard/platform/gtk/Makefile deleted file mode 100644 index fb7f40a89..000000000 --- a/backyard/platform/gtk/Makefile +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright (c) 2002-2004, Adam Dunkels. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. The name of the author may not be used to endorse or promote -# products derived from this software without specific prior -# written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS -# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE -# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# This file is part of the Contiki desktop environment -# -# $Id: Makefile,v 1.1 2008/01/05 21:08:26 oliverschmidt Exp $ -# - -all: contiki-main - -CONTIKI=../.. -APPS=program-handler calc dhcp webbrowser editor ftp process-list shell irc netconf about cmdd -TARGET=gtk --include $(CONTIKI)/Makefile.include diff --git a/backyard/platform/gtk/Makefile.gtk b/backyard/platform/gtk/Makefile.gtk deleted file mode 100644 index 7f678477a..000000000 --- a/backyard/platform/gtk/Makefile.gtk +++ /dev/null @@ -1,29 +0,0 @@ -ifndef CONTIKI - $(error CONTIKI not defined! You must specify where CONTIKI resides!) -endif - -APPS+=process-list webserver program-handler irc calc webbrowser email \ - shell netconf dhcp ftp - -CONTIKI_TARGET_DIRS = . ctk net -CONTIKI_TARGET_MAIN = ${addprefix $(OBJECTDIR)/,contiki-main.o} - -CTKGTK = $(CTK) ctk-gtksim.c ctk-draw.c ctk-gtksim-service.c libconio.c \ - ctk-gtksim-draw.c - -CONTIKI_TARGET_SOURCEFILES = tapdev-drv.c tapdev.c contiki-main.c \ - dlloader.c clock.c $(CTK) $(CTKGTK) \ - cfs-posix.c cfs-posix-dir.c - -CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) - -.SUFFIXES: - -### Define the CPU directory -CONTIKI_CPU=$(CONTIKI)/cpu/native -include $(CONTIKI_CPU)/Makefile.native - -### Compiler definitions -CFLAGS += -DCTK_GTKSIM_SERVICE_PNGDIR=\"$(CONTIKI)/platform/gtk\" \ - `pkg-config --cflags gtk+-2.0` -TARGET_LIBFILES = `pkg-config --libs gtk+-2.0` diff --git a/backyard/platform/gtk/background.png b/backyard/platform/gtk/background.png deleted file mode 100644 index bd53886ba2dcf61d2f72c8e73ebc0a8af9bdb016..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 95975 zcmd43WmH>R*C-s^p;)14TPPGL?hd7t;tnkYg1bYp5TJ!3r9g`p3zXsw!7aEHD^75C z4eoYx&Uw%C-uvU;aesVwjBk&Ttew60T5GO3=bF9~simPrLP$pl002mo-@MWR0I<=g zSO9!XbR#_Z(FolTxV?Gj2>=jL{Pn>YnG3u@Uwr4K_|{9u+~={IhpUafll5aSKR4^g z@>*K_076@97i$lD%YSbXKK}a<;3E_g78Mf_7ZKq@A3|0_R(yN{=6{`|53zrmf4&L# zz5*=)fM9^~D|tQN>D^n$>0QnNZbCw(KYtnr=lhE_^q4hkwlBw1$zPvh(f0+1wj`Ib z2zgkmHH)m<@F={*Kfk}cziT$*qb0@-X+<}ISnc_O|NV0ygaGi*4PxAOvQ})s-w&am zT?#kD4F0RbU;Pdg_%K@j?R4=Z1@P}V-^~Lxz<-a8&j$E+9%5N+O2B{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-A@2E zw_I`e?2}{+YUpFu7_F4jR=x2Av~kpeosDcv{_LY*9kmA@3KZU!(5z`wLi|z4`)VS7M{F=@dI!Nxf_$TP(VP`-&OuVT~OI>;k-4beZV?5f-~Kveie(TMBnL1*4K zp?}(f(^3h+6o^3f9A4f#A`s=AL9k4IKK9|@kV5!;E!!D}fQ&PmoX14M?+kqaDKXnh zLc8fWu6TF`f7-F)aAV3;v?Pn---rS(4K{LT!~kk1^1u3~{sZ;rmn}2JC(7DR<&Xc~ zkXZgBF5p6{ggkq>|H|--;-CMjJdmMXJ%d{dL`67CfdOD4_HMry$!LlH^@L1og{EHN z3>jdWIFmRZd-(K~)c*)e_H2xQ4xtTz8@SUa;e|gB?SGAxaS0Qj$;-5WG8w#tYr4mc z?mx)vME~`O*~XhB`%V<@(*N+X?hxh-{zvxO)mzylJf!DN!6TVdH3(vL@=RX;+Vf&v zs9^{GE(E~`X%OJAbf9 zPL}vafD*Jbojz4`|HF%^~#pWnF)nM*Y6FO0JS+!2bcU CV6UYB diff --git a/backyard/platform/gtk/clock.c b/backyard/platform/gtk/clock.c deleted file mode 100644 index dfb6bc366..000000000 --- a/backyard/platform/gtk/clock.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * $Id: clock.c,v 1.1 2008/01/05 21:08:26 oliverschmidt Exp $ - */ - -/** - * \file - * A brief description of what this file is. - * \author - * Adam Dunkels - */ - -#include "sys/clock.h" -/*---------------------------------------------------------------------------*/ -#include - -clock_time_t -clock_time(void) -{ - struct timeval tv; - struct timezone tz; - - gettimeofday(&tv, &tz); - - return tv.tv_sec * 1000 + tv.tv_usec / 1000; -} - -/*---------------------------------------------------------------------------*/ diff --git a/backyard/platform/gtk/contiki-conf.h b/backyard/platform/gtk/contiki-conf.h deleted file mode 100644 index 32ee24fd0..000000000 --- a/backyard/platform/gtk/contiki-conf.h +++ /dev/null @@ -1,187 +0,0 @@ -#ifndef __CONTIKI_CONF_H__ -#define __CONTIKI_CONF_H__ - -#define CC_CONF_REGISTER_ARGS 1 -#define CC_CONF_FUNCTION_POINTER_ARGS 1 -#define CC_CONF_FASTCALL - - - -#define CCIF -#define CLIF - - - -typedef unsigned long clock_time_t; -#define CLOCK_CONF_SECOND 1000 - -#include - -#include "ctk/ctk-arch.h" - -#define CTK_CONF_MOUSE_SUPPORT 1 - -#define CTK_CONF_MENU_KEY CH_F1 - -#define CTK_CONF_WINDOWSWITCH_KEY CH_F3 - -#define CTK_CONF_WIDGETDOWN_KEY CH_TAB - -#define CTK_CONF_WIDGETUP_KEY CH_F5 - -#define CTK_CONF_ICONS 1 - -#define CTK_CONF_ICON_BITMAPS 1 - -#define CTK_CONF_ICON_TEXTMAPS 1 - -#define CTK_CONF_WINDOWS 1 - -#define CTK_CONF_WINDOWMOVE 1 - -#define CTK_CONF_WINDOWCLOSE 1 - -#define CTK_CONF_MENUS 1 - -#define CTK_CONF_MENUWIDTH 16 -#define CTK_CONF_MAXMENUITEMS 10 - -#define CTK_CONF_WIDGET_FLAGS 1 - - - -#define COLOR_BLACK 0 -#define COLOR_WHITE 1 - -#define BORDERCOLOR COLOR_BLACK -#define SCREENCOLOR COLOR_BLACK -#define BACKGROUNDCOLOR COLOR_BLACK - -#define WINDOWCOLOR_FOCUS COLOR_WHITE -#define WINDOWCOLOR COLOR_WHITE - -#define DIALOGCOLOR COLOR_WHITE - -#define WIDGETCOLOR_HLINK COLOR_WHITE -#define WIDGETCOLOR_FWIN COLOR_WHITE -#define WIDGETCOLOR COLOR_WHITE -#define WIDGETCOLOR_DIALOG COLOR_WHITE -#define WIDGETCOLOR_FOCUS COLOR_WHITE - -#define MENUCOLOR COLOR_WHITE -#define OPENMENUCOLOR COLOR_WHITE -#define ACTIVEMENUITEMCOLOR COLOR_WHITE - - -#define CTK_VNCSERVER_CONF_NUMCONNS 10 - -#define CTK_VNCSERVER_CONF_MAX_ICONS 16 - - - - -#define EMAIL_CONF_WIDTH 76 -#define EMAIL_CONF_HEIGHT 25 - - -#define IRC_CONF_WIDTH 78 -#define IRC_CONF_HEIGHT 21 - -#define IRC_CONF_SYSTEM_STRING "GTK simulation" - - -#define LIBCONIO_CONF_SCREEN_WIDTH 80 -#define LIBCONIO_CONF_SCREEN_HEIGHT 45 - - - -#define LOG_CONF_ENABLED 0 - - -#define PROGRAM_HANDLER_CONF_MAX_NUMDSCS 10 - - - -#define SHELL_CONF_WITH_PROGRAM_HANDLER 1 - - - -#define SHELL_GUI_CONF_XSIZE 46 -#define SHELL_GUI_CONF_YSIZE 22 - - - -#define TELNETD_CONF_LINELEN 36 -#define TELNETD_CONF_NUMLINES 16 - - -/** - * The 8-bit unsigned data type. - * - * This may have to be tweaked for your particular compiler. "unsigned - * char" works for most compilers. - */ -typedef unsigned char u8_t; - -/** - * The 16-bit unsigned data type. - * - * This may have to be tweaked for your particular compiler. "unsigned - * short" works for most compilers. - */ -typedef unsigned short u16_t; - -typedef unsigned long u32_t; -typedef long s32_t; - -/** - * The statistics data type. - * - * This datatype determines how high the statistics counters are able - * to count. - */ -typedef unsigned short uip_stats_t; - - - -#define UIP_CONF_MAX_CONNECTIONS 40 -#define UIP_CONF_MAX_LISTENPORTS 40 -#define UIP_CONF_BUFFER_SIZE 420 - -#define UIP_CONF_BYTE_ORDER UIP_LITTLE_ENDIAN - -#define UIP_CONF_TCP_SPLIT 1 - -#define UIP_CONF_LOGGING 1 - -#define UIP_CONF_UDP_CHECKSUMS 1 - - - - - -#define VNC_CONF_REFRESH_ROWS 8 - - -#define WWW_CONF_WEBPAGE_WIDTH 76 -#define WWW_CONF_WEBPAGE_HEIGHT 30 - -#define WWW_CONF_HISTORY_SIZE 40 - -#define WWW_CONF_MAX_URLLEN 200 - -#define WWW_CONF_MAX_NUMPAGEWIDGETS 80 - -#define WWW_CONF_RENDERSTATE 1 - -#define WWW_CONF_FORMS 1 - -#define WWW_CONF_MAX_FORMACTIONLEN 200 -#define WWW_CONF_MAX_FORMNAMELEN 200 -#define WWW_CONF_MAX_INPUTNAMELEN 200 -#define WWW_CONF_MAX_INPUTVALUELEN 240 - -#define WWW_CONF_PAGEVIEW 1 - - -#endif /* __CONTIKI_CONF_H__ */ diff --git a/backyard/platform/gtk/contiki-main.c b/backyard/platform/gtk/contiki-main.c deleted file mode 100644 index 2c4c3f196..000000000 --- a/backyard/platform/gtk/contiki-main.c +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright (c) 2002, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: contiki-main.c,v 1.2 2010/10/19 18:29:04 adamdunkels Exp $ - * - */ - -#include -#include -#include - -#include "contiki.h" -#include "contiki-net.h" - -#include "ctk/ctk.h" - -#include "ctk/ctk-vncserver.h" - -#include "net/tapdev-drv.h" -#include "program-handler.h" -#include "webserver.h" -#include "ctk/ctk-gtksim-service.h" - -#include "about-dsc.h" -#include "calc-dsc.h" -#include "dhcp-dsc.h" -#include "email-dsc.h" -#include "ftp-dsc.h" -#include "irc-dsc.h" -#include "netconf-dsc.h" -#include "process-list-dsc.h" -#include "shell-dsc.h" -#include "www-dsc.h" - -#include "cmdd.h" - -static struct uip_fw_netif tapif = - {UIP_FW_NETIF(0,0,0,0, 0,0,0,0, tapdev_output)}; - -PROCESS(init_process, "Init"); - -PROCESS_THREAD(init_process, ev, data) -{ - uip_ipaddr_t addr; - - PROCESS_BEGIN(); - - uip_ipaddr(&addr, 192,168,2,2); - uip_sethostaddr(&addr); - - uip_ipaddr(&addr, 192,168,2,1); - uip_setdraddr(&addr); - - uip_ipaddr(&addr, 255,255,255,0); - uip_setnetmask(&addr); - - printf("init\n"); - - program_handler_add(&netconf_dsc, "Network setup", 1); - program_handler_add(&ftp_dsc, "FTP client", 1); - program_handler_add(&www_dsc, "Web browser", 1); - program_handler_add(&processes_dsc, "Processes", 1); - program_handler_add(&shell_dsc, "Command shell", 1); - program_handler_add(&calc_dsc, "Calculator", 1); - /* program_handler_add(&email_dsc, "E-mail", 1);*/ - - program_handler_add(&irc_dsc, "IRC", 1); - /* program_handler_add(&vnc_dsc, "VNC client", 1);*/ - - program_handler_add(&dhcp_dsc, "DHCP client", 1); - - uip_fw_default(&tapif); - - while(1) { - PROCESS_WAIT_EVENT(); - } - - PROCESS_END(); -} - -PROCINIT(&tcpip_process, &ctk_process, &tapdev_process, - &ctk_gtksim_service_process, &resolv_process, - &program_handler_process, - &uip_fw_process, - &init_process); - -static gint -idle_callback(gpointer data) -{ - process_run(); - return TRUE; -} -/*-----------------------------------------------------------------------------------*/ -int -main(int argc, char **argv) -{ - uip_ipaddr_t addr; - - gtk_init(&argc, &argv); - - process_init(); - - procinit_init(); - - uip_ipaddr(&addr, 192,168,2,2); - uip_sethostaddr(&addr); - - uip_ipaddr(&addr, 192,168,2,1); - uip_setdraddr(&addr); - - uip_ipaddr(&addr, 255,255,255,0); - uip_setnetmask(&addr); - - /* program_handler_add(&netconf_dsc, "Network setup", 1); - program_handler_add(&ftp_dsc, "FTP client", 1); - program_handler_add(&editor_dsc, "Editor", 1); - program_handler_add(&www_dsc, "Web browser", 1); - program_handler_add(&processes_dsc, "Processes", 1); - program_handler_add(&shell_dsc, "Command shell", 1); - program_handler_add(&calc_dsc, "Calculator", 1);*/ - /* program_handler_add(&email_dsc, "E-mail", 1);*/ - - /* program_handler_add(&irc_dsc, "IRC", 1);*/ - /* program_handler_add(&vnc_dsc, "VNC client", 1);*/ - - /* program_handler_add(&dhcp_dsc, "DHCP client", 1);*/ - - uip_fw_default(&tapif); - - gtk_timeout_add(20, idle_callback, NULL); - gtk_main(); - - return 0; - - argv = argv; - argc = argc; -} -/*-----------------------------------------------------------------------------------*/ -#undef LITTLE_ENDIAN -#undef BIG_ENDIAN -#undef BYTE_ORDER -#undef UIP_HTONS - -/*-----------------------------------------------------------------------------------*/ - -void nntpc_done(int i) {} - -void log_message(char *m1, char *m2) -{ - printf("%s%s\n", m1, m2); -} - -void -uip_log(char *m) -{ - printf("%s\n", m); -} diff --git a/backyard/platform/gtk/ctk/conio.h b/backyard/platform/gtk/ctk/conio.h deleted file mode 100644 index cb30dbc64..000000000 --- a/backyard/platform/gtk/ctk/conio.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki desktop environment - * - * $Id: conio.h,v 1.1 2008/01/05 21:08:26 oliverschmidt Exp $ - * - */ -#ifndef __CONIO_H__ -#define __CONIO_H__ - - -#define CH_ULCORNER '+' -#define CH_URCORNER '+' -#define CH_LLCORNER '+' -#define CH_LRCORNER '+' - -#include "libconio.h" - -#endif /* __CONIO_H__ */ - diff --git a/backyard/platform/gtk/ctk/ctk-arch.h b/backyard/platform/gtk/ctk/ctk-arch.h deleted file mode 100644 index 225b5d692..000000000 --- a/backyard/platform/gtk/ctk/ctk-arch.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2002, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $Id: ctk-arch.h,v 1.1 2008/01/05 21:08:26 oliverschmidt Exp $ - * - */ - -#ifndef __CTK_ARCH_H__ -#define __CTK_ARCH_H__ - -#if WITH_CTKVNC -#include "ctk-vncarch.h" -#else -#include "ctk-gtksim.h" -#endif - -#define ctk_arch_isprint(x) isprint(x) - -#endif /* __CTK_ARCH_H__ */ diff --git a/backyard/platform/gtk/ctk/ctk-gtksim-conio.c b/backyard/platform/gtk/ctk/ctk-gtksim-conio.c deleted file mode 100644 index 05570a0fa..000000000 --- a/backyard/platform/gtk/ctk/ctk-gtksim-conio.c +++ /dev/null @@ -1,359 +0,0 @@ -/* - * Copyright (c) 2002, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. All advertising materials mentioning features or use of this - * software must display the following acknowledgement: - * This product includes software developed by Adam Dunkels. - * 4. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the "ctk" console GUI toolkit for cc65 - * - * $Id: ctk-gtksim-conio.c,v 1.1 2008/01/05 21:08:26 oliverschmidt Exp $ - * - */ - -/* This file provides a very simple implementation of CTK using the - GTK (Gimp toolkit) under FreeBSD/Linux. */ - -#include - -#include "libconio.h" - -#include "ctk/ctk.h" -#include "ctk-draw.h" - -#include -#include -#include - -#define FONT_HEIGHT 14 -#define FONT_WIDTH 8 -#define FONT_HEIGHT_BASELINE 11 - -#define SCREEN_WIDTH LIBCONIO_CONF_SCREEN_WIDTH -#define SCREEN_HEIGHT LIBCONIO_CONF_SCREEN_HEIGHT - -static GdkPixmap *pixmap = NULL; -static GtkWidget *drawing_area; -static GdkFont *font; - -static int mouse_x, mouse_y, mouse_button; - -/*-----------------------------------------------------------------------------------*/ -void -ctk_arch_draw_char(char c, - unsigned char x, unsigned char y, - unsigned char reversed, - unsigned char color) -{ - char str[2]; - - str[0] = c; - str[1] = 0; - - if(reversed) { - gdk_draw_rectangle(pixmap, - drawing_area->style->black_gc, - TRUE, - x * FONT_WIDTH, - y * FONT_HEIGHT, - FONT_WIDTH, FONT_HEIGHT); - - gdk_draw_string(pixmap, - font, - drawing_area->style->white_gc, - x * FONT_WIDTH, FONT_HEIGHT_BASELINE + y * FONT_HEIGHT, - str); - } else { - gdk_draw_rectangle(pixmap, - drawing_area->style->white_gc, - TRUE, - x * FONT_WIDTH, - y * FONT_HEIGHT, - FONT_WIDTH, FONT_HEIGHT); - - gdk_draw_string(pixmap, - font, - drawing_area->style->black_gc, - x * FONT_WIDTH, FONT_HEIGHT_BASELINE + y * FONT_HEIGHT, - str); - } - - gdk_draw_pixmap(drawing_area->window, - drawing_area->style->fg_gc[GTK_WIDGET_STATE (drawing_area)], - pixmap, - x * FONT_WIDTH, - y * FONT_HEIGHT, - x * FONT_WIDTH, - y * FONT_HEIGHT, - FONT_WIDTH, FONT_HEIGHT); - -} -/*-----------------------------------------------------------------------------------*/ -#define NUMKEYS 100 -static ctk_arch_key_t keys[NUMKEYS]; -static int firstkey, lastkey; - -unsigned char -ctk_arch_keyavail(void) -{ - return firstkey != lastkey; -} -/*-----------------------------------------------------------------------------------*/ -ctk_arch_key_t -ctk_arch_getkey(void) -{ - ctk_arch_key_t key; - key = keys[firstkey]; - - if(firstkey != lastkey) { - ++firstkey; - if(firstkey >= NUMKEYS) { - firstkey = 0; - } - } - - return key; -} -/*-----------------------------------------------------------------------------------*/ -static gint -configure_event(GtkWidget *widget, GdkEventConfigure *event) -{ - if(pixmap != NULL) { - gdk_pixmap_unref(pixmap); - } - - pixmap = gdk_pixmap_new(widget->window, - widget->allocation.width, - widget->allocation.height, - -1); - - if(pixmap == NULL) { - printf("gdk_pixmap_new == NULL\n"); - exit(1); - } - gdk_draw_rectangle(pixmap, - widget->style->white_gc, - TRUE, - 0, 0, - widget->allocation.width, - widget->allocation.height); - - return TRUE; -} - -/* Redraw the screen from the backing pixmap */ -static gint -expose_event (GtkWidget * widget, GdkEventExpose * event) -{ - /* draw_screen();*/ - gdk_draw_pixmap(widget->window, - widget->style->fg_gc[GTK_WIDGET_STATE (widget)], - pixmap, - event->area.x, event->area.y, - event->area.x, event->area.y, - event->area.width, event->area.height); - return FALSE; -} - -static gint -key_press_event (GtkWidget * widget, GdkEventKey * event) -{ - if(event->keyval == GDK_Shift_L || - event->keyval == GDK_Shift_R) { - return TRUE; - } - keys[lastkey] = event->keyval; - ++lastkey; - if(lastkey >= NUMKEYS) { - lastkey = 0; - } - - return TRUE; -} - -static gint -key_release_event (GtkWidget * widget, GdkEventKey * event) -{ - return TRUE; -} - -static gint -motion_notify_event (GtkWidget * widget, GdkEventMotion * event) -{ - mouse_x = event->x; - mouse_y = event->y; - return TRUE; -} - -static gint -button_press_event (GtkWidget * widget, GdkEventButton * event) -{ - mouse_button = event->button; - return TRUE; -} - -static gint -button_release_event (GtkWidget * widget, GdkEventButton * event) -{ - mouse_button = 0; - return TRUE; -} - -static void -quit(void) -{ - gtk_exit(0); -} -/*-----------------------------------------------------------------------------------*/ -void -ctk_gtksim_init(int *argc, char **argv[]) -{ - GtkWidget *window; -#if 0 - GtkWidget *vbox; -#endif - - gtk_init(argc, argv); - - window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_window_set_title(window, "Contiki GTKsim"); - -#if 0 - vbox = gtk_vbox_new(FALSE, 0); - gtk_container_add(GTK_CONTAINER (window), vbox); - gtk_widget_show(vbox); -#endif - gtk_signal_connect(GTK_OBJECT (window), "destroy", - GTK_SIGNAL_FUNC (quit), NULL); - - /* Create the drawing area */ - - drawing_area = gtk_drawing_area_new(); - gtk_drawing_area_size(GTK_DRAWING_AREA (drawing_area), - SCREEN_WIDTH * FONT_WIDTH, - SCREEN_HEIGHT * FONT_HEIGHT); -#if 0 - gtk_box_pack_start(GTK_BOX(vbox), drawing_area, TRUE, TRUE, 0); -#else - gtk_container_add(GTK_CONTAINER(window), drawing_area); -#endif - - gtk_widget_show(drawing_area); - - /* Load a fixed width font. */ - /* font = gdk_font_load("-*-gamow-medium-r-*-*-*-90-*-*-*-*-*-*");*/ - /* font = gdk_font_load("-*-courier-*-r-normal-*-14-*-*-*-m-*-iso8859-1");*/ - font = gdk_font_load("-*-courier-medium-r-*-*-12-*-*-*-*-*-iso8859-1"); - if(font != NULL) { - printf("Font loaded OK\n"); - } else { - printf("Font loading failed\n"); - exit(1); - } - - - /* Signals used to handle backing pixmap */ - - gtk_signal_connect(GTK_OBJECT (drawing_area), "expose_event", - (GtkSignalFunc) expose_event, NULL); - gtk_signal_connect(GTK_OBJECT (drawing_area), "configure_event", - (GtkSignalFunc) configure_event, NULL); - - /* Event signals */ - - gtk_signal_connect(GTK_OBJECT (window), "key_press_event", - (GtkSignalFunc) key_press_event, NULL); - gtk_signal_connect(GTK_OBJECT (window), "key_release_event", - (GtkSignalFunc) key_release_event, NULL); - - gtk_signal_connect(GTK_OBJECT (drawing_area), "motion_notify_event", - (GtkSignalFunc) motion_notify_event, NULL); - - gtk_signal_connect(GTK_OBJECT (drawing_area), "button_press_event", - (GtkSignalFunc) button_press_event, NULL); - - gtk_signal_connect(GTK_OBJECT (drawing_area), "button_release_event", - (GtkSignalFunc) button_release_event, NULL); - - gtk_widget_set_events(drawing_area, gtk_widget_get_events (drawing_area) - | GDK_KEY_PRESS_MASK - | GDK_KEY_RELEASE_MASK - | GDK_POINTER_MOTION_MASK - | GDK_BUTTON_PRESS_MASK - | GDK_BUTTON_RELEASE_MASK); - - gtk_widget_show(window); - -} -/*-----------------------------------------------------------------------------------*/ -void -ctk_mouse_init(void) -{ - -} -/*-----------------------------------------------------------------------------------*/ -unsigned short -ctk_mouse_x(void) -{ - return mouse_x; -} -/*-----------------------------------------------------------------------------------*/ -unsigned short -ctk_mouse_y(void) -{ - return mouse_y; -} -/*-----------------------------------------------------------------------------------*/ -unsigned char -ctk_mouse_xtoc(unsigned short x) -{ - return x / FONT_WIDTH; -} -/*-----------------------------------------------------------------------------------*/ -unsigned char -ctk_mouse_ytoc(unsigned short y) -{ - return y / FONT_HEIGHT; -} -/*-----------------------------------------------------------------------------------*/ -unsigned char -ctk_mouse_button(void) -{ - return mouse_button; -} -/*-----------------------------------------------------------------------------------*/ -void -ctk_mouse_hide(void) -{ -} -/*-----------------------------------------------------------------------------------*/ -void -ctk_mouse_show(void) -{ -} -/*-----------------------------------------------------------------------------------*/ diff --git a/backyard/platform/gtk/ctk/ctk-gtksim-draw.c b/backyard/platform/gtk/ctk/ctk-gtksim-draw.c deleted file mode 100644 index 868ff1878..000000000 --- a/backyard/platform/gtk/ctk/ctk-gtksim-draw.c +++ /dev/null @@ -1,172 +0,0 @@ - -#include "ctk-gtksim.h" - -#include "ctk-gtksim-draw.h" - -#define RASTER_X 8 - -#define FONT_BASELINE 8 - -struct ctk_gtksim_draw_font { - /* GdkFont *font;*/ - PangoFontDescription *font; -}; - -struct ctk_gtksim_draw_color { - GdkGC *color; -}; - -struct ctk_gtksim_draw_font ctk_gtksim_draw_font_normal, - ctk_gtksim_draw_font_bold, - ctk_gtksim_draw_font_menu, - ctk_gtksim_draw_font_monospace, - ctk_gtksim_draw_font_monospace_bold; - -struct ctk_gtksim_draw_color ctk_gtksim_draw_color_white, - ctk_gtksim_draw_color_lightgray, - ctk_gtksim_draw_color_midgray, - ctk_gtksim_draw_color_darkgray, - ctk_gtksim_draw_color_ddarkgray, - ctk_gtksim_draw_color_black, - ctk_gtksim_draw_color_blue; - -/*static GdkFont *font, *ctk_gtksim_draw_font_bold, *menufont, *ctk_gtksim_draw_font_monospace;*/ - -static PangoLayout *layout; - -/*--------------------------------------------------------------------------*/ -int -ctk_gtksim_draw_string_width(struct ctk_gtksim_draw_font *font, - char *str, int monospace) -{ - int width; - if(monospace) { - return strlen(str) * RASTER_X; - } else { - pango_layout_set_text(layout, str, -1); - pango_layout_set_font_description(layout, font->font); - pango_layout_get_size(layout, &width, NULL); - return width / PANGO_SCALE; - /* return gdk_string_width(font->font, str);*/ - } -} -/*--------------------------------------------------------------------------*/ -void -ctk_gtksim_draw_string(struct ctk_gtksim_draw_font *font, - struct ctk_gtksim_draw_color *color, - int x, int y, char *str, - int monospace) -{ - int i; - char text[2]; - - pango_layout_set_font_description(layout, font->font); - - if(monospace) { - text[1] = 0; - for(i = 0; i < strlen(str); ++i) { - text[0] = str[i]; - pango_layout_set_text(layout, text, 1); - - gdk_draw_layout(ctk_gtksim_pixmap, color->color, - x, y, layout); - /* gdk_draw_string(ctk_gtksim_pixmap, font->font, color->color, - x, y + FONT_BASELINE, text);*/ - x += RASTER_X; - } - } else { - pango_layout_set_text(layout, str, -1); - - gdk_draw_layout(ctk_gtksim_pixmap, color->color, - x, y, layout); - /* gdk_draw_string(ctk_gtksim_pixmap, font->font, color->color, - x, y + FONT_BASELINE, str);*/ - } -} -/*--------------------------------------------------------------------------*/ -static GdkGC * -get_color(unsigned short r, unsigned short g, unsigned short b) -{ - GdkGCValues values; - GdkColor color; - - color.pixel = 0; - color.red = r; - color.green = g; - color.blue = b; - - if(gdk_colormap_alloc_color(gdk_colormap_get_system(), - &color, FALSE, TRUE)) { - } - - values.foreground = color; - - return gdk_gc_new_with_values(ctk_gtksim_drawing_area->window, - &values, - GDK_GC_FOREGROUND); -} -/*--------------------------------------------------------------------------*/ -void -ctk_gtksim_draw_init(void) -{ - /* - ctk_gtksim_draw_font_normal.font = - gdk_font_load("-*-helvetica-medium-r-*-*-10-*-*-*-*-*-*-*"); - if(ctk_gtksim_draw_font_normal.font != NULL) { - printf("ctk-gtksim-service: Font loaded OK\n"); - } else { - printf("ctk-gtksim-service: Font loading failed\n"); - exit(1); - } - - ctk_gtksim_draw_font_bold.font = - gdk_font_load("-*-helvetica-bold-r-*-*-10-*-*-*-*-*-*-*"); - if(ctk_gtksim_draw_font_bold.font != NULL) { - printf("ctk-gtksim-service: Font loaded OK\n"); - } else { - printf("ctk-gtksim-service: Font loading failed\n"); - exit(1); - } - - ctk_gtksim_draw_font_menu.font = - gdk_font_load("-*-helvetica-bold-r-*-*-12-*-*-*-*-*-*-*"); - if(ctk_gtksim_draw_font_menu.font != NULL) { - printf("ctk-gtksim-service: Font loaded OK\n"); - } else { - printf("ctk-gtksim-service: Font loading failed\n"); - exit(1); - } - - ctk_gtksim_draw_font_monospace.font = - gdk_font_load("-*-courier-medium-r-*-*-*-120-*-*-*-*-*-*"); - if(ctk_gtksim_draw_font_monospace.font != NULL) { - printf("ctk-gtksim-service: Font loaded OK\n"); - } else { - printf("ctk-gtksim-service: Font loading failed\n"); - exit(1); - } - */ - ctk_gtksim_draw_color_blue.color = get_color(0, 0, 0xffff); - ctk_gtksim_draw_color_white.color = get_color(0xffff, 0xffff, 0xffff); - ctk_gtksim_draw_color_lightgray.color = get_color(0xefff, 0xefff, 0xefff); - ctk_gtksim_draw_color_midgray.color = get_color(0xdfff, 0xdfff, 0xdfff); - ctk_gtksim_draw_color_darkgray.color = get_color(0xcfff, 0xcfff, 0xcfff); - ctk_gtksim_draw_color_ddarkgray.color = get_color(0xafff, 0xafff, 0xafff); - ctk_gtksim_draw_color_black.color = get_color(0, 0, 0); - - layout = pango_layout_new(gtk_widget_get_pango_context(ctk_gtksim_drawing_area)); - - ctk_gtksim_draw_font_normal.font = - pango_font_description_from_string("Arial 8"); - ctk_gtksim_draw_font_bold.font = - pango_font_description_from_string("Arial bold 8"); - ctk_gtksim_draw_font_menu.font = - pango_font_description_from_string("Arial bold 9"); - ctk_gtksim_draw_font_monospace.font = - pango_font_description_from_string("Monospace 8"); - ctk_gtksim_draw_font_monospace_bold.font = - pango_font_description_from_string("Monospace bold 8"); - - -} -/*--------------------------------------------------------------------------*/ diff --git a/backyard/platform/gtk/ctk/ctk-gtksim-draw.h b/backyard/platform/gtk/ctk/ctk-gtksim-draw.h deleted file mode 100644 index ffb783cbb..000000000 --- a/backyard/platform/gtk/ctk/ctk-gtksim-draw.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef __CTK_GTKSIM_DRAW_H__ -#define __CTK_GTKSIM_DRAW_H__ - -struct ctk_gtksim_draw_font; - -extern struct ctk_gtksim_draw_font ctk_gtksim_draw_font_normal, - ctk_gtksim_draw_font_bold, - ctk_gtksim_draw_font_menu, - ctk_gtksim_draw_font_monospace, - ctk_gtksim_draw_font_monospace_bold; - -struct ctk_gtksim_draw_color; - -extern struct ctk_gtksim_draw_color ctk_gtksim_draw_color_white, - ctk_gtksim_draw_color_lightgray, - ctk_gtksim_draw_color_midgray, - ctk_gtksim_draw_color_darkgray, - ctk_gtksim_draw_color_ddarkgray, - ctk_gtksim_draw_color_black, - ctk_gtksim_draw_color_blue; - -void ctk_gtksim_draw_init(void); - -int ctk_gtksim_draw_string_width(struct ctk_gtksim_draw_font *font, - char *str, int monospace); - -void ctk_gtksim_draw_string(struct ctk_gtksim_draw_font *font, - struct ctk_gtksim_draw_color *color, - int x, int y, char *str, - int monospace); - -void ctk_gtksim_draw_line(struct ctk_gtksim_draw_color *color, - int x1, int y1, - int x2, int y2); - - -#endif /* __CTK_GTKSIM_DRAW_H__ */ diff --git a/backyard/platform/gtk/ctk/ctk-gtksim-service.c b/backyard/platform/gtk/ctk/ctk-gtksim-service.c deleted file mode 100644 index 63a300903..000000000 --- a/backyard/platform/gtk/ctk/ctk-gtksim-service.c +++ /dev/null @@ -1,869 +0,0 @@ - -/*#include "ctk/ctk-draw-service.h"*/ - -#include "ctk-gtksim-draw.h" -#include "ctk-gtksim.h" - -#include - - -#define WINDOWBORDER_WIDTH 1 -#define WINDOWBORDER_HEIGHT 1 -#define WINDOWTITLE_HEIGHT 3 -#define MENU_HEIGHT 1 -#define MENUBAR_HEIGHT 12 - -#define FONT_BASELINE 12 - -#define MENUBAR_FONT_BASELINE 7 - -#define RASTER_X 8 -#define RASTER_Y 14 - -#define BUTTON_HEIGHT 12 -#define BUTTON_X_BORDER 4 -#define BUTTON_Y_BORDER 1 - -#define TEXTENTRY_HEIGHT 12 -#define TEXTENTRY_X_BORDER 4 -#define TEXTENTRY_Y_BORDER 1 - -static GdkGC *white, *lightgray, *midgray, *darkgray, *ddarkgray, *black, - *blue; - -static GdkPixbuf *background, *windowborder, *menubar; - -static void -draw_widget(struct ctk_widget *w, - unsigned char winx, - unsigned char winy, - unsigned char clipx, - unsigned char clipy, - unsigned char clipy1, - unsigned char clipy2, - unsigned char focus); - -/*--------------------------------------------------------------------------*/ -static GdkGC * -get_color(unsigned short r, unsigned short g, unsigned short b) -{ - GdkGCValues values; - GdkColor color; - - color.pixel = 0; - color.red = r; - color.green = g; - color.blue = b; - - if(gdk_colormap_alloc_color(gdk_colormap_get_system(), - &color, FALSE, TRUE)) { - } - - values.foreground = color; - - return gdk_gc_new_with_values(ctk_gtksim_drawing_area->window, - &values, - GDK_GC_FOREGROUND); -} -/*--------------------------------------------------------------------------*/ -static void -s_ctk_draw_init(void) -{ - GtkWidget *image; - - image = gtk_image_new_from_file(CTK_GTKSIM_SERVICE_PNGDIR "/background.png"); - background = gtk_image_get_pixbuf(GTK_IMAGE(image)); - - image = gtk_image_new_from_file(CTK_GTKSIM_SERVICE_PNGDIR "/windowborder.png"); - windowborder = gtk_image_get_pixbuf(GTK_IMAGE(image)); - - image = gtk_image_new_from_file(CTK_GTKSIM_SERVICE_PNGDIR "/menubar.png"); - menubar = gtk_image_get_pixbuf(GTK_IMAGE(image)); - - ctk_gtksim_init(); - ctk_gtksim_draw_init(); - - - blue = get_color(0, 0, 0xffff); - white = get_color(0xffff, 0xffff, 0xffff); - lightgray = get_color(0xefff, 0xefff, 0xefff); - midgray = get_color(0xdfff, 0xdfff, 0xdfff); - darkgray = get_color(0xcfff, 0xcfff, 0xcfff); - ddarkgray = get_color(0xafff, 0xafff, 0xafff); - black = get_color(0, 0, 0); - - -} -/*--------------------------------------------------------------------------*/ -static void -s_ctk_draw_clear(unsigned char y1, unsigned char y2) -{ - if(background == NULL) { - gdk_draw_rectangle(ctk_gtksim_pixmap, - darkgray, - TRUE, - 0, - y1 * RASTER_Y + MENUBAR_HEIGHT, - CTK_GTKSIM_SCREEN_WIDTH, - (y2 - y1) * RASTER_Y); - } else { - gdk_draw_pixbuf(ctk_gtksim_pixmap, - darkgray, - background, - 0, - y1 * RASTER_Y, - 0, - y1 * RASTER_Y + MENUBAR_HEIGHT, - CTK_GTKSIM_SCREEN_WIDTH, - (y2 - y1) * RASTER_Y, - GDK_RGB_DITHER_NONE, 0, 0); - } -} -/*--------------------------------------------------------------------------*/ -static void -s_ctk_draw_clear_window(struct ctk_window *window, - unsigned char focus, - unsigned char clipy1, - unsigned char clipy2) -{ - int x, y; - - x = window->x; - y = window->y + MENU_HEIGHT; - - /* Clear window */ - if(focus & CTK_FOCUS_WINDOW) { - gdk_draw_rectangle(ctk_gtksim_pixmap, - white, - TRUE, - x * RASTER_X - 1, - y * RASTER_Y - 1 + MENUBAR_HEIGHT, - (window->w + 2 * WINDOWBORDER_WIDTH) * RASTER_X + 2, - (window->h + WINDOWTITLE_HEIGHT + - WINDOWBORDER_HEIGHT) * RASTER_Y + 2); - } else { - gdk_draw_rectangle(ctk_gtksim_pixmap, - lightgray, - TRUE, - x * RASTER_X - 1, - y * RASTER_Y - 1 + MENUBAR_HEIGHT, - (window->w + 2 * WINDOWBORDER_WIDTH) * RASTER_X + 2, - (window->h + WINDOWTITLE_HEIGHT + - WINDOWBORDER_HEIGHT) * RASTER_Y + 2); - } -} -/*--------------------------------------------------------------------------*/ -static void -s_ctk_draw_window(struct ctk_window *window, - unsigned char focus, - unsigned char clipy1, - unsigned char clipy2) -{ - struct ctk_widget *w; - unsigned char wfocus; - int x, y, x1, y1, x2, y2; - - x = window->x; - y = window->y + MENU_HEIGHT; - - x1 = x + WINDOWBORDER_WIDTH; - y1 = y + WINDOWTITLE_HEIGHT; - x2 = x1 + window->w; - y2 = y1 + window->h; - - /* Draw window border */ - gdk_draw_rectangle(ctk_gtksim_pixmap, - darkgray, - FALSE, - x * RASTER_X, - y * RASTER_Y + MENUBAR_HEIGHT, - (window->w + 2 * WINDOWBORDER_WIDTH) * RASTER_X, - (window->h + WINDOWTITLE_HEIGHT + - WINDOWBORDER_HEIGHT) * RASTER_Y); - - if(ctk_mode_get() == CTK_MODE_WINDOWMOVE) { - if(focus & CTK_FOCUS_WINDOW) { - gdk_draw_rectangle(ctk_gtksim_pixmap, - white, - TRUE, - x * RASTER_X + 1, - y * RASTER_Y + MENUBAR_HEIGHT + 1, - (window->w + 2 * WINDOWBORDER_WIDTH) * RASTER_X - 2, - (window->h + WINDOWTITLE_HEIGHT + - WINDOWBORDER_HEIGHT) * RASTER_Y - 2); - } else { - gdk_draw_rectangle(ctk_gtksim_pixmap, - midgray, - TRUE, - x * RASTER_X + 1, - y * RASTER_Y + MENUBAR_HEIGHT + 1, - (window->w + 2 * WINDOWBORDER_WIDTH) * RASTER_X - 2, - (window->h + WINDOWTITLE_HEIGHT + - WINDOWBORDER_HEIGHT) * RASTER_Y - 2); - } - return; - } - - if(windowborder == NULL) { - gdk_draw_rectangle(ctk_gtksim_pixmap, - midgray, - TRUE, - x * RASTER_X, - y * RASTER_Y + MENUBAR_HEIGHT, - (window->w + 2 * WINDOWBORDER_WIDTH) * RASTER_X, - WINDOWTITLE_HEIGHT * RASTER_Y); - } else { - gdk_draw_pixbuf(ctk_gtksim_pixmap, - midgray, - windowborder, - 0, 0, - x * RASTER_X, - y * RASTER_Y + MENUBAR_HEIGHT, - (window->w + 2 * WINDOWBORDER_WIDTH) * RASTER_X, - WINDOWTITLE_HEIGHT * RASTER_Y, - GDK_RGB_DITHER_NONE, 0, 0); - } - - - gdk_draw_line(ctk_gtksim_pixmap, - darkgray, - x * RASTER_X, - (y + WINDOWTITLE_HEIGHT) * RASTER_Y - 1 + MENUBAR_HEIGHT, - (x + window->w + 2 * WINDOWBORDER_WIDTH) * RASTER_X, - (y + WINDOWTITLE_HEIGHT) * RASTER_Y - 1 + MENUBAR_HEIGHT); - - - /* Draw inactive widgets. */ - for(w = window->inactive; w != NULL; w = w->next) { - draw_widget(w, x1, y1, x2, y2, - clipy1, clipy2, - focus); - } - - /* Draw active widgets. */ - for(w = window->active; w != NULL; w = w->next) { - wfocus = focus; - if(w == window->focused) { - wfocus |= CTK_FOCUS_WIDGET; - } - - draw_widget(w, x1, y1, x2, y2, - clipy1, clipy2, - wfocus); - } - - ctk_gtksim_set_redrawflag(); -} -/*--------------------------------------------------------------------------*/ -static void -s_ctk_draw_dialog(struct ctk_window *window) -{ - struct ctk_widget *w; - unsigned char wfocus, focus; - int x, y, x1, y1, x2, y2; - - focus = CTK_FOCUS_DIALOG; - - x = window->x; - y = window->y + MENU_HEIGHT; - - x1 = x + WINDOWBORDER_WIDTH; - y1 = y + WINDOWTITLE_HEIGHT; - x2 = x1 + window->w; - y2 = y1 + window->h; - - /* Draw window border */ - gdk_draw_rectangle(ctk_gtksim_pixmap, - black, - FALSE, - x * RASTER_X, - y * RASTER_Y + MENUBAR_HEIGHT, - (window->w + 2 * WINDOWBORDER_WIDTH) * RASTER_X, - (window->h + WINDOWTITLE_HEIGHT + - WINDOWBORDER_HEIGHT) * RASTER_Y); - - - - gdk_draw_rectangle(ctk_gtksim_pixmap, - white, - TRUE, - x * RASTER_X + 1, - y * RASTER_Y + 1 + MENUBAR_HEIGHT, - (window->w + 2 * WINDOWBORDER_WIDTH) * RASTER_X - 2, - (window->h + WINDOWTITLE_HEIGHT + - WINDOWBORDER_HEIGHT) * RASTER_Y - 2); - - /* Draw inactive widgets. */ - for(w = window->inactive; w != NULL; w = w->next) { - draw_widget(w, x1, y1, x2, y2, - y1, y2, - focus); - } - - /* Draw active widgets. */ - for(w = window->active; w != NULL; w = w->next) { - wfocus = focus; - if(w == window->focused) { - wfocus |= CTK_FOCUS_WIDGET; - } - - draw_widget(w, x1, y1, x2, y2, - y1, y2, - wfocus); - } - - ctk_gtksim_set_redrawflag(); - -} -/*--------------------------------------------------------------------------*/ -static void -draw_widget(struct ctk_widget *w, - unsigned char winx, unsigned char winy, - unsigned char clipx, - unsigned char clipy, - unsigned char clipy1, - unsigned char clipy2, - unsigned char focus) -{ - unsigned char text[1000]; - unsigned char x, y; - int width, xpos; - int i, j; - GdkGC *bgcol, *buttoncol, *color, *inv_color; - struct ctk_gtksim_draw_font *buttonfont, *textfont, *textfont_bold; - int monospace; - unsigned char *bitmap; - - x = winx + w->x; - y = winy + w->y; - - if(focus & CTK_FOCUS_WINDOW) { - bgcol = white; - } else { - bgcol = lightgray; - } - - if(focus & CTK_FOCUS_WINDOW) { - buttoncol = lightgray; - } else { - buttoncol = midgray; - } - - monospace = w->flags & CTK_WIDGET_FLAG_MONOSPACE; - if(monospace) { - textfont = &ctk_gtksim_draw_font_monospace; - textfont_bold = &ctk_gtksim_draw_font_monospace_bold; - } else { - textfont = &ctk_gtksim_draw_font_normal; - textfont_bold = &ctk_gtksim_draw_font_bold; - } - - switch(w->type) { - case CTK_WIDGET_SEPARATOR: - gdk_draw_line(ctk_gtksim_pixmap, - darkgray, - x * RASTER_X, - y * RASTER_Y + RASTER_Y / 2 + MENUBAR_HEIGHT, - (x + w->w) * RASTER_X, - y * RASTER_Y + RASTER_Y / 2 + MENUBAR_HEIGHT); - break; - case CTK_WIDGET_LABEL: - gdk_draw_rectangle(ctk_gtksim_pixmap, - bgcol, - TRUE, - x * RASTER_X, - y * RASTER_Y + MENUBAR_HEIGHT, - w->w * RASTER_X, - w->h * RASTER_Y); - for(i = 0; i < w->h; ++i) { - strncpy(text, &w->widget.label.text[i * w->w], w->w); - for(j = 0; j < w->w; ++j) { - if(text[j] >= 0x80) { - text[j] = text[j] & 0x7f; - } - if(text[j] == 0) { - text[j] = ' '; - } - } - text[w->w] = 0; - ctk_gtksim_draw_string(textfont, - &ctk_gtksim_draw_color_black, - RASTER_X * x, - RASTER_Y * (y + i) + MENUBAR_HEIGHT, - text, monospace); - - strncpy(text, &w->widget.label.text[i * w->w], w->w); - for(j = 0; j < w->w; ++j) { - if(text[j] >= 0x80) { - gdk_draw_rectangle(ctk_gtksim_pixmap, - black, - FALSE, - (x + j) * RASTER_X - 2, - y * RASTER_Y + MENUBAR_HEIGHT, - RASTER_X + 2, - BUTTON_HEIGHT + 1); - } - } - } - - break; - case CTK_WIDGET_BUTTON: - if(w == (struct ctk_widget *)&w->window->titlebutton) { - buttonfont = &ctk_gtksim_draw_font_bold; - } else { - buttonfont = textfont; - } - - ++x; - - width = ctk_gtksim_draw_string_width(buttonfont, - w->widget.button.text, - monospace); - if(focus == (CTK_FOCUS_WIDGET|CTK_FOCUS_WINDOW) || - focus == (CTK_FOCUS_WIDGET|CTK_FOCUS_DIALOG)) { - gdk_draw_rectangle(ctk_gtksim_pixmap, - black, - FALSE, - x * RASTER_X - BUTTON_X_BORDER, - y * RASTER_Y - BUTTON_Y_BORDER + MENUBAR_HEIGHT, - w->w * RASTER_X + BUTTON_X_BORDER * 2, - BUTTON_HEIGHT + BUTTON_Y_BORDER); - /* gdk_draw_rectangle(ctk_gtksim_pixmap, - ctk_gtksim_drawing_area->style->black_gc, - FALSE, - x * RASTER_X - BUTTON_X_BORDER - 1, - y * RASTER_Y - BUTTON_Y_BORDER - 1, - w->w * RASTER_X + BUTTON_X_BORDER * 2 + 1, - RASTER_Y + BUTTON_Y_BORDER * 2 + 1);*/ - } else { - gdk_draw_rectangle(ctk_gtksim_pixmap, - darkgray, - FALSE, - x * RASTER_X - BUTTON_X_BORDER, - y * RASTER_Y - BUTTON_Y_BORDER + MENUBAR_HEIGHT, - w->w * RASTER_X + BUTTON_X_BORDER * 2, - BUTTON_HEIGHT + BUTTON_Y_BORDER); - } - gdk_draw_rectangle(ctk_gtksim_pixmap, - buttoncol, - TRUE, - x * RASTER_X - BUTTON_X_BORDER + 1, - y * RASTER_Y + MENUBAR_HEIGHT, - w->w * RASTER_X + BUTTON_X_BORDER * 2 - 2, - BUTTON_HEIGHT); - - gdk_draw_line(ctk_gtksim_pixmap, - ddarkgray, - x * RASTER_X - BUTTON_X_BORDER + 1, - y * RASTER_Y + BUTTON_HEIGHT - 1 + MENUBAR_HEIGHT, - x * RASTER_X + w->w * RASTER_X + BUTTON_X_BORDER - 1, - y * RASTER_Y + BUTTON_HEIGHT - 1 + MENUBAR_HEIGHT); - gdk_draw_line(ctk_gtksim_pixmap, - ddarkgray, - x * RASTER_X + w->w * RASTER_X + BUTTON_X_BORDER - 1, - y * RASTER_Y + BUTTON_HEIGHT - 1 + MENUBAR_HEIGHT, - x * RASTER_X + w->w * RASTER_X + BUTTON_X_BORDER - 1, - y * RASTER_Y + MENUBAR_HEIGHT); - - if(w != &w->window->closebutton) { - ctk_gtksim_draw_string(buttonfont, - &ctk_gtksim_draw_color_black, - RASTER_X * x + - (w->w * RASTER_X) / 2 - width / 2, - RASTER_Y * y + MENUBAR_HEIGHT, - w->widget.button.text, - monospace); - } - break; - case CTK_WIDGET_HYPERLINK: - strncpy(text, w->widget.hyperlink.text, w->w); - text[w->w] = 0; - width = ctk_gtksim_draw_string_width(textfont, text, monospace); - gdk_draw_rectangle(ctk_gtksim_pixmap, - bgcol, - TRUE, - x * RASTER_X, - y * RASTER_Y + MENUBAR_HEIGHT, - width, - RASTER_Y); - if(focus & CTK_FOCUS_WIDGET) { - ctk_gtksim_draw_string(textfont_bold, - &ctk_gtksim_draw_color_blue, - RASTER_X * x, - RASTER_Y * y + MENUBAR_HEIGHT, - text, monospace); - } else { - ctk_gtksim_draw_string(textfont, - &ctk_gtksim_draw_color_blue, - RASTER_X * x, - RASTER_Y * y + MENUBAR_HEIGHT, - text, monospace); - } - gdk_draw_line(ctk_gtksim_pixmap, - blue, - x * RASTER_X, - y * RASTER_Y + FONT_BASELINE + 1 + MENUBAR_HEIGHT, - x * RASTER_X + width, - y * RASTER_Y + FONT_BASELINE + 1 + MENUBAR_HEIGHT); - - break; - case CTK_WIDGET_TEXTENTRY: - strncpy(text, w->widget.textentry.text, sizeof(text)); - text[w->widget.textentry.xpos] = 0; - width = ctk_gtksim_draw_string_width(textfont, text, monospace); - gdk_draw_rectangle(ctk_gtksim_pixmap, - darkgray, - FALSE, - x * RASTER_X - TEXTENTRY_X_BORDER + RASTER_X, - y * RASTER_Y - TEXTENTRY_Y_BORDER + MENUBAR_HEIGHT, - w->w * RASTER_X + TEXTENTRY_X_BORDER * 2 - 1, - TEXTENTRY_HEIGHT + TEXTENTRY_Y_BORDER); - gdk_draw_rectangle(ctk_gtksim_pixmap, - bgcol, - TRUE, - x * RASTER_X + RASTER_X, - y * RASTER_Y + MENUBAR_HEIGHT, - w->w * RASTER_X, - TEXTENTRY_HEIGHT); - ctk_gtksim_draw_string(textfont, - &ctk_gtksim_draw_color_black, - RASTER_X * x + RASTER_X, - RASTER_Y * y + MENUBAR_HEIGHT, - w->widget.textentry.text, - monospace); - if(focus == (CTK_FOCUS_WIDGET|CTK_FOCUS_WINDOW) || - focus == (CTK_FOCUS_WIDGET|CTK_FOCUS_DIALOG)) { - gdk_draw_line(ctk_gtksim_pixmap, - black, - x * RASTER_X + width + RASTER_X, - y * RASTER_Y + MENUBAR_HEIGHT, - x * RASTER_X + width + RASTER_X, - y * RASTER_Y + TEXTENTRY_HEIGHT - 1 + MENUBAR_HEIGHT); - } - break; - case CTK_WIDGET_ICON: - width = ctk_gtksim_draw_string_width(&ctk_gtksim_draw_font_normal, - w->widget.icon.title, monospace); - - if(x * RASTER_X + width >= CTK_GTKSIM_SCREEN_WIDTH - RASTER_X) { - xpos = CTK_GTKSIM_SCREEN_WIDTH - width - RASTER_X; - } else { - xpos = x * RASTER_X; - } - - if((focus & CTK_FOCUS_WIDGET) == 0) { - color = black; - inv_color = bgcol; - } else { - color = bgcol; - inv_color = black; - } - - bitmap = w->widget.icon.bitmap; - if (bitmap != NULL) { - int k, c; - - for (c = 0; c < 9; ++c) { - for (i = 0; i < 8; ++i) { - unsigned char b = bitmap[i + c * 8]; - for (k = 0; k < 8; k++) { - gdk_draw_rectangle(ctk_gtksim_pixmap, - ((b >> k) & 1) > 0 ? color : inv_color, - TRUE, - x * RASTER_X + 8 * (c % 3) + (8 - k), - y * RASTER_Y + MENUBAR_HEIGHT + - 8 * (c / 3) + i, - 1, 1); - } - } - } - } else { - gdk_draw_rectangle(ctk_gtksim_pixmap, - color, - TRUE, - x * RASTER_X, - y * RASTER_Y + MENUBAR_HEIGHT, - 24, 24); - } - - /* if((focus & CTK_FOCUS_WIDGET) == 0) { - gdk_draw_rectangle(ctk_gtksim_pixmap, - bgcol, - TRUE, - x * RASTER_X, - y * RASTER_Y + MENUBAR_HEIGHT, - 24, 24); - } else { - gdk_draw_rectangle(ctk_gtksim_pixmap, - black, - TRUE, - x * RASTER_X, - y * RASTER_Y + MENUBAR_HEIGHT, - 24, 24); - }*/ - - /* gdk_draw_rectangle(ctk_gtksim_pixmap, - white, - TRUE, - xpos, - RASTER_Y * y + 24 + 1 + MENUBAR_HEIGHT, - width, - RASTER_Y);*/ - - ctk_gtksim_draw_string(textfont, - &ctk_gtksim_draw_color_black, - xpos + 1, - RASTER_Y * y + 24 + 1 + MENUBAR_HEIGHT, - w->widget.icon.title, - monospace); - ctk_gtksim_draw_string(textfont, - &ctk_gtksim_draw_color_white, - xpos, - RASTER_Y * y + 24 + MENUBAR_HEIGHT, - w->widget.icon.title, - monospace); - - - break; - case CTK_WIDGET_BITMAP: - bitmap = w->widget.bitmap.bitmap; - if(bitmap != NULL) { - int bx, by; - int k; - int xtmp; - - color = black; - inv_color = bgcol; - - for(by = 0; by < w->h; ++by) { - for(bx = 0; bx < w->w; ++bx) { - for (i = 0; i < 8; ++i) { - unsigned char b = bitmap[i + (by * w->w + bx) * 8]; - for (k = 0; k < 8; k++) { - gdk_draw_rectangle(ctk_gtksim_pixmap, - ((b >> k) & 1) > 0 ? color : inv_color, - TRUE, - x * RASTER_X + 8 * bx + (8 - k), - y * RASTER_Y + MENUBAR_HEIGHT + - 8 * by + i, - 1, 1); - } - } - } - } - } - break; - default: - break; - } -} - -/*--------------------------------------------------------------------------*/ -static void -s_ctk_draw_widget(struct ctk_widget *w, - unsigned char focus, - unsigned char clipy1, - unsigned char clipy2) -{ - struct ctk_window *win = w->window; - unsigned char posx, posy; - - posx = win->x + WINDOWBORDER_WIDTH; - posy = win->y + WINDOWTITLE_HEIGHT + MENU_HEIGHT; - - if(w == win->focused) { - focus |= CTK_FOCUS_WIDGET; - } - - draw_widget(w, posx, posy, - posx + win->w, - posy + win->h, - clipy1, clipy2, - focus); - - ctk_gtksim_set_redrawflag(); -} -/*--------------------------------------------------------------------------*/ -static void -draw_menu(struct ctk_menu *m, int x, int open) -{ - int i; - int xpos; - - if(x >= CTK_GTKSIM_SCREEN_WIDTH / RASTER_X - 16) { - xpos = CTK_GTKSIM_SCREEN_WIDTH / RASTER_X - 16; - } else { - xpos = x; - } - - if(open) { - - gdk_draw_rectangle(ctk_gtksim_pixmap, - black, - TRUE, - RASTER_X * x, 0, - m->titlelen * RASTER_X, - RASTER_Y + MENUBAR_HEIGHT); - - ctk_gtksim_draw_string(&ctk_gtksim_draw_font_menu, - &ctk_gtksim_draw_color_white, - RASTER_X * x + 2, - MENUBAR_FONT_BASELINE, - m->title, 0); - - gdk_draw_rectangle(ctk_gtksim_pixmap, - white, - TRUE, - xpos * RASTER_X, - RASTER_Y * MENU_HEIGHT + MENUBAR_HEIGHT, - (xpos + 16) * RASTER_X, - (m->nitems) * RASTER_Y); - - for(i = 0; i < m->nitems; ++i) { - if(i == m->active) { - gdk_draw_rectangle(ctk_gtksim_pixmap, - black, - TRUE, - RASTER_X * xpos, - (MENU_HEIGHT + i) * RASTER_Y + MENUBAR_HEIGHT, - (xpos + 16) * RASTER_X, - RASTER_Y); - ctk_gtksim_draw_string(&ctk_gtksim_draw_font_normal, - &ctk_gtksim_draw_color_white, - RASTER_X * xpos + 2, - (MENU_HEIGHT + i) * RASTER_Y + - MENUBAR_HEIGHT, - m->items[i].title, 0); - - } else { - ctk_gtksim_draw_string(&ctk_gtksim_draw_font_normal, - &ctk_gtksim_draw_color_black, - RASTER_X * xpos + 2, - (MENU_HEIGHT + i) * RASTER_Y + MENUBAR_HEIGHT, - m->items[i].title, 0); - } - - } - } else { - /* gdk_draw_rectangle(ctk_gtksim_pixmap, - white, - TRUE, - RASTER_X * x, 0, - m->titlelen * RASTER_X, RASTER_Y);*/ - - ctk_gtksim_draw_string(&ctk_gtksim_draw_font_menu, - &ctk_gtksim_draw_color_black, - RASTER_X * x, MENUBAR_FONT_BASELINE, - m->title, 0); - - } -} -/*--------------------------------------------------------------------------*/ -static void -s_ctk_draw_menus(struct ctk_menus *menus) -{ - struct ctk_menu *m; - int x; - - if(menubar != NULL) { - gdk_draw_pixbuf(ctk_gtksim_pixmap, - darkgray, - menubar, - 0, 0, - 0, 0, - CTK_GTKSIM_SCREEN_WIDTH, - RASTER_Y + MENUBAR_HEIGHT, - GDK_RGB_DITHER_NONE, 0, 0); - } - - x = 1; - for(m = menus->menus->next; m != NULL; m = m->next) { - draw_menu(m, x, m == menus->open); - x += strlen(m->title); - } - - x = CTK_GTKSIM_SCREEN_WIDTH / RASTER_X - strlen(menus->menus->title); - draw_menu(menus->menus, x, menus->menus == menus->open); - - - - /* gdk_draw_line(ctk_gtksim_pixmap, - ctk_gtksim_drawing_area->style->black_gc, - 0, RASTER_Y, - CTK_GTKSIM_SCREEN_WIDTH, - RASTER_Y);*/ - - ctk_gtksim_set_redrawflag(); -} -/*--------------------------------------------------------------------------*/ -static unsigned char -s_ctk_draw_width(void) -{ - return CTK_GTKSIM_SCREEN_WIDTH / RASTER_X; -} -/*--------------------------------------------------------------------------*/ -static unsigned char -s_ctk_draw_height(void) -{ - return CTK_GTKSIM_SCREEN_HEIGHT / RASTER_Y; -} -/*--------------------------------------------------------------------------*/ -static unsigned short -s_ctk_mouse_xtoc(unsigned short x) -{ - return x / RASTER_X; -} -/*--------------------------------------------------------------------------*/ -static unsigned short -s_ctk_mouse_ytoc(unsigned short y) -{ - if(y < MENUBAR_HEIGHT) { - return 0; - } else { - return (y - MENUBAR_HEIGHT) / RASTER_Y; - } -} -/*--------------------------------------------------------------------------*/ -SERVICE(ctk_gtksim_service, ctk_draw_service, -{ - WINDOWBORDER_WIDTH, - WINDOWBORDER_HEIGHT, - WINDOWTITLE_HEIGHT, - s_ctk_draw_init, - s_ctk_draw_clear, - s_ctk_draw_clear_window, - s_ctk_draw_window, - s_ctk_draw_dialog, - s_ctk_draw_widget, - s_ctk_draw_menus, - s_ctk_draw_width, - s_ctk_draw_height, - s_ctk_mouse_xtoc, - s_ctk_mouse_ytoc, -}); - -PROCESS(ctk_gtksim_service_process, "CTK GTK driver"); - -PROCESS_THREAD(ctk_gtksim_service_process, ev, data) { - - PROCESS_BEGIN(); - - SERVICE_REGISTER(ctk_gtksim_service); - - ctk_draw_init(); - - ctk_desktop_redraw(NULL); - - while(ev != PROCESS_EVENT_SERVICE_REMOVED && - ev != PROCESS_EVENT_EXIT) { - process_poll(&ctk_gtksim_service_process); - PROCESS_WAIT_EVENT(); - ctk_gtksim_redraw(); - - } - - SERVICE_REMOVE(ctk_gtksim_service); - - PROCESS_END(); -} -/*--------------------------------------------------------------------------*/ diff --git a/backyard/platform/gtk/ctk/ctk-gtksim-service.h b/backyard/platform/gtk/ctk/ctk-gtksim-service.h deleted file mode 100644 index eaa059639..000000000 --- a/backyard/platform/gtk/ctk/ctk-gtksim-service.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef __CTK_GTKSIM_SERVICE_H__ -#define __CTK_GTKSIM_SERVICE_H__ - -#include "contiki.h" - -PROCESS_NAME(ctk_gtksim_service_process); - -#endif /* __CTK_GTKSIM_SERVICE_H__ */ diff --git a/backyard/platform/gtk/ctk/ctk-gtksim.c b/backyard/platform/gtk/ctk/ctk-gtksim.c deleted file mode 100644 index d57040ae8..000000000 --- a/backyard/platform/gtk/ctk/ctk-gtksim.c +++ /dev/null @@ -1,371 +0,0 @@ -/* - * Copyright (c) 2002, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the "ctk" console GUI toolkit for cc65 - * - * $Id: ctk-gtksim.c,v 1.1 2008/01/05 21:08:26 oliverschmidt Exp $ - * - */ - -/* This file provides a very simple implementation of CTK using the - GTK (Gimp toolkit) under FreeBSD/Linux. */ - - -#include "lib/libconio.h" - -#include "ctk/ctk.h" -#include "ctk/ctk-draw.h" -#include "ctk/ctk-mouse.h" - -#include -#include -#include - -#define FONT_HEIGHT 14 -#define FONT_WIDTH 8 -#define FONT_HEIGHT_BASELINE 11 - -GdkPixmap *ctk_gtksim_pixmap = NULL; -GtkWidget *ctk_gtksim_drawing_area; -static GdkFont *font; - -static int mouse_x, mouse_y, mouse_button; - -static int redrawflag; - -void -ctk_gtksim_redraw(void) -{ - if(redrawflag) { - gdk_draw_pixmap(ctk_gtksim_drawing_area->window, - ctk_gtksim_drawing_area->style->fg_gc[GTK_WIDGET_STATE (ctk_gtksim_drawing_area)], - ctk_gtksim_pixmap, - 0,0,0,0, - CTK_GTKSIM_SCREEN_WIDTH, CTK_GTKSIM_SCREEN_HEIGHT); - redrawflag = 0; - } - -} -/*-----------------------------------------------------------------------------------*/ -void -ctk_gtksim_set_redrawflag(void) -{ - redrawflag = 1; -} -/*-----------------------------------------------------------------------------------*/ -void -ctk_arch_draw_char(char c, - unsigned char x, unsigned char y, - unsigned char reversed, - unsigned char color) -{ - char str[2]; - - str[0] = c; - str[1] = 0; - - if(reversed) { - gdk_draw_rectangle(ctk_gtksim_pixmap, - ctk_gtksim_drawing_area->style->black_gc, - TRUE, - x * FONT_WIDTH, - y * FONT_HEIGHT, - FONT_WIDTH, FONT_HEIGHT); - - gdk_draw_string(ctk_gtksim_pixmap, - font, - ctk_gtksim_drawing_area->style->white_gc, - x * FONT_WIDTH, FONT_HEIGHT_BASELINE + y * FONT_HEIGHT, - str); - } else { - gdk_draw_rectangle(ctk_gtksim_pixmap, - ctk_gtksim_drawing_area->style->white_gc, - TRUE, - x * FONT_WIDTH, - y * FONT_HEIGHT, - FONT_WIDTH, FONT_HEIGHT); - - gdk_draw_string(ctk_gtksim_pixmap, - font, - ctk_gtksim_drawing_area->style->black_gc, - x * FONT_WIDTH, FONT_HEIGHT_BASELINE + y * FONT_HEIGHT, - str); - } - - gdk_draw_pixmap(ctk_gtksim_drawing_area->window, - ctk_gtksim_drawing_area->style->fg_gc[GTK_WIDGET_STATE (ctk_gtksim_drawing_area)], - ctk_gtksim_pixmap, - x * FONT_WIDTH, - y * FONT_HEIGHT, - x * FONT_WIDTH, - y * FONT_HEIGHT, - FONT_WIDTH, FONT_HEIGHT); - -} -/*-----------------------------------------------------------------------------------*/ -#define NUMKEYS 100 -static ctk_arch_key_t keys[NUMKEYS]; -static int firstkey, lastkey; - -unsigned char -ctk_arch_keyavail(void) -{ - return firstkey != lastkey; -} -/*-----------------------------------------------------------------------------------*/ -ctk_arch_key_t -ctk_arch_getkey(void) -{ - ctk_arch_key_t key; - key = keys[firstkey]; - - if(firstkey != lastkey) { - ++firstkey; - if(firstkey >= NUMKEYS) { - firstkey = 0; - } - } - - return key; -} -/*-----------------------------------------------------------------------------------*/ -static gint -configure_event(GtkWidget *widget, GdkEventConfigure *event) -{ - if(ctk_gtksim_pixmap != NULL) { - gdk_pixmap_unref(ctk_gtksim_pixmap); - } - - ctk_gtksim_pixmap = gdk_pixmap_new(widget->window, - widget->allocation.width, - widget->allocation.height, - -1); - - if(ctk_gtksim_pixmap == NULL) { - printf("gdk_pixmap_new == NULL\n"); - exit(1); - } - gdk_draw_rectangle(ctk_gtksim_pixmap, - widget->style->white_gc, - TRUE, - 0, 0, - widget->allocation.width, - widget->allocation.height); - - return TRUE; -} - -/* Redraw the screen from the backing pixmap */ -static gint -expose_event (GtkWidget * widget, GdkEventExpose * event) -{ - /* draw_screen();*/ - gdk_draw_pixmap(widget->window, - widget->style->fg_gc[GTK_WIDGET_STATE (widget)], - ctk_gtksim_pixmap, - event->area.x, event->area.y, - event->area.x, event->area.y, - event->area.width, event->area.height); - return FALSE; -} - -static gint -key_press_event (GtkWidget * widget, GdkEventKey * event) -{ - if(event->keyval == GDK_Shift_L || - event->keyval == GDK_Shift_R) { - return TRUE; - } - keys[lastkey] = event->keyval; - ++lastkey; - if(lastkey >= NUMKEYS) { - lastkey = 0; - } - - return TRUE; -} - -static gint -key_release_event (GtkWidget * widget, GdkEventKey * event) -{ - return TRUE; -} - -static gint -motion_notify_event (GtkWidget * widget, GdkEventMotion * event) -{ - int x, y; - GdkModifierType state; - - if (event->is_hint) { - gdk_window_get_pointer (event->window, &x, &y, &state); - } else { - x = event->x; - y = event->y; - } - - mouse_x = x; - mouse_y = y; - return TRUE; -} - -static gint -button_press_event (GtkWidget * widget, GdkEventButton * event) -{ - mouse_button = event->button; - return TRUE; -} - -static gint -button_release_event (GtkWidget * widget, GdkEventButton * event) -{ - mouse_button = 0; - return TRUE; -} - -static void -quit(void) -{ - gtk_exit(0); -} -/*-----------------------------------------------------------------------------------*/ -void -ctk_gtksim_init(void) -{ - GtkWidget *window; -#if 0 - GtkWidget *vbox; -#endif - - window = gtk_window_new(GTK_WINDOW_TOPLEVEL); - gtk_window_set_title(window, "Contiki GTKsim"); - -#if 0 - vbox = gtk_vbox_new(FALSE, 0); - gtk_container_add(GTK_CONTAINER (window), vbox); - gtk_widget_show(vbox); -#endif - gtk_signal_connect(GTK_OBJECT (window), "destroy", - GTK_SIGNAL_FUNC (quit), NULL); - - /* Create the drawing area */ - - ctk_gtksim_drawing_area = gtk_drawing_area_new(); - gtk_drawing_area_size(GTK_DRAWING_AREA (ctk_gtksim_drawing_area), - CTK_GTKSIM_SCREEN_WIDTH, - CTK_GTKSIM_SCREEN_HEIGHT); -#if 0 - gtk_box_pack_start(GTK_BOX(vbox), ctk_gtksim_drawing_area, TRUE, TRUE, 0); -#else - gtk_container_add(GTK_CONTAINER(window), ctk_gtksim_drawing_area); -#endif - - gtk_widget_show(ctk_gtksim_drawing_area); - - /* Load a fixed width font. */ - /* font = gdk_font_load("-*-gamow-medium-r-*-*-*-90-*-*-*-*-*-*");*/ - /* font = gdk_font_load("-*-courier-*-r-normal-*-14-*-*-*-m-*-iso8859-1");*/ - font = gdk_font_load("-*-courier-medium-r-*-*-12-*-*-*-*-*-iso8859-1"); - if(font != NULL) { - printf("Font loaded OK\n"); - } else { - printf("Font loading failed\n"); - exit(1); - } - - - /* Signals used to handle backing pixmap */ - - gtk_signal_connect(GTK_OBJECT (ctk_gtksim_drawing_area), "expose_event", - (GtkSignalFunc) expose_event, NULL); - gtk_signal_connect(GTK_OBJECT (ctk_gtksim_drawing_area), "configure_event", - (GtkSignalFunc) configure_event, NULL); - - /* Event signals */ - - gtk_signal_connect(GTK_OBJECT (window), "key_press_event", - (GtkSignalFunc) key_press_event, NULL); - gtk_signal_connect(GTK_OBJECT (window), "key_release_event", - (GtkSignalFunc) key_release_event, NULL); - - gtk_signal_connect(GTK_OBJECT (ctk_gtksim_drawing_area), "motion_notify_event", - (GtkSignalFunc) motion_notify_event, NULL); - - gtk_signal_connect(GTK_OBJECT (ctk_gtksim_drawing_area), "button_press_event", - (GtkSignalFunc) button_press_event, NULL); - - gtk_signal_connect(GTK_OBJECT (ctk_gtksim_drawing_area), "button_release_event", - (GtkSignalFunc) button_release_event, NULL); - - gtk_widget_set_events(ctk_gtksim_drawing_area, gtk_widget_get_events (ctk_gtksim_drawing_area) - | GDK_KEY_PRESS_MASK - | GDK_KEY_RELEASE_MASK - | GDK_POINTER_MOTION_MASK - | GDK_POINTER_MOTION_HINT_MASK - | GDK_BUTTON_PRESS_MASK - | GDK_BUTTON_RELEASE_MASK); - - gtk_widget_show(window); - -} -/*-----------------------------------------------------------------------------------*/ -void -ctk_mouse_init(void) -{ - -} -/*-----------------------------------------------------------------------------------*/ -unsigned short -ctk_mouse_x(void) -{ - return mouse_x; -} -/*-----------------------------------------------------------------------------------*/ -unsigned short -ctk_mouse_y(void) -{ - return mouse_y; -} -/*-----------------------------------------------------------------------------------*/ -unsigned char -ctk_mouse_button(void) -{ - return mouse_button; -} -/*-----------------------------------------------------------------------------------*/ -void -ctk_mouse_hide(void) -{ -} -/*-----------------------------------------------------------------------------------*/ -void -ctk_mouse_show(void) -{ -} -/*-----------------------------------------------------------------------------------*/ diff --git a/backyard/platform/gtk/ctk/ctk-gtksim.h b/backyard/platform/gtk/ctk/ctk-gtksim.h deleted file mode 100644 index 2666caa70..000000000 --- a/backyard/platform/gtk/ctk/ctk-gtksim.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2002, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the "ctk" console GUI toolkit for cc65 - * - * $Id: ctk-gtksim.h,v 1.1 2008/01/05 21:08:26 oliverschmidt Exp $ - * - */ - -#ifndef __CTK_GTKSIM_H__ -#define __CTK_GTKSIM_H__ - -#include -#include -#include -#include - -#define CTK_ARCH_KEY_T guint - -unsigned char ctk_arch_keyavail(void); -guint ctk_arch_getkey(void); - -#define CH_CURS_RIGHT GDK_Right -#define CH_CURS_DOWN GDK_Down -#define CH_CURS_LEFT GDK_Left -#define CH_CURS_UP GDK_Up -#define CH_ENTER GDK_Return -#define CH_TAB GDK_Tab -#define CH_F1 GDK_F1 -#define CH_F2 GDK_F2 -#define CH_F3 GDK_F3 -#define CH_F4 GDK_F4 -#define CH_F5 GDK_F5 -#define CH_DEL GDK_BackSpace -#define CH_ESC GDK_Escape - -void ctk_gtksim_init(void); - -void ctk_gtksim_redraw(void); - -extern GdkPixmap *ctk_gtksim_pixmap; -extern GtkWidget *ctk_gtksim_drawing_area; - -#define CTK_GTKSIM_SCREEN_WIDTH 1024 -#define CTK_GTKSIM_SCREEN_HEIGHT 768 - -#endif /* __CTK_GTKSIM_H__ */ diff --git a/backyard/platform/gtk/menubar.png b/backyard/platform/gtk/menubar.png deleted file mode 100644 index dfc02e389ff5427a3d8c8e278f89143830f26676..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4391 zcmV+?5!mjDP)O{Go}0000TbVXQnLvL+uWo~o;Lvm$dbY)~9 zcWHEJ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YTwKPUg{%t1^cwn(!l%KP# zEBi}J<+y+?QSNRi2w`RTkT8%lzcPAJUdAPpwVrhV5&8iD`C*Q!X)>gQlrZ z+7lNjnsX=61wL^JJuoSd|5_E-WqY(%yXQu^@$e>rU zsRTQy)7kS8Zo9$6H7RaE2!;w0G8vYv2J@t=mJo((!Pl@fh=b~k-m@uU!hGiXOQf78 zBVHV+;zZ}FNtS$n$pAMk5vu_r{WX_xrk*?>J6A#tm&>Kz4XFmfrSbHfxlVILmm z!6q!owZ?ni99qY<7Jg3Ly>19jfah7tL~Fq%n&1xCZf-R62)fjVY6=&E3$8gd3Y8i1 zr_F+7vQ>I0JLUJOmIdYG(zO78j)GK2rkrXJ ze(a=-ZMu?hOtUfOr?~pIU0*?07Omhs?`n&!8YNA8VGq=aYxCdx z#2}olQsbAKF4aWn+dLi5%9&vgJ_}drOL8jN!Kl{cyVHTZ?PmLzcwGc+>L$y9beO05 z%+-}Hb&Z9SA|&QaZZQdko0be#Y^*63U1rU!wx)4Jnj`fj>?FU$I3kTgN~tJ1B^K)z zpK2QL%U7hw`sNMh)1c%)%X^GUroW=+LYar}#W7OHDZ#=y(2{a^!EZWgSvHX5_kxIX z+BIsliJuWRojKhqotjJ3Uty9mg*~$C}r>DYWM2DPpFU~ zvG{xg(klCez0}G<7kUq6v~}s!?7&y53it(FT2ou{cGO@K1Aqu2`Z_9MK~aTrxV|<^ zc*Ig!L-;BD8#~q&42w~dob>vNA?t$TS_vMBmX%&<0D1Kry_LbVX164{p-U3-7#wjR z<~#v9FO?e*@4J)Glglwj)~%+?38BGFmmxFWD1N}pNL3|OTHpS&XSiLr>vp}W*ZtjX z3~tx$dSx&BkG${F*uu*%n_Y(c hR$KXY-L6;o`Y%o-&e-dy(j))?002ovPDHLkV1krYN$mgt diff --git a/backyard/platform/gtk/vnc-draw.c b/backyard/platform/gtk/vnc-draw.c deleted file mode 100644 index 39d0b7439..000000000 --- a/backyard/platform/gtk/vnc-draw.c +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright (c) 2003, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki VNC client - * - * $Id: vnc-draw.c,v 1.1 2008/01/05 21:08:26 oliverschmidt Exp $ - * - */ - - - -#include "vnc-draw.h" - -#include "contiki-conf.h" - -#ifndef VNC_CONF_VIEWPORT_WIDTH -#define VNC_CONF_VIEWPORT_WIDTH (32*8) -#endif - -#ifndef VNC_CONF_VIEWPORT_HEIGHT -#define VNC_CONF_VIEWPORT_HEIGHT (16*8) -#endif - -#ifndef VNC_CONF_REFRESH_ROWS -#define VNC_CONF_REFRESH_ROWS 8 -#endif - - -static unsigned char conv[256]; - -static unsigned char oratab[8] = - { 0x80, 0x40, 0x20, 0x10, - 0x08, 0x04, 0x02, 0x01 }; -static unsigned char andtab[8] = - { 0x7f, 0xbf, 0xdf, 0xef, - 0xf7, 0xfb, 0xfd, 0xfe }; - -static u8_t *bitmapptrtab[VNC_CONF_VIEWPORT_HEIGHT]; - -static unsigned short viewport_x, - viewport_y, viewport_w, viewport_h; - -u8_t vnc_draw_bitmap[(VNC_CONF_VIEWPORT_WIDTH / 8) * - VNC_CONF_VIEWPORT_HEIGHT]; - - - -u16_t vnc_draw_x; -u16_t vnc_draw_y; -u8_t *vnc_draw_dataptr; -u8_t *vnc_draw_bitmapptr; -u16_t vnc_draw_datalen; - -/*-----------------------------------------------------------------------------------*/ -void -vnc_draw_pixel(u16_t x, u8_t y, u8_t c) -{ - u8_t o, a; - - vnc_draw_bitmapptr = bitmapptrtab[y] + (x & 0x1f8); - - if(c) { - o = oratab[x & 7]; - *vnc_draw_bitmapptr = *vnc_draw_bitmapptr | o; - } else { - a = andtab[x & 7]; - *vnc_draw_bitmapptr = *vnc_draw_bitmapptr & a; - } -} -/*-----------------------------------------------------------------------------------*/ -void -vnc_draw_pixelline(u16_t x, u16_t y, u8_t *data, u16_t datalen) -{ - u8_t o, a; - register u8_t *bitmapptr; - - vnc_draw_x = x - viewport_x; - vnc_draw_y = y - viewport_y; - - /* if(vnc_draw_y & 1) { - return; - } else { - vnc_draw_y /= 2; - }*/ - - - - if(vnc_draw_y >= VNC_CONF_VIEWPORT_HEIGHT || - vnc_draw_x >= VNC_CONF_VIEWPORT_WIDTH) { - return; - } - - vnc_draw_datalen = datalen; - - if(vnc_draw_datalen + vnc_draw_x >= VNC_CONF_VIEWPORT_WIDTH) { - vnc_draw_datalen = VNC_CONF_VIEWPORT_WIDTH - vnc_draw_x; - if(vnc_draw_datalen == 0) { - return; - } - } - - vnc_draw_dataptr = data; - - /* vnc_draw_bitmapptr = bitmaptab[vnc_draw_y] + - (vnc_draw_x & 0x1f8);*/ - - for(; vnc_draw_datalen > 0; --vnc_draw_datalen) { - /* vnc_draw_pixel(vnc_draw_x, vnc_draw_y, - conv[*vnc_draw_dataptr]);*/ - - bitmapptr = bitmapptrtab[vnc_draw_y] + (vnc_draw_x & 0x1f8); - - if(conv[*vnc_draw_dataptr]) { - o = oratab[vnc_draw_x & 7]; - *bitmapptr = *bitmapptr | o; - } else { - a = andtab[vnc_draw_x & 7]; - *bitmapptr = *bitmapptr & a; - } - ++vnc_draw_dataptr; - ++vnc_draw_x; - } -} -/*-----------------------------------------------------------------------------------*/ -void -vnc_draw_init(void) -{ - unsigned int tmp; - unsigned int i; - unsigned short ptr; - - - /* Create color conversion table. */ - for(i = 0; i < 256; ++i) { - if(((i & 0xc0) > 0xc0) || - ((i & 0x38) > 0x18) || - ((i & 0x07) > 0x03)) { - conv[i] = 0; - } else { - conv[i] = 1; - } - } - - memset(vnc_draw_bitmap, 0, sizeof(vnc_draw_bitmap)); - - for(i = 0; i < VNC_CONF_VIEWPORT_HEIGHT; ++i) { - bitmapptrtab[i] = (u8_t *)((u8_t *)vnc_draw_bitmap + - ((i & 0xfff8)/8) * VNC_CONF_VIEWPORT_WIDTH + - (i & 7)); - } - - viewport_x = 0; - viewport_y = 0; - - viewport_w = VNC_CONF_VIEWPORT_WIDTH; - viewport_h = VNC_CONF_VIEWPORT_HEIGHT; - - return; -} -/*-----------------------------------------------------------------------------------*/ -u16_t -vnc_draw_viewport_x(void) -{ - return viewport_x; -} -/*-----------------------------------------------------------------------------------*/ -u16_t -vnc_draw_viewport_y(void) -{ - return viewport_y; -} -/*-----------------------------------------------------------------------------------*/ -u16_t -vnc_draw_viewport_w(void) -{ - return viewport_w; -} -/*-----------------------------------------------------------------------------------*/ -u16_t -vnc_draw_viewport_h(void) -{ - return viewport_h; -} -/*-----------------------------------------------------------------------------------*/ diff --git a/backyard/platform/gtk/windowborder.png b/backyard/platform/gtk/windowborder.png deleted file mode 100644 index 9618b9ababd4d81c0c5a443b2ab68368d8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HYpC8e32P>J$A74I0~s#0>Z zTVkg|jWY|HGg+%yWPBrB)!pkyLECHF+6+$i&@wh{+;ci{1K^GfQE0VhT_RYO9z~z` zOY!eS7`wamH9wvxIEOpxPNBkXqSS6n|I-7TA$|DPopZ~ph`ZU}B?3>?2}Z6`|!o8Aff@R`O>9E^`-PgE@>|u-i!py}rN^5$;TH4lSNBcyhe=`>p4*Ke8YWY+yPC&yFr^4k^ z{${s7H^%st)qhLm>v)M(7c4K<+mnXH_pFK!Tl#bwSF=5KUXIX{gN!a_N59A!NlKAd z1Xmb6!W0h|QqsCA<&N_lx2wtukBQ);gU1z7kI{;QUNNko_SpG7&q}rlc*_u+bT`P= zv^vo%exF>ZORsOKdvsBZznEibekN{PBrZs`8Pd(V>?)xX_+bl;p)mKaSpG*3B5jZ3 z7gYZ%`i!Xie^UM{{r_|5|1A62+~3-{zgQn9a|ld-s`&qdw_|9ifmLgiAz}Xkd|h(* diff --git a/backyard/platform/minimal-ppp/Makefile b/backyard/platform/minimal-ppp/Makefile deleted file mode 100644 index de09afd9d..000000000 --- a/backyard/platform/minimal-ppp/Makefile +++ /dev/null @@ -1,118 +0,0 @@ -# Copyright (c) 2002-2004, Adam Dunkels. -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. The name of the author may not be used to endorse or promote -# products derived from this software without specific prior -# written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS -# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY -# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE -# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# This file is part of the Contiki desktop environment -# -# $Id: Makefile,v 1.1 2007/05/26 07:21:01 oliverschmidt Exp $ -# - -all: contiki - -CONTIKI=../.. -SDIRS = . net -APPDIRS = ${wildcard ${addprefix $(CONTIKI)/,apps apps/*}} -CSDIRS = ${addprefix $(CONTIKI)/core/,. dev lib net sys cfs lib/ctk ctk loader net/ppp } - -CC=gcc -STRIP=strip -CFLAGS=-Wall -Wstrict-prototypes -Wmissing-prototypes -g \ - -I$(CONTIKI) \ - ${addprefix -I,$(CONTIKI)/core} \ - ${addprefix -I,$(SDIRS)} \ - ${addprefix -I,$(APPDIRS)} -LDFLAGS=-Wl,-Map=contiki-main.map,-export-dynamic,-lutil - - -vpath %.c ${SDIRS} $(CSDIRS) $(APPDIRS) - --include $(CONTIKI)/arch/Makefile.common - -SYSTEM=process.o procinit.o service.o arg.o -UIP=uip.o uiplib.o tcpip.o \ - uip-fw.o uip-fw-service.o tcpdump.o \ - psock.o uipbuf.o uip_arp.o resolv.o \ - ppp/ahdlc.o ppp/ipcp.o ppp/lcp.o ppp/pap.o ppp/ppp.o ppp/ppp_process.o -LIBS=memb.o timer.o list.o etimer.o - -CFS=cfs.o - -WWW=www.o webclient.o http-strings.o htmlparser.o html-strings.o www-dsc.o http-user-agent-string.o -EMAIL=email.o smtp-socket.o smtp-strings.o ctk-textedit.o -WEBSERVER=webserver.o webserver-dsc.o httpd.o httpd-fs.o http-strings.o httpd-cgi.o webserver-nogui.o -TELNET=simpletelnet.o telnet.o -VNCVIEWER=vnc.o vnc-viewer.o vnc-draw.o vnc-dsc.o - -CTK=ctk.o -CTKGTK=ctk-gtksim.o ctk-draw.o ctk-gtksim-service.o libconio.o ctk-gtksim-draw.o -CTKVNC=ctk-vncserver.o libconio.o vnc-server.o vnc-out.o ctk-vncfont.o -CTKTERM=libconio.o ctk-term.o ctk-term-in.o ctk-term-out.o ctk-termtelnet.o - -POP=pop.o popc.o popc-strings.o - -TELNETD=telnetd.o shell.o - -APPS=$(WWW) $(EMAIL) $(WEBSERVER) $(TELNET) $(TELNETD) program-handler.o - -contiki.a: $(SYSTEM) $(UIP) uip-split.o $(LIBS) $(CFS) \ - ppp-arch.o $(APPS) \ - $(CTK) $(CTKVNC) \ - dlloader.o process.o clock.o - $(AR) rcf $@ $^ - -webserver.co: webserver-nogui.co httpd.o httpd-fs.o http-strings.o httpd-cgi.o psock.o uipbuf.o - $(LD) -i -o $@ $^ - -%.co: %.o - $(LD) -i -o $@ $^ - -%.ce: %.co - $(LD) -shared -o $@ $^ - -%.co: %.c - $(CC) $(CFLAGS) -DPROCESS_LOADABLE -c $< -o $@ - $(STRIP) --strip-unneeded -g -x $@ - - -contiki: contiki-main.o contiki.a - gcc $(LDFLAGS) -o $@ $^ - -test: test-main.o contiki.a - gcc $(LDFLAGS) -o $@ $^ - -clean: - rm -f *.o *~ *core contiki *.s *.ce *.co *.a *.map Makefile.depend ppp/*.o - -Makefile.depend depend: - gcc -MM \ - ${addprefix -I,$(CSDIRS)} \ - ${addprefix -I,$(SDIRS)} \ - ${addsuffix /*.c,$(CSDIRS)} \ - ${addsuffix /*.c,$(SDIRS)} \ - > Makefile.depend 2> /dev/null || true - -include Makefile.depend - diff --git a/backyard/platform/minimal-ppp/Makefile.minimal-ppp b/backyard/platform/minimal-ppp/Makefile.minimal-ppp deleted file mode 100644 index b7cf9458c..000000000 --- a/backyard/platform/minimal-ppp/Makefile.minimal-ppp +++ /dev/null @@ -1,58 +0,0 @@ -ifndef CONTIKI - $(error CONTIKI not defined! You must specify where CONTIKI resides!) -endif - -#contiki: contiki-$(TARGET).a - -CONTIKI_TARGET_DIRS = . -CONTIKI_TARGET_MAIN = ${addprefix $(OBJECTDIR)/,contiki-main.o} - -UIPDRIVERS = ppp/ahdlc.c ppp/ipcp.c ppp/lcp.c ppp/pap.c ppp/ppp.c ppp/ppp_process.c -CONTIKI_TARGET_SOURCEFILES = ppp-arch.c contiki-main.c dlloader.c clock.c leds.c leds-arch.c $(UIPDRIVERS) - -CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) - -.SUFFIXES: - -### Define the CPU directory -CONTIKI_CPU=$(CONTIKI)/cpu/x86 - -### Compiler definitions -CC = gcc -LD = ld -AS = as -OBJCOPY = objcopy -STRIP = strip -CFLAGSNO = -I. -I$(CONTIKI)/core -I$(CONTIKI_CPU) \ - -I$(CONTIKI)/platform/$(TARGET) \ - ${addprefix -I,$(APPDIRS)} $(APP_INCLUDES) \ - -DWITH_UIP -DWITH_ASCII \ - -Wall -g -I. -I/usr/local/include -CFLAGS += $(CFLAGSNO) -LDFLAGS = -Wl,-Map=contiki.map,-export-dynamic - -### Setup directory search path for source files - -CONTIKI_TARGET_DIRS_CONCAT = ${addprefix $(CONTIKI)/platform/$(TARGET)/, \ - $(CONTIKI_TARGET_DIRS)} -vpath %.c $(PROJECTDIRS) \ - $(CONTIKIDIRS) $(APPDIRS) $(CONTIKI_TARGET_DIRS_CONCAT) \ - $(CONTIKI_CPU) $(APP_DIRS) - -### Compilation rules - -# $(OBJECTDIR)/%.o: %.c -# $(CC) $(CFLAGS) -c $< -o $@ - -%.so: $(OBJECTDIR)/%.o - $(LD) -shared -o $@ $^ - -# %.ce: %.co -# $(LD) -shared -o $@ $^ - -# %.co: %.c -# $(CC) $(CFLAGS) -DPROCESS_LOADABLE -c $< -o $@ -# $(STRIP) --strip-unneeded -g -x $@ - -# %: %.co $(CONTIKI_TARGET_MAIN) $(PROJECT_OBJECTFILES) contiki-$(TARGET).a -# $(CC) $(CFLAGS) -o $@.$(TARGET) $^ $(LDFLAGS) diff --git a/backyard/platform/minimal-ppp/README b/backyard/platform/minimal-ppp/README deleted file mode 100644 index 4d31474d8..000000000 --- a/backyard/platform/minimal-ppp/README +++ /dev/null @@ -1,5 +0,0 @@ -When ./contiki is started, it will open a pty and connect its internal pppd -daemon to it. -The host side of the pppd process will assign an IP number to the contiki -interface, that means that it is not necessary to "ping" the contiki interface -to give it a number. diff --git a/backyard/platform/minimal-ppp/clock.c b/backyard/platform/minimal-ppp/clock.c deleted file mode 100644 index 511301498..000000000 --- a/backyard/platform/minimal-ppp/clock.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * $Id: clock.c,v 1.1 2007/05/26 07:21:01 oliverschmidt Exp $ - */ - -/** - * \file - * Clock implementation for Unix. - * \author - * Adam Dunkels - */ - -#include "sys/clock.h" -#include - -/*---------------------------------------------------------------------------*/ -clock_time_t -clock_time(void) -{ - struct timeval tv; - struct timezone tz; - - gettimeofday(&tv, &tz); - - return tv.tv_sec * 1000 + tv.tv_usec / 1000; -} -/*---------------------------------------------------------------------------*/ -void -clock_delay(unsigned int d) -{ - /* Does not do anything. */ -} -/*---------------------------------------------------------------------------*/ diff --git a/backyard/platform/minimal-ppp/contiki-conf.h b/backyard/platform/minimal-ppp/contiki-conf.h deleted file mode 100644 index 18aeb0188..000000000 --- a/backyard/platform/minimal-ppp/contiki-conf.h +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * @(#)$Id: contiki-conf.h,v 1.1 2007/05/26 07:21:01 oliverschmidt Exp $ - */ - -#ifndef __CONTIKI_CONF_H__ -#define __CONTIKI_CONF_H__ - -#include - -#include "ctk/ctk-vncarch.h" -#define TELNETD_CONF_LINELEN 80 -#define TELNETD_CONF_NUMLINES 16 - -#define CC_CONF_REGISTER_ARGS 1 -#define CC_CONF_FUNCTION_POINTER_ARGS 1 -#define CC_CONF_FASTCALL -#define CC_CONF_VA_ARGS 1 - -#define CCIF -#define CLIF - -typedef uint8_t u8_t; -typedef uint16_t u16_t; -typedef uint32_t u32_t; -typedef unsigned short uip_stats_t; - -#define UIP_CONF_MAX_CONNECTIONS 40 -#define UIP_CONF_MAX_LISTENPORTS 40 -#define UIP_CONF_BUFFER_SIZE 420 -#define UIP_CONF_BYTE_ORDER UIP_LITTLE_ENDIAN -#define UIP_CONF_TCP_SPLIT 1 -#define UIP_CONF_LOGGING 1 -#define UIP_CONF_UDP_CHECKSUMS 1 - -typedef unsigned long clock_time_t; -#define CLOCK_CONF_SECOND 1000 - -#define LOG_CONF_ENABLED 1 - -#define CTK_CONF_MAXMENUITEMS 10 - -/* The size of the HTML viewing area. */ -#define WWW_CONF_WEBPAGE_WIDTH 76 -#define WWW_CONF_WEBPAGE_HEIGHT 30 - -/* The size of the "Back" history. */ -#define WWW_CONF_HISTORY_SIZE 40 - -/* Defines the maximum length of an URL */ -#define WWW_CONF_MAX_URLLEN 200 - -/* The maxiumum number of widgets (i.e., hyperlinks, form elements) on - a page. */ -#define WWW_CONF_MAX_NUMPAGEWIDGETS 80 - -/* Turns

support on or off; must be on for forms to work. */ -#define WWW_CONF_RENDERSTATE 1 - -/* Toggles support for HTML forms. */ -#define WWW_CONF_FORMS 1 - -/* Maximum lengths for various HTML form parameters. */ -#define WWW_CONF_MAX_FORMACTIONLEN 200 -#define WWW_CONF_MAX_FORMNAMELEN 200 -#define WWW_CONF_MAX_INPUTNAMELEN 200 -#define WWW_CONF_MAX_INPUTVALUELEN 240 - -#define WWW_CONF_PAGEVIEW 1 - - -/*------------------------------------------------------------------------------*/ - -#define LIBCONIO_CONF_SCREEN_WIDTH 80 -#define LIBCONIO_CONF_SCREEN_HEIGHT 45 -/*------------------------------------------------------------------------------*/ - -#include "ctk-arch.h" - -/* - * This file is used for setting various compile time settings for the - * CTK GUI toolkit. -*/ - -/* Toggles mouse support (must have support functions in the -architecture specific files to work). */ -#define CTK_CONF_MOUSE_SUPPORT 1 - -/* Defines which key that is to be used for activating the menus */ -#define CTK_CONF_MENU_KEY CH_F1 - -/* Defines which key that is to be used for switching the frontmost - window. */ -#define CTK_CONF_WINDOWSWITCH_KEY CH_F3 - -/* Defines which key that is to be used for switching to the next - widget. */ -#define CTK_CONF_WIDGETDOWN_KEY CH_TAB - -/* Defines which key that is to be used for switching to the prevoius - widget. */ -#define CTK_CONF_WIDGETUP_KEY CH_F5 - -/* Toggles support for icons. */ -#define CTK_CONF_ICONS 1 /* 107 bytes */ - -/* Toggles support for icon bitmaps. */ -#define CTK_CONF_ICON_BITMAPS 1 - -/* Toggles support for icon textmaps. */ -#define CTK_CONF_ICON_TEXTMAPS 1 - -/* Toggles support for movable windows. */ -#define CTK_CONF_WINDOWMOVE 1 /* 333 bytes */ - -/* Toggles support for closable windows. */ -#define CTK_CONF_WINDOWCLOSE 1 /* 14 bytes */ - -/* Toggles support for menus. */ -#define CTK_CONF_MENUS 1 /* 1384 bytes */ - -/* Defines the default width of a menu. */ -#define CTK_CONF_MENUWIDTH 16 -/* The maximum number of menu items in each menu. */ -#define CTK_CONF_MAXMENUITEMS 10 - -#define CTK_CONF_WIDGET_FLAGS 1 - - -/*------------------------------------------------------------------------------*/ - -#define COLOR_BLACK 0 -#define COLOR_WHITE 1 - -#define BORDERCOLOR COLOR_BLACK -#define SCREENCOLOR COLOR_BLACK - -#define WINDOWCOLOR_FOCUS COLOR_WHITE -#define WINDOWCOLOR COLOR_WHITE - -#define DIALOGCOLOR COLOR_WHITE - -#define WIDGETCOLOR_HLINK COLOR_WHITE -#define WIDGETCOLOR_FWIN COLOR_WHITE -#define WIDGETCOLOR COLOR_WHITE -#define WIDGETCOLOR_DIALOG COLOR_WHITE -#define WIDGETCOLOR_FOCUS COLOR_WHITE - -#define MENUCOLOR COLOR_WHITE -#define OPENMENUCOLOR COLOR_WHITE -#define ACTIVEMENUITEMCOLOR COLOR_WHITE - - -/*------------------------------------------------------------------------------*/ - -/* Maximum number of clients to the telnet server */ -#define CTK_TERM_CONF_MAX_TELNET_CLIENTS 3 - -/* Telnet server port */ -#define CTK_TERM_CONF_TELNET_PORT 23 - -/* Serial server output buffer size */ -#define CTK_TERM_CONF_SERIAL_BUFFER_SIZE 300 - -/* Maximum number of clients to the terminal module. - Should be set to CTK_TERM_CONF_MAX_TELNET_CLIENTS or - CTK_TERM_CONF_MAX_TELNET_CLIENTS+1 if the serial server is used too -*/ -#define CTK_TERM_CONF_MAX_CLIENTS (CTK_TERM_CONF_MAX_TELNET_CLIENTS+1) - - -/*------------------------------------------------------------------------------*/ - -#define CTK_VNCSERVER_CONF_NUMCONNS 10 - -#define CTK_VNCSERVER_CONF_MAX_ICONS 16 -/** - * Some PPP definitions - */ - -#define clock_seconds() time(NULL) - -#define UIP_CONF_LLH_LEN 0 - -#define IPCP_RETRY_COUNT 5 -#define IPCP_TIMEOUT 5 -#define xxdebug_printf printf -#define debug_printf -#define LCP_RETRY_COUNT 10 -#define PAP_USERNAME_SIZE 16 -#define PAP_PASSWORD_SIZE 16 -#define PPP_RX_BUFFER_SIZE 1024 - - -#endif /* __CONTIKI_CONF_H__ */ diff --git a/backyard/platform/minimal-ppp/contiki-main.c b/backyard/platform/minimal-ppp/contiki-main.c deleted file mode 100644 index b63d36d8d..000000000 --- a/backyard/platform/minimal-ppp/contiki-main.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright (c) 2002, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * This file is part of the Contiki OS - * - * $Id: contiki-main.c,v 1.1 2007/05/26 07:21:01 oliverschmidt Exp $ - * - */ - -#include "contiki.h" - -#include "net/uip.h" -#include "net/ppp/ppp.h" -#include "webserver.h" -#include "telnetd.h" - - -PROCINIT(&etimer_process, &tcpip_process, - &webserver_process, - &telnetd_process, - &ppp_process); - -/*---------------------------------------------------------------------------*/ -int -main(void) -{ - u16_t addr[2]; - - process_init(); - - procinit_init(); - - //autostart_start(autostart_processes); - - //uip_ipaddr(addr, 192,168,2,2); - //uip_sethostaddr(addr); - - //uip_ipaddr(addr, 192,168,2,1); - //uip_setdraddr(addr); - - //uip_ipaddr(addr, 255,255,255,0); - //uip_setnetmask(addr); - - while(1) { - int n; - n = process_run(); - /* if(n > 0) { - printf("%d processes in queue\n"); - }*/ - usleep(1); - etimer_request_poll(); - } - - return 0; -} -/*---------------------------------------------------------------------------*/ -void log_message(char *m1, char *m2) -{ - printf("%s%s\n", m1, m2); -} - -void -uip_log(char *m) -{ - printf("%s\n", m); -} - -unsigned short -sensors_light1(void) -{ - static unsigned short count; - return count++; -} diff --git a/backyard/platform/minimal-ppp/ctk-arch.h b/backyard/platform/minimal-ppp/ctk-arch.h deleted file mode 100644 index c35162631..000000000 --- a/backyard/platform/minimal-ppp/ctk-arch.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2002, Adam Dunkels. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials provided - * with the distribution. - * 3. The name of the author may not be used to endorse or promote - * products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE - * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $Id: ctk-arch.h,v 1.1 2007/05/26 07:21:01 oliverschmidt Exp $ - * - */ - -#ifndef __CTK_ARCH_H__ -#define __CTK_ARCH_H__ - -#include "ctk/ctk-vncarch.h" - -#define ctk_arch_isprint(x) isprint(x) - -#endif /* __CTK_ARCH_H__ */ diff --git a/backyard/platform/minimal-ppp/leds-arch.c b/backyard/platform/minimal-ppp/leds-arch.c deleted file mode 100644 index 523c40742..000000000 --- a/backyard/platform/minimal-ppp/leds-arch.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * $Id: leds-arch.c,v 1.1 2007/05/26 07:21:01 oliverschmidt Exp $ - */ - -/** - * \file - * A brief description of what this file is. - * \author - * Adam Dunkels - */ - -#include "dev/leds.h" -static unsigned char leds; -/*---------------------------------------------------------------------------*/ -void -leds_arch_init(void) -{ - leds = 0; -} -/*---------------------------------------------------------------------------*/ -unsigned char -leds_arch_get(void) -{ - return leds; -} -/*---------------------------------------------------------------------------*/ -void -leds_arch_set(unsigned char l) -{ - leds = l; -} -/*---------------------------------------------------------------------------*/ diff --git a/backyard/platform/minimal-ppp/ppp-arch.c b/backyard/platform/minimal-ppp/ppp-arch.c deleted file mode 100644 index 479c53f63..000000000 --- a/backyard/platform/minimal-ppp/ppp-arch.c +++ /dev/null @@ -1,62 +0,0 @@ -#include "contiki.h" -#include -#include -#include - -static int ppp_master_fd = -1; -static int ppp_slave_fd = -1; -static char ppp_slave_name[80]; - -void init_pty() { - char cmd[256]; - - if (ppp_master_fd == -1) { - if (openpty( &ppp_master_fd, &ppp_slave_fd, ppp_slave_name, NULL, NULL)==0) - { - sprintf( cmd, "stty raw -echo -echoe < %s", ppp_slave_name); - system(cmd); - printf("pty opened, slave name = %s\n", ppp_slave_name); - printf("Now start pppd, for example with:\n"); - printf("/usr/sbin/pppd %s 115200 local noauth nocrtscts nodetach persist asyncmap 0xffffffff 192.168.1.1:192.168.1.2\n", - ppp_slave_name); - close(ppp_slave_fd); - } else { - printf("pty open failed\n"); - exit(1); - } - } -} - -void ppp_arch_putchar(u8_t c) { - init_pty(); - if (write( ppp_master_fd, &c, 1 ) > 0) { - //printf("wr=0x%02x '%c'\n", c, c>=' '?c<0x7f?c:' ':' '); - } else { - //printf("wr=0x%02x '%c' FAILED\n", c, c>=' '?c<0x7f?c:' ':' '); - } -} - -int ppp_arch_getchar(u8_t *p) { - fd_set read_fds; - struct timeval timeout; - - init_pty(); - FD_ZERO( &read_fds ); - FD_SET( ppp_master_fd, &read_fds ); - timeout.tv_sec = 0; - timeout.tv_usec = 10000; - if (select( ppp_master_fd+1, &read_fds, NULL, NULL, &timeout) != 0) { - if (FD_ISSET( ppp_master_fd, &read_fds )) { - if ( read( ppp_master_fd, p, 1) > 0 ) { - //printf("rd=0x%02x\n", *p); - return 1; - } - return 0; - } - printf("closing pty: %s\n", ppp_slave_name); - close( ppp_master_fd ); - ppp_master_fd == -1; - } else { - return 0; - } -} diff --git a/backyard/platform/minimal-ppp/ppp_arch.h b/backyard/platform/minimal-ppp/ppp_arch.h deleted file mode 100644 index e69de29bb..000000000 diff --git a/backyard/platform/sky/Makefile b/backyard/platform/sky/Makefile deleted file mode 100644 index b91eb6d7e..000000000 --- a/backyard/platform/sky/Makefile +++ /dev/null @@ -1,118 +0,0 @@ -# $Id: Makefile,v 1.1 2008/02/24 22:22:17 adamdunkels Exp $ -# -# This makefile requires GNU make! - -LIB = libcontiki.a -KERNELS = gateway.ihex client.ihex dhclient.ihex -PROGS = loadable_prg.ko udpsend.ko udprecv.ko -TOOLS = tunslip scat codeprop - -all: $(LIB) $(KERNELS) $(PROGS) $(TOOLS) - -loadable_prg.ko: loadable_prg.o -udpsend.ko: udpsend.o -udprecv.ko: udprecv.o - -gateway.out: gateway.o $(LIB) -client.out: client.o $(LIB) -dhclient.out: dhclient.o $(LIB) - -TOP=../.. -INCDIRS = -I. -I$(TOP)/cpu/msp430 -I$(TOP)/core -I$(TOP)/apps -SRCDIRS = dev $(TOP)/cpu/msp430 ${addprefix $(TOP)/core/,sys dev net lib loader} $(TOP)/apps/codeprop - -MCU=msp430x1611 - -ARCH=msp430.o minileds.o watchdog.o light.o button.o spi.o ds2411.o rom.o xmem.o i2c.o cle_msp430.o -SYSTEM=process.o procinit.o clock.o etimer.o timer.o \ - cmod.o cle.o sym.o -UIP=uip.o uiplib.o tcpip.o uip-fw.o uip-fw-drv.o uipbuf.o \ - tcpdump.o psock.o dhcpc.o uaodv.o uaodv-rt.o uip-udp-packet.o \ - uip-ipchksum.o -UIPDRIVERS=slip.o slip_uart1.o \ - cc2420.o cc2420_uart0.o cc2420_send_ip.o cc2420_send_uaodv.o -LIBS=memb.o list.o malloc.o realloc.o malloc_compact.o rand.o assert.o -SYSAPPS=tcp_loader2.o -LIBFILES=$(SYSTEM) $(ARCH) $(UIP) $(UIPDRIVERS) $(LIBS) $(SYSAPPS) - -MKNMLIST=awk -f $(TOP)/tools/mknmlist-ansi -CP=cp -LIBC=-lgcc -lc -lgcc -CC=msp430-gcc -LD=msp430-ld -AS=msp430-as -NM=msp430-nm -OBJCOPY=msp430-objcopy -STRIP=msp430-strip -AR=msp430-ar -RANLIB=msp430-ranlib -BSL=msp430-bsl -CFLAGS=-mmcu=$(MCU) $(INCDIRS) -Wall -Os -LDFLAGS=-mmcu=$(MCU) - -# Setup directory search path for source files -vpath %.c $(SRCDIRS) ${filter-out CVS,${wildcard labs/*}} - -# Set COM port if not already set. -# DOS: 1 => COM2, 2 => COM3, etc. -# Linux: /dev/ttyUSB0, /dev/ttyUSB1, etc. -# FreeBSD 6.2: /dev/cuaU0, /dev/cuaU1, etc. -ifndef COMPORT - COMPORT := /dev/ttyUSB0 -endif - - -%.o: %.c - $(CC) $(CFLAGS) -c $< -o $(notdir $(<:.c=.o)) - -# Combine several .o:s to one .ko and put COMMONs into the BSS segment -%.ko: - $(LD) -r -dc --strip-all --unresolved-symbols=ignore-in-object-files $^ -o $@ - -%.ihex: %.out - $(OBJCOPY) $^ -O ihex $@ - -#%.out: -# $(if $^,$(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^,$(error "NO TARGET $@")) - -# Add a namelist to the kernel -%.out: $^ - : | $(MKNMLIST) > $@_tmp.c && mv $@_tmp.c $@_nm.c - $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(LIBC) $@_nm.c - $(NM) $@ | $(MKNMLIST) > $@_tmp.c && mv $@_tmp.c $@_nm.c - $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ $(LIBC) $@_nm.c - -%.u: %.ihex - $(BSL) --telosb -D -c $(COMPORT) -r -e -I -p $< - -$(LIB): $(LIBFILES) - $(AR) rcf $@ $^ - $(RANLIB) $@ - -codeprop: $(TOP)/tools/codeprop.c - cc -g -Wall $< -o $@ - -tunslip: $(TOP)/tools/tunslip.c - cc -g -Wall $< -o $@ - -scat: $(TOP)/tools/scat.c - cc -g -Wall $< -o $@ - -### TEST ### - -test.out: test.o $(LIB) - $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $^ - -depend: $(LIBFILES:.o=.c) - -$(CC) $(CCDEPFLAGS) -MM $(CFLAGS) $(INCDIRS) $^ >Makefile.depend - -tags: $(LIBFILES:.o=.c) - etags $^ - -clean: - rm -f *.o *.ko *~ *.core *.out *.ihex *_nm.c - rm -f $(LIB) $(KERNELS) $(TOOLS) - -.PHONY: all - --include Makefile.depend diff --git a/backyard/platform/sky/client.c b/backyard/platform/sky/client.c deleted file mode 100644 index 5b524385a..000000000 --- a/backyard/platform/sky/client.c +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)$Id: client.c,v 1.2 2010/10/19 18:29:04 adamdunkels Exp $ - */ - -/* - * Example configuration with one statically configured IP interface. - * - * The IP address is hardcoded to 172.16.0.9 and the 172.16/16 network - * is on the radio interface. - * - * The default route and gateway is at 172.16.0.1. - * - * On the SLIP gateway run a standard SLIP implementation or the - * tunslip program that can also view debug printfs, example: - * - * sliphost# ./tunslip 172.16.0.1 255.255.0.0 - * - * - * This kernel has no application code but new modules can be uploaded - * using the codeprop program, example: - * - * datan$ ./codeprop 172.16.0.9 loadable_prg.ko - * File successfully sent (1116 bytes) - * Reply: ok - * - */ - -#include -#include -#include - -#include - -#include "contiki.h" - -/* Also IP output. */ -#include "net/uip-fw-drv.h" -#include "net/uaodv.h" -#include "dev/slip.h" -#include "dev/cc2420.h" - -#include "dev/ds2411.h" -#include "dev/leds.h" -#include "dev/light.h" -#include "dev/xmem.h" - -#include "dev/button.h" - -#include "codeprop/codeprop.h" - -/* This is how we force inclusion of the psock library. */ -#include "net/psock.h" -void *force_psock_inclusion = &psock_init; -void *force_udp_inclusion = &uip_udp_packet_send; - -struct uip_fw_netif cc2420if = -{UIP_FW_NETIF(172,16,0,9, 255,255,0,0, cc2420_send_uaodv)}; - -PROCESS(button_process, "Button process"); - -/* Radio stuff in network byte order. */ -static u16_t panId = UIP_HTONS(0x2024); - -#ifndef RF_CHANNEL -#define RF_CHANNEL 15 -#endif - -int -main(int argc, char **argv) -{ - /* - * Initalize hardware. - */ - msp430_cpu_init(); - clock_init(); - leds_init(); - leds_toggle(LEDS_ALL); - slip_arch_init(BAUD2UBR(115200)); /* Must come before first printf */ - printf("Starting %s " - "($Id: client.c,v 1.2 2010/10/19 18:29:04 adamdunkels Exp $)\n", __FILE__); - ds2411_init(); - sensors_light_init(); - cc2420_init(); - xmem_init(); - button_init(&button_process); - leds_toggle(LEDS_ALL); - /* - * Hardware initialization done! - */ - - printf("MAC %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x CHANNEL %d\n", - ds2411_id[0], ds2411_id[1], ds2411_id[2], ds2411_id[3], - ds2411_id[4], ds2411_id[5], ds2411_id[6], ds2411_id[7], - RF_CHANNEL); - - uip_ipaddr_copy(&uip_hostaddr, &cc2420if.ipaddr); - uip_ipaddr_copy(&uip_netmask, &cc2420if.netmask); - uip_ipaddr(&uip_draddr, 172,16,0,1); - printf("IP %d.%d.%d.%d netmask %d.%d.%d.%d default router %d.%d.%d.%d\n", - uip_ipaddr_to_quad(&uip_hostaddr), - uip_ipaddr_to_quad(&uip_netmask), - uip_ipaddr_to_quad(&uip_draddr)); - cc2420_set_chan_pan_addr(RF_CHANNEL, panId, uip_hostaddr.u16[1], ds2411_id); - - /* - * Initialize Contiki and our processes. - */ - process_init(); - process_start(&etimer_process, NULL); - - /* Configure IP stack. */ - uip_init(); - uip_fw_default(&cc2420if); - tcpip_set_forwarding(1); - - /* Start IP stack. */ - process_start(&tcpip_process, NULL); - process_start(&uip_fw_process, NULL); /* Start IP output */ - process_start(&cc2420_process, NULL); - cc2420_on(); - process_start(&uaodv_process, NULL); - - process_start(&button_process, NULL); - process_start(&tcp_loader_process, NULL); - - /* - * This is the scheduler loop. - */ - printf("process_run()...\n"); - while (1) { - do { - /* Reset watchdog. */ - } while(process_run() > 0); - - /* - * Idle processing. - */ - int s = splhigh(); /* Disable interrupts. */ - if(process_nevents() != 0) { - splx(s); /* Re-enable interrupts. */ - } else { - /* Re-enable interrupts and go to sleep atomically. */ - _BIS_SR(GIE | SCG0 | CPUOFF); /* LPM1 sleep. */ - } - } - - return 0; -} - -PROCESS_THREAD(button_process, ev, data) -{ - static struct etimer etimer; - - PROCESS_EXITHANDLER(goto exit); - PROCESS_BEGIN(); - - printf("button_process starting\n"); - - while(1) { - PROCESS_WAIT_EVENT(); - - if(ev == PROCESS_EVENT_MSG && data != NULL - && ((struct button_msg *)data)->type == BUTTON_MSG_TYPE) { - printf("button press\n"); - - leds_toggle(LEDS_ALL); - etimer_set(&etimer, CLOCK_SECOND); - PROCESS_WAIT_UNTIL(etimer_expired(&etimer)); - leds_toggle(LEDS_ALL); - } - } - - exit: - printf("button_process exiting\n"); - PROCESS_END(); -} diff --git a/backyard/platform/sky/dhclient.c b/backyard/platform/sky/dhclient.c deleted file mode 100644 index 05e2142da..000000000 --- a/backyard/platform/sky/dhclient.c +++ /dev/null @@ -1,276 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)$Id: dhclient.c,v 1.2 2010/10/19 18:29:04 adamdunkels Exp $ - */ - -/* - * Example mote configuration with one radio interface that uses DHCP - * to configure its IP stack. - * - * The gateway systems must be configured to find what DHCP server to - * use, this can be done with an extra argument to tunslip, example: - * - * sliphost# ./tunslip 172.16.0.1 255.255.0.0 193.10.66.195 - * - * - * This kernel has no application code but new modules can be uploaded - * using the codeprop program, example: - * - * datan$ ./codeprop 172.16.0.1 loadable_prg.ko - * File successfully sent (1116 bytes) - * Reply: ok - * - */ - -#include -#include -#include - -#include - -#include "contiki.h" - -/* Also IP output. */ -#include "net/uip-fw-drv.h" -#include "net/uaodv.h" -#include "net/dhcpc.h" -#include "dev/slip.h" -#include "dev/cc2420.h" - -#include "dev/ds2411.h" -#include "dev/leds.h" -#include "dev/light.h" -#include "dev/xmem.h" - -#include "dev/button.h" - -#include "codeprop/codeprop.h" - -/* This is how we force inclusion of the psock library. */ -#include "net/psock.h" -void *force_psock_inclusion = &psock_init; -void *force_udp_inclusion = &uip_udp_packet_send; - -struct uip_fw_netif cc2420if = -{UIP_FW_NETIF(0,0,0,0, 255,255,255,255, cc2420_send_uaodv)}; - -PROCESS(button_process, "Button process"); -PROCESS(dhclient_process, "Dhclient process"); - -/* Radio stuff in network byte order. */ -static u16_t panId = UIP_HTONS(0x2024); - -#ifndef RF_CHANNEL -#define RF_CHANNEL 15 -#endif - -int -main(int argc, char **argv) -{ - /* - * Initalize hardware. - */ - msp430_cpu_init(); - clock_init(); - leds_init(); - leds_toggle(LEDS_ALL); - slip_arch_init(BAUD2UBR(115200)); /* Must come before first printf */ - printf("Starting %s " - "($Id: dhclient.c,v 1.2 2010/10/19 18:29:04 adamdunkels Exp $)\n", __FILE__); - ds2411_init(); - sensors_light_init(); - cc2420_init(); - xmem_init(); - button_init(&button_process); - leds_toggle(LEDS_ALL); - /* - * Hardware initialization done! - */ - - printf("MAC %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x CHANNEL %d\n", - ds2411_id[0], ds2411_id[1], ds2411_id[2], ds2411_id[3], - ds2411_id[4], ds2411_id[5], ds2411_id[6], ds2411_id[7], - RF_CHANNEL); - - srand(rand() + - (ds2411_id[3]<<8) + (ds2411_id[4]<<6) + (ds2411_id[5]<<4) + - (ds2411_id[6]<<2) + ds2411_id[7]); - - /* - * Initialize Contiki and our processes. - */ - process_init(); - process_start(&etimer_process, NULL); - - /* Configure IP stack. */ - uip_init(); - - /* Start IP stack. */ - process_start(&tcpip_process, NULL); - process_start(&uip_fw_process, NULL); /* Start IP output */ - process_start(&cc2420_process, NULL); - cc2420_on(); - process_start(&dhclient_process, NULL); - - process_start(&button_process, NULL); - process_start(&tcp_loader_process, NULL); - - /* - * This is the scheduler loop. - */ - printf("process_run()...\n"); - while (1) { - do { - /* Reset watchdog. */ - } while(process_run() > 0); - - /* - * Idle processing. - */ - int s = splhigh(); /* Disable interrupts. */ - if(process_nevents() != 0) { - splx(s); /* Re-enable interrupts. */ - } else { - /* Re-enable interrupts and go to sleep atomically. */ - _BIS_SR(GIE | SCG0 | CPUOFF); /* LPM1 sleep. */ - } - } - - return 0; -} - -PROCESS_THREAD(button_process, ev, data) -{ - static struct etimer etimer; - - PROCESS_EXITHANDLER(goto exit); - PROCESS_BEGIN(); - - printf("button_process starting\n"); - - while(1) { - PROCESS_WAIT_EVENT(); - - if(ev == PROCESS_EVENT_MSG && data != NULL - && ((struct button_msg *)data)->type == BUTTON_MSG_TYPE) { - printf("button press\n"); - - leds_toggle(LEDS_ALL); - etimer_set(&etimer, CLOCK_SECOND); - PROCESS_WAIT_UNTIL(etimer_expired(&etimer)); - leds_toggle(LEDS_ALL); - } - } - - exit: - printf("button_process exiting\n"); - PROCESS_END(); -} - -PROCESS_THREAD(dhclient_process, ev, data) -{ - PROCESS_EXITHANDLER(goto exit); - PROCESS_BEGIN(); - - printf("dhclient_process starting\n"); - - leds_toggle(LEDS_GREEN); - - uip_setipid(rand()); - - /* For now use 0.0.0.0 as our IP address. */ - uip_ipaddr(&uip_hostaddr, 0,0,0,0); - cc2420_set_chan_pan_addr(RF_CHANNEL, panId, uip_hostaddr.u16[1], ds2411_id); - - /* Use only radio interface and enable forwarding. */ - uip_fw_default(&cc2420if); - tcpip_set_forwarding(1); - /* No default router yet. */ - - dhcpc_init(ds2411_id, sizeof(ds2411_id)); - dhcpc_request(); - - while(1) { - PROCESS_WAIT_EVENT(); - dhcpc_appcall(ev, data); - } - - exit: - printf("dhclient_process exiting\n"); - PROCESS_END(); -} - -static char is_configured; - -void -dhcpc_configured(const struct dhcpc_state *s) -{ - if(is_configured) - printf("dhcp reconfigure %d.%d.%d.%d\n", uip_ipaddr_to_quad(&s->ipaddr)); - else { - printf("dhcpc_configured %d.%d.%d.%d\n", uip_ipaddr_to_quad(&s->ipaddr)); - leds_toggle(LEDS_GREEN); - is_configured = 1; - process_start(&uaodv_process, NULL); - } - - uip_sethostaddr(&s->ipaddr); - uip_setnetmask(&s->netmask); - uip_setdraddr(&s->default_router); - - uip_ipaddr_copy(&cc2420if.ipaddr, &s->ipaddr); - uip_ipaddr_copy(&cc2420if.netmask, &s->netmask); - /* resolv_conf(s->dnsaddr); */ - - /* - * Now we also have a new short MAC address! - */ - cc2420_set_chan_pan_addr(RF_CHANNEL, panId, uip_hostaddr.u16[1], ds2411_id); - - /* Use only radio interface and enable forwarding. */ - uip_fw_init(); - tcpip_set_forwarding(1); - uip_fw_default(&cc2420if); -} - -void -dhcpc_unconfigured(const struct dhcpc_state *s) -{ - printf("dhcpc_unconfigured\n"); - leds_toggle(LEDS_GREEN); - is_configured = 0; - process_exit(&uaodv_process); - - uip_ipaddr(&uip_hostaddr, 0,0,0,0); - uip_ipaddr(&uip_netmask, 0,0,0,0); - uip_ipaddr(&uip_draddr, 0,0,0,0); - - /* New short MAC address. */ - cc2420_set_chan_pan_addr(RF_CHANNEL, panId, uip_hostaddr.u16[1], ds2411_id); -} diff --git a/backyard/platform/sky/gateway.c b/backyard/platform/sky/gateway.c deleted file mode 100644 index 04ae2ee46..000000000 --- a/backyard/platform/sky/gateway.c +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)$Id: gateway.c,v 1.2 2010/10/19 18:29:04 adamdunkels Exp $ - */ - -/* - * Example gateway configuration with two IP interfaces, one SLIP over - * USB and one over 802.11.4 radio. - * - * The IP address is hardcoded to 172.16.0.1 and the 172.16/16 network - * is on the radio interface. - * - * The default route is over the SLIP interface. - * - * On the SLIP host run a standard SLIP implementation or the tunslip - * program that can also view debug printfs, example: - * - * sliphost# ./tunslip 172.16.0.1 255.255.0.0 - * - * - * This kernel has no application code but new modules can be uploaded - * using the codeprop program, example: - * - * datan$ ./codeprop 172.16.0.1 loadable_prg.ko - * File successfully sent (1116 bytes) - * Reply: ok - * - */ - -#include -#include - -#include - -#include "contiki.h" - -/* Also IP output. */ -#include "net/uip-fw-drv.h" -#include "net/uaodv.h" -#include "dev/slip.h" -#include "dev/cc2420.h" - -#include "dev/ds2411.h" -#include "dev/leds.h" -#include "dev/light.h" -#include "dev/xmem.h" -#include "lib/rand.h" - -#include "dev/button.h" - -#include "codeprop/codeprop.h" - -/* - * This is how we force inclusion of the psock library and the button - * device driver. - */ -#include "net/psock.h" -void *force_inclusion[] = { - &psock_init, - &button_init, - &uip_udp_packet_send, -}; -#if 0 -int -force_float_inclusion() -{ - extern int __fixsfsi; - extern int __floatsisf; - extern int __mulsf3; - extern int __subsf3; - - return __fixsfsi + __floatsisf + __mulsf3 + __subsf3; -} -#endif - -/* We have two IP interfaces. */ -struct uip_fw_netif cc2420if = -{UIP_FW_NETIF(172,16,0,1, 255,255,0,0, cc2420_send_uaodv)}; - -static struct uip_fw_netif slipif = -{UIP_FW_NETIF(0,0,0,0, 255,255,255,255, slip_send)}; - -/* Radio stuff in network byte order. */ -static u16_t panId = UIP_HTONS(0x2024); - -#ifndef RF_CHANNEL -#define RF_CHANNEL 15 -#endif - -int -main(int argc, char **argv) -{ - /* - * Initalize hardware. - */ - msp430_cpu_init(); - clock_init(); - leds_init(); - leds_toggle(LEDS_ALL); - slip_arch_init(BAUD2UBR(115200)); /* Must come before first printf */ - printf("Starting %s " - "($Id: gateway.c,v 1.2 2010/10/19 18:29:04 adamdunkels Exp $)\n", __FILE__); - ds2411_init(); - sensors_light_init(); - cc2420_init(); - xmem_init(); - leds_toggle(LEDS_ALL); - /* - * Hardware initialization done! - */ - - printf("MAC %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x CHANNEL %d\n", - ds2411_id[0], ds2411_id[1], ds2411_id[2], ds2411_id[3], - ds2411_id[4], ds2411_id[5], ds2411_id[6], ds2411_id[7], - RF_CHANNEL); - - uip_ipaddr_copy(&uip_hostaddr, &cc2420if.ipaddr); - uip_ipaddr_copy(&uip_netmask, &cc2420if.netmask); - printf("IP %d.%d.%d.%d netmask %d.%d.%d.%d\n", - uip_ipaddr_to_quad(&uip_hostaddr), uip_ipaddr_to_quad(&uip_netmask)); - cc2420_set_chan_pan_addr(RF_CHANNEL, panId, uip_hostaddr.u16[1], ds2411_id); - - srand(rand() + - (ds2411_id[3]<<8) + (ds2411_id[4]<<6) + (ds2411_id[5]<<4) + - (ds2411_id[6]<<2) + ds2411_id[7]); - - /* - * Initialize Contiki and our processes. - */ - process_init(); - process_start(&etimer_process, NULL); - - /* Configure IP stack. */ - uip_init(); - uip_fw_default(&slipif); /* Point2point, no default router. */ - uip_fw_register(&cc2420if); - tcpip_set_forwarding(1); - - /* Start IP stack. */ - process_start(&tcpip_process, NULL); - process_start(&uip_fw_process, NULL); /* Start IP output */ - process_start(&slip_process, NULL); - process_start(&cc2420_process, NULL); - cc2420_on(); - process_start(&uaodv_process, NULL); - - process_start(&tcp_loader_process, NULL); - - /* - * This is the scheduler loop. - */ - printf("process_run()...\n"); - while (1) { - do { - /* Reset watchdog. */ - } while(process_run() > 0); - /* Idle! */ - } - - return 0; -} diff --git a/backyard/platform/sky/loadable_prg.c b/backyard/platform/sky/loadable_prg.c deleted file mode 100644 index 09b2ec146..000000000 --- a/backyard/platform/sky/loadable_prg.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * @(#)$Id: loadable_prg.c,v 1.1 2008/05/27 13:16:34 adamdunkels Exp $ - */ - -#include - -#include "contiki.h" - -#include "dev/leds.h" - -PROCESS(test_process, "Test process"); - -PROCESS_THREAD(test_process, ev, data) -{ - static struct etimer etimer; - - PROCESS_EXITHANDLER(goto exit); - PROCESS_BEGIN(); - - printf("test_process starting\n"); - - while(1) { - leds_on(LEDS_RED); - etimer_set(&etimer, CLOCK_SECOND); - PROCESS_WAIT_UNTIL(etimer_expired(&etimer)); - leds_off(LEDS_RED); - etimer_set(&etimer, CLOCK_SECOND); - PROCESS_WAIT_UNTIL(etimer_expired(&etimer)); - } - - exit: - printf("test_process exiting\n"); - leds_off(LEDS_RED); - PROCESS_END(); -} - -/* - * Initialize this kernel module. - */ -void -_init(void) -{ - process_start(&test_process, NULL); -} - -/* - * When this module is unloaded we must clean up! - */ -void -_fini(void) -{ - process_exit(&test_process); -} diff --git a/backyard/platform/sky/udprecv.c b/backyard/platform/sky/udprecv.c deleted file mode 100644 index 58807dd4f..000000000 --- a/backyard/platform/sky/udprecv.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * @(#)$Id: udprecv.c,v 1.2 2010/10/19 18:29:04 adamdunkels Exp $ - */ - -#include -#include - -#include "contiki.h" -#include "net/uip.h" - -PROCESS(udprecv_process, "UDP recv process"); - -PROCESS_THREAD(udprecv_process, ev, data) -{ - static struct uip_udp_conn *c; - - PROCESS_EXITHANDLER(goto exit); - PROCESS_BEGIN(); - - printf("udprecv_process starting\n"); - - { - uip_ipaddr_t any; - uip_ipaddr(&any, 0,0,0,0); - c = udp_new(&any, UIP_HTONS(0), NULL); - uip_udp_bind(c, UIP_HTONS(4321)); - } - - while(1) { - PROCESS_YIELD(); - - if(ev == tcpip_event && uip_newdata()) { - u8_t *src = ((struct uip_udpip_hdr *)&uip_buf[UIP_LLH_LEN])->srcipaddr.u8; - printf("%d.%d.%d.%d: %s\n", - src[0], src[1], src[2], src[3], (char *)uip_appdata); - } - } - - exit: - /* Contiki does automatic garbage collection of uIP state and we - * need not worry about that. */ - printf("udprecv_process exiting\n"); - PROCESS_END(); -} - -/* - * Initialize this kernel module. - */ -void -_init(void) -{ - process_start(&udprecv_process, NULL); -} - -/* - * When this module is unloaded we must clean up! - */ -void -_fini(void) -{ - process_exit(&udprecv_process); -} diff --git a/backyard/platform/sky/udpsend.c b/backyard/platform/sky/udpsend.c deleted file mode 100644 index c95b2ae13..000000000 --- a/backyard/platform/sky/udpsend.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2005, Swedish Institute of Computer Science - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * This file is part of the Contiki operating system. - * - * @(#)$Id: udpsend.c,v 1.2 2010/10/19 18:29:04 adamdunkels Exp $ - */ - -/* Set the IP destination address to something different from the - * broadcast address. Use commas (",") rather than the normal dots - * (".") in addresses. - */ - -#include -#include - -#include "contiki.h" -#include "net/uip.h" - -#include "dev/leds.h" -#include "dev/light.h" - -PROCESS(udpsend_process, "UDP send process"); - -PROCESS_THREAD(udpsend_process, ev, data) -{ - static struct etimer etimer; - static struct uip_udp_conn *c; - - PROCESS_EXITHANDLER(goto exit); - PROCESS_BEGIN(); - - printf("udpsend_process starting\n"); - - { - uip_ipaddr_t addr; - uip_ipaddr(&addr, 255,255,255,255); /* Change address here! */ - c = udp_new(&addr, UIP_HTONS(4321), NULL); - c->ttl = 1; /* One hop only. */ - } - - while(1) { - etimer_set(&etimer, CLOCK_SECOND); - PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&etimer)); - - tcpip_poll_udp(c); - PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event); - - char buf[64]; - sprintf(buf, "light sensors %d %d", sensors_light1(), sensors_light2()); - uip_send(buf, strlen(buf) + 1); - } - - exit: - /* Contiki does automatic garbage collection of uIP state and we - * need not worry about that. */ - printf("udpsend_process exiting\n"); - PROCESS_END(); -} - -/* - * Initialize this kernel module. - */ -void -_init(void) -{ - process_start(&udpsend_process, NULL); -} - -/* - * When this module is unloaded we must clean up! - */ -void -_fini(void) -{ - process_exit(&udpsend_process); -} diff --git a/backyard/tools/chakana/CYGWIN_USERS.txt b/backyard/tools/chakana/CYGWIN_USERS.txt deleted file mode 100644 index 62801a929..000000000 --- a/backyard/tools/chakana/CYGWIN_USERS.txt +++ /dev/null @@ -1,13 +0,0 @@ -If you're on Cygwin and run into the 'sem_init: Resource temporarily unavailable' problem: - -Current Cygwin python versions have problems with running out of PIDs, it is a known problem and there has been several discussions and bugreports related to it. -As of today, the best solution seems to be to rebase the Cygwin libraries: - 0> Make sure you have the rebaseall program, it can be downloaded using Cygwin's setup.exe - - 1> Shut down all Cygwin processes and services (including shells) - 2> Start a regular Win command prompt ('cmd') - 3> Start 'ash' - 4> Start '/bin/rebaseall', expect this step to take some time.. - 5> All done! This worked for me. - - -- Fredrik , 2007 \ No newline at end of file diff --git a/backyard/tools/chakana/__init__.py b/backyard/tools/chakana/__init__.py deleted file mode 100644 index 51f3cfdfc..000000000 --- a/backyard/tools/chakana/__init__.py +++ /dev/null @@ -1 +0,0 @@ -"""Chakana, an automated test harness for networked embedded systems.""" diff --git a/backyard/tools/chakana/build.xml b/backyard/tools/chakana/build.xml deleted file mode 100644 index e024611aa..000000000 --- a/backyard/tools/chakana/build.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/backyard/tools/chakana/command.py b/backyard/tools/chakana/command.py deleted file mode 100644 index 494067496..000000000 --- a/backyard/tools/chakana/command.py +++ /dev/null @@ -1,190 +0,0 @@ -# -# Copyright 2005-2007 Swedish Institute of Computer Science. -# -# Please refer to the file named LICENSE in the same directory as this file -# for licensing information. -# -# Written and maintained by Lars Albertsson . -# - -# $Id: command.py,v 1.1 2009/02/26 13:47:38 fros4943 Exp $ - -"""Utility routines for running external commands.""" - -import errno -import os -import popen2 -import re -import signal -import threading - -import chakana.error -import chakana.linux -import chakana.threads - -def quote(argument, useTick = 1): - """Quote an argument, or a list of arguments, in order to pass it - through a shell.""" - if type(argument) in (type([]), type(())): - return " ".join(map(quote, argument)) - if useTick and not "'" in argument: - return "'" + argument + "'" - return '"' + argument.replace('\\', '\\\\').replace('"', '\\"').replace( - '`', '\\`').replace('$', '\\$') + '"' - -def softQuote(argument): - """Quote an argument, or a list of arguments, in order to pass it through - a shell if it is necessary. Always quotes with quotation mark, never - with tick.""" - if type(argument) in (type([]), type(())): - return " ".join(map(softQuote, argument)) - if re.match(r'^[\w,./=-]*$', argument): - return argument - else: - return quote(argument, useTick = 0) - -def deQuote(argument): - """Remove quoting in the same manner as the shell (bash) does.""" - if argument == "": - return "" - if argument[0] == "'": - nextQuote = argument.find("'", 1) - if nextQuote == -1: - raise ValueError("Unmatched quote \"'\"") - return argument[1 : nextQuote] + deQuote(argument[nextQuote + 1 :]) - if len(argument) > 1 and argument[-1] == "'": - return argument[1:-1] - elif argument[0] == '"': - ret = [] - index = 1 - try: - while True: - if argument[index] == '"': - return "".join(ret) + deQuote(argument[index + 1 :]) - if argument[index] == '\\': - index += 1 - if argument[index] != '\n': - ret.append(argument[index]) - else: - ret.append(argument[index]) - index += 1 - except IndexError: - raise ValueError("Unmatched quote '\"'") - elif argument[0] == '\\': - if len(argument) == 1: - return argument[0] - if argument[1] != '\n': - return argument[1] + deQuote(argument[2:]) - else: - return argument[2:] - return argument[0] + deQuote(argument[1:]) - - -def runString(argv, environmentVars = ("PYTHONPATH", )): - """Return a quoted string that can be pasted into a shell in order - to rerun a command.""" - - envPrefix = "" - for envVar in environmentVars: - envPrefix += envVar + "=" + os.environ.get(envVar, "") + " " - return "( cd " + os.getcwd() + " && " + envPrefix + quote(argv) + " )" - -class Reader: - def __call__(self, fileObj): - self._data = [] - while 1: - newData = fileObj.read() - if newData == "": - return - self._data.append(newData) - - def result(self): - return "".join(self._data) - -class Writer: - def __init__(self, fileObj, data): - self._fileObj = fileObj - self._data = data - if self._data == "": - self._fileObj.close() - self._threads = [] - else: - self._threads = [threading.Thread(target = self.write)] - self._threads[0].start() - - def write(self): - self._fileObj.write(self._data) - self._fileObj.close() - - def activeThreads(self): - return self._threads - -class Runner: - def __init__(self, child, timeout): - self._child = child - self._timeout = timeout - self._threads = [] - self._output = [] - if self._timeout is None: - self.read() - self.wait() - else: - self._threads.append(threading.Thread(target = self.read)) - self._threads[-1].start() - self._threads.append(threading.Thread(target = self.wait)) - self._threads[-1].start() - - def activeThreads(self): - return self._threads - - def read(self): - while 1: - newData = self._child.fromchild.read() - if newData == "": - return - self._output.append(newData) - - def wait(self): - self._status = self._child.wait() - - def output(self): - return "".join(self._output) - - def status(self): - return self._status - -def output(command, inputData = "", timeout = None): - """Run command in a separate subprocess. Send inputData to stdin. - Kill subprocess and raise error.Timeout after timeout seconds, - unless timeout is None.""" - - # Due to python bug 1183780 (Popen4.wait not thread-safe), avoid - # threads if we don't need them. - - child = popen2.Popen4(command) - writer = Writer(child.tochild, inputData) - runner = Runner(child, timeout) - - try: - chakana.threads.waitForAll(writer.activeThreads() + runner.activeThreads(), - timeout) - except chakana.error.Timeout, timeoutErr: - try: - childProc = chakana.linux.Process(child.pid) - childProc.killAllBelow() - childProc.reallyKill() - except OSError, err: - if not err.errno in (errno.ESRCH, errno.ECHILD): - raise - raise chakana.error.CommandFailed(command, timeoutErr, runner.output()) - - if runner.status() != 0: - raise chakana.error.CommandFailed( - command, runner.status(), runner.output()) - if re.search(r"\blibefence", os.environ.get("LD_PRELOAD", "")): - lines = runner.output().splitlines() - if (len(lines) >= 2) and (lines[0] == "") and \ - lines[1].strip().startswith("Electric Fence "): - return "\n".join(lines[2:] + [""]) - return runner.output() - diff --git a/backyard/tools/chakana/cooja.chakana.properties b/backyard/tools/chakana/cooja.chakana.properties deleted file mode 100644 index 22a543d7f..000000000 --- a/backyard/tools/chakana/cooja.chakana.properties +++ /dev/null @@ -1 +0,0 @@ -DEFAULT_PROJECTDIRS=../cooja_plugin diff --git a/backyard/tools/chakana/cooja_plugin/README b/backyard/tools/chakana/cooja_plugin/README deleted file mode 100644 index 546b92f3b..000000000 --- a/backyard/tools/chakana/cooja_plugin/README +++ /dev/null @@ -1,3 +0,0 @@ -Main Chakana COOJA plugin. - -Communicates with Chakana, and should automatically be started with the simulator. diff --git a/backyard/tools/chakana/cooja_plugin/build.xml b/backyard/tools/chakana/cooja_plugin/build.xml deleted file mode 100644 index f3cdb2394..000000000 --- a/backyard/tools/chakana/cooja_plugin/build.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/backyard/tools/chakana/cooja_plugin/cooja.config b/backyard/tools/chakana/cooja_plugin/cooja.config deleted file mode 100644 index 882383efc..000000000 --- a/backyard/tools/chakana/cooja_plugin/cooja.config +++ /dev/null @@ -1,2 +0,0 @@ -se.sics.cooja.GUI.PLUGINS = + se.sics.chakana.ChakanaPlugin -se.sics.cooja.GUI.JARFILES = + chakana.jar diff --git a/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/ChakanaPlugin.java b/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/ChakanaPlugin.java deleted file mode 100644 index 9b51cde26..000000000 --- a/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/ChakanaPlugin.java +++ /dev/null @@ -1,279 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of the - * Institute nor the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $Id: ChakanaPlugin.java,v 1.1 2009/02/26 13:47:38 fros4943 Exp $ - */ - -package se.sics.chakana; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.PrintWriter; -import java.net.ServerSocket; -import java.net.Socket; -import java.util.Collection; -import javax.swing.SwingUtilities; -import org.apache.log4j.Logger; -import org.jdom.Element; - -import se.sics.cooja.*; - -/** - * Main Chakana plugin. - * - * Provides remote control functionality to COOJA via socket connections. - * - * @see #SERVER_PORT - * @author Fredrik Osterlind - */ -@ClassDescription("Chakana COOJA Server") -@PluginType(PluginType.COOJA_STANDARD_PLUGIN) -public class ChakanaPlugin implements Plugin { - public static final String VERSION = "0.1"; - - /** - * COOJA's Chakana-plugin server port - */ - public static final int SERVER_PORT = 1234; - - private static final long serialVersionUID = 1L; - - private static Logger logger = Logger.getLogger(ChakanaPlugin.class); - - private GUI myGUI; - - // Chakana communication - private Thread serverThread = null; - - private ServerSocket serverSocket = null; - - private Thread clientThread = null; - - private Socket clientSocket = null; - - private EventpointEvaluator myEvaluator = null; - - private XMLCommandHandler myCommandHandler = null; - - private boolean shutdown = false; - - private Object tag = null; - - /** - * Creates new Chakana remote control plugin. - * - * @param gui COOJA Simulator - */ - public ChakanaPlugin(GUI gui) { - myGUI = gui; - - // Create eventpoint evaluator - myEvaluator = new EventpointEvaluator(myGUI); - - // Create remote command handler - myCommandHandler = new XMLCommandHandler(myGUI, this, myEvaluator); - - // Open server socket - serverThread = new Thread(new Runnable() { - public void run() { - try { - serverSocket = new ServerSocket(SERVER_PORT); - logger.info("Chakana server listening on port " + SERVER_PORT + "."); - } catch (Exception e) { - logger.fatal("Could not start server thread: " + e.getMessage()); - return; - } - - // Handle incoming connections - while (serverSocket != null) { - try { - Socket skt = serverSocket.accept(); - handleNewConnection(skt); - } catch (Exception e) { - if (!shutdown) - logger.fatal("Server thread exception: " + e.getMessage()); - if (serverThread != null && serverThread.isInterrupted()) { - serverThread = null; - } - serverSocket = null; - } - } - logger.info("Chakana server thread terminating"); - } - }, "chakana listen thread"); - serverThread.start(); - } - - public void performCOOJAShutdown() { - shutdown = true; - } - - /** - * Handles incoming connection. - * - * @param socket Socket - */ - private void handleNewConnection(Socket socket) { - logger.info("Received request from " + socket.getInetAddress() + ":" - + socket.getPort()); - - if (clientThread != null) { - // Refuse connection - logger.warn("A client is already connected, refusing new connection"); - try { - socket.close(); - } catch (IOException e) { - } - return; - } - - // Start thread handling connection - clientSocket = socket; - clientThread = new Thread(new Runnable() { - public void run() { - try { - // Open stream - PrintWriter writer = new PrintWriter(clientSocket.getOutputStream()); - BufferedReader reader = new BufferedReader(new InputStreamReader(clientSocket - .getInputStream())); - - // Send welcome message - writer.print(XMLCommandHandler.createInfoMessage("Chakana COOJA plugin, version " + VERSION) + "\n"); - writer.flush(); - - // Handle incoming data (blocks until connection terminated) - String line; - String command = ""; - while ((!shutdown) && ((line = reader.readLine()) != null)) { - logger.debug("<-- " + line); - command += line; - - if (myCommandHandler.containsEntireCommand(command)) { - String reply = myCommandHandler.handleCommand(command); - logger.debug("--> " + reply); - writer.print(reply + "\n"); - writer.flush(); - command = ""; - } - } - - logger.debug("Terminating Chakana connection"); - - // Clean up connection - if (writer != null) { - writer.flush(); - writer.close(); - } - if (clientSocket != null && !clientSocket.isClosed()) - clientSocket.close(); - - } catch (IOException e) { - logger.fatal("Client connection exception: " + e); - } - - clientThread = null; - clientSocket = null; - SwingUtilities.invokeLater(new Runnable() { - public void run() { - myGUI.doQuit(false); - } - }); - logger.debug("Chakana client thread terminating"); - } - }, "chakana client thread"); - clientThread.start(); - - } - - /** - * Shut down any open server socket, and kill server thread. - */ - protected void closeServer() { - // Shut down server - if (serverSocket != null && !serverSocket.isClosed()) { - logger.info("Closing server socket"); - try { - serverSocket.close(); - } catch (IOException e) { - logger.fatal("Error when closing server socket: " + e); - } - serverSocket = null; - } - - if (serverThread != null && serverThread.isAlive()) { - logger.info("Interrupting server thread"); - serverThread.interrupt(); - serverThread = null; - } - } - - /** - * Disconnect all connected clients. Currently only one client can be - * connected at the same time. - */ - protected void disconnectClients() { - // Disconnect any current accepted client - if (clientSocket != null && !clientSocket.isClosed()) { - logger.info("Closing client socket"); - try { - clientSocket.close(); - } catch (IOException e) { - logger.fatal("Error when closing client socket: " + e); - } - clientSocket = null; - } - - if (clientThread != null && clientThread.isAlive()) { - logger.info("Interrupting client thread"); - clientThread.interrupt(); - clientThread = null; - } - } - - public void closePlugin() { - closeServer(); - disconnectClients(); - } - - public void tagWithObject(Object tag) { - this.tag = tag; - } - - public Object getTag() { - return tag; - } - - public Collection getConfigXML() { - return null; - } - - public boolean setConfigXML(Collection configXML, - boolean visAvailable) { - return false; - } - -} diff --git a/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/EventpointEvaluator.java b/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/EventpointEvaluator.java deleted file mode 100644 index 1bcb7e386..000000000 --- a/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/EventpointEvaluator.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: EventpointEvaluator.java,v 1.1 2009/02/26 13:47:38 fros4943 Exp $ - */ - -package se.sics.chakana; - -import java.util.Observable; -import java.util.Observer; -import java.util.Vector; -import org.apache.log4j.Logger; - -import se.sics.cooja.GUI; -import se.sics.cooja.Simulation; -import se.sics.chakana.eventpoints.*; - -/** - * Keeps track of all active eventpoints. The control method blocks until any of - * the active eventpoints trigger. - * - * @author Fredrik Osterlind - */ -public class EventpointEvaluator { - private static Logger logger = Logger.getLogger(EventpointEvaluator.class); - - private GUI myGUI; - private Vector allEventpoints; - private Eventpoint lastTriggeredEventpoint; - private Simulation sim = null; - - private int counterEventpointID = 0; - - private Observer tickObserver = new Observer() { - public void update(Observable obs, Object obj) { - // Evaluate active eventpoints - for (Eventpoint eventpoint: allEventpoints) { - if (eventpoint.evaluate()) { - lastTriggeredEventpoint = eventpoint; - sim.stopSimulation(); - logger.info("Eventpoint triggered: " + eventpoint); - } - } - } - }; - - /** - * Creates a new eventpoint evaluator. - * - * @param gui GUI with simulation - */ - public EventpointEvaluator(GUI gui) { - myGUI = gui; - allEventpoints = new Vector(); - } - - - /** - * Blocks until an active eventpoint triggers. - * - * @return Triggered eventpoint - * @throws EventpointException At evenpoint setup errors - */ - public Eventpoint resumeSimulation() throws EventpointException { - if (myGUI.getSimulation() == null) - throw new EventpointException("No simulation to observe"); - if (allEventpoints == null || allEventpoints.isEmpty()) - throw new EventpointException("No eventpoints exist"); - - // Make sure tick observer is observing the current simulation - myGUI.getSimulation().deleteTickObserver(tickObserver); - myGUI.getSimulation().addTickObserver(tickObserver); - - // Evaluate active eventpoints before starting simulation - for (Eventpoint eventpoint: allEventpoints) { - if (eventpoint.evaluate()) { - lastTriggeredEventpoint = eventpoint; - logger.info("Eventpoint triggered (EARLY): " + eventpoint); - return lastTriggeredEventpoint; - } - } - - // Reset last triggered eventpoint and start simulation - lastTriggeredEventpoint = null; - sim = myGUI.getSimulation(); - sim.startSimulation(); - - // Block until tickobserver stops simulation - while (lastTriggeredEventpoint == null || myGUI.getSimulation().isRunning()) { - Thread.yield(); - } - - if (lastTriggeredEventpoint == null) - throw new EventpointException("Simulation was stopped without eventpoint triggering"); - - return lastTriggeredEventpoint; - } - - public Eventpoint getTriggeredEventpoint() { - return lastTriggeredEventpoint; - } - - public int getLastTriggeredEventpointID() { - return lastTriggeredEventpoint.getID(); - } - - public Eventpoint getEventpoint(int id) { - for (Eventpoint eventpoint: allEventpoints) { - if (eventpoint.getID() == id) { - return eventpoint; - } - } - return null; - } - - public void addEventpoint(Eventpoint eventpoint) { - eventpoint.setID(counterEventpointID++); - allEventpoints.add(eventpoint); - } - - public void clearAllEventpoints() { - allEventpoints.clear(); - } - - public void deleteEventpoint(int id) { - Eventpoint eventpointToDelete = null; - for (Eventpoint eventpoint: allEventpoints) { - if (eventpoint.getID() == id) { - eventpointToDelete = eventpoint; - break; - } - } - - if (eventpointToDelete != null) - allEventpoints.remove(eventpointToDelete); - } - - class EventpointException extends Exception { - public EventpointException(String message) { - super(message); - } - } - -} diff --git a/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/XMLCommandHandler.java b/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/XMLCommandHandler.java deleted file mode 100644 index 031a35cdd..000000000 --- a/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/XMLCommandHandler.java +++ /dev/null @@ -1,1159 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: XMLCommandHandler.java,v 1.1 2009/02/26 13:47:38 fros4943 Exp $ - */ - -package se.sics.chakana; - -import java.io.File; -import java.io.IOException; -import java.io.StringReader; -import java.lang.reflect.Constructor; -import java.lang.reflect.Method; -import java.util.Collection; -import javax.swing.JFrame; -import javax.swing.JInternalFrame; - -import org.apache.log4j.Logger; -import org.jdom.Document; -import org.jdom.Element; -import org.jdom.JDOMException; -import org.jdom.input.SAXBuilder; - -import se.sics.chakana.EventpointEvaluator.EventpointException; -import se.sics.chakana.eventpoints.*; -import se.sics.cooja.AddressMemory; -import se.sics.cooja.CoreComm; -import se.sics.cooja.GUI; -import se.sics.cooja.Mote; -import se.sics.cooja.MoteMemory; -import se.sics.cooja.RadioMedium; -import se.sics.cooja.Simulation; -import se.sics.cooja.Mote.State; -import se.sics.cooja.MoteType.MoteTypeCreationException; -import se.sics.cooja.dialogs.MessageList; -import se.sics.cooja.plugins.VisState; -import se.sics.cooja.plugins.Visualizer2D; -import se.sics.cooja.radiomediums.UDGM; - -/** - * Handles incoming XML commands. - * Each command handling call blocks during handling and returns a reply to the client. - * - * A command must always be of the form: - * ... - * - * @author Fredrik Osterlind - */ -public class XMLCommandHandler { - public static final boolean DEBUG_OUTPUT = true; - - private static Logger logger = Logger.getLogger(XMLCommandHandler.class); - - public static final String XML_OK = ""; - public static final String XML_OK_START = ""; - public static final String XML_OK_END = ""; - - public static final String XML_INFO_START = ""; - public static final String XML_INFO_END = ""; - public static final String XML_ERROR_START = ""; - public static final String XML_ERROR_END = ""; - - public static final String XML_COMMAND_NAME = "command"; - public static final String XML_COMMAND_END = ""; - - public static final String XML_EVENTPOINT_START = ""; - public static final String XML_EVENTPOINT_END = ""; - - public static final String XML_ID_NAME = "id"; - public static final String XML_TYPE_NAME = "type"; - public static final String XML_MOTE_NAME = "mote"; - public static final String XML_VARIABLE_NAME = "variable"; - public static final String XML_MOTECOUNT_NAME = "motecount"; - public static final String XML_VALUE_NAME = "value"; - public static final String XML_TIME_NAME = "time"; - public static final String XML_SIZE_NAME = "size"; - public static final String XML_ADDRESS_NAME = "address"; - public static final String XML_VISIBLE_NAME = "visible"; - public static final String XML_TRIGGERON_NAME = "triggeron"; - public static final String XML_WATCHPOINT_INT = "int"; - public static final String XML_WATCHPOINT_VARIABLE = "variable"; - public static final String XML_WATCHPOINT_ADDRESS = "address"; - public static final String XML_TIMEPOINT_SIMULATION = "time"; - public static final String XML_TIMEPOINT_REAL = "realtime"; - public static final String XML_EVENTPOINT_RADIOMEDIUM = "radiomedium"; - - private GUI myGUI; - private EventpointEvaluator myEvaluator; - private ChakanaPlugin myParent; - - public enum Command { - CREATE_SIM, - CONF_SIM, - CONF_PLUGINS, - CONTROL_SIM, - SET_GUI, - ADD_EVENTPOINT, - READ_MEMORY, - WRITE_MEMORY, - CLEAR_EVENTPOINTS, - DELETE_EVENTPOINT, - KILL_NODES, - GET_INFO, - CUSTOM_COMMAND, - EXIT_COOJA; - } - - public enum ControlSimulationCommand { - RESUME; - } - - /** - * TODO Document - * - * @param gui - * @param parent - * @param evaluator - */ - public XMLCommandHandler(GUI gui, ChakanaPlugin parent, EventpointEvaluator evaluator) { - myGUI = gui; - myEvaluator = evaluator; - myParent = parent; - } - - /** - * @param command - * @return - */ - public boolean containsEntireCommand(String command) { - return command.contains(XMLCommandHandler.XML_COMMAND_END); // TODO Ugly trick - } - - /** - * Handle given command (XML format). - * Method blocks until given command has been handled. - * - * @param command - * Command to handle - * @return Reply to client in XML format - */ - public String handleCommand(String command) { - try { - SAXBuilder builder = new SAXBuilder(); - Document doc = builder.build(new StringReader(command)); - Element root = doc.getRootElement(); - - if (!root.getName().equals(XML_COMMAND_NAME)) { - return createErrorMessage("Malformed command: " + root.getName()); - } - - String cmdTypeString = root.getAttributeValue("value"); - Command cmdType; - try { - cmdType = Command.valueOf(cmdTypeString); - } catch (IllegalArgumentException e) { - return createErrorMessage("Unknown command: " + cmdTypeString); - } - - Collection cmdInfo = root.getChildren(); - - logger.debug("Command type: " + cmdType); - switch (cmdType) { - case CREATE_SIM: - return createSimulation(cmdInfo); - case CONF_SIM: - return configureSimulation(cmdInfo); - case CONF_PLUGINS: - return configurePlugins(cmdInfo); - case CONTROL_SIM: - return controlSimulation(cmdInfo); - case ADD_EVENTPOINT: - return addEventpoint(cmdInfo); - case SET_GUI: - return configureGUI(cmdInfo); - case READ_MEMORY: - return readMemory(cmdInfo); - case WRITE_MEMORY: - return writeMemory(cmdInfo); - case CLEAR_EVENTPOINTS: - return clearEventpoints(); - case DELETE_EVENTPOINT: - return deleteEventpoint(cmdInfo); - case KILL_NODES: - return killNodes(cmdInfo); - case GET_INFO: - return getInfo(cmdInfo); - case CUSTOM_COMMAND: - return handleCustomCommand(cmdInfo); - case EXIT_COOJA: - return shutdownCOOJA(cmdInfo); - default: - return createErrorMessage("Unknown command: " + cmdType); - } - } catch (JDOMException e) { - logger.fatal("Command parsing exception: " + e); - return createErrorMessage("Invalid command syntax: " + e.getMessage()); - } catch (IOException e) { - logger.fatal("Command parsing exception: " + e); - return createErrorMessage("Invalid command syntax: " + e.getMessage()); - } - } - - /** - * Handle create new simulation command. - * - * @param arguments Command arguments - * @return Reply to client (XML format) - */ - private String createSimulation(Collection arguments) { - Simulation simulation = new Simulation(myGUI); - simulation.setTitle("[chakana - no title]"); - simulation.setDelayTime(0); - simulation.setSimulationTime(0); - simulation.setTickTime(1); - - try { - RadioMedium radioMedium = RadioMedium.generateRadioMedium(UDGM.class, - simulation); - simulation.setRadioMedium(radioMedium); - } catch (Exception e) { - return createErrorMessage("Create simulation: Could not create radio medium: " + e.getMessage()); - } - - // Let simulation parse command arguments - myGUI.setSimulation(simulation); - try { - boolean success = simulation.setConfigXML(arguments, false); - } catch (Exception e) { - logger.fatal("Error when configuring simulation: " + e); - if (DEBUG_OUTPUT) { - if (e instanceof MoteTypeCreationException) { - MessageList compilationOutput = ((MoteTypeCreationException) e).getCompilationOutput(); - if (compilationOutput != null) { - logger.info("Compilation output:"); - for(int i = 0; i < compilationOutput.getModel().getSize(); i++) { - logger.info(compilationOutput.getModel().getElementAt(i)); - } - } - StackTraceElement[] stackTrace = e.getStackTrace(); - if (stackTrace != null) { - logger.info("Stack trace:"); - for(StackTraceElement element: stackTrace) { - logger.info(element); - } - } - GUI.showErrorDialog(new JFrame(""), "Set DEBUG_OUTPUT to false to disable this frame", e, false); // XXX Graphical component - } - } - return createErrorMessage("Create simulation: Could not configure simulation: " + e.getMessage()); - } - - return XML_OK; - } - - /** - * Handle configure simulation command. - * - * @param arguments Command arguments - * @return Reply to client (XML format) - */ - private String configureSimulation(Collection arguments) { - Simulation simulation = myGUI.getSimulation(); - - // Let simulation parse command arguments - try { - simulation.setConfigXML(arguments, false); - } catch (Exception e) { - logger.fatal("Error when configuring simulation: " + e); - e.printStackTrace(); - return createErrorMessage("Could not configure simulation: " + e.getMessage()); - } - return XML_OK; - } - - /** - * Handle configure plugins command. - * - * @param arguments Command arguments - * @return Reply to client (XML format) - */ - private String configurePlugins(Collection arguments) { - Simulation simulation = myGUI.getSimulation(); - - // Let GUI parse command arguments - try { - myGUI.setPluginsConfigXML(arguments, simulation, false); - } catch (Exception e) { - logger.fatal("Error when configuring plugins: " + e); - return createErrorMessage("Could not configure plugins: " + e.getMessage()); - } - - return XML_OK; - } - - /** - * Handle control simulation command. - * - * @param arguments Command arguments - * @return Reply to client (XML format) - */ - private String controlSimulation(Collection arguments) { - String reply = ""; - - for (Element element : arguments) { - ControlSimulationCommand cmdType; - try { - cmdType = ControlSimulationCommand.valueOf(element.getName()); - } catch (IllegalArgumentException e) { - return createErrorMessage("Unknown simulation control command: " + element.getName()); - } - - switch (cmdType) { - case RESUME: - // TODO Check performance degradation using try-blocks - try { - myEvaluator.resumeSimulation(); - reply += createEventpointMessage(myEvaluator); - } catch (EventpointException e) { - return createErrorMessage("Exception during simulation: " + e); - } - break; - default: - return createErrorMessage("Unknown simulation control command"); - } - } - return reply; - } - - /** - * Handle exit COOJA command. - * - * @param arguments Command arguments - * @return Reply to client (XML format) - */ - private String shutdownCOOJA(Collection arguments) { - myParent.performCOOJAShutdown(); - logger.info("Shutdown requested"); - return XML_OK; - } - - /** - * Fetch mote variable value as specified by arguments. - * - * @param arguments Command arguments - * @return Reply to client (XML format) - */ - private String readMemory(Collection arguments) { - Simulation simulation = myGUI.getSimulation(); - - String type = null; - String mote = null; - String variable = null; - String size = null; - String address = null; - - for (Element element : arguments) { - if (element.getName().equals(XML_TYPE_NAME)) { - type = element.getText(); - } else if (element.getName().equals(XML_MOTE_NAME)) { - mote = element.getText(); - } else if (element.getName().equals(XML_VARIABLE_NAME)) { - variable = element.getText(); - } else if (element.getName().equals(XML_SIZE_NAME)) { - size = element.getText(); - } else if (element.getName().equals(XML_ADDRESS_NAME)) { - address = element.getText(); - } else { - return createErrorMessage("Unknown read memory parameter: " + element.getName()); - } - } - - if (type == null) - return createErrorMessage("No read memory type specified"); - if (mote == null) - return createErrorMessage("No mote specified"); - - if (mote == null) - return createErrorMessage("No mote ID specified"); - int moteNr = Integer.parseInt(mote); - if (moteNr < 0 || simulation.getMotesCount() <= moteNr) { - return createErrorMessage("Bad mote ID specified: " + moteNr); - } - MoteMemory memory = simulation.getMote(moteNr).getMemory(); - - // Read integer variable - if (type.equals("int")) { - if (variable == null) - return createErrorMessage("No variable name specified"); - if (variable.contains(" ")) - return createErrorMessage("Variable name must not contain spaces: " + variable); - - if (!(memory instanceof AddressMemory)) - return createErrorMessage("Can't read mote memory variables (not address memory)"); - - if (!((AddressMemory) memory).variableExists(variable)) { - return createErrorMessage("Variable does not exist: " + variable); - } - - int val = ((AddressMemory) memory).getIntValueOf(variable); - return XML_OK_START + val + XML_OK_END; - } else if (type.equals("variable")) { - if (variable == null) - return createErrorMessage("No variable name specified"); - if (variable.contains(" ")) - return createErrorMessage("Variable name must not contain spaces: " + variable); - - if (!(memory instanceof AddressMemory)) - return createErrorMessage("Can't read mote memory variables (not address memory)"); - - if (!((AddressMemory) memory).variableExists(variable)) { - return createErrorMessage("Variable does not exist: " + variable); - } - - if (size == null) - return createErrorMessage("No size specified"); - int sizeParsed = Integer.parseInt(size); - if (sizeParsed < 0) { - return createErrorMessage("Bad size specified: " + sizeParsed); - } - - byte[] val = ((AddressMemory) memory).getByteArray(variable, sizeParsed); - String ret = ""; - for (byte b: val) - ret += (int) (0xff&b) + " "; - ret = ret.trim(); - return XML_OK_START + ret + XML_OK_END; - } else if (type.equals("address")) { - - if (size == null) - return createErrorMessage("No size specified"); - int sizeParsed = Integer.parseInt(size); - if (sizeParsed < 0) { - return createErrorMessage("Bad size specified: " + sizeParsed); - } - - int addressParsed = Integer.parseInt(address); - if (addressParsed < 0) { - return createErrorMessage("Bad start address specified: " + addressParsed); - } - - byte[] val = memory.getMemorySegment(addressParsed, sizeParsed); - String ret = ""; - for (byte b: val) - ret += (int) (0xff&b) + " "; - ret = ret.trim(); - return XML_OK_START + ret + XML_OK_END; - } - - return createErrorMessage("Bad read memory type specified: " + type); - } - - /** - * Write mote variable value as specified by arguments. - * - * @param arguments Command arguments - * @return Reply to client (XML format) - */ - private String writeMemory(Collection arguments) { - Simulation simulation = myGUI.getSimulation(); - - String type = null; - String mote = null; - String variable = null; - String size = null; - String address = null; - String value = null; - - for (Element element : arguments) { - if (element.getName().equals(XML_TYPE_NAME)) { - type = element.getText(); - } else if (element.getName().equals(XML_MOTE_NAME)) { - mote = element.getText(); - } else if (element.getName().equals(XML_VARIABLE_NAME)) { - variable = element.getText(); - } else if (element.getName().equals(XML_SIZE_NAME)) { - size = element.getText(); - } else if (element.getName().equals(XML_ADDRESS_NAME)) { - address = element.getText(); - } else if (element.getName().equals(XML_VALUE_NAME)) { - value = element.getText(); - } else { - return createErrorMessage("Unknown write memory parameter: " + element.getName()); - } - } - - if (type == null) - return createErrorMessage("No write memory type specified"); - if (mote == null) - return createErrorMessage("No mote specified"); - - if (mote == null) - return createErrorMessage("No mote ID specified"); - int moteNr = Integer.parseInt(mote); - if (moteNr < 0 || simulation.getMotesCount() <= moteNr) { - return createErrorMessage("Bad mote ID specified: " + moteNr); - } - MoteMemory memory = simulation.getMote(moteNr).getMemory(); - - // Write integer variable - if (type.equals("int")) { - if (variable == null) - return createErrorMessage("No variable name specified"); - if (variable.contains(" ")) - return createErrorMessage("Variable name must not contain spaces: " + variable); - - if (!(memory instanceof AddressMemory)) - return createErrorMessage("Can't read mote memory variables (not address memory)"); - - if (!((AddressMemory) memory).variableExists(variable)) { - return createErrorMessage("Variable does not exist: " + variable); - } - - if (value == null) - return createErrorMessage("No value specified"); - if (value.contains(" ")) - return createErrorMessage("Integer value must not contain spaces: " + value); - - int val; - try { - val = Integer.parseInt(value); - } catch (NumberFormatException e) { - return createErrorMessage("Bad integer value specified: " + e); - } - - ((AddressMemory) memory).setIntValueOf(variable, val); - return XML_OK; - } else if (type.equals("variable")) { - if (variable == null) - return createErrorMessage("No variable name specified"); - if (variable.contains(" ")) - return createErrorMessage("Variable name must not contain spaces: " + variable); - - if (!(memory instanceof AddressMemory)) - return createErrorMessage("Can't read mote memory variables (not address memory)"); - - if (!((AddressMemory) memory).variableExists(variable)) { - return createErrorMessage("Variable does not exist: " + variable); - } - - if (size == null) - return createErrorMessage("No size specified"); - int sizeParsed = Integer.parseInt(size); - if (sizeParsed < 0) { - return createErrorMessage("Bad size specified: " + sizeParsed); - } - - if (value == null) - return createErrorMessage("No value specified"); - String[] bytesParsed = value.split(" "); - if (bytesParsed.length != sizeParsed) - return createErrorMessage("Number of bytes and specified size does not match: " + bytesParsed.length + "!=" + sizeParsed); - - byte[] val = new byte[bytesParsed.length]; - for (int i=0; i < sizeParsed; i++) { - val[i] = Byte.parseByte(bytesParsed[i]); - } - - ((AddressMemory) memory).setByteArray(variable, val); - return XML_OK; - } else if (type.equals("address")) { - - if (size == null) - return createErrorMessage("No size specified"); - int sizeParsed = Integer.parseInt(size); - if (sizeParsed < 0) { - return createErrorMessage("Bad size specified: " + sizeParsed); - } - - int addressParsed = Integer.parseInt(address); - if (addressParsed < 0) { - return createErrorMessage("Bad start address specified: " + addressParsed); - } - - if (value == null) - return createErrorMessage("No value specified"); - String[] bytesParsed = value.split(" "); - if (bytesParsed.length != sizeParsed) - return createErrorMessage("Number of bytes and specified size does not match: " + bytesParsed.length + "!=" + sizeParsed); - - byte[] val = new byte[bytesParsed.length]; - for (int i=0; i < sizeParsed; i++) { - val[i] = Byte.parseByte(bytesParsed[i]); - } - - memory.setMemorySegment(addressParsed, val); - return XML_OK; - } - - return createErrorMessage("Bad write memory type specified: " + type); - } - - /** - * Handle add new eventpoint command. - * - * @param arguments Command arguments - * @return Reply to client (XML format) - */ - private String addEventpoint(Collection arguments) { - Simulation simulation = myGUI.getSimulation(); - - String type = null; - String mote = null; - String variable = null; - String time = null; - String size = null; - String triggeron = null; - String address = null; - String count = null; - - for (Element element : arguments) { - if (element.getName().equals(XML_TYPE_NAME)) { - type = element.getText(); - } else if (element.getName().equals(XML_MOTE_NAME)) { - mote = element.getText(); - } else if (element.getName().equals(XML_VARIABLE_NAME)) { - variable = element.getText(); - } else if (element.getName().equals(XML_TIME_NAME)) { - time = element.getText(); - } else if (element.getName().equals(XML_SIZE_NAME)) { - size = element.getText(); - } else if (element.getName().equals(XML_ADDRESS_NAME)) { - address = element.getText(); - } else if (element.getName().equals(XML_TRIGGERON_NAME)) { - triggeron = element.getText(); - } else if (element.getName().equals("count")) { - count = element.getText(); - } else { - return createErrorMessage("Unknown eventpoint parameter: " + element.getName()); - } - } - - logger.debug("Eventpoint type: " + type); - if (type == null) - return createErrorMessage("No eventpoint type specified"); - - // Integer variable watchpoint - if (type.equals(XML_WATCHPOINT_INT)) { - if (variable == null) - return createErrorMessage("No variable name specified"); - if (variable.contains(" ")) - return createErrorMessage("Variable name must not contain spaces: " + variable); - if (mote == null) - return createErrorMessage("No mote ID specified"); - int moteNr = Integer.parseInt(mote); - if (moteNr < 0 || simulation.getMotesCount() <= moteNr) { - return createErrorMessage("Bad mote ID specified: " + moteNr); - } - Mote moteObject = simulation.getMote(moteNr); - - MoteMemory memory = simulation.getMote(moteNr).getMemory(); - - if (!(memory instanceof AddressMemory)) - return createErrorMessage("Can't write mote memory variables (not address memory)"); - - if (!((AddressMemory) memory).variableExists(variable)) { - return createErrorMessage("Variable does not exist: " + variable); - } - - Eventpoint newEventpoint = new IntegerWatchpoint(moteObject, variable); - myEvaluator.addEventpoint(newEventpoint); - return createOkMessage(newEventpoint, simulation.getSimulationTime()); - } - - // Variable watchpoint - if (type.equals(XML_WATCHPOINT_VARIABLE)) { - if (variable == null) - return createErrorMessage("No variable name specified"); - if (variable.contains(" ")) - return createErrorMessage("Variable name must not contain spaces: " + variable); - if (mote == null) - return createErrorMessage("No mote ID specified"); - if (size == null) - return createErrorMessage("No size specified"); - int sizeParsed = Integer.parseInt(size); - if (sizeParsed < 0) { - return createErrorMessage("Bad size specified: " + sizeParsed); - } - int moteNr = Integer.parseInt(mote); - if (moteNr < 0 || simulation.getMotesCount() <= moteNr) { - return createErrorMessage("Bad mote ID specified: " + moteNr); - } - Mote moteObject = simulation.getMote(moteNr); - - MoteMemory memory = simulation.getMote(moteNr).getMemory(); - - if (!(memory instanceof AddressMemory)) - return createErrorMessage("Can't write mote memory variables (not address memory)"); - - if (!((AddressMemory) memory).variableExists(variable)) { - return createErrorMessage("Variable does not exist: " + variable); - } - - Eventpoint newEventpoint = new VariableWatchpoint(moteObject, variable, sizeParsed); - myEvaluator.addEventpoint(newEventpoint); - return createOkMessage(newEventpoint, simulation.getSimulationTime()); - } - - - // Memory area watchpoint - if (type.equals(XML_WATCHPOINT_ADDRESS)) { - if (mote == null) - return createErrorMessage("No mote ID specified"); - if (size == null) - return createErrorMessage("No size specified"); - int sizeParsed = Integer.parseInt(size); - if (sizeParsed < 0) { - return createErrorMessage("Bad size specified: " + sizeParsed); - } - int addressParsed = Integer.parseInt(address); - if (addressParsed < 0) { - return createErrorMessage("Bad start address specified: " + addressParsed); - } - int moteNr = Integer.parseInt(mote); - if (moteNr < 0 || simulation.getMotesCount() <= moteNr) { - return createErrorMessage("Bad mote ID specified: " + moteNr); - } - Mote moteObject = simulation.getMote(moteNr); - MoteMemory memory = simulation.getMote(moteNr).getMemory(); - - Eventpoint newEventpoint = new Watchpoint(moteObject, addressParsed, sizeParsed); - myEvaluator.addEventpoint(newEventpoint); - return createOkMessage(newEventpoint, simulation.getSimulationTime()); - } - - // Simulation timepoint - if (type.equals(XML_TIMEPOINT_SIMULATION)) { - if (time == null) - return createErrorMessage("No time specified"); - int timeParsed = Integer.parseInt(time); - if (timeParsed < 0) { - return createErrorMessage("Bad time specified: " + timeParsed); - } - - Eventpoint newEventpoint = new SimulationTimepoint(simulation, timeParsed); - myEvaluator.addEventpoint(newEventpoint); - return createOkMessage(newEventpoint, simulation.getSimulationTime()); - } - - // Real timepoint - if (type.equals(XML_TIMEPOINT_REAL)) { - if (time == null) - return createErrorMessage("No time specified"); - long timeParsed = Long.parseLong(time); - if (timeParsed < 0) { - return createErrorMessage("Bad time specified: " + timeParsed); - } - - Eventpoint newEventpoint = new RealTimepoint(timeParsed); - myEvaluator.addEventpoint(newEventpoint); - return createOkMessage(newEventpoint, simulation.getSimulationTime()); - } - - // Radio medium event point - if (type.equals(XML_EVENTPOINT_RADIOMEDIUM)) { - int countInt; - try { - countInt = Integer.parseInt(count); - } catch (NumberFormatException e) { - return createErrorMessage("Bad count specified: " + e); - } - - if (triggeron == null || triggeron.equals("all")) { - Eventpoint newEventpoint = new RadioMediumEventpoint(simulation.getRadioMedium(), countInt); - myEvaluator.addEventpoint(newEventpoint); - return createOkMessage(newEventpoint, simulation.getSimulationTime()); - } else if (triggeron.equals("completed")) { - Eventpoint newEventpoint = new TransmissionRadioMediumEventpoint(simulation.getRadioMedium(), countInt); - myEvaluator.addEventpoint(newEventpoint); - return createOkMessage(newEventpoint, simulation.getSimulationTime()); - } else { - return createErrorMessage("Bad trigger on parameter: " + triggeron); - } - } - - return createErrorMessage("Bad eventpoint type specified: " + type); - } - - /** - * Handle configure GUI command. - * - * @param arguments Command arguments - * @return Reply to client (XML format) - */ - private String configureGUI(Collection arguments) { - String visible = null; - - for (Element element : arguments) { - if (element.getName().equals(XML_VISIBLE_NAME)) { - visible = element.getText(); - } else { - return createErrorMessage("Unknown GUI configure parameter: " + element.getName()); - } - } - - boolean shouldBeVisible = Boolean.parseBoolean(visible); - if (myGUI.isVisualized() != shouldBeVisible) { - myGUI.setVisualized(shouldBeVisible); - } - return XML_OK; - } - - /** - * Handle delete eventpoint command. - * - * @param arguments Command arguments - * @return Reply to client (XML format) - */ - private String deleteEventpoint(Collection arguments) { - String id = null; - - for (Element element : arguments) { - if (element.getName().equals(XML_ID_NAME)) { - id = element.getText(); - } else { - return createErrorMessage("Unknown eventpoint parameter: " + element.getName()); - } - } - - int idInt; - try { - idInt = Integer.parseInt(id); - } catch (NumberFormatException e) { - return createErrorMessage("Bad eventpoint ID specified: " + e); - } - - Eventpoint eventpoint = myEvaluator.getEventpoint(idInt); - if (eventpoint == null) - return createErrorMessage("No eventpoint with ID " + idInt + " exists"); - - myEvaluator.deleteEventpoint(idInt); - return XML_OK; - } - - /** - * Handle kill nodes command. - * - * @param arguments Command arguments - * @return Reply to client (XML format) - */ - private String killNodes(Collection arguments) { - String lowId = null; - String highId = null; - - for (Element element : arguments) { - if (element.getName().equals("lowmote")) { - lowId = element.getText(); - } else if (element.getName().equals("highmote")) { - highId = element.getText(); - } else { - return createErrorMessage("Unknown eventpoint parameter: " + element.getName()); - } - } - - int lowIdInt; - int highIdInt; - try { - lowIdInt = Integer.parseInt(lowId); - highIdInt = Integer.parseInt(highId); - } catch (NumberFormatException e) { - return createErrorMessage("Bad mote interval specified: " + e); - } - - if (lowIdInt > highIdInt) - return createErrorMessage("Bad mote interval specified: Low ID must be <= than high ID"); - - if (lowIdInt < 0) - return createErrorMessage("Bad mote interval specified: Low ID >= 0"); - - if (myGUI.getSimulation() == null) - return createErrorMessage("No simulation exists"); - - if (myGUI.getSimulation().getMotesCount() < highIdInt) - return createErrorMessage("Bad mote interval specified: Only " + myGUI.getSimulation().getMotesCount() + " motes exist"); - - for (int pos=lowIdInt; pos <= highIdInt; pos++) { - Mote mote = myGUI.getSimulation().getMote(pos); - mote.setState(State.DEAD); - } - return XML_OK; - } - - /** - * Handle get info command. - * - * @param arguments Command arguments - * @return Reply to client (XML format) - */ - private String getInfo(Collection arguments) { - Simulation simulation = myGUI.getSimulation(); - String type = null; - String mote = null; - String variable = null; - - for (Element element : arguments) { - if (element.getName().equals(XML_TYPE_NAME)) { - type = element.getText(); - } else if (element.getName().equals(XML_MOTE_NAME)) { - mote = element.getText(); - } else if (element.getName().equals(XML_VARIABLE_NAME)) { - variable = element.getText(); - } else { - return createErrorMessage("Unknown info parameter: " + element.getName()); - } - } - - if (type.equals("motestate")) { - if (mote == null) - return createErrorMessage("No mote ID specified"); - int moteNr = Integer.parseInt(mote); - if (moteNr < 0 || simulation.getMotesCount() <= moteNr) { - return createErrorMessage("Bad mote ID specified: " + moteNr); - } - - State state = simulation.getMote(moteNr).getState(); - if (state == State.DEAD) - return XML_OK_START + 0 + XML_OK_END; - return XML_OK_START + 1 + XML_OK_END; - - } else if (type.equals("time")) { - return XML_OK_START + myGUI.getSimulation().getSimulationTime() + XML_OK_END; - } else if (type.equals(XML_MOTECOUNT_NAME)) { - return XML_OK_START + myGUI.getSimulation().getMotesCount() + XML_OK_END; - } else if (type.equals("var_address")) { - if (variable == null) - return createErrorMessage("No variable name specified"); - if (variable.contains(" ")) - return createErrorMessage("Variable name must not contain spaces: " + variable); - if (mote == null) - return createErrorMessage("No mote ID specified"); - int moteNr = Integer.parseInt(mote); - if (moteNr < 0 || simulation.getMotesCount() <= moteNr) { - return createErrorMessage("Bad mote ID specified: " + moteNr); - } - Mote moteObject = simulation.getMote(moteNr); - MoteMemory memory = simulation.getMote(moteNr).getMemory(); - - if (!(memory instanceof AddressMemory)) - return createErrorMessage("Can't read mote memory variable address (not address memory)"); - - if (!((AddressMemory) memory).variableExists(variable)) { - return createErrorMessage("Variable does not exist: " + variable); - } - - int address = ((AddressMemory) memory).getVariableAddress(variable); - return XML_OK_START + address + XML_OK_END; - } - - return createErrorMessage("Unknown type: " + type); - } - - - /** - * Handle custom command. - * - * @param arguments Command arguments - * @return Reply to client (XML format) - */ - private String handleCustomCommand(Collection arguments) { - Simulation simulation = myGUI.getSimulation(); - String action = null; - int id = -1; - int visible = -1; - int hide = -1; - - for (Element element : arguments) { - if (element.getName().equals("action")) { - action = element.getText(); - } else if (element.getName().equals("id")) { - String idString = element.getText(); - id = Integer.parseInt(idString); - } else if (element.getName().equals("hide")) { - String hideString = element.getText(); - hide = Integer.parseInt(hideString); - } else if (element.getName().equals("visible")) { - String visibleString = element.getText(); - visible = Integer.parseInt(visibleString); - } else { - return createErrorMessage("Unknown info parameter: " + element.getName()); - } - } - - if (action.equals("CLICK_SINK")) { - simulation.getMote(0).getInterfaces().getButton().clickButton(); - return XML_OK; - } - - if (action.equals("SHOW_FIRE")) { - if (!simulation.getGUI().isVisualized()) - return XML_OK; - - JInternalFrame[] allPlugins = simulation.getGUI().getDesktopPane().getAllFrames(); - - try { - Class pluginClass = (Class) simulation.getGUI().tryLoadClass(this, Visualizer2D.class, "se.sics.runes.RunesVis"); - Class[] parameterTypes = new Class[1]; - parameterTypes[0] = Boolean.TYPE; - Method method = pluginClass.getMethod("showFire", parameterTypes); - Object[] parameterArguments = new Object[1]; - parameterArguments[0] = new Boolean(visible==1?true:false); - - for (JInternalFrame plugin: allPlugins) { - if (plugin.getClass() == pluginClass) { - method.invoke(plugin, parameterArguments); - } - } - - } catch (Exception e) { - return createErrorMessage("Exception: " + e.getMessage()); - } - return XML_OK; - } - - if (action.equals("RESET_COLORS")) { - if (!simulation.getGUI().isVisualized()) - return XML_OK; - - JInternalFrame[] allPlugins = simulation.getGUI().getDesktopPane().getAllFrames(); - - try { - Class pluginClass = (Class) simulation.getGUI().tryLoadClass(this, Visualizer2D.class, "se.sics.runes.RunesVis"); - Class[] parameterTypes = new Class[0]; - Method method = pluginClass.getMethod("resetColors", parameterTypes); - Object[] parameterArguments = new Object[0]; - - for (JInternalFrame plugin: allPlugins) { - if (plugin.getClass() == pluginClass) { - method.invoke(plugin, parameterArguments); - } - } - - } catch (Exception e) { - return createErrorMessage("Exception: " + e.getMessage()); - } - return XML_OK; - } - - if (action.equals("SHOW_TRUCK")) { - if (!simulation.getGUI().isVisualized()) - return XML_OK; - - JInternalFrame[] allPlugins = simulation.getGUI().getDesktopPane().getAllFrames(); - - try { - Class pluginClass = (Class) simulation.getGUI().tryLoadClass(this, Visualizer2D.class, "se.sics.runes.RunesVis"); - - if (hide == 0) { - Class[] parameterTypes = new Class[0]; - Method method = pluginClass.getMethod("showTruck", parameterTypes); - Object[] parameterArguments = new Object[0]; - - for (JInternalFrame plugin: allPlugins) { - if (plugin.getClass() == pluginClass) { - method.invoke(plugin, parameterArguments); - } - } - } else { - Class[] parameterTypes = new Class[0]; - Method method = pluginClass.getMethod("hideTruck", parameterTypes); - Object[] parameterArguments = new Object[0]; - - for (JInternalFrame plugin: allPlugins) { - if (plugin.getClass() == pluginClass) { - method.invoke(plugin, parameterArguments); - } - } - } - - } catch (Exception e) { - return createErrorMessage("Exception: " + e.getMessage()); - } - return XML_OK; - } - - if (action.equals("INDICATE_MOTE")) { - if (!simulation.getGUI().isVisualized()) - return XML_OK; - - JInternalFrame[] allPlugins = simulation.getGUI().getDesktopPane().getAllFrames(); - - try { - Class pluginClass = (Class) simulation.getGUI().tryLoadClass(this, Visualizer2D.class, "se.sics.runes.RunesVis"); - Class[] parameterTypes = new Class[1]; - parameterTypes[0] = Integer.TYPE; - Method method = pluginClass.getMethod("indicateMote", parameterTypes); - Object[] parameterArguments = new Object[1]; - parameterArguments[0] = new Integer(id); - - for (JInternalFrame plugin: allPlugins) { - if (plugin.getClass() == pluginClass) { - method.invoke(plugin, parameterArguments); - } - } - - } catch (Exception e) { - return createErrorMessage("Exception: " + e.getMessage()); - } - return XML_OK; - } - - - return createErrorMessage("Unknown action: " + action); - } - - /** - * Handle clear eventpoints command. - * - * @return Reply to client (XML format) - */ - private String clearEventpoints() { - myEvaluator.clearAllEventpoints(); - return XML_OK; - } - - public static String createErrorMessage(String message) { - return XML_ERROR_START + message + XML_ERROR_END; - } - - public static String createInfoMessage(String message) { - return XML_INFO_START + message + XML_INFO_END; - } - - public static String createOkMessage(Eventpoint eventpoint, int time) { - return XML_OK_START + eventpoint.getID() + XML_OK_END; - } - - public static String createEventpointMessage(EventpointEvaluator evaluator) { - return XML_EVENTPOINT_START + - evaluator.getLastTriggeredEventpointID() + - XML_INFO_START + - evaluator.getTriggeredEventpoint().getMessage() + - XML_INFO_END + - XML_EVENTPOINT_END; - } -} diff --git a/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/Eventpoint.java b/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/Eventpoint.java deleted file mode 100644 index bbca9d7db..000000000 --- a/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/Eventpoint.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of the - * Institute nor the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $Id: Eventpoint.java,v 1.1 2009/02/26 13:47:38 fros4943 Exp $ - */ - -package se.sics.chakana.eventpoints; - -public interface Eventpoint { - - /** - * Evaluates eventpoint. - * - * @return True if eventpoint triggered, false otherwise - */ - public boolean evaluate(); - - /** - * @return Optional information of triggered eventpoint - */ - public String getMessage(); - - /** - * @param id Eventpoint ID - */ - public void setID(int id); - - /** - * @return Unique eventpoint ID - */ - public int getID(); - -} diff --git a/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/IntegerWatchpoint.java b/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/IntegerWatchpoint.java deleted file mode 100644 index a615ce2d1..000000000 --- a/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/IntegerWatchpoint.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of the - * Institute nor the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $Id: IntegerWatchpoint.java,v 1.1 2009/02/26 13:47:38 fros4943 Exp $ - */ - -package se.sics.chakana.eventpoints; - -import se.sics.cooja.Mote; - -/** - * TODO Document - * - * @author Fredrik Osterlind - */ -public class IntegerWatchpoint extends VariableWatchpoint { - public IntegerWatchpoint(Mote mote, String varName) { - super(mote, varName, 4); - } -} diff --git a/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/RadioMediumEventpoint.java b/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/RadioMediumEventpoint.java deleted file mode 100644 index 2053c8cae..000000000 --- a/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/RadioMediumEventpoint.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of the - * Institute nor the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $Id: RadioMediumEventpoint.java,v 1.1 2009/02/26 13:47:38 fros4943 Exp $ - */ - -package se.sics.chakana.eventpoints; - -import java.util.Observable; -import java.util.Observer; - -import se.sics.cooja.RadioMedium; - -/** - * Triggers if radio medium changes - * - * @author Fredrik Osterlind - */ -public class RadioMediumEventpoint implements Eventpoint { - protected boolean shouldBreak = false; - private int myID = 0; - protected RadioMedium radioMedium; - private int count = 1; - - public RadioMediumEventpoint(RadioMedium radioMedium) { - if (radioMedium == null) { - // TODO Throw exception - return; - } - - this.radioMedium = radioMedium; - - // Register as radio medium observer - radioMedium.addRadioMediumObserver(new Observer() { - public void update(Observable obs, Object obj) { - handleRadioMediumChange(); - } - }); - } - - public RadioMediumEventpoint(RadioMedium radioMedium, int count) { - this(radioMedium); - this.count = count; - } - - protected void handleRadioMediumChange() { - count--; - if (count < 1) - shouldBreak = true; - } - - public String getMessage() { - return "Radio medium changed"; - } - - public boolean evaluate() { - return shouldBreak; - } - - public void setID(int id) { - myID = id; - } - - public int getID() { - return myID; - } -} diff --git a/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/RealTimepoint.java b/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/RealTimepoint.java deleted file mode 100644 index 501ea193c..000000000 --- a/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/RealTimepoint.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of the - * Institute nor the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $Id: RealTimepoint.java,v 1.1 2009/02/26 13:47:38 fros4943 Exp $ - */ - -package se.sics.chakana.eventpoints; - -/** - * TODO Document - * - * @author Fredrik Osterlind - */ -public class RealTimepoint implements Timepoint { - private int myID = 0; - private long endTime; - - private String message; - - /** - * TODO Document - * - * TODO Use timer instead, much faster! - * - * @param time Duration in milliseconds - */ - public RealTimepoint(long time) { - this.endTime = System.currentTimeMillis() + time; - } - - public boolean evaluate() { - if (System.currentTimeMillis() >= endTime) { - message = "Real time = " + System.currentTimeMillis() + " >= " + endTime; - return true; - } - return false; - } - - public String getMessage() { - return message; - } - - public String toString() { - return "Real timepoint: " + endTime; - } - - public void setID(int id) { - myID = id; - } - - public int getID() { - return myID; - } -} diff --git a/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/SimulationTimepoint.java b/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/SimulationTimepoint.java deleted file mode 100644 index 0fb4f520a..000000000 --- a/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/SimulationTimepoint.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of the - * Institute nor the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $Id: SimulationTimepoint.java,v 1.1 2009/02/26 13:47:38 fros4943 Exp $ - */ - -package se.sics.chakana.eventpoints; - -import se.sics.cooja.Simulation; - -/** - * TODO Document - * - * @author Fredrik Osterlind - */ -public class SimulationTimepoint implements Timepoint { - private int myID = 0; - private Simulation simulation; - private int time; - - private String message; - - /** - * TODO Document - * - * @param simulation - * @param time - */ - public SimulationTimepoint(Simulation simulation, int time) { - this.simulation = simulation; - this.time = time; - } - - public boolean evaluate() { - if (simulation.getSimulationTime() >= time) { - message = "Simulation time = " + simulation.getSimulationTime() + " >= " + time; - return true; - } - return false; - } - - public String getMessage() { - return message; - } - - public String toString() { - return "Simulation timepoint: " + time; - } - - public void setID(int id) { - myID = id; - } - - public int getID() { - return myID; - } -} diff --git a/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/Timepoint.java b/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/Timepoint.java deleted file mode 100644 index da1740c6d..000000000 --- a/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/Timepoint.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of the - * Institute nor the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $Id: Timepoint.java,v 1.1 2009/02/26 13:47:38 fros4943 Exp $ - */ - -package se.sics.chakana.eventpoints; - -/** - * A timepoint triggers at and after a given time. - * - * @author Fredrik Osterlind - */ -public interface Timepoint extends Eventpoint { -} diff --git a/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/TransmissionRadioMediumEventpoint.java b/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/TransmissionRadioMediumEventpoint.java deleted file mode 100644 index b45f5132f..000000000 --- a/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/TransmissionRadioMediumEventpoint.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of the - * Institute nor the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $Id: TransmissionRadioMediumEventpoint.java,v 1.1 2009/02/26 13:47:38 fros4943 Exp $ - */ - -package se.sics.chakana.eventpoints; - -import se.sics.cooja.RadioMedium; - -/** - * Triggers when a radio medium transmission has been completed - * - * @author Fredrik Osterlind - */ -public class TransmissionRadioMediumEventpoint extends RadioMediumEventpoint { - private String message = ""; - private int count = 1; - - public TransmissionRadioMediumEventpoint(RadioMedium radioMedium) { - super(radioMedium); - } - - public TransmissionRadioMediumEventpoint(RadioMedium radioMedium, int count) { - this(radioMedium); - this.count = count; - } - - protected void handleRadioMediumChange() { - if (radioMedium.getLastTickConnections() != null) { - count -= radioMedium.getLastTickConnections().length; - if (count < 1) { - shouldBreak = true; - message = radioMedium.getLastTickConnections().length + " transmissions were completed"; - } - } - } - - public String getMessage() { - return message; - } - -} diff --git a/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/VariableWatchpoint.java b/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/VariableWatchpoint.java deleted file mode 100644 index 5bd081cdb..000000000 --- a/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/VariableWatchpoint.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of the - * Institute nor the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $Id: VariableWatchpoint.java,v 1.1 2009/02/26 13:47:38 fros4943 Exp $ - */ - -package se.sics.chakana.eventpoints; - -import se.sics.cooja.Mote; -import se.sics.cooja.SectionMoteMemory; - -/** - * TODO Document - * - * @author Fredrik Osterlind - */ -public class VariableWatchpoint extends Watchpoint { - private Mote mote; - private String name; - - private String reason; - - public VariableWatchpoint(Mote mote, String variableName, int size) { - super(mote, ((SectionMoteMemory) mote.getMemory()) - .getVariableAddress(variableName), size); - this.mote = mote; - this.name = variableName; - } - - public boolean evaluate() { - boolean shouldBreak = super.evaluate(); - - if (shouldBreak) { - reason = "Variable '" + name + "' changed"; - } - return shouldBreak; - } - - public String getMessage() { - return reason; - } - - public String toString() { - return "Variable watchpoint: " + name + " @ " + mote; - } -} diff --git a/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/Watchpoint.java b/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/Watchpoint.java deleted file mode 100644 index a9893abf7..000000000 --- a/backyard/tools/chakana/cooja_plugin/java/se/sics/chakana/eventpoints/Watchpoint.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2007, Swedish Institute of Computer Science. All rights - * reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. 2. Redistributions in - * binary form must reproduce the above copyright notice, this list of - * conditions and the following disclaimer in the documentation and/or other - * materials provided with the distribution. 3. Neither the name of the - * Institute nor the names of its contributors may be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $Id: Watchpoint.java,v 1.1 2009/02/26 13:47:38 fros4943 Exp $ - */ - -package se.sics.chakana.eventpoints; - -import java.util.Arrays; -import org.apache.log4j.Logger; - -import se.sics.cooja.Mote; - -/** - * A watchpoint watches a memory area, such as a variable, and triggers at changes. - * - * @author Fredrik Osterlind - */ -public class Watchpoint implements Eventpoint { - private static Logger logger = Logger.getLogger(Watchpoint.class); - private int myID = 0; - - private Mote mote; - private int address; - private int size; - byte[] initialMemory; - - private String reason; - - public Watchpoint(Mote mote, int address, int size) { - this.mote = mote; - this.address = address; - this.size = size; - - logger.debug("Fetching initial memory"); - initialMemory = mote.getMemory().getMemorySegment(address, size); - - // TODO Throw exception if memory area not valid - } - - public boolean evaluate() { - byte[] currentMemory = mote.getMemory().getMemorySegment(address, size); - boolean shouldBreak = !Arrays.equals(initialMemory, currentMemory); - - if (shouldBreak) { - reason = "Memory interval " + "0x" + Integer.toHexString(address) + ":" + size + " changed"; - } - return shouldBreak; - } - - public String getMessage() { - return reason; - } - - public String toString() { - return "Memory change breakpoint: " + "0x" + Integer.toHexString(address) + ":" + size + " @ " + mote; - } - - public void setID(int id) { - myID = id; - } - - public int getID() { - return myID; - } -} diff --git a/backyard/tools/chakana/debug.py b/backyard/tools/chakana/debug.py deleted file mode 100644 index 69f476ee1..000000000 --- a/backyard/tools/chakana/debug.py +++ /dev/null @@ -1,279 +0,0 @@ -# -# Copyright (C) 2003-2007 Swedish Institute of Computer Science. -# -# Please refer to the file named LICENSE in the same directory as this -# file for licensing information. -# - -# $Id: debug.py,v 1.1 2009/02/26 13:47:38 fros4943 Exp $ - -import inspect -import os -import sys -import threading -import StringIO - -DebugMin = 0 -Always = 0 -Fatal = 1 -Critical = 2 -Error = 3 -Warning = 4 -Check = 5 -Information = 6 -MajorEvent = 7 -Event = 8 -MinorEvent = 9 -Debug = 10 -Debug2 = 11 -Debug3 = 12 -Debug4 = 13 -Disabled = 14 -DebugMax = 15 - -DefaultDebugLevel = Information - -def levelName(level): - for (varName, value) in globals().items(): - if not varName in ("DebugMin", "DebugMax"): - if value == level: - return varName - return "Unknown" - -class DebugSingleton: - def __init__(self, output = sys.stderr, defaultLevel = DefaultDebugLevel, - logLevel = Debug4): - self.maxBufferLen = 1024 * 1024 - self.__level = defaultLevel - self.__output = output - self.__logBuffer = [] - self.__logBufferSize = 0 - self.__logLevel = Debug4 - self.__logFile = None - self.__logFileName = None - self.__lock = threading.RLock() - self._transformers = [] - - def level(self): - return self.__level - - def setLog(self, fileName): - assert(not self.__logBuffer is None) - if not fileName is None: - self.__logFileName = fileName - self.__logFile = open(fileName, "w") - self.__logFile.write("".join(self.__logBuffer)) - self.write(MajorEvent, "Saving debug log in " + fileName + "\n") - self.__logBuffer = None - - def logFileName(self): - return self.__logFileName - - def logLevel(self): - return self.__logLevel - - def cleanLog(self): - self.setLog(None) - - def setLogLevel(self, level): - self.__logLevel = level - self.write(MinorEvent, "Changed debug log verbosity to " + - levelName(self.__logLevel) + " (" + - str(self.__logLevel) + ")\n") - - def setLevel(self, level): - self.__level = level - if self.__level < Always: - self.__level = Always - if self.__level >= Disabled: - self.__level = Disabled - 1 - self.write(MinorEvent, "Changed debug verbosity to " + - levelName(self.__level) + " (" + str(self.__level) + ")\n") - - def increaseLevel(self, amount = 1): - self.setLevel(self.level() + amount) - - def decreaseLevel(self, amount = 1): - self.increaseLevel(- amount) - - def write(self, level, * messages): - """Write messages if current verbosity level >= level. Messages should - either be callable functors taking a writer function parameter, or they - should be strings or convertible to strings.""" - - writers = [] - if self.level() >= level: - writers.append(self.__output.write) - if self.logLevel() >= level: - writers.append(self.logWrite) - if writers != []: - self.__lock.acquire() - try: - for writer in writers: - writer(self.transform(level = level, - message = self.format(messages))) - finally: - self.__lock.release() - - def format(self, messages): - buf = StringIO.StringIO() - for msg in messages: - if callable(msg): - msg(buf.write) - else: - buf.write(msg) - return buf.getvalue() - - def transform(self, level, message): - for transform in self._transformers: - message = transform(level = level, message = message) - return message - - def writer(self, level): - return lambda what: self.write(level, what) - - def logWrite(self, what): - if self.__logFile is None: - if not self.__logBuffer is None: - self.__logBuffer.append(what) - self.__logBufferSize += len(what) - if self.__logBufferSize > self.maxBufferLen: - self.__logBuffer = None - self.write(Warning, "Cleaned log buffer since it overflowed " + - str(self.maxBufferLen) + " bytes\n") - else: - self.__logFile.write(what) - self.__logFile.flush() - - def pushTransformer(self, transformer): - assert(callable(transformer)) - if not transformer in self._transformers: - self._transformers.append(transformer) - -debugStream = DebugSingleton() - -def debug(level, message): - debugStream.write(level, message, "\n") - - -class DebugDumper: - def __init__(self): - pass - - def __call__(self, writer): - raise NotImplementedError() - - def __add__(self, other): - return DebugCombiner(self, other) - - def __radd__(self, other): - return DebugCombiner(other, self) - - -class DebugCombiner: - def __init__(self, first, second): - self.__first = first - self.__second = second - - def __call__(self, writer): - for elem in [self.__first, self.__second]: - if callable(elem): - elem(writer) - else: - writer(str(elem)) - -class DebugFile: - def __init__(self): - self.__str = "" - - def write(self, msg): - self.__str += msg - - def __str__(self): - return self.__str - -DebugStderr = DebugFile - -def exceptionDump((type, value, traceback)): - """Print an exception stack trace to DebugStderr(). Pass - sys.exc_info() as parameter.""" - if type is None: - return "" - oldStderr = sys.stderr - debugStderr = DebugStderr() - sys.stderr = debugStderr - sys.__excepthook__(type, value, traceback) - sys.stderr = oldStderr - return str(debugStderr) - -def exceptionMessage((type, value, traceback)): - import urllib2 - if isinstance(value, urllib2.HTTPError): - return str(value) + ": " + value.filename - else: - return str(value) - -class CallTracer: - def __init__(self, level, prefix = lambda f, e, a: "", traceSystem = 0, - traceDebug = 0): - self._level = level - self._prefix = prefix - self._traceSystem = traceSystem - self._traceDebug = traceDebug - - def indent(self, frame): - stack = inspect.stack() - depth = len(stack) - 4 - assert(depth >= 0) - while len(stack) > 0: - del stack[0] - del stack - return " " * depth - - def prefix(self, frame, event, arg): - return self._prefix(frame, event, arg) + self.indent(frame) - - def inDebugCode(self, frame): - if frame is None: - return 0 - if os.path.basename(frame.f_code.co_filename) == "debug.py": - ret = 1 - else: - ret = self.inDebugCode(frame.f_back) - del frame - return ret - - def __call__(self, frame, event, arg): - if frame.f_back is None: - callerDir = "" - else: - callerDir = os.path.dirname(frame.f_back.f_code.co_filename) - sourceFile = os.path.basename(frame.f_code.co_filename) - funcName = sourceFile + ":" + frame.f_code.co_name + "()" - if (not self._traceDebug) and self.inDebugCode(frame): - return None - if self._traceSystem or \ - not (callerDir.startswith(sys.prefix + "/lib/python")): - if event == "call": - debug(self._level, self.prefix( - frame = frame, event = event, arg = arg) + "-> " + funcName) - elif event == "return": - debug(self._level, self.prefix( - frame = frame, event = event, arg = arg) + "<- " + funcName) - elif event == "exception": - debug(self._level, self.prefix( - frame = frame, event = event, arg = arg) + "X " + funcName) - return self - -def pidPrefix(message = "", ** kwArgs): - return str(os.getpid()) + ": " + message - -def threadPrefix(message = "", ** kwArgs): - return threading.currentThread().getName() + ": " + message - -def objectAsString(obj): - names = [(name, value) for name,value in vars(obj).iteritems()] - names.insert(0,("Instace of", obj.__class__.__name__)) - max_length = len(max([name for (name, value) in names])) - return "\n".join([name.rjust(max_length) + ": " + str(value) for (name,value) in names]) - diff --git a/backyard/tools/chakana/error.py b/backyard/tools/chakana/error.py deleted file mode 100644 index 10879419f..000000000 --- a/backyard/tools/chakana/error.py +++ /dev/null @@ -1,89 +0,0 @@ -# -# Copyright (C) 2003-2007 Swedish Institute of Computer Science. -# -# Please refer to the file named LICENSE in the same directory as this -# file for licensing information. -# - -# $Id: error.py,v 1.1 2009/02/26 13:47:38 fros4943 Exp $ - -import errno -import os - -import chakana.debug - -class Error(Exception): - def __init__(self, message): - Exception.__init__(self, message) - -class CommandFailed(Error): - """Exception thrown when a system command fails. The command string, - environment, working directory, output, and exit status are recorded. - The exit status is typically the value returned by os.system, but may - also be an exception, for example an error.Timeout object.""" - - def __init__(self, command, status, output): - Error.__init__(self, "Command failed with exit code " + str(status) + - ": " + command + "\n" + "Output:\n" + output + "\ncwd: " + - os.getcwd() + "\n") - self._command = command - self._status = status - self._output = output - self._environ = os.environ.copy() - self._cwd = os.getcwd() - - def command(self): - return self._command - - def status(self): - return self._status - - def output(self): - return self._output - - def environ(self): - return self._environ - - def cwd(self): - return self._cwd - -class SanityCheckFailed(Error): - def __init__(self, message): - Error.__init__(self, "Sanity check failed: " + message) - -class NoSuchProcess(OSError): - def __init__(self): - OSError.__init__(self, errno.ESRCH, "No such process") - -class Timeout(Error): - def __init__(self, child, timeout): - Error.__init__(self, "Timeout (" + str(timeout) + " s) executing " + - child.getName()) - self.child = child - self.timeout = timeout - -class Discarded(Error): - def __init__(self): - Error.__init__(self, "Monitor was discarded") - -class ChildException(Error): - def __init__(self, error, exc_info): - Error.__init__(self, "Exception in child thread: " + str(error) + - ":\n" + chakana.debug.exceptionDump(exc_info)) - self.error = error - self.exc_info = exc_info - -class CoojaError(Error): - def __init__(self, response): - Error.__init__(self, "COOJA error: " + - response.documentElement.childNodes[0].nodeValue) - -class CoojaExit(Error): - def __init__(self): - Error.__init__(self, "COOJA has exited") - -def errnoError(errNum, fileName = None): - if isinstance(errNum, str): - return errnoError(getattr(errno, errNum), fileName) - return OSError(errNum, os.strerror(errNum), fileName) - diff --git a/backyard/tools/chakana/event.py b/backyard/tools/chakana/event.py deleted file mode 100644 index 8e0c92631..000000000 --- a/backyard/tools/chakana/event.py +++ /dev/null @@ -1,175 +0,0 @@ -import time -import thread - -from debug import * -import threads - -class Eventpoint(threads.ManagedThread): - - """ The Eventpoint class and its subclasses represent important events - happening in the debugged system, and are the primitives that Chakana - debugging scripts are based around. When the user calls waitFor with an - Eventpoint list argument, each Eventpoint thread is started. The - Eventpoint inserts appropriate eventpoints into COOJA or creates child - Eventpoints. An Eventpoint that is hit posts itself on a trigger queue - (Queue.Queue), where it is picked up by waitFor. The Eventpoints that - have not been triggered are then discarded by the waitFor routine.""" - - def __init__(self, shepherd): - threads.ManagedThread.__init__(self, shepherd.threadManager()) - self._shepherd = shepherd - self._activated = 0 - self._discarded = 0 - self._triggerQueue = None - - resourceAllocated = 0 - while resourceAllocated == 0: - try: - self._isWaitingEvent = threading.Event() - resourceAllocated = 1 - except thread.error: - resourceAllocated = 0 - shepherd.threadManager().registerPIDerror() - - def await(self, triggerQueue): - assert not self._activated, "Eventpoints can only be used once" - self._triggerQueue = triggerQueue - self._activated = 1 - self.activatedHook() - self.start() - - def doRun(self): - debug(Debug, "Waiting for event: " + repr(self)) - if not self._discarded: - self.doWait() - debug(MinorEvent, "Event was triggered: " + repr(self)) - if not self._discarded: - self._triggerQueue.put(self) - else: - debug(Debug, "Event is no longer waited for: " + repr(self)) - - def activatedHook(self): - pass - - def doWait(self): - raise NotImplementedError() - - def discard(self): - debug(Debug, "Discarding eventpoint:\n" + repr(self)) - self._discarded = 1 - if (not self._activated): - self.start() - for (waitingEv, event) in self.shepherd()._waitMap.values(): - if waitingEv == self: - event.set() - self.join() - - def isDiscarded(self): - return self._discarded - - def shepherd(self): - return self._shepherd - - def __repr__(self): - return "\n ".join([ - "event.Eventpoint:", - "Id: %#x" % ((id(self) + (long(1) << 32)) % (long(1) << 32)), - ]) - -class BasicEventpoint(Eventpoint): - """Eventpoint corresponding to a single COOJA Eventpoint.""" - - def __init__(self, shepherd, ** kwArgs): - Eventpoint.__init__(self, shepherd, ** kwArgs) - - def activatedHook(self): - self.shepherd().registerBasicEventpoint(self) - - def doWait(self): - self.shepherd().waitForCoojaEventpoint(self) - self.shepherd().unregisterBasicEventpoint(self) - -class Watchpoint(BasicEventpoint): - def __init__(self, shepherd, type, mote, variable, ** kwArgs): - self._type = type - self._mote = mote - self._variable = variable - BasicEventpoint.__init__(self, shepherd, ** kwArgs) - - def coojaArguments(self): - return { "type" : self._type, - "mote" : self._mote, - "variable" : self._variable } - - def __repr__(self): - return "\n ".join([ - BasicEventpoint.__repr__(self), - "event.Watchpoint:", - "Type: " + repr(self._type), - "Mote: " + repr(self._mote), - "Variable: " + repr(self._variable) - ]) - -class TimeEventpoint(BasicEventpoint): - def __init__(self, shepherd, time, ** kwArgs): - self._time = time - BasicEventpoint.__init__(self, shepherd, ** kwArgs) - - def coojaArguments(self): - return { "type" : "time", - "time" : self._time } - - def __repr__(self): - return "\n ".join([ - BasicEventpoint.__repr__(self), - "event.TimeEventpoint:", - "Time: " + repr(self._time) - ]) - - -class RadioMessageCompletedEventpoint(BasicEventpoint): - def __init__(self, shepherd, count = 1, ** kwArgs): - self._count = count - BasicEventpoint.__init__(self, shepherd, ** kwArgs) - - def coojaArguments(self): - return { "type" : "radiomedium", - "triggeron" : "completed", - "count" : str(self._count) } - - def __repr__(self): - return "\n ".join([ - BasicEventpoint.__repr__(self), - "event.RadioMessageCompletedEventpoint", - ]) - -class MonitorEventpoint(Eventpoint): - """Eventpoint that triggers after a monitor has finished.""" - - def __init__(self, monitor): - self._monitor = monitor - Eventpoint.__init__(self, monitor.shepherd()) - - def doWait(self): - debug(Debug, "MonitorEventpoint starting " + repr(self)) - self._monitor.startMonitor() - self._monitor.waitMonitor(self) - - def discard(self): - self._discarded = 1 - self._monitor.discard() - if (not self._activated): - self.start() - self._monitor.startMonitor() - self._monitor.waitMonitor(self) - else: - self._monitor.waitMonitor(self) - self.join() - - def __repr__(self): - return "\n ".join([ - Eventpoint.__repr__(self), - "event.MonitorEventpoint:", - "Monitor: " + repr(self._monitor) - ]) - diff --git a/backyard/tools/chakana/harness.py b/backyard/tools/chakana/harness.py deleted file mode 100644 index ec06ffb45..000000000 --- a/backyard/tools/chakana/harness.py +++ /dev/null @@ -1,126 +0,0 @@ -import errno -import os -import re -import time - -import chakana.command -import chakana.error -import chakana.shepherd -import chakana.threads -import chakana.utils - -from chakana.debug import * - -class Harness: - def __init__(self, chakanaRoot, coojaTimeout, doCompile="True", withGUI="False"): - self._chakanaRoot = os.path.abspath(chakanaRoot) - self._coojaTimeout = coojaTimeout - self._threadManager = chakana.threads.ThreadManager() - self._doCompile = doCompile - self._withGUI = withGUI - debug(MajorEvent, "Chakana harness created") - - def start(self): - port = self.startCooja() - self._shepherd = chakana.shepherd.Shepherd(self._threadManager, port) - - def startCooja(self): - # COMPILE COOJA AND PLUGIN - if self._doCompile == "True": - for target in ("cooja", "plugin"): - buildCommand = 'cd ' + chakana.command.quote(self._chakanaRoot) + ' && ant compile_' + target - debug(MajorEvent, "Building " + target) - debug(Event, buildCommand) - output = chakana.command.output(buildCommand) - debug(MinorEvent, output) - - coojaOutputFile = os.path.join(self._chakanaRoot, "build/cooja.out") - # START COOJA - - if os.path.isfile(coojaOutputFile): - os.remove(coojaOutputFile) - coojaThread = CoojaThread(self._threadManager, self._chakanaRoot, - coojaOutputFile, self._coojaTimeout, withGUI=self._withGUI) - coojaThread.start() - return coojaThread.port() - - def shepherd(self): - return self._shepherd - - def quit(self): - self._shepherd.quit() - - def killAllProcesses(self): - self._threadManager.killAll() - - def waitForAllThreads(self, timeout): - self._threadManager.waitAll(timeout) - -class CoojaThread(chakana.threads.ManagedThread): - def __init__(self, threadManager, chakanaRoot, outputFile, - timeout = 3600, name = "COOJA", withGUI="False", ** kwArgs): - chakana.threads.ManagedThread.__init__( - self, threadManager, name = name, **kwArgs) - self._chakanaRoot = chakanaRoot - self._outputFile = outputFile - self._timeout = timeout - self._port = None - self._withGUI = withGUI - - def doRun(self): - debug(MajorEvent, "Starting COOJA") - buildDir = os.path.dirname(self._outputFile) - chakana.utils.makeDirsSafe(buildDir) - contikiRoot = os.path.join(self._chakanaRoot, '../..') - contikiRoot = contikiRoot.replace('/cygdrive/c', 'c:') - if self._withGUI == "True": - coojaCommand = '( cd ' + chakana.command.quote(buildDir) + ' && java -jar ' + \ - chakana.command.quote(os.path.join(contikiRoot, 'tools/cooja/dist/cooja.jar')) + ' ' + \ - '-external_tools_config=../cooja.chakana.properties ' + \ - '-contiki=' + chakana.command.quote(contikiRoot) + ' < /dev/null > ' + \ - os.path.basename(self._outputFile) + ' 2>&1 )' - else: - coojaCommand = '( cd ' + chakana.command.quote(buildDir) + ' && java -jar ' + \ - chakana.command.quote(os.path.join(contikiRoot, 'tools/cooja/dist/cooja.jar')) + ' ' + \ - '-nogui ' + \ - '-external_tools_config=../cooja.chakana.properties ' + \ - '-contiki=' + chakana.command.quote(contikiRoot) + ' < /dev/null > ' + \ - os.path.basename(self._outputFile) + ' 2>&1 )' - - debug(Event, coojaCommand) - os.system(coojaCommand) - debug(MajorEvent, "COOJA has finished") - - def port(self): - if self._port is None: - laps = 0 - debug(Event, "Waiting for COOJA to open server socket") - debug(Debug, "Reading: " + self._outputFile) - while 1: - if self._timeout > 0 and laps > self._timeout: - raise chakana.error.Timeout(self, self._timeout) - logContents = "" - try: - logContents = chakana.utils.readFile(self._outputFile) - except IOError, err: - if err.errno != errno.ENOENT: - raise - match = re.search(r"Chakana server listening on port (\d+).", - logContents) - debug(Debug, "Log contents: " + logContents) - if match: - self._port = int(match.group(1)) - debug(Event, "COOJA is now listening on port " + str(self._port)) - break - else: - debug(Debug, "Waiting for COOJA to start") - time.sleep(1) - laps += 1 - - match = re.search(r"Unable to access jarfile", - logContents) - if match: - raise RuntimeError("Could not locate COOJA JAR: " + logContents) - - return self._port - diff --git a/backyard/tools/chakana/linux.py b/backyard/tools/chakana/linux.py deleted file mode 100644 index 7190ec9bf..000000000 --- a/backyard/tools/chakana/linux.py +++ /dev/null @@ -1,268 +0,0 @@ -# -# Copyright (C) 2004-2007 Swedish Institute of Computer Science. -# -# Please refer to the file named LICENSE in the same directory as this -# file for licensing information. -# - - -# $Id: linux.py,v 1.1 2009/02/26 13:47:38 fros4943 Exp $ - -import errno -import glob -import os -import re -import signal -import string -import time - -import chakana.command -import chakana.error -import chakana.utils - -from debug import * - -def numProcessors(physical = 0, cpuInfo = None): - return Host().CpuInfo(cpuInfo).count(physical = physical) - -class CpuInfo: - "Parser for /proc/cpuinfo." - def __init__(self, cpuInfo = None): - if cpuInfo is None: - cpuInfo = chakana.utils.readFile("/proc/cpuinfo") - self.__values = [map(string.strip, l.split(":")) - for l in cpuInfo.splitlines()] - - def values(self): - return self.__values - - def find(self, name): - debug(Debug3, "Looking for " + name + " in cpuinfo:") - ret = [val[1] for val in self.values() if val[0] == name] - debug(Debug3, repr(ret)) - return ret - -class IfconfigInfo: - "Parser for ifconfig output." - def __init__(self, ifconfigOutput = None): - if ifconfigOutput is None: - self._ifconfigOutput = chakana.command.output("/sbin/ifconfig") - else: - self._ifconfigOutput = ifconfigOutput - - def interfaces(self): - return map(InterfaceInfo, - re.compile("^\\w+", re.M).findall(self._ifconfigOutput)) - -class InterfaceInfo: - "Parser for ifconfig output for a single interface." - def __init__(self, interface = None, ifconfigOutput = None): - if interface is None: - self._interface = chakana.command.output("/sbin/ifconfig").split()[0] - else: - self._interface = interface - if ifconfigOutput is None: - self._ifconfigOutput = chakana.command.output("/sbin/ifconfig " + - self._interface) - else: - self._ifconfigOutput = ifconfigOutput - - def name(self): - return self._ifconfigOutput.split()[0] - - def address(self): - match = re.search("inet addr:((\d{1,3}\.){3}\d{1,3})", - self._ifconfigOutput) - if match: - return match.group(1) - else: - return None - - __str__ = name - -class MemInfo(dict): - "Parser for /proc/meminfo" - def __init__(self, memInfo = None): - if memInfo is None: - memInfo = chakana.utils.readFile("/proc/meminfo") - for line in memInfo.splitlines(): - if len(line.split(":")) == 2: - key, value = line.split(":") - if len(value.strip().split()) <= 2: - if len(value.strip().split()) == 2: - unit = {"KB" : 1024, "MB" : 1024 * 1024, - "GB" : 1024 * 1024 * 1024 }[value.split()[-1].upper()] - else: - unit = 1 - self[key] = long(value.strip().split()[0]) * unit - -class UnameInfo: - "Parser for output from uname -a" - def __init__(self, unameInfo = None): - if unameInfo is None: - unameInfo = chakana.command.output("uname -a") - self._unameInfo = unameInfo.split() - - def __getitem__(self, i): - return self._unameInfo[i] - - def __len__(self): - return len(self._unameInfo) - - def __getattr__(self, attr): - ret = self[self.indexMap()[attr]] - if (attr == "architecture") and \ - (re.match(r"(.*intel|i[0-9]86)", ret, re.I)): - # Work around bogus uname output from e.g. Gentoo - return "i386" - else: - return ret - - def smp(self): - return "SMP" in self._unameInfo - - def indexMap(self): - return { - "os" : 0, - "host" : 1, - "version" : 2, - "architecture" : -2, - } - - def __str__(self): - return repr(dict([(attr, getattr(self, attr)) - for attr in self.indexMap()])) - - def __repr__(self): - return repr(self._unameInfo) - -class X86: - class CpuInfo(CpuInfo): - def count(self, physical = 0): - logical = len(self.find("processor")) - if physical: - siblings = self.find("siblings") - if len(siblings) > 0: - return logical / int(siblings[0]) - return logical - - def type(self, num = 0): - return re.match(r"Intel(\(R\))? (.*) processor [\d]+MHz", - self.find("model name")[num]).group(2) - -class X86_64(X86): - pass - -class Sparc: - class CpuInfo(CpuInfo): - def count(self): - return int(self.find("ncpus active")[0]) - - def type(self, num = 0): - return " ".join(self.find("cpu")[num].split()[1:3]) - - class UnameInfo(UnameInfo): - pass - -def freeSpace(path): - "Return available disk space on device corresponding to path." - # If the device name is long, df may split the relevant line, so - # count lines and words from end. - return long( - chakana.command.output("df -k " + path).splitlines()[-1].split()[-3]) * 1024 - -def macAddresses(): - "Return list of mac addresses for all network interfaces." - return re.findall('..:..:..:..:..:..', os.popen( - '/sbin/ifconfig -a | grep HWaddr', 'r').read().lower()) - -class Process: - """Representation of a running process.""" - - def __init__(self, pid): - self._pid = pid - - def pid(self): - return self._pid - - def attribute(self, name): - try: - lines = chakana.utils.readFile("/proc/" + str(self._pid) + - "/status").splitlines() - for line in lines: - (key, value) = line.split(":", 1) - if key.strip().lower() == name.lower(): - return value.strip() - except EnvironmentError, err: - if err.errno == errno.ENOENT: - raise chakana.error.errnoError(errno.ESRCH) - raise - - def name(self): - return self.attribute("name") - - def parent(self): - return Process(int(self.attribute("ppid"))) - - def children(self): - ret = [] - for proc in self.all(): - try: - if proc.parent().pid() == self.pid(): - ret.append(proc) - except EnvironmentError, err: - if err.errno != errno.ESRCH: - raise - return ret - - def reallyKill(self, graceTime = 1, sigKillTime = 3, debugLevel = Event): - """Really kill process after waiting for graceTime. Send SIGKILL after - sigKillTime.""" - try: - debug(debugLevel, "Killing process " + str(self.pid()) + - " (" + str(self.name()) + ")") - os.kill(self.pid(), 0) - time.sleep(graceTime) - debug(debugLevel + 1, "kill -TERM " + str(self.pid())) - os.kill(self.pid(), signal.SIGTERM) - for tick in range(sigKillTime): - os.kill(self.pid(), 0) - debug(debugLevel + 1, "kill -KILL " + str(self.pid())) - os.kill(self.pid(), signal.SIGKILL) - time.sleep(graceTime) - if self.attribute("state")[0] != "Z": - debug(debugLevel, "Process refused to die: " + str(self.pid()) + - " (" + self.name() + ")") - except EnvironmentError, err: - if err.errno != errno.ESRCH: - raise - debug(debugLevel + 2, "Pid " + str(self.pid()) + " no longer exists") - - def killAllBelow(self, debugLevel = Event, ** kwArgs): - """Kill all processes below (but not including) a process. Start from - bottom of tree.""" - debug(debugLevel, "Killing all processes below " + str(self.pid()) + - " (" + self.name() + ")") - children = self.children() - debug(debugLevel + 2, "Pid " + str(self.pid()) + " has " + - str(len(children)) + " children") - for child in children: - child.killAllBelow(debugLevel = debugLevel, ** kwArgs) - child.reallyKill(debugLevel = debugLevel, ** kwArgs) - - def all(cls): - ret = [] - for statusFile in glob.glob("/proc/*/status"): - try: - ret.append(cls(int(os.path.basename(os.path.dirname(statusFile))))) - except ValueError: - continue - return ret - all = classmethod(all) - -def Host(): - architecture = chakana.command.output("uname -m").strip() - if re.match("i[0-9]86", architecture): - return X86 - elif architecture == "x86_64": - return X86_64 diff --git a/backyard/tools/chakana/monitor.py b/backyard/tools/chakana/monitor.py deleted file mode 100644 index 24675bfeb..000000000 --- a/backyard/tools/chakana/monitor.py +++ /dev/null @@ -1,184 +0,0 @@ -import Queue -import thread - -import chakana.event -import chakana.threads -from chakana.debug import * - -class Monitor(chakana.threads.ManagedThread): - """Base class for causal path monitors. Pass the threadManager to the - constructor. Override the doRun method or pass a routine argument. In - the latter case, the routine will be called with the Monitor object as - argument plus any extra arguments and keyword arguments specified.""" - - def __init__(self, shepherd, routine = None, * args, ** kwArgs): - chakana.threads.ManagedThread.__init__(self, shepherd.threadManager()) - self._shepherd = shepherd - self._routine = routine - self._args = args - self._kwArgs = kwArgs - self._ready = 0 - self._discarded = 0 - resourceAllocated = 0 - while resourceAllocated == 0: - try: - self._isWaitingMonitor = threading.Event() - resourceAllocated = 1 - except thread.error: - resourceAllocated = 0 - shepherd.threadManager().registerPIDerror() - debug(Debug, "Monitor created") - self._shepherd.registerMonitor(self) - - def startMonitor(self): - self.start() - debug(Debug, "New monitor thread started: " + repr(self)) - - def discard(self): - self._discarded = 1 - self._ready = 0 - debug(Debug, "Discarding monitor:\n" + repr(self)) - - # Wake up thread with empty results - if hasattr(self, "_resultQueue"): - self._resultQueue.put(None) - - def waitMonitor(self, parentEventpoint = None): - debug(Debug, "Waiting for monitor to finish: " + repr(self)) - - # While monitor is registered, check for continuations - while self in self.shepherd()._monitors: - resourceAllocated = 0 - while resourceAllocated == 0: - try: - self._isWaitingMonitor.wait() - resourceAllocated = 1 - except thread.error: - resourceAllocated = 0 - self.shepherd().threadManager().registerPIDerror() - - self._isWaitingMonitor.clear() - self._ready = 1 - - # If all monitors ready, poll continuation - allMonitorsReady = 1 - for monitor in self.shepherd()._monitors: - if not monitor._ready: - allMonitorsReady = 0 - if allMonitorsReady: - if self in self.shepherd()._monitors: - self.shepherd().pollContinuation() - else: - # A monitor may be waiting for us, tell parent we are ready - if parentEventpoint is not None: - parentEventpoint._isWaitingEvent.set() - self.join() - - def doRun(self): - debug(Debug, "Running monitor") - try: - if (not self._discarded): - self.runMonitor() - except chakana.error.Discarded: - pass - self.shepherd().unregisterMonitor(self) - self._isWaitingMonitor.set() - debug(Debug, "Monitor exiting") - - def runMonitor(self): - self._routine(self, * self._args, ** self._kwArgs) - - def waitFor(self, eventList): - """Waits until one of the Events given in 'eventList' have triggered and - returns that Event.""" - if isinstance(eventList, chakana.event.Eventpoint): - eventList = [eventList] - debug(MinorEvent, "Waiting for events to trigger. Event list: " + - str(eventList)) - assert eventList != [] - - # Clean up eventpoints and abort monitor if discarded - if self._discarded: - for ev in eventList: - ev.discard() - raise chakana.error.Discarded() - - self.shepherd().registerWaitingMonitor(self) - - resourceAllocated = 0 - while resourceAllocated == 0: - try: - self._resultQueue = Queue.Queue() - resourceAllocated = 1 - except thread.error: - resourceAllocated = 0 - self.shepherd().threadManager().registerPIDerror() - - for ev in eventList: - # Start thread and wait until eventpoint is waiting - ev.await(self._resultQueue) - - resourceAllocated = 0 - while resourceAllocated == 0: - try: - ev._isWaitingEvent.wait() - resourceAllocated = 1 - except thread.error: - resourceAllocated = 0 - self.shepherd().threadManager().registerPIDerror() - - ev._isWaitingEvent.clear() - - debug(Event, "Waiting for events: " + repr(eventList)) - - assert(not self._discarded) - - self._isWaitingMonitor.set() - resourceAllocated = 0 - while resourceAllocated == 0: - try: - triggeredEvent = self._resultQueue.get() - resourceAllocated = 1 - except thread.error: - resourceAllocated = 0 - self.shepherd().threadManager().registerPIDerror() - - self._ready = 0 - self.shepherd().unregisterWaitingMonitor(self) - debug(Event, "Eventpoint was triggered: " + repr(eventList)) - for ev in eventList: - if not (ev is triggeredEvent): - ev.discard() - - return triggeredEvent - - def shepherd(self): - return self._shepherd - - def readVariable(self, ** kwArgs): - return self.shepherd().readVariable(** kwArgs) - - def readInt(self, ** kwArgs): - return self.shepherd().readInt(** kwArgs) - - def readMemory(self, ** kwArgs): - return self.shepherd().readMemory(** kwArgs) - -class TimeoutWrapperMonitor(Monitor): - def __init__(self, shepherd, routine, eventpoint = None, timeout = 1000): - chakana.monitor.Monitor.__init__(self, shepherd) - self._eventpoint = eventpoint - self._timeout = timeout - self._triggeredEventpoint = None - - def runMonitor(self): - timeEventpoint = chakana.event.TimeEventpoint(self.shepherd(), self._timeout) - self._triggeredEventpoint = self.waitFor([timeEventpoint, self._eventpoint]) - - def getTriggeredEventpoint(self): - return self._triggeredEventpoint - - def timedOut(self): - return self.getTriggeredEventpoint() != self._eventpoint - - \ No newline at end of file diff --git a/backyard/tools/chakana/shepherd.py b/backyard/tools/chakana/shepherd.py deleted file mode 100644 index 3103c9dc7..000000000 --- a/backyard/tools/chakana/shepherd.py +++ /dev/null @@ -1,347 +0,0 @@ -import re -import socket -import threads -import xml.dom.minidom -import thread - -import chakana.error -import chakana.event -import chakana.monitor -import chakana.threads -import chakana.utils -from chakana.debug import * - -class Shepherd: - """The shepherd is a singleton class that manages the connection to COOJA - and keeps track of user monitor threads. The user initialises a - debugging scenario by creating a Shepherd object, and then calls the - newMonitor method to create Monitor objects, one for each causal - path through the system that he wishes to monitor. - - The monitor threads automatically register with the shepherd. The user - can use the debugger instances to probe variables or create eventpoints. - When the monitor thread routine decides that is ready for simulation to - proceed, it calls the waitFor method to block until one of the - eventpoints occur. - - When a Monitor object enters waitFor, it informs shepherd about the - eventpoints that the user is waiting for, and waits for the eventpoints - to happen. When all threads enter waiting state, the shepherd asks COOJA - to resume simulation. When an eventpoint is hit, the shepherd wakes the - Monitor that is waiting for that eventpoint. - - """ - - def __init__(self, threadManager, port, coojaHost = "localhost"): - debug(MajorEvent, "Creating shepherd") - self._pollConnLock = threading.Lock() - self._threadManager = threadManager - self._port = port - self._monitors = [] - self._waitingMonitors = [] - # Only basic eventpoints in these lists - self._eventpoints = [] - self._waitingEventpoints = [] - self._coojaContinueEvent = threading.Event() - self._waitMap = {} - self._coojaHost = coojaHost - self._coojaConnection = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - debug(MajorEvent, "Connecting to COOJA at " + coojaHost + ":" + - str(self._port)) - self._connectionLock = threading.Lock() - self._coojaConnection.connect((self._coojaHost, self._port)) - self._coojaStream = self._coojaConnection.makefile() - self._coojaConnection.close() - del self._coojaConnection - self._connectionLock.acquire() - hello = self.readFromCooja() - debug(Debug, hello.toprettyxml()) - self._connectionLock.release() - self._shepherdThread = threads.ManagedThread( - self._threadManager, target = self._shepherdMainLoop) - self._shepherdThread.start() - debug(Debug, "Shepherd created:\n" + repr(self)) - - def _shepherdMainLoop(self): - debug(Event, "Starting shepherd main loop") - while 1: - debug(Debug, "Waiting for eventpoints to enter wait state") - debug(Debug2, repr(self)) - self._coojaContinueEvent.wait() - self._coojaContinueEvent.clear() - if self._coojaStream.closed: - debug(Event, "Terminating shepherd main loop") - return - debug(Debug, "Resuming COOJA") - assert(len(self._eventpoints) == len(self._waitingEventpoints)) - response = self.runCommand("CONTROL_SIM", { "RESUME" : None }) - id = int(response.documentElement.childNodes[0].nodeValue) - debug(MinorEvent, "Eventpoint " + str(id) + " was triggered") - - # Wake up triggered eventpoint - self._waitMap[id][1].set() - - # Allow new main loop startups - self._pollConnLock.release() - - - def quit(self): - """Send a termination request to the debugger broker, and discard all - debuggers.""" - - debug(Information, "Terminating the shepherd session") - self.runCommand("EXIT_COOJA") - self._connectionLock.acquire() - self._coojaStream.close() - self._connectionLock.release() - self._coojaContinueEvent.set() - debug(Information, "Number of PID errors reported: " + str(self.threadManager().nrPIDerrors())) - - for (eventpoint, event) in self._waitMap.values(): - debug(Debug2, "Awakening eventpoint at exit: " + repr(eventpoint)) - event.set() - - def loadConfiguration(self, fileName): - return self.runCommand( - "CREATE_SIM", xmlContent = chakana.utils.readFile(fileName)) - - def loadConfigurationXML(self, xmlContent): - return self.runCommand( - "CREATE_SIM", xmlContent = xmlContent) - - def setConfigurationXML(self, xmlContent): - return self.runCommand( - "CONF_SIM", xmlContent = xmlContent) - - def setPluginsXML(self, xmlContent): - return self.runCommand( - "CONF_PLUGINS", xmlContent = xmlContent) - - def newMonitor(self, routine, * args, ** kwArgs): - return self.newCustomMonitor( - chakana.monitor.Monitor, routine, * args, ** kwArgs) - - def newCustomMonitor(self, Type, routine = None, * args, ** kwArgs): - """Start a new monitor thread running routine, with * args and ** kwArgs - as arguments.""" - debug(Debug, "Creating new monitor of type " + Type.__name__) - debug(Debug3, "Routine: " + repr(routine) + ", arguments: " + repr(args) + - ", keyword arguments: " + repr(kwArgs)) - thread = Type(self, routine, * args, ** kwArgs) - debug(MinorEvent, "New monitor thread created: " + repr(thread)) - return thread - - def newTimeoutMonitor(self, eventpoint, timeout, routine = None): - return self.newCustomMonitor( - chakana.monitor.TimeoutWrapperMonitor, routine, eventpoint = eventpoint, timeout = timeout) - - def threadManager(self): - return self._threadManager - - def registerMonitor(self, monitor): - debug(Debug, "Registering monitor: " + repr(monitor)) - assert(isinstance(monitor, chakana.monitor.Monitor)) - assert(not (monitor in self._monitors)) - assert(not (monitor in self._waitingMonitors)) - self._monitors.append(monitor) - self._monitors.sort() - debug(Debug2, repr(self)) - - def unregisterMonitor(self, monitor): - debug(Debug, "Unregistering monitor: " + repr(monitor)) - assert(isinstance(monitor, chakana.monitor.Monitor)) - assert(monitor in self._monitors) - assert(not (monitor in self._waitingMonitors)) - self._monitors.remove(monitor) - - def registerWaitingMonitor(self, monitor): - debug(Debug, "Registering waiting monitor: " + repr(monitor)) - assert(isinstance(monitor, chakana.monitor.Monitor)) - assert(monitor in self._monitors) - assert(not (monitor in self._waitingMonitors)) - self._waitingMonitors.append(monitor) - self._waitingMonitors.sort() - debug(Debug2, repr(self)) - - def unregisterWaitingMonitor(self, monitor): - debug(Debug, "Unregistering waiting monitor: " + repr(monitor)) - assert(isinstance(monitor, chakana.monitor.Monitor)) - assert(monitor in self._monitors) - assert(monitor in self._waitingMonitors) - self._waitingMonitors.remove(monitor) - debug(Debug2, repr(self)) - - def registerBasicEventpoint(self, eventpoint): - debug(Debug2, "Registering basic eventpoint: " + repr(eventpoint)) - assert(isinstance(eventpoint, chakana.event.BasicEventpoint)) - assert(not (eventpoint in self._eventpoints)) - self._eventpoints.append(eventpoint) - self._eventpoints.sort() - debug(Debug2, repr(self)) - - def unregisterBasicEventpoint(self, eventpoint): - debug(Debug2, "Unregistering basic eventpoint: " + repr(eventpoint)) - assert(not (eventpoint in self._waitingEventpoints)) - assert(eventpoint in self._eventpoints) - self._eventpoints.remove(eventpoint) - debug(Debug2, repr(self)) - - def _registerWaitingEventpoint(self, eventpoint): - debug(Debug2, "Registering waiting eventpoint: " + repr(eventpoint)) - assert(not (eventpoint in self._waitingEventpoints)) - assert(eventpoint in self._eventpoints) - self._waitingEventpoints.append(eventpoint) - self._waitingEventpoints.sort() - - def _unregisterWaitingEventpoint(self, eventpoint): - debug(Debug2, "Unregistering waiting eventpoint: " + repr(eventpoint)) - assert(eventpoint in self._waitingEventpoints) - assert(eventpoint in self._eventpoints) - self._waitingEventpoints.remove(eventpoint) - debug(Debug2, repr(self)) - - def pollContinuation(self): - self._pollConnLock.acquire() - if len(self._waitingMonitors) != len(self._monitors): - self._pollConnLock.release() - return - for monitor in self._monitors: - if not monitor._ready: - self._pollConnLock.release() - return - - for monitor in self._monitors: - assert(not monitor._discarded) - - for eventpoint in self._eventpoints: - assert(not eventpoint._discarded) - - assert(self._waitingMonitors == self._monitors) - assert(self._waitingEventpoints == self._eventpoints) - debug(MinorEvent, "All monitors are waiting, activating COOJA") - assert(not self._coojaContinueEvent.isSet()) - self._coojaContinueEvent.set() - - def waitForCoojaEventpoint(self, eventpoint): - response = self.runCommand("ADD_EVENTPOINT", eventpoint.coojaArguments()) - id = int(response.documentElement.childNodes[0].nodeValue) - debug(Debug, "Waiting for COOJA eventpoint " + str(id)) - - resourceAllocated = 0 - while resourceAllocated == 0: - try: - self._waitMap[id] = (eventpoint, threading.Event()) - resourceAllocated = 1 - except thread.error: - resourceAllocated = 0 - self.threadManager().registerPIDerror() - - self._registerWaitingEventpoint(eventpoint) - eventpoint._isWaitingEvent.set() - - resourceAllocated = 0 - while resourceAllocated == 0: - try: - self._waitMap[id][1].wait() - resourceAllocated = 1 - except thread.error: - resourceAllocated = 0 - self.threadManager().registerPIDerror() - - del self._waitMap[id] - self._unregisterWaitingEventpoint(eventpoint) - try: - self.runCommand("DELETE_EVENTPOINT", { "id" : id }) - debug(Debug, "COOJA event " + str(id) + " has occurred") - except chakana.error.CoojaExit: - pass - except socket.error: - pass - - def runCommand(self, name, args = None, xmlContent = ""): - debug(Debug3, "Running cooja command " + name + ", args: " + repr(args) + - " xml content: " + repr(xmlContent)) - if args is None: - args = {} - self._connectionLock.acquire() - try: - if self._coojaStream.closed: - raise chakana.error.CoojaExit() - command = [''] - for (key, value) in args.items(): - if value is None: - command.append('<' + key + '/>') - else: - command.append('<' + key + '>' + str(value) + '') - command.append(xmlContent + '') - commandStr = "\n".join(command + ['\n']) - debug(MinorEvent, '--> ' + commandStr) - self._coojaStream.write(commandStr) - self._coojaStream.flush() - response = self.readFromCooja() - debug(Debug, response.toprettyxml()) - if response.documentElement.tagName == 'error': - raise chakana.error.CoojaError(response) - self._connectionLock.release() - return response - except socket.error: - debug(MajorEvent, 'Socket error catched') - except AttributeError: - debug(MajorEvent, 'Attribute error catched') - - def readFromCooja(self): - # XXX: Assume message ends with a newline - debug(Debug, "Reading message from COOJA") - responseLines = [self._coojaStream.readline()] - debug(Debug2, "First line: " + repr(responseLines[0])) - (rootElement, slash) = re.match(r"^\s*<(\w+)(/?)>", - responseLines[0]).groups() - debug(Debug3, "Root element: " + rootElement) - if slash != "/": - while 1: - if re.search("$", responseLines[-1], - re.M): - break - responseLines.append(self._coojaStream.readline()) - debug(Debug3, "Read line: " + repr(responseLines[-1])) - result = "".join(responseLines) - debug(MinorEvent, '<-- ' + result) - return xml.dom.minidom.parseString(result) - - def readVariable(self, variable, ** kwArgs): - response = self.readMemory( - type = "variable", variable = variable, ** kwArgs) - arrayString = response.documentElement.childNodes[0].nodeValue.split() - bytes = map(eval, arrayString) - debug(Debug, "Read variable " + variable + " as byte array: " + - repr(bytes)) - return bytes - - def readInt(self, ** kwArgs): - response = self.readMemory(type = "int", ** kwArgs) - return eval(response.documentElement.childNodes[0].nodeValue) - - def readMemory(self, ** kwArgs): - return self.runCommand("READ_MEMORY", kwArgs) - - def killNodesInInterval(self, ** kwArgs): - return self.runCommand("KILL_NODES", kwArgs) - - def sendCustomCommand(self, ** kwArgs): - return self.runCommand("CUSTOM_COMMAND", kwArgs) - - def getSimulationInfo(self, ** kwArgs): - response = self.runCommand("GET_INFO", kwArgs) - return eval(response.documentElement.childNodes[0].nodeValue) - - def __repr__(self): - return "\n ".join([ - "Shepherd:", - "Port: " + repr(self._port), - "Monitors: " + repr(self._monitors), - "Waiting monitors: " + repr(self._waitingMonitors), - "Basic eventpoints: [" + "\n".join(map(repr, self._eventpoints)) + "]", - "Waiting eventpoints: [" + "\n".join( - map(repr, self._waitingEventpoints)) + "]", - "Wait map: " + repr(self._waitMap), - ]) diff --git a/backyard/tools/chakana/test_template/run_test.py b/backyard/tools/chakana/test_template/run_test.py deleted file mode 100644 index 7517b8d88..000000000 --- a/backyard/tools/chakana/test_template/run_test.py +++ /dev/null @@ -1,143 +0,0 @@ -#!/usr/bin/python - -import errno -import optparse -import os -import re -import socket -import sys -import time - -sys.path[:0] = [(os.path.join(os.path.dirname(sys.argv[0]), "../.."))] - -import chakana.threads -import chakana.event -import chakana.harness -import chakana.utils - -from chakana.debug import * - -def main(argv): - sys.stdout = chakana.utils.UnbufferedFile(sys.stdout) - make_option = optparse.make_option - parser = optparse.OptionParser( - usage = os.path.basename(argv[0]) + - """ [options]""", - option_list = [ - make_option("-c", "--cooja-timeout", action = "store", type = "int", - default = 300, - help = "Timeout waiting for COOJA to start"), - make_option("-q", "--quiet", action = "count", default = 0, - help = "Decrease verbosity"), - make_option("-t", "--timeout", action = "store", type = "int", - default = 3600, - help = "Timeout before aborting the whole test"), - make_option("-v", "--verbose", action = "count", default = 0, - help = "Increase verbosity"), - make_option("-s", "--showCOOJA", action = "store", type = "str", - default = "False", - help = "Show COOJA GUI"), - make_option("-x", "--compileCOOJA", action = "store", type = "str", - default = "True", - help = "Compile COOJA before test"), - ]) - (options, args) = parser.parse_args(argv) - debugStream.increaseLevel(options.verbose - options.quiet) - debugStream.cleanLog() - debugStream.pushTransformer(threadPrefix) - - testDir = os.path.dirname(argv[0]) - chakanaRoot = os.path.join(testDir, "..") - harness = chakana.harness.Harness(chakanaRoot, options.cooja_timeout, doCompile=options.compileCOOJA, withGUI=options.showCOOJA) - - - ## TEST START ## - # Start test examples: - # > ./run_test.py - # > ./run_test.py -v 1 - # > ./run_test.py -v 1 --compileCOOJA=False --showCOOJA=True - - - - # Test configuration (read from file?) - totalSimulationRuns = 5 - randomSeed = 12345 # Initial random seed - logFilename = "test.log" - logFile = open(logFilename, 'w') - debug(MajorEvent, "Configuration read") - - # Create log file - title = 'TEST STARTED AT: ' + time.asctime(time.localtime(time.time())) - logFile.write(title + '\n') - logFile.write(''.zfill(len(title)).replace("0", "-") + '\n\n') - logFile.write('Log file: ' + logFilename + '\n') - logFile.write('Simulation runs: ' + str(totalSimulationRuns) + '\n') - logFile.write('Initial random seed: ' + str(randomSeed) + '\n') - logFile.write('\n') - logFile.close() - debug(MajorEvent, "Log file created") - - try: - try: - nrSimulationRuns = 0 - while nrSimulationRuns < totalSimulationRuns: - - ## TEST RUN START ## - - # If not the first test run, shut down COOJA - if nrSimulationRuns > 0: - harness.quit() - harness.waitForAllThreads(options.timeout) - randomSeed = randomSeed + 1 - debug(MajorEvent, "Simulation removed and COOJA shut down") - - # Log current test run - nrSimulationRuns = nrSimulationRuns + 1 - logFile = open(logFilename, 'a') - logFile.write('\nTest run: ' + str(nrSimulationRuns) + '\n') - logFile.write('Random seed: ' + str(randomSeed) + '\n') - logFile.close() - - # Start COOJA - # This may include compiling COOJA - harness.start() - shepherd = harness.shepherd() - - # Create new simulation from stripped COOJA simulation config - # The XML contents are generated by creating a simulation in COOJA, - # saving it to file (.csc), and finally extracting the simulation specifics. - xmlContent = chakana.utils.readFile(os.path.join(testDir, "simple_simulation.csc")) - xmlContent = xmlContent.replace("[RANDOMSEED]", str(randomSeed)) - shepherd.loadConfigurationXML(xmlContent) - debug(MajorEvent, "COOJA started, and simulation created") - - # Create and wait for a simple time monitor (100 sec) - def waitTime(monitor, delay=1000): - startTime = shepherd.getSimulationInfo(type = "time") - debug(MajorEvent, "Waiting " + str(delay) + " ms, starting at " + str(startTime)) - monitor.waitFor(chakana.event.TimeEventpoint(shepherd, startTime + delay)) - debug(MajorEvent, "Waiting finished at " + str(startTime + delay)) - - waitMon = shepherd.newMonitor(waitTime, 100000) - waitMon.startMonitor() - waitMon.waitMonitor() - - logFile = open(logFilename, 'a') - logFile.write('Test run ended\n') - logFile.close() - - ## TEST RUN END ## - - except: - debug(Debug, "Exception detected:\n" + exceptionDump(sys.exc_info())) - harness.killAllProcesses() - raise - - finally: - harness.quit() - harness.waitForAllThreads(options.timeout) - debug(MajorEvent, "Simulation removed and COOJA shut down") - harness.waitForAllThreads(options.timeout) - -if __name__ == "__main__": - sys.exit(main(sys.argv)) diff --git a/backyard/tools/chakana/test_template/simple_simulation.csc b/backyard/tools/chakana/test_template/simple_simulation.csc deleted file mode 100644 index bcb716bfc..000000000 --- a/backyard/tools/chakana/test_template/simple_simulation.csc +++ /dev/null @@ -1,13 +0,0 @@ - A very simple simulation - 0 - 1 - [RANDOMSEED] - 1 - 0 - - se.sics.cooja.radiomediums.UDGM - 50.0 - 100.0 - false - - \ No newline at end of file diff --git a/backyard/tools/chakana/threads.py b/backyard/tools/chakana/threads.py deleted file mode 100644 index 428cc52ff..000000000 --- a/backyard/tools/chakana/threads.py +++ /dev/null @@ -1,287 +0,0 @@ -# -# Copyright (C) 2005-2007 Swedish Institute of Computer Science. -# -# Please refer to the file named LICENSE in the same directory as this file -# for licensing information. -# -# Written and maintained by Lars Albertsson . -# - -# $Id: threads.py,v 1.1 2009/02/26 13:47:38 fros4943 Exp $ - -import signal -import sys -import threading -import time -import Queue -import thread - -import chakana.error -import chakana.linux -from chakana.debug import * - -class ManagedThread(threading.Thread): - def __init__(self, threadManager, ** kwArgs): - self._threadManager = threadManager - self._exceptionInfo = None - resourceAllocated = 0 - while resourceAllocated == 0: - try: - threading.Thread.__init__(self, ** kwArgs) - resourceAllocated = 1 - except thread.error: - resourceAllocated = 0 - self.threadManager().registerPIDerror() - - debug(Event, "Initialising thread " + self.getName()) - self._threadManager._registerThread(self) - - def threadManager(self): - return self._threadManager - - def start(self): - try: - self._threadManager - except: - raise RuntimeError("ManagedThread started, but not initialised properly") - return threading.Thread.start(self) - - def run(self): - debug(Event, self.getName() + " thread is now running") - self.threadManager()._registerThreadStart(self) - try: - self.doRun() - except Exception, err: - debug(MajorEvent, "Caught exception in " + self.getName() + " thread" + - ":\n" + exceptionDump(sys.exc_info())) - self._exceptionInfo = sys.exc_info() - except: - debug(MajorEvent, "Uncaught exception in " + self.getName() + " thread") - self._exceptionInfo = sys.exc_info() - - if not self._exceptionInfo is None: - debug(Event, "Exception caught:\n" + exceptionDump(self._exceptionInfo)) - - debug(Event, self.getName() + " thread is terminating") - if not self.getName() == 'COOJA' and self._exceptionInfo is None: - debug(MinorEvent, self.getName() + " terminated quietly") - self.threadManager()._listLock.acquire() - del self.threadManager()._startedThreads[self.getName()] - del self.threadManager()._activeThreads[self.getName()] - self.threadManager()._listLock.release() - else: - debug(MinorEvent, self.getName() + " terminated normally (slow)") - self.threadManager()._registerResult(self, self._exceptionInfo) - - debug(Debug, "End of " + self.getName() + " thread") - - def doRun(self): - threading.Thread.run(self) - - -class ThreadManager(object): - """Singleton class for managing active python threads.""" - def __init__(self): - self._activeThreads = {} - self._startedThreads = {} - self._threadTerminations = [] - self._pidErrors = 0 - # Protects the three lists above - self._listLock = threading.RLock() - self._threadTerminationQueue = Queue.Queue() - debug(Debug, self.summary()) - - def _registerThread(self, thread): - "Called by thread classes when a thread is created." - assert(isinstance(thread, ManagedThread)) - self._listLock.acquire() - try: - assert(not thread.getName() in self._activeThreads) - debug(Debug, "Registering " + thread.getName() + " thread") - self._activeThreads[thread.getName()] = thread - debug(Debug, self.summary()) - finally: - self._listLock.release() - - def _registerThreadStart(self, thread): - "Called by the thread classes' run method." - assert(isinstance(thread, ManagedThread)) - self._listLock.acquire() - try: - assert(thread.getName() in self._activeThreads) - assert(not thread.getName() in self._startedThreads) - debug(Debug, "Registering " + thread.getName() + " thread start") - self._startedThreads[thread.getName()] = thread - debug(Debug, self.summary()) - finally: - self._listLock.release() - - def _registerResult(self, thread, exceptionInfo): - self._threadTerminationQueue.put((thread.getName(), exceptionInfo)) - - def runningThreads(self): - self._listLock.acquire() - try: - ret = [] - for thread in self._startedThreads.values(): - if not thread.getName() in [ - te[0].getName() for te in self._threadTerminations]: - ret.append(thread) - return ret - finally: - self._listLock.release() - - def unstartedThreads(self): - self._listLock.acquire() - try: - ret = [] - for thread in self._activeThreads.values(): - if not thread.getName() in self._startedThreads: - ret.append(thread) - return ret - finally: - self._listLock.release() - - def numThreadsLeft(self): - return len(self.unfinishedThreads()) - - def unfinishedThreads(self): - "Return created threads that have not terminated." - self._listLock.acquire() - try: - return self._activeThreads.values() - finally: - self._listLock.release() - - def waitAll(self, timeout = 3600, mourningTime = 5): - "Wait for all threads to terminate." - debug(MajorEvent, "Waiting for all test threads to terminate") - debug(MinorEvent, self.summary()) - limit = time.time() + timeout - while self.numThreadsLeft() > 0: - try: - nextTimeout = limit - time.time() - if nextTimeout <= 0: - raise chakana.error.Timeout(self.unfinishedThreads()[0], timeout) - else: - self.waitOne(nextTimeout) - except chakana.error.Timeout, err: - debug(Error, "Timeout waiting for " + err.child.getName() + - " thread, killing subprocesses.") - self.killAll() - while self.numThreadsLeft() > 0: - try: - self.waitOne(mourningTime) - except chakana.error.Timeout: - debug(Error, "Timeout while mourning threads, aborting") - signal.signal(signal.SIGABRT, signal.SIG_DFL) - os.abort() - raise - debug(MinorEvent, "Done waiting for " + str(len(self._startedThreads)) + - " threads") - debug(Debug, self.summary()) - for (thread, excInfo) in self._threadTerminations: - if not excInfo is None: - debug(MinorEvent, "Rethrowing exception from " + thread.getName() + - " thread") - raise chakana.error.ChildException(excInfo[1], excInfo) - - def waitOne(self, timeout): - "Wait for any one thread." - debug(Event, "Waiting for some thread to finish, timeout = " + - str(timeout)) - debug(MinorEvent, self.summary()) - debug(Debug, "Threads left: " + - str(map(ManagedThread.getName, self.unfinishedThreads()))) - assert(self.numThreadsLeft() > 0) - try: - (threadName, exception) = self._threadTerminationQueue.get( - timeout = timeout) - except Queue.Empty: - raise chakana.error.Timeout(self.unfinishedThreads()[0], timeout) - debug(MinorEvent, "Received termination signal from thread " + threadName) - self._listLock.acquire() - try: - assert(threadName in self._activeThreads) - terminatedThread = self._activeThreads[threadName] - assert(terminatedThread.getName() == threadName) - if exception is None: - debug(Debug, "Thread " + threadName + " completed successfully") - else: - debug(Debug, "Thread " + threadName + " raised an exception") - self._threadTerminations.append((terminatedThread, exception)) - self.killAll() - terminatedThread.join() - debug(Debug, "Deleting " + threadName + " thread from active threads") - del self._activeThreads[threadName] - del self._startedThreads[threadName] - finally: - self._listLock.release() - - def killAll(self, reason = "Error detected, killing remaining processes"): - debug(MajorEvent, reason) - chakana.linux.Process(os.getpid()).killAllBelow() - - def registerPIDerror(self): - self._pidErrors = self._pidErrors + 1 - if self._pidErrors > 100000: - self.killAll(reason = "PID allocation errors > 100000") - - def nrPIDerrors(self): - return self._pidErrors - - def summary(self): - return "ThreadManager: " + str(self.numThreadsLeft()) + \ - " threads left, " + \ - str(len(self.unstartedThreads())) + " unstarted threads,\n" + \ - str(len(self.runningThreads())) + " running threads" - -class TimeoutHelperThread(threading.Thread): - def __init__(self, func, funcArgs, funcKwArgs, ** kwArgs): - threading.Thread.__init__(self, ** kwArgs) - self._func = func - self._args = funcArgs - self._kwArgs = funcKwArgs - self.result = None - self.error = None - - def run(self): - try: - self.result = self._func(* self._args, ** self._kwArgs) - except Exception, err: - debug(Debug, "Caught exception in timeout function: " + str(err) + - ":\n" + exceptionDump(sys.exc_info())) - self.error = err - self.exc_info = sys.exc_info() - -class RunWithTimeout: - """Run func in a separate thread. If timeout seconds elapse, give - up, raise Timeout(thread, timeout)""" - - def __init__(self, timeout, func, name = None): - self._timeout = timeout - self._func = func - if name is None: - self._name = "thread running " + str(func) - else: - self._name = name - - def __call__(self, * args, ** kwArgs): - thread = TimeoutHelperThread(self._func, args, kwArgs, name = self._name) - thread.start() - thread.join(self._timeout) - if thread.isAlive(): - raise chakana.error.Timeout(thread, self._timeout) - if thread.error is None: - return thread.result - raise chakana.error.ChildException(thread.error, thread.exc_info) - -def waitForAll(threads, timeout): - startTime = time.time() - for t in threads: - if timeout is None: - t.join() - else: - t.join(startTime + timeout - time.time()) - if t.isAlive(): - raise chakana.error.Timeout(t, timeout) diff --git a/backyard/tools/chakana/utils.py b/backyard/tools/chakana/utils.py deleted file mode 100644 index 668685af6..000000000 --- a/backyard/tools/chakana/utils.py +++ /dev/null @@ -1,736 +0,0 @@ - -# Copyright (C) 2003-2007 Swedish Institute of Computer Science. -# -# Please refer to the file named LICENSE in the same directory as this -# file for licensing information. -# - - -# $Id: utils.py,v 1.1 2009/02/26 13:47:38 fros4943 Exp $ - -import errno -import math -import operator -import os -import popen2 -import re -import string -import shutil -import sys -import tempfile -import threading -import traceback -import types - -import chakana.command -import chakana.error -from chakana.debug import * - -try: - global False - global True - _ = False -except NameError: - False = 0 - True = 1 - -class DefaultDict(dict): - def __init__(self, defaultCreator, initialiser = (), inject = 0): - dict.__init__(self, initialiser) - if callable(defaultCreator): - self._defaultCreator = defaultCreator - else: - self._defaultCreator = lambda k: defaultCreator - self._inject = inject - - def __getitem__(self, key): - try: - return dict.__getitem__(self, key) - except KeyError, err: - value = self._defaultCreator(key) - if self._inject: - self[key] = value - return self[key] - else: - return value - -class UnbufferedFile: - def __init__(self, fileObj): - self._fileObj = fileObj - - def __getattr__(self, attribute): - return getattr(self._fileObj, attribute) - - def write(self, what): - self._fileObj.write(what) - self._fileObj.flush() - -def copyFile(src, dest): - debug(Event, "cp " + src + " " + dest) - srcFile = file(src) - destFile = file(dest, "w") - destFile.write(srcFile.read()) - srcFile.close() - destFile.close() - -def unique(list): - ret = [] - inList = {} - for elem in list: - if not elem in inList: - ret.append(elem) - inList[elem] = 1 - return ret - -def unorderedEqual(listOne, listTwo, predicate = lambda x, y: x == y): - if len(listOne) != len(listTwo): - return 0 - list1 = list(listOne) - list2 = list(listTwo) - while list1 != []: - found = 0 - for index in range(len(list2)): - if predicate(list1[0], list2[index]): - del list1[0] - del list2[index] - found = 1 - break - if not found: - return 0 - return 1 - -def reduceSequences(tupleSeq, oper = operator.add): - """Return a list, where the item at position i is the reduced value - of all items at position i.""" - - if len(tupleSeq) == 0: - return [] - return [reduce(oper, [s[i] for s in tupleSeq]) - for i in range(len(tupleSeq[0]))] - -def listRemove(theList, predicate): - """Remove all items that match predicate in theList.""" - if not callable(predicate): - return listRemove(theList, lambda x: x == predicate) - else: - index = 0 - while index < len(theList): - if predicate(theList[index]): - del theList[index] - else: - index += 1 - return theList - -def logn(n, x): - return math.log(x) / math.log(n) - -def longRange(* args): - """As range, but works with long integers.""" - if len(args) == 1: - start = 0L - stop = args[0] - step = 1L - elif len(args) == 2: - (start, stop) = args - step = 1L - else: - (start, stop, step) = args - if step == 0: - raise ValueError("longRange() arg 3 must not be zero") - ret = [] - while cmp(start, stop) == cmp(0, step): - ret.append(start) - start += step - return ret - -integerSuffixes = ("", "K", "M", "G", "T") - -def abbreviateInteger(i, factor = 1024, minimise = 0): - suf = 0 - while suf < len(integerSuffixes) - 1 and \ - ((i > 9999) or (minimise and (i != 0) and (i % factor == 0))): - suf += 1 - i /= factor - return str(i) + integerSuffixes[suf] - -def readSuffixedInt(intString, factor = 1024): - if intString[-1].isalpha(): - return int(intString[: -1]) * ( - factor ** list(integerSuffixes).index(intString[-1].upper())) - else: - return int(intString) - -def normaliseIndex(index, seq): - """Return a non-negative index relating to a sequence, or negative if - index < - len(seq).""" - - if index < 0: - return len(seq) + index - else: - return index - -def truncateIndex(index, seq): - """Return a non-negative index relating to a sequence, less than or equal - to the length of the sequence.""" - ret = normaliseIndex(index, seq) - if ret < 0: - return 0 - length = len(seq) - if ret > length: - return length - return ret - -class LazySlice: - """Representation of slice into other sequence.""" - def __init__(self, seq, start = None, stop = None, step = None): - self._sequence = seq - if step is None: - self._step = 1 - else: - self._step = step - if self._step == 0: - # Provoke ValueError - [][0:1:0] - - if self._step > 0: - startDefault = 0 - stopDefault = len(seq) - indexShift = 0 - else: - startDefault = len(seq) - 1 - stopDefault = -1 - indexShift = 1 - - if start is None: - self._start = startDefault - else: - self._start = truncateIndex(start + indexShift, seq) - indexShift - if stop is None: - self._stop = stopDefault - else: - self._stop = truncateIndex(stop + indexShift, seq) - indexShift - - if (self._step > 0) != (self._start < self._stop): - self._stop = self._start - - def __getitem__(self, key): - # debug(Debug2, "LS getitem " + str(key) + ": " + repr(self)) - if type(key) == types.SliceType: - ret = LazySlice(self, key.start, key.stop, key.step) - #debug(Debug2, "LS getitem " + str(key) + " = " + - # repr(ret) + ", LS: " + repr(self)) - return ret - index = normaliseIndex(key, self) - if index < 0: - # Provoke IndexError - [][1] - seqIndex = self._start + index * self._step - if self._step > 0: - if seqIndex >= self._stop: - [][1] - elif seqIndex <= self._stop: - [][1] - ret = self._sequence[seqIndex] - #debug(Debug2, "LS getitem " + str(key) + " (" + str(seqIndex) + ") = " + - # str(ret) + ", LS: " + repr(self)) - return ret - - def __len__(self): - return (abs(self._stop - self._start) + abs(self._step) - 1) / \ - abs(self._step) - - def __str__(self): - return str(list(self)) - - def __repr__(self): - return "LazySlice(start = " + str(self._start) + ", stop = " + \ - str(self._stop) + ", step = " + str(self._step) + ",\n " + \ - repr(self._sequence) + ")" - -def getItem(sequence, key): - """Obtain key in sequence. Key may be an integer or a slice object.""" - if type(key) == types.SliceType: - if key.step is None: - return sequence[key.start : key.stop] - return sequence[key.start : key.stop : key.step] - return sequence[key] - -def binarySearch(list, value, start = 0, end = None): - "Return the position where value should be inserted in a sorted list." - if end is None: - end = len(list) - if start == end: - return end - middle = start + (end - start) / 2 - if list[middle] < value: - return binarySearch(list, value, middle + 1, end) - else: - return binarySearch(list, value, start, middle) - -def binaryFind(list, value, *args, ** kwArgs): - "Return position of value in sorted list, or None if not found." - position = binarySearch(list, value, *args, ** kwArgs) - if (position == len(list)) or (list[position] != value): - return None - else: - return position - -def compactIntListRepr(input, sort = 0): - if sort: - list = input[:] - list.sort() - else: - list = input - if __debug__: - tmp = list[:] - tmp.sort() - assert(tmp == list) - index = 0 - ret = "[" - sep = "" - compact = lambda l, i: (i + 1 < len(l)) and (l[i] + 1 == l[i + 1]) - while index < len(list): - ret += sep + str(list[index]) - if compact(list, index): - ret += "-" - while compact(list, index): - index += 1 - ret += str(list[index]) - index += 1 - sep = "," - return ret + "]" - -def predicatedIndex(sequence, predicate): - for i in range(len(sequence)): - if predicate(sequence[i]): - return i - raise ValueError() - -class ArgumentBinder: - def __init__(self, function, argument, position = 0): - self.__function = function - self.__argument = argument - self.__position = position - - def __call__(self, *args, **keywords): - newArgs = list(args) - newArgs[self.__position : self.__position] = [self.__argument] - return self.__function(*newArgs, **keywords) - -class ArgumentTupleBinder: - def __init__(self, function, arguments): - self._function = function - self._arguments = arguments - - def __call__(self, * args, ** kwArgs): - return self._function(* (self._arguments + args), ** kwArgs) - -class KeywordArgumentBinder: - def __init__(self, function, ** keywords): - self._function = function - self._keywords = keywords - - def __call__(self, * args, ** kwArgs): - kw = self._keywords - kw.update(kwArgs) - return self._function(* args, ** kw) - -cppKeywords = ["asm", "do", "inline", "short", "typeid", "auto", - "double", "int", "signed", "typename", "bool", - "dynamic_cast", "long", "sizeof", "union", "break", - "else", "mutable", "static", "unsigned", "case", - "enum", "namespace", "static_cast", "using", "catch", - "explicit", "new", "struct", "virtual", "char", - "extern", "operator", "switch", "void", "class", - "false", "private", "template", "volatile", "const", - "float", "protected", "this", "wchar_t", "const_cast", - "for", "public", "throw", "while", "continue", - "friend", "register", "true", "default", "goto", - "reinterpret_cast", "try", "delete", "if", "return", - "typedef"] - -def isCWord(str): - return not re.match("^[a-zA-Z_][a-zA-Z0-9_]*$", str) is None - -def isCppIdentifier(str): - return isCWord(str) and (str not in cppKeywords) - -def find(seq, predicate = lambda x: x): - for item in seq: - if predicate(item): - return item - return None - -def allBest(seq, comparator = cmp): - if len(seq) < 2: - return seq - seq = seq[:] - ret = [seq.pop()] - for item in seq: - c = comparator(item, ret[0]) - if c < 0: - ret = [item] - elif c == 0: - ret.append(item) - return ret - -def readFile(fileName): - f = open(fileName) - try: - ret = f.read() - return ret - finally: - f.close() - -def writeFile(fileName, contents): - f = open(fileName, "w") - try: - f.write(contents) - finally: - f.close() - -def writeFileAtomic(fileName, contents, suffix = ".tmp"): - tmpFile = fileName + suffix - writeFile(tmpFile, contents) - try: - os.rename(tmpFile, fileName) - except: - if os.path.exists(fileName) and os.path.exists(tmpFile): - os.remove(tmpFile) - raise - - -class LineIndexed: - """Read-only file object indexed by line number. The file object must - support seeking.""" - - def __init__(self, fileName, offset = 0): - if type(fileName) == type(""): - self._file = file(fileName) - else: - self._file = fileName - self._offset = offset - self._length = None - self._lineOffsets = [0] - - def close(self): - self._file.close() - - def __del__(self): - self.close() - - def _seekForward(self, index): - if self._length == 0: - raise IndexError() - for index in range(len(self._lineOffsets), index + 1): - if self._lineOffsets[-1] == self._length: - raise IndexError() - self._file.seek(self._lineOffsets[-1] + self._offset) - line = self._file.readline() - if line == "": - self._length = self._lineOffsets[-1] - else: - self._lineOffsets.append(self._lineOffsets[-1] + len(line)) - - def __getitem__(self, key): - if type(key) == types.SliceType: - ret = LazySlice(self, key.start, key.stop, key.step) - return ret - if key < 0: - positiveLength = len(self) + key - if positiveLength < 0: - raise IndexError() - return self[positiveLength] - self._seekForward(key) - offset = self._lineOffsets[key] - if offset == self._length: - raise IndexError() - self._file.seek(offset + self._offset) - return self._file.readline() - - def __len__(self): - if self._length == 0: - return 0 - while self._lineOffsets[-1] != self._length: - self._seekForward(len(self._lineOffsets)) - return len(self._lineOffsets) - 1 - - def lineOffset(self, index): - self._seekForward(index) - return self._lineOffsets[index] - - def __str__(self): - return str(list(self)) - - def __repr__(self): - return "LineIndexed(offset = " + str(self._offset) + ", length = " + \ - str(self._length) + ", lineOffsets: " + \ - str(self._lineOffsets) + ")" - -def getLine(fileName, count): - fileObj = file(fileName) - if count < 0: - return fileObj.readlines()[count] - for i in range(count + 1): - ret = fileObj.readline() - if ret == "": - raise IndexError() - return ret - -def conditionalJoin(list, separator = " ", predicate = lambda e: e != ""): - if len(list) == 0: - return "" - rest = conditionalJoin(list[1:], separator, predicate) - if not predicate(rest): - return list[0] - if not predicate(list[0]): - return rest - else: - return list[0] + separator + rest - -def pathComponents(path): - (head, tail) = os.path.split(path) - if tail == "": - if head == "": - return [] - if head == "/": - return ["/"] - else: - return pathComponents(head) - else: - return pathComponents(head) + [tail] - -def commonFirstElements(listOfLists): - if len(listOfLists) == 0: - return [] - if len(listOfLists) == 1: - return listOfLists[0] - if (len(listOfLists[0]) == 0) or (len(listOfLists[1]) == 0) or \ - (listOfLists[0][0] != listOfLists[1][0]): - return [] - else: - return commonFirstElements([ - [listOfLists[0][0]] + - commonFirstElements([listOfLists[0][1:], listOfLists[1][1:]])] - + listOfLists[2:]) - -def commonPrefix(pathList): - """Similar to os.path.commonprefix, but works on path components instead - of individual characters.""" - - assert(not isinstance(pathList, str)) - components = commonFirstElements(map(pathComponents, pathList)) - if components == []: - return "" - else: - return os.path.join(* components) - -def pathIsBelow(path, directory): - """Check if path lies below directory.""" - return commonPrefix([path, directory]) == directory - -def realPath(path): - """Similar to os.path.realpath, but handles amd gracefully.""" - ret = os.path.realpath(path) - for binDir in os.environ["PATH"].split(":") + ["/usr/sbin", "/sbin"]: - amq = os.path.join(binDir, "amq") - if os.path.isfile(amq): - try: - output = chakana.command.output(amq) - except chakana.error.CommandFailed, err: - debug(Debug, str(err)) - # Assume amd is not running - return ret - for line in output.splitlines(): - amdDir = line.split()[0] - mountDir = line.split()[-1] - if mountDir[0] == "/": - match = re.match('^(' + re.escape(line) + ')(/$)', ret) - if match: - return amdDir + ret[len(line) :] - return ret - return ret - -def removeTree(path, ignoreErrors = False): - debug(Debug, "rm -rf " + path) - if os.path.isdir(path): - shutil.rmtree(path, ignore_errors = ignoreErrors) - -def makeSymlink(value, dest, force = True, debugLevel = MinorEvent, - dryRun = False): - if os.path.islink(dest): - if os.readlink(dest) == value: - debug(Debug, "Link " + dest + " already points to " + value) - return - elif force: - debug(debugLevel, "Removing " + dest) - if not dryRun: - os.remove(dest) - else: - raise OSError((errno.EEXIST, "Link already exists", dest)) - absValue = os.path.join(os.path.dirname(dest), value) - if (not dryRun) and (not force) and (not os.path.isfile(absValue)): - raise OSError((errno.ENOENT, "Link destination does not exist", absDest)) - debug(debugLevel, "Linking " + dest + " to " + value) - if not dryRun: - os.symlink(value, dest) - -def copyTree(src, dst, symlinks = False, predicate = lambda path: 1, - preserveTimes = False): - """Similar to shutil.copytree, but allows existing destination and - passes exceptions.""" - names = filter(predicate, os.listdir(src)) - if not os.path.isdir(dst): - os.mkdir(dst) - for name in names: - srcname = os.path.join(src, name) - dstname = os.path.join(dst, name) - try: - if symlinks and os.path.islink(srcname): - linkto = os.readlink(srcname) - os.symlink(linkto, dstname) - elif os.path.isdir(srcname): - copyTree(srcname, dstname, symlinks, predicate, preserveTimes) - else: - if preserveTimes: - shutil.copy2(srcname, dstname) - else: - shutil.copy(srcname, dstname) - # XXX What about devices, sockets etc.? - except (IOError, os.error), why: - debug(Error, "Can't copy %s to %s: %s" % - (`srcname`, `dstname`, str(why))) - raise - -def makeDirsSafe(dir, mode = 0777): - """Similar to os.makedirs, but does not fail if another process is making - the directory simultaneously.""" - while not os.path.isdir(dir): - try: - os.makedirs(dir, mode) - except OSError, err: - if err.errno != errno.EEXIST: - raise - -def typeAssert(variable, type): - assert(isinstance(variable, type)) - -def intervalsOverlap(range1, range2): - if range1 > range2: - return intervalsOverlap(range2, range1) - if (range1[0] == range1[1]) or (range2[0] == range2[1]): - return 0 - return range2[0] < range1[1] - -class LexicalDistance: - def __init__(self, caseChange = 1, whiteSpaceChange = 2, - whiteSpaceRemoval = 3, ampersand = 5, other = 10, - whiteSpace = " _-'\""): - self.__caseChange = caseChange - self.__whiteSpaceChange = whiteSpaceChange - self.__whiteSpaceRemoval = whiteSpaceRemoval - self.__ampersand = ampersand - self.__other = other - self.__whiteSpace = whiteSpace - - def removeWhiteSpace(self, str1, str2, limit): - if str1[0] in self.__whiteSpace: - if limit > self.__whiteSpaceRemoval: - return self(str1[1:], str2, limit - self.__whiteSpaceRemoval) + \ - self.__whiteSpaceRemoval - return limit - - def changeWhiteSpace(self, str1, str2, limit): - if (str1[0] in self.__whiteSpace) and (str2[0] in self.__whiteSpace): - if limit > self.__whiteSpaceChange: - return self(str1[1:], str2[1:], limit - self.__whiteSpaceChange) + \ - self.__whiteSpaceChange - return limit - - def changeCase(self, str1, str2, limit): - if str1[0].upper() == str2[0].upper(): - if limit > self.__caseChange: - return self(str1[1:], str2[1:], limit - self.__caseChange) + \ - self.__caseChange - return limit - - def changeAmpersand(self, str1, str2, limit): - if (str1[0] == "&") and (str2[:3].lower() == "and"): - if limit > self.__ampersand: - return self(str1[1:], str2[3:], limit - self.__ampersand) + \ - self.__ampersand - return limit - - def removeOther(self, str1, str2, limit): - if limit > self.__other: - return self(str1[1:], str2, limit - self.__other) + self.__other - return limit - - def changeOther(self, str1, str2, limit): - if limit > self.__other: - return self(str1[1:], str2[1:], limit - self.__other) + self.__other - return limit - - def __call__(self, str1, str2, limit = 50): - ret = limit - if str1 == "": - if str2 == "": - return 0 - ret = self.removeWhiteSpace(str2, str1, ret) - ret = self.removeOther(str2, str1, ret) - elif str2 == "": - ret = self(str2, str1, ret) - else: - if str1[0] == str2[0]: - ret = self(str1[1:], str2[1:], ret) - else: - ret = self.removeWhiteSpace(str1, str2, ret) - ret = self.removeWhiteSpace(str2, str1, ret) - ret = self.changeWhiteSpace(str1, str2, ret) - ret = self.changeCase(str1, str2, ret) - ret = self.changeAmpersand(str1, str2, ret) - ret = self.changeAmpersand(str2, str1, ret) - ret = self.changeOther(str1, str2, ret) - ret = self.removeOther(str1, str2, ret) - ret = self.removeOther(str2, str1, ret) - assert(ret <= limit) - return ret - -class TryOperation: - def __init__(self, operation, description = None): - self.__operation = operation - if description is None: - self.__description = str(operation) - else: - self.__description = description - - def __call__(self, * args, ** kwargs): - try: - self.__operation(* args, ** kwargs) - except KeyboardInterrupt: - raise - except: - import debug as d - d.debug(d.Error, self.__description + " failed\n" + - d.exceptionDump(sys.exc_info())) - -def lineDirective(): - fileInfo = traceback.extract_stack(None, 2)[0] - return "#line " + repr(fileInfo[1] + 1) + " \"" + fileInfo[0] + "\"" - -try: - mkstemp = tempfile.mkstemp -except AttributeError: - def mkstemp(suffix = "", prefix = None, dir = None, text = 0): - if prefix is None: - prefix = tempfile.gettempprefix() - fileName = tempfile.mktemp(suffix) - if dir is None: - dir = os.path.dirname(fileName) - newFileName = os.path.join(dir, prefix + os.path.basename(fileName)) - if text: - flags = "w" - else: - flags = "wb" - return (file(newFileName, flags), newFileName) - diff --git a/backyard/tools/cooja/apps/serial2pipe/build.xml b/backyard/tools/cooja/apps/serial2pipe/build.xml deleted file mode 100644 index c3c3b3a5a..000000000 --- a/backyard/tools/cooja/apps/serial2pipe/build.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/backyard/tools/cooja/apps/serial2pipe/cooja.config b/backyard/tools/cooja/apps/serial2pipe/cooja.config deleted file mode 100644 index cb9f805fe..000000000 --- a/backyard/tools/cooja/apps/serial2pipe/cooja.config +++ /dev/null @@ -1,2 +0,0 @@ -se.sics.cooja.GUI.PLUGINS = + se.sics.cooja.plugins.Serial2Pipe -se.sics.cooja.GUI.JARFILES = + serial2pipe.jar diff --git a/backyard/tools/cooja/apps/serial2pipe/java/se/sics/cooja/plugins/Serial2Pipe.java b/backyard/tools/cooja/apps/serial2pipe/java/se/sics/cooja/plugins/Serial2Pipe.java deleted file mode 100644 index 5f3faeccc..000000000 --- a/backyard/tools/cooja/apps/serial2pipe/java/se/sics/cooja/plugins/Serial2Pipe.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: Serial2Pipe.java,v 1.1 2009/05/18 14:48:10 fros4943 Exp $ - */ - -package se.sics.cooja.plugins; - -import java.awt.GridLayout; -import java.io.BufferedReader; -import java.io.InputStreamReader; -import java.util.Observable; -import java.util.Observer; -import javax.swing.*; -import org.apache.log4j.Logger; - -import se.sics.cooja.*; -import se.sics.cooja.contikimote.interfaces.ContikiRS232; - -@ClassDescription("Serial 2 Pipe") -@PluginType(PluginType.MOTE_PLUGIN) -public class Serial2Pipe extends VisPlugin { - private static Logger logger = Logger.getLogger(Serial2Pipe.class); - - private static final long serialVersionUID = 1L; - - private static int pipeNrCounter = 1; - - private Mote mote; - - private ContikiRS232 serialInterface; - - private String inPipeName; - - private String outPipeName; - - private int pipeNr = pipeNrCounter++; // Increase pipe number - - private Thread pipeListener; - - private Observer serialObserver; - - public Serial2Pipe(Mote moteToView, Simulation simulation, GUI gui) { - super("Serial 2 Pipe (" + moteToView + ")", gui); - mote = moteToView; - - // Determine pipe names - inPipeName = "s2p" + pipeNr + "in"; - outPipeName = "s2p" + pipeNr + "out"; - - // Create pipes - try { - Process subProcess = Runtime.getRuntime().exec( - new String[] { "mkfifo", inPipeName }); - subProcess.waitFor(); -// logger.debug("Creating in pipe returned: " + subProcess.exitValue()); - subProcess = Runtime.getRuntime().exec( - new String[] { "mkfifo", outPipeName }); - subProcess.waitFor(); -// logger.debug("Creating out pipe returned: " + subProcess.exitValue()); - } catch (Exception e) { - logger.fatal("Error when creating pipes: " + e); - } - - // Forward serial interface to out pipe - serialInterface = mote.getInterfaces().getInterfaceOfType( - ContikiRS232.class); - serialInterface.addObserver(serialObserver = new Observer() { - public void update(Observable obs, Object obj) { - // Start shell process which forwards the data - try { - Runtime.getRuntime().exec( - new String[] { - "sh", - "-c", - "echo " + serialInterface.getSerialMessages() + " > " - + outPipeName }); -// logger.debug("Forwarding from serial " -// + serialInterface.getSerialMessages()); - } catch (Exception ex) { - logger.fatal("Error when writing to out pipe: " + ex); - } - } - }); - - // Forward incoming data from in pipe (separate thread) - pipeListener = new Thread(new Runnable() { - public void run() { - try { - while (true) { - // Start shell process which reads the data - Process subProcess = Runtime.getRuntime().exec( - new String[] { "sh", "-c", "cat " + inPipeName }); - BufferedReader in = new BufferedReader(new InputStreamReader( - subProcess.getInputStream())); - char[] buffer = new char[512]; - int bytes_read; - bytes_read = in.read(buffer); - if (bytes_read > 0) { - String msg = String.copyValueOf(buffer, 0, bytes_read); -// logger.debug("Forwarding to serial: " + msg); - serialInterface.sendSerialMessage(msg); - } - in.close(); - subProcess.waitFor(); - } - } catch (Exception e) { - logger.fatal("Error while reading from in pipe: " + e); - } - } - }); - pipeListener.start(); - - // Add GUI labels - setLayout(new GridLayout(2, 2)); - - add(new JLabel("In pipe:")); - add(new JLabel(inPipeName)); - - add(new JLabel("Out pipe:")); - add(new JLabel(outPipeName)); - - setSize(300, 70); - - try { - setSelected(true); - } catch (java.beans.PropertyVetoException e) { - // Could not select - } - } - - public void closePlugin() { - // Stop listening to serial port - if (serialInterface != null && serialObserver != null) { - serialInterface.deleteObserver(serialObserver); - serialObserver = null; - } - - // Stop listening to in pipe - if (pipeListener != null) - pipeListener.interrupt(); - - // Remove earlier created pipes - try { - Runtime.getRuntime().exec(new String[] { "rm", inPipeName }); - Runtime.getRuntime().exec(new String[] { "rm", outPipeName }); - } catch (Exception e) { - logger.fatal("Error when deleting pipes"); - } - } - -} diff --git a/backyard/tools/cooja/examples/project_debug/build.xml b/backyard/tools/cooja/examples/project_debug/build.xml deleted file mode 100644 index cd1b65564..000000000 --- a/backyard/tools/cooja/examples/project_debug/build.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/backyard/tools/cooja/examples/project_debug/cooja.config b/backyard/tools/cooja/examples/project_debug/cooja.config deleted file mode 100644 index d59479393..000000000 --- a/backyard/tools/cooja/examples/project_debug/cooja.config +++ /dev/null @@ -1 +0,0 @@ -se.sics.cooja.GUI.PLUGINS = + MoteDebugger diff --git a/backyard/tools/cooja/examples/project_debug/java/MoteDebugger.java b/backyard/tools/cooja/examples/project_debug/java/MoteDebugger.java deleted file mode 100644 index 8fc573605..000000000 --- a/backyard/tools/cooja/examples/project_debug/java/MoteDebugger.java +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright (c) 2006, Swedish Institute of Computer Science. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $Id: MoteDebugger.java,v 1.1 2009/05/18 14:48:10 fros4943 Exp $ - */ - -import java.awt.event.*; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import javax.swing.*; -import org.apache.log4j.Logger; -import java.io.*; -import java.lang.management.*; - -import se.sics.cooja.*; -import se.sics.cooja.contikimote.ContikiMote; -import se.sics.cooja.contikimote.ContikiMoteType; - -/** - * Mote debugger lets a user debug a mote using an external debugger. - * - * It executes the external program 'gdb' and sets up breakpoints - * at the entry of the tick function. - * - * The selected mote is then set to state active and ticked. - * - * OBSERVE! Experimental code. Not fully tested yet! - * - * @author Fredrik Osterlind - */ -@ClassDescription("Debug using GDB") -@PluginType(PluginType.MOTE_PLUGIN) -public class MoteDebugger extends VisPlugin {; - - private static final long serialVersionUID = 1L; - private static Logger logger = Logger.getLogger(MoteDebugger.class); - private ContikiMote moteToDebug; - private Simulation mySimulation; - - /** - * Creates a new VisDebug. - * @param mote Contiki mote to debug next tick - */ - public MoteDebugger(Mote mote, Simulation simulation, GUI gui) { - super("VisDebug (" + mote + ")", gui); - this.moteToDebug = (ContikiMote) mote; - this.mySimulation = simulation; - - JButton debugButton = new JButton("Debug now"); - debugButton.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - logger.warn("OBSERVE! This is experimental code"); - - logger.info("Getting JVM pid"); - RuntimeMXBean rt = ManagementFactory.getRuntimeMXBean(); - String runtimeName = rt.getName(); - int pid = 1; - - String pidExtraction = "^([0-9]*)[^$]*$"; - Pattern pattern = Pattern.compile(pidExtraction); - Matcher matcher = pattern.matcher(runtimeName); - if (!matcher.find()) { - logger.fatal("Could not determine pid, aborting"); - return; - } - - pid = Integer.parseInt(matcher.group(1)); - if (pid <= 0) { - logger.fatal("Pid seems to be strange, aborting. pid=" + pid); - return; - } - - logger.info("Extracted PID=" + pid); - - logger.info("Checking that source code file exists.."); - File sourceFile = new File(ContikiMoteType.tempOutputDirectory, moteToDebug.getType().getIdentifier() + ".c"); - if (!sourceFile.exists()) { - logger.fatal("Can't find source file: " + sourceFile); - return; - } - - logger.info("Source file ok: " + sourceFile); - - - logger.info("Determining function name to break at (entry of tick)"); - String libName = ((ContikiMoteType) moteToDebug.getType()).getLibraryClassName(); - - String functionName = "Java." + CoreComm.class.getPackage().getName() + ".corecomm." + libName + ".tick"; - functionName = functionName.replaceAll("\\.", "_"); - - logger.info("Function name is: " + functionName); - - logger.info("Creating temporary file .tmp with initial commands"); - File tmpFile = new File(ContikiMoteType.tempOutputDirectory, ".tmp"); - if (tmpFile.exists()) { - tmpFile.delete(); - } - try { - BufferedWriter tmpStream = new BufferedWriter( - new OutputStreamWriter( - new FileOutputStream( - tmpFile))); - tmpStream.write("break " + functionName + "\n"); - tmpStream.write("cont\n"); - tmpStream.close(); - } catch (Exception ex) { - logger.fatal("Could not create temporary command file: " + tmpFile); - return; - } - - logger.info("Command file created ok: " + tmpFile.getName()); - - logger.info("Starting external GDB"); - logger.info("> GDB must be exited before control is returned to COOJA"); - logger.info("> Use command 'quit' followed by y to exit GDB"); - - Process gdbProcess = null; - try { - gdbProcess = Runtime.getRuntime().exec("xterm -e gdb" - + " -nw -quiet " - + " --pid=" + pid - + " -x " + ContikiMoteType.tempOutputDirectory.getName() + "/" + tmpFile.getName() - ); - - logger.info("Sleeping 2500 ms while starting up GDB"); - Thread.sleep(2500); - logger.info("Ticking chosen mote now! (setting state to active)"); - moteToDebug.setState(Mote.State.ACTIVE); - moteToDebug.tick(mySimulation.getSimulationTime()); - - gdbProcess.waitFor(); - } catch (Exception ex) { - logger.fatal("Exception while starting gdb, aborting"); - } - - logger.debug("GDB terminated with exit code: " + gdbProcess.exitValue()); - } - }); - - add(debugButton); - setSize(250, 80); - } - - public void closePlugin() { - } - -}