1 / 14

LAB04-Core Peripherals -Experiment-

LAB04-Core Peripherals -Experiment-. Speaker: Chuang Chi Chiou Advisor: Prof. Chun-Yao Wang Oct 27, 2003. Department of Computer Science National Tsing Hua University. Goal of This Lab. Understand the main mechanism of Timer/Interrupt operations. How to Perform Timer/Interrupt.

Télécharger la présentation

LAB04-Core Peripherals -Experiment-

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. LAB04-Core Peripherals-Experiment- Speaker: Chuang Chi Chiou Advisor: Prof. Chun-Yao Wang Oct 27, 2003 Department ofComputer Science National Tsing Hua University

  2. Goal of This Lab • Understand the main mechanism of Timer/Interrupt operations SoC Design Laboratory

  3. How to Perform Timer/Interrupt • With two methods: -Pure software : Armulator -Hardware :Multi-ICE • In this lab,we choose hardware method SoC Design Laboratory

  4. Interrupt Processing Flow 1 Memory AP IRQ Counter Timers Interrupt Controller Vector Branch Table IRQ(0x18) Interrupt_Handler User Code User Code Interrupt_Service_Routine: -ISR tasks -Clear IRQ Interrupt_Handler : -Check IRQ source -Branch to corresponding Interrupt Service Routine Interrupt_Service_Routine SoC Design Laboratory

  5. The Important functions of Source code • LoadTimer, WriteTimerCtrl, ReadTimer, ClearTimer: Timer related functions • enableIRQ: The IRQ enable bit in the CPSR is set to enable IRQ SoC Design Laboratory

  6. Interrupt Processing Flow Memory AP IRQ Counter Timers Interrupt Controller Vector Branch Table IRQ(0x18) 2 Interrupt_Handler User Code User Code Interrupt_Service_Routine: -ISR tasks -Clear IRQ Interrupt_Handler : -Check IRQ source -Branch to corresponding Interrupt Service Routine Interrupt_Service_Routine SoC Design Laboratory

  7. The Important Functions of Source code • Install_Handler: This function installs the IRQ handler at the branch vector table at 0x18 SoC Design Laboratory

  8. Interrupt Processing Flow Memory AP IRQ Counter Timers Interrupt Controller Vector Branch Table IRQ(0x18) 3 Interrupt_Handler User Code 3 User Code Interrupt_Service_Routine: -ISR tasks -Clear IRQ Interrupt_Handler : -Check IRQ source -Branch to corresponding Interrupt Service Routine Interrupt_Service_Routine SoC Design Laboratory

  9. The Important Functions of Source code • myIRQHandler: This is the user’s IRQ handler. It performs the timer ISR in this example SoC Design Laboratory

  10. The mechanism of Timer/Interrupt operations int main(void) { int IRQ0_STATUS_ADDR = 0x14000000; int IRQ0_RAWSTAT_ADDR = 0x14000004; int IRQ0_ENABLESET_ADDR = 0x14000008; int IRQ0_ENABLECLR_ADDR = 0x1400000C; int *IRQ0_STATUS, *IRQ0_RAWSTAT, *IRQ0_ENABLESET, *IRQ0_ENABLECLR; unsigned *irqvec = (unsigned *)0x18; Install_Handler( (unsigned)myIRQHandler, irqvec ); /* Install user’s IRQ Handler */ enable_IRQ(); IRQ0_STATUS = (int *) IRQ0_STATUS_ADDR; IRQ0_RAWSTAT = (int *) IRQ0_RAWSTAT_ADDR; IRQ0_ENABLESET = (int *) IRQ0_ENABLESET_ADDR; IRQ0_ENABLECLR = (int *) IRQ0_ENABLECLR_ADDR; IRQ0_ENABLESET = 0x0021; installs the memory addresses of IRQ Enables the IRQs of Timer0 and SWI SoC Design Laboratory

  11. The mechanism of Timer/Interrupt operations LoadTimer(64); // load timer value WriteTimerCtrl(0xC8); // enable the timer ……………………….. ……………………….. ……………………….. ……………………….. } Sets the timer down-counting from 64 and triggers the timer to start downcounting. decide the operation mode and choose the divisor value SoC Design Laboratory

  12. Steps of This Lab 1.Assemble AP,CM and LM carefully 2.Safely assemble Multi-ICE on CM 3.Turn on the power 4.Execute Multi-ICE server and click the Auto-Configuration icon 5.Execute CodeWarrior and create a new ARM Executable Image project ,add irq.c to the project ,make the project 6.Open AXD 7.Select Option->Configure Target and select Multi-ICE 8.Run the project finally SoC Design Laboratory

  13. Exercise • Use the Timer/Interrupt to evaluate the performance of other applications • Spec: Use Timer/Interrupt to calculate the time of ssram.c when executing. • Hint: You can start Timer/Interrupt when ssram.c begin to execute, and you can count how many times the interrupt occurred. • Note: The period of Timer clock is 0.5 s. SoC Design Laboratory

  14. Discussion • How to use multi-Timer/Interrupt • Give some suggestions for this lab SoC Design Laboratory

More Related