DDK Sample Design |
ZiLOG Application Note |
---|
How to create and install a XINU driver for eZ80 family of processors |
Author: Andrei Kovalev FAE ZiLOG Germany |
The driver is provided as a set of source code, the library and the header file. To quickly evaluate the function of the driver add the library to your project. The driver API corresponds to the XINU API for the input - output devices. Driver is fully compatible with XINU.
To activate the driver com_init()
function is to be used.
After the device is successfully installed the associated port can be opened.
The driver contains the code for controlling both serial ports available on
eZ80. Access to the devices is provided by means of two predefined handles,
hCOM1
and hCOM2
int hcom; com_init(); // install the driver hcom = open( hCOM1, "COM1:", 0); // open the device for usage
and used for the application purposes by means of the common XINU function
calls - putc, getc, read, write, control
. See the example below.
putc( hcom, 'H'); putc( hcom, 'e'); putc( hcom, 'l'); putc( hcom, 'l'); putc( hcom, 'o'); write( hcom, ", world!", 8 ); while( !control(hcom, COM_AVAIL, 0, 0 ) == 5 ) sleep10(1); read(hcom, testbuffer, 5 ); if( strcmp(testbuffer, "hello") ) . . .
Enjoy!