OSDN Git Service

Removed unused functions
authorPavlin Radoslavov <pavlin@google.com>
Thu, 7 Apr 2016 18:47:48 +0000 (11:47 -0700)
committerPavlin Radoslavov <pavlin@google.com>
Fri, 15 Apr 2016 00:56:32 +0000 (17:56 -0700)
Removed unused functions and defines that are not needed:
 - l2c_bcst_msg()
 - GAP_ConnBTWrite()
 - gap_proc_btu_event()
 - AVDT_WriteDataReq()
 - L2CAP_BCST_MIN_OFFSET
 - L2CAP_BCST_OVERHEAD
 - AVDT_MAX_MEDIA_SIZE
 - LOG_NDDEBUG in btif/src/bluetooth.c

Bug: 28068134
Change-Id: If0edda2bf86caf83027db2c897537c82a0d80667

btif/src/bluetooth.c
stack/avdt/avdt_api.c
stack/gap/gap_conn.c
stack/include/avdt_api.h
stack/include/gap_api.h
stack/include/l2c_api.h
stack/include/l2cdefs.h
stack/l2cap/l2c_main.c

index f2eea9c..e0399ab 100644 (file)
@@ -24,7 +24,6 @@
  *
  ***********************************************************************************/
 
-#define LOG_NDDEBUG 0
 #define LOG_TAG "bt_btif"
 
 #include <assert.h>
