~ubuntu-branches/ubuntu/quantal/zaptel/quantal

« back to all changes in this revision

Viewing changes to kernel/xpp/xdefs.h

  • Committer: Bazaar Package Importer
  • Author(s): Tzafrir Cohen
  • Date: 2008-08-28 22:58:23 UTC
  • mfrom: (11.1.11 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080828225823-r8bdunirm8hmc76m
Tags: 1:1.4.11~dfsg-2
* Patch xpp_fxs_power: Fixed an issue with hook detection of the Astribank
  FXS module.
* Don't fail init.d script if fxotune fails. This may happen if running it
  when Asterisk is already running.
* Bump standards version to 3.8.0.0 .
* Ignore false lintian warning ("m-a a-i" has "a a").
* Patch xpp_fxo_cid_always: do always pass PCM if that's what the user
  asked.
* Patch vzaphfc_proc_root_dir: fix vzaphfc on 2.6.26.
* Patch wcte12xp_flags: Proper time for irq save flags.
* Patch headers_2627: Fix location of semaphore.h for 2.6.27 .
* Patch xpp_fxs_dtmf_leak: Don't play DTMFs to the wrong channel.
* Patch wctdm_fix_alarm: Fix sending channel alarms.
* Patch device_class_2626: Fix building 2.6.26 (Closes: #493397).
* Using dh_lintian for lintian overrides, hence requiring debhelper 6.0.7.
* Lintian: we know we have direct changes. Too bad we're half-upstream :-(
* Fix doc-base section names. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef XDEFS_H
 
2
#define XDEFS_H
 
3
/*
 
4
 * Written by Oron Peled <oron@actcom.co.il>
 
5
 * Copyright (C) 2004-2006, Xorcom
 
6
 *
 
7
 * All rights reserved.
 
8
 *
 
9
 * This program is free software; you can redistribute it and/or modify
 
10
 * it under the terms of the GNU General Public License as published by
 
11
 * the Free Software Foundation; either version 2 of the License, or
 
12
 * (at your option) any later version.
 
13
 *
 
14
 * This program is distributed in the hope that it will be useful,
 
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
 * GNU General Public License for more details.
 
18
 *
 
19
 * You should have received a copy of the GNU General Public License
 
20
 * along with this program; if not, write to the Free Software
 
21
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
22
 *
 
23
 */
 
24
 
 
25
#include "xpp_version.h"
 
26
 
 
27
#ifdef  __KERNEL__
 
28
 
 
29
#include <linux/kernel.h>
 
30
#include <linux/version.h>
 
31
 
 
32
#else
 
33
 
 
34
/* This is to enable user-space programs to include this. */
 
35
 
 
36
#include <stdint.h>
 
37
typedef uint8_t  __u8;
 
38
typedef uint32_t __u32;
 
39
 
 
40
#include <stdio.h>
 
41
 
 
42
#define DBG(fmt, ...)           printf("DBG: %s: " fmt, __FUNCTION__, ## __VA_ARGS__)
 
43
#define INFO(fmt, ...)          printf("INFO: " fmt, ## __VA_ARGS__)
 
44
#define NOTICE(fmt, ...)        printf("NOTICE: " fmt, ## __VA_ARGS__)
 
45
#define ERR(fmt, ...)           printf("ERR: " fmt, ## __VA_ARGS__)
 
46
#define __user
 
47
 
 
48
struct list_head { struct list_head *next; struct list_head *prev; };
 
49
 
 
50
#endif
 
51
 
 
52
#define PACKED  __attribute__((packed))
 
53
 
 
54
#define ALL_LINES               ((lineno_t)-1)
 
55
 
 
56
#ifndef BIT     /* added in 2.6.24 */
 
57
#define BIT(i)          (1UL << (i))
 
58
#endif
 
59
#define BIT_SET(x,i)    ((x) |= BIT(i))
 
60
#define BIT_CLR(x,i)    ((x) &= ~BIT(i))
 
61
#define IS_SET(x,i)     (((x) & BIT(i)) != 0)
 
62
#define BITMASK(i)      (((u64)1 << (i)) - 1)
 
63
 
 
64
#define MAX_PROC_WRITE  100     /* Largest buffer we allow writing our /proc files */
 
65
#define CHANNELS_PERXPD 32      /* Depends on xpp_line_t and protocol fields */
 
66
 
 
67
#define MAX_SPANNAME    20      /* From zaptel.h */
 
68
#define MAX_SPANDESC    40      /* From zaptel.h */
 
69
#define MAX_CHANNAME    40      /* From zaptel.h */
 
70
 
 
71
#define XPD_NAMELEN     10      /* must be <= from maximal workqueue name */
 
72
#define XPD_DESCLEN     20
 
73
#define XBUS_NAMELEN    20      /* must be <= from maximal workqueue name */
 
74
#define XBUS_DESCLEN    40
 
75
#define LABEL_SIZE      20
 
76
 
 
77
#define UNIT_BITS       3       /* Bit for Astribank unit number */
 
78
#define SUBUNIT_BITS    3       /* Bit for Astribank subunit number */
 
79
 
 
80
#define MAX_UNIT        (1 << UNIT_BITS)        /* 1 FXS + 3 FXS/FXO | 1 BRI + 3 FXS/FXO */
 
81
#define MAX_SUBUNIT     (1 << SUBUNIT_BITS)     /* 8 port BRI */
 
82
 
 
83
/*
 
84
 * Compile time sanity checks
 
85
 */
 
86
#if MAX_UNIT > BIT(UNIT_BITS)
 
87
#error "MAX_UNIT too large"
 
88
#endif
 
89
 
 
90
#if MAX_SUBUNIT > BIT(SUBUNIT_BITS)
 
91
#error "MAX_SUBUNIT too large"
 
92
#endif
 
93
 
 
94
#define MAX_XPDS                (MAX_UNIT*MAX_SUBUNIT)
 
95
 
 
96
#define VALID_XPD_NUM(x)        ((x) < MAX_XPDS && (x) >= 0)
 
97
 
 
98
#define CHAN_BITS               5       /* 0-31 for E1 */
 
99
 
 
100
typedef char                    *charp;
 
101
typedef unsigned char           byte;
 
102
#ifdef __KERNEL__
 
103
 
 
104
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) 
 
105
#define KMEM_CACHE_T    kmem_cache_t
 
106
#else 
 
107
#define KMEM_CACHE_T    struct kmem_cache
 
108
#endif 
 
109
 
 
110
#define KZALLOC(size, gfp)      my_kzalloc(size, gfp)
 
111
#define KZFREE(p)               do {                                    \
 
112
                                        memset((p), 0, sizeof(*(p)));   \
 
113
                                        kfree(p);                       \
 
114
                                } while(0);
 
115
 
 
116
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19)
 
117
typedef int                     bool;
 
118
#endif
 
119
#else
 
120
typedef int                     bool;
 
121
#endif
 
122
typedef struct xbus             xbus_t;
 
123
typedef struct xpd              xpd_t;
 
124
typedef struct xframe           xframe_t;
 
125
typedef struct xpacket          xpacket_t;
 
126
typedef struct xops             xops_t;
 
127
typedef __u32                   xpp_line_t;     /* at most 31 lines for E1 */
 
128
typedef byte                    lineno_t;
 
129
typedef byte                    xportno_t;
 
130
 
 
131
#define PORT_BROADCAST          255
 
132
 
 
133
#endif  /* XDEFS_H */