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

EVMDM642 UART Module

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

Function Description
EVMDM642_UART_open Initialize the UART module
EVMDM642_UART_rget Read from a UART register
EVMDM642_UART_rset Write to a UART register
EVMDM642_UART_getChar Get an 8-bit byte through UART
EVMDM642_UART_putChar Send an 8-bit byte through UART

EVMDM642_UART_open()

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

Required Headers
evmdm642.h
evmdm642_uart.h

Required Libraries
evmdm642bsl.lib

Function Prototype
EVMDM642_UART_Handle EVMDM642_UART_open(Int16 devid, Int16 baudrate, EVMDM642_UART_Config *Config)

Parameters
devid – device ID, always 0 on the EVMDM642
baudrate - baud rate, use constants defined in evmdm642_uart.h. Possible values are:

    EVMDM642_UART_BAUD115200
    EVMDM642_UART_BAUD57600
    EVMDM642_UART_BAUD38400
    EVMDM642_UART_BAUD19200
    EVMDM642_UART_BAUD9600
    EVMDM642_UART_BAUD4800
    EVMDM642_UART_BAUD2400
    EVMDM642_UART_BAUD1200
config - pointer to a UART register config structure

Return Value
Active UART handle

Example

    /* Open UART at 19200 baud 
     * in normal (non-FIFO mode) */
    EVMDM642_UART_Handle hUart;
    EVMDM642_UART_Config uartcfg = {
        0x00, // IER
        0x00, // FCR
        0x03, // LCR
        0x00  // MCR
    }
    hUart = EVMDM642_UART_open(0,
            EVMDM642_UART_BAUD_19200, &uartcfg);

EVMDM642_UART_rget()

Description
Get the value of a UART register

Required Headers
evmdm642.h
evmdm642_uart.h

Required Libraries
evmdm642bsl.lib

Function Prototype
Int16 EVMDM642_UART_rget(EVMDM642_UART_Handle hUart, Int16 regnum)

Parameters
hUart - UART handle (see EVMDM642_UART_open() )
regnum - Index of register to get. Defined in evmdm642_uart.h as EVMDM642_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 = EVMDM642_UART_rget(hUart, EVMDM642_UART_LCR);

EVMDM642_UART_rset()

Description
Set the value of a UART register

Required Headers
evmdm642.h
evmdm642_uart.h

Required Libraries
evmdm642bsl.lib

Function Prototype
void EVMDM642_UART_rset(EVMDM642_UART_Handle hUart, Int16 regnum, Int16 regval)

Parameters
hUart - UART handle (see EVMDM642_UART_open() )
regnum - index of register to get. Defined in evmdm642_uart.h as EVMDM642_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 */
    EVMDM642_UART_rset(hUart, EVMDM642_UART_LCR, 0x03);

EVMDM642_UART_getChar()

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

Required Headers
evmdm642.h
evmdm642_uart.h

Required Libraries
evmdm642bsl.lib

Function Prototype
Int16 EVMDM642_UART_getChar(EVMDM642_UART_Handle hUart)

Parameters
hUart - UART handle (see EVMDM642_UART_open() )

Return Value
Character value

Example

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

EVMDM642_UART_putChar()

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

Required Headers
evmdm642.h
evmdm642_uart.h

Required Libraries
evmdm642bsl.lib

Function Prototype
void EVMDM642_UART_rset(EVMDM642_UART_Handle hUart, Uint16 data)

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

Return Value
None

Example

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