コード例 #1
0
ファイル: sio.c プロジェクト: digitalsorcery/LWIPAndroidJNI
void sio_expect_string( u8_t *str, sio_status_t * siostat )
{
    /*	sio_status_t * siostat = ((siostruct_t*)netif->state)->sio;*/
	u8_t c;
 	int finger=0;

	LWIP_DEBUGF( (PPP_DEBUG | SIO_DEBUG), ("expect:%s\n",str) );
	while ( 1 )
	{
		c=fifoGet( &(siostat->myfifo) );
		LWIP_DEBUGF( (PPP_DEBUG | SIO_DEBUG), ("_%c",c) );
		if ( c==str[finger] )
		{
			finger++;
		} else if ( finger > 0 )
		{
                    /*it might fit in the beginning? */
			if ( str[0] == c )
			{
				finger = 1;
			}
		}
		if ( 0 == str[finger] )
                    break;	/* done, we have a match */
	}
	LWIP_DEBUGF( (PPP_DEBUG | SIO_DEBUG), ("[match]\n") );
}
コード例 #2
0
int vcomGetchar(void)
{
  uint8_t c;
  bool    eof;

  vicDisable(INT_CHANNEL_USB);
  eof = fifoGet(&rxfifo, &c);
  vicEnable(INT_CHANNEL_USB);  
  
  return eof ? c : -1;
}
コード例 #3
0
static void vcomBulkIn(uint8_t EP, uint8_t EPStatus) {
	int i;

	if (fifoAvailable(&txfifo) == 0) {
		usbEnableNAKInterrupts(0);
		return;
	}

	for (i = 0; i < MAX_PACKET_SIZE; i++)
		if (!fifoGet(&txfifo, &_vcom_buffer[i])) break;

	if (i > 0) usbWrite(EP, _vcom_buffer, i);
}
コード例 #4
0
ファイル: sio.c プロジェクト: digitalsorcery/LWIPAndroidJNI
/*u8_t sio_recv( struct netif * netif )*/
u8_t sio_recv( sio_status_t * siostat )
{
    /*	sio_status_t * siostat = ((siostruct_t*)netif->state)->sio; */
	return fifoGet( &(siostat->myfifo) );
}