syscall 0x1BB7: int
Serial_Open( unsigned char *mode );
mode points to an array that holds the 6 bytes controlling the
settings for the serial interface.
mode[0]: 0x00 (mode[0]!=0 sets some serial parameters like
baud and then quits with result=4;
at present I can't figure out the function of mode[0]!=0, possibly
the change of parameters of an open serial channel.
MayBe it is connected with the "set link settings"-command of the FX
communication protocol.
mode[1]: 0=300, 1=600, 2=1200, 3=2400, 4=4800, 5=9600, 6=19200,
7=38400, 8=57600, 9=115200 baud
mode[2]: parity: 0=no; 1=odd; 2=even
mode[3]: datalength: 0=8 bit; 1=7 bit
mode[4]: stop bits: 0=one; 1=two
mode[5]: this parameter is not used by 0x418 at present. Functions
inside the OS which use 0x418 set it to 0, though.
returns
0 if successful
3 if already open
4 if mode[0]!=0
syscall 0x1bc6: int
Serial_IsOpen( void );
returns 3 if not open
returns 1 if open
syscall 0x1BB8: int Serial_Close( int mode );
Resets all buffers; disables the corresponding hardware
if mode=1 then Serial_Close does an immediate close, t. i. it does
not wait for pending transmissions.
if mode!=1 then Serial_Close quits returning code 5 if transmissions
are under way.
returns
0 if successful
5 if aware of pending transmissions and transmissions are under way
syscall 0x1BBB: int
Serial_SpyNthByte( int byteno_to_spy, unsigned char*result
);
The byte at the position byteno_to_spy in the serial receive
buffer is returned in result.
byteno_to_spy starts at 0! This function spies, it does not remove
any byte.
returns
0 if successful,
1 if the required count of bytes is not available
3 if the serial channel is not open.
syscall 0x1BB9: int
Serial_ReadOneByte( unsigned char*result );
Fetches one byte from the serial receive buffer into result.
returns
0 if successful,
1 if no byte is available
3 if the serial channel is not open.
syscall 0x1BBA: int
Serial_ReadNBytes( unsigned char*result, int max_size, short*actually_transferred
);
Fetches at most max_size bytes from the serial receive buffer
into result.
The count of actually transferred bytes is reported in
actually_transferred.
returns
0 if successful,
1 if no byte is available
3 if the serial channel is not open.
syscall 0x1BBC: int
Serial_BufferedTransmitOneByte( unsigned char byte_to_transmit );
Puts one byte into the serial transmit buffer.
returns
0 if successful,
2 if no space is available in the serial interrupt transmit buffer (256 bytes
max)
3 if the serial channel is not open.
syscall 0x1BBE: int Serial_BufferedTransmitNBytes( unsigned char*bytes_to_transmit, int requested_count );
Puts requested_count bytes from the array
bytes_to_transmit into the serial transmit buffer, if space allows.
returns
0 if successful,
2 if no space is available in the serial interrupt transmit buffer (256 bytes
max)
3 if the serial channel is not open.
syscall 0x1BBD: int Serial_DirectTransmitOneByte( unsigned char byte_to_transmit );
Puts byte_to_transmit into the serial transmit
FIFO, if it is empty!
0 if successful,
1 if the FIFO is not empty
3 if the serial channel is not open.
syscall 0x1BBf: int
Serial_GetReceivedBytesAvailable( void );
returns the count of received bytes available.
syscall 0x1bc0: int
Serial_GetFreeTransmitSpace( void );
returns the free space in the transmit buffer.
syscall 0x1bc1: int
Serial_ClearReceiveBuffer( void );
Clears the serial receive buffer.
returns
0 if successful,
3 if the serial channel is not open.
Remark: the serial interrupt receive buffer accepts 1024 bytes at most.
syscall 0x1bc2: int
Serial_ClearTransmitBuffer( void );
Clears the serial transmit buffer.
returns 0 in any case
(02.04.2011 15:47:30)