fix use of pointer to volatile/stack memory, thanks to Matthias Gruenewald

This commit is contained in:
matthias.ringwald 2013-02-18 10:26:34 +00:00
parent 59b14699fe
commit 3bc4d64e10
2 changed files with 8 additions and 2 deletions

View File

@ -94,6 +94,7 @@ static uint8_t hci_packet[HCI_PACKET_BUFFER_SIZE]; // bigger than largest packet
// tx state
static TX_STATE tx_state;
static uint8_t tx_packet_type;
static uint8_t *tx_data;
static uint16_t tx_len;
@ -281,11 +282,12 @@ static int h4_send_packet(uint8_t packet_type, uint8_t *packet, int size){
dump(packet, size);
#endif
tx_packet_type = packet_type;
tx_data = packet;
tx_len = size;
tx_state = TX_W4_HEADER_SENT;
hal_uart_dma_send_block(&packet_type, 1);
hal_uart_dma_send_block(&tx_packet_type, 1);
return 0;
}

View File

@ -208,6 +208,9 @@ static int h4_close(){
return 0;
}
// extern uint32_t hal_time_current(void);
uint32_t h4_last_packet_timestamp;
static void h4_block_received(void){
read_pos += bytes_to_read;
@ -219,6 +222,7 @@ static void h4_block_received(void){
case HCI_ACL_DATA_PACKET:
h4_state = H4_W4_ACL_HEADER;
bytes_to_read = HCI_ACL_HEADER_SIZE;
// h4_last_packet_timestamp = hal_time_current();
break;
case HCI_EVENT_PACKET:
h4_state = H4_W4_EVENT_HEADER;
@ -466,7 +470,7 @@ static int ehcill_send_packet(uint8_t packet_type, uint8_t *packet, int size){
if (!ehcill_sleep_mode_active()){
tx_state = TX_W4_HEADER_SENT;
hal_uart_dma_send_block(&packet_type, 1);
hal_uart_dma_send_block(&tx_packet_type, 1);
return 0;
}