Several example programs are provided in the Examples/ASI directory
and are described below.


Asicfg
------

NAME
	asicfg - configure a DVB ASI interface

SYNOPSIS
	asicfg [OPTION]... DEVICE_FILE

DESCRIPTION
	Asicfg uses the sysfs virtual filesystem to configure certain parameters
	of a DVB ASI interface. If no options are given, asicfg
	displays the current configuration of the interface.

OPTIONS
	-b BUFFERS
		Set the number of driver buffers on DEVICE_FILE to BUFFERS.
		There must be at least two buffers.
	-c
		Enable the 27 MHz counter on DEVICE_FILE.
	-C
		Disable the 27 MHz counter on DEVICE_FILE.
	-h
		Display a help message and quit.
	-m MODE
		Set the operating mode of DEVICE_FILE to MODE.
		For transmitters, possible values are
		0 (assume 188-byte packets), 1 (assume 204-byte packets),
		2 (append sixteen 0x00 bytes to each 188-byte packet).
		For receivers, possible values are 0 (raw mode),
		1 (synchronize on 188-byte packets),
		2 (synchronize on 204-byte packets),
		3 (synchronize on detected packet size),
		4 (synchronize on detected packet size and
		strip the last sixteen bytes from each 204-byte packet),
		5 (synchronize on 204-byte packets and
		strip the last sixteen bytes from each packet).
	-n
		For transmitters,
		enable null packet insertion on DEVICE_FILE.
		For receivers,
		enable PID filter null packet replacement on DEVICE_FILE.
	-N
		For transmitters,
		disable null packet insertion on DEVICE_FILE.
		For receivers,
		disable PID filter null packet replacement on DEVICE_FILE.
	-s BUFSIZE
		Set the size of the driver buffers on DEVICE_FILE to
		BUFSIZE bytes. This must be a positive multiple of eight.
	-t
		Set the packet timestamping mode of DEVICE_FILE to TIMESTAMPS.
		For transmitters, possible values are
		0 (disabled),
		1 (discard eight bytes after each packet),
		2 (transmit each packet when an onboard counter
		equals the prepended timestamp).
		For receivers, possible values are
		0 (disabled),
		1 (append an eight-byte PCR-format timestamp to each packet),
		2 (prepend an eight-byte 63-bit timestamp to each packet).
	-V
		Display the version information and quit.
	-x CLKSRC
		Set the clock source of DEVICE_FILE to CLKSRC.
		This is valid only for transmitters.
		Possible values are
		0 (onboard oscillator),
		1 (external reference clock),
		2 (recovered receive clock).


Calcstuff
---------

NAME
	calcstuff - calculate DVB ASI parameters

SYNOPSIS
	calcstuff [OPTION]... BITRATE PACKETSIZE

DESCRIPTION
	Calcstuff calculates the number of K28.5 comma characters
	(also known as byte synchronization characters)
	to insert between each byte and each packet
	in an MPEG-2 tranport stream to best approximate
	BITRATE over a DVB ASI interface for packets of PACKETSIZE bytes.
	The output of calcstuff is in the form of
	stuffing parameters, which can be used with txcfg, txtest,
	or passed directly to the driver. The best stuffing parameters
	may differ depending on the features supported by a given
	DVB ASI transmitter and whether burst mode is desired or not.

	Calcstuff supports bitrate finetuning, which allows
	more precise control of the average bitrate by modulating
	the interpacket stuffing between two consecutive values.
	Bitrate finetuning is available on some DVB ASI transmitters.

	Finding the stuffing parameters is an iterative process;
	calcstuff stops iterating and attempts to use
	interleaved finetuning to minimize
	network jitter when the calculated bitrate is within
	TOLERANCE parts per million of BITRATE, or when
	the bitrate accuracy cannot be improved.
	Specifying a higher TOLERANCE can provide stuffing parameters
	with lower network jitter for DVB ASI transmitters
	that do not support interleaved finetuning.

	BITRATE should be given in bits per second.
	PACKETSIZE is either 188 or 204.

