Forum: FPGA, VHDL & Co. Uart Interurpt:


von Andre (Gast)


Lesenswert?

Hallo,

ich versuche mich im Moment mit dem Uart-Interrupt am MicroBlaze.

Soweit scheint der Code zu funktionieren, also wenn eine Taste gedrückt 
wird, erfolgt ein Sprung in die ISR. Doch von aus komme man nicht mehr 
aus.
Hat jemand eine Idee, wie man dies lösen könnten.

Der Code ist aus dem Bsp, in abgewandelter Form im:

http://www.xilinx.com/support/documentation/sw_manuals/edk10_est_rm.pdf

auf Seite 237. Es handelt es sich um ein Beispiel mit einen 
Interrupt-Controller, damit mehrere Geräte einen Interrupt erzeugen 
können.
1
#include<xtmrctr_l.h>
2
#include<xuartlite_l.h> 
3
#include<xintc_l.h>
4
#include<xgpio_l.h>
5
#include<xparameters.h>
6
7
8
9
#define XPAR_MYUART_BASEADDR XPAR_UARTLITE_0_BASEADDR
10
#define XPAR_MYTIMER_BASEADDR XPAR_TMRCTR_0_BASEADDR
11
#define XPAR_MYINTC_BASEADDR XPAR_INTC_0_BASEADDR
12
#define XPAR_MYINTC_MYUART_INTERRUPT_INTR XPAR_INTC_0_UARTLITE_0_VEC_ID
13
#define XPAR_MYTIMER_INTERRUPT_MASK XPAR_XPS_TIMER_1_INTERRUPT_MASK
14
#define XPAR_MYUART_INTERRUPT_MASK XPAR_RS232_UART_1_INTERRUPT_MASK
15
#define XPAR_MYGPIO_BASEADDR XPAR_LEDS_4BIT_BASEADDR
16
17
/* Global variables: count is the count displayed using the
18
* LEDs, and timer_count is the interrupt frequency.
19
*/
20
21
void uart_int_handler(void *baseaddr_p) {
22
23
    xil_printf("uart_int_handler");
24
    XUartLite_mDisableIntr(XPAR_MYUART_BASEADDR);
25
}
26
27
28
int main(){
29
  unsigned int gpio_data;
30
  
31
  /* Enable microblaze interrupts */
32
    microblaze_enable_interrupts();
33
  
34
  /* Connect uart interrupt handler that will be called when an interrupt
35
  * for the uart occurs
36
  */
37
    XIntc_RegisterHandler(XPAR_MYINTC_BASEADDR,
38
                   XPAR_MYINTC_MYUART_INTERRUPT_INTR,
39
                   (XInterruptHandler)uart_int_handler,
40
                   (void *)XPAR_MYUART_BASEADDR);
41
42
  
43
  /* Start the interrupt controller */
44
    XIntc_mMasterEnable(XPAR_MYINTC_BASEADDR);
45
  
46
  /* Enable timer and uart interrupts in the interrupt controller */
47
    XIntc_mEnableIntr(XPAR_MYINTC_BASEADDR, XPAR_MYUART_INTERRUPT_MASK);
48
    
49
  /* Enable Uartlite interrupt */
50
    XUartLite_mEnableIntr(XPAR_MYUART_BASEADDR);  
51
  
52
  /* Wait for interrupts to occur */
53
  while (1)
54
  ;
55
  
56
return 0;
57
}

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.