Support for z80(sdcc) port.

In order to support, some core modules are modified as follows:

core/sys/dsc.h
- If CTK_CONF_ICONS is diabled, the whole icon-related code is disabled.
- DSC_HEADER is changed to remove extra semicolon.

core/sys/process.h
- process_data_t is expressed by void* in signatures (known bug on sdcc).

core/sys/autostart.h
- autostart_processes is changed to remove extra semicolon.

core/sys/cc.h
- CC_CONF_ASSIGN_AGGREGATE is introduced.
- CC_CONF_INC_CAST_POINTER is introduced, a workaround of a kind
  of sdcc bug for an increment.

core/net/hc.c
core/net/uip_arp.c
core/net/uaodv.c
- Aggregation assignments are changed to uip_ipaddr_copy.

core/net/psock.c
core/net/uipbuf.c
core/net/dhcpc.c
apps/shell/shell.c
core/ctk/vnc-server.c
core/ctk/vnc-out.c
- "register" keyword in a signature cannot be used in sdcc,
  CC_REGISTER_ARG is used instead.

core/net/uip-over-mesh.c
- An extra semicolon is removed.

apps/dhcp/dhcp-dsc.c
apps/shell/shell-dsc.
apps/ftp/ftp-dsc.c
apps/process-list/process-list-dsc.c
apps/email/email-dsc.c
apps/webserver/webserver-dsc.c
apps/vnc/vnc-dsc.c
apps/vnc/vnc-viewer.h
apps/webbrowser/www-dsc.c
apps/about/about-dsc.c
apps/irc/irc-dsc.c
apps/telnet/telnet-dsc.c
apps/telnetd/telnetd-dsc.c
apps/netconf/netconf-dsc.c
apps/directory/directory-dsc.c
pps/calc/calc-dsc.c
- Modify an extern type to a real declaration, which is static
  to prevent a compile error.

core/net/mac/xmac.c
- Variables cannot be defined in a head of block on sdcc.

core/ctk/ctk.h
core/ctk/ctk.c
apps/program-handler/program-handler.c
- If CTK_CONF_ICONS is diabled, the whole icon-related code is disabled.

Makefile.include
- Add a set of configuration for an assembler.
- $(CLEAN) variable is introduced for customized cleanup.

apps/process-list/process-list.c
- PROCESSLIST_CONF_HEIGHT is introduced to address smaller screen size.

core/lib/ctk-filedialog.c
- FILES_CONF_HEIGHT is introduced to address smaller screen size.
- "register" keyword in a signature cannot be used in sdcc,
  CC_REGISTER_ARG is used instead.

apps/vnc/vnc-viewer.c
- A cast is added to prevent a compile error.
- "register" keyword in a signature cannot be used in sdcc,
  CC_REGISTER_ARG is used instead.

apps/webbrowser/webclient.c
- CC_CONF_INC_CAST_POINTER is introduced, a workaround of a kind
  of sdcc bug for an increment.

core/loader/elfloader.c
- A cast is added to prevent a compile error.

core/net/rime/rimeaddr.c
- An initialization is added to prevent a compile error.

core/net/rime/rudolph0.c
- NULL is changed to 0, because NULL causes a compile error.

core/net/rime/route-discovery.c
- Add an argument to match the definition of nf_callbacks.

cpu/z80/strcasecmp.h
cpu/z80/strcasecmp.c
cpu/z80/contiki-sdcc-conf.h
cpu/z80/mtarch.c
cpu/z80/mtarch.h
cpu/z80/Makefile.z80
- New files to make compilation availble on sdcc.
- Added support for multithreading.
This commit is contained in:
matsutsuka 2007-08-30 14:39:16 +00:00
parent 974fcb66d4
commit 9d4fc0a1a8
53 changed files with 748 additions and 130 deletions

View file

@ -64,6 +64,8 @@ CONTIKI_OBJECTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(CONTIKI_SOURCEFI
PROJECT_OBJECTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(PROJECT_SOURCEFILES)}}
CONTIKI_ASMOBJECTFILES = ${addprefix $(OBJECTDIR)/,$(CONTIKI_ASMFILES:.S=.o)}
### Include application makefiles
ifdef APPS
@ -105,7 +107,7 @@ clean:
rm -f *~ *core core *.srec \
*.lst *.map \
*.cprg *.bin *.data contiki*.a *.firmware core-labels.S *.ihex *.ini \
*.ce *.co
*.ce *.co $(CLEAN)
-rm -rf $(OBJECTDIR)
ifndef CUSTOM_RULE_C_TO_CE
@ -129,6 +131,11 @@ ifndef CUSTOM_RULE_C_TO_CO
$(CC) $(CFLAGS) -DAUTOSTART_ENABLE -c $< -o $@
endif
ifndef CUSTOM_RULE_S_TO_OBJECTDIR_O
$(OBJECTDIR)/%.o: %.S
$(AS) $(ASFLAGS) -o $@ $<
endif
ifndef AROPTS
AROPTS = rcf
endif

View file

