1 /*
2  * Environment provided by system and miscellaneous definitions
3  *
4  * Copyright (C) Eicon Technology Corporation, 2000.
5  *
6  * Eicon File Revision :    1.2
7  *
8  * This software may be used and distributed according to the terms
9  * of the GNU General Public License, incorporated herein by reference.
10  *
11  */
12 
13 #if !defined(SYS_H)
14 #define SYS_H
15 
16 /* abreviations for unsigned types */
17 typedef int boolean_t;
18 
19 typedef unsigned char byte;
20 
21 typedef unsigned long dword;
22 typedef unsigned short word;
23 
24 /* abreviations for volatile types */
25 
26 typedef volatile byte	vbyte;
27 typedef volatile word	vword;
28 typedef volatile dword	vdword;
29 
30 /* Booleans */
31 
32 #if !defined(TRUE)
33 #define TRUE    (1)
34 #define FALSE   (0)
35 #endif
36 
37 /* NULL pointer */
38 
39 #if !defined(NULL)
40 #define NULL    ((void *) 0)
41 #endif
42 
43 /* Return the dimension of an array */
44 
45 #if !defined(DIM)
46 #define DIM(array)  (sizeof (array)/sizeof ((array)[0]))
47 #endif
48 
49 /*
50  * Return the number of milliseconds since last boot
51  */
52 
53 extern	dword	UxTimeGet(void);
54 
55 extern	void 	DivasSprintf(char *buffer, char *format, ...);
56 extern	void 	DivasPrintf(char *format, ...);
57 
58 /* fatal errors, asserts and tracing */
59 
60 void HwFatalErrorFrom(char *file, int line);
61 void HwFatalError(void);
62 /* void HwAssert(char *file, int line, char *condition); */
63 
64 #include <linux/kernel.h>
65 #include <linux/string.h>
66 
67 #define _PRINTK printk
68 
69 #define _PRINTF	DivasPrintf
70 void _PRINTF(char *format, ...);
71 #define PRINTF(arg_list)	_PRINTF arg_list
72 #if defined DTRACE
73 # define DPRINTF(arg_list)	_PRINTF arg_list
74 # define KDPRINTF(arg_list)	_PRINTF arg_list ; _PRINTK arg_list ; _PRINTK("\n");
75 #else
76 # define DPRINTF(arg_list)	(void)0
77 # define KDPRINTF(arg_list)	_PRINTK arg_list ; _PRINTK("\n");
78 #endif
79 
80 #if !defined(ASSERT)
81 #if defined DEBUG || defined DBG
82 # define HwFatalError()	HwFatalErrorFrom(__FILE__, __LINE__)
83 # define ASSERT(cond)								\
84 		if (!(cond)) 								\
85 		{											\
86 /*			HwAssert(__FILE__, __LINE__, #cond);*/	\
87 		}
88 #else
89 # define ASSERT(cond)	((void)0)
90 #endif
91 #endif /* !defined(ASSERT) */
92 
93 #define TRACE	(_PRINTF(__FILE__"@%d\n", __LINE__))
94 
95 #endif /* SYS_H */
96