summaryrefslogtreecommitdiff
path: root/xpp/card_fxo.c
diff options
context:
space:
mode:
authortzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-02-28 01:23:19 +0000
committertzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb>2007-02-28 01:23:19 +0000
commitff8823199f375d709a689dd017950d575b649df6 (patch)
tree7244e80bb45da5f27b747c8bc9aee36b984dd5cd /xpp/card_fxo.c
parent121cb4b570046fe612938d1eb401181c970b4636 (diff)
Merge xpp rev. 3495:
------------------------------------------------------------------------ r2243 | tzafrir | 2007-02-28 02:05:59 +0200 (Wed, 28 Feb 2007) | 4 lines * xpp rev. 3495: fix a race in the FXO driver of recent weeks. * Add the Astribank BRI driver (though still needs bristuffed zaptel to build and thus will not build by default) ------------------------------------------------------------------------ r2239 | tzafrir | 2007-02-27 08:14:18 +0200 (Tue, 27 Feb 2007) | 18 lines Xorcom rev. 3491: * Version of xpp modules is set from xpp/.version, rather than "unknown". * Astribank devices are now initialized in parallel: faster startup when there are multiple Astribanks. * Re-added support for the old format of /proc/xpp/sync write: (echo N 0 > /proc/xpp/sync ) . The new format (SYNC=NN) is preffered. * Firmware update to fix a PCM issue. * Fixed a build issue with kernel 2.6.8 . * Fixed missing initialization in Zaptel::Xpp::Xbus . * genzaptelconf will now set FXS ports as LS by default. To set them as KS, use fxs_default_start=ks in /etc/default/zaptel / /etc/sysconfig/zaptel (Also a workaround for #7755 ). * Groundwork for sync from zaptel master span: if zaptel is built with ZAPTEL_SYNC_TIC (see zaptel/team/tzafrir/sync ), xpp will report its drift from the zaptel sync master. * USB firmware update: had bad lines checksums (and fxload did not report). * fpga_load can now better report bad hex file checksum ;-) . ------------------------------------------------------------------------ r2223 | tzafrir | 2007-02-24 03:05:05 +0200 (Sat, 24 Feb 2007) | 3 lines Add the Zaptel and Zaptel::Xpp perl modules, and some simple utilities that use them. disabled by default for now. ------------------------------------------------------------------------ r2222 | tzafrir | 2007-02-24 02:55:05 +0200 (Sat, 24 Feb 2007) | 2 lines Make the xpp/utils/Makefile in 1.2 closer to the one in 1.4 . git-svn-id: http://svn.digium.com/svn/zaptel/trunk@2247 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'xpp/card_fxo.c')
-rw-r--r--xpp/card_fxo.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/xpp/card_fxo.c b/xpp/card_fxo.c
index 70d6018..ff87120 100644
--- a/xpp/card_fxo.c
+++ b/xpp/card_fxo.c
@@ -417,6 +417,23 @@ int FXO_card_hooksig(xbus_t *xbus, xpd_t *xpd, int pos, zt_txsig_t txsig)
return 0;
}
+static int FXO_card_open(xpd_t *xpd, lineno_t chan)
+{
+ struct FXO_priv_data *priv;
+
+ BUG_ON(!xpd);
+ priv = xpd->priv;
+ /*
+ * We pretend to have battery. If this is really the case
+ * than next calls to update_battery_status() won't change it.
+ * If we don't have battery, than on the next calls to
+ * update_battery_status() a battery_debounce[] cycle would start.
+ * Than, if no-battery is persistent, asterisk would be notified.
+ */
+ BIT_SET(priv->battery, chan);
+ return 0;
+}
+
static void poll_battery(xbus_t *xbus, xpd_t *xpd)
{
int i;
@@ -634,13 +651,17 @@ static void update_battery_status(xpd_t *xpd, byte data_low, lineno_t chipsel)
if(IS_SET(priv->battery, chipsel) && priv->battery_debounce[chipsel]++ > BAT_DEBOUNCE) {
DBG("%s/%s/%d: BATTERY OFF voltage=%d\n", xpd->xbus->busname, xpd->xpdname, chipsel, bat);
BIT_CLR(priv->battery, chipsel);
- update_line_status(xpd, chipsel, 0);
+ if(SPAN_REGISTERED(xpd))
+ zt_qevent_lock(&xpd->chans[chipsel], ZT_EVENT_ALARM);
+
}
} else {
priv->battery_debounce[chipsel] = 0;
if(!IS_SET(priv->battery, chipsel)) {
DBG("%s/%s/%d: BATTERY ON voltage=%d\n", xpd->xbus->busname, xpd->xpdname, chipsel, bat);
BIT_SET(priv->battery, chipsel);
+ if(SPAN_REGISTERED(xpd))
+ zt_qevent_lock(&xpd->chans[chipsel], ZT_EVENT_NOALARM);
}
}
/*
@@ -700,7 +721,6 @@ static void update_power_denial(xpd_t *xpd, byte data_low, lineno_t chipsel)
HANDLER_DEF(FXO, DAA_REPLY)
{
reg_cmd_t *info = &RPACKET_FIELD(pack, FXO, DAA_REPLY, regcmd);
- unsigned long flags;
struct FXO_priv_data *priv;
lineno_t chipsel;
@@ -709,7 +729,6 @@ HANDLER_DEF(FXO, DAA_REPLY)
__FUNCTION__, cmd->name, XPD_NUM(pack->addr));
return -EPROTO;
}
- spin_lock_irqsave(&xpd->lock, flags);
priv = xpd->priv;
BUG_ON(!priv);
chipsel = REG_FIELD(info, chipsel);
@@ -734,7 +753,6 @@ HANDLER_DEF(FXO, DAA_REPLY)
REG_FIELD(&xpd->requested_reply, subreg) == REG_FIELD(info, subreg)) {
xpd->last_reply = *info;
}
- spin_unlock_irqrestore(&xpd->lock, flags);
return 0;
}
@@ -757,12 +775,11 @@ xproto_table_t PROTO_TABLE(FXO) = {
.card_hooksig = FXO_card_hooksig,
.card_tick = FXO_card_tick,
.card_ioctl = FXO_card_ioctl,
+ .card_open = FXO_card_open,
.RING = XPROTO_CALLER(FXO, RING),
.RELAY_OUT = XPROTO_CALLER(FXO, RELAY_OUT),
.XPD_STATE = XPROTO_CALLER(FXO, XPD_STATE),
-
- .SYNC_SOURCE = XPROTO_CALLER(GLOBAL, SYNC_SOURCE),
},
.packet_is_valid = fxo_packet_is_valid,
.packet_dump = fxo_packet_dump,