Moved error_exit() to the Win32 Contiki Core.
This commit is contained in:
parent
f5cee13b01
commit
50fda17c3e
@ -22,6 +22,7 @@
|
|||||||
#define LOG_CONF_ENABLED 1
|
#define LOG_CONF_ENABLED 1
|
||||||
#include "sys/log.h"
|
#include "sys/log.h"
|
||||||
CCIF void debug_printf(char *format, ...);
|
CCIF void debug_printf(char *format, ...);
|
||||||
|
CCIF void error_exit(char *message);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,25 +30,35 @@
|
|||||||
*
|
*
|
||||||
* Author: Oliver Schmidt <ol.sc@web.de>
|
* Author: Oliver Schmidt <ol.sc@web.de>
|
||||||
*
|
*
|
||||||
* $Id: contiki-main.c,v 1.1 2006/08/14 23:53:55 oliverschmidt Exp $
|
* $Id: contiki-main.c,v 1.2 2006/10/03 11:27:51 oliverschmidt Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "contiki.h"
|
#include "contiki.h"
|
||||||
|
#include "contiki-net.h"
|
||||||
|
|
||||||
#include "sys/clock.h"
|
#include "sys/clock.h"
|
||||||
|
|
||||||
#include "../../apps/directory/directory-dsc.h"
|
#include "../../apps/directory/directory-dsc.h"
|
||||||
#include "../../apps/webbrowser/www-dsc.h"
|
#include "../../apps/webbrowser/www-dsc.h"
|
||||||
|
|
||||||
#include "ctk/ctk-conio-service.h"
|
#include "sys/etimer.h"
|
||||||
#include "cfs/cfs-win32.h"
|
#include "cfs/cfs-win32.h"
|
||||||
|
#include "ctk/ctk-conio-service.h"
|
||||||
|
#include "net/wpcap-service.h"
|
||||||
#include "program-handler.h"
|
#include "program-handler.h"
|
||||||
|
|
||||||
PROCINIT(&ctk_conio_service_process, &ctk_process, &cfs_win32_process, &program_handler_process);
|
PROCINIT(&etimer_process,
|
||||||
|
&cfs_win32_process,
|
||||||
|
&ctk_conio_service_process,
|
||||||
|
&ctk_process,
|
||||||
|
&tcpip_process,
|
||||||
|
&resolv_process,
|
||||||
|
&program_handler_process);
|
||||||
|
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
void
|
void
|
||||||
@ -76,6 +86,16 @@ log_message(const char *part1, const char *part2)
|
|||||||
debug_printf("%s%s\n", part1, part2);
|
debug_printf("%s%s\n", part1, part2);
|
||||||
}
|
}
|
||||||
/*-----------------------------------------------------------------------------------*/
|
/*-----------------------------------------------------------------------------------*/
|
||||||
|
void
|
||||||
|
error_exit(char *message)
|
||||||
|
{
|
||||||
|
debug_printf("Error Exit: %s", message);
|
||||||
|
|
||||||
|
console_exit();
|
||||||
|
console_cputs(message);
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
/*-----------------------------------------------------------------------------------*/
|
||||||
clock_time_t
|
clock_time_t
|
||||||
clock_time(void)
|
clock_time(void)
|
||||||
{
|
{
|
||||||
@ -94,6 +114,23 @@ main(int argc)
|
|||||||
program_handler_add(&directory_dsc, "Directory", 1);
|
program_handler_add(&directory_dsc, "Directory", 1);
|
||||||
program_handler_add(&www_dsc, "Web browser", 1);
|
program_handler_add(&www_dsc, "Web browser", 1);
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
{
|
||||||
|
uip_ipaddr_t addr;
|
||||||
|
uip_ipaddr(&addr, 192,168,0,222);
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
|
|
||||||
if(process_run() < 2) {
|
if(process_run() < 2) {
|
||||||
@ -104,6 +141,8 @@ main(int argc)
|
|||||||
|
|
||||||
/* Allow user-mode APC to execute. */
|
/* Allow user-mode APC to execute. */
|
||||||
SleepEx(10, TRUE);
|
SleepEx(10, TRUE);
|
||||||
|
|
||||||
|
etimer_request_poll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
*
|
*
|
||||||
* Author: Oliver Schmidt <ol.sc@web.de>
|
* Author: Oliver Schmidt <ol.sc@web.de>
|
||||||
*
|
*
|
||||||
* $Id: ctk-console.c,v 1.4 2006/09/09 23:20:39 oliverschmidt Exp $
|
* $Id: ctk-console.c,v 1.5 2006/10/03 11:27:51 oliverschmidt Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
@ -102,6 +102,13 @@ console_init(void)
|
|||||||
void
|
void
|
||||||
console_exit(void)
|
console_exit(void)
|
||||||
{
|
{
|
||||||
|
static unsigned char done;
|
||||||
|
|
||||||
|
if(done) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
done = 1;
|
||||||
|
|
||||||
textcolor(saved_color);
|
textcolor(saved_color);
|
||||||
revers(0);
|
revers(0);
|
||||||
clrscr();
|
clrscr();
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
*
|
*
|
||||||
* Author: Oliver Schmidt <ol.sc@web.de>
|
* Author: Oliver Schmidt <ol.sc@web.de>
|
||||||
*
|
*
|
||||||
* $Id: ctk-console.h,v 1.3 2006/10/03 00:30:42 oliverschmidt Exp $
|
* $Id: ctk-console.h,v 1.4 2006/10/03 11:27:51 oliverschmidt Exp $
|
||||||
*/
|
*/
|
||||||
#ifndef __CTK_CONSOLE_H__
|
#ifndef __CTK_CONSOLE_H__
|
||||||
#define __CTK_CONSOLE_H__
|
#define __CTK_CONSOLE_H__
|
||||||
@ -50,7 +50,7 @@ void bordercolor(unsigned char c);
|
|||||||
void screensize(unsigned char *x, unsigned char *y);
|
void screensize(unsigned char *x, unsigned char *y);
|
||||||
void revers(unsigned char c);
|
void revers(unsigned char c);
|
||||||
void console_cputc(char c);
|
void console_cputc(char c);
|
||||||
CCIF void console_cputs(char *str);
|
void console_cputs(char *str);
|
||||||
void cclear(unsigned char length);
|
void cclear(unsigned char length);
|
||||||
void chline(unsigned char length);
|
void chline(unsigned char length);
|
||||||
void cvline(unsigned char length);
|
void cvline(unsigned char length);
|
||||||
|
@ -30,14 +30,13 @@
|
|||||||
*
|
*
|
||||||
* Author: Oliver Schmidt <ol.sc@web.de>
|
* Author: Oliver Schmidt <ol.sc@web.de>
|
||||||
*
|
*
|
||||||
* $Id: wpcap-service.c,v 1.2 2006/10/03 00:28:36 oliverschmidt Exp $
|
* $Id: wpcap-service.c,v 1.3 2006/10/03 11:27:51 oliverschmidt Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <process.h>
|
|
||||||
|
|
||||||
#pragma comment(lib, "wsock32")
|
#pragma comment(lib, "wsock32")
|
||||||
|
|
||||||
@ -82,15 +81,6 @@ static int (* pcap_sendpacket)(struct pcap *, unsigned char *, int);
|
|||||||
|
|
||||||
#define BUF ((struct uip_eth_hdr *)&uip_buf[0])
|
#define BUF ((struct uip_eth_hdr *)&uip_buf[0])
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*/
|
|
||||||
static void
|
|
||||||
error_exit(char *message)
|
|
||||||
{
|
|
||||||
debug_printf("Error Exit: %s", message);
|
|
||||||
_cexit();
|
|
||||||
console_cputs(message);
|
|
||||||
ExitProcess(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
static void
|
static void
|
||||||
pollhandler(void)
|
pollhandler(void)
|
||||||
@ -114,6 +104,7 @@ pollhandler(void)
|
|||||||
debug_printf("I");
|
debug_printf("I");
|
||||||
uip_len -= sizeof(struct uip_eth_hdr);
|
uip_len -= sizeof(struct uip_eth_hdr);
|
||||||
tcpip_input();
|
tcpip_input();
|
||||||
|
|
||||||
} else if(BUF->type == HTONS(UIP_ETHTYPE_ARP)) {
|
} else if(BUF->type == HTONS(UIP_ETHTYPE_ARP)) {
|
||||||
debug_printf("A");
|
debug_printf("A");
|
||||||
uip_arp_arpin();
|
uip_arp_arpin();
|
||||||
|
Loading…
Reference in New Issue
Block a user