Site Index
   Support Home
   C6000 Home
   DaVinci EVM
   EVMDM6437
   EVM6424
   EVMDM642
   XEVM642
   DSKTCI6482
   EVMTCI6482
   DSK6455
   EVM6455
   EVM6418
   DSK6713
   DSK6416
   Ordering Info.
Google

C6000 Site
Support Site
Main Site

EVM6418 UART Module

This module communicates through the on-chip 16C550 compatible UART. To use the module, you must use the EVM6418_UART_open() call to get a handle of type EVM6418_UART_Handle which is then passed as a parameter to the other functions.

Function Description
EVM6418_UART_open Initialize the UART module
EVM6418_UART_rget Read from a UART register
EVM6418_UART_rset Write to a UART register
EVM6418_UART_getChar Get an 8-bit byte through UART
EVM6418_UART_putChar Send an 8-bit byte through UART

EVM6418_UART_open()

Description
Open the UART at a specific baud rate and return a UART handle

Required Headers
evm6418.h
evm6418_uart.h

Required Libraries
evm6418bsl.lib

Function Prototype
EVM6418_UART_Handle EVM6418_UART_open(Int16 devid, Int16 baudrate, EVM6418_UART_Config *Config)

Parameters
devid - Device ID, always 0 on the EVM6418
baudrate - baud rate, use constants defined in evm6418_uart.h. Possible values are:

    EVM6418_UART_BAUD_56000
    EVM6418_UART_BAUD_38400
    EVM6418_UART_BAUD_19200
    EVM6418_UART_BAUD_9600
    EVM6418_UART_BAUD_4800
    EVM6418_UART_BAUD_2400
    EVM6418_UART_BAUD_1200
config - pointer to a UART register config structure

Return Value
Active UART handle

Example

    /* Open UART at 19200 baud in normal (non-FIFO mode) */
    EVM6418_UART_Handle hUart;
    EVM6418_UART_Config uartcfg = {
        0x00, // IER
        0x00, // FCR
        0x03, // LCR
        0x00  // MCR
    }
    hUart = EVM6418_UART_open(0, EVM6418_UART_BAUD_19200, &uartcfg);

EVM6418_UART_rget()

Description
Get the value of a UART register

Required Headers
evm6418.h
evm6418_uart.h

Required Libraries
evm6418bsl.lib

Function Prototype
Int16 EVM6418_UART_rget(EVM6418_UART_Handle hUart, Int16 regnum)

Parameters
hUart - UART handle (see EVM6418_UART_open( ))
regnum - Index of register to get. Defined in evm6418_uart.h as EVM6418_UART_XXX where XXX is the name of the register

Return Value
Value of register, only lower 8-bits will contain data

Example

    /* Get the value of the LCR register */
    Int16 data;
    data = EVM6418_UART_rget(hUart, EVM6418_UART_LCR);

EVM6418_UART_rset()

Description
Set the value of a UART register

Required Headers
evm6418.h
evm6418_uart.h

Required Libraries
evm6418bsl.lib

Function Prototype
void EVM6418_UART_rset(EVM6418_UART_Handle hUart, Int16 regnum, Int16 regval)

Parameters
hUart - UART handle (see EVM6418_UART_open( ))
regnum - index of register to get. Defined in evm6418_uart.h as EVM6418_UART_XXX where XXX is the name of the register
regval - value to set the register to, only lower 8-bits are assigned

Return Value
None

Example

    /* Set the value of the LCR register to 0x03 */
    EVM6418_UART_rset(hUart, EVM6418_UART_LCR, 0x03);

EVM6418_UART_getChar()

Description
Get a character from the UART. Spins until a character is available

Required Headers
evm6418.h
evm6418_uart.h

Required Libraries
evm6418bsl.lib

Function Prototype
Int16 EVM6418_UART_getChar(EVM6418_UART_Handle hUart)

Parameters
hUart - UART handle (see EVM6418_UART_open() )

Return Value
Character value

Example

    /* Read a character from the UART */
    Int16 data;
    data = EVM6418_UART_getChar(hUart);

EVM6418_UART_putChar()

Description
Send a character to the UART. Spins until the UART transmitter is ready to accept data.

Required Headers
evm6418.h
evm6418_uart.h

Required Libraries
evm6418bsl.lib

Function Prototype
void EVM6418_UART_rset(EVM6418_UART_Handle hUart, Uint16 data)

Parameters
hUart - UART handle (see EVM6418_UART_open() )
data - Character to be sent

Return Value
None

Example

    /* Send the character ‘A’ to the UART */
    EVM6418_UART_putChar( hUart, ‘A’ );
©Copyright 2002-2012 Spectrum Digital, Inc. All Rights Reserved.