- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am porting a small kernel from avr to nios2 using a DE2 board. I have tried to modify the enable and disable interrupt macro like the follow: # define DISABLE_INTERRUPTS { asm volatile ( "addi r27, r27, -4 \n\t" "stw r3, 0(r27) \n\t" "addi r27, r27, -4 \n\t" "stw r2, 0(r27) \n\t" "movhi r2, 0xFF00 \n\t" "subi r2, r2, 2 \n\t" "rdctl r3, ctl0 \n\t" "and r3, r3, r2 \n\t" "wrctl ctl0, r3 \n\t" "ldw r2, 0(r27) \n\t" "addi r27, r27, 4 \n\t" "ldw r3, 0(r27) \n\t" "addi r27, r27, 4 " ); } # define ENABLE_INTERRUPTS { asm volatile ( "addi r27, r27, -4 \n\t" "stw r3, 0(r27) \n\t" "rdctl r3, ctl0 \n\t" "ori r3, r3, 1 \n\t" "wrctl ctl0, r3 \n\t" "ldw r3, 0(r27) \n\t" "addi r27, r27, 4 " ); } When I try to debug using the hardware, the status register can not be correctly set. But when I use the instruction set simulator, it works fine. Can someone give me some hint. with regards, WeiLink Copied
5 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Why don't you use altera's library irq enable and disable?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi aprado,
--- Quote Start --- Why don't you use altera's library irq enable and disable? --- Quote End --- I have looked into the provided one. The alt_irq_enable_all need a context, which force me the modify other kernel code.- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
you can pass null as the context i think
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
--- Quote Start --- you can pass null as the context i think --- Quote End --- I will try that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Context is useful when calling irq enable all to restore interrupt conditions present before calling irq disable all!
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page