OSDN Git Service

Eliminate HCI flow control. It is not used anywhere in the codebase.
authorSharvil Nanavati <sharvil@google.com>
Tue, 24 Jun 2014 07:39:06 +0000 (00:39 -0700)
committerSharvil Nanavati <sharvil@google.com>
Sun, 29 Jun 2014 04:18:22 +0000 (04:18 +0000)
Change-Id: If7244bdcf08023b0a093374950d6a5c1974fbbba

hci/include/bt_hci_lib.h
hci/include/userial.h
hci/src/bt_hci_bdroid.c
hci/src/userial.c
hci/src/userial_mct.c

index 8186d59..541ca6e 100644 (file)
@@ -181,9 +181,6 @@ typedef struct {
     /** Transmit buffer */
     int (*transmit_buf)(TRANSAC transac, char *p_buf, int len);
 
-    /** Controls receive flow */
-    int (*set_rxflow)(bt_rx_flow_state_t state);
-
     /** Controls HCI logging on/off */
     int (*logging)(bt_hc_logging_state_t state, char *p_path);
 
index 86984f6..f05c022 100644 (file)
@@ -68,11 +68,3 @@ uint16_t userial_read(uint16_t msg_id, uint8_t *p_buffer, uint16_t len);
 // This function returns the number of bytes actually written, which may be
 // less than |len|. This function may block.
 uint16_t userial_write(uint16_t msg_id, const uint8_t *p_data, uint16_t len);
-
-// Pauses reading data from the serial port. No new buffers will be produced
-// until |userial_resume_reading| is called. This function is idempotent.
-void userial_pause_reading(void);
-
-// Resumes reading data from the serial port if reads were previously paused.
-// This function is idempotent.
-void userial_resume_reading(void);
index f6d631f..6b0ccc5 100644 (file)
@@ -328,29 +328,6 @@ static int transmit_buf(TRANSAC transac, char * p_buf, int len)
 }
 
 
