/* Copyright (C) Magna Carta Software, Inc. 1988-1991. All Rights Reserved. C COMMUNICATIONS TOOLKIT COMM.H -- Main C Communications Toolkit header file. */ #if !defined(COMM_H_INCLUDED) #define COMM_H_INCLUDED #if defined(__cplusplus) extern "C" { #endif #if !defined(COMPAT_H_INCLUDED) #include /* compiler-specific macros for compatibility */ #endif #if defined(USE_CWT) #if !defined(C_WINDOWS_H_INCLUDED) #include #endif #else #include short FCALL_ bios_key(unsigned short func); short CDECL_ bios_kbd_(unsigned short func); short FCALL_ inkey(void); short FCALL_ is_key(unsigned short key); #endif /* TYPE DEFINITIONS */ #if !defined(TYPES_DEFINED) typedef unsigned char BYTE; typedef unsigned short WORD; typedef unsigned long DWORD; #define TYPES_DEFINED #endif #if defined(CCT_DEVELOPMENT) #include #else #include /* manifest constant definitions */ #include /* typedefs */ #endif #include /* definition of important ASCII values */ #include /* key identifiers (hi = scan code, lo = char. code */ #include /* assume we are using an INS8250 family UART */ /* This conditional lets you choose whether to use floating point or integral calculation of time delays; */ #if defined(USE_FLOATING_POINT) extern void FCALL_ (*pause)(double duration); #define mspause(a) ((*pause)(((double) (a)))) #else #define mspause(a) ms_pause((a)) #endif /* FUNCTION PROTOTYPES & MACROS */ short FCALL_ c_close_(COMM_PORT *p); short FCALL_ c_getc(COMM_PORT *p); short c_getc_(COMM_PORT *p_port); short FCALL_ c_gets(COMM_PORT *p, char *str, WORD len, short term); short FCALL_ c_inchar(COMM_PORT *p); short c_open_(COMM_PORT *p); short CDECL_ c_printf(COMM_PORT *p, char *fs,...); short FCALL_ c_putc(COMM_PORT *p_port, short c); short FCALL_ c_putc_(COMM_PORT *p_port, short c); WORD FCALL_ c_putn(COMM_PORT *p, WORD num, char *str); void c_putoldc_(COMM_PORT *p, short c); short FCALL_ c_puts(COMM_PORT *p_port, char *str); WORD FCALL_ c_rxcount(COMM_PORT *p); short FCALL_ c_rxflush(COMM_PORT *p_port, WORD numbytes); short FCALL_ c_rxpeek(COMM_PORT *p, WORD num); WORD FCALL_ c_txcount(COMM_PORT *p); short FCALL_ c_txflush(COMM_PORT *p, WORD numbytes); short FCALL_ c_waitc(COMM_PORT *p_port, short ch, WORD duration); short FCALL_ c_waits(COMM_PORT *p_port, char *p_str, WORD duration); void INTERRUPT_ cct_ctrl_brk_(void); WORD FCALL_ checksum(WORD accum, WORD ch); WORD FCALL_ checksumn(char *buf, WORD count); #if (defined(__WATCOMC__) && !defined(__386__)) void FAR_ CDECL_ com_isr0_(void); /* general interrupt dispatcher */ void FAR_ CDECL_ com_isr1_(void); /* general interrupt dispatcher */ void FAR_ CDECL_ com_isr2_(void); /* general interrupt dispatcher */ void FAR_ CDECL_ com_isr3_(void); /* general interrupt dispatcher */ #else void INTERRUPT_ com_isr0_(void); /* general interrupt dispatcher */ void INTERRUPT_ com_isr1_(void); /* general interrupt dispatcher */ void INTERRUPT_ com_isr2_(void); /* general interrupt dispatcher */ void INTERRUPT_ com_isr3_(void); /* general interrupt dispatcher */ #endif void FAR_ CDECL_ com_ms_ipr_(COMM_PORT FAR_ *); /* modem status ISR */ void FAR_ CDECL_ com_rls_ipr_(COMM_PORT FAR_ *);/* received line status ISR */ void FAR_ CDECL_ com_rx_ipr_(COMM_PORT FAR_ *); /* received data ready ISR */ void FAR_ CDECL_ com_tx_ipr_(COMM_PORT FAR_ *); /* transmitter holding reg. empty ISR */ void FAR_ CDECL_ com_dummy_(COMM_PORT FAR_ *); /* dummy ISR that just returns */ short FCALL_ conoutc(COMM_PORT *p, short c); void CDECL_ conoutf(char *fs,...); void FCALL_ conouts(char *s); WORD FCALL_ crc_ccitt(WORD crc, WORD ch); #if defined(_MSC_VER) void CDECL_ deinit_all_ports(void); #else void deinit_all_ports(void); #endif short FCALL_ deinit_port(COMM_PORT *p); /* short FCALL_ deinstall_ctrl_brk_(void (INTERRUPT_ *fn)()); */ short FCALL_ deinstall_ctrl_brk_(void FAR_ *fn); short FCALL_ deinstall_ipr(COMM_PORT *p, WORD itype); short FCALL_ deinstall_isr(COMM_PORT *p); short FCALL_ disable_comm_int(COMM_PORT *p_port, WORD int_type); short FCALL_ enable_comm_int(COMM_PORT *p_port, WORD int_type); short FCALL_ get_cts(COMM_PORT *p_port); short FCALL_ get_databits(COMM_PORT *p_port); short FCALL_ get_dcd(COMM_PORT *p_port); short FCALL_ get_dsr(COMM_PORT *p_port); short FCALL_ get_dtr(COMM_PORT *p_port); short FCALL_ get_loopback(COMM_PORT *p); short FCALL_ get_parity(COMM_PORT *p); WORD FCALL_ get_port_addr(WORD portnum); short FCALL_ get_ri(COMM_PORT *p_port); short FCALL_ get_rts(COMM_PORT *p_port); short FCALL_ get_rx_xlat(COMM_PORT *p, short item); long FCALL_ get_speed(COMM_PORT *p_port); short FCALL_ get_stopbits(COMM_PORT *p_port); short FCALL_ get_tx_xlat(COMM_PORT *p, short item); /* short FCALL_ install_ctrl_brk_(void (INTERRUPT_ *fn)()); */ short FCALL_ install_ctrl_brk_(void FAR_ *fn); short FCALL_ install_ipr(COMM_PORT *p, WORD itype, void FAR_ *fn, BYTE FAR_ *buf, WORD len); short FCALL_ install_isr(COMM_PORT *p, WORD irq, void FAR_ *isr); short FCALL_ irq8259_set(WORD irq, WORD state); #define enable_irq(x) irq8259_set( (x), ON) #define disable_irq(x) irq8259_set( (x), OFF) short FCALL_ isrxxlat(COMM_PORT *p); short FCALL_ istxxlat(COMM_PORT *p); short FCALL_ kbd_type(void); void FCALL_ key_click(void); void FCALL_ ms_pause(WORD duration); #define restore_xlat(a, b) memcpy((&a->rx_xlat), (b), XLAT_SIZE) #define save_xlat(a, b) memcpy((b), (&a->rx_xlat), XLAT_SIZE) void FCALL_ send_break(COMM_PORT *p_port, WORD duration); short FCALL_ set_databits(COMM_PORT *p_port, short value); void FCALL_ set_dtr(COMM_PORT *p_port, short value); short FCALL_ set_loopback(COMM_PORT *p, short value); short FCALL_ set_parity(COMM_PORT *p_port, short value); void FCALL_ set_rts(COMM_PORT *p_port, short value); short FCALL_ set_rx_xlat(COMM_PORT *p, short item, short value); void FCALL_ set_sound_off(void); short FCALL_ set_sound_on(WORD pitch, WORD duration); short FCALL_ set_speed(COMM_PORT *p_port, long value); short FCALL_ set_stopbits(COMM_PORT *p_port, short value); short FCALL_ set_tx_xlat(COMM_PORT *p, short item, short value); short FCALL_ set_warpdrive(WORD irq); /* extern void (INTERRUPT_ * com_isr[4])(); */ extern void (FAR_ * com_isr[4])(); extern COMM_PORT FAR_ * mcport[MAX_PORTS]; extern BYTE f_ports[MAX_PORTS]; extern short global_com_error; extern WORD portindex; extern char * rxmsg_error[]; extern char * msg_cmd[]; extern short use_ctrl_brk; #if 0 extern void (INTERRUPT_ *old_isr_1B)(); extern void (INTERRUPT_ *old_isr_23)(); #endif extern void (FAR_ *old_isr_1B)(); extern void (FAR_ *old_isr_23)(); extern WORD enhanced_kbd; extern WORD kbd_clear; /* flag: checkkey clears kbd. buffer? */ extern short checkdcd; extern WORD cct_warpdrive; #if defined(__cplusplus) } #endif #endif