Question

In my project I am using a simple periodic interrupt in my Qsys design in Quartus. Below I need to make a counter that can count from a user defined value (which will be in seconds), but I am not sure how would I start writing the code. I have already looked at the Atera manual online for an idea of how to start but I am still a little confused. Below is what I have so far

//*****************************************************************************
//*****************************************************************************
#include "nios_std_types.h"
#include "system.h"
#include <stdio.h>
#include "sys/alt_stdio.h"

//*****************************************************************************
//                  Define symbolic constants
//*****************************************************************************
// define the PIO register offsets
#define TIMER_START_OFFSET 2
#define TIMER_CNTRL_MASK //Not sure what to write yet.


//*****************************************************************************
//                            Define private data
//*****************************************************************************
uint32 *timer_ptr = (uint32 *)TIMER_0_BASE;




//*****************************************************************************
//                             private functions
//*****************************************************************************

void Timer_StartTimer();
void Timer_StopTimer();
void Timer_SetTimeLimit();

No correct solution

OTHER TIPS

  1. Configure a time stamp timer in the Project BSP (board support file)
  2. Generate the BSP (right click on the project and generate)
  3. Register the ISR as below

     retVal = alt_ic_isr_register(HIGH_RES_TIMER_IRQ_INTERRUPT_CONTROLLER_ID,
                              HIGH_RES_TIMER_IRQ,
                              handle_timer_interrupts,
                              timer_ptr, 0x0);
    

then it should work, the same must be present in one of the document http://www.altera.com/support/ip/processors/nios2/ips-nios2_support.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top