예제 #1
0
pollTest2()
{
    int i;
    char Ichar;
    SIO_CHAN *pSioChan, *pSioChan2; /* serial I/O channel */
    char *text = "test";
    pSioChan = masterFpgaSerialChanGet(2);
    pSioChan2 = masterFpgaSerialChanGet(3);
    /* ns16550InitChannel(pSioChan);  */
    for (i = 0; i < 4; i++)
    {
	printf("output: %c, 0x%x\n",text[i],text[i]);
        while (sioPollOutput (pSioChan, text[i]) == EAGAIN);
        taskDelay(calcSysClkTicks(17));  /* taskDelay(1); */
        if ( sioPollInput (pSioChan2, &Ichar) != EAGAIN)
           printf("got: '%c',  0x%x\n",Ichar,Ichar);
    }
/*
    for (i = 0; i < 4; i++)
    {
        while (sioPollInput (pSioChan, &Ichar) == EAGAIN);
	printf("got: %c\n",Ichar);
    }
*/
}
static int sysSerialPollConsoleOut(int arg, char * buf, int len)
{
    char c;
    int  bytesOut = 0;

    if ((len <= 0) || (buf == NULL))
    {
	    return 0;
    }

    while ((bytesOut < len) && ((c = *buf++) != EOS))
	{
	    while (sioPollOutput (sysSioChans[SIO_POLL_CONSOLE], c) == EAGAIN);
	    bytesOut++;

	    if (c == '\n')
        {
	        while (sioPollOutput (sysSioChans[SIO_POLL_CONSOLE], '\r') == EAGAIN);
        }
	}

    return (bytesOut);
}/*lint !e715 !e818*/
예제 #3
0
polltx()
{
    int i,len,doit;
    SIO_CHAN *pSioChan, *pSioChan2; /* serial I/O channel */
    char *text = "0123456789abcdefghijklmnopqurstuwxyz";
    pSioChan = masterFpgaSerialChanGet(2);
    len = strlen(text);
    doit = 100;
    while(doit--)
    {
    for (i = 0; i < len; i++)
    {
        while (sioPollOutput (pSioChan, text[i]) == EAGAIN);
    }
    }
}