diff --git a/platform/win32/contiki-conf.h b/platform/win32/contiki-conf.h new file mode 100644 index 000000000..1ca6ac984 --- /dev/null +++ b/platform/win32/contiki-conf.h @@ -0,0 +1,139 @@ +#ifndef __CONTIKI_CONF_H__ +#define __CONTIKI_CONF_H__ + +#define CC_CONF_REGISTER_ARGS 1 +#define CC_CONF_FASTCALL __fastcall + + + +#if _USRDLL +#define CCI __declspec(dllimport) +#define CLI __declspec(dllexport) +#else +#define CCI __declspec(dllexport) +#define CLI +#endif + + + +#define LOG_CONF_ENABLED 1 +#include "sys/log.h" +void debug_printf(char *format, ...); + + + +#include +#define CLOCK_CONF_SECOND CLK_TCK +typedef unsigned long clock_time_t; + + + +#include +#define ctk_arch_isprint isprint + +typedef char ctk_arch_key_t; +#include "ctk/ctk-console.h" + +#define CH_ULCORNER 0xDA +#define CH_URCORNER 0xBF +#define CH_LLCORNER 0xC0 +#define CH_LRCORNER 0xD9 +#define CH_ENTER '\r' +#define CH_DEL '\b' +#define CH_CURS_UP -1 +#define CH_CURS_LEFT -2 +#define CH_CURS_RIGHT -3 +#define CH_CURS_DOWN -4 + +#define CTK_CONF_MENU_KEY -5 /* F10 */ +#define CTK_CONF_WINDOWSWITCH_KEY -6 /* Ctrl-Tab */ +#define CTK_CONF_WIDGETDOWN_KEY '\t' +#define CTK_CONF_WIDGETUP_KEY -7 /* Shift-Tab */ +#define CTK_CONF_MOUSE_SUPPORT 1 +#define CTK_CONF_ICONS 1 +#define CTK_CONF_ICON_BITMAPS 0 +#define CTK_CONF_ICON_TEXTMAPS 1 +#define CTK_CONF_WINDOWMOVE 1 +#define CTK_CONF_WINDOWCLOSE 1 +#define CTK_CONF_MENUS 1 +#define CTK_CONF_MENUWIDTH 16 +#define CTK_CONF_MAXMENUITEMS 10 +#define CTK_CONF_WIDGET_FLAGS 0 +#define CTK_CONF_SCREENSAVER 0 + +#define COLOR_BLACK (0) +#define COLOR_BLUE (1) +#define COLOR_GRAY (1 | 2 | 4) +#define COLOR_CYAN (1 | 2 | 8) +#define COLOR_YELLOW (2 | 4 | 8) +#define COLOR_WHITE (1 | 2 | 4 | 8) + +#define BORDERCOLOR COLOR_BLACK +#define SCREENCOLOR COLOR_BLACK +#define BACKGROUNDCOLOR COLOR_BLACK +#define WINDOWCOLOR_FOCUS COLOR_WHITE | COLOR_BLUE * 0x10 +#define WINDOWCOLOR COLOR_GRAY | COLOR_BLUE * 0x10 +#define DIALOGCOLOR COLOR_WHITE | COLOR_BLUE * 0x10 +#define WIDGETCOLOR_HLINK COLOR_CYAN | COLOR_BLUE * 0x10 +#define WIDGETCOLOR_FWIN COLOR_WHITE | COLOR_BLUE * 0x10 +#define WIDGETCOLOR COLOR_GRAY | COLOR_BLUE * 0x10 +#define WIDGETCOLOR_DIALOG COLOR_WHITE | COLOR_BLUE * 0x10 +#define WIDGETCOLOR_FOCUS COLOR_YELLOW | COLOR_BLUE * 0x10 +#define MENUCOLOR COLOR_WHITE | COLOR_BLUE * 0x10 +#define OPENMENUCOLOR COLOR_WHITE | COLOR_BLUE * 0x10 +#define ACTIVEMENUITEMCOLOR COLOR_YELLOW | COLOR_BLUE * 0x10 + + + +#define EMAIL_CONF_WIDTH 76 +#define EMAIL_CONF_HEIGHT 25 + + + +#define IRC_CONF_WIDTH 78 +#define IRC_CONF_HEIGHT 30 +#define IRC_CONF_SYSTEM_STRING "Win32" + + + +#define LOADER_CONF_ARCH "loader/dll-loader.h" + +#define PROGRAM_HANDLER_CONF_MAX_NUMDSCS 10 + +#define strcasecmp _stricmp + + + +#define SHELL_GUI_CONF_XSIZE 46 +#define SHELL_GUI_CONF_YSIZE 22 + + + +typedef unsigned char u8_t; +typedef unsigned short u16_t; +typedef unsigned long u32_t; +typedef unsigned short uip_stats_t; + +#define UIP_CONF_MAX_CONNECTIONS 40 +#define UIP_CONF_MAX_LISTENPORTS 40 +#define UIP_CONF_BUFFER_SIZE 420 +#define UIP_CONF_BYTE_ORDER LITTLE_ENDIAN +#define UIP_CONF_TCP_SPLIT 1 +#define UIP_CONF_LOGGING 1 +#define UIP_CONF_UDP_CHECKSUMS 1 + + + +#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 + +#endif /* __CONTIKI_CONF_H__ */ diff --git a/platform/win32/contiki-main.c b/platform/win32/contiki-main.c new file mode 100644 index 000000000..f46b0ad3f --- /dev/null +++ b/platform/win32/contiki-main.c @@ -0,0 +1,110 @@ +/* + * Copyright (c) 2006, Swedish Institute of Computer Science. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * This file is part of the Contiki operating system. + * + * Author: Oliver Schmidt + * + * $Id: contiki-main.c,v 1.1 2006/08/14 23:53:55 oliverschmidt Exp $ + */ + +#define WIN32_LEAN_AND_MEAN +#include +#include + +#include "contiki.h" + +#include "sys/clock.h" + +#include "../../apps/directory/directory-dsc.h" +#include "../../apps/webbrowser/www-dsc.h" + +#include "ctk/ctk-conio-service.h" +#include "cfs/cfs-win32.h" +#include "program-handler.h" + +PROCINIT(&ctk_conio_service_process, &ctk_process, &cfs_win32_process, &program_handler_process); + +/*-----------------------------------------------------------------------------------*/ +void +debug_printf(char *format, ...) +{ + va_list argptr; + char buffer[1024]; + + va_start(argptr, format); + vsprintf(buffer, format, argptr); + va_end(argptr); + + OutputDebugString(buffer); +} +/*-----------------------------------------------------------------------------------*/ +void +uip_log(char *message) +{ + debug_printf("%s\n", message); +} +/*-----------------------------------------------------------------------------------*/ +void +log_message(const char *part1, const char *part2) +{ + debug_printf("%s%s\n", part1, part2); +} +/*-----------------------------------------------------------------------------------*/ +clock_time_t +clock_time(void) +{ + return clock(); +} +/*-----------------------------------------------------------------------------------*/ +void +main(int argc) +{ + process_init(); + + procinit_init(); + + console_init(); + + program_handler_add(&directory_dsc, "Directory", 1); + program_handler_add(&www_dsc, "Web browser", 1); + + while(1) { + + if(process_run() < 2) { + + if(console_resize()) { + ctk_restore(); + } + + /* Allow user-mode APC to execute. */ + SleepEx(10, TRUE); + } + } +} +/*-----------------------------------------------------------------------------------*/