constrain hci_stack.acl_data_packet_length by HCI_ACL_BUFFER_SIZE

This commit is contained in:
matthias.ringwald 2011-07-27 20:42:17 +00:00
parent a7a04bd9eb
commit 28c93cee3e
3 changed files with 11 additions and 4 deletions

View File

@ -408,7 +408,7 @@ static void event_handler(uint8_t *packet, int size){
hci_stack.acl_data_packet_length = HCI_ACL_BUFFER_SIZE;
}
// determine usable ACL packet types
hci_stack.packet_types = hci_acl_packet_types_for_buffer_size(max_acl_payload);
hci_stack.packet_types = hci_acl_packet_types_for_buffer_size(hci_stack.acl_data_packet_length);
log_error("hci_read_buffer_size: size %u, count %u, packet types %04x\n",
hci_stack.acl_data_packet_length, hci_stack.total_num_acl_packets, hci_stack.packet_types);

View File

@ -71,6 +71,8 @@ extern "C" {
#define HCI_ACL_3DH3_SIZE 552
#define HCI_ACL_2DH5_SIZE 679
#define HCI_ACL_3DH5_SIZE 1021
#define HCI_EVENT_PKT_SIZE 255
// OGFs
#define OGF_LINK_CONTROL 0x01

View File

@ -48,6 +48,13 @@
#include "hci_transport.h"
#include "hci_dump.h"
// determine sie of receive buffer
#if (HCI_ACL_DATA_PKT_HDR + HCI_ACL_BUFFER_SIZE) > (HCI_EVENT_PKT_HDR + HCI_EVENT_PKT_SIZE)
#define HCI_PACKET_BUFFER_SIZE (HCI_ACL_DATA_PKT_HDR + HCI_ACL_BUFFER_SIZE)
#else
#define HCI_PACKET_BUFFER_SIZE (HCI_EVENT_PKT_HDR + HCI_EVENT_PKT_SIZE)
#endif
// #define USE_HCI_READER_THREAD
typedef enum {
@ -90,10 +97,8 @@ static void (*packet_handler)(uint8_t packet_type, uint8_t *packet, uint16_t si
static H4_STATE h4_state;
static int bytes_to_read;
static int read_pos;
// static uint8_t hci_event_buffer[255+2]; // maximal payload + 2 bytes header
static uint8_t hci_packet[1+HCI_ACL_BUFFER_SIZE]; // bigger than largest packet - watch out when ACL payload is < 255
static uint8_t hci_packet[1+HCI_PACKET_BUFFER_SIZE]; // packet type + max(acl header + acl payload, event header + event data)
// prototypes
static int h4_open(void *transport_config){