summaryrefslogtreecommitdiff
path: root/xpp/xdefs.h
diff options
context:
space:
mode:
authortzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-07-08 00:43:31 +0000
committertzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-07-08 00:43:31 +0000
commitec6b220aa7a334ccbd0fcb41d35c66560fc78a11 (patch)
tree8ee3f2338f95b3fa67f8512adb8fe4842643c391 /xpp/xdefs.h
parent4e4b79bf56f6477b65973c869e5a8936aea27864 (diff)
xpp Release 1.1.0 :
* FPGA firmware now loaded from PC (for newer models) * Driver for the FXO module (xpd_fxo.ko) * Moved most userspace files to the subdirectory utils (see also next commit) * Explicit license for firmware files * Optionally avoid auto-registration * Registers initializations code is done by a userspace script. * Remove obsolete .inc initialization files (we use user-space init) * Added an install target to the utils dir. * Updated README.Astribank accordingly. * Using RBS signalling, as caller ID did not work well otherwise. * Better handling of USB protocol errors. * Fixed some procfs-related races. * per-card-module ioctls. * fxotune support. * opermode support (set through /etc/default/zaptel for now) * Userspace initialization script can also read registers. * Power calibration works (and implemented in perl) * some fine-tuning to the regster initialization parameters. * Leds turn on before registration and turn off after it. git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@1212 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'xpp/xdefs.h')
-rw-r--r--xpp/xdefs.h74
1 files changed, 47 insertions, 27 deletions
diff --git a/xpp/xdefs.h b/xpp/xdefs.h
index 8c902bd..491e7b6 100644
--- a/xpp/xdefs.h
+++ b/xpp/xdefs.h
@@ -2,7 +2,7 @@
#define XDEFS_H
/*
* Written by Oron Peled <oron@actcom.co.il>
- * Copyright (C) 2004-2005, Xorcom
+ * Copyright (C) 2004-2006, Xorcom
*
* All rights reserved.
*
@@ -26,15 +26,10 @@
#include <linux/kernel.h>
-#define DBG(fmt, ...) \
- ((print_dbg) && printk(KERN_DEBUG "DBG-%s: %s: " fmt, \
- THIS_MODULE->name, __FUNCTION__, ## __VA_ARGS__))
-#define INFO(fmt, ...) printk(KERN_INFO "INFO-%s: " fmt, THIS_MODULE->name, ## __VA_ARGS__)
-#define NOTICE(fmt, ...) printk(KERN_NOTICE "NOTICE-%s: " fmt, THIS_MODULE->name, ## __VA_ARGS__)
-#define ERR(fmt, ...) printk(KERN_ERR "ERR-%s: " fmt, THIS_MODULE->name, ## __VA_ARGS__)
-
#else
+/* This is to enable user-space programs to include this. */
+
#include <stdint.h>
typedef uint32_t __u32;
@@ -50,33 +45,58 @@ struct list_head { struct list_head *next; struct list_head *prev; };
#endif
-typedef char *charp;
-typedef unsigned char byte;
-typedef int bool;
-typedef struct xbus xbus_t;
-typedef struct xpd xpd_t;
-typedef struct xpacket_raw xpacket_raw_t;
-typedef struct xpacket xpacket_t;
-typedef struct xops xops_t;
-typedef __u32 xpp_line_t; /* at most 31 lines for E1 */
+#define PACKED __attribute__((packed))
+#define ALL_LINES ((lineno_t)-1)
-#define BIT_SET(x,i) ((x) |= (1 << (i)))
-#define BIT_CLR(x,i) ((x) &= ~(1 << (i)))
-#define IS_SET(x,i) (((x) & (1 << (i))) != 0)
#define BIT(i) (1 << (i))
+#define BIT_SET(x,i) ((x) |= BIT(i))
+#define BIT_CLR(x,i) ((x) &= ~BIT(i))
+#define IS_SET(x,i) (((x) & BIT(i)) != 0)
+#define BITMASK(i) (BIT(i) - 1)
+
+#define CHANNELS_PERXPD 30 /* Depends on xpp_line_t and protocol fields */
+
+#define MAX_SPANNAME 20 /* From zaptel.h */
+#define MAX_SPANDESC 40 /* From zaptel.h */
+#define MAX_CHANNAME 40 /* From zaptel.h */
+
+#define XPD_NAMELEN 10 /* must be <= from maximal workqueue name */
+#define XPD_DESCLEN 20
+#define XBUS_NAMELEN 20 /* must be <= from maximal workqueue name */
+#define XBUS_DESCLEN 40
+
+#define UNIT_BITS 4 /* Bit for Astribank unit number */
+#define SUBUNIT_BITS 4 /* Bit for Astribank subunit number */
-#undef SUPPORT_USB1
+#define MAX_UNIT 4 /* 1 FXS + 3 FXS/FXO */
+#define MAX_SUBUNIT 1 /* Firmware does not support subunits yet */
-#ifdef SUPPORT_USB1
/*
- * packet size <= 64 bytes:
- * ZT_CHUNKSIZE * 7 channels + header size <= 64
+ * Compile time sanity checks
*/
-#define CHANNELS_PERXPD 7 /* 7 * ZT_CHUNKSIZE + header <= 64 bytes */
-#else
-#define CHANNELS_PERXPD 30 /* Depends on xpp_line_t and protocol fields */
+#if MAX_UNIT > BIT(UNIT_BITS)
+#error "MAX_UNIT too large"
+#endif
+
+#if MAX_SUBUNIT > BIT(SUBUNIT_BITS)
+#error "MAX_SUBUNIT too large"
#endif
+#define MAX_XPDS (MAX_UNIT*MAX_SUBUNIT)
+
+#define VALID_XPD_NUM(x) ((x) < MAX_XPDS && (x) >= 0)
+
+typedef char *charp;
+typedef unsigned char byte;
+typedef int bool;
+typedef struct xbus xbus_t;
+typedef struct xpd xpd_t;
+typedef struct xpacket_raw xpacket_raw_t;
+typedef struct xpacket xpacket_t;
+typedef struct xops xops_t;
+typedef __u32 xpp_line_t; /* at most 31 lines for E1 */
+typedef int lineno_t;
+
#endif /* XDEFS_H */