Specifications
Embedded System Tools Guide (EDK 6.2i) www.xilinx.com 331
UG111 (v1.4) January 30, 2004 1-800-255-7778
Example Systems
R
i On interrupts MicroBlaze jumps to the handler function using the exception table.
Example MHS File Snippet
BEGIN opb_timer
parameter INSTANCE = mytimer
parameter HW_VER = 1.00.b
parameter C_BASEADDR = 0xFFFF0000
parameter C_HIGHADDR = 0xFFFF00ff
bus_interface SOPB = opb_bus
port Interrupt = interrupt
port CaptureTrig0 = net_gnd
END
begin microblaze
parameter INSTANCE = mblaze
parameter HW_VER = 1.00.c
bus_interface DOPB = opb_bus
bus_interface DLMB = d_lmb
bus_interface ILMB = i_lmb
port INTERRUPT = interrupt
end
Example MSS File snippet
BEGIN DRIVER
parameter HW_INSTANCE = mytimer
parameter DRIVER_NAME = tmrctr
parameter DRIVER_VER = 1.00.b
parameter INT_HANDLER = timer_int_handler, INT_PORT = Interrupt
END
Example C Program
#include <xtmrctr_l.h>
#include <xgpio_l.h>
#include <xparameters.h>
/* Global variables: count is the count displayed using the
* LEDs, and timer_count is the interrupt frequency.
*/
unsigned int count = 1; /* default count */
unsigned int timer_count = 1; /* default timer_count */
/* timer interrupt service routine */
void timer_int_handler(void * baseaddr_p) {
unsigned int csr;
unsigned int gpio_data;
/* Read timer 0 CSR to see if it raised the interrupt */
csr = XTmrCtr_mGetControlStatusReg(XPAR_MYTIMER_BASEADDR, 0);
if (csr & XTC_CSR_INT_OCCURED_MASK) {
/* Increment the count */










