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

📄 gpio.c

📁 VxWorks BSP for S3C2510A
💻 C
字号:
#include "vxWorks.h"
#include "intLib.h"
#include "netLib.h"
#include "end.h"
#include "endLib.h"
#include "cacheLib.h"
#include "miiLib.h"
#include "errno.h"
#include "stdio.h"
#include "logLib.h"
#include "taskLib.h"

#include "drv/multi/s3c2510.h"
#include "config.h"
#include "drv/intrCtl/s3c2510Intr.h"
#include "gpio.h"


#define DEBUG_LOG(x, p1, p2, p3, p4, p5, p6) \
        logMsg(x, (int)(UINT32)(p1), (int)(UINT32)(p2), (int)(UINT32)(p3), (int)(UINT32)(p4), (int)(UINT32)(p5), (int)(UINT32)(p6))


/* ISR function */
LOCAL void s3c2510ExtInt0(void);
LOCAL void s3c2510ExtInt1(void);
LOCAL void s3c2510ExtInt2(void);
LOCAL void s3c2510ExtInt3(void);
LOCAL void s3c2510ExtInt4(void);
LOCAL void s3c2510ExtInt5(void);

LOCAL void s3c2510ExtInit0(void);
LOCAL void s3c2510ExtInit1(void);
LOCAL void s3c2510ExtInit2(void);
LOCAL void s3c2510ExtInit3(void);
LOCAL void s3c2510ExtInit4(void);
LOCAL void s3c2510ExtInit5(void);


void s3c2510ExtInt_Init(void)
{   
    /* Initialize IOPCON Register. */
    *S3C2510_IOPFUNC1 &= 0xffffc0ff;
    s3c2510ExtInit0();
    s3c2510ExtInit1();
    s3c2510ExtInit2();
    s3c2510ExtInit3();
    s3c2510ExtInit4();
    s3c2510ExtInit5(); 
    return OK;  
}


void s3c2510ExtInit0(void)
{
    intConnect(INT_VEC_EXT0, (VOIDFUNCPTR)s3c2510ExtInt0, 0);	
    *S3C2510_IOPINT |= S3C2510_ExtInt_Filter_On | S3C2510_ExtInt_Falling ;
    intEnable(INT_LVL_EXT0);
}
void s3c2510ExtInit1(void)
{
    intConnect(INT_VEC_EXT1, (VOIDFUNCPTR)s3c2510ExtInt1, 0);	
    *S3C2510_IOPINT |= (S3C2510_ExtInt_Filter_On | S3C2510_ExtInt_Falling)<<4 ;
    intEnable(INT_LVL_EXT1);
}
void s3c2510ExtInit2(void)
{
    intConnect(INT_VEC_EXT2, (VOIDFUNCPTR)s3c2510ExtInt2, 0);	
    *S3C2510_IOPINT |= (S3C2510_ExtInt_Filter_On | S3C2510_ExtInt_Rising)<<8 ;
    intEnable(INT_LVL_EXT2);
}
void s3c2510ExtInit3(void)
{
    intConnect(INT_VEC_EXT3, (VOIDFUNCPTR)s3c2510ExtInt3, 0);	
    *S3C2510_IOPINT |= (S3C2510_ExtInt_Filter_On | S3C2510_ExtInt_Falling)<<12 ;
    intEnable(INT_LVL_EXT3);
}
void s3c2510ExtInit4(void)
{
    intConnect(INT_VEC_EXT4, (VOIDFUNCPTR)s3c2510ExtInt4, 0);	
    *S3C2510_IOPINT |= S3C2510_ExtInt_Filter_On<<16 ;
    intEnable(INT_LVL_EXT4);
}
void s3c2510ExtInit5(void)
{
    intConnect(INT_VEC_EXT5, (VOIDFUNCPTR)s3c2510ExtInt5, 0);	
    *S3C2510_IOPINT |= S3C2510_ExtInt_Filter_On<<20 ;
    intEnable(INT_LVL_EXT5);
}


void s3c2510ExtInt0 (void)
{
	*S3C2510_IOPINTPEND |= S3C2510_ExtInt_Clr_0;
	
	DEBUG_LOG("0",0,0,0,0,0,0);
	
	
	/* OtherPortControl = *S3C2510_IOPINTPEND; */
	
	/*
	switch(OtherPortControl){
		case 1: *S3C2510_IOPINTPEND = S3C2510_ExtInt_Clr_0; DEBUG_LOG("0",0,0,0,0,0,0); break;
		case 2: *S3C2510_IOPINTPEND = S3C2510_ExtInt_Clr_1; DEBUG_LOG("1",0,0,0,0,0,0);break;
		case 3: *S3C2510_IOPINTPEND = S3C2510_ExtInt_Clr_2; DEBUG_LOG("2",0,0,0,0,0,0);break;
		case 4: *S3C2510_IOPINTPEND = S3C2510_ExtInt_Clr_3; DEBUG_LOG("3",0,0,0,0,0,0);break;
		case 5: *S3C2510_IOPINTPEND = S3C2510_ExtInt_Clr_4; DEBUG_LOG("4",0,0,0,0,0,0);break;
		case 6: *S3C2510_IOPINTPEND = S3C2510_ExtInt_Clr_5; DEBUG_LOG("5",0,0,0,0,0,0);break;
	}
	*/
}
void s3c2510ExtInt1 (void)
{
	DEBUG_LOG("1",0,0,0,0,0,0);
	*S3C2510_IOPINTPEND |= S3C2510_ExtInt_Clr_1;		
}
void s3c2510ExtInt2 (void)
{
	DEBUG_LOG("2",0,0,0,0,0,0);
	*S3C2510_IOPINTPEND |= S3C2510_ExtInt_Clr_2;	
}
void s3c2510ExtInt3 (void)
{		
	DEBUG_LOG("3",0,0,0,0,0,0);
	*S3C2510_IOPINTPEND |= S3C2510_ExtInt_Clr_3;	
}
void s3c2510ExtInt4 (void)
{		
	DEBUG_LOG("4",0,0,0,0,0,0);
	*S3C2510_IOPINTPEND |= S3C2510_ExtInt_Clr_4;	
}
void s3c2510ExtInt5 (void)
{		
	DEBUG_LOG("5",0,0,0,0,0,0);
	*S3C2510_IOPINTPEND |= S3C2510_ExtInt_Clr_5;	
}

⌨️ 快捷键说明

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