亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ubcsp.c

?? BlueZ源碼
?? C
?? 第 1 頁 / 共 3 頁
字號:
	}

	/* We didn't have a packet, or it was reliable
	   Must wait for ACK before allowing another packet to be sent */

	return 0;
}

/*****************************************************************************/
/**                                                                         **/
/** ubcsp_poll                                                              **/
/**                                                                         **/
/** This is the main function for ubcsp                                     **/
/** It performs a number of tasks                                           **/
/**                                                                         **/
/** 1) Send another octet to the UART - escaping as required                **/
/** 2) Setup the payload to be sent after the header has been sent          **/
/** 3) Send the CRC for the packet if required                              **/
/**                                                                         **/
/** 4) Calculate the next Link Establishment State                          **/
/** 5) Send a Link Establishment packet                                     **/
/** 6) Send a normal packet if available                                    **/
/** 7) Send an ACK packet if required                                       **/
/**                                                                         **/
/** 8) Receive octets from UART and deslip them as required                 **/
/** 9) Place received octets into receive header or receive payload buffer  **/
/** 10) Process received packet when SLIP_END is received                   **/
/**                                                                         **/
/** 11) Keep track of ability of caller to delay recalling                  **/
/**                                                                         **/
/*****************************************************************************/

uint8 ubcsp_poll (uint8 *activity)
{
	uint8
		delay = UBCSP_POLL_TIME_IMMEDIATE;

	uint8
		value;

	/* Assume no activity to start with */

	*activity = 0;

	/* If we don't have to delay, then send something if we can */

	if (!ubcsp_config.delay)
	{
		/* Do we have something we are sending to send */

		if (ubcsp_config.send_size)
		{
			/* We have something to send so send it */

			if (ubcsp_config.send_slip_escape)
			{
				/* Last time we send a SLIP_ESCAPE octet
				   this time send the second escape code */

				put_uart (ubcsp_config.send_slip_escape);

				ubcsp_config.send_slip_escape = 0;
			}
			else
			{
#if UBCSP_CRC
				/* get the value to send, and calculate CRC as we go */

				value = *ubcsp_config.send_ptr ++;

				ubcsp_config.send_crc = ubcsp_calc_crc (value, ubcsp_config.send_crc);

				/* Output the octet */

				ubcsp_put_slip_uart (value);
#else
				/* Just output the octet*/

				ubcsp_put_slip_uart (*ubcsp_config.send_ptr ++);
#endif
			}

			/* If we did output a SLIP_ESCAPE, then don't process the end of a block */

			if ((!ubcsp_config.send_slip_escape) && ((ubcsp_config.send_size = ubcsp_config.send_size - 1) == 0))
			{
				/*** We are at the end of a block - either header or payload ***/

				/* setup the next block */

				ubcsp_config.send_ptr = ubcsp_config.next_send_ptr;
				ubcsp_config.send_size = ubcsp_config.next_send_size;
				ubcsp_config.next_send_ptr = 0;
				ubcsp_config.next_send_size = 0;

#if UBCSP_CRC
				/* If we have no successor block
				   then we might need to send the CRC */

				if (!ubcsp_config.send_ptr)
				{
					if (ubcsp_config.need_send_crc)
					{
						/* reverse the CRC from what we computed along the way */

						ubcsp_config.need_send_crc = 0;

						ubcsp_config.send_crc = ubcsp_crc_reverse (ubcsp_config.send_crc);

						/* Save in the send_crc buffer */

						ubcsp_send_crc[0] = (uint8) (ubcsp_config.send_crc >> 8);
						ubcsp_send_crc[1] = (uint8) ubcsp_config.send_crc;

						/* Setup to send this buffer */

						ubcsp_config.send_ptr = ubcsp_send_crc;
						ubcsp_config.send_size = 2;
					}
					else
					{
						/* We don't need to send the crc
						   either we just have, or this packet doesn't include it */

						/* Output the end of FRAME marker */

						put_uart (SLIP_FRAME);

						/* Check if this is an unreliable packet */

						*activity |= ubcsp_sent_packet ();

						/* We've sent the packet, so don't need to have be called quickly soon */

						delay = UBCSP_POLL_TIME_DELAY;
					}
				}
#else
				/* If we have no successor block
				   then we might need to send the CRC */

				if (!ubcsp_config.send_ptr)
				{
					/* Output the end of FRAME marker */

					put_uart (SLIP_FRAME);

					/* Check if this is an unreliable packet */

					*activity |= ubcsp_sent_packet ();

					/* We've sent the packet, so don't need to have be called quickly soon */

					delay = UBCSP_POLL_TIME_DELAY;
				}
#endif
			}
		}
		else if (ubcsp_config.link_establishment_packet == ubcsp_le_none)
		{
			/* We didn't have something to send
			   AND we have no Link Establishment packet to send */

			if (ubcsp_config.link_establishment_resp & 2)
			{
				/* Send the start of FRAME packet */

				put_uart (SLIP_FRAME);

				/* We did require a RESP packet - so setup the send */

				ubcsp_setup_packet ((uint8*) ubcsp_send_le_header, 0, (uint8*) ubcsp_le_buffer[ubcsp_le_conf_resp], 4);

				/* We have now "sent" this packet */

				ubcsp_config.link_establishment_resp = 0;
			}
			else if (ubcsp_config.send_packet)
			{
				/* There is a packet ready to be sent */

				/* Send the start of FRAME packet */

				put_uart (SLIP_FRAME);

				/* Encode up the packet header using ACK and SEQ numbers */

				ubcsp_send_header[0] =
					(ubcsp_config.send_packet->reliable << 7) |
#if UBCSP_CRC
					0x40 |	/* Always use CRC's */
#endif
					(ubcsp_config.ack_number << 3) | 
					(ubcsp_config.sequence_number);

				/* Encode up the packet header's channel and length */
				ubcsp_send_header[1] =
					(ubcsp_config.send_packet->channel & 0x0f) |
					((ubcsp_config.send_packet->length << 4) & 0xf0);

				ubcsp_send_header[2] =
					(ubcsp_config.send_packet->length >> 4) & 0xff;

				/* Let the ubcsp_setup_packet function calculate the header checksum */

				ubcsp_setup_packet ((uint8*) ubcsp_send_header, 1, ubcsp_config.send_packet->payload, ubcsp_config.send_packet->length);

				/* Don't need to send an ACK - we just place on in this packet */

				ubcsp_config.send_ack = 0;
				
#if SHOW_PACKET_ERRORS
				printf (" : %10d Send %d Ack %d\n",
					GetTickCount () % 100000,
					ubcsp_config.sequence_number,
					ubcsp_config.ack_number);
#endif
			}
			else if (ubcsp_config.send_ack)
			{
				/* Send the start of FRAME packet */

				put_uart (SLIP_FRAME);

#if SHOW_PACKET_ERRORS
				printf (" : %10d Send ACK %d\n",
					GetTickCount () % 100000,
					ubcsp_config.ack_number);
#endif

				/* The ack packet is already computed apart from the first octet */

				ubcsp_send_ack_header[0] =
#if UBCSP_CRC
					0x40 | 
#endif
					(ubcsp_config.ack_number << 3);

				/* Let the ubcsp_setup_packet function calculate the header checksum */

				ubcsp_setup_packet (ubcsp_send_ack_header, 1, 0, 0);

				/* We've now sent the ack */

				ubcsp_config.send_ack = 0;
			}
			else
			{
				/* We didn't have a Link Establishment response packet,
				   a normal packet or an ACK packet to send */

				delay = UBCSP_POLL_TIME_DELAY;
			}
		}
		else
		{
#if SHOW_PACKET_ERRORS
//			printf (" : %10d Send LE %d\n",
//				GetTickCount () % 100000,
//				ubcsp_config.link_establishment_packet);
#endif

			/* Send A Link Establishment Message */

			put_uart (SLIP_FRAME);

			/* Send the Link Establishment header followed by the 
			   Link Establishment packet */

			ubcsp_setup_packet ((uint8*) ubcsp_send_le_header, 0, (uint8*) ubcsp_le_buffer[ubcsp_config.link_establishment_packet], 4);

			/* start sending immediately */

			ubcsp_config.delay = 0;

			/* workout what the next link establishment packet should be */

			ubcsp_config.link_establishment_packet = next_le_packet[ubcsp_config.link_establishment_state + ubcsp_config.link_establishment_resp * 4];

			/* We have now delt with any response packet that we needed */

			ubcsp_config.link_establishment_resp = 0;

			return 0;
		}
	}

	/* We now need to receive any octets from the UART */

	while ((ubcsp_config.receive_packet) && (get_uart (&value)))
	{
		/* If the last octet was SLIP_ESCAPE, then special processing is required */

		if (ubcsp_config.receive_slip_escape)
		{
			/* WARNING - out of range values are not detected !!!
			   This will probably be caught with the checksum or CRC check */

			value = ubcsp_deslip[value - SLIP_ESCAPE_FRAME];

			ubcsp_config.receive_slip_escape = 0;
		}
		else
		{
			/* Check for the SLIP_FRAME octet - must be start or end of packet */
			if (value == SLIP_FRAME)
			{
				/* If we had a full header then we have a packet */

				if (ubcsp_config.receive_index >= 0)
				{
					/* process the received packet */

					*activity |= ubcsp_recevied_packet ();

					if (*activity & UBCSP_PACKET_ACK)
					{
						/* We need to ACK this packet, then don't delay its sending */
						ubcsp_config.delay = 0;
					}
				}

				/* Setup to receive the next packet */

				ubcsp_config.receive_index = -4;

				/* Ok, next octet */

				goto finished_receive;
			}
			else if (value == SLIP_ESCAPE)
			{
				/* If we receive a SLIP_ESCAPE,
				   then remember to process the next special octet */

				ubcsp_config.receive_slip_escape = 1;

				goto finished_receive;
			}
		}

		if (ubcsp_config.receive_index < 0)
		{
			/* We are still receiving the header */

			ubcsp_receive_header[ubcsp_config.receive_index + 4] = value;

			ubcsp_config.receive_index ++;
		}
		else if (ubcsp_config.receive_index < ubcsp_config.receive_packet->length)
		{
			/* We are receiving the payload */
			/* We might stop comming here if we are receiving a
			   packet which is longer than the receive_packet->length
			   given by the host */

			ubcsp_config.receive_packet->payload[ubcsp_config.receive_index] = value;

			ubcsp_config.receive_index ++;
		}

finished_receive:
		{
		}
	}

	if (ubcsp_config.delay > 0)
	{
		/* We were delayed so delay some more
		   this could be cancelled if we received something */

		ubcsp_config.delay --;
	}
	else
	{
		/* We had no delay, so use the delay we just decided to us */

		ubcsp_config.delay = delay;
	}

	/* Report the current delay to the user */

	return ubcsp_config.delay;
}

