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

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

?? rfcomm.c

?? linux系統(tǒng)下的關于藍牙模塊的源代碼!十分的經(jīng)典的程序!
?? 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一区二区三区免费野_久草精品视频
欧美成人三级在线| 日本一道高清亚洲日美韩| 午夜视频在线观看一区二区三区 | 欧美中文字幕亚洲一区二区va在线 | 日本一区二区久久| 手机精品视频在线观看| 99久久99久久免费精品蜜臀| 欧美成人午夜电影| 性做久久久久久久免费看| zzijzzij亚洲日本少妇熟睡| 日韩三级av在线播放| 亚洲一区二区三区在线看| 成人中文字幕合集| 久久综合久久99| 日韩成人午夜电影| 欧日韩精品视频| 1024国产精品| 99精品视频在线免费观看| 国产片一区二区| 国产高清精品网站| 2023国产一二三区日本精品2022| 日韩电影在线观看一区| 色诱视频网站一区| 亚洲欧美一区二区不卡| 99久久国产综合色|国产精品| 国产亚洲综合av| 国产乱码精品一区二区三区忘忧草| 在线不卡a资源高清| 亚洲成va人在线观看| 欧美色图12p| 亚洲国产一区二区在线播放| 91国偷自产一区二区使用方法| 成人欧美一区二区三区1314| 成人精品免费网站| 亚洲女同一区二区| 日本精品一区二区三区高清| 日韩伦理av电影| 日本道在线观看一区二区| 亚洲夂夂婷婷色拍ww47| 欧美区一区二区三区| 青青草国产成人av片免费| 91精品国产入口在线| 日本aⅴ亚洲精品中文乱码| 欧美成人欧美edvon| 国产精品1区2区3区在线观看| 久久久久9999亚洲精品| av午夜一区麻豆| 亚洲黄色在线视频| 欧美猛男超大videosgay| 蜜桃视频免费观看一区| 久久你懂得1024| 99视频在线观看一区三区| 亚洲美女电影在线| 欧美久久一区二区| 国产一区在线观看视频| 国产精品毛片大码女人| 在线观看免费成人| 麻豆91精品视频| 国产精品丝袜在线| 欧美日韩精品福利| 国产一区二区美女| 一区二区久久久久| 宅男噜噜噜66一区二区66| 国产真实精品久久二三区| 亚洲欧美怡红院| 欧美一级高清大全免费观看| 国内精品写真在线观看| 国产精品国产a级| 91精品在线一区二区| 成人动漫精品一区二区| 亚洲成人一区二区在线观看| 一区二区三区资源| 日韩欧美一区在线| 色综合视频一区二区三区高清| 日韩激情视频网站| 国产精品传媒在线| 欧美一区二区三区不卡| 91在线视频免费观看| 国内偷窥港台综合视频在线播放| 亚洲男人天堂一区| 国产日韩成人精品| 日韩视频一区二区| 欧美亚洲一区二区在线| 国产精品18久久久久久久久| 丝袜亚洲另类欧美| 中文字幕一区二区在线播放| 精品国产一区二区在线观看| 欧美最猛性xxxxx直播| 国产aⅴ综合色| 蜜臀a∨国产成人精品| 亚洲午夜在线视频| 国产精品久久久久久久久快鸭 | 一本色道久久综合亚洲91| 国产美女精品一区二区三区| 日日噜噜夜夜狠狠视频欧美人| 中文字幕在线不卡一区二区三区| 欧美不卡一区二区| 91麻豆精品国产综合久久久久久| 色综合天天在线| 99国产精品一区| 成人aaaa免费全部观看| 岛国av在线一区| 国产成人精品综合在线观看| 韩国av一区二区三区在线观看| 蜜臀av性久久久久蜜臀aⅴ| 亚洲va欧美va人人爽| 午夜一区二区三区在线观看| 亚洲一区二区视频| 一区二区国产视频| 亚洲永久精品大片| 亚洲狠狠爱一区二区三区| 一区二区三区加勒比av| 一区二区三区欧美久久| 一区二区三区在线观看国产| 一区二区三区欧美视频| 亚洲福利视频导航| 日韩中文字幕区一区有砖一区| 婷婷久久综合九色综合伊人色| 亚洲第一av色| 日韩和欧美的一区| 九色综合狠狠综合久久| 国产伦精一区二区三区| 国产成人综合网| 97久久久精品综合88久久| 在线欧美一区二区| 欧美剧情片在线观看| 日韩欧美国产电影| 久久久久99精品一区| 国产精品二区一区二区aⅴ污介绍| 亚洲欧洲成人av每日更新| 一区二区三区四区蜜桃| 日韩在线一区二区三区| 久久精品免费观看| 成人午夜免费电影| 91福利精品视频| 欧美精品日韩一本| 精品国产乱码久久| 国产精品污污网站在线观看| 国产精品主播直播| 99久久精品情趣| 欧美日韩性生活| 久久久国产精品麻豆| 亚洲日本护士毛茸茸| 日韩精品每日更新| 国产999精品久久久久久| 91麻豆精品在线观看| 91麻豆精品国产91久久久更新时间| 日韩欧美国产精品一区| **性色生活片久久毛片| 日韩av一二三| 91视频www| 欧美电影免费观看高清完整版| 中文字幕亚洲区| 日产精品久久久久久久性色| 成人在线视频首页| 欧美剧情片在线观看| 国产精品美女www爽爽爽| 美女视频黄频大全不卡视频在线播放| 国产不卡在线一区| 欧美一区二区三区视频免费| 国产精品久久久久久久第一福利| 亚洲成人自拍一区| jlzzjlzz亚洲日本少妇| 欧美成人bangbros| 一个色综合av| 成+人+亚洲+综合天堂| 精品国产髙清在线看国产毛片| 中文字幕一区二区三区精华液| 久久精品国产久精国产| 欧美系列一区二区| 亚洲三级免费电影| 国产美女视频91| 欧美电影免费观看高清完整版 | 成人免费在线播放视频| 狠狠狠色丁香婷婷综合激情| 欧美日韩在线一区二区| 日韩理论片中文av| 国产98色在线|日韩| 精品国产区一区| 日本中文字幕一区| 欧美性大战久久久久久久蜜臀| 国产精品视频免费| 国产成人免费视频精品含羞草妖精 | 欧美午夜电影在线播放| 欧美国产日韩一二三区| 狠狠色狠狠色综合日日91app| 在线观看亚洲成人| 亚洲卡通动漫在线| 91视频www| 亚洲色图19p| 91污片在线观看| 亚洲视频一区在线观看| 成人av网址在线观看| 国产精品拍天天在线| 福利一区二区在线观看| 国产精品网站导航| 97精品久久久午夜一区二区三区| 国产精品丝袜一区| 99精品视频中文字幕| 一区二区三区欧美日韩|