⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bench_int.c

📁 This zip describes a benchmark software provided by IXXAT. It shows how to use the DBGU and timer pe
💻 C
字号:
//*----------------------------------------------------------------------------
//*         ATMEL Microcontroller Software Support  -  ROUSSET  -
//*----------------------------------------------------------------------------
//* The software is delivered "AS IS" without warranty or condition of any
//* kind, either express, implied or statutory. This includes without
//* limitation any warranty or condition with respect to merchantability or
//* fitness for any particular purpose, or against the infringements of
//* intellectual property rights of others.
//*----------------------------------------------------------------------------
//* File Name           : benchmark_int.c
//* Object              : Run in Specific area internal memory
//* Creation            : JPP   06/Jun/2003
//*----------------------------------------------------------------------------

#include "AT91RM9200.h"
#include "lib_AT91RM9200.h"
#include "target.h"

extern volatile UINT32 ISRCounter;
extern volatile UINT32 TimerTicks;

#pragma ghs section text=".internal" 

/*************************************************************************
**
** Function   : GenerateInt
** Description: Generate an interrupt request to fire the MeasureISR
**              If the interrupt controller doesn't support self interrupt
**              generation, use two ports with a short circuit or any
**              other periphery unit.
** Parameters : -
** Returnvalue: -
**
*************************************************************************/
void GenerateInt(void)
{
    // set interrupt request
    //* generate software interrupt 
    AT91F_AIC_Trig (AT91C_BASE_AIC,AT91C_ID_SYS) ;
}

/*************************************************************************
**
** Function   : IntFunc
** Description: function called from interrupt
** Parameters : -
** Returnvalue: -
**
*************************************************************************/
void IntFunc(void)
{
  // increment counter value to check the number of interrupt generations
  ISRCounter++;
}

/*************************************************************************
**    Interrupt functions
*************************************************************************/

/*************************************************************************
**
** Function   : TimerISR
** Description: Timer interrupt service routine: runs every msec.
**              Must have higher priority than the MeasureISR.
** Parameters : -
** Returnvalue: -
**
*************************************************************************/
void TimerISR(void)
{
    unsigned int dummy;
    //* Acknowledge interrupt status
    dummy = AT91C_BASE_TC0->TC_SR;
    //* Supress warning variable "dummy" was set but never used
    dummy = dummy;
    TimerTicks++;             // counts msec
#ifdef DEBUG
    if ( (AT91F_PIO_GetInput(AT91C_BASE_PIOB) & LED_MASK ) == LED_MASK )
    {
        AT91F_PIO_ClearOutput( AT91C_BASE_PIOB, LED_MASK );
    }
    else
    {
        AT91F_PIO_SetOutput( AT91C_BASE_PIOB, LED_MASK );
    }
#endif 
}

/*************************************************************************
**
** Function   : MeasureISR
** Description: ISR for interrupt performance measuring
**              Must have lower priority than the TimerISR.
** Parameters : -
** Returnvalue: -
**
*************************************************************************/
void MeasureISR(void) 
{
  IntFunc();
}
/*************************************************************************
**
** Function   : GetTime
** Description: Returns a 32 bit timer value with a resolution of 1 msec.
** Parameters : -
** Returnvalue: timer value
**
*************************************************************************/
UINT32 GetTime(void)
{
  return TimerTicks;
}

/*************************************************************************
**
** Function   : benchmark_int
** Description: C-Benchmark program for micro-controllers.
**              Inludes some test routines which can typically
**              be found in embedded CAN application.** Parameters : -
** Returnvalue: None
**
*************************************************************************/

#define  benchmark	benchmark_int
#include "benchmrk.c"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -