FreeBSD/contrib/ntp/util/tg2.c
/*
 * Generate cycles of 100 Hz or any multiple of 100 Hz.
 */
Generate cycles of 100 Hz or any multiple of 100 Hz.
Generate cycles of 100 Hz or any multiple of 100 Hz .
void peep(
	int	pulse,		
	int	freq,		
	int	amp		
	)
{
	int	increm;		
	int	i, j;
	if (amp == OFF || freq == 0)
		increm = 10;
	else
		increm = freq / 100;
	j = 0;
	for (i = 0 ; i < pulse * 8; i++) {
		switch (amp) {
		case HIGH:
			buffer[bufcnt++] = ~c6000[j];
			break;
		case LOW:
			buffer[bufcnt++] = ~c3000[j];
			break;
		default:
			buffer[bufcnt++] = ~0;
		}
		if (bufcnt >= BUFLNG) {
			write(fd, buffer, BUFLNG);
			bufcnt = 0;
		}
		j = (j + increm) % 80;
	}
}
void peep ( int pulse , int freq , int amp ) { int increm ; int i , j ; if ( amp == OFF || freq == 0 ) increm = 10 ; else increm = freq / 100 ; j = 0 ; for ( i = 0 ; i < pulse * 8 ; i ++ ) { switch ( amp ) { case HIGH : buffer [ bufcnt ++ ] = ~ c6000 [ j ] ; break ; case LOW : buffer [ bufcnt ++ ] = ~ c3000 [ j ] ; break ; default : buffer [ bufcnt ++ ] = ~ 0 ; } if ( bufcnt >= BUFLNG ) { write ( fd , buffer , BUFLNG ) ; bufcnt = 0 ; } j = ( j + increm ) % 80 ; } }
Generate cycles of 100 Hz or any multiple of 100 Hz.
Generate cycles of 100 Hz or any multiple of 100 Hz .
/* pulse length (ms) */ /* frequency (Hz) */ /* amplitude */ /* phase increment */