14 #ifndef __PLATFORM_H__
15 #define __PLATFORM_H__
17 #if !defined(DIVA_BUILD)
18 #define DIVA_BUILD "local"
21 #include <linux/module.h>
23 #include <linux/kernel.h>
24 #include <linux/sched.h>
30 #include <linux/list.h>
31 #include <asm/types.h>
38 #define DIVA_NO_DEBUGLIB
41 #define DIVA_USER_MODE_CARD_CONFIG 1
42 #define USE_EXTENDED_DEBUGS 1
44 #define MAX_ADAPTER 32
46 #define DIVA_ISTREAM 1
48 #define MEMORY_SPACE_TYPE 0
49 #define PORT_SPACE_TYPE 1
52 #include <linux/string.h>
71 #define NULL ((void *) 0)
90 #define MEM_TYPE_RAM 0
91 #define MEM_TYPE_PORT 1
92 #define MEM_TYPE_PROM 2
93 #define MEM_TYPE_CTLREG 3
94 #define MEM_TYPE_RESET 4
95 #define MEM_TYPE_CFG 5
96 #define MEM_TYPE_ADDRESS 6
97 #define MEM_TYPE_CONFIG 7
98 #define MEM_TYPE_CONTROL 8
100 #define MAX_MEM_TYPE 10
102 #define DIVA_OS_MEM_ATTACH_RAM(a) ((a)->ram)
103 #define DIVA_OS_MEM_ATTACH_PORT(a) ((a)->port)
104 #define DIVA_OS_MEM_ATTACH_PROM(a) ((a)->prom)
105 #define DIVA_OS_MEM_ATTACH_CTLREG(a) ((a)->ctlReg)
106 #define DIVA_OS_MEM_ATTACH_RESET(a) ((a)->reset)
107 #define DIVA_OS_MEM_ATTACH_CFG(a) ((a)->cfg)
108 #define DIVA_OS_MEM_ATTACH_ADDRESS(a) ((a)->Address)
109 #define DIVA_OS_MEM_ATTACH_CONFIG(a) ((a)->Config)
110 #define DIVA_OS_MEM_ATTACH_CONTROL(a) ((a)->Control)
112 #define DIVA_OS_MEM_DETACH_RAM(a, x) do { } while (0)
113 #define DIVA_OS_MEM_DETACH_PORT(a, x) do { } while (0)
114 #define DIVA_OS_MEM_DETACH_PROM(a, x) do { } while (0)
115 #define DIVA_OS_MEM_DETACH_CTLREG(a, x) do { } while (0)
116 #define DIVA_OS_MEM_DETACH_RESET(a, x) do { } while (0)
117 #define DIVA_OS_MEM_DETACH_CFG(a, x) do { } while (0)
118 #define DIVA_OS_MEM_DETACH_ADDRESS(a, x) do { } while (0)
119 #define DIVA_OS_MEM_DETACH_CONFIG(a, x) do { } while (0)
120 #define DIVA_OS_MEM_DETACH_CONTROL(a, x) do { } while (0)
122 #define DIVA_INVALID_FILE_HANDLE ((dword)(-1))
124 #define DIVAS_CONTAINING_RECORD(address, type, field) \
125 ((type *)((char *)(address) - (char *)(&((type *)0)->field)))
127 extern int sprintf(
char *,
const char *, ...);
138 #define dtrc(p) DBG_PRV0(p)
139 #define dbug(a, p) DBG_PRV1(p)
148 struct _diva_os_timer;
171 static __inline__ void diva_os_free(
unsigned long flags,
void *
ptr)
182 #define DIVA_MESSAGE_BUFFER_LEN(x) x->len
183 #define DIVA_MESSAGE_BUFFER_DATA(x) x->data
207 unsigned long length,
const char *
name,
int id);
229 #define diva_os_in_irq() in_irq()
237 spin_lock_init(lock);
return (0); }
238 static __inline__ void diva_os_enter_spin_lock(diva_os_spin_lock_t *
a, \
239 diva_os_spin_lock_magic_t *old_irql, \
240 void *
dbg) { spin_lock_bh(a); }
241 static __inline__ void diva_os_leave_spin_lock(diva_os_spin_lock_t *
a, \
242 diva_os_spin_lock_magic_t *old_irql, \
243 void *
dbg) { spin_unlock_bh(a); }
245 #define diva_os_destroy_spin_lock(a, b) do { } while (0)
275 diva_os_atomic_increment(diva_os_atomic_t *
pv)
281 diva_os_atomic_decrement(diva_os_atomic_t *
pv)
291 #define IMPLEMENT_DTMF 1
292 #define IMPLEMENT_ECHO_CANCELLER 1
293 #define IMPLEMENT_RTP 1
294 #define IMPLEMENT_T38 1
295 #define IMPLEMENT_FAX_SUB_SEP_PWD 1
296 #define IMPLEMENT_V18 1
297 #define IMPLEMENT_DTMF_TONE 1
298 #define IMPLEMENT_PIAFS 1
299 #define IMPLEMENT_FAX_PAPER_FORMATS 1
300 #define IMPLEMENT_VOWN 1
301 #define IMPLEMENT_CAPIDTMF 1
302 #define IMPLEMENT_FAX_NONSTANDARD 1
303 #define VSWITCH_SUPPORT 1
305 #define IMPLEMENT_MARKED_OK_AFTER_FC 1
307 #define DIVA_IDI_RX_DMA 1
315 #define READ_BYTE(addr) readb(addr)
316 #define READ_WORD(addr) readw(addr)
317 #define READ_DWORD(addr) readl(addr)
319 #define WRITE_BYTE(addr, v) writeb(v, addr)
320 #define WRITE_WORD(addr, v) writew(v, addr)
321 #define WRITE_DWORD(addr, v) writel(v, addr)
327 static inline __u32 GET_DWORD(
void *
addr)
331 static inline void PUT_WORD(
void *addr,
__u16 v)
335 static inline void PUT_DWORD(
void *addr,
__u32 v)
344 #if BITS_PER_LONG > 32
345 #define PLATFORM_GT_32BIT
346 #define ULongToPtr(x) (void *)(unsigned long)(x)
360 #define diva_os_dump_file_t char
361 #define diva_os_board_trace_t char
362 #define diva_os_dump_file(__x__) do { } while (0)
367 #define MAX_DESCRIPTORS 64