Ect 358
Download
1 / 12

ECT 358 - PowerPoint PPT Presentation


  • 67 Views
  • Uploaded on

ECT 358. Lecture 25 Interrupts. The best way to forget your own problems is to help someone solve his. Look not every man on his own things, but every man also on the things of others. Phillippians 2:4. Interrupts. MicroBlaze has one interrupt port.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' ECT 358' - charles-good


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
Ect 358

ECT 358

Lecture 25

Interrupts


The best way to forget your own problems is to help someone solve his
The best way to forget your own problems is to help someone solve his.

Look not every man on his own things, but every man also on the things of others. Phillippians 2:4


Interrupts
Interrupts solve his.

  • MicroBlaze has one interrupt port.

  • An interrupt controller peripheral is required for handling more than one interrupt signal.


Interrupt sources
Interrupt Sources solve his.

  • Interrupt Controller Peripheral

  • Peripheral with an Interrupt Port

  • External Interrupt Port

  • Interrupt Handlers

  • Interrupt Vector Table in MicroBlaze

  • Interrupt Routines in MicroBlaze


Interrupt action
Interrupt Action solve his.

  • Interrupt occurs

  • MicroBlaze jumps to address location 0x10

  • Interrupt Vector Table contains address of Interrupt Handler for Interrupt Source

  • MicroBlaze jumps to address of Interrupt Handler (Subroutine)

  • Subroutine returns and MicroBlaze returns to original code execution


Interrupt controller peripheral
Interrupt Controller Peripheral solve his.

  • An interrupt controller peripheral should be used for handling multiple interrupts.

  • The interrupt handler for the interrupt controller peripheral is automatically generated by Libgen.

  • Peripherals are handled by individual interrupt handlers in the order of their priority.

  • The interrupt controller handler services each interrupt signal that is active starting from the highest priority signal.

  • Each of the peripheral interrupt signals needs to be associated with an ISR.



Peripheral with interrupt
Peripheral with Interrupt solve his.

  • Change the following lines of the MHS snippet in the OPBTIMER section to the following

    port Interrupt = interrupt

    port CaptureTrig0 = net_gnd

    Delete references to other interrupt controller


Peripheral with interrupt1
Peripheral with Interrupt solve his.

  • Change the following lines of the MSS snippet in the OPBTIMER section to the following

    parameter INT_HANDLER = timer_int_handler, INT_PORT = Interrupt

    timer_int_handler is the name of your interrupt service routine.

    Delete references to other interrupt controller.


Interrupt handlers
Interrupt Handlers solve his.

You can write your own interrupt handlers, or ISRs, for any peripherals that raise interrupts. You write these routines in C as with other functions. You can give the interrupt handler function any name with the signature void func (void *). Alternately, you can elect to register the handlers defined as a part of the drivers of the interrupt sources.


Example c file
Example C File solve his.

#include <xtmrctr_l.h>

void timer_int_handler(void * baseaddr_p)

{

int status;

status = XTmrCtr_mGetControlStatusReg(baseaddr_p, 0);

if (status & XTC_CSR_INT_OCCURED_MASK)

{

/* your code here */

/* Clear the timer interrupt */

XTmrCtr_mSetControlStatusReg(baseaddr_p, 0, status);

}

}


Example c file1
Example C File solve his.

void main()

{

/* initializations */

microblaze_enable_interrupts();

XTmrCtr_mSetLoadReg(XPAR_OPB_TIMER_1_BASEADDR, 0, 1000000);

/* reset the timers, and clear interrupts */

XTmrCtr_mSetControlStatusReg(XPAR_OPB_TIMER_1_BASEADDR, 0,

XTC_CSR_INT_OCCURED_MASK | XTC_CSR_LOAD_MASK );

/* start the timers */

XTmrCtr_mSetControlStatusReg(XPAR_OPB_TIMER_1_BASEADDR, 0,

XTC_CSR_ENABLE_TMR_MASK | XTC_CSR_ENABLE_INT_MASK |

XTC_CSR_AUTO_RELOAD_MASK | XTC_CSR_DOWN_COUNT_MASK);

/* Wait for interrupts to occur */

while (1);

}


ad