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

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

?? bcsp_sequence.c

?? blue tooth protocol stack source code
?? C
字號:
/* * bcsp_sequence.c -- Implementation of the Sequence layer in the BCSP *                    protocol stack * * Copyright (C) 2001  Axis Communications AB * * Author: Mats Friden <Mats.Friden@axis.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. * * Exceptionally, Axis Communications AB grants discretionary and * conditional permissions for additional use of the text contained * in the company's release of the AXIS OpenBT Stack under the * provisions set forth hereunder. * * Provided that, if you use the AXIS OpenBT Stack with other files, * that do not implement functionality as specified in the Bluetooth * System specification, to produce an executable, this does not by * itself cause the resulting executable to be covered by the GNU * General Public License. Your use of that executable is in no way * restricted on account of using the AXIS OpenBT Stack code with it. * * This exception does not however invalidate any other reasons why * the executable file might be covered by the provisions of the GNU * General Public License. * * $Id: bcsp_sequence.c,v 1.20 2001/09/20 17:02:03 pkj Exp $ * *//****************** INCLUDE FILES SECTION ***********************************/#define __NO_VERSION__ /* don't define kernel_version in module.h */#ifdef __KERNEL__#include <linux/malloc.h>#include <linux/types.h>#include <linux/interrupt.h>#include <linux/timer.h>#include <linux/bluetooth/sysdep-2.1.h>#include <linux/bluetooth/btmem.h>#include <linux/bluetooth/hci.h>#include <linux/bluetooth/bcsp.h>#include <linux/bluetooth/bcsp_debug.h>#else#include "include/btmem.h"#include "include/hci.h"#include "include/bcsp.h"#include "include/bcsp_debug.h"#endif/****************** CONSTANT AND MACRO SECTION ******************************/#if SEQUENCE_DEBUG#define D(fmt...) printk("SEQUENCE:  "fmt)#else#define D(fmt...)#endif#define WINSIZE 4#define SEQUENCE_TIMEOUT (HZ/4) /* default 250 ms */#define BCSP_RTX_MAX 20/****************** TYPE DEFINITION SECTION *********************************/typedef struct resend_buf {	u32 len;	u8 chn;	u8 seq_nbr;	u8 data[280];} resend_buf;/****************** LOCAL FUNCTION DECLARATION SECTION **********************/static void sequence_resend(void);static void send_ack(void);static void start_resend_timer(void);static void release_resend_timer(void);/****************** GLOBAL VARIABLE DECLARATION SECTION *********************//****************** LOCAL VARIABLE DECLARATION SECTION **********************/#ifdef __KERNEL__static struct tq_struct resend_data_task;static struct tq_struct send_ack_task;#endif#if BCSP_PARSELOWERu8 txseq;u8 txack;u8 rxack;u8 expected_rxseq;u8 winspace;#elsestatic u8 txseq;static u8 txack;static u8 rxack;static u8 expected_rxseq;static u8 winspace;#endifstatic u8 rtx_count = BCSP_RTX_MAX;#ifdef __KERNEL__static struct timer_list resend_timer;#endifstatic u8 resend_timer_active = FALSE;static struct resend_buf resend_buffer[8];/****************** FUNCTION DEFINITION SECTION *****************************/voidbcsp_sequence_init(void){#ifdef __KERNEL__	resend_data_task.routine = (void*)sequence_resend;	resend_data_task.data = NULL;	send_ack_task.routine = (void*)send_ack;	send_ack_task.data = NULL;#endif	txseq = 0;	txack = 0;	rxack = 0;	expected_rxseq = 0;	winspace = WINSIZE;}voidbcsp_sequence_shutdown(void){	release_resend_timer();}s32bcsp_sequence_receive(struct bcsp *bcsp){	if (!bcsp_issyncronized()){			D(__FUNCTION__": Still not synced\n");		return 0;	}		D(__FUNCTION__": txack:%d, expected_rxseq:%d, BCSP_GET_SEQ(bcsp):%d\n", txack, expected_rxseq, BCSP_GET_SEQ(bcsp));	if (expected_rxseq == BCSP_GET_SEQ(bcsp)) {		cli();		txack = (BCSP_GET_SEQ(bcsp) + 1) % 8;		expected_rxseq = (expected_rxseq + 1) % 8;		sti();		bcsp_signal_rxack(BCSP_GET_ACK(bcsp));				/* FIXME: Do we need to schedule when winsize > 0 ? */		if ((winspace > 0) && buf_count() && (hci_acl_num_cnt() > 0)) {			/* ack is piggybacked in next tx data packet */			D("<-data ack\n");		} else {			D("<-ack\n");			send_ack();		}				bcsp_receive_top(bcsp->payload, bcsp->payload_length,				 bcsp->identifier);	} else { /* out of order rx seq nbr */ 		if ((winspace > 0) && (hci_trig_send())) {			/* ack is piggybacked in next tx data packet */			printk("seq out-of-order [exp:%d, got:%ld]\n", 			       expected_rxseq, BCSP_GET_SEQ(bcsp));		} else {			printk("seq out-of-order [exp:%d, got:%ld], send ack\n",			       expected_rxseq, BCSP_GET_SEQ(bcsp));			send_ack();		}	}	return 0;}s32bcsp_sequence_send(u8 *data, u32 len, u8 chn){	struct bcsp bcsp;	D(__FUNCTION__": rxack:%d, txack:%d, txseq:%d, winspace:%d\n", rxack, txack, txseq, winspace);		if (winspace > 0) {		bcsp_init_packet(&bcsp);		bcsp.identifier = chn;		BCSP_SET_PROTOCOL_TYPE(&bcsp, BCSP_RELIABLE);		cli();		BCSP_SET_SEQ(&bcsp, txseq);		BCSP_SET_ACK(&bcsp, txack);		bcsp.payload = data;		bcsp.payload_length = len;		sti();		memcpy(resend_buffer[txseq].data, data, len);		resend_buffer[txseq].len = len;		resend_buffer[txseq].chn = chn;				cli();		txseq = (txseq + 1) % 8;		winspace--;		sti();				D(__FUNCTION__": winspace:%d, txreq:%d\n", winspace, txseq);		/* restart timer */		start_resend_timer();	} else {#ifdef DBG_BCSPHEADER		printk(__FUNCTION__": win=0\n");#endif		return 0;	}	return bcsp_mux_send(&bcsp);}voidbcsp_signal_rxack(u8 new_ack){	s32 trig_send = FALSE;	D(__FUNCTION__": Got new ack:%d, rxack is:%d, txseq:%d, winspace:%d\n", new_ack, rxack, txseq, winspace);	if (rxack == new_ack) { /* Same ack again... */		return;	}	cli();	if (winspace == 0) {		trig_send = TRUE;	}	D(__FUNCTION__": winspace before:%d [%d, %d]\n", 	  winspace, rxack, new_ack);	if (new_ack > rxack) {		winspace += (new_ack - rxack);	} else {		winspace += (8 - (rxack - new_ack));	}	D(__FUNCTION__" win_up:%d\n", winspace);	rxack = new_ack;	rtx_count = BCSP_RTX_MAX;		sti();		if (winspace == WINSIZE) {		release_resend_timer();	} else if (winspace > WINSIZE) {		printk(__FUNCTION__": ERROR  winspace > WINSIZE [%d]\n", 		       winspace);		winspace = WINSIZE;		release_resend_timer();	} 		if (trig_send) {		hci_trig_send();	}}voidsequence_resend(void){	struct bcsp bcsp;	u8 resend_cnt = rxack;		cli();	while (rtx_count && (resend_cnt != txseq)) {		sti();		D(__FUNCTION__ ": seq_nbr:%d, last_ack:%d, cur_seq:%d\n",                  resend_cnt, rxack, txseq);				bcsp_init_packet(&bcsp);				bcsp.identifier = resend_buffer[resend_cnt].chn;				BCSP_SET_PROTOCOL_TYPE(&bcsp, BCSP_RELIABLE);				BCSP_SET_SEQ(&bcsp, resend_cnt);		cli();		BCSP_SET_ACK(&bcsp, txack);		sti();		bcsp.payload = resend_buffer[resend_cnt].data;		bcsp.payload_length = resend_buffer[resend_cnt].len;				bcsp_mux_send(&bcsp);		resend_cnt = (resend_cnt + 1) % 8;	}       	sti();	rtx_count--;		if (rtx_count == 0) {		printk("ERROR : giving up on rtx!\n");		/* fixme -- signal link down etc. */	} else {		start_resend_timer();	}}voidsend_ack(void){	u8 tmp;	cli();	tmp = txack;	sti();	bcsp_send_txack(tmp);}voidstart_resend_timer(void){	if (resend_timer_active) {		release_resend_timer();	}#ifdef __KERNEL__	init_timer(&resend_timer);	resend_timer.function = (void*)sequence_resend;	resend_timer.data = 0;	resend_timer.expires = jiffies + SEQUENCE_TIMEOUT;		resend_timer_active = TRUE;		add_timer(&resend_timer);#endif}voidrelease_resend_timer(void){	if (resend_timer_active) {		resend_timer_active = FALSE;#ifdef __KERNEL__		del_timer(&resend_timer);#endif	}}/****************** END OF FILE sequence.c **********************************/

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品网友自拍| 国产精品毛片大码女人| 色系网站成人免费| 成人国产免费视频| 成人高清视频在线观看| 成人黄色777网| 91麻豆免费看| 欧美在线观看视频一区二区三区| 91视频精品在这里| 色综合久久久久久久久| 欧美主播一区二区三区| 欧美偷拍一区二区| 91精品久久久久久蜜臀| 欧美大片一区二区| 欧美激情一区二区三区全黄| 国产精品美女久久久久久久网站| 亚洲国产成人在线| 亚洲欧美激情小说另类| 首页亚洲欧美制服丝腿| 久久99久久99| 成人免费视频免费观看| 91免费国产在线观看| 欧美日韩午夜在线| 久久色.com| 国产欧美视频一区二区三区| 亚洲欧洲日韩av| 首页欧美精品中文字幕| 国产精品 欧美精品| 色欧美乱欧美15图片| 91精品国产91久久综合桃花| 欧美激情一区二区三区| 日韩国产欧美三级| 国产suv一区二区三区88区| 欧美中文字幕一区二区三区亚洲| 欧美www视频| 中文字幕日韩精品一区| 日韩国产欧美在线播放| www.色精品| 日韩久久精品一区| 一二三区精品视频| 国产乱码字幕精品高清av| 在线观看av一区| 久久亚洲影视婷婷| 日韩在线一二三区| 99精品一区二区| 久久免费美女视频| 视频精品一区二区| 91久久精品一区二区三区| 日韩精品一区二区在线| 亚洲国产精品久久人人爱蜜臀| 国产一区二区精品久久| 51精品久久久久久久蜜臀| 国产精品久久久久久久裸模| 久久国产欧美日韩精品| 欧美日韩一区二区三区在线 | 综合色天天鬼久久鬼色| 精品一区二区三区日韩| 538在线一区二区精品国产| 综合激情网...| 色婷婷综合激情| 国产欧美日韩精品在线| 极品少妇一区二区| 日韩美女视频一区二区在线观看| 亚洲一区二区三区四区中文字幕| 99久久精品免费看国产| 中文字幕欧美日韩一区| 国产精品一级在线| 久久免费看少妇高潮| 国内精品伊人久久久久av一坑| 91精品婷婷国产综合久久竹菊| 亚洲aⅴ怡春院| 欧美日韩成人在线| 奇米一区二区三区| 欧美一级免费观看| 九九精品一区二区| 久久久久久夜精品精品免费| 国产在线精品免费| 国产三级一区二区三区| 国产精品一区在线观看乱码| 久久免费午夜影院| 成人综合激情网| 亚洲欧美一区二区视频| 色综合久久综合| 亚洲一区二区三区四区在线观看 | 亚洲视频一区在线| 91在线观看污| 亚洲一卡二卡三卡四卡五卡| 欧美午夜精品免费| 日本不卡在线视频| 久久欧美一区二区| 不卡影院免费观看| 亚洲影院免费观看| 欧美一区二区三区色| 激情久久久久久久久久久久久久久久| 欧美va亚洲va在线观看蝴蝶网| 韩国成人精品a∨在线观看| 国产亚洲成年网址在线观看| 91免费观看国产| 奇米影视7777精品一区二区| 国产片一区二区三区| 91影视在线播放| 日韩成人免费电影| 久久网站最新地址| 91香蕉国产在线观看软件| 亚洲国产综合视频在线观看| 日韩一区二区免费电影| 粉嫩欧美一区二区三区高清影视| 成人欧美一区二区三区白人| 欧美日韩国产系列| 国产成人精品免费视频网站| 一区二区高清视频在线观看| 日韩精品一区二区三区视频播放| 粉嫩一区二区三区在线看| 亚洲第一搞黄网站| 国产精品乱人伦| 日韩一区二区不卡| 91性感美女视频| 激情五月激情综合网| 一区二区不卡在线播放| 国产三级欧美三级日产三级99| 在线亚洲一区二区| 国产iv一区二区三区| 视频在线观看一区二区三区| 国产精品久久久久桃色tv| 欧美精品在欧美一区二区少妇| 国产成人高清在线| 麻豆精品精品国产自在97香蕉| 一个色妞综合视频在线观看| 国产欧美一区二区精品性色| 日韩三级在线观看| 色成年激情久久综合| 丁香婷婷综合五月| 久久精品国产一区二区三 | 久久影院午夜论| 欧美精品18+| 在线看不卡av| 91官网在线观看| 91欧美一区二区| 成人黄色免费短视频| 精品一区二区三区视频| 蜜臀精品久久久久久蜜臀| 亚洲第一精品在线| 亚洲一区二区四区蜜桃| 亚洲精品日韩综合观看成人91| 国产蜜臀av在线一区二区三区| 日韩一级免费观看| 欧美一区二区在线不卡| 欧美日韩精品一区视频| 欧美日韩黄视频| 欧美日韩久久久一区| 欧美日韩免费不卡视频一区二区三区| 99精品国产91久久久久久| 成人avav影音| av中文字幕不卡| 91农村精品一区二区在线| 91原创在线视频| 欧美在线一二三四区| 欧美日韩亚洲综合一区二区三区 | 爽爽淫人综合网网站| 亚洲图片有声小说| 五月天中文字幕一区二区| 亚洲成人av一区| 免费在线看一区| 国产曰批免费观看久久久| 国产激情91久久精品导航| 成人美女视频在线看| 色域天天综合网| 欧美日韩的一区二区| 精品成a人在线观看| 亚洲国产精品成人综合 | 午夜久久电影网| 奇米四色…亚洲| 福利视频网站一区二区三区| 欧美丝袜自拍制服另类| 欧美浪妇xxxx高跟鞋交| 久久这里只有精品首页| 中文字幕免费一区| 亚洲午夜日本在线观看| 日本免费在线视频不卡一不卡二| 国产一区二区三区黄视频 | 中文字幕亚洲欧美在线不卡| 亚洲三级在线播放| 日韩电影在线免费观看| 国产成人精品影院| 欧美中文字幕不卡| 欧美videos中文字幕| 亚洲欧洲精品一区二区三区| 午夜电影一区二区三区| 国产美女视频一区| 欧美裸体bbwbbwbbw| 欧美激情艳妇裸体舞| 日韩高清在线电影| 菠萝蜜视频在线观看一区| 欧美疯狂性受xxxxx喷水图片| 国产调教视频一区| 日韩国产在线观看| 日本韩国精品一区二区在线观看| 日韩精品综合一本久道在线视频| 亚洲视频一二三| 国产精品资源网|