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

📄 int.c

📁 s3c24a0固件测试代码 ? ? ? ? ?啊 
💻 C
字号:
/*****************************************
  NAME: int.c
  HISTORY:Internal Interrupt test
  2003.12.31: Baik Seung Woo  ver 0.0
 *****************************************/

#include <string.h>
#include "def.h"
#include "option.h"
#include "24A0addr.h"
#include "24A0lib.h"
#include "24A0slib.h" 

volatile int fiqCnt0, fiqCnt1;

static void __irq T0Int(void)           //FIQ
{
    ClearPending(BIT_TIMER0);
    fiqCnt0 += 1;

}

//--------------------------------------------------------------------
static void __irq T1Int(void)           //IRQ
{
    ClearPending(BIT_TIMER1);           
    fiqCnt1 += 1;
    
    if(fiqCnt0!=fiqCnt1)
        fiqCnt1 = 0; 
    if(fiqCnt0==10000)                  
        rTCON   = 0x0;                  
}

//**********************[ Test_Fiq ]**********************************
void Test_Fiq(void)
{
    int intmod;

    Uart_Printf("[ FIQ Interrupt Test ]\n");
    fiqCnt0     = 0;
    fiqCnt1     = 0;    
    pISR_FIQ    = (U32)T0Int;                
    pISR_TIMER1 = (U32)T1Int;                
    intmod      = rINTMOD;                      
    rINTMOD     = BIT_TIMER0;                   
    rSRCPND     = BIT_TIMER0 | BIT_TIMER1;      
    rINTPND     = BIT_TIMER0 | BIT_TIMER1;      
               
    rTCFG0  = 0x0;      
    rTCFG1  = 0x0;      
    rTCNTB0 = 2570;
    rTCNTB1 = 2570;
    rTCON   = 0xa0a;
    rTCON   = 0x909;
    
    rINTMSK = ~(BIT_TIMER0 | BIT_TIMER1);      

    while(fiqCnt1<10000)
    {
	       if((fiqCnt1%100)==0)   
           Uart_Printf(".");
    }
    rTCON = 0x0;       
    Delay(1);
    Uart_Printf("\nfiqCnt0 = %d, fiqCnt1 = %d (10000,10000)\n",fiqCnt0,fiqCnt1);
    rINTMOD = intmod;
    rINTMSK = BIT_ALLMSK;
}

//***************[ Change_IntPriorities ]*************************
void Change_IntPriorities(void)
{
    int key;

 
    Uart_Printf("[ Interrupt Controller Priority Policy ]\n\n");
    Uart_Printf("1. Reverse Priority   2. Priority Rotate Off   3. Default\n\n");
    Uart_Printf("Select : ");
    key = Uart_Getch();
    Uart_Printf("%c\n\n",key);    
    
    switch(key)
    {
       case '1':
          Uart_Printf("Reverse priority is selected.\n");
          rPRIORITY = 0x7f;             //Arbiter 0 to 6 group priority rotate enable
          rPRIORITY = (0x3fff<<7);      //Arbiter 0 and 5 are group priority order set.(REQ 4-1-2-3)
          Uart_Printf("rPRIORITY=%x\n",rPRIORITY);//Arbiter 1 to 4 and 6 are group priority order set.(REQ 0-4-1-2-3-5)
          break;
       case '2':
          Uart_Printf("Priority rotate off is selected.\n");
          rPRIORITY = 0x0;              //Arbiter 0 to 6 group priority does not rotate
	  Uart_Printf("rPRIORITY=%x\n",rPRIORITY);
	  break;
       case '3':
          Uart_Printf("Default mode is selected.\n");
          rPRIORITY = 0x7f;             //Arbiter 0 to 6 group priority rotate enable
	  Uart_Printf("rPRIORITY=%x\n",rPRIORITY);
	  break;
       default:
          break;
    }
}
    
   

⌨️ 快捷键说明

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