A
download com_os2.h
Language: C
Copyright: Copyright 1987-96, Bit Bucket Software Co.
LOC: 195
Project Info
BinkleyTerm XE(btxe)
Server: SourceForge
Type: cvs
...e\b\btxe\btxe\btnt\sources\
   Addr.cpp
   Addr.h
   aglcrc.cpp
   aglcrc.h
   asyn_lnx.cpp
   asyn_os2.cpp
   asyn_w32.cpp
   async.h
   asyos2v1.h
   b_banner.cpp
   b_bbs.cpp
   b_faxrcv.cpp
   b_flofil.cpp
   b_frproc.cpp
   b_help.cpp
   b_initva.cpp
   b_logs.cpp
   b_passwo.cpp
   b_proto.cpp
   b_rspfil.cpp
   b_sbinit.cpp
   b_script.cpp
   b_search.cpp
   b_sessio.cpp
   b_spawn.cpp
   b_term.cpp
   b_termov.cpp
   b_today.cpp
   b_wazoo.cpp
   b_whack.cpp
   b_wzsend.cpp
   banner.cpp
   banner.h
   BasicString.h
   bbs_ctra.cpp
   bbs_data.cpp
   bbs_incl.h
   bbs_io.cpp
   bink.h
   bink_asm.cpp
   binkdlg.cpp
   binkpipe.h
   box.h
   brec.cpp
   bsend.cpp
   bt.cpp
   btconfig.cpp
   btutil.cpp
   buffer.h
   cache.cpp
   cache.h
   callback.cpp
   callerid.cpp
   callwin.cpp
   callwin.h
   capi.cpp
   cfosline.cpp
   chat.cpp
   com.h
   com_dos.h
   com_lnx.h
   com_os2.h
   com_w32.h
   common.cpp
   cpuload.cpp
   css.cpp
   css.h
   data.cpp
   debug.cpp
   debug.h
   defines.h
   dosfuncs.cpp
   emsi.cpp
   emxmxcom.cpp
   evtparse.cpp
   evtsetup.cpp
   exceptio.cpp
   exceptio.h
   Exceptions.cpp
   Exceptions.h
   externs.h
   faxproto.h
   fcfgread.cpp
   fidomail.h
   file_all.cpp
   file_dos.cpp
   file_io.h
   file_lnx.cpp
   file_os2.cpp
   file_w32.cpp
   foffsets.h
   fossil.cpp
   freepoll.cpp
   ftsc.cpp
   gethcomm.h
   heap.cpp
   history.cpp
   history.h
   hydra.cpp
   hydra.h
   includes.cpp
   includes.h
   janus.cpp
   janus.h
   keybd.h
   keyfncs.h
   keymap.cpp
   langload.cpp
   language.h
   lngmagic.h
   m7rec.cpp
   m7send.cpp
   mailer.cpp
   mailovly.cpp
   mailroot.cpp
   maxcomm.h
   maxmcp.cpp
   maxmcp.h
   maxprm.cpp
   mdm_proc.cpp
   misc.cpp
   msgs.h
   Node.cpp
   Node.h
   NodeList.cpp
   NodeList.h
   nodeproc.cpp
   os2_pm.cpp
   outbound.cpp
   pipe.cpp
   pktmsgs.cpp
   pktmsgs.h
   protcomm.cpp
   prototyp.h
   recvbark.cpp
   recvsync.cpp
   sbuf.cpp
   sbuf.h
   sched.cpp
   sched.h
   script2.cpp
   SelfTest.cpp
   SelfTest.h
   sendbark.cpp
   sendsync.cpp
   squish.cpp
   squish.h
   srif.cpp
   statetbl.cpp
   stats.cpp
   stdafx.cpp
   stdafx.h
   timer.cpp
   timer.h
   times.cpp
   types.h
   v7debug.cpp
   version.cpp
   version7.cpp
   version7.h
   vfos_dos.cpp
   vfos_lnx.cpp
   vfos_os2.cpp
   vfos_qnx.cpp
   vfos_w32.cpp
   vfossil.h
   video.h
   vt100.cpp
   vt100.h
   xfer.h
   xmrec.cpp
   xmsend.cpp
   xstring.h
   yoohoo.cpp
   zmodem.cpp
   zmodem.h

/*---------------------------------------------------------------------------*
 *
 *                               BinkleyTerm
 *
 *              (C) Copyright 1987-96, Bit Bucket Software Co.
 *     For license and contact information see /doc/orig_260/license.260.
 *
 *           This version was modified by the BinkleyTerm XE Team.
 *        For contact information see /doc/team.lst and /doc/join.us.
 *  For a complete list of changes see /doc/xe_user.doc and /doc/xe_hist.doc.
 *
 * Filename    : $Source: /cvsroot/btxe/btnt/sources/com_os2.h,v $
 * Revision    : $Revision: 1.1 $
 * Tagname     : $Name:  $
 * Last updated: $Date: 2005/01/01 15:18:12 $
 * State       : $State: Exp $
 * Orig. Author: Peter Fitzsimmons
 *
 * Description : OS/2 Communications definitions for BinkleyTerm
 *
 *---------------------------------------------------------------------------*/

#ifndef NEED_OS2COMMS

/* Baud rate masks */

#define BAUD_300        300
#define BAUD_1200       1200
#define BAUD_2400       2400
#define BAUD_4800       4800
#define BAUD_9600       9600
#define BAUD_19200      19200
#define BAUD_38400      38400
#define BAUD_57600      57600
#define BAUD_115200     115200

unsigned Cominit (int, int);
void MDM_DISABLE (void);
void MDM_ENABLE (unsigned long);

typedef unsigned char bool;

extern void com_XON_enable (void);
extern void com_XON_disable (void);
extern void com_DTR_on (void);
extern void com_DTR_off (void);
extern void com_break (int on);
extern int com_getc (int);

extern void MDM_ENABLE (unsigned long rate);
extern void MDM_DISABLE (void);
unsigned Cominit (int port, int failsafe);
extern int get_key (void);
extern USHORT ComTXBlockTimeout (BYTE * lpBuf, USHORT cbBuf, ULONG ulTimer);
extern USHORT ComTXRemain (void);

/* translate binkley fossil stuff to my async package */

#define CARRIER             (ComIsOnline(hcModem))
#define CHAR_AVAIL()        ComInCount(hcModem)
#define OUT_EMPTY()         (ComOutCount(hcModem)==0)
#define OUT_FULL()          (ComOutSpace(hcModem)==0)
#define LOWER_DTR()         com_DTR_off()
#define RAISE_DTR()         com_DTR_on()
#define CLEAR_OUTBOUND()    ComPurge(hcModem, COMM_PURGE_TX)
#define CLEAR_INBOUND()     ComPurge(hcModem, COMM_PURGE_RX)
#define KEYPRESS()          kbhit()
#define READKB()            get_key()
#define FOSSIL_CHAR()       get_key()
#define XON_ENABLE()        com_XON_enable()
#define IN_XON_ENABLE()
#define XON_DISABLE()       com_XON_disable()
#define _BRK_DISABLE()
#define FOSSIL_WATCHDOG(x)
#define SENDBYTE(c)         ComPutc(hcModem, c)
#define BUFFER_BYTE(c)      ComPutc(hcModem, c)
#define UNBUFFER_BYTES()    ComTxWait(hcModem, 1L)  /* yield cpu for a moment */
#define MODEM_IN()          ComGetc(hcModem)
#ifdef __BORLANDC__
#define NEED_WRITE_ANSI
#else
#define WRITE_ANSI(c)       putch (c)
#endif
#define PEEKBYTE()          ComPeek(hcModem)
#define do_break(on)        com_break(on)
#define SENDCHARS(buf, size, carcheck)  ComWrite(hcModem, buf, (USHORT)size)
#define hfComHandle         ComGetFH(hcModem)
#define real_flush(fh)      DosResetBuffer((HFILE)fh)

