[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] pnet/include il_serial.h, NONE, 1.1 Makefile.am, 1
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] pnet/include il_serial.h, NONE, 1.1 Makefile.am, 1.15, 1.16 |
Date: |
Sat, 08 Nov 2003 05:49:48 +0000 |
Update of /cvsroot/dotgnu-pnet/pnet/include
In directory subversions:/tmp/cvs-serv2361/include
Modified Files:
Makefile.am
Added Files:
il_serial.h
Log Message:
Add the support routines for serial port I/O and hook up the
necessary internalcalls.
--- NEW FILE: il_serial.h ---
/*
* il_serial.h - Serial port I/O routines.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _IL_SERIAL_H
#define _IL_SERIAL_H
#include "il_values.h"
#include "il_thread.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Serial port types.
*/
#define IL_SERIAL_REGULAR 0
#define IL_SERIAL_INFRARED 1
#define IL_SERIAL_USB 2
/*
* Bits for various serial pins.
*/
#define IL_PIN_BREAK (1<<0)
#define IL_PIN_CD (1<<1)
#define IL_PIN_CTS (1<<2)
#define IL_PIN_DSR (1<<3)
#define IL_PIN_DTR (1<<4)
#define IL_PIN_RTS (1<<5)
/*
* Parity values.
*/
#define IL_PARITY_NONE 0
#define IL_PARITY_ODD 1
#define IL_PARITY_EVEN 2
#define IL_PARITY_MARK 3
#define IL_PARITY_SPACE 4
/*
* Serial port handshake modes.
*/
#define IL_HANDSHAKE_NONE 0
#define IL_HANDSHAKE_XONOFF 1
#define IL_HANDSHAKE_RTS 2
#define IL_HANDSHAKE_RTS_XONOFF 3
/*
* Serial port parameters. Must match "PortMethods.Parameters".
*/
typedef struct
{
ILInt32 baudRate;
ILInt32 parity;
ILInt32 dataBits;
ILInt32 stopBits;
ILInt32 handshake;
ILUInt8 parityReplace;
ILBool discardNull;
ILInt32 readBufferSize;
ILInt32 writeBufferSize;
ILInt32 receivedBytesThreshold;
ILInt32 readTimeout;
ILInt32 writeTimeout;
} ILSerialParameters;
/*
* Opaque serial port type.
*/
typedef struct _tagILSerial ILSerial;
/*
* Determine if a serial port number is valid.
*/
int ILSerialIsValid(ILInt32 type, ILInt32 portNumber);
/*
* Determine if a serial port is accessible.
*/
int ILSerialIsAccessible(ILInt32 type, ILInt32 portNumber);
/*
* Open a serial port.
*/
ILSerial *ILSerialOpen(ILInt32 type, ILInt32 portNumber,
ILSerialParameters *parameters);
/*
* Close a serial port.
*/
void ILSerialClose(ILSerial *handle);
/*
* Modify the settings on a serial port.
*/
void ILSerialModify(ILSerial *handle, ILSerialParameters *parameters);
/*
* Get the number of bytes that are available to be read.
*/
ILInt32 ILSerialGetBytesToRead(ILSerial *handle);
/*
* Get the number of bytes that are buffered to be written.
*/
ILInt32 ILSerialGetBytesToWrite(ILSerial *handle);
/*
* Read the state of the serial port pins.
*/
ILInt32 ILSerialReadPins(ILSerial *handle);
/*
* Write the state of the serial port pins.
*/
void ILSerialWritePins(ILSerial *handle, ILInt32 mask, ILInt32 value);
/*
* Get the recommended buffer sizes.
*/
void ILSerialGetRecommendedBufferSizes
(ILInt32 *readBufferSize, ILInt32 *writeBufferSize,
ILInt32 *receivedBytesThreshold);
/*
* Discard the contents of the input buffer.
*/
void ILSerialDiscardInBuffer(ILSerial *handle);
/*
* Discard the contents of the output buffer.
*/
void ILSerialDiscardOutBuffer(ILSerial *handle);
/*
* Drain the contents of the output buffer.
*/
void ILSerialDrainOutBuffer(ILSerial *handle);
/*
* Read data from a serial port.
*/
ILInt32 ILSerialRead(ILSerial *handle, void *buffer, ILInt32 count);
/*
* Write data to a serial port.
*/
void ILSerialWrite(ILSerial *handle, const void *buffer, ILInt32 count);
/*
* Wait for a change in state on the incoming pins. Returns non-zero
* if a pin change was detected, zero if the thread was interrupted,
* or -1 if pin changes cannot be detected.
*/
int ILSerialWaitForPinChange(ILSerial *handle);
/*
* Wait for input on a serial port. Returns non-zero if there was
* input, or zero if the thread was interrupted, and -1 if input
* detection is not possible.
*/
int ILSerialWaitForInput(ILSerial *handle);
/*
* Send an interrupt signal to a serial port pin-change/input wait thread.
*/
void ILSerialInterrupt(ILThread *thread);
#ifdef __cplusplus
};
#endif
#endif /* _IL_SERIAL_H */
Index: Makefile.am
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnet/include/Makefile.am,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** Makefile.am 5 Nov 2003 09:33:43 -0000 1.15
--- Makefile.am 8 Nov 2003 05:49:46 -0000 1.16
***************
*** 20,23 ****
--- 20,24 ----
il_program.h \
il_regex.h \
+ il_serial.h \
il_serialize.h \
il_sysio.h \
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] pnet/include il_serial.h, NONE, 1.1 Makefile.am, 1.15, 1.16,
Rhys Weatherley <address@hidden> <=