Skip to content
Snippets Groups Projects

BLE fixes 2020-2

Merged schneider requested to merge schneider/ble-fixes-2020-2 into master
All threads resolved!
Files
3
+ 0
63
@@ -12,7 +12,6 @@
#include "FreeRTOS.h"
#include "timers.h"
#include <machine/endian.h>
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
@@ -45,8 +44,6 @@ static StaticTimer_t x;
static TimerHandle_t timerWakeup = NULL;
static int lasttick = 0;
static int log_fd;
/*! \brief Stack initialization for app. */
extern void StackInit(void);
extern void AppInit(void);
@@ -73,57 +70,6 @@ static bool_t myTrace(const uint8_t *pBuf, uint32_t len)
return FALSE;
}
struct packet_header {
uint32_t original_length;
uint32_t included_length;
uint32_t packet_flags;
uint32_t cumulative_drops;
uint32_t timestamp_us_h;
uint32_t timestamp_us_l;
};
void WsfPDump(wsfPDumpType_t pdType, uint16_t length, uint8_t *pBuffer)
{
uint32_t direction;
uint8_t type;
switch(pdType) {
case WSF_PDUMP_TYPE_HCI_CMD:
direction = 0;
type = 0x01;
break;
case WSF_PDUMP_TYPE_HCI_EVT:
direction = 1;
type = 0x04;
break;
case WSF_PDUMP_TYPE_HCI_TX_ACL:
direction = 0;
type = 0x02;
break;
case WSF_PDUMP_TYPE_HCI_RX_ACL:
direction = 1;
type = 0x02;
break;
default:
break;
}
int tick = xTaskGetTickCount();
uint64_t timestamp_us = tick * 1000;
struct packet_header header = {
.original_length = __htonl(length+1),
.included_length = __htonl(length+1),
.packet_flags = __htonl(direction),
.cumulative_drops = __htonl(0),
.timestamp_us_h = __htonl(timestamp_us >> 32),
.timestamp_us_l = __htonl(timestamp_us & 0xFFFFFFFF)
};
epic_file_write(log_fd, &header, sizeof(header));
epic_file_write(log_fd, &type, sizeof(type));
epic_file_write(log_fd, pBuffer, length);
}
/*************************************************************************************************/
static void WsfInit(void)
{
@@ -292,13 +238,6 @@ static void scheduleTimer(void)
APP_TRACE_INFO0("No timer running");
}
}
static const uint8_t log_header[] = {'b', 't', 's', 'n', 'o', 'o', 'p', 0, 0, 0, 0, 1, 0, 0, 0x03, 0xea};
void ble_log_flush(void)
{
epic_file_flush(log_fd);
}
/*************************************************************************************************/
void vBleTask(void *pvParameters)
{
@@ -309,8 +248,6 @@ void vBleTask(void *pvParameters)
*/
vTaskDelay(pdMS_TO_TICKS(500));
log_fd = epic_file_open("ble.log", "w");
epic_file_write(log_fd, log_header, sizeof(log_header));
/* We are going to execute FreeRTOS functions from callbacks
* coming from this interrupt. Its priority needs to be
* reduced to allow this. */
Loading