OPTIONS
	-h
		Display a help message and quit.
	-t TOLERANCE
		Accept a bitrate within TOLERANCE parts per million
		of BITRATE.
	-V
		Display the version information and quit.


Cknull
------

NAME
	cknull - test for null MPEG-2 transport stream packets

SYNOPSIS
	cknull [OPTION]... [FILE]

DESCRIPTION
	Cknull tests the contents of FILE for data like
	that generated by mknull.
	If FILE is not specified, standard input is read.

OPTIONS
	-h
		Display a help message and quit.
	-V
		Display the version information and quit.


Mknull
------

NAME
	mknull - generate null MPEG-2 transport stream packets

SYNOPSIS
	mknull [OPTION]... [-n NUM]

DESCRIPTION
	Mknull generates null MPEG-2 transport stream packets with
	a payload of 0xFF. The packet continuity_counter field
	is incremented by one after every packet, and the results are
	sent to standard output.

	By default, mknull generates 188-byte packets
	until it is interrupted.

OPTIONS
	-b BITRATE
		Prepend timestamps at BITRATE bits per second.
	-h
		Display a help message and quit.
	-i
		Invert every eighth packet synchronization byte.
	-n NUM
		Stop after NUM packets.
	-V
		Display the version information and quit.
	-2
		Generate 204-byte packets by appending sixteen 0x00 bytes
		to each 188-byte packet.


Rxcfg
-----

NAME
	rxcfg - interactively issue DVB ASI receiver ioctls

SYNOPSIS
	rxcfg [OPTION]... DEVICE_FILE

DESCRIPTION
	Rxcfg is a simple program which demonstrates
	the DVB ASI receiver ioctl commands.
	It can be used interactively to control or monitor
	a DVB ASI receiver, or noninteractively
	with a script piped to its standard input.

OPTIONS
	-h
		Display a help message and quit.
	-V
		Display the version information and quit.


Rxmon
-----

NAME
	rxmon - monitor DEVICE_FILE for DVB ASI receiver events

SYNOPSIS
	rxmon [OPTION]... DEVICE_FILE

DESCRIPTION
	Rxmon monitors DEVICE_FILE for DVB ASI events
	such as loss of carrier and loss of packet synchronization.
	It can be used with another program which reads
	from the interface (such as cat or dd).
	It should not be used with an application which performs
	its own monitoring (such as rxtest).

OPTIONS
	-h
		Display a help message and quit.
	-V
		Display the version information and quit.


Rxtest
------

NAME
	rxtest - example DVB ASI receiver application

SYNOPSIS
	rxtest [OPTION]... DEVICE_FILE [FILE]

DESCRIPTION
	Rxtest reads data from DEVICE_FILE
	and optionally writes the received data to FILE,
	while monitoring for DVB ASI receiver events.
	If FILE is not specified, the data is discarded.

	Any events which are reported by the receiver are
	sent to standard output, unless the -q option is used.

	The received data may be piped to cknull (or any other program)
	by using a FIFO or named pipe.

	If the -v option is used, rxtest will display the
	packet synchronization byte(s),
	double packet synchronization mode,
	and the PID it is counting (if any).

	If the -s option is used, rxtest will periodically display
	the bitrate between it and the driver, the PID count,
	and the receiver status;

		0 = blocking data,
		1 = passing data in raw mode,
		188 = synchronized to 188-byte packets,
		204 = synchronized to 204-byte packets.

OPTIONS
	-d
		Gain packet synchronization after receiving
		two packet synchronization bytes.
	-D
		Gain packet synchronization after receiving
		one packet synchronization byte.
	-h
		Display a help message and quit.
	-i
		Treat 0x47 and 0xB8 as packet synchronization bytes.
	-I
		Treat 0x47 as the packet synchronization byte.
	-n TIME
		Stop after TIME seconds.
	-p PID
		Count packets with the given PID.
	-q
		Quiet operation; no output.
	-s PERIOD
		Display status every PERIOD seconds.
	-v
		Verbose output; display additional information
		at startup.
	-V
		Display the version information and quit.