/* some useful bits */

/* (MSR) Received line signal detect sometimes called Carrier Detect */
#define RLSD    0x80

/* (LSR) Transmitter holding register empty (ready for another byte) */
#define THRE    0x20

/* (LSR) Data ready indicator */
#define DR      0x1

/* (LSR) Overrun error! We are not reading bytes fast enuf           */
#define OE      0x2

void ShowMdmSettings (void);

#else // NEED_OS2COMMS

#define TRUE 1
#define FALSE 0

#define BAUD_300        300
#define BAUD_1200       1200
#define BAUD_2400       2400
#define BAUD_4800       4800
#define BAUD_9600       9600
#define BAUD_19200      19200
#define BAUD_38400      38400
#define BAUD_57600      57600
#define BAUD_115200     115200

typedef unsigned char bool;

/*
   typedef unsigned char byte;
   typedef unsigned short word;
 */

extern int com_getc (int);
extern void com_putc (unsigned char c);
extern unsigned com_putc_now (unsigned char c);
extern void com_write (char *buf, unsigned int bytes, int carcheck);
extern void com_wait (void);
extern int com_getchar (void);
extern int com_peek (void);
extern int com_char_avail (void);
extern bool com_out_empty (void);
extern bool com_online (void);
extern void com_clear_out (void);
extern void com_clear_in (void);
extern void com_XON_enable (void);
extern void com_XON_disable (void);
extern long com_cur_baud (void);
extern int com_init (int port, char *unc);
extern int com_fini (void);
extern int com_set_baud (unsigned long rate,
                         char parity, int databits, int stopbits);
extern void com_DTR_on (void);
extern void com_DTR_off (void);
extern void com_break (int on);

extern void MDM_ENABLE (unsigned long rate);
extern void MDM_DISABLE (void);
extern void BUFFER_BYTE (unsigned char ch);
extern void UNBUFFER_BYTES (void);
extern unsigned Cominit (int port, int failsafe);
extern int get_key (void);

/* translate binkley fossil stuff to my async package */
#define CARRIER            (com_online())
#define MODEM_STATUS       (com_online())
#define CHAR_AVAIL()       com_char_avail()
#define OUT_EMPTY()        com_out_empty()
#define LOWER_DTR()        com_DTR_off()
#define RAISE_DTR()        com_DTR_on()
#define CLEAR_OUTBOUND()   com_clear_out()
#define CLEAR_INBOUND()    com_clear_in()
#define KEYPRESS()         kbhit()
#define READKB()           get_key()
#define FOSSIL_CHAR()      get_key()
#define XON_ENABLE()       com_XON_enable()
#define IN_XON_ENABLE()    com_XON_enable()
#define XON_DISABLE()      com_XON_disable()
#define _BRK_DISABLE()
#define FOSSIL_WATCHDOG(x)
#define SENDBYTE(c)        com_putc(c)
#define MODEM_IN()         com_getchar()
#define WRITE_ANSI(c)      putch(c)
#define PEEKBYTE()         com_peek()
#define do_break(on)       com_break(on)
#define SENDCHARS(buf, size, carcheck) com_write(buf, size, carcheck)
#define ComPause(x)
#define ComResume(x)

extern USHORT ComTXBlockTimeout (BYTE * lpBuf, USHORT cbBuf, ULONG ulTimer);
extern USHORT ComTXRemain (void);

#define real_flush(fh)     DosResetBuffer(fh)

/* some usefull bits */

/* (MSR) Received line signal detect, sometimes called Carrier Detect */
#define RLSD  0x80
/* (LSR) Transmitter holding register empty (ready for another byte) */
#define THRE 0x20
/* (LSR) Data ready indicator */
#define DR   0x1
/* (LSR) Overrun error! We are not reading the bytes fast enuf */
#define OE   0x2

