add hci cmd buffer to hci_stack_t struct - avoid malloc for static memory

This commit is contained in:
matthias.ringwald 2011-07-22 19:12:34 +00:00
parent fb0ca34a15
commit 124062bc8d
2 changed files with 2 additions and 6 deletions

View File

@ -585,9 +585,6 @@ void hci_init(hci_transport_t *transport, void *config, bt_control_t *control, r
hci_stack.connections = NULL;
hci_stack.discoverable = 0;
// empty cmd buffer
hci_stack.hci_cmd_buffer = malloc(3+255);
// higher level handler
hci_stack.packet_handler = dummy_handler;
@ -1087,10 +1084,9 @@ int hci_send_cmd_packet(uint8_t *packet, int size){
int hci_send_cmd(const hci_cmd_t *cmd, ...){
va_list argptr;
va_start(argptr, cmd);
uint8_t * hci_cmd_buffer = hci_stack.hci_cmd_buffer;
uint16_t size = hci_create_cmd_internal(hci_stack.hci_cmd_buffer, cmd, argptr);
va_end(argptr);
return hci_send_cmd_packet(hci_cmd_buffer, size);
return hci_send_cmd_packet(hci_stack.hci_cmd_buffer, size);
}
// Create various non-HCI events.

View File

@ -226,7 +226,7 @@ typedef struct {
linked_list_t connections;
// single buffer for HCI Command assembly
uint8_t * hci_cmd_buffer;
uint8_t hci_cmd_buffer[3+255]; // opcode (16), len(8)
/* host to controller flow control */
uint8_t num_cmd_packets;