@ -29,13 +29,13 @@
*
* This file is part of the Contiki desktop environment
*
* $Id: about-dsc.c,v 1.1 2006/06/17 22:41:10 adamdunkels Exp $
* $Id: about-dsc.c,v 1.2 2007/08/30 14:39:19 matsutsuka Exp $
*
*/
#include "sys/dsc.h"
extern struct ctk_icon about_icon;
extern static struct ctk_icon about_icon;
/*-----------------------------------------------------------------------------------*/
DSC(about_dsc,
"About Contiki",

View file

@ -29,13 +29,13 @@
*
* This file is part of the Contiki desktop environment
*
* $Id: calc-dsc.c,v 1.1 2006/06/17 22:41:10 adamdunkels Exp $
* $Id: calc-dsc.c,v 1.2 2007/08/30 14:39:18 matsutsuka Exp $
*
*/
#include "sys/dsc.h"
extern struct ctk_icon calc_icon;
extern static struct ctk_icon calc_icon;
/*-----------------------------------------------------------------------------------*/
DSC(calc_dsc,
"Simple calculator",

View file

@ -29,13 +29,13 @@
*
* This file is part of the Contiki desktop environment
*
* $Id: dhcp-dsc.c,v 1.1 2006/06/17 22:41:10 adamdunkels Exp $
* $Id: dhcp-dsc.c,v 1.2 2007/08/30 14:39:19 matsutsuka Exp $
*
*/
#include "sys/dsc.h"
extern struct ctk_icon dhcp_icon;
extern static struct ctk_icon dhcp_icon;
/*-----------------------------------------------------------------------------------*/
DSC(dhcp_dsc,
"Obtain IP address automatically",

View file

@ -29,13 +29,13 @@
*
* This file is part of the Contiki desktop environment
*
* $Id: directory-dsc.c,v 1.1 2006/06/17 22:41:10 adamdunkels Exp $
* $Id: directory-dsc.c,v 1.2 2007/08/30 14:39:17 matsutsuka Exp $
*
*/
#include "sys/dsc.h"
extern struct ctk_icon directory_icon;
extern static struct ctk_icon directory_icon;
/*-----------------------------------------------------------------------------------*/
DSC(directory_dsc,
"Directory reader",

View file

@ -29,13 +29,13 @@
*
* This file is part of the Contiki desktop environment
*
* $Id: email-dsc.c,v 1.1 2006/06/17 22:41:11 adamdunkels Exp $
* $Id: email-dsc.c,v 1.2 2007/08/30 14:39:17 matsutsuka Exp $
*
*/
#include "sys/dsc.h"
extern struct ctk_icon email_icon;
extern static struct ctk_icon email_icon;
/*-----------------------------------------------------------------------------------*/
DSC(email_dsc,
"Unfinished e-mail client",

View file

@ -29,13 +29,13 @@
*
* This file is part of the Contiki desktop environment
*
* $Id: ftp-dsc.c,v 1.1 2006/06/17 22:41:11 adamdunkels Exp $
* $Id: ftp-dsc.c,v 1.2 2007/08/30 14:39:18 matsutsuka Exp $
*
*/
#include "sys/dsc.h"
extern struct ctk_icon ftp_icon;
extern static struct ctk_icon ftp_icon;
/*-----------------------------------------------------------------------------------*/
DSC(ftp_dsc,
"FTP client",

View file

@ -29,13 +29,13 @@
*
* This file is part of the Contiki desktop environment
*
* $Id: irc-dsc.c,v 1.1 2006/06/17 22:41:11 adamdunkels Exp $
* $Id: irc-dsc.c,v 1.2 2007/08/30 14:39:18 matsutsuka Exp $
*
*/
#include "sys/dsc.h"
extern struct ctk_icon irc_icon;
extern static struct ctk_icon irc_icon;
/*-----------------------------------------------------------------------------------*/
DSC(irc_dsc,
"Internet Relay Chat client",

View file

@ -29,13 +29,13 @@
*
* This file is part of the Contiki desktop environment
*
* $Id: netconf-dsc.c,v 1.1 2006/06/17 22:41:11 adamdunkels Exp $
* $Id: netconf-dsc.c,v 1.2 2007/08/30 14:39:18 matsutsuka Exp $
*
*/
#include "sys/dsc.h"
extern struct ctk_icon netconf_icon;
extern static struct ctk_icon netconf_icon;
/*-----------------------------------------------------------------------------------*/
DSC(netconf_dsc,
"Network configuration",

View file

@ -29,13 +29,13 @@
*
* This file is part of the Contiki desktop environment
*
* $Id: process-list-dsc.c,v 1.1 2006/06/17 22:41:12 adamdunkels Exp $
* $Id: process-list-dsc.c,v 1.2 2007/08/30 14:39:17 matsutsuka Exp $
*
*/
#include "sys/dsc.h"
extern struct ctk_icon processes_icon;
extern static struct ctk_icon processes_icon;
/*-----------------------------------------------------------------------------------*/
DSC(processes_dsc,
"Process information",

View file

@ -29,7 +29,7 @@
*
* This file is part of the Contiki desktop environment
*
* $Id: process-list.c,v 1.2 2006/08/27 15:15:46 oliverschmidt Exp $
* $Id: process-list.c,v 1.3 2007/08/30 14:39:17 matsutsuka Exp $
*
*/
@ -38,23 +38,30 @@
#include <string.h>
#ifdef PROCESSLIST_CONF_HEIGHT
#define PROCESSLIST_HEIGHT PROCESSLIST_CONF_HEIGHT
#else /* PROCESSLIST_CONF_HEIGHT */
#define PROCESSLIST_HEIGHT 16
#endif /* PROCESSLIST_CONF_HEIGHT */
#define MAX_PROCESSLABELS 13
static struct ctk_window processwindow;
static struct {struct process *p; char id[2];} processes[MAX_PROCESSLABELS];
static struct ctk_label processidlabels[MAX_PROCESSLABELS];
static struct ctk_label processnamelabels[MAX_PROCESSLABELS];
static struct ctk_label killlabel =
{CTK_LABEL(0, 14, 12, 1, "Kill process")};
{CTK_LABEL(0, PROCESSLIST_CONF_HEIGHT - 2, 12, 1, "Kill process")};
static char killprocnum[3];
static struct ctk_textentry killtextentry =
{CTK_TEXTENTRY(13, 14, 2, 1, killprocnum, 2)};
{CTK_TEXTENTRY(13, PROCESSLIST_CONF_HEIGHT - 2, 2, 1, killprocnum, 2)};
static struct ctk_button killbutton =
{CTK_BUTTON(19, 14, 2, "Ok")};
{CTK_BUTTON(19, PROCESSLIST_CONF_HEIGHT - 2, 2, "Ok")};
static struct ctk_button processupdatebutton =
{CTK_BUTTON(0, 15, 6, "Update")};
{CTK_BUTTON(0, PROCESSLIST_CONF_HEIGHT - 1, 6, "Update")};
static struct ctk_button processclosebutton =
{CTK_BUTTON(19, 15, 5, "Close")};
{CTK_BUTTON(19, PROCESSLIST_CONF_HEIGHT - 1, 5, "Close")};
PROCESS(processes_process, "Process listing");
@ -147,7 +154,7 @@ PROCESS_THREAD(processes_process, ev, data)
PROCESS_BEGIN();
ctk_window_new(&processwindow, 26, 16, "Processes");
ctk_window_new(&processwindow, 26, PROCESSLIST_HEIGHT, "Processes");
update_processwindow();
ctk_window_open(&processwindow);

View file

@ -43,7 +43,7 @@
*
* This file is part of the Contiki desktop OS
*
* $Id: program-handler.c,v 1.4 2007/03/26 23:02:11 oliverschmidt Exp $
* $Id: program-handler.c,v 1.5 2007/08/30 14:39:18 matsutsuka Exp $
*
*/
@ -164,7 +164,9 @@ program_handler_add(struct dsc *dsc, char *menuname,
contikidsc[contikidsclast++] = dsc;
ctk_menuitem_add(&contikimenu, menuname);
if(desktop) {
#if CTK_CONF_ICONS
CTK_ICON_ADD(dsc->icon, &program_handler_process);
#endif /* CTK_CONF_ICONS */
}
}
/*-----------------------------------------------------------------------------------*/
@ -337,8 +339,11 @@ PROCESS_THREAD(program_handler_process, ev, data)
#endif /* QUIT_MENU */
dscp = &contikidsc[0];
for(i = 0; i < CTK_MAXMENUITEMS; ++i) {
if(*dscp != NULL &&
data == (process_data_t)(*dscp)->icon) {
if(*dscp != NULL
#if CTK_CONF_ICONS
&& data == (process_data_t)(*dscp)->icon
#endif /* CTK_CONF_ICONS */
) {
RUN((*dscp)->prgname, (*dscp)->process, NULL);
break;
}

View file

@ -29,13 +29,13 @@
*
* This file is part of the Contiki desktop environment
*
* $Id: shell-dsc.c,v 1.1 2006/06/17 22:41:12 adamdunkels Exp $
* $Id: shell-dsc.c,v 1.2 2007/08/30 14:39:16 matsutsuka Exp $
*
*/
#include "sys/dsc.h"
extern struct ctk_icon shell_icon;
extern static struct ctk_icon shell_icon;
/*-----------------------------------------------------------------------------------*/
DSC(shell_dsc,
"The Contiki command shell",

View file

@ -28,7 +28,7 @@
*
* This file is part of the Contiki desktop OS.
*
* $Id: shell.c,v 1.4 2007/04/14 08:11:24 oliverschmidt Exp $
* $Id: shell.c,v 1.5 2007/08/30 14:39:16 matsutsuka Exp $
*
*/
@ -52,7 +52,7 @@ struct ptentry {
/*-----------------------------------------------------------------------------------*/
static void
parse(register char *str, struct ptentry *t)
parse(CC_REGISTER_ARG char *str, struct ptentry *t)
{
register struct ptentry *p;
char *sstr;
@ -85,7 +85,7 @@ parse(register char *str, struct ptentry *t)
}
/*-----------------------------------------------------------------------------------*/
static void
inttostr(register char *str, unsigned int i)
inttostr(CC_REGISTER_ARG char *str, unsigned int i)
{
str[0] = '0' + i / 100;
if(str[0] == '0') {

View file

@ -29,13 +29,13 @@
*
* This file is part of the Contiki desktop environment
*
* $Id: telnet-dsc.c,v 1.1 2006/06/17 22:41:12 adamdunkels Exp $
* $Id: telnet-dsc.c,v 1.2 2007/08/30 14:39:18 matsutsuka Exp $
*
*/
#include "sys/dsc.h"
extern struct ctk_icon telnet_icon;
extern static struct ctk_icon telnet_icon;
/*-----------------------------------------------------------------------------------*/
DSC(telnet_dsc,
"A simple Telnet client",

View file

@ -29,13 +29,13 @@
*
* This file is part of the Contiki desktop environment
*
* $Id: telnetd-dsc.c,v 1.1 2006/06/17 22:41:13 adamdunkels Exp $
* $Id: telnetd-dsc.c,v 1.2 2007/08/30 14:39:19 matsutsuka Exp $
*
*/
#include "sys/dsc.h"
extern struct ctk_icon telnetd_icon;
extern static struct ctk_icon telnetd_icon;
/*-----------------------------------------------------------------------------------*/
DSC(telnetd_dsc,
"Telnet shell server",

View file

@ -29,13 +29,13 @@
*
* This file is part of the Contiki desktop environment
*
* $Id: vnc-dsc.c,v 1.1 2006/06/17 23:08:35 adamdunkels Exp $
* $Id: vnc-dsc.c,v 1.2 2007/08/30 14:39:17 matsutsuka Exp $
*
*/
#include "sys/dsc.h"
extern struct ctk_icon vnc_icon;
extern static struct ctk_icon vnc_icon;
/*-----------------------------------------------------------------------------------*/
DSC(vnc_dsc,
"Remote control your PC using Contiki",

View file

@ -28,7 +28,7 @@
*
* This file is part of the uIP TCP/IP stack.
*
* $Id: vnc-viewer.c,v 1.1 2006/06/17 23:08:35 adamdunkels Exp $
* $Id: vnc-viewer.c,v 1.2 2007/08/30 14:39:17 matsutsuka Exp $
*
*/
@ -84,7 +84,7 @@ vnc_viewer_connect(u16_t *server, u8_t display)
vnc_draw_init();
memset(vs, 0, sizeof(struct vnc_viewer_state));
conn = uip_connect(server, htons(5900 + display));
conn = uip_connect((uip_ipaddr_t *) server, htons(5900 + display));
if(conn == NULL) {
return;
}
@ -308,7 +308,7 @@ recv_rectstate(u8_t *dataptr, u16_t datalen)
/* Returns: the amount of bytes that needs to be buffered before the
rect can be drawn. */
static unsigned short
recv_update_rect(register struct rfb_fb_update_rect_hdr *rhdr,
recv_update_rect(CC_REGISTER_ARG struct rfb_fb_update_rect_hdr *rhdr,
u16_t dataleft)
{
struct rfb_rre_hdr *rrehdr;
@ -364,7 +364,7 @@ recv_update_rect(register struct rfb_fb_update_rect_hdr *rhdr,
* be expected.
*/
static u16_t
identify_data(register u8_t *data, u16_t datalen)
identify_data(CC_REGISTER_ARG u8_t *data, u16_t datalen)
{
switch(vs->waitmsg) {
case VNC_WAIT_VERSION:
@ -425,7 +425,7 @@ identify_data(register u8_t *data, u16_t datalen)
* Handles the data.
*/
static unsigned short
handle_data(register u8_t *data, u16_t datalen)
handle_data(CC_REGISTER_ARG u8_t *data, u16_t datalen)
{
switch(vs->waitmsg) {

View file

@ -29,7 +29,7 @@
*
* This file is part of the Contiki VNC client.
*
* $Id: vnc-viewer.h,v 1.1 2006/06/17 23:08:35 adamdunkels Exp $
* $Id: vnc-viewer.h,v 1.2 2007/08/30 14:39:17 matsutsuka Exp $
*
*/
@ -163,7 +163,7 @@ struct vnc_viewer_state {
u8_t buffer[VNC_BUFFERSIZE];
};
extern struct vnc_viewer_state vnc_viewer_state;
extern static struct vnc_viewer_state vnc_viewer_state;
/* Definitions of the RFB (Remote Frame Buffer) protocol
structures and constants. */

View file

@ -29,7 +29,7 @@
*
* This file is part of the "contiki" web browser.
*
* $Id: webclient.c,v 1.2 2006/08/14 23:32:29 oliverschmidt Exp $
* $Id: webclient.c,v 1.3 2007/08/30 14:39:18 matsutsuka Exp $
*
*/
@ -219,7 +219,7 @@ parse_statusline(u16_t len)
while(len > 0 && s.httpheaderlineptr < sizeof(s.httpheaderline)) {
s.httpheaderline[s.httpheaderlineptr] = *(char *)uip_appdata;
++((char *)uip_appdata);
CC_INC_CAST_POINTER(char *, uip_appdata);
--len;
if(s.httpheaderline[s.httpheaderlineptr] == ISO_nl) {
@ -287,7 +287,7 @@ parse_headers(u16_t len)
while(len > 0 && s.httpheaderlineptr < sizeof(s.httpheaderline)) {
s.httpheaderline[s.httpheaderlineptr] = *(char *)uip_appdata;
++((char *)uip_appdata);
CC_INC_CAST_POINTER(char *, uip_appdata);
--len;
if(s.httpheaderline[s.httpheaderlineptr] == ISO_nl) {
/* We have an entire HTTP header line in s.httpheaderline, so

View file

@ -29,13 +29,13 @@
*
* This file is part of the Contiki desktop environment
*
* $Id: www-dsc.c,v 1.1 2006/06/17 22:41:14 adamdunkels Exp $
* $Id: www-dsc.c,v 1.2 2007/08/30 14:39:18 matsutsuka Exp $
*
*/
#include "sys/dsc.h"
extern struct ctk_icon www_icon;
extern static struct ctk_icon www_icon;
/*-----------------------------------------------------------------------------------*/
DSC(www_dsc,
"The Contiki web browser",

View file

@ -28,7 +28,7 @@
*
* This file is part of the uIP TCP/IP stack.
*
* $Id: httpd-cgi.c,v 1.6 2007/05/23 21:35:18 oliverschmidt Exp $
* $Id: httpd-cgi.c,v 1.7 2007/08/30 14:39:18 matsutsuka Exp $
*
*/
@ -150,7 +150,7 @@ PT_THREAD(file_stats(struct httpd_state *s, char *ptr))
{
PSOCK_BEGIN(&s->sout);
PSOCK_GENERATOR_SEND(&s->sout, generate_file_stats, strchr(ptr, ' ') + 1);
PSOCK_GENERATOR_SEND(&s->sout, generate_file_stats, (void *) (strchr(ptr, ' ') + 1));
PSOCK_END(&s->sout);
}
@ -203,7 +203,7 @@ make_processes(void *p)
return sprintf((char *)uip_appdata,
"<tr align=\"center\"><td>%p</td><td>%s</td><td>%p</td><td>%s</td></tr>\r\n",
p, name,
((struct process *)p)->thread,
(char *)((struct process *)p)->thread,
states[9 + ((struct process *)p)->state]);
}
/*---------------------------------------------------------------------------*/

View file

@ -29,13 +29,13 @@
*
* This file is part of the Contiki desktop environment
*
* $Id: webserver-dsc.c,v 1.1 2006/06/17 22:41:14 adamdunkels Exp $
* $Id: webserver-dsc.c,v 1.2 2007/08/30 14:39:18 matsutsuka Exp $
*
*/
#include "sys/dsc.h"
extern struct ctk_icon webserver_icon;
extern static struct ctk_icon webserver_icon;
/*-----------------------------------------------------------------------------------*/
DSC(webserver_dsc,
"The Contiki web server",

View file

@ -44,7 +44,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: ctk.c,v 1.6 2007/04/15 13:09:23 oliverschmidt Exp $
* $Id: ctk.c,v 1.7 2007/08/30 14:39:17 matsutsuka Exp $
*
*/
@ -168,9 +168,11 @@ process_event_t ctk_signal_screensaver_stop,
unsigned short mouse_x, mouse_y, mouse_button;
#endif /* CTK_CONF_MOUSE_SUPPORT */
#if CTK_CONF_SCREENSAVER
static unsigned short screensaver_timer = 0;
unsigned short ctk_screensaver_timeout = (5*60);
static struct timer timer;
#endif /* CTK_CONF_SCREENSAVER */
static void CC_FASTCALL
textentry_input(ctk_arch_key_t c,
@ -202,6 +204,7 @@ make_desktopmenu(void)
}
#endif /* CTK_CONF_MENUS */
/*---------------------------------------------------------------------------*/
#if CTK_CONF_ICONS
static void
arrange_icons(void)
{
@ -223,6 +226,7 @@ arrange_icons(void)
}
}
}
#endif /* CTK_CONF_ICONS */
/*---------------------------------------------------------------------------*/
void
ctk_restore(void)
@ -232,7 +236,9 @@ ctk_restore(void)
height = ctk_draw_height();
width = ctk_draw_width();
#if CTK_CONF_ICONS
arrange_icons();
#endif /* CTK_CONF_ICONS */
redraw = REDRAW_ALL;
}
@ -1296,23 +1302,23 @@ menus_input(ctk_arch_key_t c)
}
#endif /* CTK_CONF_MENUS */
/*---------------------------------------------------------------------------*/
#if CTK_CONF_SCREENSAVER
static void
handle_timer(void)
{
if(mode == CTK_MODE_NORMAL) {
++screensaver_timer;
if(screensaver_timer >= ctk_screensaver_timeout) {
#if CTK_CONF_SCREENSAVER
process_post(PROCESS_BROADCAST, ctk_signal_screensaver_start, NULL);
#ifdef CTK_SCREENSAVER_INIT
CTK_SCREENSAVER_INIT();
#endif /* CTK_SCREENSAVER_INIT */
#endif /* CTK_CONF_SCREENSAVER */
screensaver_timer = 0;
}
}
}
#endif /* CTK_CONF_SCREENSAVER */
/*---------------------------------------------------------------------------*/
static void
unfocus_widget(CC_REGISTER_ARG struct ctk_widget *w)
@ -1393,16 +1399,20 @@ PROCESS_THREAD(ctk_process, ev, data)
iconx = ICONX_START;
icony = ICONY_START;
#if CTK_CONF_SCREENSAVER
timer_set(&timer, CLOCK_SECOND);
#endif /* CTK_CONF_SCREENSAVER */
while(1) {
process_poll(&ctk_process);
PROCESS_WAIT_EVENT();
#if CTK_CONF_SCREENSAVER
if(timer_expired(&timer)) {
timer_reset(&timer);
handle_timer();
}
#endif /* CTK_CONF_SCREENSAVER */
#if CTK_CONF_MENUS
if(menus.open != NULL) {
@ -1456,7 +1466,9 @@ PROCESS_THREAD(ctk_process, ev, data)
the correct signals, or bring a window to focus. */
if(mouse_moved || mouse_button_changed) {
ctk_mouse_show();
#if CTK_CONF_SCREENSAVER
screensaver_timer = 0;
#endif /* CTK_CONF_SCREENSAVER */
if(myc == 0) {
/* Here we should do whatever needs to be done when the mouse
@ -1656,7 +1668,9 @@ PROCESS_THREAD(ctk_process, ev, data)
ctk_mouse_hide();
#if CTK_CONF_SCREENSAVER
screensaver_timer = 0;
#endif /* CTK_CONF_SCREENSAVER */
c = ctk_arch_getkey();
@ -1788,7 +1802,9 @@ PROCESS_THREAD(ctk_process, ev, data)
while(mode == CTK_MODE_WINDOWMOVE && ctk_arch_keyavail()) {
#if CTK_CONF_SCREENSAVER
screensaver_timer = 0;
#endif /* CTK_CONF_SCREENSAVER */
c = ctk_arch_getkey();

View file

@ -43,7 +43,7 @@
*
* This file is part of the Contiki desktop OS.
*
* $Id: ctk.h,v 1.2 2006/08/26 23:55:32 oliverschmidt Exp $
* $Id: ctk.h,v 1.3 2007/08/30 14:39:17 matsutsuka Exp $
*
*/
@ -310,6 +310,7 @@ struct ctk_textentry {
* \param bitmap A pointer to the icon's bitmap image.
* \param textmap A pointer to the icon's text version of the bitmap.
*/
#if CTK_CONF_ICONS
#define CTK_ICON(title, bitmap, textmap) \
NULL, NULL, 0, 0, CTK_WIDGET_ICON, 2, 4, CTK_WIDGET_FLAG_INITIALIZER(0) \
title, PROCESS_NONE, \
@ -362,7 +363,7 @@ struct ctk_textmap {
char *textmap;
unsigned char state;
};
#endif /* CTK_CONF_ICONS */
/**
* \internal The CTK button widget structure.

View file

@ -28,7 +28,7 @@
*
* This file is part of the uIP TCP/IP stack.
*
* $Id: vnc-out.c,v 1.1 2006/06/17 22:41:16 adamdunkels Exp $
* $Id: vnc-out.c,v 1.2 2007/08/30 14:39:18 matsutsuka Exp $
*
*/
@ -376,7 +376,7 @@ vnc_out_update_area(struct vnc_server_state *vs,
}
/*-----------------------------------------------------------------------------------*/
static void
init_send_screen(register struct vnc_server_state *vs)
init_send_screen(CC_REGISTER_ARG struct vnc_server_state *vs)
{
vs->sendmsg = SEND_SCREEN;
vs->x = vs->y = 0;
@ -387,7 +387,7 @@ init_send_screen(register struct vnc_server_state *vs)
}
/*-----------------------------------------------------------------------------------*/
static void
check_updates(register struct vnc_server_state *vs)
check_updates(CC_REGISTER_ARG struct vnc_server_state *vs)
{
if(vs->state == VNC_RUNNING &&
@ -521,7 +521,7 @@ makechar(CC_REGISTER_ARG char *ptr, u8_t x, u8_t y)
}
/*-----------------------------------------------------------------------------------*/
void
vnc_out_new(register struct vnc_server_state *vs)
vnc_out_new(CC_REGISTER_ARG struct vnc_server_state *vs)
{
u8_t i;
@ -542,7 +542,7 @@ vnc_out_new(register struct vnc_server_state *vs)
}
/*-----------------------------------------------------------------------------------*/
void
vnc_out_send_blank(register struct vnc_server_state *vs)
vnc_out_send_blank(CC_REGISTER_ARG struct vnc_server_state *vs)
{
register struct rfb_fb_update *umsg;
u8_t *ptr;
@ -588,7 +588,7 @@ vnc_out_send_screen(struct vnc_server_state *vs)
/*-----------------------------------------------------------------------------------*/
static short tmpbuf[30];
void
vnc_out_send_update(register struct vnc_server_state *vs)
vnc_out_send_update(CC_REGISTER_ARG struct vnc_server_state *vs)
{
u8_t x, y, x0;
u8_t msglen;
@ -857,7 +857,7 @@ vnc_out_pointer_event(struct vnc_server_state *vs)
}
/*-----------------------------------------------------------------------------------*/
void
vnc_out_acked(register struct vnc_server_state *vs)
vnc_out_acked(CC_REGISTER_ARG struct vnc_server_state *vs)
{
if(vs->state != VNC_RUNNING) {
return;

View file

@ -28,7 +28,7 @@
*
* This file is part of the uIP TCP/IP stack.
*
* $Id: vnc-server.c,v 1.1 2006/06/17 22:41:16 adamdunkels Exp $
* $Id: vnc-server.c,v 1.2 2007/08/30 14:39:17 matsutsuka Exp $
*
*/
@ -245,7 +245,7 @@ vnc_pointer_event(struct vnc_server_state *vs)
}
/*-----------------------------------------------------------------------------------*/
static u8_t
vnc_read_data(register struct vnc_server_state *vs)
vnc_read_data(CC_REGISTER_ARG struct vnc_server_state *vs)
{
u8_t *appdata;
u16_t len;
@ -392,7 +392,7 @@ vnc_read_data(register struct vnc_server_state *vs)
}
/*-----------------------------------------------------------------------------------*/
static void
vnc_new(register struct vnc_server_state *vs)
vnc_new(CC_REGISTER_ARG struct vnc_server_state *vs)
{
vs->counter = 0;
vs->readlen = 0;
@ -409,7 +409,7 @@ vnc_new(register struct vnc_server_state *vs)
}
/*-----------------------------------------------------------------------------------*/
static void
vnc_acked(register struct vnc_server_state *vs)
vnc_acked(CC_REGISTER_ARG struct vnc_server_state *vs)
{
switch(vs->state) {
case VNC_VERSION:

View file

@ -30,7 +30,7 @@
*
* Author: Adam Dunkels <adam@sics.se>
*
* $Id: ctk-filedialog.c,v 1.1 2006/06/17 22:41:17 adamdunkels Exp $
* $Id: ctk-filedialog.c,v 1.2 2007/08/30 14:39:18 matsutsuka Exp $
*/
#include "contiki.h"
@ -42,7 +42,11 @@
#define MAX_NUMFILES 40
#define FILES_WIDTH 17
#if FILES_CONF_HEIGHT
#define FILES_HEIGHT FILES_CONF_HEIGHT
#else
#define FILES_HEIGHT 14
#endif
static struct ctk_window dialog;
static char leftptr[FILES_HEIGHT];
@ -94,13 +98,13 @@ showptr(void)
}
/*---------------------------------------------------------------------------*/
void
ctk_filedialog_init(register struct ctk_filedialog_state *s)
ctk_filedialog_init(CC_REGISTER_ARG struct ctk_filedialog_state *s)
{
state = STATE_CLOSED;
}
/*---------------------------------------------------------------------------*/
void
ctk_filedialog_open(register struct ctk_filedialog_state *s,
ctk_filedialog_open(CC_REGISTER_ARG struct ctk_filedialog_state *s,
const char *buttontext, process_event_t event)
{
ctk_dialog_new(&dialog, 20, 5 + FILES_HEIGHT);

View file

@ -30,7 +30,7 @@
*
* Author: Adam Dunkels <adam@sics.se>
*
* $Id: ctk-filedialog.h,v 1.1 2006/06/17 22:41:17 adamdunkels Exp $
* $Id: ctk-filedialog.h,v 1.2 2007/08/30 14:39:18 matsutsuka Exp $
*/
#ifndef __CTK_FILEDIALOG_H__
#define __CTK_FILEDIALOG_H__
@ -42,8 +42,8 @@ struct ctk_filedialog_state {
process_event_t ev;
};
void ctk_filedialog_init(register struct ctk_filedialog_state *s);
void ctk_filedialog_open(register struct ctk_filedialog_state *s,
void ctk_filedialog_init(CC_REGISTER_ARG struct ctk_filedialog_state *s);
void ctk_filedialog_open(CC_REGISTER_ARG struct ctk_filedialog_state *s,
const char *buttontext, process_event_t event);
char ctk_filedialog_eventhandler(struct ctk_filedialog_state *s,
process_event_t ev, process_data_t data);

View file

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* @(#)$Id: elfloader.c,v 1.5 2007/03/22 23:56:44 adamdunkels Exp $
* @(#)$Id: elfloader.c,v 1.6 2007/08/30 14:39:18 matsutsuka Exp $
*/
#include "contiki.h"
@ -556,14 +556,14 @@ elfloader_load(int fd)
seek_read(fd, dataoff, data.address, datasize);
PRINTF("elfloader: autostart search\n");
process = find_local_symbol(fd, "autostart_processes", symtaboff, symtabsize, strtaboff);
process = (struct process **) find_local_symbol(fd, "autostart_processes", symtaboff, symtabsize, strtaboff);
if(process != NULL) {
PRINTF("elfloader: autostart found\n");
elfloader_autostart_processes = process;
return ELFLOADER_OK;
} else {
PRINTF("elfloader: no autostart\n");
process = find_program_processes(fd, symtaboff, symtabsize, strtaboff);
process = (struct process **) find_program_processes(fd, symtaboff, symtabsize, strtaboff);
if(process != NULL) {
PRINTF("elfloader: FOUND PRG\n");
}

View file

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* @(#)$Id: dhcpc.c,v 1.7 2007/03/16 12:16:16 bg- Exp $
* @(#)$Id: dhcpc.c,v 1.8 2007/08/30 14:39:17 matsutsuka Exp $
*/
#include <stdio.h>
@ -139,7 +139,7 @@ add_end(u8_t *optptr)
}
/*---------------------------------------------------------------------------*/
static void
create_msg(register struct dhcp_msg *m)
create_msg(CC_REGISTER_ARG struct dhcp_msg *m)
{
m->op = DHCP_REQUEST;
m->htype = DHCP_HTYPE_ETHERNET;

View file

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* @(#)$Id: hc.c,v 1.3 2006/10/09 11:53:43 adamdunkels Exp $
* @(#)$Id: hc.c,v 1.4 2007/08/30 14:39:17 matsutsuka Exp $
*/
/**
@ -179,7 +179,7 @@ hc_inflate(u8_t *buf, int len)
uhdr = (struct udpip_hdr *)buf;
hdr = (struct hc_hdr *)&buf[UIP_IPUDPH_LEN - HC_HLEN];
uhdr->srcipaddr = hdr->srcipaddr;
uip_ipaddr_copy(&uhdr->srcipaddr, &hdr->srcipaddr);
uhdr->srcport = hdr->flagsport & HTONS(0x3fff);
uhdr->destport = hdr->flagsport & HTONS(0x3fff);
@ -196,7 +196,7 @@ hc_inflate(u8_t *buf, int len)
uhdr->ipoffset[0] = uhdr->ipoffset[1] = 0;
uhdr->ttl = 2;
uhdr->proto = UIP_PROTO_UDP;
uhdr->destipaddr = uip_broadcast_addr;
uip_ipaddr_copy(&uhdr->destipaddr, &uip_broadcast_addr);
uhdr->udpchksum = 0;
uhdr->ipchksum = 0;

View file

@ -30,7 +30,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: xmac.c,v 1.6 2007/05/25 08:07:15 adamdunkels Exp $
* $Id: xmac.c,v 1.7 2007/08/30 14:39:18 matsutsuka Exp $
*/
/**
@ -219,6 +219,9 @@ send(void)
int strobes;
struct xmac_hdr *hdr;
int got_ack = 0;
struct xmac_hdr msg;
rtimer_clock_t t;
int len;
we_are_sending = 1;
@ -248,9 +251,6 @@ send(void)
strobes = 0;
do {
struct xmac_hdr msg;
rtimer_clock_t t;
int len;
t = RTIMER_NOW();

View file

@ -30,7 +30,7 @@
*
* Author: Adam Dunkels <adam@sics.se>
*
* $Id: psock.c,v 1.1 2006/06/17 22:41:18 adamdunkels Exp $
* $Id: psock.c,v 1.2 2007/08/30 14:39:17 matsutsuka Exp $
*/
#include <stdio.h>
@ -106,8 +106,8 @@ buf_bufdata(struct psock_buf *buf, u16_t len,
}
/*---------------------------------------------------------------------------*/
static u8_t
buf_bufto(register struct psock_buf *buf, u8_t endmarker,
register u8_t **dataptr, register u16_t *datalen)
buf_bufto(CC_REGISTER_ARG struct psock_buf *buf, u8_t endmarker,
CC_REGISTER_ARG u8_t **dataptr, CC_REGISTER_ARG u16_t *datalen)
{
u8_t c;
while(buf->left > 0 && *datalen > 0) {
@ -140,7 +140,7 @@ buf_bufto(register struct psock_buf *buf, u8_t endmarker,
}
/*---------------------------------------------------------------------------*/
static char
send_data(register struct psock *s)
send_data(CC_REGISTER_ARG struct psock *s)
{
if(s->state != STATE_DATA_SENT || uip_rexmit()) {
if(s->sendlen > uip_mss()) {
@ -155,7 +155,7 @@ send_data(register struct psock *s)
}
/*---------------------------------------------------------------------------*/
static char
data_acked(register struct psock *s)
data_acked(CC_REGISTER_ARG struct psock *s)
{
if(s->state == STATE_DATA_SENT && uip_acked()) {
if(s->sendlen > uip_mss()) {
@ -171,7 +171,7 @@ data_acked(register struct psock *s)
return 0;
}
/*---------------------------------------------------------------------------*/
PT_THREAD(psock_send(register struct psock *s, const char *buf,
PT_THREAD(psock_send(CC_REGISTER_ARG struct psock *s, const char *buf,
unsigned int len))
{
PT_BEGIN(&s->psockpt);
@ -210,7 +210,7 @@ PT_THREAD(psock_send(register struct psock *s, const char *buf,
PT_END(&s->psockpt);
}
/*---------------------------------------------------------------------------*/
PT_THREAD(psock_generator_send(register struct psock *s,
PT_THREAD(psock_generator_send(CC_REGISTER_ARG struct psock *s,
unsigned short (*generate)(void *), void *arg))
{
PT_BEGIN(&s->psockpt);
@ -267,7 +267,7 @@ psock_newdata(struct psock *s)
}
}
/*---------------------------------------------------------------------------*/
PT_THREAD(psock_readto(register struct psock *psock, unsigned char c))
PT_THREAD(psock_readto(CC_REGISTER_ARG struct psock *psock, unsigned char c))
{
PT_BEGIN(&psock->psockpt);
@ -294,7 +294,7 @@ PT_THREAD(psock_readto(register struct psock *psock, unsigned char c))
PT_END(&psock->psockpt);
}
/*---------------------------------------------------------------------------*/
PT_THREAD(psock_readbuf(register struct psock *psock))
PT_THREAD(psock_readbuf(CC_REGISTER_ARG struct psock *psock))
{
PT_BEGIN(&psock->psockpt);
@ -323,7 +323,7 @@ PT_THREAD(psock_readbuf(register struct psock *psock))
}
/*---------------------------------------------------------------------------*/
void
psock_init(register struct psock *psock, char *buffer, unsigned int buffersize)
psock_init(CC_REGISTER_ARG struct psock *psock, char *buffer, unsigned int buffersize)
{
psock->state = STATE_NONE;
psock->readlen = 0;

View file

@ -33,7 +33,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: rimeaddr.c,v 1.5 2007/03/31 18:31:28 adamdunkels Exp $
* $Id: rimeaddr.c,v 1.6 2007/08/30 14:39:17 matsutsuka Exp $
*/
/**
@ -46,7 +46,7 @@
#include "net/rime/rimeaddr.h"
rimeaddr_t rimeaddr_node_addr;
const rimeaddr_t rimeaddr_null;
const rimeaddr_t rimeaddr_null = { { 0, 0 } };
/*---------------------------------------------------------------------------*/
void

View file

@ -33,7 +33,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: route-discovery.c,v 1.6 2007/05/15 08:09:21 adamdunkels Exp $
* $Id: route-discovery.c,v 1.7 2007/08/30 14:39:17 matsutsuka Exp $
*/
/**
@ -210,7 +210,7 @@ rreq_packet_received(struct nf_conn *nf, rimeaddr_t *from,
}
/*---------------------------------------------------------------------------*/
static const struct uc_callbacks rrep_callbacks = {rrep_packet_received};
static const struct nf_callbacks rreq_callbacks = {rreq_packet_received, NULL};
static const struct nf_callbacks rreq_callbacks = {rreq_packet_received, NULL, NULL};
/*---------------------------------------------------------------------------*/
void
route_discovery_open(struct route_discovery_conn *c,

View file

@ -33,7 +33,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: rudolph0.c,v 1.5 2007/05/15 08:09:21 adamdunkels Exp $
* $Id: rudolph0.c,v 1.6 2007/08/30 14:39:17 matsutsuka Exp $
*/
/**
@ -179,7 +179,7 @@ recv_nack(struct polite_conn *polite)
}
}
/*---------------------------------------------------------------------------*/
static const struct polite_callbacks polite = { recv_nack, NULL, NULL };
static const struct polite_callbacks polite = { recv_nack, 0, 0 };
static const struct sabc_callbacks sabc = { recv, sent };
/*---------------------------------------------------------------------------*/
void

View file

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: uaodv.c,v 1.30 2007/06/28 15:16:41 bg- Exp $
* $Id: uaodv.c,v 1.31 2007/08/30 14:39:17 matsutsuka Exp $
*/
/**
@ -108,7 +108,7 @@ fwc_add(const uip_ipaddr_t *orig, const u32_t *id)
{
unsigned n = (orig->u8[2] + orig->u8[3]) % NFWCACHE;
fwcache[n].id = *id;
fwcache[n].orig = *orig;
uip_ipaddr_copy(&fwcache[n].orig, orig);
}
#ifdef NDEBUG

View file

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: uip-over-mesh.c,v 1.4 2007/03/29 22:21:56 adamdunkels Exp $
* $Id: uip-over-mesh.c,v 1.5 2007/08/30 14:39:17 matsutsuka Exp $
*/
/**
@ -49,7 +49,7 @@
static struct queuebuf *queued_packet;
static rimeaddr_t queued_receiver;
static struct route_discovery_conn route_discovery;;
static struct route_discovery_conn route_discovery;
static struct uc_conn dataconn;
#define DEBUG 0

View file

@ -54,7 +54,7 @@
*
* This file is part of the uIP TCP/IP stack.
*
* $Id: uip_arp.c,v 1.3 2007/03/21 23:19:52 adamdunkels Exp $
* $Id: uip_arp.c,v 1.4 2007/08/30 14:39:17 matsutsuka Exp $
*
*/
@ -217,7 +217,7 @@ uip_arp_update(uip_ipaddr_t *ipaddr, struct uip_eth_addr *ethaddr)
/* Now, i is the ARP table entry which we will fill with the new
information. */
tabptr->ipaddr = *ipaddr;
uip_ipaddr_copy(&tabptr->ipaddr, ipaddr);
memcpy(tabptr->ethaddr.addr, ethaddr->addr, 6);
tabptr->time = arptime;
}
@ -314,8 +314,8 @@ uip_arp_arpin(void)
memcpy(BUF->ethhdr.src.addr, uip_ethaddr.addr, 6);
memcpy(BUF->ethhdr.dest.addr, BUF->dhwaddr.addr, 6);
BUF->dipaddr = BUF->sipaddr;
BUF->sipaddr = uip_hostaddr;
uip_ipaddr_copy(&BUF->dipaddr, &BUF->sipaddr);
uip_ipaddr_copy(&BUF->sipaddr, &uip_hostaddr);
BUF->ethhdr.type = HTONS(UIP_ETHTYPE_ARP);
uip_len = sizeof(struct arp_hdr);

View file

@ -30,7 +30,7 @@
*
* Author: Adam Dunkels <adam@sics.se>
*
* $Id: uipbuf.c,v 1.1 2006/06/17 22:41:19 adamdunkels Exp $
* $Id: uipbuf.c,v 1.2 2007/08/30 14:39:17 matsutsuka Exp $
*/
#if 0 /* This whole file is #ifdef'd out - the contents are to be removed */
@ -78,8 +78,8 @@ uipbuf_bufdata(struct uipbuf_buffer *buf, u16_t len,
}
/*---------------------------------------------------------------------------*/
u8_t
uipbuf_bufto(register struct uipbuf_buffer *buf, u8_t endmarker,
register u8_t **dataptr, register u16_t *datalen)
uipbuf_bufto(CC_REGISTER_ARG struct uipbuf_buffer *buf, u8_t endmarker,
CC_REGISTER_ARG u8_t **dataptr, CC_REGISTER_ARG u16_t *datalen)
{
u8_t c;
/*

View file

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* $Id: autostart.h,v 1.1 2006/06/17 22:41:20 adamdunkels Exp $
* $Id: autostart.h,v 1.2 2007/08/30 14:39:17 matsutsuka Exp $
*/
/**
@ -46,9 +46,10 @@
#if ! CC_NO_VA_ARGS
#if AUTOSTART_ENABLE
#define AUTOSTART_PROCESSES(...) \
const struct process *autostart_processes[] = {__VA_ARGS__, NULL};
const struct process *autostart_processes[] = {__VA_ARGS__, NULL}
#else /* AUTOSTART_ENABLE */
#define AUTOSTART_PROCESSES(...)
#define AUTOSTART_PROCESSES(...) \
extern int _dummy
#endif /* AUTOSTART_ENABLE */
#else
#error "C compiler must support __VA_ARGS__ macro"

View file

@ -39,7 +39,7 @@
*
* This file is part of the Contiki desktop OS
*
* $Id: cc.h,v 1.1 2006/06/17 22:41:20 adamdunkels Exp $
* $Id: cc.h,v 1.2 2007/08/30 14:39:17 matsutsuka Exp $
*
*/
#ifndef __CC_H__
@ -101,6 +101,26 @@
#define CC_INLINE
#endif /* CC_CONF_INLINE */
/**
* Configure if the C compiler supports the assignment of struct value.
*/
#ifdef CC_CONF_ASSIGN_AGGREGATE
#define CC_ASSIGN_AGGREGATE(dest, src) CC_ASSIGN_AGGREGATE(dest, src)
#else /* CC_CONF_ASSIGN_AGGREGATE */
#define CC_ASSIGN_AGGREGATE(dest, src) *dest = *src
#endif /* CC_CONF_ASSIGN_AGGREGATE */
/**
* Configure if the C compiler supports the increment of pointer.
*/
#ifdef CC_CONF_INC_CAST_POINTER
#define CC_INC_CAST_POINTER(type, data) \
CC_CONF_INC_CAST_POINTER(type, data)
#else /* CC_CONF_INC_CAST_POINTER */
#define CC_INC_CAST_POINTER(type, data) \
++((type) data)
#endif /* CC_CONF_INC_CAST_POINTER */
#if CC_CONF_NO_VA_ARGS
#define CC_NO_VA_ARGS CC_CONF_VA_ARGS
#endif

View file

@ -56,7 +56,7 @@
*
* This file is part of the Contiki desktop environment
*
* $Id: dsc.h,v 1.2 2006/08/26 23:59:39 oliverschmidt Exp $
* $Id: dsc.h,v 1.3 2007/08/30 14:39:17 matsutsuka Exp $
*
*/
#ifndef __DSC_H__
@ -82,8 +82,10 @@ struct dsc {
struct process *process; /**< A pointer to the program's process. */
#endif /* WITH_LOADER_ARCH */
#if CTK_CONF_ICONS
struct ctk_icon *icon; /**< A pointer to the ctk_icon structure for
the DSC. */
#endif /* CTK_CONF_ICONS */
#if WITH_LOADER_ARCH
void *loadaddr; /**< The loading address of the DSC. Used by
@ -109,15 +111,26 @@ struct dsc {
* \param icon A pointer to the CTK icon.
*/
#if WITH_LOADER_ARCH
#if CTK_CONF_ICONS
#define DSC(dscname, description, prgname, process, icon) \
CLIF const struct dsc dscname = {description, prgname, icon}
#else /* CTK_CONF_ICONS */
#define DSC(dscname, description, prgname, process, icon) \
CLIF const struct dsc dscname = {description, prgname}
#endif /* CTK_CONF_ICONS */
#else /* WITH_LOADER_ARCH */
#if CTK_CONF_ICONS
#define DSC(dscname, description, prgname, process, icon) \
PROCESS_NAME(process); \
const struct dsc dscname = {description, &process, icon}
#else /* CTK_CONF_ICONS */
#define DSC(dscname, description, prgname, process, icon) \
PROCESS_NAME(process); \
const struct dsc dscname = {description, &process}
#endif /* CTK_CONF_ICONS */
#endif /* WITH_LOADER_ARCH */
#define DSC_HEADER(name) extern struct dsc name;
#define DSC_HEADER(name) extern struct dsc name
#ifndef NULL
#define NULL 0

View file

@ -28,7 +28,7 @@
*
* This file is part of the Contiki operating system.
*
* @(#)$Id: process.h,v 1.9 2007/08/22 10:49:48 ksb Exp $
* @(#)$Id: process.h,v 1.10 2007/08/30 14:39:17 matsutsuka Exp $
*/
/**
@ -360,7 +360,7 @@ void process_start(struct process *p, char *arg);
* \retval PROCESS_ERR_FULL The event queue was full and the event could
* not be posted.
*/
CCIF int process_post(struct process *p, process_event_t ev, process_data_t data);
CCIF int process_post(struct process *p, process_event_t ev, void* data);
/**
* Post a synchronous event to a process.
@ -373,7 +373,7 @@ CCIF int process_post(struct process *p, process_event_t ev, process_data_t data
* with the event.
*/
void process_post_synch(struct process *p,
process_event_t ev, process_data_t data);
process_event_t ev, void* data);
/**
* \brief Cause a process to exit

View file

@ -30,7 +30,7 @@
#
# Author: Oliver Schmidt <ol.sc@web.de>
#
# $Id: Makefile.6502,v 1.10 2007/05/29 21:56:21 oliverschmidt Exp $
# $Id: Makefile.6502,v 1.11 2007/08/30 14:39:18 matsutsuka Exp $
#
ifndef CONTIKI
@ -94,5 +94,6 @@ CUSTOM_RULE_C_TO_CO = 1
@$(AS) $(AFLAGS) $(@:.co=.s) -o $@
@rm -f $(@:.co=.s)
$(OBJECTDIR)/%.o: %.S
$(AS) $(AFLAGS) $< -o $@
#moved to Makefile.include
#$(OBJECTDIR)/%.o: %.S
# $(AS) $(AFLAGS) $< -o $@

35
cpu/z80/Makefile.z80 Normal file
View file

@ -0,0 +1,35 @@
#
# Makefile for z80/SDCC
# @author Takahide Matsutsuka <markn@markn.org>
#
# $Id: Makefile.z80,v 1.1 2007/08/30 14:39:16 matsutsuka Exp $
#
### Compiler definitions
CC = sdcc
LD = sdcc
#LD = link-z80
AS = as-z80
AR = sdcclib
OBJCOPY = objcopy
STRIP = strip
CFLAGS += -I. -I$(CONTIKI) -I$(CONTIKI)/core -I$(CONTIKI_CPU) \
${addprefix -I$(CONTIKI)/platform/$(TARGET)/,$(CONTIKI_TARGET_DIRS)} \
${addprefix -I,$(APPDIRS)} $(APP_INCLUDES) \
--std-c99 --vc -mz80
ASFLAGS +=
LDFLAGS += -mz80
AROPTS = -a
CONTIKI_SOURCEFILES += strcasecmp.c mtarch.c
CONTIKI_ASMFILES += uip_arch-asm.S
contiki-$(TARGET).o: $(CONTIKI_OBJECTFILES) $(PROJECT_OBJECTFILES) $(CONTIKI_ASMOBJECTFILES)
for target in $^; do $(AR) $(AROPTS) $@ $$target; done
contiki.ihex: contiki-$(TARGET).o
$(LD) $(LDFLAGS) -DAUTOSTART_ENABLE $(CONTIKI_TARGET_MAIN) -lcontiki-$(TARGET).o -o $@
#CONTIKI_TARGET_DIRS += $(CONTIKI_CPU)/net

View file

@ -0,0 +1,78 @@
/*
* 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-sdcc-conf.h,v 1.1 2007/08/30 14:39:16 matsutsuka Exp $
*
*/
/*
* \file
* This file contains a set of configuration for using SDCC as a compiler.
*
* \author
* Takahide Matsutsuka <markn@markn.org>
*/
#ifndef __CONTIKI_SDCC_CONF_H__
#define __CONTIKI_SDCC_CONF_H__
#define CC_CONF_FUNCTION_POINTER_ARGS 1
#define CC_CONF_FASTCALL
#define CC_CONF_VA_ARGS 1
#define CC_CONF_UNSIGNED_CHAR_BUGS 1
#define CC_CONF_REGISTER_ARGS 0
/* Generic types. */
typedef unsigned char u8_t; /* 8 bit type */
typedef unsigned short u16_t; /* 16 bit type */
typedef unsigned long u32_t; /* 32 bit type */
typedef signed long s32_t; /* 32 bit type */
typedef unsigned short uip_stats_t;
#ifndef _SIZE_T_DEFINED
#define _SIZE_T_DEFINED
typedef unsigned int size_t;
#endif
/* Compiler configurations */
#define CCIF
#define CLIF
/* uIP configurations */
/* uip_add32 */
#define UIP_ARCH_ADD32 1
#define uip_ipaddr_copy(dest, src) \
memcpy(dest, src, sizeof(*dest))
#define CC_CONF_ASSIGN_AGGREGATE(dest, src) \
memcpy(dest, src, sizeof(*dest))
#define CC_CONF_INC_CAST_POINTER(type, data) \
data = ((type) data) + 1
#endif /* __CONTIKI_SDCC_CONF_H__ */

192
cpu/z80/mtarch.c Normal file
View file

@ -0,0 +1,192 @@
/*
* 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.
*
*/
/*
* \file
* Z80 machine-specific implementation for supporting multithread.
* \author
* Takahide Matsutsuka <markn@markn.org>
*/
#include "sys/mt.h"
#include "mtarch.h"
/*--------------------------------------------------------------------------*/
void
mtarch_init(void)
{
}
/*--------------------------------------------------------------------------*/
void
mtarch_start(struct mtarch_thread *t,
void (*function)(void *), void *data)
{
u16_t i;
for(i = 0; i < MTARCH_STACKSIZE; i++) {
t->stack[i] = i;
}
t->sp = &t->stack[MTARCH_STACKSIZE - 1];
/* A parameter for method for thread function. */
*t->sp = (u16_t) data;
--t->sp;
/* This will be a return address of thread function. */
*t->sp = (u16_t) mt_exit;
--t->sp;
/* The thread function, is used as a return address of mtarch_switch. */
*t->sp = (u16_t) function;
--t->sp;
/*
* Space for registers.
* af, bc, de, hl, ix, iy, af', bc', de', hl'
*/
/*
* Z80 stack basis:
* push stores the data AFTER decrementing sp.
* pop reads the data BEFORE incrementing sp.
*/
t->sp = t->sp - 9;
}
/*--------------------------------------------------------------------------*/
static struct mtarch_thread *running_thread;
static u16_t *sptmp;
static void
mtarch_switch()
{
__asm
di ; disable interrupt
; normal registers
push af
push bc
push de
push hl
push ix
push iy
; back registers
ex af,af'
push af
exx
push bc
push de
push hl
; swap between running_thread->sp and SP reg
; _running_thread in asembler below points running_thread->sp
; sptmp = sp;
ld (_sptmp),sp
; sp = *(running_thread->sp);
ld ix,(_running_thread)
ld l,0(ix)
ld h,1(ix)
ld sp,hl
; running_thread->sp = sptmp;
ld hl,(_sptmp)
ld 0(ix),l
ld 1(ix),h
; back registers
pop hl
pop de
pop bc
exx
pop af
ex af,af'
; normal registers
pop iy
pop ix
pop hl
pop de
pop bc
pop af
ei ; enable interrupt
__endasm;
// here sp indicates the address that point the function
}
/*--------------------------------------------------------------------------*/
void
mtarch_exec(struct mtarch_thread *t)
{
running_thread = t;
mtarch_switch();
running_thread = NULL;
}
/*--------------------------------------------------------------------------*/
void
mtarch_remove()
{
}
/*--------------------------------------------------------------------------*/
void
mtarch_yield()
{
if (running_thread == NULL) {
/* ERROR! we have no runnning thread. */
return;
}
mtarch_switch();
}
/*--------------------------------------------------------------------------*/
void mtarch_stop(struct mtarch_thread *thread)
{
}
/*--------------------------------------------------------------------------*/
void
mtarch_pstop()
{
}
/*--------------------------------------------------------------------------*/
void
mtarch_pstart()
{
}
/*--------------------------------------------------------------------------*/
int
mtarch_stack_usage(struct mtarch_thread *t)
{
u16_t i;
for (i = 0; i < MTARCH_STACKSIZE; i++) {
if (t->stack[i] != i) {
return MTARCH_STACKSIZE - i;
}
}
return 0;
}
/*--------------------------------------------------------------------------*/

58
cpu/z80/mtarch.h Normal file
View file

@ -0,0 +1,58 @@
/*
* 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.
*
*/
/*
* \file
* Z80 machine-specific difinitions for supporting multithread.
*
* \author
* Takahide Matsutsuka <markn@markn.org>
*/
#ifndef __MTARCH_H__
#define __MTARCH_H__
/* Unit of the stack is 2byte wide. */
#ifndef MTARCH_STACKSIZE
#define MTARCH_STACKSIZE 128
#endif /* MTARCH_STACKSIZE */
struct mtarch_thread {
/*
* On top of the mtarch_thread must be the address for the stack pointer.
* See details at mtarch_switch in mtarch.c
*/
u16_t *sp;
u16_t stack[MTARCH_STACKSIZE];
};
int mtarch_stack_usage(struct mtarch_thread *t);
#endif /* __MTARCH_H__ */

50
cpu/z80/strcasecmp.c Normal file
View file

@ -0,0 +1,50 @@
/*
* 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: strcasecmp.c,v 1.1 2007/08/30 14:39:16 matsutsuka Exp $
*
*/
/*
* \file
* This complements standard C library of sdcc.
* \author
* Takahide Matsutsuka <markn@markn.org>
*/
#include <ctype.h>
#include "strcasecmp.h"
int strcasecmp(const char *str1, const char *str2)
{
while (*str1 != '\0' && tolower(*str1) == tolower(*str2)) {
str1++;
str2++;
}
return tolower(*(unsigned char *) str1) - tolower(*(unsigned char *) str2);
}

45
cpu/z80/strcasecmp.h Normal file
View file

@ -0,0 +1,45 @@
/*
* 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: strcasecmp.h,v 1.1 2007/08/30 14:39:16 matsutsuka Exp $
*
*/
/*
* \file
* This complements standard C library of sdcc.
* \author
* Takahide Matsutsuka <markn@markn.org>
*/
#ifndef __STRCASECMP_H__
#define __STRCASECMP_H__
int strcasecmp(const char *str1, const char *str2);
#endif /*__STRCASECMP_H__*/

85
cpu/z80/uip_arch-asm.S Normal file
View file

@ -0,0 +1,85 @@
;;;
;;;
;;; uip_arch-asm.S
;;;
;;; \file
;;; Z80 architecture-depend uip module
;;; for calculating checksums
;;;
;;; \author
;;; Takahide Matsutsuka <markn@markn.org>
;;;
.globl _uip_add32
.globl _uip_acc32
.area _GSINIT
.area _DATA
.area _CODE
;; ---------------------------------
;; void uip_add32(u8_t *op32, u16_t op16);
;; Stack; retl reth op32l op32h op16l op16h
;; ABCDEHL____
;; return void
;; _uip_acc32 = op32 + op16
;; ---------------------------------
_uip_add32_start::
_uip_add32:
ld hl,#2
add hl,sp
;; HL indicates #_op32l
ld e,(hl)
inc hl
ld d,(hl)
inc hl
ld c,(hl)
inc hl
ld b,(hl)
;; BC indicates op16
ld l,e
ld h,d
;; HL indicates #_op32
ld de,#_uip_acc32
;; DE indicates #_uip_acc32
;; uip_acc32[0] = op32[0] + op16l;
ld a,(hl)
add a,c
ld (de),a
inc hl
inc de
;; uip_acc32[1] = op32[1] + op16h + carry;
ld a,(hl)
adc a,b
ld (de),a
inc hl
inc de
jr nc,_uip_add32_exit
ld a,(hl)
inc a
ld (de),a
inc hl
inc de
jr nc,_uip_add32_exit
ld a,(hl)
inc a
ld (de),a
ret
_uip_add32_exit:
ld a,(hl)
ld (de),a
inc hl
inc de
ld a,(hl)
ld (de),a
ret
_uip_add32_end::
;; ---------------------------------
;; u16_t uip_chksum(void);
;; Stack; retl reth suml sumh datal datah lenl lenh
;; ABCDEHL____
;; return HL
;; _uip_acc32 = op32 + op16
;; ---------------------------------