Example #1
0
static void xbus_tick(xbus_t *xbus)
{
	int		i;
	xpd_t		*xpd;
	xframe_t	*xframe = NULL;
	xpacket_t	*pack = NULL;
	size_t		pcm_len;
	bool		sent_sync_bit = 0;

	/*
	 * Update zaptel
	 */
	for(i = 0; i < MAX_XPDS; i++) {
		xpd = xpd_of(xbus, i);
		if(xpd && SPAN_REGISTERED(xpd)) {
#ifdef	OPTIMIZE_CHANMUTE
			int		j;
			xpp_line_t	xmit_mask = xpd->wanted_pcm_mask;
			
			xmit_mask |= xpd->silence_pcm;
			xmit_mask |= xpd->digital_signalling;
			for_each_line(xpd, j) {
				xpd->chans[j].chanmute = (optimize_chanmute)
					? !IS_SET(xmit_mask, j)
					: 0;
			}
#endif
			/*
			 * calls to zt_transmit should be out of spinlocks, as it may call back
			 * our hook setting methods.
			 */
			zt_transmit(&xpd->span);
		}
	}
Example #2
0
static void torisa_tasklet(unsigned long data)
{
	int x,y;
	u_char mychunk[2][ZT_CHUNKSIZE];
	taskletrun++;
	if (taskletpending) {
		taskletexec++;
		/* Perform receive data calculations.  Reverse to run most
		   likely master last */
		if (spans[1].flags & ZT_FLAG_RUNNING) {
			/* Perform echo cancellation */
			for (x=0;x<channels_per_span;x++) 
			{
				for(y = 0; y < ZT_CHUNKSIZE; y++)
				{
					mychunk[1][y] = last_ecwrite[1][x];
					last_ecwrite[1][x] = 
						writedata[1-curread][x + channels_per_span][y];
				}
				zt_ec_chunk(&spans[1].chans[x], 
					spans[1].chans[x].readchunk,mychunk[1]);
			}
			zt_receive(&spans[1]);
		}
		if (spans[0].flags & ZT_FLAG_RUNNING) {
			/* Perform echo cancellation */
			for (x=0;x<channels_per_span;x++) 
			{
				for(y = 0; y < ZT_CHUNKSIZE; y++)
				{
					mychunk[0][y] = last_ecwrite[0][x];
					last_ecwrite[0][x] = writedata[1-curread][x][y];
				}
				zt_ec_chunk(&spans[0].chans[x], 
					spans[0].chans[x].readchunk,mychunk[0]);
			}
			zt_receive(&spans[0]);
		}
	
		/* Prepare next set for transmission */
		if (spans[1].flags & ZT_FLAG_RUNNING)
			zt_transmit(&spans[1]);
		if (spans[0].flags & ZT_FLAG_RUNNING)
			zt_transmit(&spans[0]);
	}
	taskletpending = 0;
}
static void ztdummy_timer(void *arg)
{
    struct ztdummy_state *ztd;

    ztd = ddi_get_soft_state(ztdummy_statep, 0);
    zt_receive(&ztd->span);
    zt_transmit(&ztd->span);
}