/*****************************************************************************/
/**                                                                         **/
/** ubcsp_end_of_functions                                                  **/
/**                                                                         **/
/*****************************************************************************/

/* This function is only included to allow for the size 
   of the code to be determined */

void ubcsp_end_of_functions (void)
{
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91国在线观看| 久久久久青草大香线综合精品| 成人一区二区三区| 国产激情视频一区二区在线观看| 精品一区二区三区免费| 日本va欧美va精品| 日韩影视精彩在线| 蜜臀av性久久久久蜜臀aⅴ流畅| 日本亚洲天堂网| 激情五月播播久久久精品| 精品制服美女久久| 国产剧情一区在线| 成人av网站在线观看| 色狠狠色噜噜噜综合网| 欧美日韩国产小视频在线观看| 欧美日韩亚洲综合在线| 欧美一级片在线| 欧美tickle裸体挠脚心vk| 国产调教视频一区| 国产精品网站一区| 一区二区三区精品视频| 五月婷婷激情综合网| 麻豆精品在线视频| 粉嫩aⅴ一区二区三区四区| 色欲综合视频天天天| 欧美男男青年gay1069videost| 欧美电视剧免费全集观看 | 综合婷婷亚洲小说| 亚洲五码中文字幕| 蜜桃一区二区三区在线观看| 国产成人精品www牛牛影视| 色诱亚洲精品久久久久久| 717成人午夜免费福利电影| 欧美精品一区二区三区在线| 亚洲欧美自拍偷拍| 婷婷六月综合亚洲| 国产在线一区二区| 色综合久久中文综合久久牛| 欧美一区二区人人喊爽| 久久夜色精品国产噜噜av | 国产中文字幕精品| 91丝袜高跟美女视频| 日韩一级二级三级| 中文字幕在线一区二区三区| 五月激情综合网| 成人免费毛片aaaaa**| 欧美日韩国产在线播放网站| 久久九九99视频| 亚洲国产色一区| 国产不卡视频一区二区三区| 欧美久久久久久久久中文字幕| wwwwww.欧美系列| 亚洲永久免费av| 国产高清在线精品| 久久久蜜桃精品| 亚洲免费成人av| 国产综合一区二区| 欧美日韩在线播放| 国产精品国产a级| 久久疯狂做爰流白浆xx| 欧美综合一区二区三区| 国产婷婷一区二区| 免费观看30秒视频久久| 色婷婷久久综合| 国产精品三级在线观看| 激情欧美一区二区三区在线观看| 欧美综合亚洲图片综合区| 中文无字幕一区二区三区| 奇米影视一区二区三区小说| 一本大道av一区二区在线播放| 国产亚洲女人久久久久毛片| 美国三级日本三级久久99| 欧美日韩一区不卡| 一区二区三区视频在线看| 成人动漫一区二区| 久久久久成人黄色影片| 欧美aaa在线| 欧美乱熟臀69xxxxxx| 亚洲视频一区二区在线| 成人激情综合网站| 国产欧美一区二区三区在线老狼 | 一本大道久久a久久精二百| 国产日韩欧美精品一区| 久久99国产精品久久99果冻传媒| 欧美乱妇15p| 亚洲成人先锋电影| 欧美丝袜丝交足nylons图片| 亚洲视频一区二区在线| 99精品国产热久久91蜜凸| 日本一区二区在线不卡| 国产成人av自拍| 久久精品欧美一区二区三区不卡 | 久热成人在线视频| 91精品一区二区三区在线观看| 亚洲一区二区三区中文字幕在线| 色婷婷一区二区| 亚洲激情图片小说视频| 色天使色偷偷av一区二区| 一区在线中文字幕| av电影在线观看不卡| 中文字幕中文字幕在线一区| www.亚洲在线| 亚洲天堂久久久久久久| 97精品视频在线观看自产线路二| 中文字幕在线免费不卡| 色悠悠久久综合| 亚洲高清视频在线| 91精品国产综合久久久蜜臀图片| 日韩激情av在线| 精品国产sm最大网站免费看| 国内外精品视频| 久久精品男人的天堂| eeuss鲁一区二区三区| 亚洲人成精品久久久久| 欧美三级蜜桃2在线观看| 日本午夜精品视频在线观看 | 久久久精品国产免费观看同学| 国产老女人精品毛片久久| 中文久久乱码一区二区| 91看片淫黄大片一级在线观看| 夜夜揉揉日日人人青青一国产精品| 欧美网站大全在线观看| 麻豆视频观看网址久久| 国产欧美一区二区精品性色超碰| 7777精品伊人久久久大香线蕉| 日本欧美一区二区在线观看| 精品国产a毛片| 9i看片成人免费高清| 亚洲国产精品一区二区久久恐怖片 | 欧美日韩高清在线播放| 日本不卡中文字幕| 国产亚洲女人久久久久毛片| 91蜜桃视频在线| 午夜不卡av在线| 久久久久久麻豆| 9久草视频在线视频精品| 午夜精品在线视频一区| 久久久久久亚洲综合| 色视频欧美一区二区三区| 日韩高清不卡在线| 欧美国产激情一区二区三区蜜月| 91视频在线看| 麻豆精品一区二区av白丝在线| 欧美国产一区在线| 欧美日韩aaa| 成人黄色av网站在线| 亚洲va中文字幕| 国产精品久久久久一区| 91精品国产一区二区人妖| 不卡一区二区中文字幕| 蜜臀av亚洲一区中文字幕| 椎名由奈av一区二区三区| 日韩免费看的电影| 91啪在线观看| 国产一区视频网站| 亚洲成人av电影在线| 国产精品美日韩| 日韩欧美在线观看一区二区三区| 风流少妇一区二区| 青青草视频一区| 亚洲欧美另类久久久精品2019| 亚洲精品一区二区三区影院| 在线精品国精品国产尤物884a| 国模冰冰炮一区二区| 亚洲mv在线观看| 国产精品入口麻豆九色| 精品久久久三级丝袜| 欧美日韩在线播放三区| 91视频观看免费| 高清国产一区二区| 韩国一区二区三区| 日韩二区在线观看| 亚洲精品国产成人久久av盗摄 | 秋霞午夜av一区二区三区| 亚洲免费av高清| 中国色在线观看另类| 日韩免费一区二区三区在线播放| 欧美亚洲丝袜传媒另类| 99re在线视频这里只有精品| 国产真实乱子伦精品视频| 日本欧美一区二区在线观看| 亚洲尤物视频在线| 综合在线观看色| 国产精品毛片高清在线完整版| 日韩欧美的一区二区| 欧美美女一区二区三区| 色妹子一区二区| 99久久精品国产导航| 成人v精品蜜桃久久一区| 国产馆精品极品| 国产一区在线不卡| 国产制服丝袜一区| 经典三级视频一区| 久久精品国产久精国产| 日韩国产欧美一区二区三区| 天天操天天干天天综合网| 亚洲综合免费观看高清完整版在线 | 视频一区二区中文字幕| 亚洲已满18点击进入久久| 亚洲永久免费av|