fifo_init

Description

This function initialises a block of RAM for subsequent use as a FIFO. FIFOs must be initialised before they are used.

BEWARE: FIFOs are initialised by XCSB before use, do not use fifo_init unless you are creating FIFOs yourself dynamically.

Definition

fifo_init(ubyte *fifo, byte len)

Library

LIB/fifo_lib.bas

Usage

// declare a global byte array for use as a FIFO
ubyte xfifo[19]

proc main()

	// initialise the array for use as a FIFO
	fifo_init(&xfifo, 16)

	// NOTE the array is declared as 19 bytes long
	// and the length of the fifo buffer is 16 bytes
	// the relationship between the delared array
	// and the size of the fifo is always
	//	len = array_size - 3

endproc
On entry:
fifo is a pointer to an array to be used as a FIFO.
len is the number of bytes to be used as the fifo buffer.

The FIFO occupies len+3 bytes of RAM so to use a FIFO of 16 bytes space must be reserved for 16+3 bytes.

On exit:
There is no return value