Added C128 port. It runs the example webserver both in the cgi and cfs variant - although the latter only with a reduced MTU size due to memory constraints.
This commit is contained in:
parent
a9a1a00f27
commit
26a554e7c2
6 changed files with 271 additions and 0 deletions
4
platform/c128/Makefile.c128
Normal file
4
platform/c128/Makefile.c128
Normal file
|
@ -0,0 +1,4 @@
|
|||
CFLAGS += -DWITH_PETSCII
|
||||
|
||||
CONTIKI_CPU = $(CONTIKI)/cpu/6502
|
||||
include $(CONTIKI_CPU)/Makefile.6502
|
12
platform/c128/README
Normal file
12
platform/c128/README
Normal file
|
@ -0,0 +1,12 @@
|
|||
The platform/c128/ directory is used for targeting a Commodore 128 computer.
|
||||
Most things are shared between the 6502-based targets so please consult
|
||||
cpu/6502/README for further details.
|
||||
|
||||
The following C64 Ethernet cards are supported:
|
||||
- RR+RR-Net: Use driver cs8900a.eth with the address $DE08.
|
||||
- TFE: Use driver cs8900a.eth with the address $DE00.
|
||||
- ETH64: Use driver lan91c96.eth with the address $DE10.
|
||||
|
||||
In most cases it is desirable to use an emulator for the development and testing
|
||||
of a Contiki application. VICE is especially well suited as it emulates both the
|
||||
RR-Net and TFE Ethernet cards. It is available at http://www.viceteam.org/.
|
73
platform/c128/contiki-conf.h
Normal file
73
platform/c128/contiki-conf.h
Normal file
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* 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: contiki-conf.h,v 1.1 2008/01/05 22:30:23 oliverschmidt Exp $
|
||||
*/
|
||||
|
||||
#ifndef __CONTIKI_CONF_H__
|
||||
#define __CONTIKI_CONF_H__
|
||||
|
||||
#include "6502def.h"
|
||||
|
||||
#define UIP_CONF_LOGGING 0
|
||||
|
||||
#define CTK_CONF_MENU_KEY CH_F1
|
||||
#define CTK_CONF_WINDOWSWITCH_KEY CH_F3
|
||||
#define CTK_CONF_WIDGETUP_KEY CH_F5
|
||||
#define CTK_CONF_WIDGETDOWN_KEY CH_F7
|
||||
|
||||
#define MOUSE_CONF_DRIVER "c128-1351.mou"
|
||||
#define MOUSE_CONF_XTOC(x) ((x) / 8)
|
||||
#define MOUSE_CONF_YTOC(y) ((y) / 8)
|
||||
|
||||
#define BORDERCOLOR COLOR_LIGHTBLUE
|
||||
#define SCREENCOLOR COLOR_BLUE
|
||||
#define BACKGROUNDCOLOR COLOR_BLUE
|
||||
#define WINDOWCOLOR COLOR_GRAY1
|
||||
#define WINDOWCOLOR_FOCUS COLOR_LIGHTBLUE
|
||||
#define WIDGETCOLOR COLOR_GRAY1
|
||||
#define WIDGETCOLOR_FOCUS COLOR_YELLOW
|
||||
#define WIDGETCOLOR_FWIN COLOR_LIGHTBLUE
|
||||
#define WIDGETCOLOR_HLINK COLOR_CYAN
|
||||
|
||||
#define WEBSERVER_CONF_CGI_CONNS UIP_CONNS
|
||||
#define WEBSERVER_CONF_CFS_CONNS 8
|
||||
|
||||
#define WWW_CONF_HISTORY_SIZE 4
|
||||
#define WWW_CONF_MAX_URLLEN 38
|
||||
#define WWW_CONF_MAX_NUMPAGEWIDGETS 20
|
||||
#define WWW_CONF_MAX_FORMACTIONLEN 20
|
||||
#define WWW_CONF_MAX_FORMNAMELEN 20
|
||||
#define WWW_CONF_MAX_INPUTNAMELEN 20
|
||||
#define WWW_CONF_MAX_INPUTVALUELEN 20
|
||||
|
||||
#endif /* __CONTIKI_CONF_H__ */
|
145
platform/c128/contiki-main.c
Normal file
145
platform/c128/contiki-main.c
Normal file
|
@ -0,0 +1,145 @@
|
|||
/*
|
||||
* Copyright (c) 2006, Swedish Institute of Computer Science.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the Institute nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* Author: Oliver Schmidt <ol.sc@web.de>
|
||||
*
|
||||
* $Id: contiki-main.c,v 1.1 2008/01/05 22:30:23 oliverschmidt Exp $
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "contiki-net.h"
|
||||
#include "ctk/ctk.h"
|
||||
#include "sys/log.h"
|
||||
#include "lib/config.h"
|
||||
#include "net/ethernet-drv.h"
|
||||
|
||||
#if WITH_GUI
|
||||
#define CTK_PROCESS &ctk_process,
|
||||
#else /* WITH_GUI */
|
||||
#define CTK_PROCESS
|
||||
#endif /* WITH_GUI */
|
||||
|
||||
#if WITH_DNS
|
||||
#define RESOLV_PROCESS &resolv_process,
|
||||
#else /* WITH_DNS */
|
||||
#define RESOLV_PROCESS
|
||||
#endif /* WITH_DNS */
|
||||
|
||||
PROCINIT(&etimer_process,
|
||||
CTK_PROCESS
|
||||
RESOLV_PROCESS
|
||||
&tcpip_process);
|
||||
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void *
|
||||
opendir(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void *
|
||||
readdir(void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
closedir(void)
|
||||
{
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
||||
void
|
||||
main(void)
|
||||
{
|
||||
struct ethernet_config *ethernet_config;
|
||||
|
||||
process_init();
|
||||
|
||||
procinit_init();
|
||||
|
||||
autostart_start((struct process **)autostart_processes);
|
||||
|
||||
#if 1
|
||||
|
||||
ethernet_config = config_read("contiki.cfg");
|
||||
|
||||
#else
|
||||
{
|
||||
static struct ethernet_config config = {0xDE08, "cs8900a.eth"};
|
||||
uip_ipaddr_t addr;
|
||||
|
||||
uip_ipaddr(&addr, 192,168,0,128);
|
||||
uip_sethostaddr(&addr);
|
||||
|
||||
uip_ipaddr(&addr, 255,255,255,0);
|
||||
uip_setnetmask(&addr);
|
||||
|
||||
uip_ipaddr(&addr, 192,168,0,1);
|
||||
uip_setdraddr(&addr);
|
||||
|
||||
uip_ipaddr(&addr, 192,168,0,1);
|
||||
resolv_conf(&addr);
|
||||
|
||||
ethernet_config = &config;
|
||||
}
|
||||
#endif
|
||||
|
||||
process_start((struct process *)ðernet_process, (char *)ethernet_config);
|
||||
|
||||
#if (WITH_GUI && WITH_MOUSE)
|
||||
{
|
||||
static const u8_t mouse_sprite[64] = {
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x0F, 0xE0, 0x00, 0x0F, 0xC0, 0x00, 0x0F,
|
||||
0x80, 0x00, 0x0F, 0xC0, 0x00, 0x0D, 0xE0, 0x00,
|
||||
0x08, 0xF0, 0x00, 0x00, 0x78, 0x00, 0x00, 0x3C,
|
||||
0x00, 0x00, 0x1E, 0x00, 0x00, 0x0F, 0x00, 0x00,
|
||||
0x07, 0x80, 0x00, 0x03, 0x80, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
memcpy((void*)0x0E00, mouse_sprite, sizeof(mouse_sprite));
|
||||
*(u8_t*)0x07F8 = 0x0E00 / 64;
|
||||
VIC.spr0_color = COLOR_WHITE;
|
||||
}
|
||||
#endif /* WITH_GUI && WITH_MOUSE */
|
||||
|
||||
log_message("Contiki up and running ...", "");
|
||||
|
||||
while(1) {
|
||||
|
||||
if(process_run() < 2) {
|
||||
|
||||
etimer_request_poll();
|
||||
}
|
||||
}
|
||||
}
|
||||
/*-----------------------------------------------------------------------------------*/
|
BIN
platform/c128/contiki.cfg
Normal file
BIN
platform/c128/contiki.cfg
Normal file
Binary file not shown.
37
platform/c128/linker.cfg
Normal file
37
platform/c128/linker.cfg
Normal file
|
@ -0,0 +1,37 @@
|
|||
# This file should be identical to the file '<cc65>/doc/c128.cfg' with the
|
||||
# following exception:
|
||||
# - Reduced stacksize: Contiki is designed to use extremely little stack.
|
||||
# The applications coming with Contiki run even with a $100 byte stack.
|
||||
|
||||
MEMORY {
|
||||
ZP: start = $0002, size = $001A, type = rw, define = yes;
|
||||
RAM: start = $1Bff, size = $A401, file = %O, define = yes;
|
||||
}
|
||||
SEGMENTS {
|
||||
STARTUP: load = RAM, type = ro;
|
||||
LOWCODE: load = RAM, type = ro, optional = yes;
|
||||
INIT: load = RAM, type = ro, define = yes, optional = yes;
|
||||
CODE: load = RAM, type = ro;
|
||||
RODATA: load = RAM, type = ro;
|
||||
DATA: load = RAM, type = rw;
|
||||
BSS: load = RAM, type = bss, define = yes;
|
||||
HEAP: load = RAM, type = bss, optional = yes; # must sit just below stack
|
||||
ZEROPAGE: load = ZP, type = zp;
|
||||
}
|
||||
FEATURES {
|
||||
CONDES: segment = INIT,
|
||||
type = constructor,
|
||||
label = __CONSTRUCTOR_TABLE__,
|
||||
count = __CONSTRUCTOR_COUNT__;
|
||||
CONDES: segment = RODATA,
|
||||
type = destructor,
|
||||
label = __DESTRUCTOR_TABLE__,
|
||||
count = __DESTRUCTOR_COUNT__;
|
||||
CONDES: segment = RODATA,
|
||||
type = interruptor,
|
||||
label = __INTERRUPTOR_TABLE__,
|
||||
count = __INTERRUPTOR_COUNT__;
|
||||
}
|
||||
SYMBOLS {
|
||||
__STACKSIZE__ = $200; # 1/2K instead of 2K stack
|
||||
}
|
Loading…
Reference in a new issue