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

📄 eint.c.bak

📁 自己编写移植的基于s3c44b0的bootloader源代码
💻 BAK
字号:
/****************************************************************
 *		  ARMSYS S3C44B0X  Exter Int TEST						*  
 ****************************************************************
 
  1.2005.5.13::  ExInt TEST
 
 ***************************************************************/
 
//#include <string.h>
//#include "..\Target\44b.h"
//#include "..\Target\44blib.h"
//#include "..\inc\eint.h"
#include <string.h>
#include "..\inc\44b.h"
#include "..\inc\config.h"
#include "..\inc\def.h"
#include "..\inc\board.h"
#include "..\inc\utils.h"
//#include "..\inc\shell.h"
//#include "..\inc\flash.h"
//#include "..\inc\fat16.h"
//#include "..\inc\Rtc.h"
#include "..\myfution\myfution.h"
#include "..\exint\eint.h"


void __irq Eint4567Isr(void);
//void __irq Eint2Isr(void);

//volatile char which_int=0;
char which_int=0;
//extern int download_addr;
//extern EnvParams Env;

void Test_Eint(void)
{
    unsigned int save_G,save_PG;

//    printf("\n[External Interrupt Test]\n");
//    printf("Note:Because Keyboard's pressing exist shake,many times\n");
//    printf("of interrupt maybe triggered.\n");
/***Vectored interrupt test***/
    EnableInt();       //修改
    rINTCON=0x1;//disable fiq, enable irq

    pISR_EINT4567=(int)Eint4567Isr;
    
//    printf("\nUsing Fallling trigger.");

    save_G=rPCONG;
    save_PG=rPUPG;
    rPCONG=0xffff;	//EINT7~0
    rPUPG=0x0;		//pull up enable
    
    which_int=0;	    
      rEXTINT=(rEXTINT&0x0000ffff)|0x22220000;       //修改 Falling edge mode
      rINTMSK=~(BIT_GLOBAL|BIT_EINT4567);
//      printf("Press the EINT buttons!!!\n");
    while((getkey()!=ESC_KEY))
    {
	    EnableInt();       //修改
	    rINTCON=0x1;//disable fiq, enable irq
	    pISR_EINT4567=(int)Eint4567Isr;
	    rPCONG=0xffff;	//EINT7~0
	    rPUPG=0x0;		//pull up enable	    
	    rEXTINT=(rEXTINT&0x0000ffff)|0x22220000;       //修改 Falling edge mode
	    rINTMSK=~(BIT_GLOBAL|BIT_EINT4567);
	if(which_int!=0)
	{
	    
	    switch(which_int)
	    {
		case 1:
		    printf("\nEINT4 had been occured...\n");
//		    download_addr=0xc000000;
//		    tftp_main(0xc000000, Env.nic_cfg.ip);                  //MP3 增加
		    Mp3Play();
		    break;
		case 2:
		    printf("\nEINT5 had been occured...\n");
		    break;
		case 4:
		    printf("\nEINT6 had been occured...\n");
		    break;
		case 8:
		    printf("\nEINT7 had been occured...\n");
		    break;
		//case 9:
		//    printf("EINT2 had been occured...\n");
		//    break;
		default :
		    printf("which_int=%d\n",which_int);
		    break;
	    }
	    which_int=0;
	 }
	 PlayMucsic();
	 
     }
	
//	    rINTMSK=BIT_GLOBAL;
//	    rPCONG=save_G;
//	    rPUPG=save_PG;
//	    which_int=0;
    
    //printf("\nrINTCON=0x%x\n",rINTCON);
//    rINTCON=0x5;
}


void __irq Eint4567Isr(void)
{
    which_int=rEXTINTPND;
    rEXTINTPND=0x0f;		//clear EXTINTPND reg.		
    rI_ISPC=BIT_EINT4567;	//clear pending_bit
}

⌨️ 快捷键说明

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