[Asterisk-cvs] asterisk/apps app_rpt.c,1.23,1.24

jim at lists.digium.com jim at lists.digium.com
Wed Dec 22 00:06:12 CST 2004


Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv22108/apps

Modified Files:
	app_rpt.c 
Log Message:
Made changes to go with pciradio zaptel driver changes


Index: app_rpt.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_rpt.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- app_rpt.c	17 Nov 2004 05:26:36 -0000	1.23
+++ app_rpt.c	22 Dec 2004 05:02:00 -0000	1.24
@@ -329,18 +329,13 @@
 {
 	int flags = ZT_IOMUX_WRITEEMPTY;
 	int res;
-	struct ast_frame *f;	
 
         if ((res = ast_tonepair_start(chan, f1, f2, duration, amplitude)))
                 return res;
                                                                                                                                             
         while(chan->generatordata) {
-                f = ast_read(chan);
-                if (f)
-                        ast_frfree(f);
-                else
-                        return -1;
-        }
+		if (ast_safe_sleep(chan,1)) return -1;
+	}
 
 	/*
 	* Wait for the zaptel driver to physically write the tone blocks to the hardware
@@ -2577,7 +2572,7 @@
 * Shift out a formatted serial bit stream
 */
 
-static void rbi_out(struct rpt *myrpt,unsigned char *data)
+static void rbi_out_parallel(struct rpt *myrpt,unsigned char *data)
     {
     int i,j;
     unsigned char od,d;
@@ -2603,6 +2598,28 @@
         for(delayvar = 1; delayvar < 50000; delayvar++); 
     }
 
+static void rbi_out(struct rpt *myrpt,unsigned char *data)
+{
+struct zt_radio_param r;
+
+	memset(&r,0,sizeof(struct zt_radio_param));
+	r.radpar = ZT_RADPAR_REMMODE;
+	r.data = ZT_RADPAR_REM_RBI1;
+	/* if setparam ioctl fails, its probably not a pciradio card */
+	if (ioctl(myrpt->rxchannel->fds[0],ZT_RADIO_SETPARAM,&r) == -1)
+	{
+		rbi_out_parallel(myrpt,data);
+		return;
+	}
+	r.radpar = ZT_RADPAR_REMCOMMAND;
+	memcpy(&r.data,data,5);
+	if (ioctl(myrpt->rxchannel->fds[0],ZT_RADIO_SETPARAM,&r) == -1)
+	{
+		ast_log(LOG_WARNING,"Cannot send RBI command for channel %s\n",myrpt->rxchannel->name);
+		return;
+	}
+}
+
 static int setrbi(struct rpt *myrpt)
 {
 char tmp[MAXREMSTR] = "",rbicmd[5],*s;




More information about the svn-commits mailing list