コード例 #1
0
ファイル: pmic.c プロジェクト: HappyASR/exynos4_uboot
void pmic_init(void)
{
	u8 pmic_id;
	
	GPIO_SetFunctionEach(eGPIO_F1, eGPIO_4, 1);
	GPIO_SetDataEach(eGPIO_F1, eGPIO_4, 1);
	GPIO_SetFunctionEach(eGPIO_F1, eGPIO_5, 1);
	GPIO_SetDataEach(eGPIO_F1, eGPIO_5, 1);
	
	GPIO_SetFunctionEach(eGPIO_X0, eGPIO_7, 0);
	GPIO_SetPullUpDownEach(eGPIO_X0, eGPIO_7, 0);
	GPIO_SetFunctionEach(eGPIO_X1, eGPIO_5, 0);
	GPIO_SetPullUpDownEach(eGPIO_X1, eGPIO_5, 0);

	udelay(10000); /* make sure all GPIOs got applied */
	I2C_InitIp(7, 400*1000, 1000000);
	udelay(10000); /* make sure I2C controller starts up */
	/* read ID */
	IIC7_ERead(S5M8767_ADDR, 0, &pmic_id);
	if(pmic_id >= 0x0 && pmic_id <= 0x5) {
		pmic_s5m8767_init();
	} else {
		pmic_max77686_init();
	}
	pmic_print_info();
	charger_max77693_init();
	
}
コード例 #2
0
ファイル: library.c プロジェクト: hylu/s3c6410_ucos
//////////
// Function Name : InitLED
// Function Desctiption : This function initializes gpio for debugging LED
// Input : NONE
// Output : NONE
// Version :
void InitLED(void)
{
	GPIO_SetFunctionEach(eGPIO_N, eGPIO_12, 1);
	GPIO_SetFunctionEach(eGPIO_N, eGPIO_13, 1);
	GPIO_SetFunctionEach(eGPIO_N, eGPIO_14, 1);
	GPIO_SetFunctionEach(eGPIO_N, eGPIO_15, 1);	
	return;
}
コード例 #3
0
ファイル: gpio.c プロジェクト: cyj1988jyc/2440-test
//////////
// Function Name : GPIO_SetEint0
// Function Desctiption : This function setup Eint[27:0]
// Input : 			uEINT_No: EINT No.
//					uINTType: Select EINT Type. 
//								Low, High, Falling, Rising, Both
//					uFltType :  Select Filter Type
//								DisFLT(Disable Filter), DLYFLT(Delay Filter), DIGFLT(Digital Filter)
//					uFltWidth : Digital Filter Width ( 1~0x3F)
// Output : NONE
//
// Version : v0.1
void GPIO_SetEint0(u32 uEINT_No , u32 uIntType, FLT_eTYPE eFltType,  u32 uFltWidth)
{

	volatile u32 *pEINTx_Reg, *pFLTx_Reg;
	volatile u32 *pGPIO_EINT_Addr;
	u32 uGpioPort, uFunc, uType ;	
	u32 uConValue;

	GPIO_pBase = (void *)GPIO_BASE;

	pGPIO_EINT_Addr = &(GPIO->rEINT0CON0);

	// EINT Port
	if( uEINT_No <= 15)
	{
		uGpioPort = uEINT_No;
		uFunc = 2;  					// EINT Function 
		GPIO_SetFunctionEach(eGPIO_N, (GPIO_eBitPos)uGpioPort, uFunc);		// ??
		GPIO_SetPullUpDownEach(eGPIO_N,(GPIO_eBitPos) uGpioPort, 0x0);		// disable Pull-up/dn
	}
	else if(uEINT_No >= 16 && uEINT_No <= 22)
	{
		uGpioPort = (uEINT_No - 8) ;
		uFunc = 3;
		GPIO_SetFunctionEach(eGPIO_L,(GPIO_eBitPos) uGpioPort, uFunc);   		  // ??
		GPIO_SetPullUpDownEach(eGPIO_L, (GPIO_eBitPos)uGpioPort, 0x0);

	}
	else if(uEINT_No >=23 && uEINT_No <=27)
	{
		uGpioPort = (uEINT_No - 23 );
		uFunc = 3;
		GPIO_SetFunctionEach(eGPIO_M, (GPIO_eBitPos)uGpioPort, uFunc);		// ??
		GPIO_SetPullUpDownEach(eGPIO_M, (GPIO_eBitPos)uGpioPort, 0x0);		// disable Pull-up/dn
	}
	else if (uEINT_No >= 27)
	{
		UART_Printf("Error Eint No. \n");
		Assert(0);
	}

	
	//  Interrupt Type 
	if( uEINT_No <= 15)
	{
		uType =(uEINT_No>>1);
		pEINTx_Reg = pGPIO_EINT_Addr ; 	
		uConValue = *pEINTx_Reg;
		uConValue = (uConValue & ~(0xF<<(uType*4))) | (uIntType<<(uType*4));
		*pEINTx_Reg = uConValue;
		
	}
コード例 #4
0
ファイル: smdk5250.c プロジェクト: 54shady/uboot_tiny4412
int board_late_init(void)
{

	GPIO_Init();
	GPIO_SetFunctionEach(eGPIO_X0, eGPIO_0, 0);
	GPIO_SetPullUpDownEach(eGPIO_X0, eGPIO_0, 0);

	udelay(10);
	if (GPIO_GetDataEach(eGPIO_X0, eGPIO_0) == 0 || second_boot_info == 1)
		setenv("bootcmd", CONFIG_BOOTCOMMAND2);

	if (second_boot_info == 1)
		printf("###Secondary Boot###\n");

	return 0;
}
コード例 #5
0
ファイル: cf.c プロジェクト: cyj1988jyc/2440-test
//////////
// Function Name : CF_SetEBI
// Function Description : 
//   This function sets EBI of Syscon for CF controller.
// Input : NONE
// Output : NONE
// Version : v0.1 
void CF_SetEBI(u8 ucOpMode)
{
	SYSC_CtrlCSMEM0(eCS_SROMC, eCS_SROMC, eCS_CFC, eCS_CFC);		// bank4_cfg->CF,bank5_cfg->CF 
	// Set Buffer Direction pin 
//	GPIO_SetFunctionEach(eGPIO_M, eGPIO_5, 3);	// Set XhiINTR pin as CF Data Direction
	GPIO_SetFunctionEach(eGPIO_B, eGPIO_4, 4);	// Set XirSDBW pin as CF Data Direction

 	if (ucOpMode == DIRECT_MODE)	
 	{
		UART_Printf(" * CF EBI MODE : Direct Mode\n\n");
		SYSC_IndepCF();		// select dedicated CF path (direct path)
 	}
	else
	{
		UART_Printf(" * CF EBI MODE : InDirect Mode\n\n");
		SYSC_EBICF();		// select EBI path (for Indirect path)
	}
}
コード例 #6
0
ファイル: i2c.c プロジェクト: 54shady/uboot_tiny4412
void I2C_SetGPIO(I2C_CHANNEL eCh, bool bEnable)
{
	switch (eCh)
	{	
		case I2C0:
			if (bEnable)
			{
				GPIO_SetFunctionEach(eGPIO_D1, eGPIO_0, 2);			// GPIO set I2C0_SDA
				GPIO_SetFunctionEach(eGPIO_D1, eGPIO_1, 2);			// GPIO set I2C0_SCL
				GPIO_SetPullUpDownEach(eGPIO_D1, eGPIO_0, 0);		// GPIO set Pull-up/down Disable
				GPIO_SetPullUpDownEach(eGPIO_D1, eGPIO_1, 0);		// GPIO set Pull-up/down Disable
			}
			else
			{
				GPIO_SetFunctionEach(eGPIO_D1, eGPIO_0, 0);			// GPIO set reset value
				GPIO_SetFunctionEach(eGPIO_D1, eGPIO_1, 0);			// GPIO set reset value
				GPIO_SetPullUpDownEach(eGPIO_D1, eGPIO_0, 1);		// GPIO set reset value
				GPIO_SetPullUpDownEach(eGPIO_D1, eGPIO_1, 1);		// GPIO set reset value
			}
			break;

		case I2C1:
			if (bEnable)
			{
				GPIO_SetFunctionEach(eGPIO_D1, eGPIO_2, 2);			// GPIO set I2C1_SDA
				GPIO_SetFunctionEach(eGPIO_D1, eGPIO_3, 2);			// GPIO set I2C1_SCL
				GPIO_SetPullUpDownEach(eGPIO_D1, eGPIO_2, 0);		// GPIO set Pull-up/down Disable
				GPIO_SetPullUpDownEach(eGPIO_D1, eGPIO_3, 0);		// GPIO set Pull-up/down Disable
			}
			else
			{
				GPIO_SetFunctionEach(eGPIO_D1, eGPIO_2, 0);			// GPIO set reset value
				GPIO_SetFunctionEach(eGPIO_D1, eGPIO_3, 0);			// GPIO set reset value
				GPIO_SetPullUpDownEach(eGPIO_D1, eGPIO_2, 1);		// GPIO set reset value
				GPIO_SetPullUpDownEach(eGPIO_D1, eGPIO_3, 1);		// GPIO set reset value
			}
			break;
			
		case I2C2:
			if (bEnable)
			{
				GPIO_SetFunctionEach(eGPIO_A0, eGPIO_6, 3);			// GPIO set I2C2_SDA
				GPIO_SetFunctionEach(eGPIO_A0, eGPIO_7, 3);			// GPIO set I2C2_SCL
				GPIO_SetPullUpDownEach(eGPIO_A0, eGPIO_6, 0);		// GPIO set Pull-up/down Disable
				GPIO_SetPullUpDownEach(eGPIO_A0, eGPIO_7, 0);		// GPIO set Pull-up/down Disable
			}
			else
			{
				GPIO_SetFunctionEach(eGPIO_A0, eGPIO_6, 0);			// GPIO set reset value
				GPIO_SetFunctionEach(eGPIO_A0, eGPIO_7, 0);			// GPIO set reset value
				GPIO_SetPullUpDownEach(eGPIO_A0, eGPIO_6, 1);		// GPIO set reset value
				GPIO_SetPullUpDownEach(eGPIO_A0, eGPIO_7, 1);		// GPIO set reset value
			}
			break;

		case I2C3:
			if (bEnable)
			{
				GPIO_SetFunctionEach(eGPIO_A1, eGPIO_2, 3);			// GPIO set I2C3_SDA
				GPIO_SetFunctionEach(eGPIO_A1, eGPIO_3, 3);			// GPIO set I2C3_SCL
				GPIO_SetPullUpDownEach(eGPIO_A1, eGPIO_2, 0);		// GPIO set Pull-up/down Disable
				GPIO_SetPullUpDownEach(eGPIO_A1, eGPIO_3, 0);		// GPIO set Pull-up/down Disable
			}
			else
			{
				GPIO_SetFunctionEach(eGPIO_A1, eGPIO_2, 0);			// GPIO set reset value
				GPIO_SetFunctionEach(eGPIO_A1, eGPIO_3, 0);			// GPIO set reset value
				GPIO_SetPullUpDownEach(eGPIO_A1, eGPIO_2, 1);		// GPIO set reset value
				GPIO_SetPullUpDownEach(eGPIO_A1, eGPIO_3, 1);		// GPIO set reset value
			}
			break;

		case I2C4:
			if (bEnable)
			{
				GPIO_SetFunctionEach(eGPIO_B, eGPIO_2, 3);			// GPIO set I2C4_SDA
				GPIO_SetFunctionEach(eGPIO_B, eGPIO_3, 3);			// GPIO set I2C4_SCL
				GPIO_SetPullUpDownEach(eGPIO_B, eGPIO_2, 0);		// GPIO set Pull-up/down Disable
				GPIO_SetPullUpDownEach(eGPIO_B, eGPIO_3, 0);		// GPIO set Pull-up/down Disable
			}
			else
			{
				GPIO_SetFunctionEach(eGPIO_B, eGPIO_2, 0);			// GPIO set reset value
				GPIO_SetFunctionEach(eGPIO_B, eGPIO_3, 0);			// GPIO set reset value
				GPIO_SetPullUpDownEach(eGPIO_B, eGPIO_2, 1);		// GPIO set reset value
				GPIO_SetPullUpDownEach(eGPIO_B, eGPIO_3, 1);		// GPIO set reset value
			}
			break;

		case I2C5:
			if (bEnable)
			{
				GPIO_SetFunctionEach(eGPIO_B, eGPIO_6, 3);			// GPIO set I2C5_SDA
				GPIO_SetFunctionEach(eGPIO_B, eGPIO_7, 3);			// GPIO set I2C5_SCL
				GPIO_SetPullUpDownEach(eGPIO_B, eGPIO_6, 0);		// GPIO set Pull-up/down Disable
				GPIO_SetPullUpDownEach(eGPIO_B, eGPIO_7, 0);		// GPIO set Pull-up/down Disable
			}
			else
			{
				GPIO_SetFunctionEach(eGPIO_B, eGPIO_6, 0);			// GPIO set reset value
				GPIO_SetFunctionEach(eGPIO_B, eGPIO_7, 0);			// GPIO set reset value
				GPIO_SetPullUpDownEach(eGPIO_B, eGPIO_6, 1);		// GPIO set reset value
				GPIO_SetPullUpDownEach(eGPIO_B, eGPIO_7, 1);		// GPIO set reset value
			}
			break;

		case I2C6:
			if (bEnable)
			{
				GPIO_SetFunctionEach(eGPIO_C1, eGPIO_3, 4);			// GPIO set I2C6_SDA
				GPIO_SetFunctionEach(eGPIO_C1, eGPIO_4, 4);			// GPIO set I2C6_SCL
				GPIO_SetPullUpDownEach(eGPIO_C1, eGPIO_3, 0);		// GPIO set Pull-up/down Disable
				GPIO_SetPullUpDownEach(eGPIO_C1, eGPIO_4, 0);		// GPIO set Pull-up/down Disable
			}
			else
			{
				GPIO_SetFunctionEach(eGPIO_C1, eGPIO_3, 0);			// GPIO set reset value
				GPIO_SetFunctionEach(eGPIO_C1, eGPIO_4, 0);			// GPIO set reset value
				GPIO_SetPullUpDownEach(eGPIO_C1, eGPIO_3, 1);		// GPIO set reset value
				GPIO_SetPullUpDownEach(eGPIO_C1, eGPIO_4, 1);		// GPIO set reset value
			}
			break;

		case I2C7:
			if (bEnable)
			{
				GPIO_SetFunctionEach(eGPIO_D0, eGPIO_2, 3);			// GPIO set I2C7_SDA
				GPIO_SetFunctionEach(eGPIO_D0, eGPIO_3, 3);			// GPIO set I2C7_SCL
				GPIO_SetPullUpDownEach(eGPIO_D0, eGPIO_2, 0);		// GPIO set Pull-up/down Disable
				GPIO_SetPullUpDownEach(eGPIO_D0, eGPIO_3, 0);		// GPIO set Pull-up/down Disable
			}
			else
			{
				GPIO_SetFunctionEach(eGPIO_D0, eGPIO_2, 0);			// GPIO set reset value
				GPIO_SetFunctionEach(eGPIO_D0, eGPIO_3, 0);			// GPIO set reset value
				GPIO_SetPullUpDownEach(eGPIO_D0, eGPIO_2, 1);		// GPIO set reset value
				GPIO_SetPullUpDownEach(eGPIO_D0, eGPIO_3, 1);		// GPIO set reset value
			}
			break;

		case I2C8:
			break;
	}
}
コード例 #7
0
ファイル: library.c プロジェクト: hylu/s3c6410_ucos
//////////
// Function Name : InitUartPort
// Function Description : This function initializes gpio for debugging uart ch.
// Input :  ch, uart ch number
//			flowControl, whether flow control or not
// Output : NONE
// Version :
void InitUartPort(u8 ch, u8 flowControl)
{
	switch (ch)
	{
		default:
		case 0:
			if(flowControl == TRUE)
			{
				GPIO_SetFunctionEach(eGPIO_A, eGPIO_0, 2);
				GPIO_SetFunctionEach(eGPIO_A, eGPIO_1, 2);
				GPIO_SetFunctionEach(eGPIO_A, eGPIO_2, 2);
				GPIO_SetFunctionEach(eGPIO_A, eGPIO_3, 2);
			}
			else
			{
				GPIO_SetFunctionEach(eGPIO_A, eGPIO_0, 2);
				GPIO_SetFunctionEach(eGPIO_A, eGPIO_1, 2);
			}
			break;
			
		case 1:
			if(flowControl == TRUE)
			{
				GPIO_SetFunctionEach(eGPIO_A, eGPIO_4, 2);
				GPIO_SetFunctionEach(eGPIO_A, eGPIO_5, 2);
				GPIO_SetFunctionEach(eGPIO_A, eGPIO_6, 2);
				GPIO_SetFunctionEach(eGPIO_A, eGPIO_7, 2);
			}
			else
			{
				GPIO_SetFunctionEach(eGPIO_A, eGPIO_4, 2);
				GPIO_SetFunctionEach(eGPIO_A, eGPIO_5, 2);
			}
			break;
			
		case 2:
			GPIO_SetFunctionEach(eGPIO_B, eGPIO_0, 2);
			GPIO_SetFunctionEach(eGPIO_B, eGPIO_1, 2);
			break;
			
		case 3:
			GPIO_SetFunctionEach(eGPIO_B, eGPIO_2, 2);
			GPIO_SetFunctionEach(eGPIO_B, eGPIO_3, 2);
			break;		
	}
	
	return;	
}
コード例 #8
0
ファイル: uart.c プロジェクト: hylu/s3c6410_ucos
u8 UART_SetConfig(u8 cCh, u32 uBreakorLoop,u32 uParity,u32 uNumStop,u32 uWordLength,u32 uOpCLK,u32 uSelPLL,
                  u32 uExtIFtype,u32 uBaudrate,u32 uSelOpmode,u32 uSelFIFO,u32 uSelAFC,u32 uRTSLvL)
{

    volatile UART_CON *pUartCon;

    pUartCon = &g_AUartCon[cCh];


    //Set Other Options
//	UART_Printf("\nSelect Other Options\n 0. Nothing[D]  1.Send Break Signal  2. Loop Back Mode  \n Choose : ");
    switch(uBreakorLoop)
    {
    default :
        pUartCon->cSendBreakSignal = 0x0;
        pUartCon->cLoopTest = 0x0;
        break;

    case 1 :
        pUartCon->cSendBreakSignal = 1;
        return cCh;


    case 2 :
        pUartCon->cLoopTest = 1;
        break;
    }


    //Set Parity mode
//	UART_Printf("\nSelect Parity Mode\n 1. No parity[D] 2. Odd 3. Even 4. Forced as '1' 5. Forced as '0' \n Choose : ");
    switch(uParity)
    {
    default :
        pUartCon->cParityBit = 0;
        break;
    case 2 :
        pUartCon->cParityBit = 4;
        break;
    case 3 :
        pUartCon->cParityBit = 5;
        break;
    case 4 :
        pUartCon->cParityBit = 6;
        break;
    case 5 :
        pUartCon->cParityBit = 7;
        break;
    }
    //Set the number of stop bit
//	UART_Printf("\n\nSelect Number of Stop Bit\n 1. One stop bit per frame[D] 2. Two stop bit per frame");
    switch(uNumStop)
    {
    default :
        pUartCon->cStopBit = 0;
        break;

    case 2 :
        pUartCon->cStopBit = 1;
        break;
    }
    //Set Word Length
//	UART_Printf("\n\nSelect Word Length\n 1. 5bits 2. 6bits 3. 7bits 4. 8bits[D] \n Choose : ");
    switch(uWordLength)
    {
    case 1 :
        pUartCon->cDataBit = 0;
        break;
    case 2 :
        pUartCon->cDataBit = 1;
        break;
    case 3 :
        pUartCon->cDataBit = 2;
        break;
    default :
        pUartCon->cDataBit = 3;
        break;
    }


    // Set Operation clock
//	UART_Printf("\n\nSelect Operating Clock\n 1. PCLK[D]	2. UEXTCLK	3. EPLL \n Choose : ");
    switch (uOpCLK)
    {
    case 2 :
        pUartCon->cOpClock = 1;
//		g_uOpClock=12000000;
        GPIO_SetFunctionEach(eGPIO_F,eGPIO_13,2);
        // connect CLKOUT and UEXTCLK
//		UART_Printf("\nInput PWM EXT_CLK by Pulse Generater\n");
        break;

    case 3 :
        pUartCon->cOpClock = 3;
//		UART_Printf("\nSelect Clock SRC\n 1.EPLL  2.MPLL \n Choose: ");
        switch(uSelPLL)
        {
        case 1:
//						SYSC_SetPLL(eEPLL,64,3,1,0);	//EPLL=128Mhz
            SYSC_SetPLL(eEPLL,32,1,1,0);   //EPLL=192Mhz
            SYSC_ClkSrc(eEPLL_FOUT);
            SYSC_ClkSrc(eUART_MOUTEPLL);
//						SYSC_CtrlCLKOUT(eCLKOUT_EPLLOUT,9);
            g_uOpClock = CalcEPLL(32,1,1,0);
//						UART_Printf("EPLL = %dMhz\n",(g_uOpClock/1000000));
            // use EPLL output clock
            //SetEPLL(42, 1, 2); // Epll output - 96MHz, pll input - 12MHz
            //CLK_SRC	UART_SEL[13]  0:EPLL
            //CLK_DIV2	UART_RATIO[19:16]
            break;
        case 2:							//MPLL
            SYSC_ClkSrc(eMPLL_FOUT);
            SYSC_ClkSrc(eUART_DOUTMPLL);

            Delay(100);
            g_uOpClock = (u32)g_MPLL/2;

//						UART_Printf("MPLL = %dMhz\n",(g_uOpClock/1000000));
            // use MPLL output clock
            //CLK_SRC	UART_SEL[13]	  1:MPLL
            //CLK_DIV2	UART_RATIO[19:16]
            break;
        default:							//MPLL
            SYSC_ClkSrc(eMPLL_FOUT);
            SYSC_ClkSrc(eUART_DOUTMPLL);
            Delay(100);

            g_uOpClock =(u32) g_MPLL/2;
            //SetEPLL(42, 1, 2); // Epll output - 96MHz, pll input - 12MHz
            //CLK_SRC	UART_SEL[13]  0:EPLL
            //CLK_DIV2	UART_RATIO[19:16]
            break;
        }
        break;

    default :
        pUartCon->cOpClock = 0; // PCLK
        break;
    }

    // Select UART or IrDA 1.0
//	UART_Printf("\n\nSelect External Interface Type\n 1. UART[D]   2. IrDA mode\n Choose : ");
    if (uExtIFtype==2)
        pUartCon->cSelUartIrda = 1; // IrDA mode
    else
        pUartCon->cSelUartIrda = 0; // IrDA mode

    // Set Baudrate
//	UART_Printf("\n\nType the baudrate and then change the same baudrate of host, too.\n");
//	UART_Printf(" Baudrate (ex 9600, 115200[D], 921600) : ");
    pUartCon->uBaudrate = uBaudrate;

//	if ((s32)pUartCon->uBaudrate == -1)
//		pUartCon->uBaudrate = 115200;

    // Select UART operating mode
//	UART_Printf("\n\nSelect Operating Mode\n 1. Interrupt[D]	2. DMA\n Choose : ");
    if (uSelOpmode==2)
    {
        pUartCon->cTxMode = 2; // DMA0 mode
        pUartCon->cRxMode = 3; // DMA1 mode
    }
    else
    {
        pUartCon->cTxMode = 1; // Int mode
        pUartCon->cRxMode = 1; // Int mode
    }

    // Select UART FIFO mode
//	UART_Printf("\n\nSelect FIFO Mode (Tx/Rx[byte])\n 1. no FIFO[D]  2. Empty/1  3. 16/8   4. 32/16  5. 48/32 \n Choose : ");

    if ( (uSelFIFO>1)&&(uSelFIFO<6) )
    {
        pUartCon->cEnableFifo = 1;
        pUartCon->cTxTrig = uSelFIFO -2;
        pUartCon->cRxTrig = uSelFIFO -2;
    }
    else
    {
        pUartCon->cEnableFifo = 0;
    }

    // Select AFC mode enable/disable
//	UART_Printf("\n\nSelect AFC Mode\n 1. Disable[D]	2. Enable\n Choose : ");
    if (uSelAFC == 2)
    {
        pUartCon->cAfc = 1; // AFC mode enable
//		UART_Printf("Select nRTS trigger level(byte)\n 1. 63[D]   2. 56   3. 48   4. 40   5. 32   6. 24   7. 16   8. 8\n Choose : ");


        if ( (uRTSLvL>1)&&(uRTSLvL<9) )
            pUartCon->cRtsTrig = uRTSLvL -1;

        else
            pUartCon->cRtsTrig = 0; // default 63 byte
    }
    else
    {
        pUartCon->cAfc = 0; // AFC mode disable
    }

    return cCh;
}
コード例 #9
0
ファイル: uart.c プロジェクト: hylu/s3c6410_ucos
u8 UART_Open(u8 ch) // setting H/W & initializing regiter
{


    if(ch == 0)
        g_pUartDebugRegs = UART0_BASE;
    else if(ch == 1)
        g_pUartDebugRegs = UART1_BASE;
    else if(ch == 2)
        g_pUartDebugRegs = UART2_BASE;
    else if(ch == 3)
        g_pUartDebugRegs = UART3_BASE;


//	return TRUE;
#if 1
    switch(ch)
    {
    case 0 :
        GPIO_SetFunctionEach(eGPIO_A, eGPIO_0, 2); //Uart0 RXD
        GPIO_SetFunctionEach(eGPIO_A, eGPIO_1, 2); //Uart0 TXD
        GPIO_SetFunctionEach(eGPIO_A, eGPIO_2, 2); //Uart0 CTSn
        GPIO_SetFunctionEach(eGPIO_A, eGPIO_3, 2); //Uart0 RTSn

        if(UART_InitializeREG(UART0_BASE, &g_AUartCon[0])  == SENDBREAK)
            return SENDBREAK; // Initialize register set for Uart 0

        break;
    case 1 :
        GPIO_SetFunctionEach(eGPIO_A, eGPIO_4, 2); //Uart1 RXD
        GPIO_SetFunctionEach(eGPIO_A, eGPIO_5, 2); //Uart1 TXD
        GPIO_SetFunctionEach(eGPIO_A, eGPIO_6, 2); //Uart1 CTSn
        GPIO_SetFunctionEach(eGPIO_A, eGPIO_7, 2); //Uart1 RTSn

        if(UART_InitializeREG(UART1_BASE, &g_AUartCon[1]) == SENDBREAK)
            return SENDBREAK;

        break;
    case 2 :
        GPIO_SetFunctionEach(eGPIO_B, eGPIO_0, 2); //Uart2 RXD
        GPIO_SetFunctionEach(eGPIO_B, eGPIO_1, 2); //Uart2 TXD

        if(UART_InitializeREG(UART2_BASE, &g_AUartCon[2]) == SENDBREAK)
            return SENDBREAK;

        break;
    case 3 :
        GPIO_SetFunctionEach(eGPIO_B, eGPIO_2, 2); //Uart2 RXD
        GPIO_SetFunctionEach(eGPIO_B, eGPIO_3, 2); //Uart2 TXD

        if(UART_InitializeREG(UART3_BASE, &g_AUartCon[3]) == SENDBREAK)
            return SENDBREAK;

        break;
    default :
        return FALSE;
    }
    return TRUE;
#endif
}
コード例 #10
0
ファイル: smdk4212.c プロジェクト: Rebell/exynos4_uboot
int board_init(void)
{
    char bl1_version[9] = {0};

    GPIO_Init();

    GPIO_SetFunctionEach(eGPIO_X0, eGPIO_1, 0);
    GPIO_SetPullUpDownEach(eGPIO_X0, eGPIO_1, 0);
    GPIO_SetFunctionEach(eGPIO_X0, eGPIO_4, 0);
    GPIO_SetPullUpDownEach(eGPIO_X0, eGPIO_4, 0);
    GPIO_SetFunctionEach(eGPIO_X0, eGPIO_5, 0);
    GPIO_SetPullUpDownEach(eGPIO_X0, eGPIO_5, 0);


    GPIO_SetFunctionEach(eGPIO_X1, eGPIO_3, 0);
    GPIO_SetPullUpDownEach(eGPIO_X1, eGPIO_3, 0);
    GPIO_SetFunctionEach(eGPIO_X1, eGPIO_4, 0);
    GPIO_SetPullUpDownEach(eGPIO_X1, eGPIO_4, 0);
    GPIO_SetFunctionEach(eGPIO_X2, eGPIO_0, 0);
    GPIO_SetPullUpDownEach(eGPIO_X2, eGPIO_0, 0);
    GPIO_SetFunctionEach(eGPIO_X2, eGPIO_1, 0);
    GPIO_SetPullUpDownEach(eGPIO_X2, eGPIO_1, 0);
    GPIO_SetFunctionEach(eGPIO_X2, eGPIO_2, 0);
    GPIO_SetPullUpDownEach(eGPIO_X2, eGPIO_2, 0);
    GPIO_SetFunctionEach(eGPIO_X2, eGPIO_7, 0);
    GPIO_SetPullUpDownEach(eGPIO_X2, eGPIO_7, 0);
    GPIO_SetFunctionEach(eGPIO_X3, eGPIO_3, 0);
    GPIO_SetPullUpDownEach(eGPIO_X3, eGPIO_3, 0);

    GPIO_SetFunctionEach(eGPIO_M1, eGPIO_2, 0);
    GPIO_SetPullUpDownEach(eGPIO_M1, eGPIO_2, 0);
    GPIO_SetFunctionEach(eGPIO_M1, eGPIO_3, 0);
    GPIO_SetPullUpDownEach(eGPIO_M1, eGPIO_3, 0);
    GPIO_SetFunctionEach(eGPIO_M1, eGPIO_4, 0);
    GPIO_SetPullUpDownEach(eGPIO_M1, eGPIO_4, 0);
    GPIO_SetFunctionEach(eGPIO_M1, eGPIO_5, 0);
    GPIO_SetPullUpDownEach(eGPIO_M1, eGPIO_5, 0);

    board_rev =
        (GPIO_GetDataEach(eGPIO_M1, eGPIO_5) << 3) |
        (GPIO_GetDataEach(eGPIO_M1, eGPIO_4) << 2) |
        (GPIO_GetDataEach(eGPIO_M1, eGPIO_3) << 1) |
        (GPIO_GetDataEach(eGPIO_M1, eGPIO_2) << 0);

    printf("Board revision: 0x%X\n", board_rev);

    pmic_init();

    /* display BL1 version */
#ifdef CONFIG_TRUSTZONE
    printf("BL1 version: N/A (TrustZone Enabled BSP)\n");
#else
    strncpy(&bl1_version[0], (char *)0x02022fc8, 8);
    printf("BL1 version: %s\n", &bl1_version[0]);
#endif

#ifdef CONFIG_SMDKC220
    gd->bd->bi_arch_number = MACH_TYPE_C220;
#else
    if(((PRO_ID & 0x300) >> 8) == 2)
        gd->bd->bi_arch_number = MACH_TYPE_C210;
    else