component/bt: add bluedroid 1st version
1. add bluedroid 1st version 2. alarm adapter 3. task semaphore lock 4. other bugs resolved
This commit is contained in:
+252
@@ -0,0 +1,252 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef PORT_INT_H
|
||||
#define PORT_INT_H
|
||||
|
||||
#include "bt_target.h"
|
||||
#include "gki.h"
|
||||
#include "rfcdefs.h"
|
||||
#include "port_api.h"
|
||||
|
||||
/* Local events passed when application event is sent from the api to PORT */
|
||||
/* ???*/
|
||||
#define PORT_EVENT_OPEN (1 | BT_EVT_TO_BTU_SP_EVT)
|
||||
#define PORT_EVENT_CONTROL (2 | BT_EVT_TO_BTU_SP_EVT)
|
||||
#define PORT_EVENT_SET_STATE (3 | BT_EVT_TO_BTU_SP_EVT)
|
||||
#define PORT_EVENT_SET_CALLBACK (5 | BT_EVT_TO_BTU_SP_EVT)
|
||||
#define PORT_EVENT_WRITE (6 | BT_EVT_TO_BTU_SP_EVT)
|
||||
#define PORT_EVENT_PURGE (7 | BT_EVT_TO_BTU_SP_EVT)
|
||||
#define PORT_EVENT_SEND_ERROR (8 | BT_EVT_TO_BTU_SP_EVT)
|
||||
#define PORT_EVENT_FLOW_CONTROL (9 | BT_EVT_TO_BTU_SP_EVT)
|
||||
|
||||
/*
|
||||
** Flow control configuration values for the mux
|
||||
*/
|
||||
#define PORT_FC_UNDEFINED 0 /* mux flow control mechanism not defined yet */
|
||||
#define PORT_FC_TS710 1 /* use TS 07.10 flow control */
|
||||
#define PORT_FC_CREDIT 2 /* use RFCOMM credit based flow control */
|
||||
|
||||
/*
|
||||
** Define Port Data Transfere control block
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
BUFFER_Q queue; /* Queue of buffers waiting to be sent */
|
||||
BOOLEAN peer_fc; /* TRUE if flow control is set based on peer's request */
|
||||
BOOLEAN user_fc; /* TRUE if flow control is set based on user's request */
|
||||
UINT32 queue_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
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
#define MODEM_SIGNAL_DTRDSR 0x01
|
||||
#define MODEM_SIGNAL_RTSCTS 0x02
|
||||
#define MODEM_SIGNAL_RI 0x04
|
||||
#define MODEM_SIGNAL_DCD 0x08
|
||||
|
||||
UINT8 modem_signal; /* [DTR/DSR | RTS/CTS | RI | DCD ] */
|
||||
|
||||
UINT8 break_signal; /* 0-3 s in steps of 200 ms */
|
||||
|
||||
UINT8 discard_buffers; /* 0 - do not discard, 1 - discard */
|
||||
|
||||
#define RFCOMM_CTRL_BREAK_ASAP 0
|
||||
#define RFCOMM_CTRL_BREAK_IN_SEQ 1
|
||||
|
||||
UINT8 break_signal_seq; /* as soon as possible | in sequence (default) */
|
||||
|
||||
BOOLEAN fc; /* TRUE when the device is unable to accept frames */
|
||||
} tPORT_CTRL;
|
||||
|
||||
|
||||
/*
|
||||
** RFCOMM multiplexer Control Block
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
TIMER_LIST_ENT tle; /* Timer list entry */
|
||||
BUFFER_Q cmd_q; /* Queue for command messages on this mux */
|
||||
UINT8 port_inx[RFCOMM_MAX_DLCI + 1]; /* Array for quick access to */
|
||||
/* tPORT based on dlci */
|
||||
BD_ADDR bd_addr; /* BD ADDR of the peer if initiator */
|
||||
UINT16 lcid; /* Local cid used for this channel */
|
||||
UINT16 peer_l2cap_mtu; /* Max frame that can be sent to peer L2CAP */
|
||||
UINT8 state; /* Current multiplexer channel state */
|
||||
UINT8 is_initiator; /* TRUE if this side sends SABME (dlci=0) */
|
||||
BOOLEAN local_cfg_sent;
|
||||
BOOLEAN peer_cfg_rcvd;
|
||||
BOOLEAN restart_required; /* TRUE if has to restart channel after disc */
|
||||
BOOLEAN peer_ready; /* True if other side can accept frames */
|
||||
UINT8 flow; /* flow control mechanism for this mux */
|
||||
BOOLEAN l2cap_congested; /* TRUE if L2CAP is congested */
|
||||
BOOLEAN is_disc_initiator; /* TRUE if initiated disc of port */
|
||||
UINT16 pending_lcid; /* store LCID for incoming connection while connecting */
|
||||
UINT8 pending_id; /* store l2cap ID for incoming connection while connecting */
|
||||
} tRFC_MCB;
|
||||
|
||||
|
||||
/*
|
||||
** RFCOMM Port Connection Control Block
|
||||
*/
|
||||
struct t_rfc_port
|
||||
{
|
||||
#define RFC_PORT_STATE_IDLE 0
|
||||
#define RFC_PORT_STATE_WAIT_START 1
|
||||
#define RFC_PORT_STATE_OPENING 2
|
||||
#define RFC_PORT_STATE_OPENED 3
|
||||
#define RFC_PORT_STATE_CLOSING 4
|
||||
|
||||
UINT8 state; /* Current state of the connection */
|
||||
|
||||
#define RFC_RSP_PN 0x01
|
||||
#define RFC_RSP_RPN_REPLY 0x02
|
||||
#define RFC_RSP_RPN 0x04
|
||||
#define RFC_RSP_MSC 0x08
|
||||
#define RFC_RSP_RLS 0x10
|
||||
|
||||
UINT8 expected_rsp;
|
||||
|
||||
tRFC_MCB *p_mcb;
|
||||
|
||||
TIMER_LIST_ENT tle; /* Timer list entry */
|
||||
};
|
||||
typedef struct t_rfc_port tRFC_PORT;
|
||||
|
||||
|
||||
/*
|
||||
** Define control block containing information about PORT connection
|
||||
*/
|
||||
struct t_port_info
|
||||
{
|
||||
UINT8 inx; /* Index of this control block in the port_info array */
|
||||
BOOLEAN in_use; /* True when structure is allocated */
|
||||
|
||||
#define PORT_STATE_CLOSED 0
|
||||
#define PORT_STATE_OPENING 1
|
||||
#define PORT_STATE_OPENED 2
|
||||
#define PORT_STATE_CLOSING 3
|
||||
|
||||
UINT8 state; /* State of the application */
|
||||
|
||||
UINT8 scn; /* Service channel number */
|
||||
UINT16 uuid; /* Service UUID */
|
||||
|
||||
BD_ADDR bd_addr; /* BD ADDR of the device for the multiplexer channel */
|
||||
BOOLEAN is_server; /* TRUE if the server application */
|
||||
UINT8 dlci; /* DLCI of the connection */
|
||||
|
||||
UINT8 error; /* Last error detected */
|
||||
|
||||
UINT8 line_status; /* Line status as reported by peer */
|
||||
|
||||
UINT8 default_signal_state; /* Initial signal state depending on uuid */
|
||||
|
||||
UINT16 mtu; /* Max MTU that port can receive */
|
||||
UINT16 peer_mtu; /* Max MTU that port can send */
|
||||
|
||||
tPORT_DATA tx; /* Control block for data from app to peer */
|
||||
tPORT_DATA rx; /* Control block for data from peer to app */
|
||||
|
||||
tPORT_STATE user_port_pars; /* Port parameters for user connection */
|
||||
tPORT_STATE peer_port_pars; /* Port parameters for user connection */
|
||||
|
||||
tPORT_CTRL local_ctrl;
|
||||
tPORT_CTRL peer_ctrl;
|
||||
|
||||
#define PORT_CTRL_REQ_SENT 0x01
|
||||
#define PORT_CTRL_REQ_CONFIRMED 0x02
|
||||
#define PORT_CTRL_IND_RECEIVED 0x04
|
||||
#define PORT_CTRL_IND_RESPONDED 0x08
|
||||
|
||||
UINT8 port_ctrl; /* Modem Status Command */
|
||||
|
||||
BOOLEAN rx_flag_ev_pending; /* RXFLAG Character is received */
|
||||
|
||||
tRFC_PORT rfc; /* RFCOMM port control block */
|
||||
|
||||
UINT32 ev_mask; /* Event mask for the callback */
|
||||
tPORT_CALLBACK *p_callback; /* Pointer to users callback function */
|
||||
tPORT_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 */
|
||||
UINT16 credit_tx; /* Flow control credits for tx path */
|
||||
UINT16 credit_rx; /* Flow control credits for rx path, this is */
|
||||
/* number of buffers peer is allowed to sent */
|
||||
UINT16 credit_rx_max; /* Max number of credits we will allow this guy to sent */
|
||||
UINT16 credit_rx_low; /* Number of credits when we send credit update */
|
||||
UINT16 rx_buf_critical; /* port receive queue critical watermark level */
|
||||
BOOLEAN keep_port_handle; /* TRUE if port is not deallocated when closing */
|
||||
/* it is set to TRUE for server when allocating port */
|
||||
UINT16 keep_mtu; /* Max MTU that port can receive by server */
|
||||
};
|
||||
typedef struct t_port_info tPORT;
|
||||
|
||||
|
||||
/* Define the PORT/RFCOMM control structure
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
tPORT port[MAX_RFC_PORTS]; /* Port info pool */
|
||||
tRFC_MCB rfc_mcb[MAX_BD_CONNECTIONS]; /* RFCOMM bd_connections pool */
|
||||
} tPORT_CB;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Functions provided by the port_utils.c
|
||||
*/
|
||||
extern tPORT *port_allocate_port (UINT8 dlci, BD_ADDR bd_addr);
|
||||
extern void port_set_defaults (tPORT *p_port);
|
||||
extern void port_select_mtu (tPORT *p_port);
|
||||
extern void port_release_port (tPORT *p_port);
|
||||
extern tPORT *port_find_mcb_dlci_port (tRFC_MCB *p_mcb, UINT8 dlci);
|
||||
extern tRFC_MCB *port_find_mcb (BD_ADDR bd_addr);
|
||||
extern tPORT *port_find_dlci_port (UINT8 dlci);
|
||||
extern tPORT *port_find_port (UINT8 dlci, BD_ADDR bd_addr);
|
||||
extern UINT32 port_get_signal_changes (tPORT *p_port, UINT8 old_signals, UINT8 signal);
|
||||
extern UINT32 port_flow_control_user (tPORT *p_port);
|
||||
extern void port_flow_control_peer(tPORT *p_port, BOOLEAN enable, UINT16 count);
|
||||
|
||||
/*
|
||||
** Functions provided by the port_rfc.c
|
||||
*/
|
||||
extern int port_open_continue (tPORT *p_port);
|
||||
extern void port_start_port_open (tPORT *p_port);
|
||||
extern void port_start_par_neg (tPORT *p_port);
|
||||
extern void port_start_control (tPORT *p_port);
|
||||
extern void port_start_close (tPORT *p_port);
|
||||
extern void port_rfc_closed (tPORT *p_port, UINT8 res);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
+386
@@ -0,0 +1,386 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* 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 RFC unit
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
#ifndef RFC_INT_H
|
||||
#define RFC_INT_H
|
||||
|
||||
#include "l2c_api.h"
|
||||
#include "port_int.h"
|
||||
|
||||
/*
|
||||
** Define RFCOMM result codes
|
||||
*/
|
||||
#define RFCOMM_SUCCESS 0
|
||||
#define RFCOMM_ERROR 1
|
||||
#define RFCOMM_LOW_RESOURCES 2
|
||||
#define RFCOMM_TRY_LATER 3
|
||||
|
||||
#define RFCOMM_USER_ERR 111
|
||||
#define RFCOMM_SECURITY_ERR 112
|
||||
|
||||
/*
|
||||
** Define max and min RFCOMM MTU (N1)
|
||||
*/
|
||||
#define RFCOMM_MIN_MTU 23
|
||||
#define RFCOMM_MAX_MTU 32767
|
||||
|
||||
extern void RFCOMM_StartReq (tRFC_MCB *p_mcb);
|
||||
extern void RFCOMM_StartRsp (tRFC_MCB *p_mcb, UINT16 result);
|
||||
|
||||
extern void RFCOMM_DlcEstablishReq (tRFC_MCB *p_mcb, UINT8 dlci, UINT16 mtu);
|
||||
extern void RFCOMM_DlcEstablishRsp (tRFC_MCB *p_mcb, UINT8 dlci, UINT16 mtu, UINT16 result);
|
||||
|
||||
extern void RFCOMM_DataReq (tRFC_MCB *p_mcb, UINT8 dlci, BT_HDR *p_buf);
|
||||
|
||||
extern void RFCOMM_DlcReleaseReq (tRFC_MCB *p_mcb, UINT8 dlci);
|
||||
|
||||
extern void RFCOMM_ParNegReq (tRFC_MCB *p_mcb, UINT8 dlci, UINT16 mtu);
|
||||
extern void RFCOMM_ParNegRsp (tRFC_MCB *p_mcb, UINT8 dlci, UINT16 mtu, UINT8 cl, UINT8 k);
|
||||
|
||||
extern void RFCOMM_TestReq (UINT8 *p_data, UINT16 len);
|
||||
|
||||
#define RFCOMM_FLOW_STATE_DISABLE 0
|
||||
#define RFCOMM_FLOW_STATE_ENABLE 1
|
||||
|
||||
extern void RFCOMM_FlowReq (tRFC_MCB *p_mcb, UINT8 dlci, UINT8 state);
|
||||
|
||||
extern void RFCOMM_PortNegReq (tRFC_MCB *p_mcb, UINT8 dlci, tPORT_STATE *p_pars);
|
||||
extern void RFCOMM_PortNegRsp (tRFC_MCB *p_mcb, UINT8 dlci, tPORT_STATE *p_pars, UINT16 param_mask);
|
||||
|
||||
extern void RFCOMM_ControlReq (tRFC_MCB *p_mcb, UINT8 dlci, tPORT_CTRL *p_pars);
|
||||
extern void RFCOMM_ControlRsp (tRFC_MCB *p_mcb, UINT8 dlci, tPORT_CTRL *p_pars);
|
||||
|
||||
extern void RFCOMM_LineStatusReq (tRFC_MCB *p_mcb, UINT8 dlci, UINT8 line_status);
|
||||
/*
|
||||
** Define logical struct used for sending and decoding MX frames
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
UINT8 dlci;
|
||||
UINT8 type;
|
||||
UINT8 cr;
|
||||
UINT8 ea;
|
||||
UINT8 pf;
|
||||
UINT8 credit;
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
UINT8 dlci;
|
||||
UINT8 frame_type;
|
||||
UINT8 conv_layer;
|
||||
UINT8 priority;
|
||||
UINT8 t1;
|
||||
UINT16 mtu;
|
||||
UINT8 n2;
|
||||
UINT8 k;
|
||||
} pn;
|
||||
struct
|
||||
{
|
||||
UINT8 *p_data;
|
||||
UINT16 data_len;
|
||||
} test;
|
||||
struct
|
||||
{
|
||||
UINT8 dlci;
|
||||
UINT8 signals;
|
||||
UINT8 break_present;
|
||||
UINT8 break_duration;
|
||||
} msc;
|
||||
struct
|
||||
{
|
||||
UINT8 ea;
|
||||
UINT8 cr;
|
||||
UINT8 type;
|
||||
} nsc;
|
||||
struct
|
||||
{
|
||||
UINT8 dlci;
|
||||
UINT8 is_request;
|
||||
UINT8 baud_rate;
|
||||
UINT8 byte_size;
|
||||
UINT8 stop_bits;
|
||||
UINT8 parity;
|
||||
UINT8 parity_type;
|
||||
UINT8 fc_type;
|
||||
UINT8 xon_char;
|
||||
UINT8 xoff_char;
|
||||
UINT16 param_mask;
|
||||
} rpn;
|
||||
struct
|
||||
{
|
||||
UINT8 dlci;
|
||||
UINT8 line_status;
|
||||
} rls;
|
||||
} u;
|
||||
} MX_FRAME;
|
||||
|
||||
#define LINE_STATUS_NO_ERROR 0x00
|
||||
#define LINE_STATUS_OVERRUN 0x02 /* Receive Overrun Error */
|
||||
#define LINE_STATUS_RXPARITY 0x04 /* Receive Parity Error */
|
||||
#define LINE_STATUS_FRAME 0x08 /* Receive Framing error */
|
||||
#define LINE_STATUS_FAILED 0x10 /* Connection Failed */
|
||||
|
||||
/*
|
||||
** Define states and events for the RFC multiplexer state machine
|
||||
*/
|
||||
#define RFC_MX_STATE_IDLE 0
|
||||
#define RFC_MX_STATE_WAIT_CONN_CNF 1
|
||||
#define RFC_MX_STATE_CONFIGURE 2
|
||||
#define RFC_MX_STATE_SABME_WAIT_UA 3
|
||||
#define RFC_MX_STATE_WAIT_SABME 4
|
||||
#define RFC_MX_STATE_CONNECTED 5
|
||||
#define RFC_MX_STATE_DISC_WAIT_UA 6
|
||||
|
||||
/*
|
||||
** Define port states
|
||||
*/
|
||||
#define RFC_STATE_CLOSED 0
|
||||
#define RFC_STATE_SABME_WAIT_UA 1
|
||||
#define RFC_STATE_ORIG_WAIT_SEC_CHECK 2
|
||||
#define RFC_STATE_TERM_WAIT_SEC_CHECK 3
|
||||
#define RFC_STATE_OPENED 4
|
||||
#define RFC_STATE_DISC_WAIT_UA 5
|
||||
|
||||
/*
|
||||
** Events that can be received by multiplexer as well as port state machines
|
||||
*/
|
||||
#define RFC_EVENT_SABME 0
|
||||
#define RFC_EVENT_UA 1
|
||||
#define RFC_EVENT_DM 2
|
||||
#define RFC_EVENT_DISC 3
|
||||
#define RFC_EVENT_UIH 4
|
||||
#define RFC_EVENT_TIMEOUT 5
|
||||
#define RFC_EVENT_BAD_FRAME 50
|
||||
/*
|
||||
** Multiplexer events
|
||||
*/
|
||||
#define RFC_MX_EVENT_START_REQ 6
|
||||
#define RFC_MX_EVENT_START_RSP 7
|
||||
#define RFC_MX_EVENT_CLOSE_REQ 8
|
||||
#define RFC_MX_EVENT_CONN_CNF 9
|
||||
#define RFC_MX_EVENT_CONN_IND 10
|
||||
#define RFC_MX_EVENT_CONF_CNF 11
|
||||
#define RFC_MX_EVENT_CONF_IND 12
|
||||
#define RFC_MX_EVENT_QOS_VIOLATION_IND 13
|
||||
#define RFC_MX_EVENT_DISC_IND 14
|
||||
#define RFC_MX_EVENT_TEST_CMD 15
|
||||
#define RFC_MX_EVENT_TEST_RSP 16
|
||||
#define RFC_MX_EVENT_FCON_CMD 17
|
||||
#define RFC_MX_EVENT_FCOFF_CMD 18
|
||||
#define RFC_MX_EVENT_NSC 19
|
||||
#define RFC_MX_EVENT_NSC_RSP 20
|
||||
|
||||
/*
|
||||
** Port events
|
||||
*/
|
||||
#define RFC_EVENT_OPEN 9
|
||||
#define RFC_EVENT_ESTABLISH_RSP 11
|
||||
#define RFC_EVENT_CLOSE 12
|
||||
#define RFC_EVENT_CLEAR 13
|
||||
#define RFC_EVENT_DATA 14
|
||||
#define RFC_EVENT_SEC_COMPLETE 15
|
||||
|
||||
// btla-specific ++
|
||||
#define RFC_T1_TIMEOUT 20 /* seconds to wait for reply with Poll bit */
|
||||
#define RFC_PORT_T1_TIMEOUT 60 /* seconds to wait for reply with Poll bit other than MX */
|
||||
#define RFC_T2_TIMEOUT 20 /* timeout to wait for Mx UIH */
|
||||
// btla-specific --
|
||||
#define RFC_DISC_TIMEOUT 3 /* If something goes wrong and we send DISC we should not wait for min */
|
||||
#define RFC_CLOSE_TIMEOUT 10
|
||||
#define RFCOMM_CONN_TIMEOUT 120 /* first connection to be established on Mx */
|
||||
|
||||
|
||||
/* Define RFComm control block
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
MX_FRAME rx_frame;
|
||||
tL2CAP_APPL_INFO reg_info; /* L2CAP Registration info */
|
||||
tRFC_MCB *p_rfc_lcid_mcb[MAX_L2CAP_CHANNELS]; /* MCB based on the L2CAP's lcid */
|
||||
BOOLEAN peer_rx_disabled; /* If TRUE peer sent FCOFF */
|
||||
UINT8 last_mux; /* Last mux allocated */
|
||||
UINT8 last_port; /* Last port allocated */
|
||||
} tRFCOMM_CB;
|
||||
|
||||
/* Main Control Block for the RFCOMM Layer (PORT and RFC) */
|
||||
typedef struct
|
||||
{
|
||||
tRFCOMM_CB rfc;
|
||||
tPORT_CB port;
|
||||
UINT8 trace_level;
|
||||
} tRFC_CB;
|
||||
|
||||
|
||||
#if RFC_DYNAMIC_MEMORY == FALSE
|
||||
extern tRFC_CB rfc_cb;
|
||||
#else
|
||||
extern tRFC_CB *rfc_cb_ptr;
|
||||
#define rfc_cb (*rfc_cb_ptr)
|
||||
#endif
|
||||
|
||||
/* Timer running on the multiplexor channel while no DLCI connection is opened */
|
||||
#define RFC_MCB_INIT_INACT_TIMER 60 /* in seconds */
|
||||
|
||||
/* Timer running on the multiplexor channel after last DLCI is released */
|
||||
#define RFC_MCB_RELEASE_INACT_TIMER 2 /* in seconds */
|
||||
|
||||
/*
|
||||
** Define RFCOMM frame processing errors
|
||||
*/
|
||||
#define RFCOMM_ERR_BAD_SABME 1
|
||||
#define RFCOMM_ERR_BAD_UA 2
|
||||
#define RFCOMM_ERR_BAD_DM 3
|
||||
#define RFCOMM_ERR_BAD_DISC 4
|
||||
#define RFCOMM_ERR_BAD_UIH 5
|
||||
|
||||
#ifdef RFCOMM_PRECALC_FCS
|
||||
|
||||
#define RFCOMM_SABME_FCS(p_data, cr, dlci) rfc_sabme_fcs[cr][dlci]
|
||||
#define RFCOMM_UA_FCS(p_data, cr, dlci) rfc_ua_fcs[cr][dlci]
|
||||
#define RFCOMM_DM_FCS(p_data, cr, dlci) rfc_dm_fcs[cr][dlci]
|
||||
#define RFCOMM_DISC_FCS(p_data, cr, dlci) rfc_disc_fcs[cr][dlci]
|
||||
#define RFCOMM_UIH_FCS(p_data, dlci) rfc_uih_fcs[dlci]
|
||||
|
||||
#else
|
||||
|
||||
extern UINT8 rfc_calc_fcs (UINT16 len, UINT8 *p);
|
||||
|
||||
#define RFCOMM_SABME_FCS(p_data, cr, dlci) rfc_calc_fcs(3, p_data)
|
||||
#define RFCOMM_UA_FCS(p_data, cr, dlci) rfc_calc_fcs(3, p_data)
|
||||
#define RFCOMM_DM_FCS(p_data, cr, dlci) rfc_calc_fcs(3, p_data)
|
||||
#define RFCOMM_DISC_FCS(p_data, cr, dlci) rfc_calc_fcs(3, p_data)
|
||||
#define RFCOMM_UIH_FCS(p_data, dlci) rfc_calc_fcs(2, p_data)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern void rfc_mx_sm_execute (tRFC_MCB *p_mcb, UINT16 event, void *p_data);
|
||||
|
||||
/*
|
||||
** Functions provided by the rfc_port_fsm.c
|
||||
*/
|
||||
extern void rfc_port_sm_execute (tPORT *p_port, UINT16 event, void *p_data);
|
||||
|
||||
|
||||
extern void rfc_process_pn (tRFC_MCB *p_rfc_mcb, BOOLEAN is_command, MX_FRAME *p_frame);
|
||||
extern void rfc_process_msc (tRFC_MCB *p_rfc_mcb, BOOLEAN is_command, MX_FRAME *p_frame);
|
||||
extern void rfc_process_rpn (tRFC_MCB *p_rfc_mcb, BOOLEAN is_command, BOOLEAN is_request, MX_FRAME *p_frame);
|
||||
extern void rfc_process_rls (tRFC_MCB *p_rfc_mcb, BOOLEAN is_command, MX_FRAME *p_frame);
|
||||
extern void rfc_process_nsc (tRFC_MCB *p_rfc_mcb, MX_FRAME *p_frame);
|
||||
extern void rfc_process_test_rsp (tRFC_MCB *p_rfc_mcb, BT_HDR *p_buf);
|
||||
extern void rfc_process_fcon (tRFC_MCB *p_rfc_mcb, BOOLEAN is_command);
|
||||
extern void rfc_process_fcoff (tRFC_MCB *p_rfc_mcb, BOOLEAN is_command);
|
||||
extern void rfc_process_l2cap_congestion (tRFC_MCB *p_mcb, BOOLEAN is_congested);
|
||||
|
||||
/*
|
||||
** Functions provided by the rfc_utils.c
|
||||
*/
|
||||
tRFC_MCB *rfc_alloc_multiplexer_channel (BD_ADDR bd_addr, BOOLEAN is_initiator);
|
||||
extern void rfc_release_multiplexer_channel (tRFC_MCB *p_rfc_mcb);
|
||||
extern void rfc_timer_start (tRFC_MCB *p_rfc_mcb, UINT16 timeout);
|
||||
extern void rfc_timer_stop (tRFC_MCB *p_rfc_mcb);
|
||||
extern void rfc_port_timer_start (tPORT *p_port, UINT16 tout);
|
||||
extern void rfc_port_timer_stop (tPORT *p_port);
|
||||
|
||||
BOOLEAN rfc_check_uih_fcs (UINT8 dlci, UINT8 received_fcs);
|
||||
BOOLEAN rfc_check_fcs (UINT16 len, UINT8 *p, UINT8 received_fcs);
|
||||
tRFC_MCB *rfc_find_lcid_mcb (UINT16 lcid);
|
||||
extern void rfc_save_lcid_mcb (tRFC_MCB *p_rfc_mcb, UINT16 lcid);
|
||||
extern void rfc_check_mcb_active (tRFC_MCB *p_mcb);
|
||||
extern void rfc_port_closed (tPORT *p_port);
|
||||
extern void rfc_sec_check_complete (BD_ADDR bd_addr, tBT_TRANSPORT transport,void *p_ref_data, UINT8 res);
|
||||
extern void rfc_inc_credit (tPORT *p_port, UINT8 credit);
|
||||
extern void rfc_dec_credit (tPORT *p_port);
|
||||
extern void rfc_check_send_cmd(tRFC_MCB *p_mcb, BT_HDR *p_buf);
|
||||
|
||||
/*
|
||||
** Functions provided by the rfc_ts_frames.c
|
||||
*/
|
||||
extern void rfc_send_sabme (tRFC_MCB *p_rfc_mcb, UINT8 dlci);
|
||||
extern void rfc_send_ua (tRFC_MCB *p_rfc_mcb, UINT8 dlci);
|
||||
extern void rfc_send_dm (tRFC_MCB *p_rfc_mcb, UINT8 dlci, BOOLEAN pf);
|
||||
extern void rfc_send_disc (tRFC_MCB *p_rfc_mcb, UINT8 dlci);
|
||||
extern void rfc_send_pn (tRFC_MCB *p_mcb, UINT8 dlci, BOOLEAN is_command, UINT16 mtu,
|
||||
UINT8 cl, UINT8 k);
|
||||
extern void rfc_send_test (tRFC_MCB *p_rfc_mcb, BOOLEAN is_command, BT_HDR *p_buf);
|
||||
extern void rfc_send_msc (tRFC_MCB *p_mcb, UINT8 dlci, BOOLEAN is_command,
|
||||
tPORT_CTRL *p_pars);
|
||||
extern void rfc_send_rls (tRFC_MCB *p_mcb, UINT8 dlci, BOOLEAN is_command, UINT8 status);
|
||||
extern void rfc_send_rpn (tRFC_MCB *p_mcb, UINT8 dlci, BOOLEAN is_command,
|
||||
tPORT_STATE *p_pars, UINT16 mask);
|
||||
extern void rfc_send_fcon (tRFC_MCB *p_mcb, BOOLEAN is_command);
|
||||
extern void rfc_send_fcoff (tRFC_MCB *p_mcb, BOOLEAN is_command);
|
||||
extern void rfc_send_buf_uih (tRFC_MCB *p_rfc_mcb, UINT8 dlci, BT_HDR *p_buf);
|
||||
extern void rfc_send_credit(tRFC_MCB *p_mcb, UINT8 dlci, UINT8 credit);
|
||||
extern void rfc_process_mx_message (tRFC_MCB *p_rfc_mcb, BT_HDR *p_buf);
|
||||
extern UINT8 rfc_parse_data (tRFC_MCB *p_rfc_mcb, MX_FRAME *p_frame, BT_HDR *p_buf);
|
||||
|
||||
/*
|
||||
** Functions provided by the rfc_disp.c
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* Call back functions from RFCOMM */
|
||||
extern void rfcomm_l2cap_if_init (void);
|
||||
|
||||
extern void PORT_StartInd (tRFC_MCB *p_mcb);
|
||||
extern void PORT_StartCnf (tRFC_MCB *p_mcb, UINT16 result);
|
||||
|
||||
extern void PORT_CloseInd (tRFC_MCB *p_mcb);
|
||||
extern void Port_TimeOutCloseMux (tRFC_MCB *p_mcb);
|
||||
|
||||
extern void PORT_DlcEstablishInd (tRFC_MCB *p_mcb, UINT8 dlci, UINT16 mtu);
|
||||
extern void PORT_DlcEstablishCnf (tRFC_MCB *p_mcb, UINT8 dlci, UINT16 mtu, UINT16 result);
|
||||
|
||||
extern void PORT_DataInd (tRFC_MCB *p_mcb, UINT8 dlci, BT_HDR *p_buf);
|
||||
|
||||
extern void PORT_DlcReleaseInd (tRFC_MCB *p_mcb, UINT8 dlci);
|
||||
|
||||
extern void PORT_ParNegInd (tRFC_MCB *p_mcb, UINT8 dlci, UINT16 mtu, UINT8 cl, UINT8 k);
|
||||
extern void PORT_ParNegCnf (tRFC_MCB *p_mcb, UINT8 dlci, UINT16 mtu, UINT8 cl, UINT8 k);
|
||||
|
||||
extern void PORT_TestCnf (tRFC_MCB *p_mcb, UINT8 *p_data, UINT16 len);
|
||||
|
||||
extern void PORT_FlowInd (tRFC_MCB *p_mcb, UINT8 dlci, BOOLEAN fc);
|
||||
|
||||
extern void PORT_PortNegInd (tRFC_MCB *p_mcb, UINT8 dlci, tPORT_STATE *p_pars, UINT16 param_mask);
|
||||
extern void PORT_PortNegCnf (tRFC_MCB *p_mcb, UINT8 dlci, tPORT_STATE *p_pars, UINT16 result);
|
||||
|
||||
extern void PORT_ControlInd (tRFC_MCB *p_mcb, UINT8 dlci, tPORT_CTRL *p_pars);
|
||||
extern void PORT_ControlCnf (tRFC_MCB *p_mcb, UINT8 dlci, tPORT_CTRL *p_pars);
|
||||
|
||||
extern void PORT_LineStatusInd (tRFC_MCB *p_mcb, UINT8 dlci, UINT8 line_status);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user