From 5055c9d0061aaa451de9ee33d6d2d2716f188e0f Mon Sep 17 00:00:00 2001 From: Sharvil Nanavati Date: Tue, 24 Jun 2014 00:39:06 -0700 Subject: [PATCH] Eliminate HCI flow control. It is not used anywhere in the codebase. Change-Id: If7244bdcf08023b0a093374950d6a5c1974fbbba --- hci/include/bt_hci_lib.h | 3 --- hci/include/userial.h | 8 -------- hci/src/bt_hci_bdroid.c | 24 ------------------------ hci/src/userial.c | 29 ++--------------------------- hci/src/userial_mct.c | 31 ++----------------------------- 5 files changed, 4 insertions(+), 91 deletions(-) diff --git a/hci/include/bt_hci_lib.h b/hci/include/bt_hci_lib.h index 8186d5961..541ca6e30 100644 --- a/hci/include/bt_hci_lib.h +++ b/hci/include/bt_hci_lib.h @@ -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); diff --git a/hci/include/userial.h b/hci/include/userial.h index 86984f6f8..f05c022a1 100644 --- a/hci/include/userial.h +++ b/hci/include/userial.h @@ -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); diff --git a/hci/src/bt_hci_bdroid.c b/hci/src/bt_hci_bdroid.c index f6d631f07..6b0ccc5a0 100644 --- a/hci/src/bt_hci_bdroid.c +++ b/hci/src/bt_hci_bdroid.c @@ -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 }; diff --git a/hci/src/userial.c b/hci/src/userial.c index c54285826..0fd328537 100644 --- a/hci/src/userial.c +++ b/hci/src/userial.c @@ -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); -} diff --git a/hci/src/userial_mct.c b/hci/src/userial_mct.c index da059d897..3b97f89f4 100644 --- a/hci/src/userial_mct.c +++ b/hci/src/userial_mct.c @@ -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); -} -- 2.11.0