diff options
author | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2006-05-03 23:06:02 +0000 |
---|---|---|
committer | tzafrir <tzafrir@5390a7c7-147a-4af0-8ec9-7488f05a26cb> | 2006-05-03 23:06:02 +0000 |
commit | 2dd60aaf18e98b0e9d3c06bd9dce5f1128fa55ad (patch) | |
tree | 1a1cd28888f191e6ce83bcbbe539124e2529c90b /xpp/card_global.c | |
parent | 8c4db4e3acd9a7626e709af0494055487b589719 (diff) |
xpp driver release 1.1.0 (first part of commit)
* FPGA firmware now loaded from PC (for newer models)
* Driver for the FXO module
* Moved most userspace files to the subdirectory utils (see also next commit)
* Explicit license for firmware files
* Optionally avoid auto-registration
* Initializations parameters to chips given from userspace
* And did I mention bugfixes?
git-svn-id: http://svn.digium.com/svn/zaptel/trunk@1021 5390a7c7-147a-4af0-8ec9-7488f05a26cb
Diffstat (limited to 'xpp/card_global.c')
-rw-r--r-- | xpp/card_global.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/xpp/card_global.c b/xpp/card_global.c index 8b73f6e..0f81f2c 100644 --- a/xpp/card_global.c +++ b/xpp/card_global.c @@ -1,6 +1,6 @@ /* * Written by Oron Peled <oron@actcom.co.il> - * Copyright (C) 2004-2005, Xorcom + * Copyright (C) 2004-2006, Xorcom * * All rights reserved. * @@ -24,6 +24,7 @@ #include "xpd.h" #include "xpp_zap.h" #include "xproto.h" +#include "zap_debug.h" #include <linux/module.h> static const char rcsid[] = "$Id$"; @@ -65,7 +66,7 @@ static void global_packet_dump(xpacket_t *pack); BUG_ON(!xbus); BUG_ON(!xpd); - lines &= xpd->enabled_chans; + lines &= (xpd->enabled_chans | ~xpd->no_pcm); if(pcm_gen != 0) return 0; // if(lines == 0) @@ -81,7 +82,7 @@ static void global_packet_dump(xpacket_t *pack); XPACKET_NEW(pack, xbus, GLOBAL, PCM_WRITE, xpd->id); RPACKET_FIELD(pack, GLOBAL, PCM_WRITE, lines) = lines; start_pcm = pcm = RPACKET_FIELD(pack, GLOBAL, PCM_WRITE, pcm); - for(i = 0; i < CHANNELS_PERXPD; i++) { + for_each_line(xpd, i) { if(IS_SET(lines, i)) { memcpy(pcm, (byte *)buf, ZT_CHUNKSIZE); pcm += ZT_CHUNKSIZE; @@ -177,7 +178,7 @@ HANDLER_DEF(GLOBAL, PCM_READ) } /* Copy PCM and put each channel in its index */ - for (i = 0; i < CHANNELS_PERXPD; i++) { + for_each_line(xpd, i) { if(IS_SET(lines, i)) { memcpy((u_char *)r, pcm, ZT_CHUNKSIZE); //memset((u_char *)r, 0x5A, ZT_CHUNKSIZE); // DEBUG @@ -195,12 +196,18 @@ HANDLER_DEF(GLOBAL, PCM_READ) HANDLER_DEF(GLOBAL, SYNC_REPLY) { + byte mask = RPACKET_FIELD(pack, GLOBAL, SYNC_REPLY, mask); + bool setit = mask & 0x01; + if(!xpd) { int xpd_num = XPD_NUM(pack->content.addr); NOTICE("%s: received %s for non-existing xpd: %d\n", __FUNCTION__, cmd->name, xpd_num); return -EPROTO; } - DBG("SYNC_REPLY: 0x%X\n", RPACKET_FIELD(pack, GLOBAL, SYNC_REPLY, mask)); + DBG("%s/%s: SYNC_REPLY: 0x%X %s\n", xpd->xbus->busname, xpd->xpdname, + mask, (setit) ? "SET SYNC MASTER" : ""); + if(setit) + sync_master_is(xpd); return 0; } @@ -239,7 +246,7 @@ static bool pcm_valid(xpd_t *xpd, xpacket_t *pack) BUG_ON(!pack); BUG_ON(pack->content.opcode != XPROTO_NAME(GLOBAL, PCM_READ)); - for (i = 0; i < CHANNELS_PERXPD; i++) + for_each_line(xpd, i) if(IS_SET(lines, i)) count++; if(pack->datalen != (sizeof(xpp_line_t) + count * 8)) { |