index bc0038e..98ef5f7 100644 (file)
@@ -1130,88 +1130,6 @@ UINT16 AVDT_GetSignalChannel(UINT8 handle, BD_ADDR bd_addr)
 #if AVDT_MULTIPLEXING == TRUE
 /*******************************************************************************
 **
-** Function         AVDT_WriteDataReq
-**
-** Description      Send a media packet to the peer device.  The stream must
-**                  be started before this function is called.  Also, this
-**                  function can only be called if the stream is a SRC.
-**
-**                  When AVDTP has sent the media packet and is ready for the
-**                  next packet, an AVDT_WRITE_CFM_EVT is sent to the
-**                  application via the control callback.  The application must
-**                  wait for the AVDT_WRITE_CFM_EVT before it makes the next
-**                  call to AVDT_WriteDataReq().  If the applications calls
-**                  AVDT_WriteDataReq() before it receives the event the packet
-**                  will not be sent.  The application may make its first call
-**                  to AVDT_WriteDataReq() after it receives an
-**                  AVDT_START_CFM_EVT or AVDT_START_IND_EVT.
-**
-** Returns          AVDT_SUCCESS if successful, otherwise error.
-**
-*******************************************************************************/
-extern UINT16 AVDT_WriteDataReq(UINT8 handle, UINT8 *p_data, UINT32 data_len,
-                                UINT32 time_stamp, UINT8 m_pt, UINT8 marker)
-{
-
-    tAVDT_SCB       *p_scb;
-    tAVDT_SCB_EVT   evt;
-    UINT16          result = AVDT_SUCCESS;
-
-    do
-    {
-        /* check length of media frame */
-        if(data_len > AVDT_MAX_MEDIA_SIZE)
-        {
-            result = AVDT_BAD_PARAMS;
-            break;
-        }
-        /* map handle to scb */
-        if ((p_scb = avdt_scb_by_hdl(handle)) == NULL)
-        {
-            result = AVDT_BAD_HANDLE;
-            break;
-        }
-        AVDT_TRACE_WARNING("mux_tsid_media:%d", p_scb->curr_cfg.mux_tsid_media);
-
-        if (p_scb->p_pkt != NULL
-            || p_scb->p_ccb == NULL
-            || !fixed_queue_is_empty(p_scb->frag_q)
-            || p_scb->frag_off != 0
-            || p_scb->curr_cfg.mux_tsid_media == 0)
-        {
-            result = AVDT_ERR_BAD_STATE;
-            AVDT_TRACE_WARNING("p_scb->p_pkt=%x, p_scb->p_ccb=%x, IsQueueEmpty=%x, p_scb->frag_off=%x",
-                p_scb->p_pkt, p_scb->p_ccb,
-                fixed_queue_is_empty(p_scb->frag_q), p_scb->frag_off);
-            break;
-        }
-        evt.apiwrite.p_buf = 0; /* it will indicate using of fragments queue frag_q */
-
-        /* compose fragments from media payload and put fragments into gueue */
-        avdt_scb_queue_frags(p_scb, &p_data, &data_len);
-
-        evt.apiwrite.data_len = data_len;
-        evt.apiwrite.p_data = p_data;
-
-        /* process the fragments queue */
-        evt.apiwrite.time_stamp = time_stamp;
-        evt.apiwrite.m_pt = m_pt | (marker<<7);
-        avdt_scb_event(p_scb, AVDT_SCB_API_WRITE_REQ_EVT, &evt);
-    } while (0);
-
-#if (BT_USE_TRACES == TRUE)
-    if(result != AVDT_SUCCESS)
-    {
-        AVDT_TRACE_WARNING("*** AVDT_WriteDataReq failed result=%d",result);
-    }
-#endif
-    return result;
-}
-#endif
-
-#if AVDT_MULTIPLEXING == TRUE
-/*******************************************************************************
-**
 ** Function         AVDT_SetMediaBuf
 **
 ** Description      Assigns buffer for media packets or forbids using of assigned
index 03dc667..1ee2c97 100644 (file)
@@ -466,71 +466,6 @@ UINT16 GAP_ConnBTRead (UINT16 gap_handle, BT_HDR **pp_buf)
     }
 }
 
-
-/*******************************************************************************
-**
-** Function         GAP_ConnBTWrite
-**
-** Description      Bluetooth Aware applications can call this function to write data.
-**
-** Parameters:      handle      - Handle of the connection returned in the Open
-**                  p_buf      - pointer to address of buffer with data,
-**
-** Returns          BT_PASS                 - data read
-**                  GAP_ERR_BAD_HANDLE      - invalid handle
-**                  GAP_ERR_BAD_STATE       - connection not established
-**                  GAP_INVALID_BUF_OFFSET  - buffer offset is invalid
-*******************************************************************************/
-UINT16 GAP_ConnBTWrite (UINT16 gap_handle, BT_HDR *p_buf)
-{
-    tGAP_CCB    *p_ccb = gap_find_ccb_by_handle (gap_handle);
-
-    if (!p_ccb)
-    {
-        osi_free(p_buf);
-        return (GAP_ERR_BAD_HANDLE);
-    }
-
-    if (p_ccb->con_state != GAP_CCB_STATE_CONNECTED)
-    {
-        osi_free(p_buf);
-        return (GAP_ERR_BAD_STATE);
-    }
-
-    if (p_buf->offset < L2CAP_MIN_OFFSET)
-    {
-        osi_free(p_buf);
-        return (GAP_ERR_BUF_OFFSET);
-    }
-
-    fixed_queue_enqueue(p_ccb->tx_queue, p_buf);
-
-    if (p_ccb->is_congested)
-    {
-        return (BT_PASS);
-    }
-
-    /* Send the buffer through L2CAP */
-#if (GAP_CONN_POST_EVT_INCLUDED == TRUE)
-    gap_send_event (gap_handle);
-#else
-    while ((p_buf = (BT_HDR *)fixed_queue_try_dequeue(p_ccb->tx_queue)) != NULL)
-    {
-        UINT8 status = L2CA_DATA_WRITE (p_ccb->connection_id, p_buf);
-
-        if (status == L2CAP_DW_CONGESTED)
-        {
-            p_ccb->is_congested = TRUE;
-            break;
-        }
-        else if (status != L2CAP_DW_SUCCESS)
-            return (GAP_ERR_BAD_STATE);
-    }
-#endif
-    return (BT_PASS);
-}
-
-
 /*******************************************************************************
 **
 ** Function         GAP_ConnWriteData
@@ -1321,51 +1256,5 @@ void gap_send_event (UINT16 gap_handle)
     GKI_send_msg(BTU_TASK, BTU_HCI_RCV_MBOX, p_msg);
 }
 
-/*******************************************************************************
-**
-** Function     gap_proc_btu_event
-**
-** Description  Event handler for BT_EVT_TO_GAP_MSG event from BTU task
-**
-** Returns      None
-**
-*******************************************************************************/
-void gap_proc_btu_event(BT_HDR *p_msg)
-{
-    tGAP_CCB   *p_ccb = gap_find_ccb_by_handle (p_msg->layer_specific);
-    UINT8       status;
-    BT_HDR     *p_buf;
-
-    if (!p_ccb)
-    {
-        return;
-    }
-
-    if (p_ccb->con_state != GAP_CCB_STATE_CONNECTED)
-    {
-        return;
-    }
-
-    if (p_ccb->is_congested)
-    {
-        return;
-    }
-
-    /* Send the buffer through L2CAP */
-
-    while ((p_buf = (BT_HDR *)fixed_queue_try_dequeue(&p_ccb->tx_queue)) != NULL)
-    {
-        status = L2CA_DATA_WRITE (p_ccb->connection_id, p_buf);
-
-        if (status == L2CAP_DW_CONGESTED)
-        {
-            p_ccb->is_congested = TRUE;
-            break;
-        }
-        else if (status != L2CAP_DW_SUCCESS)
-            break;
-    }
-
-}
 #endif /* (GAP_CONN_POST_EVT_INCLUDED == TRUE) */
 #endif  /* GAP_CONN_INCLUDED */
