/****************************************************************************** * * 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 definitions internal to the PORT unit * *****************************************************************************//* ... */#ifndefPORT_INT_H#definePORT_INT_H#include"common/bt_target.h"#include"stack/rfcdefs.h"#include"stack/port_api.h"#include"osi/fixed_queue.h"#include"common/bt_defs.h"5 includes/* Local events passed when application event is sent from the api to PORT *//* ???*/#definePORT_EVENT_OPEN(1|BT_EVT_TO_BTU_SP_EVT)#definePORT_EVENT_CONTROL(2|BT_EVT_TO_BTU_SP_EVT)#definePORT_EVENT_SET_STATE(3|BT_EVT_TO_BTU_SP_EVT)#definePORT_EVENT_SET_CALLBACK(5|BT_EVT_TO_BTU_SP_EVT)#definePORT_EVENT_WRITE(6|BT_EVT_TO_BTU_SP_EVT)#definePORT_EVENT_PURGE(7|BT_EVT_TO_BTU_SP_EVT)#definePORT_EVENT_SEND_ERROR(8|BT_EVT_TO_BTU_SP_EVT)#definePORT_EVENT_FLOW_CONTROL(9|BT_EVT_TO_BTU_SP_EVT)/*** Flow control configuration values for the mux*//* ... */#definePORT_FC_UNDEFINED0/* mux flow control mechanism not defined yet */#definePORT_FC_TS7101/* use TS 07.10 flow control */#definePORT_FC_CREDIT2/* use RFCOMM credit based flow control */11 defines/*** Define Port Data Transfere control block*//* ... */typedefstruct{fixed_queue_t*queue;/* Queue of buffers waiting to be sent */BOOLEANpeer_fc;/* TRUE if flow control is set based on peer's request */BOOLEANuser_fc;/* TRUE if flow control is set based on user's request */UINT32queue_size;/* Number of data bytes in the queue */tPORT_CALLBACK*p_callback;/* Address of the callback function */}{ ... }tPORT_DATA;/*** Port control structure used to pass modem info*//* ... */typedefstruct{#defineMODEM_SIGNAL_DTRDSR0x01#defineMODEM_SIGNAL_RTSCTS0x02#defineMODEM_SIGNAL_RI0x04#defineMODEM_SIGNAL_DCD0x08UINT8modem_signal;/* [DTR/DSR | RTS/CTS | RI | DCD ] */UINT8break_signal;/* 0-3 s in steps of 200 ms */UINT8discard_buffers;/* 0 - do not discard, 1 - discard */#defineRFCOMM_CTRL_BREAK_ASAP0#defineRFCOMM_CTRL_BREAK_IN_SEQ1UINT8break_signal_seq;/* as soon as possible | in sequence (default) */BOOLEANfc;/* TRUE when the device is unable to accept frames */}{ ... }tPORT_CTRL;/*** RFCOMM multiplexer Control Block*//* ... */typedefstruct{TIMER_LIST_ENTtle;/* Timer list entry */fixed_queue_t*cmd_q;/* Queue for command messages on this mux */UINT8port_inx[RFCOMM_MAX_DLCI+1];/* Array for quick access to *//* tPORT based on dlci */BD_ADDRbd_addr;/* BD ADDR of the peer if initiator */UINT16lcid;/* Local cid used for this channel */UINT16peer_l2cap_mtu;/* Max frame that can be sent to peer L2CAP */UINT8state;/* Current multiplexer channel state */UINT8is_initiator;/* TRUE if this side sends SABME (dlci=0) */BOOLEANlocal_cfg_sent;BOOLEANpeer_cfg_rcvd;BOOLEANrestart_required;/* TRUE if has to restart channel after disc */BOOLEANpeer_ready;/* True if other side can accept frames */UINT8flow;/* flow control mechanism for this mux */BOOLEANl2cap_congested;/* TRUE if L2CAP is congested */BOOLEANis_disc_initiator;/* TRUE if initiated disc of port */UINT16pending_lcid;/* store LCID for incoming connection while connecting */UINT8pending_id;/* store l2cap ID for incoming connection while connecting */}{ ... }tRFC_MCB;/*** RFCOMM Port Connection Control Block*//* ... */structt_rfc_port{#defineRFC_PORT_STATE_IDLE0#defineRFC_PORT_STATE_WAIT_START1#defineRFC_PORT_STATE_OPENING2#defineRFC_PORT_STATE_OPENED3#defineRFC_PORT_STATE_CLOSING45 definesUINT8state;/* Current state of the connection */#defineRFC_RSP_PN0x01#defineRFC_RSP_RPN_REPLY0x02#defineRFC_RSP_RPN0x04#defineRFC_RSP_MSC0x08#defineRFC_RSP_RLS0x105 definesUINT8expected_rsp;tRFC_MCB*p_mcb;TIMER_LIST_ENTtle;/* Timer list entry */}{ ... };typedefstructt_rfc_porttRFC_PORT;/*** Define control block containing information about PORT connection*//* ... */structt_port_info{UINT8inx;/* Index of this control block in the port_info array */BOOLEANin_use;/* True when structure is allocated */#definePORT_STATE_CLOSED0#definePORT_STATE_OPENING1#definePORT_STATE_OPENED2#definePORT_STATE_CLOSING3UINT8state;/* State of the application */UINT8scn;/* Service channel number */UINT16uuid;/* Service UUID */BD_ADDRbd_addr;/* BD ADDR of the device for the multiplexer channel */BOOLEANis_server;/* TRUE if the server application */UINT8dlci;/* DLCI of the connection */UINT8error;/* Last error detected */UINT8line_status;/* Line status as reported by peer */UINT8default_signal_state;/* Initial signal state depending on uuid */UINT16mtu;/* Max MTU that port can receive */UINT16peer_mtu;/* Max MTU that port can send */tPORT_DATAtx;/* Control block for data from app to peer */tPORT_DATArx;/* Control block for data from peer to app */tPORT_STATEuser_port_pars;/* Port parameters for user connection */tPORT_STATEpeer_port_pars;/* Port parameters for user connection */tPORT_CTRLlocal_ctrl;tPORT_CTRLpeer_ctrl;#definePORT_CTRL_REQ_SENT0x01#definePORT_CTRL_REQ_CONFIRMED0x02#definePORT_CTRL_IND_RECEIVED0x04#definePORT_CTRL_IND_RESPONDED0x08UINT8port_ctrl;/* Modem Status Command */BOOLEANrx_flag_ev_pending;/* RXFLAG Character is received */tRFC_PORTrfc;/* RFCOMM port control block */UINT32ev_mask;/* Event mask for the callback */tPORT_CALLBACK*p_callback;/* Pointer to users callback function */tPORT_MGMT_CALLBACK*p_mgmt_callback;/* Callback function to receive connection up/down */tPORT_DATA_CALLBACK*p_data_callback;/* Callback function to receive data indications */tPORT_DATA_CO_CALLBACK*p_data_co_callback;/* Callback function with callouts and flowctrl */UINT16credit_tx;/* Flow control credits for tx path */UINT16credit_rx;/* Flow control credits for rx path, this is *//* number of buffers peer is allowed to sent */UINT16credit_rx_max;/* Max number of credits we will allow this guy to sent */UINT16credit_rx_low;/* Number of credits when we send credit update */UINT16rx_buf_critical;/* port receive queue critical watermark level */BOOLEANkeep_port_handle;/* TRUE if port is not deallocated when closing *//* it is set to TRUE for server when allocating port */UINT16keep_mtu;/* Max MTU that port can receive by server */}{ ... };typedefstructt_port_infotPORT;/* Define the PORT/RFCOMM control structure*//* ... */typedefstruct{tPORTport[MAX_RFC_PORTS];/* Port info pool */tRFC_MCBrfc_mcb[MAX_BD_CONNECTIONS];/* RFCOMM bd_connections pool */BOOLEANenable_l2cap_ertm;/* enable/disable l2cap ertm */}{ ... }tPORT_CB;#ifdef__cplusplusextern"C"{#endif/*** Functions provided by the port_utils.c*//* ... */externtPORT*port_allocate_port(UINT8dlci,BD_ADDRbd_addr);externvoidport_set_defaults(tPORT*p_port);externvoidport_select_mtu(tPORT*p_port);externvoidport_release_port(tPORT*p_port);externtPORT*port_find_mcb_dlci_port(tRFC_MCB*p_mcb,UINT8dlci);externtRFC_MCB*port_find_mcb(BD_ADDRbd_addr);externtPORT*port_find_dlci_port(UINT8dlci);externtPORT*port_find_port(UINT8dlci,BD_ADDRbd_addr);externUINT32port_get_signal_changes(tPORT*p_port,UINT8old_signals,UINT8signal);externUINT32port_flow_control_user(tPORT*p_port);externvoidport_flow_control_peer(tPORT*p_port,BOOLEANenable,UINT16count);/*** Functions provided by the port_rfc.c*//* ... */externintport_open_continue(tPORT*p_port);externvoidport_start_port_open(tPORT*p_port);externvoidport_start_par_neg(tPORT*p_port);externvoidport_start_control(tPORT*p_port);externvoidport_start_close(tPORT*p_port);externvoidport_rfc_closed(tPORT*p_port,UINT8res);#ifdef__cplusplus}{...}#endif/* ... */#endif
Details
Show: from
Types: Columns:
All items filtered out
All items filtered out
This file uses the notable symbols shown below. Click anywhere in the file to view more details.