summaryrefslogtreecommitdiff
path: root/xpp/xpp_zap.c
diff options
context:
space:
mode:
authortzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-09-06 05:14:22 +0000
committertzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2006-09-06 05:14:22 +0000
commit3657d8f829223072c78d8054f325ef0ac134cc18 (patch)
tree0a610d33f59cfb47f178e805bdfaf7dca8c2e837 /xpp/xpp_zap.c
parent9f615ebcb22c35e982c327d00d6d685d8c056cd5 (diff)
More cleanup:
xpp_zap.c: * Remove old and long unused character device interface. * Show some extra fields in XPD summary proc file. * Move atomic_dec() to correct position card_fxs.c: Remove unused label. git-svn-id: http://svn.digium.com/svn/zaptel/trunk@1409 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'xpp/xpp_zap.c')
-rw-r--r--xpp/xpp_zap.c132
1 files changed, 18 insertions, 114 deletions
diff --git a/xpp/xpp_zap.c b/xpp/xpp_zap.c
index d9d413d..698ef2a 100644
--- a/xpp/xpp_zap.c
+++ b/xpp/xpp_zap.c
@@ -56,7 +56,6 @@ struct proc_dir_entry *xpp_proc_toplevel = NULL;
#define PROC_XPD_SUMMARY "summary"
#endif
-#define XPP_CTL_MAJOR 42
#define MAX_QUEUE_LEN 10000
#define SAMPLE_TICKS 10000
#define DELAY_UNTIL_DIALTONE 3000
@@ -407,10 +406,22 @@ static int xpd_read_proc(char *page, char **start, off_t off, int count, int *eo
for_each_line(xpd, i) {
len += sprintf(page + len, "%d ", IS_SET(xpd->cid_on, i));
}
+ len += sprintf(page + len, "\n\t%-17s: ", "lasttxhook");
+ for_each_line(xpd, i) {
+ len += sprintf(page + len, "%d ", xpd->lasttxhook[i]);
+ }
+ len += sprintf(page + len, "\n\t%-17s: ", "idletxhookstate");
+ for_each_line(xpd, i) {
+ len += sprintf(page + len, "%d ", xpd->idletxhookstate[i]);
+ }
len += sprintf(page + len, "\n\t%-17s: ", "ringing");
for_each_line(xpd, i) {
len += sprintf(page + len, "%d ", xpd->ringing[i]);
}
+ len += sprintf(page + len, "\n\t%-17s: ", "no_pcm");
+ for_each_line(xpd, i) {
+ len += sprintf(page + len, "%d ", IS_SET(xpd->no_pcm, i));
+ }
#if 1
if(SPAN_REGISTERED(xpd)) {
len += sprintf(page + len, "\nPCM:\n | [readchunk] | [writechunk] | delay");
@@ -431,7 +442,7 @@ static int xpd_read_proc(char *page, char **start, off_t off, int count, int *eo
wp = chans[i].writechunk;
#else
rp = (byte *)xpd->readchunk + (ZT_CHUNKSIZE * i);
- wp = chans[i].writechunk;
+ wp = (byte *)xpd->writechunk + (ZT_CHUNKSIZE * i);
#endif
memcpy(rchunk, rp, ZT_CHUNKSIZE);
memcpy(wchunk, wp, ZT_CHUNKSIZE);
@@ -1292,16 +1303,15 @@ static int zaptel_unregister_xpd(xpd_t *xpd)
spin_lock_irqsave(&xpd->lock, flags);
if(!SPAN_REGISTERED(xpd)) {
- NOTICE("%s: %s is already unregistered\n", __FUNCTION__, xpd->xpdname);
+ NOTICE("%s/%s is already unregistered\n", xpd->xbus->busname, xpd->xpdname);
spin_unlock_irqrestore(&xpd->lock, flags);
return -EIDRM;
}
- atomic_dec(&xpd->zt_registered);
if(sync_master == xpd)
sync_master_is(NULL); // FIXME: it's better to elect a new prince
update_xpd_status(xpd, ZT_ALARM_NOTOPEN);
if(atomic_read(&xpd->open_counter)) {
- NOTICE("%s: %s is busy (open_counter=%d). Skipping.\n", __FUNCTION__, xpd->xpdname, atomic_read(&xpd->open_counter));
+ NOTICE("%s/%s is busy (open_counter=%d). Skipping.\n", xpd->xbus->busname, xpd->xpdname, atomic_read(&xpd->open_counter));
spin_unlock_irqrestore(&xpd->lock, flags);
return -EBUSY;
}
@@ -1309,6 +1319,7 @@ static int zaptel_unregister_xpd(xpd_t *xpd)
spin_unlock_irqrestore(&xpd->lock, flags);
if(xpd->card_present)
xpd->xops->card_zaptel_preregistration(xpd, 0);
+ atomic_dec(&xpd->zt_registered);
zt_unregister(&xpd->span);
if(xpd->card_present)
xpd->xops->card_zaptel_postregistration(xpd, 0);
@@ -1389,112 +1400,12 @@ static int xpp_zap_write_proc(struct file *file, const char __user *buffer, unsi
#endif
-/*------------------------- File Operations ------------------------*/
-
-#define MINOR_XBUS_NUM(m) ((m) >> 4)
-#define MINOR_XPD_NUM(m) ((m) & 0xF);
-
-#if 0
-static int xpp_sys_open (struct inode * inode, struct file * file)
-{
- xbus_t *xbus;
- unsigned int minor = iminor(inode);
- unsigned int busnum = MINOR_XBUS_NUM(minor);
- unsigned long flags;
-
- spin_lock_irqsave(&xbuses_lock, flags);
- xbus = xbus_of(busnum);
- spin_unlock_irqrestore(&xbuses_lock, flags);
- if(xbus == NULL)
- return -ENODEV;
- file->private_data = xbus;
- DBG("unit %d xbus %s\n", busnum, xbus->busname);
- return 0;
-}
-
-static int xpp_sys_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
-{
- switch(cmd) {
- default:
- return -ENOTTY;
- }
- return 0;
-}
-
-static int xpp_sys_release (struct inode * inode, struct file * file)
-{
- unsigned int minor = iminor(inode);
- unsigned int busnum = MINOR_XBUS_NUM(minor);
- xbus_t *xbus = file->private_data;
- DBG("unit %d xbus %s\n", busnum, xbus->busname);
- if(xbus == NULL) {
- ERR("xpp_sys_release: xbus has dissappeared\n");
- return -EINVAL;
- }
- return 0;
-}
-
-#if 0
-static ssize_t xpp_sys_write (struct file * file, const char __user * buf,
- size_t count, loff_t * ppos)
-{
- unsigned int minor = iminor(file->f_dentry->d_inode);
- unsigned int busnum = MINOR_XBUS_NUM(minor);
- int xpdnum = MINOR_XPD_NUM(minor)
- xbus_t *xbus = file->private_data;
- xpacket_t *pack_tx;
-
- DBG("count=%d from %d/%d xbus %s\n", count, busnum, xpdnum, xbus->busname);
- if(xbus == NULL) {
- ERR("xpp_sys_write: xbus has dissappeared\n");
- return -EINVAL;
- }
- if(count == 0)
- return 0;
- if(count >= sizeof(xpacket_raw_t)) {
- DBG("count=%d, partial write...\n", count);
- count = sizeof(xpacket_raw_t);
- }
- pack_tx = xbus->ops->packet_new(xbus, GFP_KERNEL);
- if (!pack_tx) {
- return -ENOMEM;
- }
- if (copy_from_user (pack_tx->content.raw, buf, count)) {
- return -EFAULT;
- }
- xpd_set_addr(&pack_tx->content.addr, xpdnum);
- pack_tx->datalen = count;
- // pack_tx->flags |= XPP_PACKET_FIREANDFORGET;
- DBG("sending op=%d to %d\n", pack_tx->content.opcode, xpdnum);
- xbus_reset_counters(xbus);
- pcm_write_enable = 1;
- packet_send(xbus, pack_tx);
- return count;
-}
-#endif
-
-static struct file_operations xpp_fops = {
- .owner = THIS_MODULE,
- .llseek = no_llseek,
-#if 0
- .write = xpp_sys_write,
-#endif
- .ioctl = xpp_sys_ioctl,
- .open = xpp_sys_open,
- .release = xpp_sys_release,
-};
-
-#endif
-
/*------------------------- Initialization -------------------------*/
static void do_cleanup(void)
{
if(timer_pending(&xpp_timer))
del_timer_sync(&xpp_timer);
-#if 0
- unregister_chrdev(XPP_CTL_MAJOR, THIS_MODULE->name);
-#endif
#ifdef CONFIG_PROC_FS
DBG("Removing '%s' from proc\n", PROC_SYNC);
remove_proc_entry(PROC_SYNC, xpp_proc_toplevel);
@@ -1511,7 +1422,8 @@ int __init xpp_zap_init(void)
int ret;
struct proc_dir_entry *ent;
- INFO("%s revision %s\n", THIS_MODULE->name, ZAPTEL_VERSION);
+ INFO("%s revision %s MAX_XPDS=%d\n", THIS_MODULE->name, ZAPTEL_VERSION,
+ MAX_XPDS);
#ifdef WITH_RBS
INFO("FEATURE: %s (RBS signalling)\n", THIS_MODULE->name);
#else
@@ -1550,14 +1462,6 @@ int __init xpp_zap_init(void)
do_cleanup();
return ret;
}
-
-#if 0
- if (register_chrdev(XPP_CTL_MAJOR, THIS_MODULE->name, &xpp_fops)) {
- printk (KERN_WARNING "%s: unable to get major %d\n", THIS_MODULE->name, XPP_CTL_MAJOR);
- do_cleanup();
- return -EIO;
- }
-#endif
/* Only timer init. We add it only *after* zt_register */
init_timer(&xpp_timer);