Beispiel #1
0
static void scan_keypad(void)
{ 
	volatile unsigned int temp = 0;
	volatile int i;

 	port1_init();

	temp = readl(S3C64XX_GPNDAT);
	
	if((temp & (1 << 0)) == 0){
		key_delay();	//去延时抖动
		row_value= 1;
	}
	else if((temp & (1 << 1)) == 0){
		key_delay();
		row_value= 2;
	}
	else if((temp & (1 << 2)) == 0){
		key_delay();
		row_value = 3;
	}
	else if((temp & (1 << 3)) == 0)	{
		key_delay();
		row_value = 4;
	}

	for (i=0; i<10000; i++) asm ("");

	port2_init();
	
	temp = readl(S3C64XX_GPNDAT);
	if(temp & (1 << 5)){
		col_value = 1;
	}
	else if(temp & (1 << 6)){
		col_value = 2;
	}
	else if(temp & (1 << 9)){
		col_value = 3;
	}
	else if(temp & (1 << 10)){
		col_value = 4;
	}
	else if(temp & (1 << 12)){
		col_value = 5;
	}
	/*reset GPNDAT 5 6 9 10 12 low level */
	/*The most important step*/
	temp  = readl(S3C64XX_GPNDAT);
	temp &= ~(1 << 5) & ~(1 << 6) & ~(1 << 9) & ~(1 << 10) & ~(1 << 12);
	temp |= (1 << 0) | (1 << 1) | (1 << 2) | (1 << 3);
	writel( temp, S3C64XX_GPNDAT);
}
Beispiel #2
0
void ports_init(void) // initializes all 11 ports
{
    port0_init();
    port1_init();
    port2_init();
    port3_init();
    port4_init();
    port5_init();
    port6_init();
    port7_init();
    port8_init();
    port9_init();
    port10_init();
}