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

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

?? rfcomm.c

?? linux系統下的關于藍牙模塊的源代碼!十分的經典的程序!
?? C
?? 第 1 頁 / 共 5 頁
字號:
/* * rfcomm.c -- Implementation of Bluetooth RFCOMM with TS 07.10,  *             Serial Port Emulation * * Copyright (C) 2000, 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: rfcomm.c,v 1.127 2001/10/18 15:49:25 pkj Exp $ * *//****************** INCLUDE FILES SECTION ***********************************/#define __NO_VERSION__ /* don't define kernel_version in module.h */#ifdef __KERNEL__ #include <linux/config.h>#include <linux/bluetooth/sysdep-2.1.h>#include <linux/malloc.h>#include <linux/types.h>#include <linux/string.h>#include <linux/sched.h>#include <asm/unaligned.h>#include <linux/bluetooth/rfcomm.h>#include <linux/bluetooth/rfcomm_sec.h>#include <linux/bluetooth/btmem.h>#include <linux/bluetooth/l2cap.h>#include <linux/bluetooth/bluetooth.h>#include <linux/bluetooth/btconfig.h>#include <linux/bluetooth/bt_errno.h>#else#include <stdlib.h>#include <string.h>#include <errno.h>#include <asm/unaligned.h>#include "include/rfcomm.h"#include "include/rfcomm_sec.h"#include "include/btmem.h"#include "include/l2cap.h"#include "include/bluetooth.h"#include "include/local.h"#include "include/bt_errno.h"#endif/****************** DEBUG CONSTANT AND MACRO SECTION ************************//* Defines for the debug macros */#if DEBUG_RFCOMM_RECEIVE_FLOW#define D_REC(fmt...) printk(RFCOMM_DBG_STR fmt)#else#define D_REC(fmt...) #endif#if DEBUG_RFCOMM_SEND_PROCESS#define D_SND(fmt...) printk(RFCOMM_DBG_STR fmt)#else#define D_SND(fmt...)#endif#if DEBUG_RFCOMM_INTERNAL_SIGNALING#define D_CTRL(fmt...) printk(RFCOMM_DBG_STR fmt)#else#define D_CTRL(fmt...)#endif#if PRINT_DATA_ENABLE#define RF_DATA(str, data, len) print_data(str, data, len)#else#define RF_DATA(str, data, len)#endif#define FNC __FUNCTION__ ": "/****************** CONSTANT AND MACRO SECTION ******************************/#define SET_PF(ctr) ((ctr) | (1 << 4)) /* Sets the P/F-bit in the control field */#define CLR_PF(ctr) ((ctr) & 0xef)/* clears the P/F-bit in the control field */#define GET_PF(ctr) (((ctr) >> 4) & 0x1)/* Returns the P/F bit */#define SHORT_CRC_CHECK 2/* Used for uih packets */#define LONG_CRC_CHECK 3/* Used for all packet exepts for the uih packets */#define SHORT_HDR 2/* Short header for short uih packets */#define LONG_HDR 3/* and long header for long uih packets *//* FIXME: Should thsi one be define here? */#define SHORT_PAYLOAD_SIZE 127#define EA 1/* Used for setting the EA field in different packets,  really neccessary? */#define FCS_SIZE 1/* Yes the FCS size is only one byte */#define RFCOMM_MAX_HDR_SIZE 5#define MAX_CREDITS   30#define START_CREDITS 7#define MIN_CREDITS   15#define DEF_RFCOMM_MTU 127/* The values in the control field when sending ordinary rfcomm packets */#define SABM      0x2f#define SABM_SIZE 4#define UA        0x63#define UA_SIZE   4#define DM        0x0f#define DISC      0x43#define UIH       0xef/* The values in the type field in a multiplexer command packet */#define TEST  0x08#define FCON  0x28#define FCOFF 0x18#define MSC   0x38#define RPN   0x24#define RLS   0x14#define PN    0x20#define NSC   0x04/* Define of some V.24 signals modem control signals in RFCOMM */#define FC  0x02#define RTC 0x04#define RTR 0x08#define DV  0x80/* endian-swapping macros for structs */#define swap_long_frame(x) ((x)->h.length.val = le16_to_cpu((x)->h.length.val))#define swap_mcc_long_frame(x) (swap_long_frame(x))#define RFCOMM_CON_TIMEOUT (5*HZ)/****************** TYPE DEFINITION SECTION *********************************//* Typedefinitions of stuctures used for creating and parsing packets, for a   further description of the structures please se the bluetooth core   specification part F:1 and the ETSI TS 07.10 specification  */#include <asm/byteorder.h>#ifdef __LITTLE_ENDIAN_BITFIELDtypedef struct address_field {	u8 ea:1;	u8 cr:1;	u8 d:1;	u8 server_chn:5;} __attribute__ ((packed)) address_field;typedef struct short_length {	u8 ea:1;	u8 len:7;} __attribute__ ((packed)) short_length;typedef union long_length {	struct bits {		u16 ea:1;		u16 len:15;	} __attribute__ ((packed)) bits;	u16 val;} __attribute__ ((packed)) long_length;typedef struct short_frame_head {	address_field addr;	u8 control;	short_length length;} __attribute__ ((packed)) short_frame_head;typedef struct short_frame {	short_frame_head h;	u8 data[0];} __attribute__ ((packed)) short_frame;typedef struct long_frame_head {	address_field addr;	u8 control;	long_length length;	u8 data[0];} __attribute__ ((packed)) long_frame_head;typedef struct long_frame {	long_frame_head h;	u8 data[0];} __attribute__ ((packed)) long_frame;/* Typedefinitions for structures used for the multiplexer commands */typedef struct mcc_type {	u8 ea:1;	u8 cr:1;	u8 type:6;} __attribute__ ((packed)) mcc_type;typedef struct mcc_short_frame_head {	mcc_type type;	short_length length;	u8 value[0];} __attribute__ ((packed)) mcc_short_frame_head;typedef struct mcc_short_frame {	mcc_short_frame_head h;	u8 value[0];} __attribute__ ((packed)) mcc_short_frame;typedef struct mcc_long_frame_head {	mcc_type type;	long_length length;	u8 value[0];} __attribute__ ((packed)) mcc_long_frame_head;typedef struct mcc_long_frame {	mcc_long_frame_head h;	u8 value[0];} __attribute__ ((packed)) mcc_long_frame;/* MSC command */typedef struct v24_signals {	u8 ea:1;	u8 fc:1;	u8 rtc:1;	u8 rtr:1;	u8 reserved:2;	u8 ic:1;	u8 dv:1;} __attribute__ ((packed)) v24_sigs;typedef struct brk_sigs {	u8 ea:1;	u8 b1:1;	u8 b2:1;	u8 b3:1;	u8 len:4;} __attribute__ ((packed)) brk_sigs;typedef struct msc_msg {	short_frame_head s_head;	mcc_short_frame_head mcc_s_head;	address_field dlci;	u8 v24_sigs;//	brk_sigs break_signals;	u8 fcs;} __attribute__ ((packed)) msc_msg;/* RPN command */typedef struct rpn_msg {	short_frame_head s_head;	mcc_short_frame_head mcc_s_head;	address_field dlci;	rpn_values rpn_val;	u8 fcs;} __attribute__ ((packed)) rpn_msg;/* RLS command */  typedef struct rls_msg {	short_frame_head s_head;	mcc_short_frame_head mcc_s_head;	address_field dlci;	u8 error:4;	u8 res:4;	u8 fcs;} __attribute__ ((packed)) rls_msg;/* PN command */typedef struct pn_msg {	short_frame_head s_head;	mcc_short_frame_head mcc_s_head;/* The res1, res2 and res3 values have to be set to 0 by the sender */	u8 dlci:6;	u8 res1:2;	u8 frame_type:4;	u8 credit_flow:4;	u8 prior:6;	u8 res2:2;	u8 ack_timer;	u16 frame_size;	u8 max_nbrof_retrans;	u8 credits;	u8 fcs;} __attribute__ ((packed)) pn_msg;/* NSC-command */typedef struct nsc_msg {	short_frame_head s_head;	mcc_short_frame_head mcc_s_head;	mcc_type command_type;	u8 fcs;} __attribute__ ((packed)) nsc_msg;#elif defined(__BIG_ENDIAN_BITFIELD)typedef struct address_field {	u8 server_chn:5;	u8 d:1;	u8 cr:1;	u8 ea:1;} __attribute__ ((packed)) address_field;typedef struct short_length {	u8 len:7;	u8 ea:1;} __attribute__ ((packed)) short_length;typedef union long_length {	struct bits {		u16 len:15;		u16 ea:1;	} __attribute__ ((packed)) bits;	u16 val;} __attribute__ ((packed)) long_length;typedef struct short_frame_head { 	address_field addr;	u8 control;	short_length length;} __attribute__ ((packed)) short_frame_head;typedef struct short_frame {	short_frame_head h;	u8 data[0];} __attribute__ ((packed)) short_frame;typedef struct long_frame_head { 	address_field addr;	u8 control;	long_length length;	u8 data[0];} __attribute__ ((packed)) long_frame_head;typedef struct long_frame { 	long_frame_head h;	u8 data[0];} __attribute__ ((packed)) long_frame;/* Typedefinitions for structures used for the multiplexer commands */typedef struct mcc_type { 	u8 type:6;	u8 cr:1;	u8 ea:1;} __attribute__ ((packed)) mcc_type;typedef struct mcc_short_frame_head { 	mcc_type type;	short_length length;	u8 value[0];} __attribute__ ((packed)) mcc_short_frame_head;typedef struct mcc_short_frame { 	mcc_short_frame_head h;	u8 value[0];} __attribute__ ((packed)) mcc_short_frame;typedef struct mcc_long_frame_head { 	mcc_type type;	long_length length;	u8 value[0];} __attribute__ ((packed)) mcc_long_frame_head;typedef struct mcc_long_frame { 	mcc_long_frame_head h;	u8 value[0];} __attribute__ ((packed)) mcc_long_frame;/* MSC command */typedef struct v24_signals { 	u8 dv:1;	u8 ic:1;	u8 reserved:2;	u8 rtr:1;	u8 rtc:1;	u8 fc:1;	u8 ea:1;} __attribute__ ((packed)) v24_sigs;typedef struct brk_sigs { 	u8 len:4;	u8 b3:1;	u8 b2:1;	u8 b1:1;	u8 ea:1;} __attribute__ ((packed)) brk_sigs;typedef struct msc_msg { 	short_frame_head s_head;	mcc_short_frame_head mcc_s_head;	address_field dlci;	u8 v24_sigs;//	brk_sigs break_signals;	u8 fcs;} __attribute__ ((packed)) msc_msg;/* RPN command */typedef struct rpn_msg { 	short_frame_head s_head;	mcc_short_frame_head mcc_s_head;	address_field dlci;	rpn_values rpn_val;	u8 fcs;} __attribute__ ((packed)) rpn_msg;/* RLS command */  typedef struct rls_msg { 	short_frame_head s_head;	mcc_short_frame_head mcc_s_head;	address_field dlci;	u8 res:4;	u8 error:4;	u8 fcs;} __attribute__ ((packed)) rls_msg;/* PN command */typedef struct pn_msg { 	short_frame_head s_head;	mcc_short_frame_head mcc_s_head;/* The res1, res2 and res3 values have to be set to 0 by the sender */	u8 res1:2;	u8 dlci:6;	u8 credit_flow:4;	u8 frame_type:4;	u8 res2:2;	u8 prior:6;	u8 ack_timer;	u16 frame_size;	u8 max_nbrof_retrans;	u8 credits;	u8 fcs;} __attribute__ ((packed)) pn_msg;/* NSC-command */typedef struct nsc_msg { 	short_frame_head s_head;	mcc_short_frame_head mcc_s_head;	mcc_type command_type;	u8 fcs;} __attribute__ ((packed)) nsc_msg;#else /* __XXX_ENDIAN */#error Processor endianness unknown!#endif /* __XXX_ENDIAN *//****************** LOCAL FUNCTION DECLARATION SECTION **********************/static void process_mcc(u8* data, u32 len, rfcomm_con *rfcomm, s32 long_pkt);static s32 send_ua(rfcomm_con *rfcomm, u8 dlci);static s32 send_dm(rfcomm_con *rfcomm, u8 dlci);static s32 send_sabm(rfcomm_con *rfcomm, u8 dlci);static s32 send_disc(rfcomm_con *rfcomm, u8 dlci);static s32 send_uih(u8 *data, u32 len, rfcomm_con *rfcomm, u8 dlci);static s32 send_pn_msg(rfcomm_con *rfcomm, u8 prior, u32 frame_size, u8 credit_flow, u8 credits, u8 dlci, u8 cr);static s32 send_nsc_msg(rfcomm_con *rfcomm, mcc_type cmd, u8 cr);static void set_uih_hdr(short_frame *uih_pkt, u8 dlci, u32 len, u8 cr);static u32 crc_check(u8 *data, u32 length, u8 check_sum);static u8 crc_calc(u8 *data, u32 length);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲成人综合网站| 7777精品伊人久久久大香线蕉| 色综合久久九月婷婷色综合| 日韩欧美国产一区二区在线播放| 欧美国产日韩亚洲一区| 美女视频一区二区| 欧美午夜精品一区| 中文字幕一区二区三区色视频| 激情六月婷婷久久| 91精品婷婷国产综合久久竹菊| 亚洲老司机在线| 波多野结衣中文字幕一区二区三区| 日韩欧美成人激情| 三级成人在线视频| 欧美三级电影网站| 欧美亚洲综合一区| 欧美午夜精品久久久久久孕妇 | 视频一区在线视频| 成a人片国产精品| 久久久久国产精品麻豆| 美女视频一区二区| 日韩久久精品一区| 免费高清不卡av| 日韩一级黄色大片| 天使萌一区二区三区免费观看| 日本久久一区二区三区| 中文字幕一区二区三| 成人av一区二区三区| 亚洲国产电影在线观看| 国产成人免费在线观看不卡| 国产日产欧产精品推荐色| 国产一区二区三区免费播放| 久久久精品tv| 成人爱爱电影网址| 亚洲精品午夜久久久| 欧美伊人久久久久久午夜久久久久| 亚洲精品乱码久久久久| 色综合久久天天| 亚洲国产色一区| 4438x成人网最大色成网站| 免费人成网站在线观看欧美高清| 欧美三级中文字幕在线观看| 无吗不卡中文字幕| 精品久久久久久久久久久久久久久 | 欧洲日韩一区二区三区| 亚洲一区自拍偷拍| 日韩一区二区三区视频| 国产一区二区三区电影在线观看| 欧美国产一区视频在线观看| 色天天综合色天天久久| 日韩av网站在线观看| 久久你懂得1024| 99久久99久久久精品齐齐| 亚洲线精品一区二区三区 | 在线一区二区三区| 亚洲一区免费观看| 日韩一本二本av| 国产激情一区二区三区四区 | 欧美高清在线一区| 在线视频一区二区三区| 日本sm残虐另类| 中文字幕欧美国产| 欧美三级午夜理伦三级中视频| 激情都市一区二区| 亚洲精品写真福利| 久久久久久久久免费| 在线观看精品一区| 国产99精品视频| 丝袜亚洲另类欧美| 中文字幕日韩精品一区 | 国产精品美女久久久久久久久久久| 一本久久a久久免费精品不卡| 午夜电影一区二区| 国产精品免费看片| 欧美一二区视频| 色婷婷精品久久二区二区蜜臂av| 理论电影国产精品| 亚洲一区二区3| 中文字幕+乱码+中文字幕一区| 欧美日韩中文字幕一区| 成人h动漫精品| 精品无码三级在线观看视频| 一区二区三区欧美亚洲| 欧美激情一区三区| 日韩美女在线视频| 欧美日韩一区二区三区在线| 99精品国产99久久久久久白柏| 捆绑变态av一区二区三区| 亚洲国产一区二区三区青草影视| 久久精品男人的天堂| 欧美一区二区观看视频| 在线视频欧美精品| 91蜜桃传媒精品久久久一区二区| 国产在线精品国自产拍免费| 爽好久久久欧美精品| 自拍偷拍亚洲欧美日韩| 久久久一区二区| 久久午夜免费电影| 精品伦理精品一区| 精品国产人成亚洲区| 欧美精品日日鲁夜夜添| 色婷婷激情综合| 91久久精品一区二区三| 本田岬高潮一区二区三区| 国产精品77777| 国产一区不卡精品| 裸体歌舞表演一区二区| 麻豆精品国产传媒mv男同| 亚洲福利电影网| 丝袜脚交一区二区| 青青草视频一区| 免费观看91视频大全| 日本vs亚洲vs韩国一区三区| 日韩成人免费电影| 久久国产日韩欧美精品| 激情综合色综合久久综合| 久久精品国产在热久久| 蜜乳av一区二区| 久久99久久99精品免视看婷婷 | 久久免费视频色| 国产女同互慰高潮91漫画| 国产女主播一区| 亚洲免费在线视频一区 二区| 一区二区在线观看视频在线观看| 亚洲欧美日本韩国| 日韩一区精品视频| 精品一区二区日韩| jizzjizzjizz欧美| 欧美性猛交xxxx黑人交| 日韩一区二区影院| 国产日韩欧美高清| 亚洲靠逼com| 另类的小说在线视频另类成人小视频在线 | 26uuu精品一区二区在线观看| 久久综合久久鬼色| 国产精品卡一卡二卡三| 一区二区三区四区中文字幕| 日日夜夜精品视频免费| 亚洲精品日日夜夜| 国产无一区二区| 亚洲天堂免费看| 日日夜夜精品视频天天综合网| 蜜臀久久99精品久久久久宅男| 经典三级一区二区| 99精品视频中文字幕| 91精品国产91久久久久久一区二区| 欧美成人三级在线| 亚洲视频你懂的| 蜜臀精品久久久久久蜜臀| 成人免费观看男女羞羞视频| 欧美日韩视频在线第一区| 日本一区二区视频在线| 五月激情综合色| 国产成人亚洲综合a∨婷婷图片| 色婷婷国产精品综合在线观看| 7799精品视频| 中文字幕一区二区三区在线不卡| 亚洲成人自拍网| 不卡的电影网站| 欧美r级电影在线观看| 中文一区一区三区高中清不卡| 婷婷综合五月天| va亚洲va日韩不卡在线观看| 一区二区视频免费在线观看| 亚洲国产日韩在线一区模特| 国内精品伊人久久久久影院对白| 不卡的av电影| 精品国精品国产尤物美女| 亚洲欧美日韩在线不卡| 国产真实乱对白精彩久久| 欧美日韩亚洲国产综合| 亚洲欧美在线aaa| 国内精品久久久久影院一蜜桃| 欧美性猛交一区二区三区精品| 中文字幕精品三区| 国产精品中文字幕日韩精品| 欧美一级二级三级蜜桃| 亚洲电影在线免费观看| 91麻豆自制传媒国产之光| 久久综合色8888| 狠狠色丁香久久婷婷综| 制服丝袜日韩国产| 午夜精品久久久久久不卡8050| 成人高清免费在线播放| 国产视频911| 国产一区在线不卡| 欧美精品一区二| 久久国产精品99精品国产| 7777精品伊人久久久大香线蕉完整版| 亚洲欧洲成人精品av97| 成人激情文学综合网| 国产欧美日韩另类视频免费观看| 久久99久久99| 日韩成人dvd| 日韩欧美一卡二卡| 午夜免费欧美电影| 欧美日韩精品系列| 日韩高清不卡在线| 日韩欧美在线一区二区三区| 蜜臀国产一区二区三区在线播放|