/*++

Module Name:
    serOSCI.h			Copyright (c) 2004 MPL AG

Abstract:
    This is the include file that defines all constants and types specific to the
		serOSCI.sys driver from MPL AG. It can be used to make serOSCI driver specific
		ioctrls from an application program.

		All microsoft standard serial driver specific ioctrls are also included in the
		serOSCI.sys driver and can be used by the application program.

Author:
    Patrik Hossle (ph) 2004-03-18

Revision History:
	2004-03-18	first edition

--*/

#ifndef _serOSCI_H_
#define _serOSCI_H_

//
// struct for IOCTL_OSCI_MPIO_READ_PLD / IOCTL_OSCI_MPIO_WRITE_PLD ioctrls
//
typedef struct _INTERFACE_MODE {	// struct for mpl specific ioctrl
	UCHAR RS232Enable;				// FALSE: rs232 disabled, TRUE: rs232 enabled
	UCHAR RS485Enable;				// FALSE: rs485 / RS422 disabled, TRUE: rs485 / RS422 enabled
									// -> in hardware the enable for rs232 is stronger than the enable for rs485
	UCHAR FDEnable;					// FALSE: half duplex enable (RS485), TRUE: full duplex enable (RS425)
} INTERFACE_MODE,*PINTERFACE_MODE;

//
// struct for IOCTL_OSCI_SET_RS485_DELAY / IOCTL_OSCI_GET_DELAY_DELAY ioctrls
//
typedef struct _RS485_DELAY {	// struct for mpl specific ioctrl
	UCHAR RS485Delay;			// delay in transmitter bit time. valid is 0 .. 15
								// in auto rs485 half duplex mode the driver is disabled after
								// this number in bit times (e.g. 9600 baud: bit time = 104.2 us)
} RS485_DELAY,*PRS485_DELAY;

//
// Define the various device type values.  Note that values used by Microsoft
// Corporation are in the range 0-32767, and 32768-65535 are reserved for use
// by customers.
//
#define FILE_DEVICE_OSCI  0x00008005

//
// Macro definition for defining IOCTL and FSCTL function control codes.  Note
// that function codes 0-2047 are reserved for Microsoft Corporation, and
// 2048-4095 are reserved for customers.
//
#define OSCI_IOCTL_INDEX  0x805

// mpl ioctrls for handling the interface type
#define IOCTL_OSCI_MPIO_READ_PLD		CTL_CODE(FILE_DEVICE_OSCI, OSCI_IOCTL_INDEX+0x20, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_OSCI_MPIO_WRITE_PLD		CTL_CODE(FILE_DEVICE_OSCI, OSCI_IOCTL_INDEX+0x21, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_OSCI_SET_RS485_DELAY		CTL_CODE(FILE_DEVICE_OSCI, OSCI_IOCTL_INDEX+0x22, METHOD_BUFFERED, FILE_ANY_ACCESS)
#define IOCTL_OSCI_GET_RS485_DELAY		CTL_CODE(FILE_DEVICE_OSCI, OSCI_IOCTL_INDEX+0x23, METHOD_BUFFERED, FILE_ANY_ACCESS)

#endif  //_serOSCI_H_

