EVMDM642 Board Setup Module
The Board Setup API provides general functions used for board initialization. The EVMDM642_init() call must be made before any other BSL functions as it is responsible for all BSL initialization. The EVMDM642_rget() and EVMDM642_rset() functions are used to access to the asynchronous CPLD interface registers.
The following list summarizes the Board Setup API in terms of its function calls. All programs that use the BSL should include the evmdm642.h header file.
In addition to other things, it contains several useful constants:
| Name |
Typical Value |
Description |
| EVMDM642_CPLD_BASE |
0x90080000 |
Address of CPLD in data space |
| EVMDM642_OSDCTRL |
0x10 |
Index of OSDCTRL CPLD register |
| EVMDM642_THRESHLSB |
0x11 |
Index of THRESHLSB register |
| EVMDM642_THRESHMSB |
0x12 |
Index of THRESHMSB register |
| EVMDM642_ISR |
0x13 |
Index of ISR register |
| EVMDM642_IER |
0x14 |
Index of IER register |
| EVMDM642_GPIODIR |
0x15 |
Index of GPIODIR register |
| EVMDM642_GPIOSTAT |
0x16 |
Index of GPIOSTAT register |
| EVMDM642_LED |
0x17 |
Index of LED register |
| EVMDM642_FLASHPAGE |
0x18 |
Index of FLASHPAGE register |
| EVMDM642_REVISION |
0x1F |
Index of REVISION register |
EVMDM642_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
evmdm642.h
Required Libraries
evmdm642bsl.lib
Function Prototype
void EVMDM642_init( )
Parameters
None
Return Value
None
Example
/* Initialize the board support library */
EVMDM642_init();
EVMDM642_rget()
Description
Read an 8-bit value from a CPLD register.
Required Headers
evmdm642.h
Required Libraries
evmdm642bsl.lib
Function Prototype
Uint16 EVMDM642_rget(Int16 regnum)
Parameters
regnum – Index of CPLD register.
Return Value
Value of CPLD register
Example
/* Read the FPGA revision number */
version = EVMDM642_rget(EVMDM642_VERSION);
EVMDM642_rset()
Description
Write an 8-bit value to a CPLD register.
Required Headers
evmdm642.h
Required Libraries
evmdm642bsl.lib
Function Prototype
void EVMDM642_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 8 LEDs on */
EVMDM642_rset(EVMDM642_LED, 0xff);
EVMDM642_wait()
Description
Spin in a loop. Used for short timing loops.
Required Headers
evmdm642.h
Required Libraries
evmdm642bsl.lib
Function Prototype
void EVMDM642_wait(Uint32 delay)
Parameters
delay – number of loop iterations to spin
Return Value
None
Example
/* Spin for 100 loop iterations */
EVMDM642_wait(100);
EVMDM642_waitusec()
Description
Spin in a loop for a number of microseconds. Used for short timing loops. Roughly calibrated to wall clock time.
Required Headers
evmdm642.h
Required Libraries
evmdm642bsl.lib
Function Prototype
void EVMDM642_waitusec(Uint32 delay)
Parameters
delay – number of microseconds to delay.
Return Value
None
Example
/* Spin for 100 microseconds */
EVMDM642_waitusec(100);
EVMDM642_fpgaLoad()
Description
Programs the FPGA with hex file data.
Required Headers
evmdm642.h
Required Libraries
evmdm642bsl.lib
Function Prototype
void EVMDM642_fpgaLoad(Uint32 fpgaaddr)
Parameters
fpgaaddr – Address of FPGA data. The constant EVMDM642_FPGAFLASH_BASE is defined as the address in Flash where the FPGA data is stored by default.
Return Value
None
Example
/* Load the FPGA from Flash */
EVMDM642_fpgaLoad(EVMDM642_FPGAFLASH_BASE);
|