index 41f8a12..e10faf0 100644 (file)
 /* The size in bytes of a media packet header. */
 #define AVDT_MEDIA_HDR_SIZE         12
 
-/* AVDTP 7.5.3 Adaptation Layer Fragmentation
- * original length of the un-fragmented transport packet should be specified by
- * two bytes length field of Adaptation Layer Header  */
-#define AVDT_MAX_MEDIA_SIZE         (0xFFFF - AVDT_MEDIA_HDR_SIZE)
-
 /* The handle is used when reporting MULTI_AV specific events */
 #define AVDT_MULTI_AV_HANDLE        0xFF
 
@@ -901,30 +896,6 @@ extern UINT16 AVDT_GetSignalChannel(UINT8 handle, BD_ADDR bd_addr);
 
 /*******************************************************************************
 **
-** Function         AVDT_WriteDataReq
-**
-** Description      Send a media packet to the peer device.  The stream must
-**                  be started before this function is called.  Also, this
-**                  function can only be called if the stream is a SRC.
-**
-**                  When AVDTP has sent the media packet and is ready for the
-**                  next packet, an AVDT_WRITE_CFM_EVT is sent to the
-**                  application via the control callback.  The application must
-**                  wait for the AVDT_WRITE_CFM_EVT before it makes the next
-**                  call to AVDT_WriteDataReq().  If the applications calls
-**                  AVDT_WriteDataReq() before it receives the event the packet
-**                  will not be sent.  The application may make its first call
-**                  to AVDT_WriteDataReq() after it receives an
-**                  AVDT_START_CFM_EVT or AVDT_START_IND_EVT.
-**
-** Returns          AVDT_SUCCESS if successful, otherwise error.
-**
-*******************************************************************************/
-extern UINT16 AVDT_WriteDataReq(UINT8 handle, UINT8 *p_data, UINT32 data_len,
-                                UINT32 time_stamp, UINT8 m_pt, UINT8 marker);
-
-/*******************************************************************************
-**
 ** Function         AVDT_SetMediaBuf
 **
 ** Description      Assigns buffer for media packets or forbids using of assigned
index a0b99cf..e1be352 100644 (file)
@@ -208,20 +208,6 @@ extern UINT16 GAP_ConnBTRead (UINT16 gap_handle, BT_HDR **pp_buf);
 
 /*******************************************************************************
 **
-** Function         GAP_ConnBTWrite
-**
-** Description      GKI buffer aware applications can call this function to write data
-**                  by passing a pointer to the GKI buffer of data.
-**
-** Returns          BT_PASS                 - data read
-**                  GAP_ERR_BAD_HANDLE      - invalid handle
-**                  GAP_ERR_BAD_STATE       - connection not established
-**                  GAP_INVALID_BUF_OFFSET  - buffer offset is invalid
-*******************************************************************************/
-extern UINT16 GAP_ConnBTWrite (UINT16 gap_handle, BT_HDR *p_buf);
-
-/*******************************************************************************
-**
 ** Function         GAP_ConnWriteData
 **
 ** Description      GKI buffer unaware application will call this function
index dde661d..e8b21fe 100644 (file)
@@ -42,9 +42,6 @@
 #define L2CAP_LCC_SDU_LENGTH    2
 #define L2CAP_LCC_OFFSET        (L2CAP_MIN_OFFSET + L2CAP_LCC_SDU_LENGTH)  /* plus SDU length(2) */
 
