|
Sundance TIMs |
Top Previous Next |
|
Sundance C6000 processors are built around a range of modules called TIMs. Each TIM uses an FPGA to implement the Sundance peripherals such as comports and SDBs. Most Diamond applications do not need to know anything about the FPGA, but occasionally it may be necessary to be able to access it. The header file <smt_fpga.h> provides definitions of the standard registers that are used to control FPGA resources. In particular, it contains a function SMT_FpgaBase that computes the base address used to access FPGA registers.
The base address varies from TIM to TIM, so the header file normally defines only offsets that can be added to the actual base address of the FPGA to generate the address of the registers.
For example, the LED register can be found as follows:
#include <smt_fpga.h> // defines only offsets unsigned int *LED;
main() { LED = (unsigned int *)(SMT_FpgaBase() + LED_OFFSET); *LED = 7; // turn on 3 LEDs }
If your code does not need to be general and you know the FPGA address for the TIM on which it always run, you can condition the header file by defining ___TIM to be that address. Now when you include smt_fpga.h it provides definitions for all the registers, as shown in the following example which is identical to the one above except that it runs only on an SMT361.
#define ___TIM 0x90000000 // define base of FPGA for SMT361 // note the three underlines. #include <SMT_FPGA.h> // now defines LED for you
main() { *LED = 7; // turn on 3 LEDs } | |||||