beautypg.com

Comtrol API (6508) for the MS-DOS User Manual

Page 31

background image

31

API Functions

aaReadWithStatus

aaReadWithStatus

Reads serial data and status from a device.

aaReadWithStatus(Dev,Cnt,Buf)
int Dev

Device number

int Cnt

Max number of bytes that can
be read

unsigned int *Buf

Buffer to store the data and
status. The low byte of each
array element in Buf contains
the data byte, and the high byte
contains the status for that data
byte. The status may be 0
indicating no error, or any
combination of the following
flags:

ERR_PARITY

parity error

ERR_OVRRUN

receiver over
run error

ERR_FRAME

framing error

ERR_BREAK

break

int: Number of bytes read

if successful

0

if no data available to be

read

ERR_DEV

if device number out of

range

ERR_NOTOPEN

if device not open for receive

The Cnt parameter should not be greater than the
number of array elements in the Buf receive buffer.

Function

Purpose

Call

Return

Warning

aaReconfigure

Reconfigures a device’s communications parameters.

aa

R

econfigure(

Dev,Baud,Parity,DataBits,StopBits,FlowCtl,Detect

En

);

int dev;

Device Number

unsigned char Baud

One of the baud rate flags
defined in

API.H

.

unsigned char Parity

One of:

COM_PAR_NONE,

COM_PAR_EVEN,
COM_PAR_ODD

.

unsigned char DataBits

One of

COM_DATABIT_7,

COM_DATABIT_8

.

unsigned char StopBits

One of

COM_STOPBIT_1,

COM_STOPBIT_2

.

unsigned int FlowCtl

Flow control flag, can be

COM_FLOW_NONE

or any

combination of:

COM_FLOW_IS,
COM_FLOW_OS,
COM_FLOW_IH,
COM_FLOW_OH,
COM_FLOW_OXANY.

unsigned int DetectEn

Detection enable flags, can be
any combination of the
following:

COM_DEN_NONE

No error
detection
enabled

COM_DEN_
RDA

Enable Rx
data
available
detection

COM_DEN_MDM

Enable
modem
input
(

DSR

,

CD

, or

CTS

)

change
detection

int:

NO_ERR

if successful

ERR_DEV

if device number out of range

ERR_BAUDRATE

if invalid baud rate flag

Function

Purpose

Call

Return