diff options
Diffstat (limited to 'xpp/xdefs.h')
-rw-r--r-- | xpp/xdefs.h | 74 |
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 */ |