EVM5509 Board Setup Module
The Board Setup API provides general functions used for board initialization. The EVM5509_init() call must be made before any other BSL functions as it is responsible for all BSL initialization. The EVM5509_rget() and EVM5509_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:
All programs that use the BSL should include the evm5509.h header file. In addition to other things, it contains several useful constants:
| Name |
Typical Value |
Description |
| EVM5509_CPLD_BASE |
0x3F0000 |
Address of CPLD in data space |
| EVM5509_USER_REG |
0 |
Index of USER_REG CPLD register |
| EVM5509_DC_REG |
1 |
Index of DC_REG CPLD register |
| EVM5509_VERSION |
4 |
Index of VERSION CPLD register |
| EVM5509_MISC |
6 |
Index of MISC CPLD register |
| EVM5509_LCD0 |
8 |
Index of LCD0 CPLD register |
| EVM5509_LCD1 |
9 |
Index of LCD1 CPLD register |
| EVM5509_BOARD |
10 |
Index of BOARD CPLD register |
EVM5509_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
evm5509.h
Required Libraries
evm5509bsl.lib
Function Prototype
void EVM5509_init( )
Parameters
None
Return Value
None
Example
/* Initialize the board support library */
EVM5509_init();
EVM5509_rget()
Description
Read an 8-bit value from a CPLD register.
Required Headers
evm5509.h
Required Libraries
evm5509bsl.lib
Function Prototype
Uint16 EVM5509_rget(Int16 regnum)
Parameters
regnum – Index of CPLD register.
Return Value
Value of CPLD register
Example
/* Read the value of DIP switch #0 */
if ( EVM5509_rget(EVM5509_USER_REG) & 0x10 )
{
/* Switch #0 is on */
}
else
{
/* Switch #0 is off */
}
EVM5509_rset()
Description
Write an 8-bit value to a CPLD register.
Required Headers
evm5509.h
Required Libraries
evm5509bsl.lib
Function Prototype
void EVM5509_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 */
EVM5509_rset(EVM5509_USER_REG, 0xf);
EVM5509_mget()
Description
Read a 16-bit value from a 23-bit memory address
Required Headers
evm5509.h
Required Libraries
evm5509bsl.lib
Function Prototype
Uint16 EVM5509_mget(Uint32 memaddr)
Parameters
memaddr – Memory address
Return Value
16-bit value at memory address
Example
Uint16 data;
/* Read the value at location 0x1000 */
data = EVM5509_mget( 0x1000 )
EVM5509_mset()
Description
Write a 16-bit value to a 23-bit memory address
Required Headers
evm5509.h
Required Libraries
evm5509bsl.lib
Function Prototype
void EVM5509_mset(Uint32 memaddr, Uint16 memval)
Parameters
memaddr – Memory address
memval – Value to write to the memory address
Return Value
None
Example
/* Set the value at memory location 0x1000 to 0 */
EVM5509_mget( 0x1000, 0 )
EVM5509_wait()
Description
Spin in a loop. Used for short timing loops.
Required Headers
evm5509.h
Required Libraries
evm5509bsl.lib
Function Prototype
void EVM5509_wait(Uint32 delay)
Parameters
delay – number of loop iterations to spin
Return Value
None
Example
/* Spin for 100 loop iterations */
EVM5509_wait(100);
EVM5509_waitusec()
Description
Spin in a loop for a number of microseconds. Used for short timing loops. Roughly calibrated to wall clock time.
Required Headers
evm5509.h
Required Libraries
evm5509bsl.lib
Function Prototype
void EVM5509_waitusec(Uint32 delay)
Parameters
delay – number of microseconds to delay.
Return Value
None
Example
/* Spin for 100 microseconds */
EVM5509_waitusec(100);
|