在我的项目中,我在 Quartus 的 Qsys 设计中使用了一个简单的周期性中断。下面我需要创建一个可以从用户定义的值(以秒为单位)计数的计数器,但我不确定如何开始编写代码。我已经在线查看了 Atera 手册以了解如何开始,但我仍然有点困惑。以下是我到目前为止所拥有的
//*****************************************************************************
//*****************************************************************************
#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();