libww libww
WWitch compatibility library for the Wonderful toolchain
Loading...
Searching...
No Matches
comm.h File Reference
#include <sys/types.h>

Go to the source code of this file.

Macros

#define COMM_SPEED_9600   0
 
#define COMM_SPEED_38400   1
 
#define ERR_SIO_OK   0
 
#define ERR_SIO_BUSY   0x8100
 
#define ERR_SIO_TIMEOUT   0x8101
 
#define ERR_SIO_OVERRUN   0x8102
 
#define ERR_SIO_CANCEL   0x8103
 
#define ERR_XM_STATECODE   0x8104
 
#define ERR_XM_CANCELED   0x8105
 
#define ERR_XM_BLOCK_LOST   0x8106
 
#define ERR_XM_TOO_LARGE   0x8107
 

Functions

static void comm_open (void)
 
static void comm_close (void)
 
static int16_t comm_send_char (uint8_t ch)
 
static int16_t comm_receive_char (void)
 
static int16_t comm_receive_with_timeout (uint16_t timeout)
 
int16_t comm_send_string (const char __far *str)
 
int16_t comm_send_block (const void __far *data, uint16_t length)
 
int16_t comm_receive_block (void __far *data, uint16_t length, int16_t __far *out_length)
 
static void comm_set_timeout (uint16_t recv_timeout, uint16_t send_timeout)
 
static void comm_set_baudrate (uint16_t value)
 
static uint16_t comm_get_baudrate (void)
 
static void comm_set_cancel_key (uint16_t value)
 
static uint16_t comm_get_cancel_key (void)
 

Macro Definition Documentation

◆ COMM_SPEED_38400

#define COMM_SPEED_38400   1

Definition at line 12 of file comm.h.

◆ COMM_SPEED_9600

#define COMM_SPEED_9600   0

Definition at line 10 of file comm.h.

◆ ERR_SIO_BUSY

#define ERR_SIO_BUSY   0x8100

Definition at line 17 of file comm.h.

◆ ERR_SIO_CANCEL

#define ERR_SIO_CANCEL   0x8103

Definition at line 23 of file comm.h.

◆ ERR_SIO_OK

#define ERR_SIO_OK   0

Definition at line 16 of file comm.h.

◆ ERR_SIO_OVERRUN

#define ERR_SIO_OVERRUN   0x8102

Definition at line 21 of file comm.h.

◆ ERR_SIO_TIMEOUT

#define ERR_SIO_TIMEOUT   0x8101

Definition at line 19 of file comm.h.

◆ ERR_XM_BLOCK_LOST

#define ERR_XM_BLOCK_LOST   0x8106

Definition at line 26 of file comm.h.

◆ ERR_XM_CANCELED

#define ERR_XM_CANCELED   0x8105

Definition at line 25 of file comm.h.

◆ ERR_XM_STATECODE

#define ERR_XM_STATECODE   0x8104

Definition at line 24 of file comm.h.

◆ ERR_XM_TOO_LARGE

#define ERR_XM_TOO_LARGE   0x8107

Definition at line 27 of file comm.h.

Function Documentation

◆ comm_close()

static void comm_close ( void )
inlinestatic

Definition at line 39 of file comm.h.

◆ comm_get_baudrate()

static uint16_t comm_get_baudrate ( void )
inlinestatic
Returns
Current baud rate

Definition at line 146 of file comm.h.

◆ comm_get_cancel_key()

static uint16_t comm_get_cancel_key ( void )
inlinestatic
Returns
Current cancel key combination

Definition at line 173 of file comm.h.

◆ comm_open()

static void comm_open ( void )
inlinestatic

Definition at line 29 of file comm.h.

◆ comm_receive_block()

int16_t comm_receive_block ( void __far * data,
uint16_t length,
int16_t __far * out_length )
Parameters
dataData buffer
lengthLength of buffer, in bytes
out_lengthLength of data received, in bytes
Returns
Return code

◆ comm_receive_char()

static int16_t comm_receive_char ( void )
inlinestatic

Receive a character using the default timeout.

Returns
Character read on success, negative on error

Definition at line 68 of file comm.h.

◆ comm_receive_with_timeout()

static int16_t comm_receive_with_timeout ( uint16_t timeout)
inlinestatic

Receive a character using an user-provided timeout.

Parameters
timeoutTimeout, in frames
Returns
Character read on success, negative on error

Definition at line 84 of file comm.h.

◆ comm_send_block()

int16_t comm_send_block ( const void __far * data,
uint16_t length )
Parameters
dataData to send
lengthLength of data to send
Returns
Return code

◆ comm_send_char()

static int16_t comm_send_char ( uint8_t ch)
inlinestatic
Parameters
chCharacter to send
Returns
Zero on success, negative on error

Definition at line 53 of file comm.h.

◆ comm_send_string()

int16_t comm_send_string ( const char __far * str)
Parameters
strInput string to send
Returns
Return code

◆ comm_set_baudrate()

static void comm_set_baudrate ( uint16_t value)
inlinestatic
Parameters
valueNew baud rate

Definition at line 133 of file comm.h.

◆ comm_set_cancel_key()

static void comm_set_cancel_key ( uint16_t value)
inlinestatic
Parameters
valueNew cancel key combination

Definition at line 160 of file comm.h.

◆ comm_set_timeout()

static void comm_set_timeout ( uint16_t recv_timeout,
uint16_t send_timeout )
inlinestatic
Parameters
recv_timeoutReceive timeout
send_timeoutSend timeout

Definition at line 120 of file comm.h.