Stampinfo
---------

NAME
	stampinfo - read the packet timestamps inserted by DVB Master receivers

SYNOPSIS
	stampinfo -a | -p [OPTION]... [FILE]

DESCRIPTION
	Stampinfo reads all timestamps in FILE and calculates the
	minimum and maximum interval between consecutive packets.
	If FILE is not specified, standard input is read.

OPTIONS
	-a
		Assume a timestamp follows each packet.
	-h
		Display a help message and quit.
	-p
		Assume a timestamp precedes each packet.
	-v
		Verbose output; display all timestamp values,
		intervals, and packet headers.
	-V
		Display version information and quit.
	-2
		Assume each packet is 204 bytes long.


Txcfg
-----

NAME
	txcfg - interactively issue DVB ASI transmitter ioctls

SYNOPSIS
	txcfg [OPTION]... DEVICE_FILE

DESCRIPTION
	Txcfg is a simple program which demonstrates
	the DVB ASI transmitter ioctl commands.
	It can be used interactively to control or monitor
	a DVB ASI transmitter, or noninteractively
	with a script piped to its standard input.

OPTIONS
	-h
		Display a help message and quit.
	-V
		Display the version information and quit.


Txmon
-----

NAME
	txmon - monitor DEVICE_FILE for DVB ASI transmitter events

SYNOPSIS
	txmon [OPTION]... DEVICE_FILE

DESCRIPTION
	Txmon monitors DEVICE_FILE for DVB ASI transmitter events
	such as underrun of the onboard FIFO.
	It can be used with another program which writes
	to the interface (such as cat or dd).
	It should not be used with an application which performs
	its own monitoring (such as txtest).

	Sometimes txmon is useful for simply holding an interface open.
	This prevents the interface from resetting when
	another application closes it.
	For example, to repeatedly transmit a file from disk
	one possible approach is to run txmon with

		./txmon /dev/asitx0

	Then, set the transmitter stuffing parameters with txcfg
	and execute a script such as the following;

		while [ 1 ]
		do
			cat filename > /dev/asitx0
		done

	Txmon will report any transmitter events on standard output.
	If txmon was not used in this example, the stuffing parameters
	would reset and there would be a discontinuity at each end-of-file.

OPTIONS
	-h
		Display a help message and quit.
	-V
		Display the version information and quit.


Txtest
------

NAME
	txtest - example DVB ASI transmitter application

SYNOPSIS
	txtest [OPTION]... DEVICE_FILE [IB IP
		[NORMAL_IP BIG_IP [IL_NORMAL IL_BIG]]]

DESCRIPTION
	Txtest configures DEVICE_FILE with interbyte stuffing IB,
	interpacket stuffing IP + (BIG_IP / (BIG_IP + NORMAL_IP)),
	and interleaved finetuning parameters IL_NORMAL and IL_BIG,
	and copies data to it from standard input while
	monitoring for DVB ASI transmitter events.

	Any events which are reported by the transmitter are
	sent to standard output, unless the -q option is used.

	Typically, the output of mknull or the contents of a disk file
	would be piped to txtest. Calcstuff may be used to calculate
	the appropriate stuffing parameters for a given bitrate and
	packet size.

	At end-of-file, txtest issues a fsync () to the interface.

	If the -v option is used, txtest will display the
	transmit mode, stuffing parameters,
	and target interface bitrate.

	If the -s option is used, txtest will periodically display
	the bitrate between it and the driver.

OPTIONS
	-h
		Display a help message and quit.
	-n TIME
		Stop after TIME seconds.
	-q
		Quiet operation; no output.
	-s PERIOD
		Display status every PERIOD seconds.
	-v
		Verbose output; display additional information
		at startup.
	-V
		Display the version information and quit.

