[svn-commits] tzafrir: trunk r1383 - /trunk/xpp/

svn-commits at lists.digium.com svn-commits at lists.digium.com
Mon Sep 4 14:58:47 MST 2006


Author: tzafrir
Date: Mon Sep  4 16:58:47 2006
New Revision: 1383

URL: http://svn.digium.com/view/zaptel?rev=1383&view=rev
Log:
Minor code cleanup: No more SETHOOK method. It's only used in FXO, so
now it's an internal function: __do_sethook()

Modified:
    trunk/xpp/card_fxo.c
    trunk/xpp/card_fxo.h
    trunk/xpp/card_fxs.c
    trunk/xpp/card_fxs.h
    trunk/xpp/xproto.c
    trunk/xpp/xproto.h

Modified: trunk/xpp/card_fxo.c
URL: http://svn.digium.com/view/zaptel/trunk/xpp/card_fxo.c?rev=1383&r1=1382&r2=1383&view=diff
==============================================================================
--- trunk/xpp/card_fxo.c (original)
+++ trunk/xpp/card_fxo.c Mon Sep  4 16:58:47 2006
@@ -59,7 +59,6 @@
 static /* 0x0F */ DECLARE_CMD(FXO, CHAN_ENABLE, xpp_line_t lines, bool on);
 static /* 0x0F */ DECLARE_CMD(FXO, CHAN_CID, int pos);
 static /* 0x0F */ DECLARE_CMD(FXO, RING, int pos, bool on);
-static /* 0x0F */ DECLARE_CMD(FXO, SETHOOK, int pos, bool offhook);
 static /* 0x0F */ DECLARE_CMD(FXO, RELAY_OUT, byte which, bool on);
 static /* 0x0F */ DECLARE_CMD(FXO, DAA_QUERY, int pos, byte reg_num);
 
@@ -212,6 +211,33 @@
 	}
 }
 
