summaryrefslogtreecommitdiff
path: root/xpp/xproto.c
diff options
context:
space:
mode:
Diffstat (limited to 'xpp/xproto.c')
-rw-r--r--xpp/xproto.c34
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);