Line 41... |
Line 41... |
|
|
//--------------------------------------------------------------//
|
//--------------------------------------------------------------//
|
// Common Includes to ownet applications
|
// Common Includes to ownet applications
|
//--------------------------------------------------------------//
|
//--------------------------------------------------------------//
|
#include <stdlib.h>
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
|
//--------------------------------------------------------------//
|
//--------------------------------------------------------------//
|
// Target Specific Information
|
// Target Specific Information
|
//--------------------------------------------------------------//
|
//--------------------------------------------------------------//
|
//--------------------------------------------------------------//
|
|
// Handhelds (PalmOS, WinCE)
|
|
//--------------------------------------------------------------//
|
|
#ifdef __MC68K__
|
|
//MC68K is the type of processor in the PILOT
|
|
//Metrowerk's CodeWarrior defines this symbol
|
|
#include <string.h>
|
|
#ifndef strcmp
|
|
#include <StringMgr.h>
|
|
#define strcmp StrCompare
|
|
#endif
|
|
#include <file_struc.h>
|
|
#endif
|
|
|
|
#ifdef _WIN32_WCE
|
|
//All of our projects had this flag defined by default (_WIN32_WCE),
|
|
//but I'm not 100% positive that this is _the_ definitive
|
|
//flag to use to identify a WinCE system.
|
|
#include "WinCElnk.h"
|
|
#ifndef FILE
|
|
#define FILE int
|
|
extern int sprintf(char *buffer, char *format,...);
|
|
extern void fprintf(FILE *fp, char *format,...);
|
|
extern void printf(char *format,...);
|
|
#endif
|
|
#endif
|
|
|
|
#if !defined(_WIN32_WCE) && !defined(__MC68K__)
|
|
#include <stdio.h>
|
|
#endif
|
|
|
|
#ifdef __C51__
|
|
#define FILE int
|
|
#define exit(c) return
|
|
typedef unsigned int ushort;
|
|
typedef unsigned long ulong;
|
|
#define SMALLINT uchar
|
|
#endif
|
|
|
|
#ifdef __ICCMAXQ__
|
|
#define FILE int
|
|
#define stdout 0
|
|
#define stdin 1
|
|
#define stderr 2
|
|
typedef unsigned int ushort;
|
|
typedef unsigned long ulong;
|
|
#define SMALLINT short
|
|
#define main micro_main
|
|
#define real_main main
|
|
#define SMALL_MEMORY_TARGET
|
|
#endif
|
|
|
|
|
// Altera Nios II + uCOS II
|
|
// configuration options available in: sockit_owm_sw.tcl
|
|
//#define SOCKIT_OWM_ERR_ENABLE
|
|
//#define SOCKIT_OWM_ERR_SMALL
|
|
|
//--------------------------------------------------------------//
|
//--------------------------------------------------------------//
|
// Typedefs
|
// Typedefs
|
//--------------------------------------------------------------//
|
//--------------------------------------------------------------//
|
#ifndef SMALLINT
|
#ifndef SMALLINT
|
Line 126... |
Line 79... |
// common place you'll see smallint is for boolean return types.
|
// common place you'll see smallint is for boolean return types.
|
//
|
//
|
#define SMALLINT int
|
#define SMALLINT int
|
#endif
|
#endif
|
|
|
// setting max baud
|
|
#ifdef _WINDOWS
|
|
// 0x02 = PARAMSET_19200
|
|
#define MAX_BAUD 0x02
|
|
#else
|
|
// 0x06 = PARMSET_115200
|
|
#define MAX_BAUD 0x06
|
|
#endif
|
|
|
|
#ifndef OW_UCHAR
|
#ifndef OW_UCHAR
|
#define OW_UCHAR
|
#define OW_UCHAR
|
typedef unsigned char uchar;
|
typedef unsigned char uchar;
|
#if !defined(__MINGW32__) && (defined(__CYGWIN__) || defined(__GNUC__))
|
#if !defined(__MINGW32__) && (defined(__CYGWIN__) || defined(__GNUC__))
|
typedef unsigned long ulong;
|
typedef unsigned long ulong;
|
Line 195... |
Line 139... |
#define LV_VERBOSE 0
|
#define LV_VERBOSE 0
|
|
|
//--------------------------------------------------------------//
|
//--------------------------------------------------------------//
|
// Error handling
|
// Error handling
|
//--------------------------------------------------------------//
|
//--------------------------------------------------------------//
|
|
|
|
#ifdef SOCKIT_OWM_ERR_ENABLE
|
|
|
extern int owGetErrorNum(void);
|
extern int owGetErrorNum(void);
|
extern int owHasErrors(void);
|
extern int owHasErrors(void);
|
|
|
//Clears the stack.
|
//Clears the stack.
|
#define OWERROR_CLEAR() while(owHasErrors()) owGetErrorNum();
|
#define OWERROR_CLEAR() while(owHasErrors()) owGetErrorNum();
|
Line 213... |
Line 160... |
#define OWERROR(err) owRaiseError(err)
|
#define OWERROR(err) owRaiseError(err)
|
extern void owRaiseError(int);
|
extern void owRaiseError(int);
|
#define OWASSERT(s,err,ret) if(!(s)){owRaiseError((err));return (ret);}
|
#define OWASSERT(s,err,ret) if(!(s)){owRaiseError((err));return (ret);}
|
#endif
|
#endif
|
|
|
#ifdef SMALL_MEMORY_TARGET
|
#ifdef SOCKIT_OWM_ERR_SMALL
|
#define OWERROR_DUMP(fileno) /*no-op*/;
|
#define OWERROR_DUMP(fileno) /*no-op*/;
|
#else
|
#else
|
//Prints the stack out to the given file.
|
//Prints the stack out to the given file.
|
#define OWERROR_DUMP(fileno) while(owHasErrors()) owPrintErrorMsg(fileno);
|
#define OWERROR_DUMP(fileno) while(owHasErrors()) owPrintErrorMsg(fileno);
|
extern void owPrintErrorMsg(FILE *);
|
extern void owPrintErrorMsg(FILE *);
|
extern void owPrintErrorMsgStd();
|
extern void owPrintErrorMsgStd();
|
extern char *owGetErrorMsg(int);
|
extern char *owGetErrorMsg(int);
|
#endif
|
#endif
|
|
|
|
#else
|
|
|
|
#define OWERROR_CLEAR() /*no-op*/;
|
|
#define OWERROR(err) /*no-op*/;
|
|
#define OWERROR_DUMP(fileno) /*no-op*/;
|
|
|
|
#endif
|
|
|
#define OWERROR_NO_ERROR_SET 0
|
#define OWERROR_NO_ERROR_SET 0
|
#define OWERROR_NO_DEVICES_ON_NET 1
|
#define OWERROR_NO_DEVICES_ON_NET 1
|
#define OWERROR_RESET_FAILED 2
|
#define OWERROR_RESET_FAILED 2
|
#define OWERROR_SEARCH_ERROR 3
|
#define OWERROR_SEARCH_ERROR 3
|
#define OWERROR_ACCESS_FAILED 4
|
#define OWERROR_ACCESS_FAILED 4
|