www.beck-ipc.com

@CHIP-RTOS C Library V2.00 - Fossil API


fossil_setbaud

Set baud rate and port configuration.

int fossil_setbaud (int port, long baudrate, int parity,
                    int wordlen, int stopbits );

Parameters

port

Port specifier:   FOSSIL_EXT = 0 for EXT port,   FOSSIL_COM = 1 for COM port

baudrate

Desired baud rate, bits per second

parity

Enumeration type:
    FOSSIL_PARITY_NO = 0
    FOSSIL_PARITY_ODD = 1
    FOSSIL_PARITY_EVEN = 2
    FOSSIL_PARITY_MARK = 3
    FOSSIL_PARITY_SPACE = 4

wordlen

Bits per character (7 or 8)

stopbits

Stop bits (1 or 2)

Return Value

-1 = Illegal parameter
Else status code (bit field):
    bit 6: FOSSIL_OUTPUT_BUFFER_EMPTY
    bit 5: FOSSIL_OUTPUT_NOT_FULL
    bit 4: FOSSIL_LINE_BREAK Line break detected
    bit 3: FOSSIL_FRAMING_ERROR Framing error detected
    bit 2: FOSSIL_PARITY_ERROR Parity error detected
    bit 1: FOSSIL_OVERRUN_ERROR Set if overrun occurred on receiver.
    bit 0: FOSSIL_DATA_AVAILABLE Set if data is available in receiver buffer.

The header file contains the indicated mask definitions.

Comments

Set baud rate and other parameters for specified port.

Two stop bits are only available if no parity is set.

For standard baud rates, this function uses Fossil interrupt 0x14 Service 0x00.

For non-standard baud rates the HAL interrupt 0xA1 "Get Frequencies" function 0x8A is used to determine the maximum baud rate.   Based on this maximum baud rate a baud rate divider is computed for the "Extended Line Control Initialization" Fossil interrupt 0x81 service.   Then the Fossil interrupt 0x03 service reports the port's status.

See Also

RTOS API

This library function invokes a RTOS software interrupt. Refer to this RTOS API function's documentation for more details.


Developer Notes

Two Stopbits are only supported without parity.
If the DMA mode (send or receive mode) is enabled at Chip.ini, two stopbits are gernerally not supported.


This API List
List of C Libraries
@CHIP-RTOS Main Index


End of document