IPC@CHIP® RTOS-PPC – API Documentation

Header image

Main page


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

Set baud rate and port configuration for specified port.

Parameters:
port port number index: 0=UART1 ... 5=UART6, see FOSSIL_PORT
baudrate Desired baud rate, bits per second
parity Parity mode, see FOSSIL_PARITY
wordlen Bits per character (5 - 8)
stopbits Stop bits
0 = 1.5 stop bits
1 = 1 stop bit
2 = 2 stop bits
Returns:
Port status:
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
Note:
Please read the following note, if you're interested in the precision of the selected baud rate. A 16 bit clock divider for the desired baud rate is calculated internally by this function. The following formulas are used for the divider calculation:

Baud rate <= 460800 bit/s:
     The prescaler 32 is used.
     Baud divisor = ((IPB clock / baud) + 16) / 32

Baud rate > 460800 bit/s:
     The prescaler 4 is used.
     Baud divisor = ((IPB clock / baud) + 2) / 4

Accordingly the real baud rate can be calculated with these formulars:

Baud rate <= 460800 bit/s:
     Real baud rate = IPB clock / 32 / baud divisor

Baud rate > 460800 bit/s:
     Real baud rate = IPB clock / 4 / baud divisor
Since:
SC2x3 V1.00 - CLIB V1.00
Changes:
SC2x3 V1.05 - Use different clock prescalers for baud rate calculation, previous RTOS versions always used prescaler 32.
See also:
fossil_initmode() fossil_init()





Top of page | Main page

Copyright © 2017 Beck IPC GmbH
Generated on Thu Jan 26 16:21:36 2017 by Doxygen 1.6.1