+static __do_sethook(xbus_t *xbus, xpd_t *xpd, int pos, bool 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 = (offhook) ? 0x09 : 0x08;
+	// value |= BIT(3);	/* Bit 3 is for CID */
+	DBG("%s/%s/%d: SETHOOK: value=0x%02X %s\n", xbus->busname, xpd->xpdname, pos, value, (offhook)?"OFFHOOK":"ONHOOK");
+	MARK_LED(xpd, pos, LED_GREEN, (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);
+	pack->datalen = len;
+	packet_send(xbus, pack);
+	if(!offhook)
+		mark_ring(xpd, pos, 0);				// No more rings
+	priv->ring_sig[pos] = 0;
+	return ret;
+}
+
 static void do_sethook(xpd_t *xpd, int pos, bool offhook)
 {
 	unsigned long		flags;
@@ -227,7 +253,7 @@
 	spin_lock_irqsave(&xpd->lock, flags);
 	mark_ring(xpd, pos, 0);				// No more rings
 	priv->ring_sig[pos] = 0;
-	CALL_XMETHOD(SETHOOK, xpd->xbus, xpd, pos, offhook);
+	__do_sethook(xpd->xbus, xpd, pos, offhook);
 	if(offhook) {
 		BIT_SET(xpd->hookstate, pos);
 	} else {
@@ -601,33 +627,6 @@
 	pack->datalen = len;
 
 	packet_send(xbus, pack);
-	return ret;
-}
-
-static /* 0x0F */ HOSTCMD(FXO, SETHOOK, int pos, bool 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 = (offhook) ? 0x09 : 0x08;
-	// value |= BIT(3);	/* Bit 3 is for CID */
-	DBG("%s/%s/%d: SETHOOK: value=0x%02X %s\n", xbus->busname, xpd->xpdname, pos, value, (offhook)?"OFFHOOK":"ONHOOK");
-	MARK_LED(xpd, pos, LED_GREEN, (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);
-	pack->datalen = len;
-	packet_send(xbus, pack);
-	if(!offhook)
-		mark_ring(xpd, pos, 0);				// No more rings
-	priv->ring_sig[pos] = 0;
 	return ret;
 }
 
@@ -806,7 +805,6 @@
 		.card_ioctl	= FXO_card_ioctl,
 
 		.RING		= XPROTO_CALLER(FXO, RING),
-		.SETHOOK	= XPROTO_CALLER(FXO, SETHOOK),
 		.RELAY_OUT	= XPROTO_CALLER(FXO, RELAY_OUT),
 		.CHAN_ENABLE	= XPROTO_CALLER(FXO, CHAN_ENABLE),
 		.CHAN_CID	= XPROTO_CALLER(FXO, CHAN_CID),

Modified: trunk/xpp/card_fxo.h
URL: http://svn.digium.com/view/zaptel/trunk/xpp/card_fxo.h?rev=1383&r1=1382&r2=1383&view=diff
==============================================================================
--- trunk/xpp/card_fxo.h (original)
+++ trunk/xpp/card_fxo.h Mon Sep  4 16:58:47 2006
@@ -32,7 +32,6 @@
 	XPROTO_NAME(FXO, CHAN_ENABLE)		= 0x0F,	/* Write to DAA */
 	XPROTO_NAME(FXO, CHAN_CID)		= 0x0F,	/* Write to DAA */
 	XPROTO_NAME(FXO, RING)			= 0x0F,	/* Write to DAA */
-	XPROTO_NAME(FXO, SETHOOK)		= 0x0F,	/* Write to DAA */
 	XPROTO_NAME(FXO, LED)			= 0x0F,	/* Write to DAA */
 	XPROTO_NAME(FXO, RELAY_OUT)		= 0x0F,	/* Write to DAA */
 	XPROTO_NAME(FXO, DAA_INIT)		= 0x0F,	/* Write to DAA */

Modified: trunk/xpp/card_fxs.c
URL: http://svn.digium.com/view/zaptel/trunk/xpp/card_fxs.c?rev=1383&r1=1382&r2=1383&view=diff
==============================================================================
--- trunk/xpp/card_fxs.c (original)
+++ trunk/xpp/card_fxs.c Mon Sep  4 16:58:47 2006
@@ -77,7 +77,6 @@
 static /* 0x0F */ DECLARE_CMD(FXS, CHAN_ENABLE, xpp_line_t lines, bool on);
 static /* 0x0F */ DECLARE_CMD(FXS, CHAN_CID, int pos);
 static /* 0x0F */ DECLARE_CMD(FXS, RING, int pos, bool on);
-static /* 0x0F */ DECLARE_CMD(FXS, SETHOOK, int pos, bool offhook);
 static /* 0x0F */ DECLARE_CMD(FXS, RELAY_OUT, byte which, bool on);
 static /* 0x0F */ DECLARE_CMD(FXS, SLIC_QUERY, int pos, byte reg_num);
 
@@ -698,12 +697,6 @@
 	return ret;
 }
 
-static /* 0x0F */ HOSTCMD(FXS, SETHOOK, int pos, bool offhook)
-{
-	BUG();	// Should never be called
-	return 0;
-}
-
 static /* 0x0F */ HOSTCMD(FXS, RELAY_OUT, byte which, bool on)
 {
 	int		ret = 0;
@@ -879,7 +872,6 @@
 		.card_tick	= FXS_card_tick,
 
 		.RING		= XPROTO_CALLER(FXS, RING),
-		.SETHOOK	= XPROTO_CALLER(FXS, SETHOOK),
 		.RELAY_OUT	= XPROTO_CALLER(FXS, RELAY_OUT),
 		.CHAN_ENABLE	= XPROTO_CALLER(FXS, CHAN_ENABLE),
 		.CHAN_CID	= XPROTO_CALLER(FXS, CHAN_CID),

Modified: trunk/xpp/card_fxs.h
URL: http://svn.digium.com/view/zaptel/trunk/xpp/card_fxs.h?rev=1383&r1=1382&r2=1383&view=diff
==============================================================================
--- trunk/xpp/card_fxs.h (original)
+++ trunk/xpp/card_fxs.h Mon Sep  4 16:58:47 2006
@@ -33,7 +33,6 @@
 	XPROTO_NAME(FXS, CHAN_POWER)		= 0x0F,	/* Write to SLIC */
 	XPROTO_NAME(FXS, CHAN_CID)		= 0x0F,	/* Write to SLIC */
 	XPROTO_NAME(FXS, RING)			= 0x0F,	/* Write to SLIC */
-	XPROTO_NAME(FXS, SETHOOK)		= 0x0F,	/* Write to SLIC */
 	XPROTO_NAME(FXS, LED)			= 0x0F,	/* Write to SLIC */
 	XPROTO_NAME(FXS, RELAY_OUT)		= 0x0F,	/* Write to SLIC */
 	XPROTO_NAME(FXS, SLIC_INIT)		= 0x0F,	/* Write to SLIC */

Modified: trunk/xpp/xproto.c
URL: http://svn.digium.com/view/zaptel/trunk/xpp/xproto.c?rev=1383&r1=1382&r2=1383&view=diff
==============================================================================
--- trunk/xpp/xproto.c (original)
+++ trunk/xpp/xproto.c Mon Sep  4 16:58:47 2006
@@ -309,7 +309,6 @@
 	CHECK_XOP(CHAN_ENABLE);
 	CHECK_XOP(CHAN_CID);
 	CHECK_XOP(RING);
-	CHECK_XOP(SETHOOK);
 	CHECK_XOP(RELAY_OUT);
 
 	xprotocol_tables[type] = proto_table;

Modified: trunk/xpp/xproto.h
URL: http://svn.digium.com/view/zaptel/trunk/xpp/xproto.h?rev=1383&r1=1382&r2=1383&view=diff
==============================================================================
--- trunk/xpp/xproto.h (original)
+++ trunk/xpp/xproto.h Mon Sep  4 16:58:47 2006
@@ -164,7 +164,6 @@
 	int (*CHAN_ENABLE)(xbus_t *xbus, xpd_t *xpd, xpp_line_t lines, bool on);
 	int (*CHAN_CID)(xbus_t *xbus, xpd_t *xpd, int pos);
 	int (*RING)(xbus_t *xbus, xpd_t *xpd, int pos, bool on);
-	int (*SETHOOK)(xbus_t *xbus, xpd_t *xpd, int pos, bool offhook);
 	int (*RELAY_OUT)(xbus_t *xbus, xpd_t *xpd, byte which, bool on);
 };
 



More information about the svn-commits mailing list