[zaptel-commits] tzafrir: trunk r1408 - /trunk/xpp/card_fxo.c
zaptel-commits at lists.digium.com
zaptel-commits at lists.digium.com
Tue Sep 5 22:08:32 MST 2006
Author: tzafrir
Date: Wed Sep 6 00:08:32 2006
New Revision: 1408
URL: http://svn.digium.com/view/zaptel?rev=1408&view=rev
Log:
Begin merging a small set of clean-ups:
* __do_sethook() was gone and merged into do_sethook().
* Use DAA_RING_REGISTER constant instead of a number.
Modified:
trunk/xpp/card_fxo.c
Modified: trunk/xpp/card_fxo.c
URL: http://svn.digium.com/view/zaptel/trunk/xpp/card_fxo.c?rev=1408&r1=1407&r2=1408&view=diff
==============================================================================
--- trunk/xpp/card_fxo.c (original)
+++ trunk/xpp/card_fxo.c Wed Sep 6 00:08:32 2006
@@ -76,8 +76,8 @@
#define POLL_RING_INTERVAL 2
#define RING_THRESHOLD 3
#define NORING_THRESHOLD 10
+#endif
#define DAA_RING_REGISTER 0x05
-#endif
struct FXO_priv_data {
struct proc_dir_entry *xpd_slic;
@@ -214,50 +214,38 @@
}
}
-static int __do_sethook(xbus_t *xbus, xpd_t *xpd, int pos, bool to_offhook)
-{
- int ret = 0;
- xpacket_t *pack;
- slic_cmd_t *sc;
- int len;
- bool value;
- struct FXO_priv_data *priv;
-
- BUG_ON(!xbus);
- BUG_ON(!xpd);
- priv = (struct FXO_priv_data*)xpd->priv;
- value = (to_offhook) ? 0x09 : 0x08;
- // value |= BIT(3); /* Bit 3 is for CID */
+static int do_sethook(xpd_t *xpd, int pos, bool to_offhook)
+{
+ unsigned long flags;
+ xbus_t *xbus;
+ struct FXO_priv_data *priv;
+ int ret = 0;
+ bool value;
+ xpacket_t *pack;
+ slic_cmd_t *sc;
+ int len;
+
+ BUG_ON(!xpd);
+ BUG_ON(xpd->direction == TO_PHONE); // We can SETHOOK state only on PSTN
+ xbus = xpd->xbus;
+ priv = xpd->priv;
+ BUG_ON(!priv);
+ if(!IS_SET(priv->battery, pos)) {
+ NOTICE("%s/%s/%d: WARNING: called while battery is off\n", xbus->busname, xpd->xpdname, pos);
+ }
+ spin_lock_irqsave(&xpd->lock, flags);
+ mark_ring(xpd, pos, 0); // No more rings
+ value = (to_offhook) ? 0x09 : 0x08; /* Bit 3 is for CID */
DBG("%s/%s/%d: SETHOOK: value=0x%02X %s\n", xbus->busname, xpd->xpdname, pos, value, (to_offhook)?"OFFHOOK":"ONHOOK");
MARK_LED(xpd, pos, LED_GREEN, (to_offhook)?LED_ON:LED_OFF);
XPACKET_NEW(pack, xbus, FXO, DAA_WRITE, xpd->id);
sc = &RPACKET_FIELD(pack, FXO, DAA_WRITE, slic_cmd);
- len = slic_cmd_direct_write(sc, BIT(pos), 0x05, value);
+ len = slic_cmd_direct_write(sc, BIT(pos), DAA_RING_REGISTER, value);
pack->datalen = len;
packet_send(xbus, pack);
- if(!to_offhook)
- mark_ring(xpd, pos, 0); // No more rings
#ifdef SOFT_RING
priv->ring_sig[pos] = 0;
#endif
- return ret;
-}
-
-static void do_sethook(xpd_t *xpd, int pos, bool to_offhook)
-{
- unsigned long flags;
- struct FXO_priv_data *priv;
-
- BUG_ON(!xpd);
- BUG_ON(xpd->direction == TO_PHONE); // We can SETHOOK state only on PSTN
- priv = xpd->priv;
- BUG_ON(!priv);
- if(!IS_SET(priv->battery, pos)) {
- NOTICE("%s/%s/%d: WARNING: called while battery is off\n", xpd->xbus->busname, xpd->xpdname, pos);
- }
- spin_lock_irqsave(&xpd->lock, flags);
- mark_ring(xpd, pos, 0); // No more rings
- __do_sethook(xpd->xbus, xpd, pos, to_offhook);
if(to_offhook) {
BIT_SET(xpd->offhook, pos);
} else {
@@ -268,6 +256,7 @@
spin_unlock_irqrestore(&xpd->lock, flags);
if(to_offhook)
wake_up_interruptible(&xpd->txstateq[pos]);
+ return ret;
}
/*---------------- FXO: Methods -------------------------------------------*/
More information about the zaptel-commits
mailing list