diff options
Diffstat (limited to 'stack/rfcomm/rfc_utils.c')
-rw-r--r-- | stack/rfcomm/rfc_utils.c | 62 |
1 files changed, 38 insertions, 24 deletions
diff --git a/stack/rfcomm/rfc_utils.c b/stack/rfcomm/rfc_utils.c index 9395891..49405ac 100644 --- a/stack/rfcomm/rfc_utils.c +++ b/stack/rfcomm/rfc_utils.c @@ -1,13 +1,27 @@ -/*****************************************************************************/ -/* */ -/* Name: rfc_utils.c */ -/* */ -/* Description: This file contains collection of utility functions used */ -/* the RFCOMM unit */ -/* */ -/* Copyright (c) 1999-2008, Broadcom Corp., All Rights Reserved. */ -/* WIDCOMM Bluetooth Core. Proprietary and confidential. */ -/*****************************************************************************/ +/****************************************************************************** + * + * Copyright (C) 1999-2012 Broadcom Corporation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at: + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + ******************************************************************************/ + +/***************************************************************************** + * + * This file contains collection of utility functions used the RFCOMM unit + * + *****************************************************************************/ + #include "bt_target.h" #include "gki.h" @@ -29,7 +43,7 @@ ** Description Reversed CRC Table , 8-bit, poly=0x07 ** (GSM 07.10 TS 101 369 V6.3.0) *******************************************************************************/ -static const UINT8 rfc_crctable[] = +static const UINT8 rfc_crctable[] = { 0x00, 0x91, 0xE3, 0x72, 0x07, 0x96, 0xE4, 0x75, 0x0E, 0x9F, 0xED, 0x7C, 0x09, 0x98, 0xEA, 0x7B, 0x1C, 0x8D, 0xFF, 0x6E, 0x1B, 0x8A, 0xF8, 0x69, 0x12, 0x83, 0xF1, 0x60, 0x15, 0x84, 0xF6, 0x67, @@ -57,7 +71,7 @@ static const UINT8 rfc_crctable[] = ** ** Function rfc_calc_fcs ** -** Description This function calculate FCS for the RFCOMM frame +** Description This function calculate FCS for the RFCOMM frame ** (GSM 07.10 TS 101 369 V6.3.0) ** ** Input len - number of bytes in the message @@ -82,7 +96,7 @@ UINT8 rfc_calc_fcs (UINT16 len, UINT8 *p) ** ** Function rfc_check_fcs ** -** Description This function checks FCS for the RFCOMM frame +** Description This function checks FCS for the RFCOMM frame ** (GSM 07.10 TS 101 369 V6.3.0) ** ** Input len - number of bytes in the message @@ -192,7 +206,7 @@ void rfc_release_multiplexer_channel (tRFC_MCB *p_mcb) void rfc_timer_start (tRFC_MCB *p_mcb, UINT16 timeout) { TIMER_LIST_ENT *p_tle = &p_mcb->tle; - + RFCOMM_TRACE_EVENT1 ("rfc_timer_start - timeout:%d", timeout); p_tle->param = (UINT32)p_mcb; @@ -205,7 +219,7 @@ void rfc_timer_start (tRFC_MCB *p_mcb, UINT16 timeout) ** ** Function rfc_timer_stop ** -** Description Stop RFC Timer +** Description Stop RFC Timer ** *******************************************************************************/ void rfc_timer_stop (tRFC_MCB *p_mcb) @@ -239,7 +253,7 @@ void rfc_port_timer_start (tPORT *p_port, UINT16 timeout) ** ** Function rfc_port_timer_stop ** -** Description Stop RFC Timer +** Description Stop RFC Timer ** *******************************************************************************/ void rfc_port_timer_stop (tPORT *p_port) @@ -315,8 +329,8 @@ void rfcomm_process_timeout (TIMER_LIST_ENT *p_tle) ** ** Function rfc_sec_check_complete ** -** Description The function called when Security Manager finishes -** verification of the service side connection +** Description The function called when Security Manager finishes +** verification of the service side connection ** ** Returns void ** @@ -326,7 +340,7 @@ void rfc_sec_check_complete (BD_ADDR bd_addr, void *p_ref_data, UINT8 res) tPORT *p_port = (tPORT *)p_ref_data; /* Verify that PORT is still waiting for Security to complete */ - if (!p_port->in_use + if (!p_port->in_use || ((p_port->rfc.state != RFC_STATE_ORIG_WAIT_SEC_CHECK) && (p_port->rfc.state != RFC_STATE_TERM_WAIT_SEC_CHECK))) return; @@ -340,18 +354,18 @@ void rfc_sec_check_complete (BD_ADDR bd_addr, void *p_ref_data, UINT8 res) ** Function rfc_port_closed ** ** Description The function is called when port is released based on the -** event received from the lower layer, typically L2CAP +** event received from the lower layer, typically L2CAP ** connection down, DISC, or DM frame. ** ** Returns void ** *******************************************************************************/ void rfc_port_closed (tPORT *p_port) -{ +{ tRFC_MCB *p_mcb = p_port->rfc.p_mcb; RFCOMM_TRACE_DEBUG0 ("rfc_port_closed"); - + rfc_port_timer_stop (p_port); p_port->rfc.state = RFC_STATE_CLOSED; @@ -385,7 +399,7 @@ void rfc_inc_credit (tPORT *p_port, UINT8 credit) if (p_port->rfc.p_mcb->flow == PORT_FC_CREDIT) { p_port->credit_tx += credit; - + RFCOMM_TRACE_EVENT1 ("rfc_inc_credit:%d", p_port->credit_tx); if (p_port->tx.peer_fc == TRUE) @@ -410,7 +424,7 @@ void rfc_dec_credit (tPORT *p_port) { if (p_port->credit_tx > 0) p_port->credit_tx--; - + if (p_port->credit_tx == 0) p_port->tx.peer_fc = TRUE; } |