Allow 6502 ctk programs (all running in non-window mode) to exit the Contiki process by calling LOAD_UNLOAD().

This commit is contained in:
oliverschmidt 2010-02-04 23:52:30 +00:00
parent 5e66abda50
commit 2d40c75efe
4 changed files with 98 additions and 4 deletions

View file

@ -30,7 +30,7 @@
* *
* Author: Oliver Schmidt <ol.sc@web.de> * Author: Oliver Schmidt <ol.sc@web.de>
* *
* @(#)$Id: 6502def.h,v 1.19 2010/01/30 20:54:15 oliverschmidt Exp $ * @(#)$Id: 6502def.h,v 1.20 2010/02/04 23:52:30 oliverschmidt Exp $
*/ */
#ifndef __6502DEF_H__ #ifndef __6502DEF_H__
@ -66,6 +66,8 @@ typedef unsigned short uip_stats_t;
#define UIP_ARCH_ADD32 1 #define UIP_ARCH_ADD32 1
#define UIP_ARCH_CHKSUM 1 #define UIP_ARCH_CHKSUM 1
#define LOADER_CONF_ARCH "lib/unload.h"
#if WITH_LOGGING #if WITH_LOGGING
#define LOG_CONF_ENABLED 1 #define LOG_CONF_ENABLED 1
#define UIP_CONF_LOGGING 1 #define UIP_CONF_LOGGING 1

View file

@ -30,7 +30,7 @@
# #
# Author: Oliver Schmidt <ol.sc@web.de> # Author: Oliver Schmidt <ol.sc@web.de>
# #
# $Id: Makefile.6502,v 1.30 2009/10/18 11:34:38 oliverschmidt Exp $ # $Id: Makefile.6502,v 1.31 2010/02/04 23:52:30 oliverschmidt Exp $
# #
ifndef CC65_HOME ifndef CC65_HOME
@ -43,8 +43,8 @@ CONTIKI_TARGET_DIRS = . lib sys
CONTIKI_CPU_DIRS = . lib sys ctk net CONTIKI_CPU_DIRS = . lib sys ctk net
CONTIKI_TARGET_SOURCEFILES = contiki-main.c CONTIKI_TARGET_SOURCEFILES = contiki-main.c
CONTIKI_CPU_SOURCEFILES = log.c error.c config.c clock.c ctk-mouse.c \ CONTIKI_CPU_SOURCEFILES = log.c error.c unload.c config.c ctk-mouse.c \
mtarch.c mtarch-asm.S lc-asm.S \ clock.c mtarch.c mtarch-asm.S lc-asm.S \
uip_arch.c ethernet-drv.c ethernet.c uip_arch.c ethernet-drv.c ethernet.c
CONTIKI_SOURCEFILES += $(CTK) ctk-conio.c petsciiconv.c cfs-posix-dir.c \ CONTIKI_SOURCEFILES += $(CTK) ctk-conio.c petsciiconv.c cfs-posix-dir.c \

49
cpu/6502/lib/unload.c Normal file
View file

@ -0,0 +1,49 @@
/*
* Copyright (c) 2010, 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: unload.c,v 1.1 2010/02/04 23:52:30 oliverschmidt Exp $
*/
#include <stdlib.h>
#include "ctk/ctk-draw.h"
/*-----------------------------------------------------------------------------------*/
void
unload(void)
{
#if WITH_GUI
ctk_draw_init();
#endif /* WITH_GUI */
exit(EXIT_SUCCESS);
}
/*-----------------------------------------------------------------------------------*/

43
cpu/6502/lib/unload.h Normal file
View file

@ -0,0 +1,43 @@
/*
* Copyright (c) 2010, 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: unload.h,v 1.1 2010/02/04 23:52:30 oliverschmidt Exp $
*/
#ifndef __UNLOAD_H__
#define __UNLOAD_H__
#define LOADER_UNLOAD unload
void unload(void);
#endif /* __UNLOAD_H__ */