-/* Minimum offset for broadcast needs another two bytes for the PSM */
-#define L2CAP_BCST_MIN_OFFSET       11
-
 /* ping result codes */
 #define L2CAP_PING_RESULT_OK        0       /* Ping reply received OK     */
 #define L2CAP_PING_RESULT_NO_LINK   1       /* Link could not be setup    */
index 769e560..4037dc7 100644 (file)
@@ -59,7 +59,6 @@
 #define L2CAP_ECHO_RSP_LEN      0           /* Data is optional                     */
 #define L2CAP_INFO_REQ_LEN      2           /* Info type                            */
 #define L2CAP_INFO_RSP_LEN      4           /* Info type, result (data is optional) */
-#define L2CAP_BCST_OVERHEAD     2           /* Additional broadcast packet overhead */
 #define L2CAP_UCD_OVERHEAD      2           /* Additional connectionless packet overhead */
 
 #define L2CAP_AMP_CONN_REQ_LEN  5           /* PSM, CID, and remote controller ID   */
index d039808..ad1e583 100644 (file)
@@ -56,62 +56,6 @@ tL2C_CB l2cb;
 
 /*******************************************************************************
 **
-** Function         l2c_bcst_msg
-**
-** Description
-**
-** Returns          void
-**
-*******************************************************************************/
-void l2c_bcst_msg( BT_HDR *p_buf, UINT16 psm )
-{
-    UINT8       *p;
-
-    /* Ensure we have enough space in the buffer for the L2CAP and HCI headers */
-    if (p_buf->offset < L2CAP_BCST_MIN_OFFSET)
-    {
-        L2CAP_TRACE_ERROR ("L2CAP - cannot send buffer, offset: %d", p_buf->offset);
-        osi_free(p_buf);
-        return;
-    }
-
-    /* Step back some bytes to add the headers */
-    p_buf->offset -= (HCI_DATA_PREAMBLE_SIZE + L2CAP_PKT_OVERHEAD + L2CAP_BCST_OVERHEAD);
-    p_buf->len    += L2CAP_PKT_OVERHEAD + L2CAP_BCST_OVERHEAD;
-
-    /* Set the pointer to the beginning of the data */
-    p = (UINT8 *)(p_buf + 1) + p_buf->offset;
-
-    /* First, the HCI transport header */
-    UINT16_TO_STREAM (p, 0x0050 | (L2CAP_PKT_START << 12) | (2 << 14));
-
-    uint16_t acl_data_size = controller_get_interface()->get_acl_data_size_classic();
-    /* The HCI transport will segment the buffers. */
-    if (p_buf->len > acl_data_size)
-    {
-        UINT16_TO_STREAM (p, acl_data_size);
-    }
-    else
-    {
-        UINT16_TO_STREAM (p, p_buf->len);
-    }
-
-    /* Now the L2CAP header */
-    UINT16_TO_STREAM (p, p_buf->len - L2CAP_PKT_OVERHEAD);
-    UINT16_TO_STREAM (p, L2CAP_CONNECTIONLESS_CID);
-    UINT16_TO_STREAM (p, psm);
-
-    p_buf->len += HCI_DATA_PREAMBLE_SIZE;
-
-    if (p_buf->len <= controller_get_interface()->get_acl_packet_size_classic())
-    {
-
-        bte_main_hci_send(p_buf, BT_EVT_TO_LM_HCI_ACL);
-    }
-}
-
-/*******************************************************************************
-**
 ** Function         l2c_rcv_acl_data
 **
 ** Description      This function is called from the HCI Interface when an ACL