⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bcsp_mux.c

📁 bluetooth 驱动
💻 C
字号:
/* * bcsp_mux.c -- Implementation of the MUX 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_mux.c,v 1.10 2001/09/18 13:04:27 pkj Exp $ * *//****************** INCLUDE FILES SECTION ***********************************/#define __NO_VERSION__ /* don't define kernel_version in module.h */#ifdef __KERNEL__#include <linux/malloc.h>#include <linux/bluetooth/bcsp.h>#include <linux/bluetooth/bcsp_debug.h>#else#include "include/bcsp.h"#include "include/bcsp_debug.h"#endif/****************** CONSTANT AND MACRO SECTION ******************************/#if MUX_DEBUG#define D(fmt...) printk("MUX:       " fmt)#else#define D(fmt...)#endif/****************** TYPE DEFINITION SECTION *********************************//****************** LOCAL FUNCTION DECLARATION SECTION **********************//****************** GLOBAL VARIABLE DECLARATION SECTION *********************//****************** LOCAL VARIABLE DECLARATION SECTION **********************//****************** FUNCTION DEFINITION SECTION *****************************/s32bcsp_mux_receive(struct bcsp *bcsp){	/* If we received an ack packet, we discard the packet, sice the ack	   has already been handled by signal_rxack */	if (bcsp->identifier == 0) {		D(__FUNCTION__ ": Received ack, returning\n");		bcsp_signal_rxack(BCSP_GET_ACK(bcsp));		return 0;	}		if (BCSP_GET_PROTOCOL_TYPE(bcsp) == BCSP_RELIABLE) {		D(__FUNCTION__ ": Sending to sequencing layer\n");		return bcsp_sequence_receive(bcsp);	} else if (BCSP_GET_PROTOCOL_TYPE(bcsp) == BCSP_UNRELIABLE) {		D(__FUNCTION__ ": Sending to datagram layer\n");		return bcsp_datagram_receive(bcsp);	} else {		/* This shouldn't be possible */		BCSP_SYS(__FUNCTION__ ": Packet is neither reliable nor unreliable\n");	}	return 0;}s32bcsp_mux_send(struct bcsp *bcsp){	D(__FUNCTION__ "\n");	return bcsp_integrity_send(bcsp);}s32 bcsp_send_txack(u8 txack){	struct bcsp bcsp;	D(__FUNCTION__ ": txack: 0x%x\n", txack);	bcsp_init_packet(&bcsp);		BCSP_SET_ACK(&bcsp, txack);	BCSP_SET_SEQ(&bcsp, 0);	bcsp.identifier = 0;  /* According to AN004.pdf page 20 */	bcsp.payload_length = 0;	return bcsp_integrity_send(&bcsp);}/****************** END OF FILE mux.c ***************************************/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -