示例#1
0
LOCAL void SIO_HwOpen (struct FDL_ChannelHandler *channel, unsigned int divider)
{
    UartPort_T *port  = (UartPort_T *) channel->priv;

#if defined(CONFIG_SC7710G2)
    if(port->regBase == ARM_UART3_BASE){
        /* Disable UART*/
        * ( (volatile unsigned int *) (GR_CTRL_REG1)) &= ~ (GR_UART3_CTRL_EN);
        /*Disable Interrupt */
        * (volatile unsigned int *) (port->regBase + ARM_UART_IEN) = 0;
        /* Enable UART*/
        * (volatile unsigned int *) GR_CTRL_REG1 |= (GR_UART3_CTRL_EN);

    } else
#endif
    {
        /* Disable UART*/
        * ( (volatile unsigned int *) (GR_CTRL_REG)) &= ~ (GR_UART_CTRL_EN);
        /*Disable Interrupt */
        * (volatile unsigned int *) (port->regBase + ARM_UART_IEN) = 0;
        /* Enable UART*/
        * (volatile unsigned int *) GR_CTRL_REG |= (GR_UART_CTRL_EN);
    }
    /* Set baud rate  */
    * (volatile unsigned int *) (port->regBase + ARM_UART_CLKD0) = LWORD (divider);
    * (volatile unsigned int *) (port->regBase + ARM_UART_CLKD1) = HWORD (divider);


    /* Set port for 8 bit, one stop, no parity  */
    * (volatile unsigned int *) (port->regBase + ARM_UART_CTL0) = UARTCTL_BL8BITS | UARTCTL_SL1BITS;
    * (volatile unsigned int *) (port->regBase+ ARM_UART_CTL1) = 0;
    * (volatile unsigned int *) (port->regBase + ARM_UART_CTL2) = 0;
}
示例#2
0
extern "C" void FCExport FmsCreateAuthAdaptor3(IFmsAuthServerContext2* pAuthServerCtx, 
											   IFmsAuthAdaptor*& pFmsAuthAdaptor, U32& iVersion)
{
	pFmsAuthAdaptor = new FmsAuthAdaptor(pAuthServerCtx);
	U32 version = pAuthServerCtx->getVersion();
	U16 w2 = LWORD(version);
	U16 w1 = HWORD(version);
	iVersion = MKLONG(INTERFACE_MINOR_VERSION, INTERFACE_MAJOR_VERSION);
	char buf[1024];
	char *ptr = buf;
	int valueLen = pAuthServerCtx->getConfig("UserKey1", &ptr, sizeof(buf));
	if (!valueLen)
	{
		valueLen = pAuthServerCtx->getConfig("UserKey2", &ptr, sizeof(buf));
		if (!valueLen)
		{
			return; 
		}
		if (valueLen < 0)
		{
			// failed to find this key
			return;
		}
	}
	if (valueLen < 0)
	{
		// failed to find this key
		return; 
	}
	// value length is bigger then the buffer size, and a real adaptor should 
    // allocate valueLen + 1 bytes and call again
}
示例#3
0
LOCAL int SIO_SetBaudrate (struct FDL_ChannelHandler  *channel,  unsigned int baudrate)
{
#if 0
    channel->Open (channel, baudrate);
#else
    unsigned int divider;
    UartPort_T *port  = (UartPort_T *) channel->priv;

    divider = SIO_GetHwDivider (baudrate);
    /* Set baud rate  */
    * (volatile unsigned int *) (port->regBase + ARM_UART_CLKD0) = LWORD (divider);
    * (volatile unsigned int *) (port->regBase + ARM_UART_CLKD1) = HWORD (divider);

#endif
    return 0;
}