File: /usr/src/linux/drivers/isdn/eicon/sys.h
1
2 /*
3 *
4 * Copyright (C) Eicon Technology Corporation, 2000.
5 *
6 * Eicon File Revision : 1.2
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY
15 * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 * See the GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 *
22 */
23
24
25 /* Environment provided by system and miscellaneous definitions */
26
27 #if !defined(SYS_H)
28 #define SYS_H
29
30 /* abreviations for unsigned types */
31 typedef int boolean_t;
32
33 typedef unsigned char byte;
34
35 typedef unsigned long dword;
36 typedef unsigned short word;
37
38 /* abreviations for volatile types */
39
40 typedef volatile byte vbyte;
41 typedef volatile word vword;
42 typedef volatile dword vdword;
43
44 /* Booleans */
45
46 #if !defined(TRUE)
47 #define TRUE (1)
48 #define FALSE (0)
49 #endif
50
51 /* NULL pointer */
52
53 #if !defined(NULL)
54 #define NULL ((void *) 0)
55 #endif
56
57 /* Return the dimension of an array */
58
59 #if !defined(DIM)
60 #define DIM(array) (sizeof (array)/sizeof ((array)[0]))
61 #endif
62
63 /*
64 * Return the number of milliseconds since last boot
65 */
66
67 extern dword UxTimeGet(void);
68
69 extern void DivasSprintf(char *buffer, char *format, ...);
70 extern void DivasPrintf(char *format, ...);
71
72 /* fatal errors, asserts and tracing */
73
74 void HwFatalErrorFrom(char *file, int line);
75 void HwFatalError(void);
76 /* void HwAssert(char *file, int line, char *condition); */
77
78 #include <linux/kernel.h>
79 #include <linux/string.h>
80
81 #define _PRINTK printk
82
83 #define _PRINTF DivasPrintf
84 void _PRINTF(char *format, ...);
85 #define PRINTF(arg_list) _PRINTF arg_list
86 #if defined DTRACE
87 # define DPRINTF(arg_list) _PRINTF arg_list
88 # define KDPRINTF(arg_list) _PRINTF arg_list ; _PRINTK arg_list ; _PRINTK("\n");
89 #else
90 # define DPRINTF(arg_list) (void)0
91 # define KDPRINTF(arg_list) _PRINTK arg_list ; _PRINTK("\n");
92 #endif
93
94 #if !defined(ASSERT)
95 #if defined DEBUG || defined DBG
96 # define HwFatalError() HwFatalErrorFrom(__FILE__, __LINE__)
97 # define ASSERT(cond) \
98 if (!(cond)) \
99 { \
100 /* HwAssert(__FILE__, __LINE__, #cond);*/ \
101 }
102 #else
103 # define ASSERT(cond) ((void)0)
104 #endif
105 #endif /* !defined(ASSERT) */
106
107 #define TRACE (_PRINTF(__FILE__"@%d\n", __LINE__))
108
109 #endif /* SYS_H */
110