mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-31 18:33:00 +00:00
eHCILL: use ENABLE_EHCILL instead of HAVE_EHCILL plus runtime enable call, updated docs
This commit is contained in:
parent
8a23fc5312
commit
f6a20ec99f
@ -84,7 +84,6 @@ extern const uint32_t cc256x_init_script_size;
|
||||
// init script
|
||||
static uint32_t init_script_offset = 0;
|
||||
static int16_t init_power_in_dB = 13; // 13 dBm
|
||||
static int init_ehcill_enabled = 0;
|
||||
|
||||
// support for SCO over HCI
|
||||
#ifdef ENABLE_SCO_OVER_HCI
|
||||
@ -193,11 +192,11 @@ static void update_set_class2_single_power(uint8_t * hci_cmd_buffer){
|
||||
|
||||
// eHCILL activate from http://e2e.ti.com/support/low_power_rf/f/660/p/134855/484776.aspx
|
||||
static void update_sleep_mode_configurations(uint8_t * hci_cmd_buffer){
|
||||
if (init_ehcill_enabled) {
|
||||
#ifdef ENABLE_EHCILL
|
||||
hci_cmd_buffer[4] = 1;
|
||||
} else {
|
||||
#else
|
||||
hci_cmd_buffer[4] = 0;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void update_init_script_command(uint8_t *hci_cmd_buffer){
|
||||
@ -275,14 +274,6 @@ static btstack_chipset_result_t chipset_next_command(uint8_t * hci_cmd_buffer){
|
||||
|
||||
|
||||
// MARK: public API
|
||||
void btstack_chipset_cc256x_enable_ehcill(int on){
|
||||
init_ehcill_enabled = on;
|
||||
}
|
||||
|
||||
int btstack_chipset_cc256x_ehcill_enabled(void){
|
||||
return init_ehcill_enabled;
|
||||
}
|
||||
|
||||
void btstack_chipset_cc256x_set_power(int16_t power_in_dB){
|
||||
init_power_in_dB = power_in_dB;
|
||||
}
|
||||
|
@ -50,8 +50,6 @@ extern "C" {
|
||||
#include <stdint.h>
|
||||
#include "btstack_chipset.h"
|
||||
|
||||
void btstack_chipset_cc256x_enable_ehcill(int on);
|
||||
int btstack_chipset_cc256x_ehcill_enabled(void);
|
||||
void btstack_chipset_cc256x_set_power(int16_t power_in_dB);
|
||||
const btstack_chipset_t * btstack_chipset_cc256x_instance(void);
|
||||
|
||||
|
@ -39,7 +39,6 @@ System properties:
|
||||
|
||||
#define | Description
|
||||
-----------------------------------|-------------------------------------
|
||||
HAVE_EHCILL | TI CC256x/WL18xx with eHCILL is used
|
||||
HAVE_MALLOC | Use dynamic memory
|
||||
|
||||
|
||||
@ -70,6 +69,7 @@ BTstack properties:
|
||||
-------------------------|---------------------------------------------
|
||||
ENABLE_CLASSIC | Enable Classic related code in HCI and L2CAP
|
||||
ENABLE_BLE | Enable BLE related code in HCI and L2CAP
|
||||
ENABLE_EHCILL | Enable eHCILL low power mode on TI CC256x/WL18xx chipsets
|
||||
ENABLE_LOG_DEBUG | Enable log_debug messages
|
||||
ENABLE_LOG_ERROR | Enable log_error messages
|
||||
ENABLE_LOG_INFO | Enable log_info messages
|
||||
|
@ -59,7 +59,7 @@
|
||||
#error HCI_OUTGOING_PRE_BUFFER_SIZE not defined. Please update hci.h
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_EHCILL
|
||||
#ifdef ENABLE_EHCILL
|
||||
#error "HCI Transport H4 DMA does not support eHCILL. Please use hci_transport_h4_ehcill_dma.c instead."
|
||||
#endif
|
||||
|
||||
|
@ -8,7 +8,6 @@
|
||||
// Port related features
|
||||
#define HAVE_INIT_SCRIPT
|
||||
#define HAVE_EMBEDDED_TICK
|
||||
#define HAVE_EHCILL
|
||||
|
||||
// BTstack features that can be enabled
|
||||
#define ENABLE_BLE
|
||||
@ -16,6 +15,7 @@
|
||||
#define ENABLE_LOG_INTO_HCI_DUMP
|
||||
// #define ENABLE_LOG_ERROR
|
||||
// #define ENABLE_LOG_INFO
|
||||
// #define ENABLE_EHCILL
|
||||
|
||||
// BTstack configuration. buffers, sizes, ...
|
||||
#define HCI_ACL_PAYLOAD_SIZE 52
|
||||
|
@ -115,9 +115,6 @@ int main(void)
|
||||
hci_event_callback_registration.callback = &packet_handler;
|
||||
hci_add_event_handler(&hci_event_callback_registration);
|
||||
|
||||
// use eHCILL
|
||||
btstack_chipset_cc256x_enable_ehcill(1);
|
||||
|
||||
// ready - enable irq used in h4 task
|
||||
__enable_interrupt();
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
#define __BTSTACK_CONFIG
|
||||
|
||||
// Port related features
|
||||
#define HAVE_EHCILL
|
||||
#define HAVE_INIT_SCRIPT
|
||||
#define HAVE_EMBEDDED_TICK
|
||||
|
||||
@ -16,6 +15,7 @@
|
||||
// #define ENABLE_LOG_INTO_HCI_DUMP
|
||||
// #define ENABLE_LOG_ERROR
|
||||
// #define ENABLE_LOG_INFO
|
||||
// #define ENABLE_EHCILL
|
||||
|
||||
// BTstack configuration. buffers, sizes, ...
|
||||
#define HCI_ACL_PAYLOAD_SIZE 52
|
||||
|
@ -384,9 +384,6 @@ int main(void){
|
||||
hci_set_link_key_db(link_key_db);
|
||||
hci_set_chipset(btstack_chipset_cc256x_instance());
|
||||
|
||||
// use eHCILL
|
||||
btstack_chipset_cc256x_enable_ehcill(1);
|
||||
|
||||
// register for HCI events
|
||||
hci_event_callback_registration.callback = &packet_handler;
|
||||
hci_add_event_handler(&hci_event_callback_registration);
|
||||
|
@ -114,9 +114,6 @@ static void btstack_setup(void){
|
||||
// inform about BTstack state
|
||||
hci_event_callback_registration.callback = &packet_handler;
|
||||
hci_add_event_handler(&hci_event_callback_registration);
|
||||
|
||||
// use eHCILL
|
||||
btstack_chipset_cc256x_enable_ehcill(1);
|
||||
}
|
||||
|
||||
int btstack_main(int argc, const char * argv[]);
|
||||
|
@ -9,14 +9,13 @@
|
||||
#define HAVE_INIT_SCRIPT
|
||||
#define HAVE_EMBEDDED_TICK
|
||||
|
||||
// #define HAVE_EHCILL
|
||||
|
||||
// BTstack features that can be enabled
|
||||
#define ENABLE_BLE
|
||||
#define ENABLE_CLASSIC
|
||||
#define ENABLE_LOG_INTO_HCI_DUMP
|
||||
// #define ENABLE_LOG_ERROR
|
||||
// #define ENABLE_LOG_INFO
|
||||
// #define ENABLE_EHCILL
|
||||
|
||||
// BTstack configuration. buffers, sizes, ...
|
||||
#define HCI_ACL_PAYLOAD_SIZE 52
|
||||
|
@ -121,9 +121,6 @@ static void btstack_setup(void){
|
||||
// inform about BTstack state
|
||||
hci_event_callback_registration.callback = &packet_handler;
|
||||
hci_add_event_handler(&hci_event_callback_registration);
|
||||
|
||||
// use eHCILL
|
||||
// btstack_chipset_cc256x_enable_ehcill(1);
|
||||
}
|
||||
|
||||
int btstack_main(int argc, const char * argv[]);
|
||||
|
@ -6,9 +6,7 @@
|
||||
#define __BTSTACK_CONFIG
|
||||
|
||||
// Port related features
|
||||
#define HAVE_EHCILL
|
||||
#define HAVE_EMBEDDED_TIME_MS
|
||||
#define WICED_BT_UART_MANUAL_CTS_RTS
|
||||
|
||||
// BTstack features that can be enabled
|
||||
#define ENABLE_BLE
|
||||
|
@ -10,7 +10,6 @@
|
||||
#define HAVE_POSIX_FILE_IO
|
||||
#define HAVE_POSIX_STDIN
|
||||
#define HAVE_POSIX_TIME
|
||||
#define HAVE_EHCILL
|
||||
|
||||
// BTstack features that can be enabled
|
||||
#define ENABLE_BLE
|
||||
@ -20,6 +19,7 @@
|
||||
#define ENABLE_LOG_INTO_HCI_DUMP
|
||||
#define ENABLE_SCO_OVER_HCI
|
||||
#define ENABLE_SDP_DES_DUMP
|
||||
#define ENABLE_EHCILL
|
||||
|
||||
// BTstack configuration. buffers, sizes, ...
|
||||
#define HCI_INCOMING_PRE_BUFFER_SIZE 14 // sizeof benep heade, avoid memcpy
|
||||
|
@ -139,9 +139,8 @@ static void local_version_information_callback(uint8_t * packet){
|
||||
printf("Texas Instruments - CC256x compatible chipset.\n");
|
||||
use_fast_uart();
|
||||
hci_set_chipset(btstack_chipset_cc256x_instance());
|
||||
#ifdef HAVE_EHCILL
|
||||
printf("Enabling eHCILL\n");
|
||||
btstack_chipset_cc256x_enable_ehcill(1);
|
||||
#ifdef ENABLE_EHCILL
|
||||
printf("eHCILL enabled.\n");
|
||||
#endif
|
||||
break;
|
||||
case COMPANY_ID_BROADCOM_CORPORATION:
|
||||
|
@ -8,13 +8,13 @@
|
||||
// Port related features
|
||||
#define HAVE_INIT_SCRIPT
|
||||
#define HAVE_EMBEDDED_TICK
|
||||
#define HAVE_EHCILL
|
||||
|
||||
// BTstack features that can be enabled
|
||||
#define ENABLE_BLE
|
||||
#define ENABLE_CLASSIC
|
||||
// #define ENABLE_LOG_INFO
|
||||
// #define ENABLE_LOG_ERROR
|
||||
// #define ENABLE_EHCILL
|
||||
|
||||
// BTstack configuration. buffers, sizes, ...
|
||||
#define HCI_ACL_PAYLOAD_SIZE 52
|
||||
|
@ -442,9 +442,6 @@ int main(void)
|
||||
hci_event_callback_registration.callback = &packet_handler;
|
||||
hci_add_event_handler(&hci_event_callback_registration);
|
||||
|
||||
// enable eHCILL
|
||||
btstack_chipset_cc256x_enable_ehcill(1);
|
||||
|
||||
// hand over to btstack embedded code
|
||||
btstack_main();
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
#define __BTSTACK_CONFIG
|
||||
|
||||
// Port related features
|
||||
#define HAVE_EHCILL
|
||||
#define HAVE_EMBEDDED_TIME_MS
|
||||
#define WICED_BT_UART_MANUAL_CTS_RTS
|
||||
|
||||
|
@ -50,7 +50,7 @@
|
||||
#include "hci_transport.h"
|
||||
#include "btstack_uart_block.h"
|
||||
|
||||
#ifdef HAVE_EHCILL
|
||||
#ifdef ENABLE_EHCILL
|
||||
|
||||
// eHCILL commands
|
||||
#define EHCILL_GO_TO_SLEEP_IND 0x030
|
||||
@ -80,6 +80,8 @@ typedef enum {
|
||||
static EHCILL_STATE ehcill_state;
|
||||
static uint8_t ehcill_command_to_send;
|
||||
|
||||
static btstack_uart_sleep_mode_t btstack_uart_sleep_mode;
|
||||
|
||||
// work around for eHCILL problem
|
||||
static btstack_timer_source_t ehcill_sleep_ack_timer;
|
||||
|
||||
@ -104,7 +106,7 @@ typedef enum {
|
||||
typedef enum {
|
||||
TX_IDLE = 1,
|
||||
TX_W4_PACKET_SENT,
|
||||
#ifdef HAVE_EHCILL
|
||||
#ifdef ENABLE_EHCILL
|
||||
TX_W4_WAKEUP,
|
||||
TX_W2_EHCILL_SEND,
|
||||
TX_W4_EHCILL_SENT,
|
||||
@ -113,7 +115,6 @@ typedef enum {
|
||||
|
||||
// UART Driver + Config
|
||||
static const btstack_uart_block_t * btstack_uart;
|
||||
static btstack_uart_sleep_mode_t btstack_uart_sleep_mode;
|
||||
static btstack_uart_config_t uart_config;
|
||||
|
||||
// write state
|
||||
@ -169,7 +170,7 @@ static void hci_transport_h4_block_read(void){
|
||||
bytes_to_read = HCI_SCO_HEADER_SIZE;
|
||||
h4_state = H4_W4_SCO_HEADER;
|
||||
break;
|
||||
#ifdef HAVE_EHCILL
|
||||
#ifdef ENABLE_EHCILL
|
||||
case EHCILL_GO_TO_SLEEP_IND:
|
||||
case EHCILL_GO_TO_SLEEP_ACK:
|
||||
case EHCILL_WAKE_UP_IND:
|
||||
@ -223,7 +224,7 @@ static void hci_transport_h4_block_sent(void){
|
||||
tx_len = 0;
|
||||
tx_state = TX_IDLE;
|
||||
|
||||
#ifdef HAVE_EHCILL
|
||||
#ifdef ENABLE_EHCILL
|
||||
// notify eHCILL engine
|
||||
hci_transport_h4_ehcill_handle_packet_sent();
|
||||
#endif
|
||||
@ -231,7 +232,7 @@ static void hci_transport_h4_block_sent(void){
|
||||
packet_handler(HCI_EVENT_PACKET, &packet_sent_event[0], sizeof(packet_sent_event));
|
||||
break;
|
||||
|
||||
#ifdef HAVE_EHCILL
|
||||
#ifdef ENABLE_EHCILL
|
||||
case TX_W4_EHCILL_SENT:
|
||||
hci_transport_h4_ehcill_handle_ehcill_command_sent();
|
||||
break;
|
||||
@ -256,7 +257,7 @@ static int hci_transport_h4_send_packet(uint8_t packet_type, uint8_t * packet, i
|
||||
tx_len = size;
|
||||
tx_data = packet;
|
||||
|
||||
#ifdef HAVE_EHCILL
|
||||
#ifdef ENABLE_EHCILL
|
||||
if (hci_transport_h4_ehcill_sleep_mode_active()){
|
||||
hci_transport_h4_ehcill_trigger_wakeup();
|
||||
return 0;
|
||||
@ -302,7 +303,7 @@ static int hci_transport_h4_open(void){
|
||||
|
||||
tx_state = TX_IDLE;
|
||||
|
||||
#ifdef HAVE_EHCILL
|
||||
#ifdef ENABLE_EHCILL
|
||||
hci_transport_h4_ehcill_open();
|
||||
#endif
|
||||
return 0;
|
||||
@ -323,7 +324,7 @@ static void dummy_handler(uint8_t packet_type, uint8_t *packet, uint16_t size){
|
||||
// --- main part of eHCILL implementation ---
|
||||
//
|
||||
|
||||
#ifdef HAVE_EHCILL
|
||||
#ifdef ENABLE_EHCILL
|
||||
|
||||
static void hci_transport_h4_ehcill_open(void){
|
||||
hci_transport_h4_ehcill_reset_statemachine();
|
||||
|
Loading…
x
Reference in New Issue
Block a user