summaryrefslogtreecommitdiff
path: root/xpp/xpd.h
diff options
context:
space:
mode:
authortzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-07-06 13:47:05 +0000
committertzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-07-06 13:47:05 +0000
commit39a1812c1ef76b6a792f00087f1e507616bbbb25 (patch)
treee50633c999779c514ef16f4a2ce7a70fc7511c9e /xpp/xpd.h
parent70ef1183eba2d2fe4f00668fd3438b7f1c842c94 (diff)
Tons of updates to the Astribank (xpp) driver:
* xpd_fxo.ko (FXO span) is now operational * 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/trunk@1204 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'xpp/xpd.h')
-rw-r--r--xpp/xpd.h89
1 files changed, 46 insertions, 43 deletions
diff --git a/xpp/xpd.h b/xpp/xpd.h
index f7efaf1..4de2510 100644
--- a/xpp/xpd.h
+++ b/xpp/xpd.h
@@ -62,20 +62,6 @@
#endif // __KERNEL__
-#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
-
-/* Hardware does not check bank_num yet. So only 4 cards can be used */
-#define MAX_XPDS 4 // 1 FXS + 2 E1/T1 + 1 (Quad * E1/T1)
-
-#define VALID_XPD_NUM(x) ((x) < MAX_XPDS && (x) >= 0)
-
typedef struct xbus_ops xbus_ops_t;
typedef enum xbus_type {
@@ -106,13 +92,12 @@ struct xbus_ops {
*/
enum {
XBUS_N_DESC_REQ,
- XBUS_N_DEV_DESC,
+ XBUS_N_DEV_DESC_FULL,
+ XBUS_N_DEV_DESC_EMPTY,
XBUS_N_PCM_WRITE,
XBUS_N_PCM_READ,
XBUS_N_TX_BYTES,
XBUS_N_RX_BYTES,
- XBUS_N_SOFTSIM_PACKETS,
- XBUS_N_SIM_PACKETS,
};
#define XBUS_COUNTER(xbus, counter) ((xbus)->counters[XBUS_N_ ## counter])
@@ -124,51 +109,72 @@ static struct xbus_counters {
char *name;
} xbus_counters[] = {
C_(DESC_REQ),
- C_(DEV_DESC),
+ C_(DEV_DESC_FULL),
+ C_(DEV_DESC_EMPTY),
C_(PCM_WRITE),
C_(PCM_READ),
C_(TX_BYTES),
C_(RX_BYTES),
- C_(SOFTSIM_PACKETS),
- C_(SIM_PACKETS),
};
#undef C_
#define XBUS_COUNTER_MAX ARRAY_SIZE(xbus_counters)
+#define CARD_DESC_MAGIC 0xca9dde5c
+
+struct card_desc_struct {
+ struct list_head card_list;
+ u32 magic;
+ xbus_t *xbus;
+ byte rev; /* Revision number */
+ byte type; /* LSB: 1 - to_phone, 0 - to_line */
+ xpd_addr_t xpd_addr;
+};
+
+
/*
* An xbus is a transport layer for Xorcom Protocol commands
*/
struct xbus {
- char busname[XBUS_NAMELEN]; /* only xbus_new set this */
- char busdesc[XBUS_DESCLEN]; /* lowlevel drivers set this */
- int num;
- xbus_ops_t *ops;
- struct xpd *xpds[MAX_XPDS];
- int max_packet_size;
+ char busname[XBUS_NAMELEN]; /* only xbus_new set this */
+ char busdesc[XBUS_DESCLEN]; /* lowlevel drivers set this */
+ int num;
+ xbus_ops_t *ops;
+ struct xpd *xpds[MAX_XPDS];
+ int max_packet_size;
/* Device-Model */
- struct device the_bus;
+ struct device the_bus;
/* Simulator data */
- xbus_type_t bus_type;
-
- spinlock_t lock;
+ xbus_type_t bus_type;
- bool hardware_exists; /* Hardware is functional */
- int open_counter; /* Number of open channels */
- atomic_t packet_counter; /* Allocated packets */
- wait_queue_head_t packet_cache_empty;
+ spinlock_t lock;
- struct timer_list poll_timer;
- struct rw_semaphore in_use;
- int num_xpds;
- void *priv; /* Pointer to transport level data structures */
+ bool hardware_exists; /* Hardware is functional */
+ int open_counter; /* Number of open channels */
+ atomic_t packet_counter; /* Allocated packets */
+ wait_queue_head_t packet_cache_empty;
+
+ struct timer_list poll_timer;
+ /*
+ * Bus scanning
+ */
+ atomic_t count_poll_answers;
+ struct list_head poll_results;
+ wait_queue_head_t wait_for_polls;
+ struct work_struct xpds_init_work;
+ struct completion xpds_initialized;
+
+ struct rw_semaphore in_use;
+ int num_xpds;
+ void *priv; /* Pointer to transport level data structures */
#ifdef CONFIG_PROC_FS
struct proc_dir_entry *proc_xbus_dir;
struct proc_dir_entry *proc_xbus_summary;
+ struct proc_dir_entry *proc_xbus_waitfor_xpds;
#endif
/* statistics */
@@ -236,9 +242,9 @@ struct xpd {
xpd_type_t type;
byte revision; /* Card revision */
xpd_direction_t direction; /* TO_PHONE, TO_PSTN */
- xpp_line_t enabled_chans; /* hardware activation: 0 - off, 1 - on */
xpp_line_t no_pcm; /* Temporary: disable PCM (for USB-1) */
xpp_line_t hookstate; /* Actual chip state: 0 - ONHOOK, 1 - OFHOOK */
+ xpp_line_t cid_on;
xpp_line_t digital_outputs; /* 0 - no, 1 - yes */
xpp_line_t digital_inputs; /* 0 - no, 1 - yes */
@@ -276,6 +282,7 @@ struct xpd {
unsigned int seq_errors;
unsigned long last_response; /* in jiffies */
unsigned id;
+ xpd_addr_t addr;
struct list_head xpd_list;
unsigned int timer_count;
volatile u_char *writechunk; /* Double-word aligned write memory */
@@ -288,10 +295,6 @@ struct xpd {
#define for_each_line(xpd,i) \
for((i) = 0; (i) < (xpd)->channels; (i)++)
-#define for_each_enabled_line(xpd,i) \
- for((i) = 0; (i) < (xpd)->channels; (i)++) \
- if(IS_SET((xpd)->enabled_chans,(i)))
-
#endif
#endif /* XPD_H */