-/** Controls receive flow */
-static int set_rxflow(bt_rx_flow_state_t state) {
-    BTHCDBG("set_rxflow %d", state);
-
-    switch (state) {
-        case BT_RXFLOW_ON:
-            userial_resume_reading();
-            break;
-
-        case BT_RXFLOW_OFF:
-            userial_pause_reading();
-            break;
-
-        default:
-            assert(false);
-            ALOGE("%s unexpected flow state: %d", __func__, state);
-            return BT_HC_STATUS_FAIL;
-    }
-
-    return BT_HC_STATUS_SUCCESS;
-}
-
-
 /** Controls HCI logging on/off */
 static int logging(bt_hc_logging_state_t state, char *p_path)
 {
@@ -419,7 +396,6 @@ static const bt_hc_interface_t bluetoothHCLibInterface = {
     preload,
     postload,
     transmit_buf,
-    set_rxflow,
     logging,
     cleanup
 };
index c542858..0fd3285 100644 (file)
@@ -64,9 +64,7 @@
 // Note that the values must be >= 0x8000000000000000 to guarantee delivery
 // of the message (see eventfd(2) for details on blocking behaviour).
 enum {
-    USERIAL_RX_EXIT     = 0x8000000000000000ULL,
-    USERIAL_RX_FLOW_OFF = 0x8000000000000001ULL,
-    USERIAL_RX_FLOW_ON  = 0x8000000000000002ULL,
+    USERIAL_RX_EXIT     = 0x8000000000000000ULL
 };
 
 /******************************************************************************
@@ -101,7 +99,6 @@ static volatile uint8_t userial_running = 0;
 **      - signal_fds[1]: trigger from userial_close
 *****************************************************************************/
 static int event_fd = -1;
-static uint8_t rx_flow_on = TRUE;
 
 static inline int add_event_fd(fd_set *set) {
     if (event_fd == -1) {
@@ -155,10 +152,7 @@ static int select_read(int fd, uint8_t *pbuf, int len)
     {
         /* Initialize the input fd set */
         FD_ZERO(&input);
-        if (rx_flow_on == TRUE)
-        {
-            FD_SET(fd, &input);
-        }
+        FD_SET(fd, &input);
         int fd_max = add_event_fd(&input);
         fd_max = fd_max > fd ? fd_max : fd;
 
@@ -168,14 +162,6 @@ static int select_read(int fd, uint8_t *pbuf, int len)
         {
             uint64_t event = read_event();
             switch (event) {
-                case USERIAL_RX_FLOW_ON:
-                    USERIALDBG("RX flow ON");
-                    rx_flow_on = TRUE;
-                    break;
-                case USERIAL_RX_FLOW_OFF:
-                    USERIALDBG("RX flow OFF");
-                    rx_flow_on = FALSE;
-                    break;
                 case USERIAL_RX_EXIT:
                     USERIALDBG("RX termination");
                     return -1;
@@ -214,7 +200,6 @@ static void *userial_read_thread(void *arg)
     USERIALDBG("Entering userial_read_thread()");
     prctl(PR_SET_NAME, (unsigned long)"userial_read", 0, 0, 0);
 
-    rx_flow_on = TRUE;
     userial_running = 1;
 
     raise_priority_a2dp(TASK_HIGH_USERIAL_READ);
@@ -412,13 +397,3 @@ void userial_close(void) {
 
     userial_cb.fd = -1;
 }
-
-void userial_pause_reading(void) {
-    if (userial_running)
-        send_event(USERIAL_RX_FLOW_OFF);
-}
-
-void userial_resume_reading(void) {
-    if (userial_running)
-        send_event(USERIAL_RX_FLOW_ON);
-}
index da059d8..3b97f89 100644 (file)
@@ -59,8 +59,6 @@
 
 enum {
     USERIAL_RX_EXIT,
-    USERIAL_RX_FLOW_OFF,
-    USERIAL_RX_FLOW_ON
 };
 
 /******************************************************************************
@@ -102,7 +100,6 @@ static volatile uint8_t userial_running = 0;
 **      - signal_fds[1]: trigger from userial_close
 *****************************************************************************/
 static int signal_fds[2]={0,1};
-static uint8_t rx_flow_on = TRUE;
 static inline int create_signal_fds(fd_set* set)
 {
     if(signal_fds[0]==0 && socketpair(AF_UNIX, SOCK_STREAM, 0, signal_fds)<0)
@@ -147,7 +144,6 @@ static void *userial_read_thread(void *arg)
 
     USERIALDBG("Entering userial_read_thread()");
 
-    rx_flow_on = TRUE;
     userial_running = 1;
 
     raise_priority_a2dp(TASK_HIGH_USERIAL_READ);
@@ -156,11 +152,8 @@ static void *userial_read_thread(void *arg)
     {
         /* Initialize the input fd set */
         FD_ZERO(&input);
-        if (rx_flow_on == TRUE)
-        {
-            FD_SET(userial_cb.fd[CH_EVT], &input);
-            FD_SET(userial_cb.fd[CH_ACL_IN], &input);
-        }
+        FD_SET(userial_cb.fd[CH_EVT], &input);
+        FD_SET(userial_cb.fd[CH_ACL_IN], &input);
 
         int fd_max = create_signal_fds(&input);
         fd_max = (fd_max>userial_cb.fd[CH_EVT]) ? fd_max : userial_cb.fd[CH_EVT];
@@ -178,16 +171,6 @@ static void *userial_read_thread(void *arg)
                 userial_running = 0;
                 break;
             }
-            else if (reason == USERIAL_RX_FLOW_OFF)
-            {
-                USERIALDBG("RX flow OFF");
-                rx_flow_on = FALSE;
-            }
-            else if (reason == USERIAL_RX_FLOW_ON)
-            {
-                USERIALDBG("RX flow ON");
-                rx_flow_on = TRUE;
-            }
         }
 
         if (n > 0)
@@ -394,13 +377,3 @@ void userial_close(void)
     for (idx=0; idx < CH_MAX; idx++)
         userial_cb.fd[idx] = -1;
 }
-
-void userial_pause_reading(void) {
-    if (userial_running)
-        send_wakeup_signal(USERIAL_RX_FLOW_OFF);
-}
-
-void userial_resume_reading(void) {
-    if (userial_running)
-        send_wakeup_signal(USERIAL_RX_FLOW_ON);
-}