diff options
author | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2007-09-14 22:29:36 +0000 |
---|---|---|
committer | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2007-09-14 22:29:36 +0000 |
commit | c91b2cd29653da525d1a37cf680f4a75b2d3b208 (patch) | |
tree | f26185291a7ebb24902a2737d6e5b1fed75bb8c1 /xpp/card_fxo.c | |
parent | 236601045ee0a95930414d8d5f822d9a61054aae (diff) |
New xpp release (Xorcom rev 4648):
* New firmware protocol version: 2.8 .
* New firmwares fix input ports offhook.
* Cleanup INFO() messages during module loading.
* USB: Receive queue with TASKLETS [r4600]. Controlled by rx_tasklet
parameter to xpp_usb module (can be changed in runtime).
* The pcm_tasklet parameter in xpp module is deprecated:
- Does not actually do anything.
- If set during module loading, shows an ERR() message.
- Also appears in /proc/xpp/sync
* FXS: Hardware DTMF detection by default, can be disabled
by setting dtmf_detection=0 parameter to xpd_fxs.
PCM is muted when DTMF key is pressed.
* zapconf:
- Can now generate users.conf compatible with asterisk-gui.
- Optional command-line arguments denoting which files to generate.
Possible values are 'zaptel', 'zapata' and 'users'.
- Defaults to creating zaptel and zapata.
git-svn-id: http://svn.digium.com/svn/zaptel/branches/1.2@3019 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'xpp/card_fxo.c')
-rw-r--r-- | xpp/card_fxo.c | 61 |
1 files changed, 13 insertions, 48 deletions
diff --git a/xpp/card_fxo.c b/xpp/card_fxo.c index 2063433..e22fe50 100644 --- a/xpp/card_fxo.c +++ b/xpp/card_fxo.c @@ -57,12 +57,11 @@ enum fxo_leds { #define BAT_THRESHOLD 3 #define BAT_DEBOUNCE 3 /* compensate for battery voltage fluctuation (in poll_battery_interval's) */ -static /* 0x0F */ DECLARE_CMD(FXO, REGISTER_REQUEST, byte chipsel, bool writing, bool do_subreg, byte regnum, byte subreg, byte data_low, byte data_high); /* Shortcuts */ #define DAA_WRITE 1 #define DAA_READ 0 #define DAA_DIRECT_REQUEST(xbus,xpd,chipsel,writing,reg,dL) \ - CALL_PROTO(FXO, REGISTER_REQUEST, (xbus), (xpd), (chipsel), (writing), 0, (reg), 0, (dL), 0) + xpp_register_request((xbus), (xpd), (chipsel), (writing), 0, (reg), 0, (dL), 0) #define VALID_CHIPSEL(x) (((chipsel) >= 0 && (chipsel) <= 7) || (chipsel) == ALL_CHANS) @@ -200,7 +199,7 @@ static void handle_fxo_leds(xpd_t *xpd) spin_unlock_irqrestore(&xpd->lock, flags); } -void update_zap_ring(xpd_t *xpd, int pos, bool on) +static void update_zap_ring(xpd_t *xpd, int pos, bool on) { zt_rxsig_t rxsig; @@ -463,7 +462,7 @@ static int FXO_card_zaptel_postregistration(xpd_t *xpd, bool on) return 0; } -int FXO_card_hooksig(xbus_t *xbus, xpd_t *xpd, int pos, zt_txsig_t txsig) +static int FXO_card_hooksig(xbus_t *xbus, xpd_t *xpd, int pos, zt_txsig_t txsig) { struct FXO_priv_data *priv; @@ -622,36 +621,7 @@ static int FXO_card_ioctl(xpd_t *xpd, int pos, unsigned int cmd, unsigned long a /*---------------- FXO: HOST COMMANDS -------------------------------------*/ -/* 0x0F */ HOSTCMD(FXO, REGISTER_REQUEST, byte chipsel, bool writing, bool do_subreg, byte regnum, byte subreg, byte data_low, byte data_high) -{ - int ret = 0; - xframe_t *xframe; - xpacket_t *pack; - reg_cmd_t *reg_cmd; - - if(!xbus) { - DBG(REGS, "NO XBUS\n"); - return -EINVAL; - } - XFRAME_NEW(xframe, pack, xbus, GLOBAL, REGISTER_REQUEST, xpd->xbus_idx); - LINE_DBG(REGS, xpd, chipsel, "%c%c R%02X S%02X %02X %02X\n", - (writing)?'W':'R', - (do_subreg)?'S':'D', - regnum, subreg, data_low, data_high); - reg_cmd = &RPACKET_FIELD(pack, GLOBAL, REGISTER_REQUEST, reg_cmd); - reg_cmd->bytes = sizeof(*reg_cmd) - 1; // do not count the 'bytes' field - REG_FIELD(reg_cmd, chipsel) = chipsel; - REG_FIELD(reg_cmd, read_request) = (writing) ? 0 : 1; - REG_FIELD(reg_cmd, do_subreg) = do_subreg; - REG_FIELD(reg_cmd, regnum) = regnum; - REG_FIELD(reg_cmd, subreg) = subreg; - REG_FIELD(reg_cmd, data_low) = data_low; - REG_FIELD(reg_cmd, data_high) = data_high; - ret = send_cmd_frame(xbus, xframe); - return ret; -} - -static /* 0x0F */ HOSTCMD(FXO, XPD_STATE, bool on) +/* 0x0F */ HOSTCMD(FXO, XPD_STATE, bool on) { int ret = 0; struct FXO_priv_data *priv; @@ -664,7 +634,7 @@ static /* 0x0F */ HOSTCMD(FXO, XPD_STATE, bool on) return ret; } -static /* 0x0F */ HOSTCMD(FXO, RING, lineno_t chan, bool on) +/* 0x0F */ HOSTCMD(FXO, RING, lineno_t chan, bool on) { BUG_ON(!xbus); BUG_ON(!xpd); @@ -672,7 +642,7 @@ static /* 0x0F */ HOSTCMD(FXO, RING, lineno_t chan, bool on) return DAA_DIRECT_REQUEST(xbus, xpd, chan, DAA_WRITE, 0x40, (on)?0x04:0x01); } -static /* 0x0F */ HOSTCMD(FXO, RELAY_OUT, byte which, bool on) +/* 0x0F */ HOSTCMD(FXO, RELAY_OUT, byte which, bool on) { return -ENOSYS; } @@ -688,7 +658,7 @@ HANDLER_DEF(FXO, SIG_CHANGED) struct FXO_priv_data *priv; if(!xpd) { - notify_bad_xpd(__FUNCTION__, xbus, pack->addr, cmd->name); + notify_bad_xpd(__FUNCTION__, xbus, XPACKET_ADDR(pack), cmd->name); return -EPROTO; } priv = xpd->priv; @@ -707,7 +677,7 @@ HANDLER_DEF(FXO, SIG_CHANGED) /* First report false ring alarms */ debounce = atomic_read(&priv->ring_debounce[i]); if(debounce) - LINE_NOTICE(xpd, i, "debounced %d ticks\n", debounce); + LINE_NOTICE(xpd, i, "debounced false ring (only %d ticks)\n", debounce); /* * Now set a new ring alarm. * It will be checked in handle_fxo_ring() @@ -836,16 +806,11 @@ static void update_metering_state(xpd_t *xpd, byte data_low, lineno_t chipsel) } #endif -HANDLER_DEF(FXO, DAA_REPLY) +static int FXO_card_register_reply(xbus_t *xbus, xpd_t *xpd, reg_cmd_t *info) { - reg_cmd_t *info = &RPACKET_FIELD(pack, FXO, DAA_REPLY, regcmd); struct FXO_priv_data *priv; lineno_t chipsel; - if(!xpd) { - notify_bad_xpd(__FUNCTION__, xbus, pack->addr, cmd->name); - return -EPROTO; - } priv = xpd->priv; BUG_ON(!priv); chipsel = REG_FIELD(info, chipsel); @@ -862,7 +827,7 @@ HANDLER_DEF(FXO, DAA_REPLY) break; #endif } - LINE_DBG(REGS, xpd, chipsel, "DAA_REPLY: %c reg_num=0x%X, dataL=0x%X dataH=0x%X\n", + LINE_DBG(REGS, xpd, chipsel, "%c reg_num=0x%X, dataL=0x%X dataH=0x%X\n", ((info->bytes == 3)?'I':'D'), REG_FIELD(info, regnum), REG_FIELD(info, data_low), @@ -878,12 +843,11 @@ HANDLER_DEF(FXO, DAA_REPLY) } -xproto_table_t PROTO_TABLE(FXO) = { +static xproto_table_t PROTO_TABLE(FXO) = { .owner = THIS_MODULE, .entries = { /* Prototable Card Opcode */ XENTRY( FXO, FXO, SIG_CHANGED ), - XENTRY( FXO, FXO, DAA_REPLY ), }, .name = "FXO", .type = XPD_TYPE_FXO, @@ -899,6 +863,7 @@ xproto_table_t PROTO_TABLE(FXO) = { .card_pcm_tospan = generic_card_pcm_tospan, .card_ioctl = FXO_card_ioctl, .card_open = FXO_card_open, + .card_register_reply = FXO_card_register_reply, .RING = XPROTO_CALLER(FXO, RING), .RELAY_OUT = XPROTO_CALLER(FXO, RELAY_OUT), @@ -913,7 +878,7 @@ static bool fxo_packet_is_valid(xpacket_t *pack) const xproto_entry_t *xe; //DBG(GENERAL, "\n"); - xe = xproto_card_entry(&PROTO_TABLE(FXO), pack->opcode); + xe = xproto_card_entry(&PROTO_TABLE(FXO), XPACKET_OP(pack)); return xe != NULL; } |