Vector VEC256 Specifiche Pagina 336

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 346
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 335
336 www.xilinx.com Embedded System Tools Guide (EDK 6.2i)
1-800-255-7778 UG111 (v1.4) January 30, 2004
Chapter 23: Interrupt Management
R
/* Set timer with new value of timer_count */
XTmrCtr_mSetLoadReg(XPAR_MYTIMER_BASEADDR, 0, (timer_count*tim
er_count+1) * 1000000);
}
}
}
/* 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 */
if ((count <<= 1) > 8) {
count = 1;
}
/* Write value to gpio. 0 means light up, hence count is negated */
gpio_data = ~count;
XGpio_mSetDataReg(XPAR_MYGPIO_BASEADDR, gpio_data);
/* Clear the timer interrupt */
XTmrCtr_mSetControlStatusReg(XPAR_MYTIMER_BASEADDR, 0, csr);
}
}
void
main() {
unsigned int gpio_data;
/* Enable microblaze interrupts */
microblaze_enable_interrupts();
/* Connect uart interrupt handler that will be called when an interrupt
* for the uart occurs
*/
XIntc_RegisterHandler(XPAR_MYINTC_BASEADDR,
XPAR_MYINTC_MYUART_INTERRUPT_INTR,
(XInterruptHandler)uart_int_handler,
(void *)XPAR_MYUART_BASEADDR);
/* Start the interrupt controller */
XIntc_mMasterEnable(XPAR_MYINTC_BASEADDR);
/* Set the gpio as output on high 3 bits (LEDs)*/
XGpio_mSetDataDirection(XPAR_MYGPIO_BASEADDR, 0x00);
/* set the number of cycles the timer counts before interrupting */
Vedere la pagina 335
1 2 ... 331 332 333 334 335 336 337 338 339 340 341 ... 345 346

Commenti su questo manuale

Nessun commento