Site Index
   Home
   File Upload
Google

Transfer Site
Main Site

EVM5502 Board Setup Module

The Board Setup API provides general functions used for board initialization. The EVM5502_init() call must be made before any other BSL functions as it is responsible for all BSL initialization. The EVM5502_rget() and EVM5502_rset() functions are used to access on on-board CPLD register.

The following list summarizes the Board Setup API in terms of its function calls:

Function Description
EVM5502_init Initialize the BSL
EVM5502_rget Read an 8-bit value from a CPLD register
EVM5502_rset Write an 8-bit value to a CPLD register
EVM5502_wait Wait for a specified number of cycles
EVM5502_waitusec Wait for a specified number of microseconds

All programs that use the BSL should include the evm5502.h header file. In addition to other things, it contains several useful constants:

Name Typical Value Description
EVM5502_CPLD_BASE 0x380000 Address of CPLD in data space
EVM5502_USER_REG 0 Index of USER_REG CPLD register
EVM5502_DC_REG 1 Index of DC_REG CPLD register
EVM5502_VERSION 4 Index of VERSION CPLD register
EVM5502_MISC 6 Index of MISC CPLD register
EVM5502_BOARD 10 Index of BOARD CPLD register

EVM5502_init()

Description
Sets all CPLD registers to their power-on states and initializes internal BSL data structures. Must be called before any other BSL functions.

Required Headers
evm5502.h

Required Libraries
evm5502bsl.lib

Function Prototype
void EVM5502_init( )

Parameters
None

Return Value
None

Example

    /* Initialize the board support library */
    EVM5502_init(); 

EVM5502_rget()

Description
Read an 8-bit value from a CPLD register.

Required Headers
evm5502.h

Required Libraries
evm5502bsl.lib

Function Prototype
Uint16 EVM5502_rget(Int16 regnum)

Parameters
regnum Index of CPLD register.

Return Value
Value of CPLD register

Example

    /* Read the value of DIP switch #0 */
    if (EVM5502_rget(EVM5502_USER_REG) & 0x10) {
        /* Switch #0 is on */
    } else {
        /* Switch #0 is off */
    }

EVM5502_rset()

Description
Write an 8-bit value to a CPLD register.

Required Headers
evm5502.h

Required Libraries
evm5502bsl.lib

Function Prototype
void EVM5502_rset(Int16 regnum, Uint16 regval)

Parameters
regnum Index of CPLD register.
regval Value to set the register to. Only the lower 8 bits are used.

Return Value
None

Example

    /* Turn all 4 LEDs on */
    EVM5502_rset(EVM5502_USER_REG, 0xf); 

EVM5502_wait()

Description
Spin in a loop. Used for short timing loops.

Required Headers
evm5502.h

Required Libraries
evm5502bsl.lib

Function Prototype
void EVM5502_wait(Uint32 delay)

Parameters
delay number of loop iterations to spin

Return Value
None

Example

    /* Spin for 100 loop iterations */
    EVM5502_wait(100);

EVM5502_waitusec()

Description
Spin in a loop for a number of microseconds. Used for short timing loops. Roughly calibrated to wall clock time.

Required Headers
evm5502.h

Required Libraries
evm5502bsl.lib

Function Prototype
void EVM5502_waitusec(Uint32 delay)

Parameters
delay number of microseconds to delay.

Return Value
None

Example

    /* Spin for 100 microseconds */
    EVM5502_waitusec(100);
©Copyright 2002-2011 Spectrum Digital, Inc. All Rights Reserved.