extern HFILE hfComHandle;
extern unsigned long WriteSem;

typedef struct
{
  ULONG cur_bps;
  CHAR bps_fract;
  ULONG min_bps;
  CHAR min_bps_frac;
  ULONG max_bps;
  CHAR max_bps_frac;
}
EXTBAUDRATE, *PEXTBAUDRATE;



#if defined(OS2_INCLUDED) && !defined(BSEDEV_INCLUDED) && !defined(ASYNC_SETBAUDRATE)

/* OS/2 Category 1 DosDevIoctl() calls */
#define SERIAL          1       /* category: serial device control */
#define ASYNC_SETBAUDRATE    0x0041  /* Sets baud rate                                 */
#define ASYNC_SETLINECTRL    0x0042  /* Sets line characteristics for serial
                                        * device    */
#define ASYNC_TRANSMITIMM    0x0044  /* Transmits byte immediately                     */
#define ASYNC_SETBREAKOFF    0x0045  /* Sets break off                                 */
#define ASYNC_SETMODEMCTRL   0x0046  /* Sets modem control register                    */
#define ASYNC_STOPTRANSMIT   0x0047  /* Stops device from transmitting                 */
#define ASYNC_STARTTRANSMIT  0x0048  /* Starts a transmission                          */
#define ASYNC_SETBREAKON     0x004B  /* Sets break on                                  */
#define ASYNC_SETDCBINFO     0x0053  /* Sets device control block information          */
#define ASYNC_GETBAUDRATE    0x0061  /* Retrieves current baud rate                    */
#define ASYNC_GETLINECTRL    0x0062  /* Gets line characterstics of serial
                                        * device      */
#define ASYNC_GETCOMMSTATUS  0x0064  /* Retrieves communications status                */
#define ASYNC_GETLINESTATUS  0x0065  /* Retrieves current line status                  */
#define ASYNC_GETMODEMOUTPUT 0x0066  /* Retrieves modem-control output signals         */
#define ASYNC_GETMODEMINPUT  0x0067  /* Retrieves modem control register               */
#define ASYNC_GETINQUECOUNT  0x0068  /* Retrieves number of characters in
                                        * input queue  */
#define ASYNC_GETOUTQUECOUNT 0x0069  /* Retrieves number of characters in
                                        * output q     */
#define ASYNC_GETCOMMERROR   0x006D  /* Retrieves communications error                 */
#define ASYNC_GETCOMMEVENT   0x0072  /* Retrieves communications event mask            */
#define ASYNC_GETDCBINFO     0x0073  /* Retrieves device control block
                                        * information     */

#define GENERIC         11      /* category: generic device control commands */
#define FLUSHINPUT      1       /* function: flush input buffer */
#define FLUSHOUTPUT     2       /* function: flush output buffer */

typedef struct _DCBINFO
{
  USHORT usWriteTimeout;
  USHORT usReadTimeout;
  BYTE fbCtlHndShake;
  BYTE fbFlowReplace;
  BYTE fbTimeout;
  BYTE bErrorReplacementChar;
  BYTE bBreakReplacementChar;
  BYTE bXONChar;
  BYTE bXOFFChar;
}
DCBINFO;

typedef struct _RXQUEUE
{
  USHORT cch;                   /* number of bytes queued */
  USHORT cb;                    /* queue size             */
}
RXQUEUE;

#else
#if !defined(BSEDEV_INCLUDED)
#define BSEDEV_INCLUDED
#endif
#endif

#endif // NEED_OS2COMMS

/* $Id: com_os2.h,v 1.1 2005/01/01 15:18:12 vildanov Exp $ */

About Koders | Resources | Downloads | Support | Black Duck | Terms of Service | DMCA | Privacy Policy | Contact Us