#include <stdio.h>#include <mi32/stddefns.h>#include <mi32/fixedstr.h>Include dependency graph for ports.h:

Go to the source code of this file.
Classes | |
| struct | MPORT |
| struct | MPORTTYPE |
| struct | PortChannel |
Defines | |
| #define | LIBEXPORT MI_DLLIMPORT |
| #define | MAXPORTCHANNEL 2 |
| #define | MSERIALBAUD_1200 1200 |
| #define | MSERIALBAUD_19_2K 19200 |
| #define | MSERIALBAUD_2400 2400 |
| #define | MSERIALBAUD_300 300 |
| #define | MSERIALBAUD_38_4K 28400 |
| #define | MSERIALBAUD_4800 4800 |
| #define | MSERIALBAUD_57_6K 57600 |
| #define | MSERIALBAUD_600 600 |
| #define | MSERIALBAUD_9600 9600 |
| #define | MSERIALDATABITS_7 7 |
| #define | MSERIALDATABITS_8 8 |
| #define | MSERIALFLOW_Hardware 0 |
| #define | MSERIALFLOW_NoCTSDSR 3 |
| #define | MSERIALFLOW_None 2 |
| #define | MSERIALFLOW_XonXoff 1 |
| #define | MSERIALPARITY_Even 2 |
| #define | MSERIALPARITY_None 0 |
| #define | MSERIALPARITY_Odd 1 |
| #define | MSERIALSTOPBITS_1 1 |
| #define | MSERIALSTOPBITS_1_5 3 |
| #define | MSERIALSTOPBITS_2 2 |
| #define | PORTMODE_Buffered 0x0003 |
| #define | PORTMODE_Command PORTMODE_Secondary |
| #define | PORTMODE_Compressed 0x0010 |
| #define | PORTMODE_Data (PORTMODE_Secondary|PORTMODE_NOT) |
| #define | PORTMODE_DoubleBuf 0x0001 |
| #define | PORTMODE_HighSpeed 0x0004 |
| #define | PORTMODE_NonBlocking 0x0200 |
| #define | PORTMODE_NOT 0x8000 |
| #define | PORTMODE_Secondary 0x0080 |
| #define | PORTMODE_SingleBuf 0x0002 |
| #define | PORTMODE_SingleStream 0x0020 |
| #define | PORTMODE_UnicodeName 0x0100 |
| #define | PORTSTAT_Abort 0x8000 |
| #define | PORTSTAT_DiskFull 0x0100 |
| #define | PORTSTAT_Error 0x0008 |
| #define | PORTSTAT_NotReady 0x0080 |
| #define | PORTSTAT_OffLine 0x0010 |
| #define | PORTSTAT_OutOfPaper 0x0020 |
| #define | PORTSTAT_TimeOut 0x0001 |
| #define | PORTTYPE_COM 0x0002 |
| #define | PORTTYPE_FILE 0x0008 |
| #define | PORTTYPE_GPIB 0x0004 |
| #define | PORTTYPE_IKON 0x0040 |
| #define | PORTTYPE_LPT 0x0001 |
| #define | PORTTYPE_MACBACK 0x0800 |
| #define | PORTTYPE_PAP 0x0200 |
| #define | PORTTYPE_PIPE 0x0080 |
| #define | PORTTYPE_SCSI 0x0010 |
| #define | PORTTYPE_SPOOLER 0x0100 |
| #define | PORTTYPE_VPI110 0x0020 |
| #define | PORTTYPE_WINPRINT 0x0400 |
Functions | |
| LIBEXPORT MPORTTYPE * | _MserialGetClassDef (void) |
| int | MpAbort (MPORT *port) |
| int | MpClose (MPORT *port) |
| int | MpComHasDataAvail (MPORT *port) |
| void | MpComSetQueueSize (int InputSize, int OutputSize) |
| int | MpFlush (MPORT *port) |
| int | MpGetLastError (MPORT *port) |
| MPORTTYPE * | MpGetPortTypeByName (const char *name) |
| MPORTTYPE * | MpGetPortTypeByNumber (int num) |
| int | MpInit (void) |
| int | MpInterfaceCommand (MPORT *port, const char *cmd, int len) |
| int | MpIsFile (const char *type, const char *name) |
| int | MpIsFileUC (const char *type, const UNICODE *name) |
| int | MpLastStatus (MPORT *port) |
| MPORT * | MpOpen (const char *name, MPORTTYPE *type, const char *parms, UINT32 mode) |
| int | MpRead (MPORT *port, void *buf, int maxlen, char *term) |
| int | MpReset (MPORT *port) |
| int | MpSetMode (MPORT *port, int mode) |
| int | MpSetParms (MPORT *port, const char *parms) |
| int | MpStatus (MPORT *port, char **status) |
| int | MpWrite (MPORT *port, const void *buf, int len) |
| int | MpWriteExt (MPORT *port, const void *buffer, int len, UINT32 flags) |
| LIBEXPORT int | MserialClose (MPORT *port) |
| LIBEXPORT int | MserialFlush (MPORT *port) |
| LIBEXPORT int | MserialGetLastError (MPORT *port) |
| LIBEXPORT int | MserialGetStatus (MPORT *port) |
| LIBEXPORT int | MserialHasDataAvail (MPORT *port) |
| LIBEXPORT int | MserialLastStatus (MPORT *port) |
| LIBEXPORT int | MserialOpen (MPORT **port, const char *name, const char *parms, UINT32 mode) |
| LIBEXPORT int | MserialRead (MPORT *port, void *buf, int maxlen) |
| LIBEXPORT int | MserialReset (MPORT *port) |
| LIBEXPORT int | MserialSetParms (MPORT *port, int baud, int data, int parity, int stop, int flow) |
| LIBEXPORT int | MserialSetParmsString (MPORT *port, const char *parmstr) |
| LIBEXPORT void | MserialSetQueueSize (int insize, int outsize) |
| LIBEXPORT int | MserialWrite (MPORT *port, const void *buf, int len) |
| int | MxPortGetSettings (Widget pwidget, MPORTTYPE *porttype, char *portoptions) |
| int | MxpWrite (MPORT *port, const void *buf, int numbytes, void *status, int line) |
Variables | |
| MPORTTYPE * | MpPortTypeList [] |
|
|
|
|
|
Channels 0 - 2.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Single or double.
|
|
|
|
|
|
Do LZW compression.
|
|
|
|
|
|
|
|
|
else via DOS
|
|
|
Do not block on read.
|
|
|
Clear the given flags.
|
|
|
Use secondary port (command/print).
|
|
|
|
|
|
Single stream has command/data.
|
|
|
Name is Unicode.
|
|
|
|
|
|
for files only
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Macintosh PrGeneral back door hack.
|
|
|
Macintosh Printer Access Protocol.
|
|
|
via popen()
|
|
|
|
|
|
lp or lpr using popen()
|
|
|
|
|
|
Windows printer driver.
|
|
|
For ports.c only!
|
|
|
Abort current operation and close port.
|
|
|
Close a port. This routine closes the port and frees the buffers. You MUST do an MpFlush before closing the port.
|
|
|
Determine if data available for reading.
|
|
||||||||||||
|
Set input/output queue sizes for COM ports.
|
|
|
Flush a buffered port.
|
|
|
Return last error that occurred for a port.
|
|
|
Get a MPORTTYPE given a port type name. This routine takes the name of a port type and returns the corresponding MPORTTYPE structure. This name may be stored in MIPS.INI. It is also returned by MpSelectPort.
|
|
|
Get a MPORTTYPE given a port type number. PORTTYPE_LPT PORTTYPE_COM PORTTYPE_GPIB PORTTYPE_FILE PORTTYPE_SCSI PORTTYPE_VPI110 PORTTYPE_UNIXPORT (as in "/dev/lp0")
|
|
|
Initialize the port library. This function initializes the MicroImages Port routines. |
|
||||||||||||||||
|
Send a command to the interface (for SCSI). This function will send a command to the interface. So far, it's only used for SCSI and ignored for all other port types. For SCSI, this function is used to send a CDB before an MpRead or MpWrite. Note, this function won't actually write the CDB until you call MpRead() or MpWrite(). To send a command that is nothing but a CDB, call this function followed by MpWrite() with a length of 0.
|
|
||||||||||||
|
Is file really a "file" ?
|
|
||||||||||||
|
Is file really a "file" -- Unicode version ?
|
|
|
Return the last known status for a port.
|
|
||||||||||||||||||||
|
Open a port. This routine will open a port. To get the MPORTTYPE structure needed in the second parameter, use MpGetPortTypeByName or MpGetPortTypeByNumber. The mode flags are listed in MpSetMode. The parms parameter is used to override the default parameters in MIPS.INI. Normally, just pass NULL for this paramter. SCSI: Port names are platform specific. For Windows, they're "SCSIn" where "n" is a digit from 0 to 7. For Unix, you have to pass the name of a character mode special device in the /dev directory (eg: /dev/scsi/sc0d1l0 is SCSI device 1 on the SGI).
|
|
||||||||||||||||||||
|
Read from a port.
This function will read data from a given port. If term is NULL, it acts like a normal read() function. If term is not NULL, it should contain a NULL-terminated string containing terminators. For example, if term contains "\n\t ", MpRead will read up to the next newline, tab, or space, but not more than maxlen chars. The terminator itself will also be read. NOTE: The "term" argument hasn't been implemented, and is currently ignored. SCSI: Note that for SCSI read commands, you must send a CDB by calling MpInterfaceCommand() before calling MpRead().
|
|
|
GENERATING_DOXYGEN_OUTPUT.
|
|
||||||||||||
|
Set the mode of a port.
PORTMODE_Buffered Single or double PORTMODE_Secondary Use secondary port (command/print) PORTMODE_SingleStream See MpWrite() for details PORTMODE_NOT Clear the given flags Some of these modes may be set by using MpSetParms when it's rewritten.
|
|
||||||||||||
|
Set port specific parameters. This routine allows you to set parameters for a given port. The values of the parms parameter is dependant on the port, but should always be in the following format: :parm1:parm2:parm3: This string may be stored in MIPS.INI. The last user selected parameters for each port are stored in MIPS.INI and automatically used when you call MpOpen. This function is only here to allow you to override them. Example: :9600:8:none:1: for a "serial_port", this means 9600 baud, 8 data bits, no parity, and 1 stop bit.
|
|
||||||||||||
|
Get the status of a port.
Possible status codes returned: 0 OK PORTSTAT_Error Some error has occured PORTSTAT_OffLine The printer is off-line PORTSTAT_OutOfPaper The printer is out of paper PORTSTAT_NotReady The printer is busy PORTSTAT_Abort SCSI: A pointer to a SCSI Sense Block is returned in the "status" parameter. DO NOT FREE IT! Also be aware that the data in this Sense Block may change after calling other functions on the port. This Sense Block is obtained by sending a REQUEST SENSE (CDB command 0).
|
|
||||||||||||||||
|
Write to a port.
This function will write data to the given port. If the port is buffered, it might not actually send unless the buffer fills up or until you call MpFlush. If the status returned is not 0, the port is busy and the write has been buffered. In this case, you should call MpFlush() until it returns a status of 0 or until the user gets bored and goes home. If len is -1, buf is assumed to be a NULL-terminated string. Notes for SCSI implementation: This command is used to send DATA only. To send a CDB, use MpInterfaceCommand(), followed by MpWrite(). An alternative method is to open the port with PORTMODE_SingleStream (or set it using MpSetMode). If the PORTMODE_SingleStream flag is set, the data is assumed to be wrapped as follows... <CC> <HH> <LL> <Data....> Where CC is the channel number (0 == CDB, 1 == DATA) to write to, HH and LL are the high and low-bytes of the length to write. In this mode, data is buffered until the full length is recieved and is then sent all at once. This is useful for SCSI and GPIB where data has to be sent in fixed size chunks. A data block can span multiple calls to MpWrite(). MpWrite() will write at most one block per call. If a buffer contains multiple blocks, MpWrite() will write the first block then return a count indicating how many bytes were written. It is up to the caller to call MpWrite again with the rest of the buffer (possibly checking MpStatus() between calls). Also, to send just a CDB (eg reset command) using this method, you have to send the CDB in channel 0, followed by a 0-byte data block on channel 1.
|
|
||||||||||||||||||||
|
Same as MpWrite() but if the port becomes busy, will add a message to the current status handle (if any) and check the cancle button.
|
|
|
Close a serial port. This function is equivalent to the Mp function but assumes the port is a serial port. This function is also in misystem.
|
|
|
Flush a serial port.
|
|
|
Return last error code for a port. This function is equivalent to the Mp function but assumes the port is a serial port. This function is in misystem.
|
|
|
Get status of a serial port (asks the OS).
|
|
|
See if a port has data available for reading.
|
|
|
Return last known status for a serial port.
|
|
||||||||||||||||||||
|
Open a serial port. The only valid mode is PORTMODE_UnicodeName if the name passed is really Unicode. This function is almost equivalent to the Mp function but assumes the port is a serial port. This function is in misystem.
|
|
||||||||||||||||
|
Read from a serial port.
|
|
|
Reset a serial port. This function is equivalent to the Mp function but assumes the port is a serial port. This function is in misystem.
|
|
||||||||||||||||||||||||||||
|
Set serial port parameters given numeric values. This function is in misystem. It's designed to replace MserialSetParmsString for cases where you don't really want to form a string just to pass it. The #defined constants are mostly logical, so you don't have to use them. For example, the following are equivalent: MserialSetParms(port, MSERIALBAUD_57_6K, MSERIALDATABITS_8, MSERIALPARITY_None, MSERIALSTOPBITS_1, MSERIALFLOW_Hardware) MserialSetParms(port, 57600, 8, 0, 1, MSERIALFLOW_Hardware); The constants are #defined in ports.h
|
|
||||||||||||
|
Set port parameters from a string (like MpSetParms). This function is equivalent to the MpSetParms function but assumes the port is a serial port. This function is in misystem.
|
|
||||||||||||
|
Set the size of the input and output queues. Sets the size of the input/output buffers in bytes. These values will be used for subsiquent MserialOpen()s. This function is equivalent to the Mp function but assumes the port is a serial port. This function is in misystem.
|
|
||||||||||||||||
|
Write data to a serial port.
|
|
||||||||||||||||
|
Create dialog for port settings.
|
|
||||||||||||||||||||||||
|
Write to a port with status and/or error dialogs.
|
|
|
|
1.3.8-20040913