diff options
author | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2006-07-06 13:47:05 +0000 |
---|---|---|
committer | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2006-07-06 13:47:05 +0000 |
commit | 39a1812c1ef76b6a792f00087f1e507616bbbb25 (patch) | |
tree | e50633c999779c514ef16f4a2ce7a70fc7511c9e /xpp/xproto.c | |
parent | 70ef1183eba2d2fe4f00668fd3438b7f1c842c94 (diff) |
Tons of updates to the Astribank (xpp) driver:
* xpd_fxo.ko (FXO span) is now operational
* Remove obsolete .inc initialization files (we use user-space init)
* Added an install target to the utils dir.
* Updated README.Astribank accordingly.
* Using RBS signalling, as caller ID did not work well otherwise.
* Better handling of USB protocol errors.
* Fixed some procfs-related races.
* per-card-module ioctls.
* fxotune support.
* opermode support (set through /etc/default/zaptel for now)
* Userspace initialization script can also read registers.
* Power calibration works (and implemented in perl)
* some fine-tuning to the regster initialization parameters.
* Leds turn on before registration and turn off after it.
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@1204 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'xpp/xproto.c')
-rw-r--r-- | xpp/xproto.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/xpp/xproto.c b/xpp/xproto.c index 1fb28c5..7e6dd56 100644 --- a/xpp/xproto.c +++ b/xpp/xproto.c @@ -34,26 +34,25 @@ static int packet_process(xbus_t *xbus, int xpd_num, xpacket_t *pack); static const xproto_table_t *xprotocol_tables[XPD_TYPE_NOMODULE]; +#if MAX_UNIT*MAX_SUBUNIT > MAX_XPDS +#error MAX_XPDS is too small +#endif + bool valid_xpd_addr(const xpd_addr_t *addr) { - return ((addr->bank_num & ~0x1) == 0) && ((addr->card_id & ~0x3) == 0); + return ((addr->subunit & ~0x1) == 0) && ((addr->unit & ~0x3) == 0); } int xpd_addr2num(const xpd_addr_t *addr) { BUG_ON(!valid_xpd_addr(addr)); - return addr->bank_num * 4 + addr->card_id; + return addr->unit + addr->subunit * MAX_UNIT; } void xpd_set_addr(xpd_addr_t *addr, int xpd_num) { - if(xpd_num < 4) { - addr->card_id = xpd_num; - addr->bank_num = 0; - } else { - addr->card_id = xpd_num % 4; - addr->bank_num = xpd_num / 4; - } + addr->unit = xpd_num % MAX_UNIT; + addr->subunit = xpd_num / MAX_UNIT; } @@ -195,7 +194,8 @@ static int packet_process(xbus_t *xbus, int xpd_num, xpacket_t *pack) xe = find_xproto_entry(xpd, op); /*-------- Validations -----------*/ if(!xe) { - ERR("xpp: %s -- bad command op=0x%02X\n", __FUNCTION__, op); + ERR("xpp: %s: %s unit #%d: bad command op=0x%02X\n", + __FUNCTION__, xbus->busname, xpd_num, op); dump_packet("packet_process -- bad command", pack, print_dbg); ret = -EPROTO; goto out; @@ -227,10 +227,10 @@ void dump_packet(const char *msg, xpacket_t *packet, bool print_dbg) if(!print_dbg) return; - DBG("%s: @0x%1X%1X OP=0x%02X LEN=%d\n", + DBG("%s: U=0x%1X S=0x%1X OP=0x%02X LEN=%d\n", msg, - packet->content.addr.bank_num, - packet->content.addr.card_id, + packet->content.addr.unit, + packet->content.addr.subunit, op, (byte)packet->datalen); #if VERBOSE_DEBUG @@ -296,8 +296,14 @@ int xproto_register(const xproto_table_t *proto_table) CHECK_XOP(card_init); CHECK_XOP(card_remove); CHECK_XOP(card_tick); - CHECK_XOP(card_zaptel_registration); + CHECK_XOP(card_zaptel_preregistration); + CHECK_XOP(card_zaptel_postregistration); +#ifdef WITH_RBS + CHECK_XOP(card_hooksig); +#else CHECK_XOP(card_sethook); +#endif + // CHECK_XOP(card_ioctl); // optional method -- call after testing CHECK_XOP(SYNC_SOURCE); CHECK_XOP(PCM_WRITE); CHECK_XOP(CHAN_ENABLE); |