NEC PC-6001 support sources are initially added.
This commit is contained in:
parent
c258a2e83a
commit
6dd93a3d04
55
platform/pc-6001/Makefile
Normal file
55
platform/pc-6001/Makefile
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
#
|
||||||
|
# Makefile for PC-6001 using z80/SDCC
|
||||||
|
# @author Takahide Matsutsuka <markn@markn.org>
|
||||||
|
#
|
||||||
|
# $Id: Makefile,v 1.1 2007/09/11 12:12:59 matsutsuka Exp $
|
||||||
|
#
|
||||||
|
|
||||||
|
CONTIKI = ../..
|
||||||
|
TARGET=pc-6001
|
||||||
|
APPS_DESKTOP = program-handler calc process-list shell about
|
||||||
|
APPS_NETWORK = netconf cmdd
|
||||||
|
|
||||||
|
# editor netconf dhcp webbrowser ftp irc email telnet telnetd
|
||||||
|
# cmdd codeprop webserver vnc
|
||||||
|
# directory
|
||||||
|
|
||||||
|
PLATFORM_APPS_DESKTOP = multithread tinysample
|
||||||
|
PLATFORM_APPS_NETWORK = webserver-mini
|
||||||
|
|
||||||
|
#defualt values
|
||||||
|
#16K, 32K, or ROM
|
||||||
|
MEMORY=32K
|
||||||
|
#PC6001, PC6001A, or PC6001MK2
|
||||||
|
ARCH=PC6001
|
||||||
|
|
||||||
|
APPS = $(APPS_DESKTOP)
|
||||||
|
PLATFORM_APPS=$(PLATFORM_APPS_DESKTOP)
|
||||||
|
|
||||||
|
all: p6
|
||||||
|
|
||||||
|
p6:
|
||||||
|
rm -f contiki.ihex
|
||||||
|
make contiki
|
||||||
|
p62:
|
||||||
|
rm -f contiki.ihex;
|
||||||
|
make contiki ARCH=PC6001MK2
|
||||||
|
p6A:
|
||||||
|
rm -f contiki.ihex;
|
||||||
|
make contiki ARCH=PC6001A
|
||||||
|
minimal:
|
||||||
|
rm -f contiki.ihex;
|
||||||
|
make contiki MEMORY=16K CONTIKI_TARGET_MAIN=contiki-minimal-main.c
|
||||||
|
|
||||||
|
serial:
|
||||||
|
rm -f contiki.ihex;
|
||||||
|
make contiki MEMORY=16K CONTIKI_TARGET_MAIN=contiki-serial-main.c
|
||||||
|
|
||||||
|
rom:
|
||||||
|
rm -f contiki.ihex;
|
||||||
|
make contiki.rom MEMORY=ROM CONTIKI_TARGET_MAIN=contiki-rom-main.c
|
||||||
|
slip:
|
||||||
|
rm -f contiki.ihex;
|
||||||
|
make contiki APPS="$(APPS_NETWORK)" PLATFORM_APPS="$(PLATFORM_APPS_NETWORK)" CONTIKI_TARGET_MAIN=contiki-slip-main.c
|
||||||
|
|
||||||
|
include $(CONTIKI)/Makefile.include
|
94
platform/pc-6001/Makefile.pc-6001
Normal file
94
platform/pc-6001/Makefile.pc-6001
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
#
|
||||||
|
# Makefile for PC-6001 using z80/SDCC
|
||||||
|
# @author Takahide Matsutsuka <markn@markn.org>
|
||||||
|
#
|
||||||
|
# $Id: Makefile.pc-6001,v 1.1 2007/09/11 12:12:59 matsutsuka Exp $
|
||||||
|
#
|
||||||
|
|
||||||
|
ifndef CONTIKI
|
||||||
|
$(error CONTIKI not defined! You must specify where CONTIKI resides!)
|
||||||
|
endif
|
||||||
|
|
||||||
|
### setup default values
|
||||||
|
ifndef ARCH
|
||||||
|
ARCH = PC6001
|
||||||
|
endif
|
||||||
|
ifndef MEMORY
|
||||||
|
MEMORY = 32K
|
||||||
|
endif
|
||||||
|
ifndef HEX2CAS
|
||||||
|
HEX2CAS = hex2cas
|
||||||
|
endif
|
||||||
|
ifndef CONTIKI_TARGET_MAIN
|
||||||
|
CONTIKI_TARGET_MAIN = contiki-main.c
|
||||||
|
endif
|
||||||
|
|
||||||
|
### setup flags to be used in compiler, assembler, and hex2cas
|
||||||
|
PLATFORM = $(CONTIKI)/platform/$(TARGET)
|
||||||
|
CONTIKI_TARGET_DIRS = . ctk dev loader
|
||||||
|
CFLAGS += -DMEMORY_$(MEMORY) -DARCH_$(ARCH)
|
||||||
|
LDFLAGS += $(CFLAGS) --opt-code-size --out-fmt-ihx
|
||||||
|
|
||||||
|
ifeq ($(MEMORY),16K)
|
||||||
|
LDFLAGS += --code-loc 0xc41d --data-loc
|
||||||
|
HEX2CASFLAGS = -1 -n contki
|
||||||
|
else ifeq ($(MEMORY),ROM)
|
||||||
|
LDFLAGS += --code-loc 0x4004 --data-loc 0xf000
|
||||||
|
HEX2CASFLAGS = -r -o coniki.rom
|
||||||
|
else
|
||||||
|
LDFLAGS += --code-loc 0x841d --data-loc
|
||||||
|
HEX2CASFLAGS = -2 -n contki
|
||||||
|
endif
|
||||||
|
|
||||||
|
### Include platform-depend application makefiles
|
||||||
|
|
||||||
|
ifdef PLATFORM_APPS
|
||||||
|
PLATFORM_APPDIRS += ${addprefix $(PLATFORM)/apps/, $(PLATFORM_APPS)}
|
||||||
|
PLATFORM_APPINCLUDES = ${foreach APP, $(PLATFORM_APPS), $(PLATFORM)/apps/$(APP)/Makefile.$(APP)}
|
||||||
|
-include $(PLATFORM_APPINCLUDES)
|
||||||
|
PLATFORM_APP_SOURCES = ${foreach APP, $(PLATFORM_APPS), $($(APP)_src)}
|
||||||
|
PLATFORM_DSC_SOURCES = ${foreach APP, $(PLATFORM_APPS), $($(APP)_dsc)}
|
||||||
|
CONTIKI_SOURCEFILES += $(PLATFORM_APP_SOURCES) $(PLATFORM_DSC_SOURCES)
|
||||||
|
endif
|
||||||
|
|
||||||
|
CONTIKI_TARGET_SOURCEFILES = \
|
||||||
|
$(CTK) cfs-ram.c serial.c slip.c \
|
||||||
|
ctk-conio_arch.c libconio.c
|
||||||
|
|
||||||
|
#you can use the below instead of ctk-conio_arch.c and ctk-conio_arch-asm.hS
|
||||||
|
#ctk-conio_arch-source.c
|
||||||
|
|
||||||
|
CONTIKI_ASMFILES += getkey.S isprint_arch.S clock.S rs232-asm.S
|
||||||
|
CONTIKI_HASMFILES += ctk-conio_arch-asm.hS
|
||||||
|
|
||||||
|
CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES)
|
||||||
|
|
||||||
|
CLEAN += *.asm *.lnk *.sym *.o *.a *.cas *.rom
|
||||||
|
|
||||||
|
contiki: contiki.cas
|
||||||
|
|
||||||
|
.SUFFIXES:
|
||||||
|
|
||||||
|
%.cas: %.ihex
|
||||||
|
$(HEX2CAS) $(HEX2CASFLAGS) $<
|
||||||
|
%.rom: %.ihex
|
||||||
|
$(HEX2CAS) $(HEX2CASFLAGS) $<
|
||||||
|
|
||||||
|
remove-ctk:
|
||||||
|
rm -f obj_$(TARGET)/ctk*;
|
||||||
|
rm -f contiki.ihex
|
||||||
|
remove-net:
|
||||||
|
rm -f ${addprefix obj_$(TARGET)/,uip*.o hc.o psock.o rawpacket-udp.o resolv.o slip*.o tcp*.o uaod*.o rime*.o http*.o web*.o};
|
||||||
|
rm -f contiki.ihex
|
||||||
|
remove-mt:
|
||||||
|
rm -f obj_$(TARGET)/mt*.o
|
||||||
|
rm -f contiki.ihex
|
||||||
|
|
||||||
|
### Define the CPU directory
|
||||||
|
CONTIKI_CPU=$(CONTIKI)/cpu/z80
|
||||||
|
include $(CONTIKI_CPU)/Makefile.z80
|
||||||
|
|
||||||
|
### Setup directory search path for source files
|
||||||
|
|
||||||
|
PROJECTDIRS += $(PLATFORM_APPDIRS)
|
||||||
|
|
2
platform/pc-6001/apps/multithread/Makefile.multithread
Normal file
2
platform/pc-6001/apps/multithread/Makefile.multithread
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
multithread_src = mt-test.c
|
||||||
|
multithread_dsc = mt-test-dsc.c
|
38
platform/pc-6001/apps/multithread/mt-test-dsc.c
Normal file
38
platform/pc-6001/apps/multithread/mt-test-dsc.c
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
#include "sys/dsc.h"
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
#if CTK_CONF_ICON_BITMAPS
|
||||||
|
static unsigned char mttesticon_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 mttesticon_textmap[9] = {
|
||||||
|
'T', 'h', 'r',
|
||||||
|
'e', 'a', 'd',
|
||||||
|
'=', '=', '>'
|
||||||
|
};
|
||||||
|
#endif /* CTK_CONF_ICON_TEXTMAPS */
|
||||||
|
|
||||||
|
#if CTK_CONF_ICONS
|
||||||
|
static struct ctk_icon mttest_icon =
|
||||||
|
{CTK_ICON("Multithread test", mttesticon_bitmap, mttesticon_textmap)};
|
||||||
|
#endif /* CTK_CONF_ICONS */
|
||||||
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
DSC(mttest_dsc,
|
||||||
|
"MultithreadTest",
|
||||||
|
"mt-test.prg",
|
||||||
|
mt_process,
|
||||||
|
&mttest_icon);
|
||||||
|
/*-----------------------------------------------------------------------------------*/
|
7
platform/pc-6001/apps/multithread/mt-test-dsc.h
Normal file
7
platform/pc-6001/apps/multithread/mt-test-dsc.h
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
#ifndef MTTESTDSC_H_
|
||||||
|
#define MTTESTDSC_H_
|
||||||
|
#include "sys/dsc.h"
|
||||||
|
|
||||||
|
DSC_HEADER(mttest_dsc);
|
||||||
|
|
||||||
|
#endif /*MTTESTDSC_H_*/
|
144
platform/pc-6001/apps/multithread/mt-test.c
Normal file
144
platform/pc-6001/apps/multithread/mt-test.c
Normal file
|
@ -0,0 +1,144 @@
|
||||||
|
/*
|
||||||
|
* 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 <ol.sc@web.de>
|
||||||
|
*
|
||||||
|
* $Id: mt-test.c,v 1.1 2007/09/11 12:12:59 matsutsuka Exp $
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file
|
||||||
|
* A very simple Contiki application showing how to use the Contiki
|
||||||
|
* Multi-threading library
|
||||||
|
* \author
|
||||||
|
* Oliver Schmidt <ol.sc@web.de>
|
||||||
|
* \author for PC-6001 version
|
||||||
|
* Takahide Matsutsuka <markn@markn.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "contiki.h"
|
||||||
|
#include "ctk.h"
|
||||||
|
#include "sys/mt.h"
|
||||||
|
#include "mtarch.h"
|
||||||
|
|
||||||
|
#define WIN_XSIZE 10
|
||||||
|
#define WIN_YSIZE 10
|
||||||
|
|
||||||
|
static char log[WIN_XSIZE * WIN_YSIZE];
|
||||||
|
static struct ctk_window window;
|
||||||
|
static struct ctk_label loglabel = {CTK_LABEL(0, 0, WIN_XSIZE, WIN_YSIZE, log)};
|
||||||
|
PROCESS(mt_process, "Multi-threading test");
|
||||||
|
|
||||||
|
static char buf[20];
|
||||||
|
|
||||||
|
void
|
||||||
|
println(char *str1)
|
||||||
|
{
|
||||||
|
static unsigned int i;
|
||||||
|
|
||||||
|
for(i = 1; i < WIN_YSIZE; i++) {
|
||||||
|
memcpy(log + (i - 1) * WIN_XSIZE, log + i * WIN_XSIZE, WIN_XSIZE);
|
||||||
|
}
|
||||||
|
memset(log + (WIN_YSIZE - 1) * WIN_XSIZE, 0, WIN_XSIZE);
|
||||||
|
|
||||||
|
strncpy(log + (WIN_YSIZE - 1) * WIN_XSIZE, str1, WIN_XSIZE);
|
||||||
|
|
||||||
|
CTK_WIDGET_REDRAW(&loglabel);
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static void
|
||||||
|
thread_func(char *str, int len)
|
||||||
|
{
|
||||||
|
println((char *) (str + len));
|
||||||
|
mt_yield();
|
||||||
|
|
||||||
|
if(len) {
|
||||||
|
thread_func(str, len - 1);
|
||||||
|
mt_yield();
|
||||||
|
}
|
||||||
|
|
||||||
|
println((char *) (str + len));
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static void
|
||||||
|
thread_main(void *data)
|
||||||
|
{
|
||||||
|
while(1) {
|
||||||
|
thread_func((char *)data, 9);
|
||||||
|
}
|
||||||
|
mt_exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
PROCESS_THREAD(mt_process, ev, data)
|
||||||
|
{
|
||||||
|
|
||||||
|
static struct etimer timer;
|
||||||
|
static int toggle = 0;
|
||||||
|
static struct mt_thread th1;
|
||||||
|
static struct mt_thread th2;
|
||||||
|
|
||||||
|
PROCESS_BEGIN();
|
||||||
|
|
||||||
|
ctk_window_new(&window, WIN_XSIZE, WIN_YSIZE, "Multithread");
|
||||||
|
CTK_WIDGET_ADD(&window, &loglabel);
|
||||||
|
memset(log, 0, sizeof(log));
|
||||||
|
ctk_window_open(&window);
|
||||||
|
mt_init();
|
||||||
|
mt_start(&th1, thread_main, "JIHGFEDCBA");
|
||||||
|
mt_start(&th2, thread_main, "9876543210");
|
||||||
|
|
||||||
|
etimer_set(&timer, CLOCK_SECOND / 2);
|
||||||
|
while(1) {
|
||||||
|
PROCESS_WAIT_EVENT();
|
||||||
|
if(ev == PROCESS_EVENT_TIMER) {
|
||||||
|
if(toggle) {
|
||||||
|
mt_exec(&th1);
|
||||||
|
toggle--;
|
||||||
|
} else {
|
||||||
|
mt_exec(&th2);
|
||||||
|
toggle++;
|
||||||
|
}
|
||||||
|
etimer_set(&timer, CLOCK_SECOND / 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mt_stop(&th1);
|
||||||
|
mt_stop(&th2);
|
||||||
|
mt_remove();
|
||||||
|
|
||||||
|
while(1) {
|
||||||
|
PROCESS_WAIT_EVENT();
|
||||||
|
}
|
||||||
|
PROCESS_END();
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
2
platform/pc-6001/apps/tinysample/Makefile.tinysample
Normal file
2
platform/pc-6001/apps/tinysample/Makefile.tinysample
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
tinysample_src = tinysample.c
|
||||||
|
tinysample_dsc = tinysample-dsc.c
|
80
platform/pc-6001/apps/tinysample/tinysample-dsc.c
Normal file
80
platform/pc-6001/apps/tinysample/tinysample-dsc.c
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2007, Takahide Matsutsuka.
|
||||||
|
* 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 <ol.sc@web.de>
|
||||||
|
*
|
||||||
|
* $Id: tinysample-dsc.c,v 1.1 2007/09/11 12:12:59 matsutsuka Exp $
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file
|
||||||
|
* A very small sample Contiki application using console.
|
||||||
|
* \author
|
||||||
|
* Takahide Matsutsuka <markn@markn.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "sys/dsc.h"
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
#if CTK_CONF_ICON_BITMAPS
|
||||||
|
static unsigned char tiny_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 tiny_textmap[9] = {
|
||||||
|
'T', 'i', 'n',
|
||||||
|
'y', 'S', 'a',
|
||||||
|
'm', 'p', 'l'
|
||||||
|
};
|
||||||
|
#endif /* CTK_CONF_ICON_TEXTMAPS */
|
||||||
|
|
||||||
|
#if CTK_CONF_ICONS
|
||||||
|
static struct ctk_icon tiny_icon =
|
||||||
|
{CTK_ICON("Tiny sample", tiny_bitmap, tiny_textmap)};
|
||||||
|
#endif /* CTK_CONF_ICONS */
|
||||||
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
DSC(tiny_dsc,
|
||||||
|
"Tinysample",
|
||||||
|
"tinysmaple.prg",
|
||||||
|
tiny_process,
|
||||||
|
&tiny_icon);
|
||||||
|
/*-----------------------------------------------------------------------------------*/
|
49
platform/pc-6001/apps/tinysample/tinysample-dsc.h
Normal file
49
platform/pc-6001/apps/tinysample/tinysample-dsc.h
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2007, Takahide Matsutsuka.
|
||||||
|
* 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 <ol.sc@web.de>
|
||||||
|
*
|
||||||
|
* $Id: tinysample-dsc.h,v 1.1 2007/09/11 12:12:59 matsutsuka Exp $
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file
|
||||||
|
* A very small sample Contiki application using console.
|
||||||
|
* \author
|
||||||
|
* Takahide Matsutsuka <markn@markn.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef TINYSAMPLE_DSC_H_
|
||||||
|
#define TINYSAMPLE_DSC_H_
|
||||||
|
#include "sys/dsc.h"
|
||||||
|
|
||||||
|
DSC_HEADER(tiny_dsc);
|
||||||
|
|
||||||
|
#endif /*TINYSAMPLE_DSC_H_*/
|
69
platform/pc-6001/apps/tinysample/tinysample.c
Normal file
69
platform/pc-6001/apps/tinysample/tinysample.c
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2007, Takahide Matsutsuka.
|
||||||
|
* 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 <ol.sc@web.de>
|
||||||
|
*
|
||||||
|
* $Id: tinysample.c,v 1.1 2007/09/11 12:12:59 matsutsuka Exp $
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file
|
||||||
|
* A very small sample Contiki application using console.
|
||||||
|
* \author
|
||||||
|
* Takahide Matsutsuka <markn@markn.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "contiki.h"
|
||||||
|
#include "libconio.h"
|
||||||
|
|
||||||
|
PROCESS(tiny_process, "Tiny Sample");
|
||||||
|
|
||||||
|
static char ch[] = "A";
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
PROCESS_THREAD(tiny_process, ev, data)
|
||||||
|
{
|
||||||
|
static struct etimer timer;
|
||||||
|
|
||||||
|
PROCESS_BEGIN();
|
||||||
|
|
||||||
|
clrscr();
|
||||||
|
gotoxy(0, 0);
|
||||||
|
|
||||||
|
while(1) {
|
||||||
|
etimer_set(&timer, CLOCK_SECOND / 32);
|
||||||
|
PROCESS_WAIT_EVENT();
|
||||||
|
if(etimer_expired(&timer)) {
|
||||||
|
cputs(ch);
|
||||||
|
ch[0]++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PROCESS_END();
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
148
platform/pc-6001/contiki-conf.h
Normal file
148
platform/pc-6001/contiki-conf.h
Normal file
|
@ -0,0 +1,148 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2007, Takahide Matsutsuka.
|
||||||
|
* 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: contiki-conf.h,v 1.1 2007/09/11 12:12:59 matsutsuka Exp $
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* \file
|
||||||
|
* contiki-conf.h
|
||||||
|
* A set of configurations of contiki for PC-6001 family.
|
||||||
|
* \author
|
||||||
|
* Takahide Matsutsuka <markn@markn.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __CONTIKI_CONF_H__
|
||||||
|
#define __CONTIKI_CONF_H__
|
||||||
|
|
||||||
|
#include "z80def.h"
|
||||||
|
#include "sys/cc.h"
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "ctk/ctk_arch.h"
|
||||||
|
#include "strcasecmp.h"
|
||||||
|
|
||||||
|
#define rtimer_arch_now() clock_time()
|
||||||
|
|
||||||
|
/* Time type. */
|
||||||
|
typedef unsigned long clock_time_t;
|
||||||
|
|
||||||
|
/* Defines tick counts for a second. */
|
||||||
|
#define CLOCK_CONF_SECOND 1024
|
||||||
|
|
||||||
|
/* Memory filesystem RAM size. */
|
||||||
|
#define CFS_RAM_CONF_SIZE 512
|
||||||
|
|
||||||
|
/* Logging.. */
|
||||||
|
#define LOG_CONF_ENABLED 1
|
||||||
|
|
||||||
|
/* Application specific configurations. */
|
||||||
|
|
||||||
|
/* Command shell */
|
||||||
|
#define SHELL_GUI_CONF_XSIZE 26
|
||||||
|
#define SHELL_GUI_CONF_YSIZE 10
|
||||||
|
|
||||||
|
/* Text editor */
|
||||||
|
#define EDITOR_CONF_WIDTH 26
|
||||||
|
#define EDITOR_CONF_HEIGHT 8
|
||||||
|
|
||||||
|
/* Process list */
|
||||||
|
#define PROCESSLIST_CONF_HEIGHT 12
|
||||||
|
|
||||||
|
/* File dialog */
|
||||||
|
#define FILES_CONF_HEIGHT 6
|
||||||
|
|
||||||
|
#undef MALLOC_TEST
|
||||||
|
|
||||||
|
#define SHELL_CONF_WITH_PROGRAM_HANDLER 1
|
||||||
|
|
||||||
|
/* screen properties */
|
||||||
|
#define LIBCONIO_CONF_ATTRIBUTES_ENABLED
|
||||||
|
#if defined(ARCH_PC6001MK2)
|
||||||
|
#define LIBCONIO_VRAM_ATTR 0x4000
|
||||||
|
#define LIBCONIO_VRAM_CHAR 0x4400
|
||||||
|
#define LIBCONIO_CONF_SCREEN_WIDTH 40
|
||||||
|
#define LIBCONIO_CONF_SCREEN_HEIGHT 20
|
||||||
|
#define LIBCONIO_COLOR_NORMAL 0x0f
|
||||||
|
#define LIBCONIO_COLOR_REVERSED 0x70
|
||||||
|
#elif (defined(ARCH_PC6001) || defined(ARCH_PC6001A)) && defined(MEMORY_16K)
|
||||||
|
#define LIBCONIO_VRAM_ATTR 0xc000
|
||||||
|
#define LIBCONIO_VRAM_CHAR 0xc200
|
||||||
|
#define LIBCONIO_CONF_SCREEN_WIDTH 32
|
||||||
|
#define LIBCONIO_CONF_SCREEN_HEIGHT 16
|
||||||
|
#define LIBCONIO_COLOR_NORMAL 0x20
|
||||||
|
#define LIBCONIO_COLOR_REVERSED 0x21
|
||||||
|
#elif (defined(ARCH_PC6001) || defined(ARCH_PC6001A)) && (defined(MEMORY_32K) || defined(MEMORY_ROM))
|
||||||
|
#define LIBCONIO_VRAM_ATTR 0x8000
|
||||||
|
#define LIBCONIO_VRAM_CHAR 0x8200
|
||||||
|
#define LIBCONIO_CONF_SCREEN_WIDTH 32
|
||||||
|
#define LIBCONIO_CONF_SCREEN_HEIGHT 16
|
||||||
|
#define LIBCONIO_COLOR_NORMAL 0x20
|
||||||
|
#define LIBCONIO_COLOR_REVERSED 0x21
|
||||||
|
#else
|
||||||
|
#error Specify appropriate ARCH & MEMORY combination
|
||||||
|
#endif /* ARCH_PC6001MK2 */
|
||||||
|
|
||||||
|
|
||||||
|
/* uIP configuration */
|
||||||
|
#define UIP_CONF_MAX_CONNECTIONS 10
|
||||||
|
#define UIP_CONF_MAX_LISTENPORTS 10
|
||||||
|
#define UIP_CONF_BUFFER_SIZE 300
|
||||||
|
#define UIP_CONF_BYTE_ORDER LITTLE_ENDIAN
|
||||||
|
//#define UIP_CONF_TCP_SPLIT 1
|
||||||
|
#define UIP_CONF_TCP_SPLIT 0
|
||||||
|
#define UIP_CONF_LOGGING 0
|
||||||
|
//#define UIP_CONF_UDP_CHECKSUMS 1
|
||||||
|
#define UIP_CONF_UDP_CHECKSUMS 0
|
||||||
|
|
||||||
|
/* Web sever configuration */
|
||||||
|
#undef WEBSERVER_CONF_LOG_ENABLED
|
||||||
|
|
||||||
|
/* unused yet */
|
||||||
|
#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
|
||||||
|
|
||||||
|
#define HTTPD_CONF_CGI 0
|
||||||
|
#define HTTPD_CONF_SCRIPT 0
|
||||||
|
//#define WEBSERVER_CONF_SPRINTF(buf, address) log_address(buf, address)
|
||||||
|
|
||||||
|
#endif /* __CONTIKI_CONF_H__ */
|
83
platform/pc-6001/contiki-main.c
Normal file
83
platform/pc-6001/contiki-main.c
Normal file
|
@ -0,0 +1,83 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2007, Takahide Matsutsuka.
|
||||||
|
* 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: contiki-main.c,v 1.1 2007/09/11 12:12:59 matsutsuka Exp $
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* \file
|
||||||
|
* This is a sample main file with desktop.
|
||||||
|
* \author
|
||||||
|
* Takahide Matsutsuka <markn@markn.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "contiki.h"
|
||||||
|
|
||||||
|
#include "program-handler.h"
|
||||||
|
#include "about-dsc.h"
|
||||||
|
#include "calc-dsc.h"
|
||||||
|
#include "process-list-dsc.h"
|
||||||
|
#include "shell-dsc.h"
|
||||||
|
#include "mt-test-dsc.h"
|
||||||
|
|
||||||
|
#if WITH_LOADER_ARCH
|
||||||
|
#include "directory-dsc.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
int
|
||||||
|
main(void)
|
||||||
|
{
|
||||||
|
/* initialize process manager. */
|
||||||
|
process_init();
|
||||||
|
|
||||||
|
/* start services */
|
||||||
|
process_start(&ctk_process, NULL);
|
||||||
|
process_start(&program_handler_process, NULL);
|
||||||
|
process_start(&etimer_process, NULL);
|
||||||
|
|
||||||
|
/* register programs to the program handler */
|
||||||
|
#if WITH_LOADER_ARCH
|
||||||
|
program_handler_add(&directory_dsc, "Directory", 1);
|
||||||
|
program_handler_add(&processes_dsc, "Processes", 1);
|
||||||
|
program_handler_add(&shell_dsc, "Command shell", 1);
|
||||||
|
#else
|
||||||
|
program_handler_add(&processes_dsc, "Processes", 1);
|
||||||
|
program_handler_add(&mttest_dsc, "Multithread", 1);
|
||||||
|
// program_handler_add(&calc_dsc, "Calculator", 1);
|
||||||
|
program_handler_add(&about_dsc, "About", 1);
|
||||||
|
program_handler_add(&shell_dsc, "Command shell", 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
while(1) {
|
||||||
|
process_run();
|
||||||
|
etimer_request_poll();
|
||||||
|
}
|
||||||
|
}
|
66
platform/pc-6001/contiki-minimal-main.c
Normal file
66
platform/pc-6001/contiki-minimal-main.c
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2007, Takahide Matsutsuka.
|
||||||
|
* 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: contiki-minimal-main.c,v 1.1 2007/09/11 12:12:59 matsutsuka Exp $
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* \file
|
||||||
|
* This is a minimal main file with desktop.
|
||||||
|
* \author
|
||||||
|
* Takahide Matsutsuka <markn@markn.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "contiki.h"
|
||||||
|
|
||||||
|
#include "program-handler.h"
|
||||||
|
#include "tinysample-dsc.h"
|
||||||
|
|
||||||
|
extern struct process *tiny_process;
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
int
|
||||||
|
main(void)
|
||||||
|
{
|
||||||
|
/* initialize process manager. */
|
||||||
|
process_init();
|
||||||
|
|
||||||
|
/* start services */
|
||||||
|
// process_start(&ctk_process, NULL);
|
||||||
|
// process_start(&program_handler_process, NULL);
|
||||||
|
process_start(&etimer_process, NULL);
|
||||||
|
process_start(&tiny_process, NULL);
|
||||||
|
|
||||||
|
// program_handler_add(&tiny_dsc, "Tiny", 1);
|
||||||
|
|
||||||
|
while(1) {
|
||||||
|
process_run();
|
||||||
|
etimer_request_poll();
|
||||||
|
}
|
||||||
|
}
|
103
platform/pc-6001/contiki-serial-main.c
Normal file
103
platform/pc-6001/contiki-serial-main.c
Normal file
|
@ -0,0 +1,103 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2007, Takahide Matsutsuka.
|
||||||
|
* 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: contiki-serial-main.c,v 1.1 2007/09/11 12:12:59 matsutsuka Exp $
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* \file
|
||||||
|
* This is a sample main file with serial.
|
||||||
|
* \author
|
||||||
|
* Takahide Matsutsuka <markn@markn.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "contiki.h"
|
||||||
|
|
||||||
|
/* devices */
|
||||||
|
#include "dev/serial.h"
|
||||||
|
#include "dev/rs232.h"
|
||||||
|
#include "lib/libconio.h"
|
||||||
|
#include "log.h"
|
||||||
|
|
||||||
|
PROCESS(stest_process, "Serial test process");
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static void
|
||||||
|
rs232_print(char* str) {
|
||||||
|
while (*str != 0) {
|
||||||
|
rs232_arch_writeb(*str++);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
PROCESS_THREAD(stest_process, ev, data)
|
||||||
|
{
|
||||||
|
static struct etimer timer;
|
||||||
|
PROCESS_BEGIN();
|
||||||
|
|
||||||
|
clrscr();
|
||||||
|
gotoxy(0, 0);
|
||||||
|
|
||||||
|
etimer_set(&timer, CLOCK_SECOND);
|
||||||
|
|
||||||
|
log_message("Starting serial test process", "");
|
||||||
|
while(1) {
|
||||||
|
PROCESS_WAIT_EVENT();
|
||||||
|
|
||||||
|
if (etimer_expired(&timer)) {
|
||||||
|
log_message("Sending serial data now", "");
|
||||||
|
rs232_print("GNU's not Unix\n");
|
||||||
|
etimer_reset(&timer);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ev == serial_event_message) {
|
||||||
|
log_message(data, "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PROCESS_END();
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
main(void)
|
||||||
|
{
|
||||||
|
/* initialize process manager. */
|
||||||
|
process_init();
|
||||||
|
|
||||||
|
/* start services */
|
||||||
|
process_start(&etimer_process, NULL);
|
||||||
|
process_start(&serial_process, NULL);
|
||||||
|
process_start(&rs232_process, NULL);
|
||||||
|
process_start(&stest_process, NULL);
|
||||||
|
|
||||||
|
while(1) {
|
||||||
|
process_run();
|
||||||
|
etimer_request_poll();
|
||||||
|
}
|
||||||
|
}
|
432
platform/pc-6001/ctk/ctk-conio_arch-asm.hS
Normal file
432
platform/pc-6001/ctk/ctk-conio_arch-asm.hS
Normal file
|
@ -0,0 +1,432 @@
|
||||||
|
;;;
|
||||||
|
;;;
|
||||||
|
;;; ctk-conio_arch-asm.hS
|
||||||
|
;;;
|
||||||
|
;;; Architecture depend ctk-conio implementation.
|
||||||
|
;;; This assembler source contributes basically saving for speed and memory.
|
||||||
|
;;;
|
||||||
|
;;; @author Takahide Matsutsuka <markn@markn.org>
|
||||||
|
;;;
|
||||||
|
;;; $Id: ctk-conio_arch-asm.hS,v 1.1 2007/09/11 12:12:59 matsutsuka Exp $
|
||||||
|
;;;
|
||||||
|
|
||||||
|
;; uses preprocessor to enable definitions
|
||||||
|
#include "ctk_arch-def.h"
|
||||||
|
|
||||||
|
;; export symbols
|
||||||
|
.globl _cputc_arch
|
||||||
|
.globl _cputs_arch
|
||||||
|
.globl _cputsn_arch
|
||||||
|
.globl _chline_arch
|
||||||
|
.globl _cvline_arch
|
||||||
|
.globl _gotoxy_arch
|
||||||
|
.globl _cclear_arch
|
||||||
|
.globl _revers_arch
|
||||||
|
.globl _clip_arch
|
||||||
|
.globl _ctk_draw_init
|
||||||
|
.globl _ctk_draw_clear
|
||||||
|
.globl _ctk_draw_clear_window
|
||||||
|
;; import symbols
|
||||||
|
.globl _info
|
||||||
|
.if 0
|
||||||
|
.globl _ctk_arch_window_x
|
||||||
|
.globl _ctk_arch_window_y
|
||||||
|
.globl _ctk_arch_window_h
|
||||||
|
.globl _ctk_arch_window_w
|
||||||
|
.endif
|
||||||
|
|
||||||
|
.area _DATA
|
||||||
|
_ctk_arch_reversed:
|
||||||
|
.ds 1
|
||||||
|
|
||||||
|
.area _CODE
|
||||||
|
|
||||||
|
;; ---------------------------------
|
||||||
|
;; void cputc(char ch);
|
||||||
|
;; Stack; ixl ixh retl reth ch
|
||||||
|
;; AF__DEHL____
|
||||||
|
;; return void
|
||||||
|
;; ---------------------------------
|
||||||
|
_cputc_arch:
|
||||||
|
push ix
|
||||||
|
ld ix, #_info
|
||||||
|
ld a, CURSY(ix)
|
||||||
|
cp a, CY1(ix) ; cursy - cy1
|
||||||
|
jr c, _cputc_arch_ret ; cusy < cy1
|
||||||
|
cp a, CY2(ix) ; cursy - cy2
|
||||||
|
jr z, _cputc_arch_next1
|
||||||
|
jr nc, _cputc_arch_ret ; cursy > cy2
|
||||||
|
_cputc_arch_next1:
|
||||||
|
cp a, #SCREEN_HEIGHT ; cursy - SCREEN_HEIGHT
|
||||||
|
jr z, _cputc_arch_next2
|
||||||
|
jr nc, _cputc_arch_ret ; cursy > SCREEN_HEIGHT
|
||||||
|
_cputc_arch_next2:
|
||||||
|
ld a, CURSX(ix)
|
||||||
|
cp a, #SCREEN_WIDTH ; cursx - SCREEN_WIDTH
|
||||||
|
jr nc, _cputc_arch_ret
|
||||||
|
;; calculate offset
|
||||||
|
ld a, CURSY(ix)
|
||||||
|
ld hl, #0
|
||||||
|
ld de, #SCREEN_WIDTH
|
||||||
|
_cputc_arch_loop:
|
||||||
|
or a
|
||||||
|
jr z, _cputc_arch_calcx
|
||||||
|
add hl, de
|
||||||
|
dec a
|
||||||
|
jr _cputc_arch_loop
|
||||||
|
_cputc_arch_calcx:
|
||||||
|
ld d, #0
|
||||||
|
ld e, CURSX(ix)
|
||||||
|
add hl, de
|
||||||
|
;; putchar
|
||||||
|
push hl
|
||||||
|
ld hl, #6
|
||||||
|
add hl, sp
|
||||||
|
ld a, (hl)
|
||||||
|
pop hl
|
||||||
|
ld de, #VRAM_CHAR
|
||||||
|
push hl
|
||||||
|
add hl, de
|
||||||
|
ld (hl), a
|
||||||
|
pop hl
|
||||||
|
;; putattr
|
||||||
|
ld de, #VRAM_ATTR
|
||||||
|
add hl, de
|
||||||
|
ld de, #_ctk_arch_reversed
|
||||||
|
ld a, (de)
|
||||||
|
or a
|
||||||
|
jr z, _cputc_arch_normal
|
||||||
|
ld (hl), #COLOR_REVERSED
|
||||||
|
jr _cputc_arch_ret
|
||||||
|
_cputc_arch_normal:
|
||||||
|
ld (hl), #COLOR_NORMAL
|
||||||
|
_cputc_arch_ret:
|
||||||
|
inc CURSX(ix)
|
||||||
|
pop ix
|
||||||
|
ret
|
||||||
|
|
||||||
|
;; ---------------------------------
|
||||||
|
;; void cputs_arch(char *str);
|
||||||
|
;; Stack; ixl ixh retl reth strl strh
|
||||||
|
;; AFB_DEHL____
|
||||||
|
;; return void
|
||||||
|
;; ---------------------------------
|
||||||
|
_cputs_arch:
|
||||||
|
push ix
|
||||||
|
ld hl, #4
|
||||||
|
add hl, sp
|
||||||
|
ld e, (hl)
|
||||||
|
inc hl
|
||||||
|
ld d, (hl)
|
||||||
|
ld b, #0 ; max length
|
||||||
|
_cputs_arch_loop:
|
||||||
|
ld a, (de)
|
||||||
|
or a
|
||||||
|
jr z, _cputs_arch_ret
|
||||||
|
push bc
|
||||||
|
push de
|
||||||
|
push af
|
||||||
|
inc sp
|
||||||
|
call _cputc_arch
|
||||||
|
inc sp
|
||||||
|
pop de
|
||||||
|
pop bc
|
||||||
|
inc de
|
||||||
|
djnz _cputs_arch_loop
|
||||||
|
_cputs_arch_ret:
|
||||||
|
pop ix
|
||||||
|
ret
|
||||||
|
|
||||||
|
;; ---------------------------------
|
||||||
|
;; void cputsn(char *str, unsigned char length);
|
||||||
|
;; Stack; ixl ixh retl reth length
|
||||||
|
;; AFB_DEHL____
|
||||||
|
;; return void
|
||||||
|
;; ---------------------------------
|
||||||
|
_cputsn_arch:
|
||||||
|
push ix
|
||||||
|
ld ix, #4
|
||||||
|
add ix, sp
|
||||||
|
ld e, 0(ix)
|
||||||
|
ld d, 1(ix)
|
||||||
|
ld b, 2(ix)
|
||||||
|
jr _cputs_arch_loop ; take over B and DE
|
||||||
|
|
||||||
|
;; ---------------------------------
|
||||||
|
;; void chline(unsigned char length);
|
||||||
|
;; Stack; ixl ixh retl reth length
|
||||||
|
;; AFB_DEHL____
|
||||||
|
;; return void
|
||||||
|
;; ---------------------------------
|
||||||
|
_chline_arch:
|
||||||
|
push ix
|
||||||
|
ld hl, #4
|
||||||
|
add hl, sp
|
||||||
|
ld b, (hl)
|
||||||
|
ld a, #CH_HOLILINE
|
||||||
|
_chline_arch_loop:
|
||||||
|
push bc
|
||||||
|
push af
|
||||||
|
inc sp
|
||||||
|
call _cputc_arch
|
||||||
|
dec sp
|
||||||
|
pop af
|
||||||
|
pop bc
|
||||||
|
djnz _chline_arch_loop
|
||||||
|
pop ix
|
||||||
|
ret
|
||||||
|
|
||||||
|
;; ---------------------------------
|
||||||
|
;; void cvline(unsigned char length);
|
||||||
|
;; Stack; ixl ixh retl reth length
|
||||||
|
;; AFB_DEHL____
|
||||||
|
;; return void
|
||||||
|
;; ---------------------------------
|
||||||
|
_cvline_arch:
|
||||||
|
push ix
|
||||||
|
ld hl, #4 ; subject to change
|
||||||
|
add hl, sp
|
||||||
|
ld b, (hl) ; length
|
||||||
|
ld a, #CH_VERTLINE
|
||||||
|
ld ix, #_info
|
||||||
|
_cvline_arch_loop:
|
||||||
|
push bc
|
||||||
|
push af
|
||||||
|
inc sp
|
||||||
|
call _cputc_arch
|
||||||
|
dec sp
|
||||||
|
pop af
|
||||||
|
pop bc
|
||||||
|
inc CURSY(ix)
|
||||||
|
dec CURSX(ix)
|
||||||
|
djnz _cvline_arch_loop
|
||||||
|
pop ix
|
||||||
|
ret
|
||||||
|
|
||||||
|
;; ---------------------------------
|
||||||
|
;; void gotoxy(unsigned char x, unsigned char y)
|
||||||
|
;; Stack; ixl ixh retl reth x y
|
||||||
|
;; AF____HL____
|
||||||
|
;; return void
|
||||||
|
;; ---------------------------------
|
||||||
|
_gotoxy_arch:
|
||||||
|
push ix
|
||||||
|
ld hl, #4
|
||||||
|
add hl, sp
|
||||||
|
ld ix, #_info
|
||||||
|
ld a, (hl)
|
||||||
|
ld CURSX(ix), a
|
||||||
|
inc hl
|
||||||
|
ld a, (hl)
|
||||||
|
ld CURSY(ix), a
|
||||||
|
pop ix
|
||||||
|
ret
|
||||||
|
|
||||||
|
;; ---------------------------------
|
||||||
|
;; void clearTo(char x)
|
||||||
|
;; Stack; ixl ixh retl reth x
|
||||||
|
;; AF__DEHL____
|
||||||
|
;; return void
|
||||||
|
;; ---------------------------------
|
||||||
|
_cclear_arch:
|
||||||
|
push ix
|
||||||
|
ld ix, #_info
|
||||||
|
ld hl, #4
|
||||||
|
add hl, sp
|
||||||
|
_cclear_arch_loop:
|
||||||
|
ld a, (hl) ; x
|
||||||
|
cp a, CURSX(ix)
|
||||||
|
jr z, _cclear_arch_ret
|
||||||
|
jr c, _cclear_arch_ret
|
||||||
|
ld a, #CH_SPACE
|
||||||
|
push hl
|
||||||
|
push af
|
||||||
|
inc sp
|
||||||
|
call _cputc_arch
|
||||||
|
inc sp
|
||||||
|
pop hl
|
||||||
|
jr _cclear_arch_loop
|
||||||
|
_cclear_arch_ret:
|
||||||
|
ld a, (hl)
|
||||||
|
ld CURSX(ix), a
|
||||||
|
pop ix
|
||||||
|
ret
|
||||||
|
|
||||||
|
;; ---------------------------------
|
||||||
|
;; void revers_arch(unsigned char reverse)
|
||||||
|
;; Stack; retl reth reverse
|
||||||
|
;; A_____HL____
|
||||||
|
;; return void
|
||||||
|
;; ---------------------------------
|
||||||
|
_revers_arch:
|
||||||
|
ld hl, #2
|
||||||
|
add hl, sp
|
||||||
|
ld a, (hl)
|
||||||
|
ld hl, #_ctk_arch_reversed
|
||||||
|
ld (hl), a
|
||||||
|
ret
|
||||||
|
|
||||||
|
;; ---------------------------------
|
||||||
|
;; void clip_arch(unsigned char clip1, unsigned char clip2)
|
||||||
|
;; Stack; retl reth clip1 clip2
|
||||||
|
;; A_____HL____
|
||||||
|
;; return void
|
||||||
|
;; ---------------------------------
|
||||||
|
_clip_arch:
|
||||||
|
push ix
|
||||||
|
ld ix, #_info
|
||||||
|
ld hl, #4
|
||||||
|
add hl, sp
|
||||||
|
ld a, (hl)
|
||||||
|
ld CY1(ix), a
|
||||||
|
inc hl
|
||||||
|
ld a, (hl)
|
||||||
|
ld CY2(ix), a
|
||||||
|
pop ix
|
||||||
|
ret
|
||||||
|
|
||||||
|
;; ---------------------------------
|
||||||
|
;; void ctk_draw_init(void)
|
||||||
|
;; Stack; retl reth
|
||||||
|
;; _F____HL____ AFBCDEHL____
|
||||||
|
;; return void
|
||||||
|
;; ---------------------------------
|
||||||
|
_ctk_draw_init:
|
||||||
|
push ix
|
||||||
|
ld ix, #_info
|
||||||
|
ld h, #SCREEN_HEIGHT
|
||||||
|
ld l, #0
|
||||||
|
ld CY1(ix), l
|
||||||
|
ld CY2(ix), h
|
||||||
|
push hl
|
||||||
|
call _ctk_draw_clear
|
||||||
|
pop hl
|
||||||
|
pop ix
|
||||||
|
ret
|
||||||
|
|
||||||
|
;; ---------------------------------
|
||||||
|
;; ctk_draw_clear(unsigned char clipy1, unsigned char clipy2);
|
||||||
|
;; Stack; retl reth clipy1 clipy2
|
||||||
|
;; AFBCDEHL____
|
||||||
|
;; return void
|
||||||
|
;; ---------------------------------
|
||||||
|
_ctk_draw_clear:
|
||||||
|
ld hl, #2
|
||||||
|
add hl, sp
|
||||||
|
ld d, (hl) ; clipy1
|
||||||
|
inc hl
|
||||||
|
ld e, (hl) ; clipy2
|
||||||
|
ld c, #0
|
||||||
|
_ctk_draw_clear_loop:
|
||||||
|
ld a, d
|
||||||
|
cp a, e ; d - e (clipy1 - clipy2)
|
||||||
|
ret nc ; ret if clipy1 >= clipy2
|
||||||
|
push de
|
||||||
|
ld b, d
|
||||||
|
push bc
|
||||||
|
call _gotoxy_arch
|
||||||
|
pop bc
|
||||||
|
ld a, #SCREEN_WIDTH
|
||||||
|
push af
|
||||||
|
inc sp
|
||||||
|
call _cclear_arch
|
||||||
|
inc sp
|
||||||
|
pop de
|
||||||
|
inc d
|
||||||
|
jr _ctk_draw_clear_loop
|
||||||
|
|
||||||
|
.if 0
|
||||||
|
;; ---------------------------------
|
||||||
|
;; void ctk_draw_clear_window(struct ctk_window *window,
|
||||||
|
;; unsigned char focus,
|
||||||
|
;; unsigned clipy1,
|
||||||
|
;; unsigned clipy2);
|
||||||
|
;; Stack; retl reth windowl windowh focus clipy1 clipy2
|
||||||
|
;; AFBCDEHL____
|
||||||
|
;; return void
|
||||||
|
;; ---------------------------------
|
||||||
|
_ctk_draw_clear_get_value:
|
||||||
|
;; param; de=window, hl=offset
|
||||||
|
;; return a=value
|
||||||
|
;; A___________
|
||||||
|
push de
|
||||||
|
ld a, (hl)
|
||||||
|
add a, e
|
||||||
|
ld e, a
|
||||||
|
ld a, d
|
||||||
|
adc #0
|
||||||
|
ld d, a
|
||||||
|
ld a, (de)
|
||||||
|
pop de
|
||||||
|
ret
|
||||||
|
_ctk_draw_clear_window:
|
||||||
|
push ix
|
||||||
|
ld ix, #4
|
||||||
|
add ix, sp
|
||||||
|
ld l, 3(ix)
|
||||||
|
ld h, 4(ix)
|
||||||
|
push hl
|
||||||
|
call _clip_arch
|
||||||
|
pop hl
|
||||||
|
ld e, 0(ix)
|
||||||
|
ld d, 1(ix) ; #_window
|
||||||
|
ld hl, #_ctk_arch_window_y
|
||||||
|
call _ctk_draw_clear_get_value
|
||||||
|
ld b, a
|
||||||
|
inc b
|
||||||
|
inc b ; window->y + 2
|
||||||
|
|
||||||
|
ld hl, #_ctk_arch_window_h
|
||||||
|
call _ctk_draw_clear_get_value
|
||||||
|
ld c, a ; window->h
|
||||||
|
|
||||||
|
ld hl, #_ctk_arch_window_x
|
||||||
|
call _ctk_draw_clear_get_value
|
||||||
|
ld h, a
|
||||||
|
inc h ; window->x + 1
|
||||||
|
|
||||||
|
push hl
|
||||||
|
ld hl, #_ctk_arch_window_w
|
||||||
|
call _ctk_draw_clear_get_value
|
||||||
|
pop hl
|
||||||
|
ld l, a ; window->w
|
||||||
|
ld a, b ; i
|
||||||
|
_ctk_draw_clear_window_loop:
|
||||||
|
cp a, c ; i - h
|
||||||
|
jr nc, _ctk_draw_clear_window_ret
|
||||||
|
ld d, a
|
||||||
|
ld e, h ; d=i, e=window->x+1
|
||||||
|
push af
|
||||||
|
push hl
|
||||||
|
push de
|
||||||
|
call _gotoxy_arch
|
||||||
|
pop de
|
||||||
|
pop hl
|
||||||
|
ld a, h
|
||||||
|
add a, l ; window->x + 1+ window->w
|
||||||
|
push hl
|
||||||
|
push af
|
||||||
|
inc sp
|
||||||
|
call _cclear_arch
|
||||||
|
inc sp
|
||||||
|
pop af
|
||||||
|
pop hl
|
||||||
|
inc a
|
||||||
|
jr _ctk_draw_clear_window_loop
|
||||||
|
_ctk_draw_clear_window_ret:
|
||||||
|
pop ix
|
||||||
|
ret
|
||||||
|
|
||||||
|
void
|
||||||
|
ctk_draw_clear_window(struct ctk_window *window,
|
||||||
|
unsigned char focus,
|
||||||
|
unsigned char ctk_arch_clipy1,
|
||||||
|
unsigned char ctk_arch_clipy2) {
|
||||||
|
clip_arch(clipy1, clipy2);
|
||||||
|
h = window->y + 2 + window->h;
|
||||||
|
|
||||||
|
for(i = window->y + 2; i < h; ++i) {
|
||||||
|
gotoxy(window->x + 1, i)
|
||||||
|
cclear(window->x + 1 + window->w);
|
||||||
|
}
|
||||||
|
.endif
|
396
platform/pc-6001/ctk/ctk-conio_arch-source.c
Normal file
396
platform/pc-6001/ctk/ctk-conio_arch-source.c
Normal file
|
@ -0,0 +1,396 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2007, Takahide Matsutsuka.
|
||||||
|
* 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-conio_arch-source.c,v 1.1 2007/09/11 12:12:59 matsutsuka Exp $
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* \file
|
||||||
|
* This is an original source file for
|
||||||
|
* ctk-conio_arch.c and ctk-conio_arch-asm.S
|
||||||
|
* \author
|
||||||
|
* Takahide Matsutsuka <markn@markn.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "ctk/ctk.h"
|
||||||
|
#include "ctk/ctk-draw.h"
|
||||||
|
#include "contiki-conf.h"
|
||||||
|
#include "ctk/ctk-arch.h"
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#ifndef NULL
|
||||||
|
#define NULL (void *)0
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static char cursx, cursy;
|
||||||
|
static unsigned char reversed;
|
||||||
|
static char cy1, cy2;
|
||||||
|
|
||||||
|
unsigned char ctk_draw_windowtitle_height = 1;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
#define revers(c) reversed = c
|
||||||
|
#define clip(y1, y2) cy1 = y1; cy2 = y2
|
||||||
|
#define OFFSET(x, y) y * SCREEN_WIDTH + x
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
void cputc(char c) {
|
||||||
|
if (cursy >= cy1 && cursy <= cy2
|
||||||
|
&& cursy >= 0 && cursy <= SCREEN_HEIGHT
|
||||||
|
&& cursx >= 0 && cursx < SCREEN_WIDTH) {
|
||||||
|
unsigned int offset = OFFSET(cursx, cursy);
|
||||||
|
*((char *) VRAM_CHAR + offset) = c;
|
||||||
|
*((char *) VRAM_ATTR + offset) = reversed ? COLOR_REVERSED : COLOR_NORMAL;
|
||||||
|
}
|
||||||
|
cursx++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
void cputs(char *str) {
|
||||||
|
while (*str != 0) {
|
||||||
|
cputc(*str);
|
||||||
|
str++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
void cputsn(char *str, unsigned char len) {
|
||||||
|
while ((len > 0) && (*str != 0)) {
|
||||||
|
cputc(*str);
|
||||||
|
str++;
|
||||||
|
len--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
void chline(unsigned char length) {
|
||||||
|
while (length > 0) {
|
||||||
|
cputc(CH_HOLILINE);
|
||||||
|
length--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/* #define cvline(l) while (l > 0) { cputc(CH_VERTLINE); */
|
||||||
|
/* ++cursy; --cursx; l--; } */
|
||||||
|
|
||||||
|
void cvline(unsigned char length) {
|
||||||
|
while (length > 0) {
|
||||||
|
cputc(CH_VERTLINE);
|
||||||
|
++cursy;
|
||||||
|
--cursx;
|
||||||
|
length--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
void gotoxy(unsigned char x, unsigned char y) {
|
||||||
|
cursx = x;
|
||||||
|
cursy = y;
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
void clearTo(char x) {
|
||||||
|
while (cursx < x) {
|
||||||
|
cputc(CH_SPACE);
|
||||||
|
}
|
||||||
|
cursx = x;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
void ctk_draw_clear(unsigned char clipy1, unsigned char clipy2) {
|
||||||
|
while (clipy1 < clipy2) {
|
||||||
|
gotoxy(0, clipy1);
|
||||||
|
clearTo(SCREEN_WIDTH);
|
||||||
|
clipy1++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
void ctk_draw_init(void) {
|
||||||
|
clip(0, SCREEN_HEIGHT);
|
||||||
|
ctk_draw_clear(0, SCREEN_HEIGHT);
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/*
|
||||||
|
* w: widget
|
||||||
|
* x, y: screen position of client drawing area (left, top)
|
||||||
|
* clipx, clipy: screen position of client drawing area (right, bottom)
|
||||||
|
* clipy1, clipy2: min/max y position of screen
|
||||||
|
* focus: boolean
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
draw_widget(struct ctk_widget *w,
|
||||||
|
unsigned char x, unsigned char y,
|
||||||
|
unsigned char focus) {
|
||||||
|
unsigned char xpos, ypos, xscroll;
|
||||||
|
unsigned char i, j;
|
||||||
|
char c, *text;
|
||||||
|
#if CTK_CONF_ICONS
|
||||||
|
unsigned char len;
|
||||||
|
#endif /* CTK_CONF_ICONS */
|
||||||
|
|
||||||
|
xpos = x + w->x;
|
||||||
|
ypos = y + w->y;
|
||||||
|
|
||||||
|
revers(focus & CTK_FOCUS_WIDGET);
|
||||||
|
gotoxy(xpos, ypos);
|
||||||
|
|
||||||
|
if (w->type == CTK_WIDGET_SEPARATOR) {
|
||||||
|
chline(w->w);
|
||||||
|
} else if (w->type == CTK_WIDGET_LABEL) {
|
||||||
|
text = w->widget.label.text;
|
||||||
|
for(i = 0; i < w->h; ++i) {
|
||||||
|
gotoxy(xpos, ypos);
|
||||||
|
cputsn(text, w->w);
|
||||||
|
clearTo(xpos + w->w);
|
||||||
|
++ypos;
|
||||||
|
text += w->w;
|
||||||
|
}
|
||||||
|
} else if (w->type == CTK_WIDGET_BUTTON) {
|
||||||
|
cputc('[');
|
||||||
|
cputsn(w->widget.button.text, w->w);
|
||||||
|
cputc(']');
|
||||||
|
} else if (w->type == CTK_WIDGET_HYPERLINK) {
|
||||||
|
cputsn(w->widget.button.text, w->w);
|
||||||
|
} else if (w->type == 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) {
|
||||||
|
gotoxy(xpos, ypos);
|
||||||
|
if(w->widget.textentry.state == CTK_TEXTENTRY_EDIT &&
|
||||||
|
w->widget.textentry.ypos == j) {
|
||||||
|
revers(0);
|
||||||
|
cputc('>');
|
||||||
|
for(i = 0; i < w->w; ++i) {
|
||||||
|
c = text[i + xscroll];
|
||||||
|
revers(i == w->widget.textentry.xpos - xscroll);
|
||||||
|
cputc((c == 0) ? CH_SPACE : c);
|
||||||
|
}
|
||||||
|
revers(0);
|
||||||
|
cputc('<');
|
||||||
|
} else {
|
||||||
|
cputc(CH_VERTLINE);
|
||||||
|
cputsn(text, w->w);
|
||||||
|
clearTo(xpos + w->w + 1);
|
||||||
|
cputc(CH_VERTLINE);
|
||||||
|
}
|
||||||
|
++ypos;
|
||||||
|
text += w->w;
|
||||||
|
}
|
||||||
|
#if CTK_CONF_ICONS
|
||||||
|
} else if (w->type == CTK_WIDGET_ICON) {
|
||||||
|
if(w->widget.icon.textmap != NULL) {
|
||||||
|
for(i = 0; i < 3; ++i) {
|
||||||
|
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;
|
||||||
|
|
||||||
|
len = strlen(w->widget.icon.title);
|
||||||
|
if(x + len >= SCREEN_WIDTH) {
|
||||||
|
x = SCREEN_WIDTH - len;
|
||||||
|
}
|
||||||
|
gotoxy(x, ypos);
|
||||||
|
cputs(w->widget.icon.title);
|
||||||
|
}
|
||||||
|
#endif /* CTK_CONF_ICONS */
|
||||||
|
}
|
||||||
|
revers(0);
|
||||||
|
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
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;
|
||||||
|
clip(clipy1, clipy2);
|
||||||
|
|
||||||
|
posx = win->x + 1;
|
||||||
|
posy = win->y + 2;
|
||||||
|
|
||||||
|
if(w == win->focused) {
|
||||||
|
focus |= CTK_FOCUS_WIDGET;
|
||||||
|
}
|
||||||
|
|
||||||
|
draw_widget(w, posx, posy, focus);
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
ctk_draw_clear_window(struct ctk_window *window,
|
||||||
|
unsigned char focus,
|
||||||
|
unsigned char clipy1,
|
||||||
|
unsigned char clipy2) {
|
||||||
|
|
||||||
|
unsigned char i;
|
||||||
|
unsigned char x1, x2, y1, y2;
|
||||||
|
x1 = window->x + 1;
|
||||||
|
x2 = x1 + window->w;
|
||||||
|
y1 = window->y + 2;
|
||||||
|
y2 = y1 + window->h;
|
||||||
|
|
||||||
|
for(i = y1; i < y2; ++i) {
|
||||||
|
gotoxy(x1, i);
|
||||||
|
clearTo(x2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
void draw_window_sub(struct ctk_window *window, unsigned char focus) {
|
||||||
|
|
||||||
|
unsigned char x, y;
|
||||||
|
unsigned char x1, y1, x2;
|
||||||
|
struct ctk_widget *w;
|
||||||
|
unsigned char wfocus;
|
||||||
|
|
||||||
|
x = window->x;
|
||||||
|
y = window->y + 1;
|
||||||
|
|
||||||
|
x1 = x + 1;
|
||||||
|
y1 = y + 1;
|
||||||
|
x2 = x1 + window->w;
|
||||||
|
|
||||||
|
// |_
|
||||||
|
gotoxy(x, y1);
|
||||||
|
cvline(window->h);
|
||||||
|
cputc(CH_LLCORNER);
|
||||||
|
chline(window->w);
|
||||||
|
cputc(CH_LRCORNER);
|
||||||
|
|
||||||
|
// -
|
||||||
|
gotoxy(x, y);
|
||||||
|
cputc(CH_ULCORNER);
|
||||||
|
chline(window->w);
|
||||||
|
cputc(CH_URCORNER);
|
||||||
|
// |
|
||||||
|
gotoxy(x2, y1);
|
||||||
|
cvline(window->h);
|
||||||
|
|
||||||
|
/* Draw inactive widgets. */
|
||||||
|
for(w = window->inactive; w != NULL; w = w->next) {
|
||||||
|
draw_widget(w, x1, y1, 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, wfocus);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
ctk_draw_window(struct ctk_window *window, unsigned char focus,
|
||||||
|
unsigned char clipy1, unsigned char clipy2, unsigned char draw_borders) {
|
||||||
|
clip(clipy1, clipy2);
|
||||||
|
|
||||||
|
focus = focus & CTK_FOCUS_WINDOW;
|
||||||
|
draw_window_sub(window, focus);
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
void ctk_draw_dialog(struct ctk_window *dialog) {
|
||||||
|
clip(0, SCREEN_HEIGHT);
|
||||||
|
|
||||||
|
ctk_draw_clear_window(dialog, 0, 0, SCREEN_HEIGHT);
|
||||||
|
draw_window_sub(dialog, CTK_FOCUS_DIALOG);
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
#if CTK_CONF_MENUS
|
||||||
|
void draw_menu(struct ctk_menu *m, struct ctk_menu *open) {
|
||||||
|
#if CC_CONF_UNSIGNED_CHAR_BUGS
|
||||||
|
unsigned char x2;
|
||||||
|
unsigned int x, y;
|
||||||
|
#else
|
||||||
|
unsigned char x2;
|
||||||
|
unsigned char x, y;
|
||||||
|
#endif
|
||||||
|
x = cursx;
|
||||||
|
cputs(m->title);
|
||||||
|
cputc(CH_SPACE);
|
||||||
|
|
||||||
|
if (m == open) {
|
||||||
|
x2 = cursx;
|
||||||
|
if(x + CTK_CONF_MENUWIDTH > SCREEN_WIDTH) {
|
||||||
|
x = SCREEN_WIDTH - CTK_CONF_MENUWIDTH;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(y = 0; y < m->nitems; y++) {
|
||||||
|
if(y == m->active) {
|
||||||
|
revers(0);
|
||||||
|
}
|
||||||
|
gotoxy(x, y + 1);
|
||||||
|
if(m->items[y].title[0] == '-') {
|
||||||
|
chline(CTK_CONF_MENUWIDTH);
|
||||||
|
} else {
|
||||||
|
cputs(m->items[y].title);
|
||||||
|
}
|
||||||
|
clearTo(x + CTK_CONF_MENUWIDTH);
|
||||||
|
revers(1);
|
||||||
|
}
|
||||||
|
gotoxy(x2, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
void ctk_draw_menus(struct ctk_menus *menus) {
|
||||||
|
struct ctk_menu *m;
|
||||||
|
|
||||||
|
clip(0, SCREEN_HEIGHT);
|
||||||
|
/* Draw menus */
|
||||||
|
gotoxy(0, 0);
|
||||||
|
revers(1);
|
||||||
|
for(m = menus->menus->next; m != NULL; m = m->next) {
|
||||||
|
draw_menu(m, menus->open);
|
||||||
|
}
|
||||||
|
|
||||||
|
clearTo(SCREEN_WIDTH - strlen(menus->desktopmenu->title) - 1);
|
||||||
|
|
||||||
|
/* Draw desktopmenu */
|
||||||
|
draw_menu(menus->desktopmenu, menus->open);
|
||||||
|
|
||||||
|
revers(0);
|
||||||
|
}
|
||||||
|
#endif /* CTK_CONF_MENUS */
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/* Returns width and height of screen. */
|
||||||
|
unsigned char ctk_draw_width(void) {
|
||||||
|
return SCREEN_WIDTH;
|
||||||
|
}
|
||||||
|
unsigned char ctk_draw_height(void) {
|
||||||
|
return SCREEN_HEIGHT;
|
||||||
|
}
|
||||||
|
|
320
platform/pc-6001/ctk/ctk-conio_arch.c
Normal file
320
platform/pc-6001/ctk/ctk-conio_arch.c
Normal file
|
@ -0,0 +1,320 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2007, Takahide Matsutsuka.
|
||||||
|
* 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-conio_arch.c,v 1.1 2007/09/11 12:12:59 matsutsuka Exp $
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* \file
|
||||||
|
* This is architecture-depend contiki toolkit for PC-6001 family.
|
||||||
|
* \author
|
||||||
|
* Takahide Matsutsuka <markn@markn.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "ctk/ctk.h"
|
||||||
|
#include "ctk/ctk-draw.h"
|
||||||
|
#include "contiki-conf.h"
|
||||||
|
#include "ctk/ctk_arch.h"
|
||||||
|
#include "ctk/ctk-conio_arch.h"
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
|
struct screen_info {
|
||||||
|
char cursx; // +0
|
||||||
|
char cursy; // +1
|
||||||
|
char cy1; // +2
|
||||||
|
char cy2; // +3
|
||||||
|
};
|
||||||
|
struct screen_info info;
|
||||||
|
#if 0
|
||||||
|
const unsigned char ctk_arch_window_x = offsetof(struct ctk_window, x);
|
||||||
|
const unsigned char ctk_arch_window_y = offsetof(struct ctk_window, y);
|
||||||
|
const unsigned char ctk_arch_window_h = offsetof(struct ctk_window, h);
|
||||||
|
const unsigned char ctk_arch_window_w = offsetof(struct ctk_window, w);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
unsigned char ctk_draw_windowtitle_height = 1;
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/*
|
||||||
|
* w: widget
|
||||||
|
* x, y: screen position of client drawing area (left, top)
|
||||||
|
* focus: boolean
|
||||||
|
*/
|
||||||
|
static void draw_widget(struct ctk_widget *w,
|
||||||
|
unsigned char x, unsigned char y,
|
||||||
|
unsigned char focus) {
|
||||||
|
unsigned char xpos, ypos, xscroll;
|
||||||
|
unsigned char i, j;
|
||||||
|
char c, *text;
|
||||||
|
#if CTK_CONF_ICONS
|
||||||
|
unsigned char len;
|
||||||
|
#endif /* CTK_CONF_ICONS */
|
||||||
|
|
||||||
|
xpos = x + w->x;
|
||||||
|
ypos = y + w->y;
|
||||||
|
|
||||||
|
revers_arch(focus & CTK_FOCUS_WIDGET);
|
||||||
|
gotoxy_arch(xpos, ypos);
|
||||||
|
|
||||||
|
if (w->type == CTK_WIDGET_SEPARATOR) {
|
||||||
|
chline_arch(w->w);
|
||||||
|
} else if (w->type == CTK_WIDGET_LABEL) {
|
||||||
|
text = w->widget.label.text;
|
||||||
|
for(i = 0; i < w->h; ++i) {
|
||||||
|
gotoxy_arch(xpos, ypos);
|
||||||
|
cputsn_arch(text, w->w);
|
||||||
|
cclear_arch(xpos + w->w);
|
||||||
|
++ypos;
|
||||||
|
text += w->w;
|
||||||
|
}
|
||||||
|
} else if (w->type == CTK_WIDGET_BUTTON) {
|
||||||
|
cputc_arch('[');
|
||||||
|
cputsn_arch(w->widget.button.text, w->w);
|
||||||
|
cputc_arch(']');
|
||||||
|
} else if (w->type == CTK_WIDGET_HYPERLINK) {
|
||||||
|
cputsn_arch(w->widget.button.text, w->w);
|
||||||
|
} else if (w->type == 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) {
|
||||||
|
gotoxy_arch(xpos, ypos);
|
||||||
|
if(w->widget.textentry.state == CTK_TEXTENTRY_EDIT &&
|
||||||
|
w->widget.textentry.ypos == j) {
|
||||||
|
revers_arch(0);
|
||||||
|
cputc_arch('>');
|
||||||
|
for(i = 0; i < w->w; ++i) {
|
||||||
|
c = text[i + xscroll];
|
||||||
|
revers_arch(i == w->widget.textentry.xpos - xscroll);
|
||||||
|
cputc_arch((c == 0) ? CH_SPACE : c);
|
||||||
|
}
|
||||||
|
revers_arch(0);
|
||||||
|
cputc_arch('<');
|
||||||
|
} else {
|
||||||
|
cputc_arch(CH_VERTLINE);
|
||||||
|
cputsn_arch(text, w->w);
|
||||||
|
cclear_arch(xpos + w->w + 1);
|
||||||
|
cputc_arch(CH_VERTLINE);
|
||||||
|
}
|
||||||
|
++ypos;
|
||||||
|
text += w->w;
|
||||||
|
}
|
||||||
|
#if CTK_CONF_ICONS
|
||||||
|
} else if (w->type == CTK_WIDGET_ICON) {
|
||||||
|
if(w->widget.icon.textmap != NULL) {
|
||||||
|
for(i = 0; i < 3; ++i) {
|
||||||
|
gotoxy_arch(xpos, ypos);
|
||||||
|
cputc_arch(w->widget.icon.textmap[0 + 3 * i]);
|
||||||
|
cputc_arch(w->widget.icon.textmap[1 + 3 * i]);
|
||||||
|
cputc_arch(w->widget.icon.textmap[2 + 3 * i]);
|
||||||
|
++ypos;
|
||||||
|
}
|
||||||
|
x = xpos;
|
||||||
|
|
||||||
|
len = strlen(w->widget.icon.title);
|
||||||
|
if(x + len >= SCREEN_WIDTH) {
|
||||||
|
x = SCREEN_WIDTH - len;
|
||||||
|
}
|
||||||
|
gotoxy_arch(x, ypos);
|
||||||
|
cputs_arch(w->widget.icon.title);
|
||||||
|
}
|
||||||
|
#endif /* CTK_CONF_ICONS */
|
||||||
|
}
|
||||||
|
revers_arch(0);
|
||||||
|
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
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;
|
||||||
|
clip_arch(clipy1, clipy2);
|
||||||
|
|
||||||
|
posx = win->x + 1;
|
||||||
|
posy = win->y + 2;
|
||||||
|
|
||||||
|
if(w == win->focused) {
|
||||||
|
focus |= CTK_FOCUS_WIDGET;
|
||||||
|
}
|
||||||
|
|
||||||
|
draw_widget(w, posx, posy, focus);
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
ctk_draw_clear_window(struct ctk_window *window,
|
||||||
|
unsigned char focus,
|
||||||
|
unsigned char clipy1,
|
||||||
|
unsigned char clipy2) {
|
||||||
|
|
||||||
|
unsigned char i;
|
||||||
|
unsigned char x1, x2, y1, y2;
|
||||||
|
x1 = window->x + 1;
|
||||||
|
x2 = x1 + window->w;
|
||||||
|
y1 = window->y + 2;
|
||||||
|
y2 = y1 + window->h;
|
||||||
|
clip_arch(clipy1, clipy2);
|
||||||
|
|
||||||
|
for(i = y1; i < y2; ++i) {
|
||||||
|
gotoxy_arch(x1, i);
|
||||||
|
cclear_arch(x2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
static void draw_window_sub(struct ctk_window *window, unsigned char focus) {
|
||||||
|
|
||||||
|
unsigned char x, y;
|
||||||
|
unsigned char x1, y1, x2;
|
||||||
|
struct ctk_widget *w;
|
||||||
|
unsigned char wfocus;
|
||||||
|
|
||||||
|
x = window->x;
|
||||||
|
y = window->y + 1;
|
||||||
|
|
||||||
|
x1 = x + 1;
|
||||||
|
y1 = y + 1;
|
||||||
|
x2 = x1 + window->w;
|
||||||
|
|
||||||
|
// |_
|
||||||
|
gotoxy_arch(x, y1);
|
||||||
|
cvline_arch(window->h);
|
||||||
|
cputc_arch(CH_LLCORNER);
|
||||||
|
chline_arch(window->w);
|
||||||
|
cputc_arch(CH_LRCORNER);
|
||||||
|
|
||||||
|
// -
|
||||||
|
gotoxy_arch(x, y);
|
||||||
|
cputc_arch(CH_ULCORNER);
|
||||||
|
chline_arch(window->w);
|
||||||
|
cputc_arch(CH_URCORNER);
|
||||||
|
// |
|
||||||
|
gotoxy_arch(x2, y1);
|
||||||
|
cvline_arch(window->h);
|
||||||
|
|
||||||
|
/* Draw inactive widgets. */
|
||||||
|
for(w = window->inactive; w != NULL; w = w->next) {
|
||||||
|
draw_widget(w, x1, y1, 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, wfocus);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
void ctk_draw_window(struct ctk_window *window, unsigned char focus,
|
||||||
|
unsigned char clipy1, unsigned char clipy2,
|
||||||
|
unsigned char draw_borders) {
|
||||||
|
clip_arch(clipy1, clipy2);
|
||||||
|
|
||||||
|
focus = focus & CTK_FOCUS_WINDOW;
|
||||||
|
draw_window_sub(window, focus);
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
void ctk_draw_dialog(struct ctk_window *dialog) {
|
||||||
|
clip_arch(0, SCREEN_HEIGHT);
|
||||||
|
|
||||||
|
ctk_draw_clear_window(dialog, 0, 0, SCREEN_HEIGHT);
|
||||||
|
draw_window_sub(dialog, CTK_FOCUS_DIALOG);
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
#if CTK_CONF_MENUS
|
||||||
|
static void draw_menu(struct ctk_menu *m, struct ctk_menu *open) {
|
||||||
|
#if CC_CONF_UNSIGNED_CHAR_BUGS
|
||||||
|
unsigned char x2;
|
||||||
|
unsigned int x, y;
|
||||||
|
#else
|
||||||
|
unsigned char x2;
|
||||||
|
unsigned char x, y;
|
||||||
|
#endif
|
||||||
|
x = info.cursx;
|
||||||
|
cputs_arch(m->title);
|
||||||
|
cputc_arch(CH_SPACE);
|
||||||
|
|
||||||
|
if (m == open) {
|
||||||
|
x2 = info.cursx;
|
||||||
|
if(x + CTK_CONF_MENUWIDTH > SCREEN_WIDTH) {
|
||||||
|
x = SCREEN_WIDTH - CTK_CONF_MENUWIDTH;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(y = 0; y < m->nitems; y++) {
|
||||||
|
if(y == m->active) {
|
||||||
|
revers_arch(0);
|
||||||
|
}
|
||||||
|
gotoxy_arch(x, y + 1);
|
||||||
|
if(m->items[y].title[0] == '-') {
|
||||||
|
chline_arch(CTK_CONF_MENUWIDTH);
|
||||||
|
} else {
|
||||||
|
cputs_arch(m->items[y].title);
|
||||||
|
}
|
||||||
|
cclear_arch(x + CTK_CONF_MENUWIDTH);
|
||||||
|
revers_arch(1);
|
||||||
|
}
|
||||||
|
gotoxy_arch(x2, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
void ctk_draw_menus(struct ctk_menus *menus) {
|
||||||
|
struct ctk_menu *m;
|
||||||
|
|
||||||
|
clip_arch(0, SCREEN_HEIGHT);
|
||||||
|
/* Draw menus */
|
||||||
|
gotoxy_arch(0, 0);
|
||||||
|
revers_arch(1);
|
||||||
|
for(m = menus->menus->next; m != NULL; m = m->next) {
|
||||||
|
draw_menu(m, menus->open);
|
||||||
|
}
|
||||||
|
|
||||||
|
cclear_arch(SCREEN_WIDTH - strlen(menus->desktopmenu->title) - 1);
|
||||||
|
|
||||||
|
/* Draw desktopmenu */
|
||||||
|
draw_menu(menus->desktopmenu, menus->open);
|
||||||
|
|
||||||
|
revers_arch(0);
|
||||||
|
}
|
||||||
|
#endif /* CTK_CONF_MENUS */
|
||||||
|
/*---------------------------------------------------------------------------*/
|
||||||
|
/* Returns width and height of screen. */
|
||||||
|
unsigned char ctk_draw_width(void) {
|
||||||
|
return SCREEN_WIDTH;
|
||||||
|
}
|
||||||
|
unsigned char ctk_draw_height(void) {
|
||||||
|
return SCREEN_HEIGHT;
|
||||||
|
}
|
54
platform/pc-6001/ctk/ctk-conio_arch.h
Normal file
54
platform/pc-6001/ctk/ctk-conio_arch.h
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2007, Takahide Matsutsuka.
|
||||||
|
* 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-conio_arch.h,v 1.1 2007/09/11 12:12:59 matsutsuka Exp $
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* \file
|
||||||
|
* This is architecture-depend contiki toolkit for PC-6001 family.
|
||||||
|
* \author
|
||||||
|
* Takahide Matsutsuka <markn@markn.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __CTK_CONIO_ARCH_H__
|
||||||
|
#define __CTK_CONIO_ARCH_H__
|
||||||
|
|
||||||
|
void cputc_arch(char c);
|
||||||
|
void cputs_arch(char *str);
|
||||||
|
void cputsn_arch(char *str, unsigned char len);
|
||||||
|
void chline_arch(unsigned char length);
|
||||||
|
void cvline_arch(unsigned char length);
|
||||||
|
void clip_arch(unsigned char clip1, unsigned char clip2);
|
||||||
|
void gotoxy_arch(unsigned char x, unsigned char y);
|
||||||
|
void cclear_arch(char x);
|
||||||
|
void revers_arch(unsigned char reversed);
|
||||||
|
|
||||||
|
#endif /* __CTK_CONIO_ARCH_H__ */
|
151
platform/pc-6001/ctk/ctk_arch-def.h
Normal file
151
platform/pc-6001/ctk/ctk_arch-def.h
Normal file
|
@ -0,0 +1,151 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2007, Takahide Matsutsuka.
|
||||||
|
* 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-def.h,v 1.1 2007/09/11 12:12:59 matsutsuka Exp $
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* \file
|
||||||
|
* ctk_arch-def.h
|
||||||
|
* Definitions of CTK for PC-6001 family, which consist of the following:
|
||||||
|
* - Configuraton for ctk main library.
|
||||||
|
* - Configuraton for ctk_arch library.
|
||||||
|
* This file is used in assembler file with precompilation, so
|
||||||
|
* NEVER include other than directives and comments.
|
||||||
|
* \author
|
||||||
|
* Takahide Matsutsuka <markn@markn.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __CTK_ARCH_DEF_H__
|
||||||
|
#define __CTK_ARCH_DEF_H__
|
||||||
|
|
||||||
|
/* characters */
|
||||||
|
#if defined(ARCH_PC6001) || defined(ARCH_PC6001MK2)
|
||||||
|
#define CH_VERTLINE 0x16
|
||||||
|
#define CH_HOLILINE 0x17
|
||||||
|
#define CH_ULCORNER 0x18
|
||||||
|
#define CH_URCORNER 0x19
|
||||||
|
#define CH_LLCORNER 0x1a
|
||||||
|
#define CH_LRCORNER 0x1b
|
||||||
|
#elif defined(ARCH_PC6001A)
|
||||||
|
#define CH_VERTLINE '|'
|
||||||
|
#define CH_HOLILINE '-'
|
||||||
|
#define CH_ULCORNER '/'
|
||||||
|
#define CH_URCORNER '\\'
|
||||||
|
#define CH_LLCORNER '\\'
|
||||||
|
#define CH_LRCORNER '/'
|
||||||
|
#else
|
||||||
|
#error invalid ARCH
|
||||||
|
#endif
|
||||||
|
#define CH_SPACE 0x20
|
||||||
|
|
||||||
|
/* screen properties */
|
||||||
|
#if defined(ARCH_PC6001MK2)
|
||||||
|
#define VRAM_ATTR 0x4000
|
||||||
|
#define VRAM_CHAR 0x4400
|
||||||
|
#define SCREEN_WIDTH 40
|
||||||
|
#define SCREEN_HEIGHT 20
|
||||||
|
#define COLOR_NORMAL 0x0f
|
||||||
|
#define COLOR_REVERSED 0x70
|
||||||
|
#elif (defined(ARCH_PC6001) || defined(ARCH_PC6001A)) && defined(MEMORY_16K)
|
||||||
|
#define VRAM_ATTR 0xc000
|
||||||
|
#define VRAM_CHAR 0xc200
|
||||||
|
#define SCREEN_WIDTH 32
|
||||||
|
#define SCREEN_HEIGHT 16
|
||||||
|
#define COLOR_NORMAL 0x20
|
||||||
|
#define COLOR_REVERSED 0x21
|
||||||
|
#elif (defined(ARCH_PC6001) || defined(ARCH_PC6001A)) && (defined(MEMORY_32K) || defined(MEMORY_ROM))
|
||||||
|
#define VRAM_ATTR 0x8000
|
||||||
|
#define VRAM_CHAR 0x8200
|
||||||
|
#define SCREEN_WIDTH 32
|
||||||
|
#define SCREEN_HEIGHT 16
|
||||||
|
#define COLOR_NORMAL 0x20
|
||||||
|
#define COLOR_REVERSED 0x21
|
||||||
|
#else
|
||||||
|
#error Specify appropriate ARCH & MEMORY combination
|
||||||
|
#endif /* ARCH_PC6001MK2 */
|
||||||
|
|
||||||
|
/* key code */
|
||||||
|
#define CH_F1 -16//0xf0
|
||||||
|
#define CH_F2 -15//0xf1
|
||||||
|
#define CH_F3 -14//0xf2
|
||||||
|
#define CH_F4 -13//0xf3
|
||||||
|
#define CH_F5 -12//0xf4
|
||||||
|
#define CH_TAB 0x09
|
||||||
|
|
||||||
|
#define CH_CURS_UP 0x1e
|
||||||
|
#define CH_CURS_DOWN 0x1f
|
||||||
|
#define CH_CURS_LEFT 0x1d
|
||||||
|
#define CH_CURS_RIGHT 0x1c
|
||||||
|
#define CH_ENTER 0x0d
|
||||||
|
#define CH_ESC 0x1b
|
||||||
|
#define CH_STOP 0x03
|
||||||
|
#define CH_DEL 0x08
|
||||||
|
|
||||||
|
/* Contiki toolkit options */
|
||||||
|
|
||||||
|
/* Toggles support for desktop icons. */
|
||||||
|
#define CTK_CONF_ICONS 1
|
||||||
|
/* Define if text icon is used. */
|
||||||
|
#define CTK_CONF_ICON_TEXTMAPS 1
|
||||||
|
/* Define if bitmap icon is used. */
|
||||||
|
#define CTK_CONF_ICON_BITMAPS 1
|
||||||
|
/* Toggles support for closable windows. */
|
||||||
|
#define CTK_CONF_WINDOWCLOSE 1
|
||||||
|
/* Toggles support for movable windows. */
|
||||||
|
#define CTK_CONF_WINDOWMOVE 1
|
||||||
|
/* Toggles support for menus. */
|
||||||
|
#define CTK_CONF_MENUS 1
|
||||||
|
/* Defines the default width of a menu. */
|
||||||
|
#define CTK_CONF_MENUWIDTH 16
|
||||||
|
/* Defines if screen saver is supported. */
|
||||||
|
#define CTK_CONF_SCREENSAVER 0
|
||||||
|
|
||||||
|
/* The maximum number of menu items in each menu. */
|
||||||
|
#define CTK_CONF_MAXMENUITEMS 4
|
||||||
|
//#define CTK_CONF_MAX_REDRAWWIDGETS 2
|
||||||
|
//#define CTK_CONF_MAX_REDRAWWINDOWS 2
|
||||||
|
|
||||||
|
/* Key used to switch the frontmost window. */
|
||||||
|
#define CTK_CONF_WINDOWSWITCH_KEY CH_F3
|
||||||
|
/* Key used to move down a widget. */
|
||||||
|
#define CTK_CONF_WIDGETDOWN_KEY CH_TAB
|
||||||
|
/* Key used to move up a widget. */
|
||||||
|
#define CTK_CONF_WIDGETUP_KEY CH_F5
|
||||||
|
/* Defines which key that is to be used for activating the menus */
|
||||||
|
#define CTK_CONF_MENU_KEY CH_F1
|
||||||
|
|
||||||
|
/* offsets of struct screen_info for assembler */
|
||||||
|
#define CURSX 0
|
||||||
|
#define CURSY 1
|
||||||
|
#define CY1 2
|
||||||
|
#define CY2 3
|
||||||
|
|
||||||
|
#endif /* __CTK_ARCH_DEF_H__ */
|
49
platform/pc-6001/ctk/ctk_arch.h
Normal file
49
platform/pc-6001/ctk/ctk_arch.h
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2007, Takahide Matsutsuka.
|
||||||
|
* 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/09/11 12:12:59 matsutsuka Exp $
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* \file
|
||||||
|
* ctk_arch.h
|
||||||
|
* Archtecture specific definitions and library declarations.
|
||||||
|
* \author
|
||||||
|
* Takahide Matsutsuka <markn@markn.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __CTK_ARCH_H__
|
||||||
|
#define __CTK_ARCH_H__
|
||||||
|
|
||||||
|
#include "ctk/ctk_arch-def.h"
|
||||||
|
#include "dev/getkey.h"
|
||||||
|
#include "dev/isprint_arch.h"
|
||||||
|
|
||||||
|
#endif /* __CTK_ARCH_H__ */
|
34
platform/pc-6001/dev/clock.S
Normal file
34
platform/pc-6001/dev/clock.S
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
;;;
|
||||||
|
;;;
|
||||||
|
;;; clock.S
|
||||||
|
;;;
|
||||||
|
;;; retrieve tickcount from PC-6001's internal timer
|
||||||
|
;;;
|
||||||
|
;;; @author Takahide Matsutsuka <markn@markn.org>
|
||||||
|
;;;
|
||||||
|
;;; $Id: clock.S,v 1.1 2007/09/11 12:12:59 matsutsuka Exp $
|
||||||
|
;;;
|
||||||
|
.globl _clock_time
|
||||||
|
|
||||||
|
.area _GSINIT
|
||||||
|
;; ---------------------------------
|
||||||
|
;; unsigned long clock_time();
|
||||||
|
;; __BCDEHL____
|
||||||
|
;; return long value as (DE, BC)
|
||||||
|
;; ---------------------------------
|
||||||
|
;; this function uses PC-6001's internal timer
|
||||||
|
;; which counts up 2 per 1/512 sec.
|
||||||
|
.area _CODE
|
||||||
|
_clock_time:
|
||||||
|
ld hl, #0xfa28
|
||||||
|
ld c, (hl)
|
||||||
|
inc hl
|
||||||
|
ld b, (hl)
|
||||||
|
inc hl
|
||||||
|
ld e, (hl)
|
||||||
|
inc hl
|
||||||
|
ld d, (hl)
|
||||||
|
ld l, c
|
||||||
|
ld h, b
|
||||||
|
|
||||||
|
ret
|
77
platform/pc-6001/dev/getkey.S
Normal file
77
platform/pc-6001/dev/getkey.S
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
;;;
|
||||||
|
;;;
|
||||||
|
;;; getkey.S
|
||||||
|
;;;
|
||||||
|
;;; PC-6001 architecture-depend key fetch module
|
||||||
|
;;;
|
||||||
|
;;; @author Takahide Matsutsuka <markn@markn.org>
|
||||||
|
;;;
|
||||||
|
|
||||||
|
.globl _keyavail_arch
|
||||||
|
.globl _getkey_arch
|
||||||
|
.area _GSINIT
|
||||||
|
|
||||||
|
.area _DATA
|
||||||
|
;; unsigned char key;
|
||||||
|
_key:
|
||||||
|
.ds 1
|
||||||
|
|
||||||
|
.area _GSINIT
|
||||||
|
ld hl, #_key
|
||||||
|
xor (hl)
|
||||||
|
|
||||||
|
.area _CODE
|
||||||
|
|
||||||
|
;; ---------------------------------
|
||||||
|
;; unsigned char keyavail_arch();
|
||||||
|
;; AFBC__HL____
|
||||||
|
;; a=getkey, l=getkey
|
||||||
|
;; ---------------------------------
|
||||||
|
_keyavail_arch:
|
||||||
|
ld hl, #_key
|
||||||
|
ld a, (hl)
|
||||||
|
;; if (key != 0) return 1; else goto _getch;
|
||||||
|
or a
|
||||||
|
jr z, _getch
|
||||||
|
ld l, #0x01
|
||||||
|
ret
|
||||||
|
|
||||||
|
_getch:
|
||||||
|
push hl
|
||||||
|
;; A = (keybuf)
|
||||||
|
call #0x103a
|
||||||
|
pop hl
|
||||||
|
;; if (keybuf != null) goto _getch_key
|
||||||
|
jr nz, _getch_key
|
||||||
|
;; we do not have a keyin
|
||||||
|
xor a
|
||||||
|
jr _getch_got
|
||||||
|
_getch_key:
|
||||||
|
cp a, #0x14
|
||||||
|
jr z, _getch
|
||||||
|
|
||||||
|
_getch_got:
|
||||||
|
;; key = getch()
|
||||||
|
ld (hl), a
|
||||||
|
ld l, a
|
||||||
|
ret
|
||||||
|
|
||||||
|
|
||||||
|
;; ---------------------------------
|
||||||
|
;; unsigned char getkey_arch();
|
||||||
|
;; AFBC__HL____
|
||||||
|
;; ---------------------------------
|
||||||
|
_getkey_arch:
|
||||||
|
;; if (key == 0) keyavail_arch();
|
||||||
|
ld hl, #_key
|
||||||
|
ld a, (hl)
|
||||||
|
or a
|
||||||
|
call z, _keyavail_arch
|
||||||
|
;; if (key == 0) goto _havekey
|
||||||
|
or a
|
||||||
|
jr z, _havekey
|
||||||
|
;; key = 0
|
||||||
|
ld (hl), #0x00
|
||||||
|
_havekey:
|
||||||
|
ld l, a
|
||||||
|
ret
|
52
platform/pc-6001/dev/getkey.h
Normal file
52
platform/pc-6001/dev/getkey.h
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2007, Takahide Matsutsuka.
|
||||||
|
* 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: getkey.h,v 1.1 2007/09/11 12:12:59 matsutsuka Exp $
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* \file
|
||||||
|
* A header file for machine depend key fetching functions.
|
||||||
|
* \author
|
||||||
|
* Takahide Matsutsuka <markn@markn.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __GETKEY_H__
|
||||||
|
#define __GETKEY_H__
|
||||||
|
|
||||||
|
/* defined in getch.S */
|
||||||
|
typedef char ctk_arch_key_t;
|
||||||
|
ctk_arch_key_t keyavail_arch();
|
||||||
|
ctk_arch_key_t getkey_arch();
|
||||||
|
#define CTK_ARCH_KEY_T
|
||||||
|
#define ctk_arch_getkey() getkey_arch()
|
||||||
|
#define ctk_arch_keyavail() keyavail_arch()
|
||||||
|
|
||||||
|
#endif /* __GETKEY_H__ */
|
38
platform/pc-6001/dev/isprint_arch.S
Normal file
38
platform/pc-6001/dev/isprint_arch.S
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
;;;
|
||||||
|
;;;
|
||||||
|
;;; isprint-arch.S
|
||||||
|
;;;
|
||||||
|
;;; Architecture depend isprint function.
|
||||||
|
;;;
|
||||||
|
;;; @author Takahide Matsutsuka <markn@markn.org>
|
||||||
|
;;;
|
||||||
|
;;; $Id: isprint_arch.S,v 1.1 2007/09/11 12:12:59 matsutsuka Exp $
|
||||||
|
;;;
|
||||||
|
.globl _isprint_arch
|
||||||
|
.area _GSINIT
|
||||||
|
|
||||||
|
;; unsigned long clock_time();
|
||||||
|
;; return long value as (DE, BC)
|
||||||
|
|
||||||
|
;; this function is identify if a given
|
||||||
|
;; character is printable on PC-6001
|
||||||
|
.area _CODE
|
||||||
|
_isprint_arch:
|
||||||
|
;; ---------------------------------
|
||||||
|
;; char isprint (unsigned char ch);
|
||||||
|
;; Stack; retl reth ch
|
||||||
|
;; A_____HL____
|
||||||
|
;; return l
|
||||||
|
;; ---------------------------------
|
||||||
|
ld hl, #2
|
||||||
|
add hl, sp
|
||||||
|
ld a, (hl)
|
||||||
|
or a
|
||||||
|
jr z, #_isprint_arch_ret_false
|
||||||
|
cp #0xfe
|
||||||
|
jr nc, #_isprint_arch_ret_false
|
||||||
|
ld l, #1
|
||||||
|
ret
|
||||||
|
_isprint_arch_ret_false:
|
||||||
|
ld l, #0
|
||||||
|
ret
|
48
platform/pc-6001/dev/isprint_arch.h
Normal file
48
platform/pc-6001/dev/isprint_arch.h
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2007, Takahide Matsutsuka.
|
||||||
|
* 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: isprint_arch.h,v 1.1 2007/09/11 12:12:59 matsutsuka Exp $
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* \file
|
||||||
|
* A header file for machine depend isprint function.
|
||||||
|
* \author
|
||||||
|
* Takahide Matsutsuka <markn@markn.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __ISPRINT_ARCH_H__
|
||||||
|
#define __ISPRINT_ARCH_H__
|
||||||
|
|
||||||
|
/* defined in isprint_arch.S */
|
||||||
|
unsigned char isprint_arch(char ch);
|
||||||
|
#define ctk_arch_isprint(c) isprint_arch(c)
|
||||||
|
|
||||||
|
#endif /* __ISPRINT_ARCH_H__ */
|
65
platform/pc-6001/dev/rs232-asm.S
Normal file
65
platform/pc-6001/dev/rs232-asm.S
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
;;;
|
||||||
|
;;;
|
||||||
|
;;; rs232-asm.S
|
||||||
|
;;;
|
||||||
|
;;; PC-6001 Architecture depend RS-232C implementation,
|
||||||
|
;;; uses a bunch of BIOS functions.
|
||||||
|
;;;
|
||||||
|
;;; @author Takahide Matsutsuka <markn@markn.org>
|
||||||
|
;;;
|
||||||
|
;;; $Id: rs232-asm.S,v 1.1 2007/09/11 12:12:59 matsutsuka Exp $
|
||||||
|
;;;
|
||||||
|
|
||||||
|
;; definitions of PC-6001 BIOS routines
|
||||||
|
_rs232c_initialize = 0x19bf
|
||||||
|
_rs232c_char_output = 0x19e8
|
||||||
|
_char_input_sub = 0x2642
|
||||||
|
_rs232c_interrupt_sub = 0x0f64
|
||||||
|
|
||||||
|
;; export symbols
|
||||||
|
.globl _rs232_arch_writeb
|
||||||
|
.globl _rs232_arch_poll
|
||||||
|
.globl _rs232_arch_init
|
||||||
|
|
||||||
|
.area _CODE
|
||||||
|
|
||||||
|
;; ---------------------------------
|
||||||
|
;; void rs232_writeb(u8_t c)
|
||||||
|
;; Stack; retl reth c
|
||||||
|
;; AFBC__HL____
|
||||||
|
;; return void
|
||||||
|
;; ---------------------------------
|
||||||
|
_rs232_arch_writeb:
|
||||||
|
ld hl, #2
|
||||||
|
add hl, sp
|
||||||
|
ld a, (hl)
|
||||||
|
call _rs232c_char_output
|
||||||
|
ret
|
||||||
|
|
||||||
|
;; ---------------------------------
|
||||||
|
;; unsigned char rs232_arch_poll();
|
||||||
|
;; Stack; retl reth
|
||||||
|
;; AFBC__HL____
|
||||||
|
;; return input byte (zero if no input)
|
||||||
|
;; ---------------------------------
|
||||||
|
_rs232_arch_poll:
|
||||||
|
ld a,#0x01
|
||||||
|
di
|
||||||
|
call #_char_input_sub ; read from buffer
|
||||||
|
ei
|
||||||
|
jr nz, _rs232_arch_poll_ret
|
||||||
|
xor a ; we have no data in the buffer
|
||||||
|
_rs232_arch_poll_ret:
|
||||||
|
ld l, a
|
||||||
|
ret
|
||||||
|
|
||||||
|
;; ---------------------------------
|
||||||
|
;; void rs232_init(unsigned long ubr);
|
||||||
|
;; Stack; retl reth ubr1 ubr2 ubr3 ubr4
|
||||||
|
;; AFB_DEHL____
|
||||||
|
;; return void
|
||||||
|
;; ---------------------------------
|
||||||
|
_rs232_arch_init:
|
||||||
|
ld b, #0x4f
|
||||||
|
call _rs232c_initialize
|
||||||
|
ret
|
47
platform/pc-6001/dev/rtimer-arch.h
Normal file
47
platform/pc-6001/dev/rtimer-arch.h
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* $Id: rtimer-arch.h,v 1.1 2007/09/11 12:12:59 matsutsuka Exp $
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* \file
|
||||||
|
* A configuration file of machine depend rtimer.
|
||||||
|
* \authort
|
||||||
|
* Takahide Matsutsuka <markn@markn.org>
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef __RTIMER_ARCH_H__
|
||||||
|
#define __RTIMER_ARCH_H__
|
||||||
|
|
||||||
|
#define RTIMER_ARCH_SECOND 1024
|
||||||
|
|
||||||
|
#endif /* __RTIMER_ARCH_H__ */
|
Loading…
Reference in a new issue