Bluetooth: monitor: Add 32-bit timestamp support

Add support for the 32-bit timestamp (1/10th ms units) extended
header.

Change-Id: I67f481a35be6878605b8c2256f6e4bfb6afe55c8
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2016-05-04 21:19:49 +03:00
commit 251f1cbc28
2 changed files with 23 additions and 2 deletions

View file

@ -56,10 +56,17 @@ static void monitor_send(const void *data, size_t len)
static inline void encode_hdr(struct bt_monitor_hdr *hdr, uint16_t opcode,
uint16_t len)
{
hdr->data_len = sys_cpu_to_le16(4 + len);
uint32_t ts32;
hdr->hdr_len = sizeof(hdr->type) + sizeof(hdr->ts32);
hdr->data_len = sys_cpu_to_le16(4 + hdr->hdr_len + len);
hdr->opcode = sys_cpu_to_le16(opcode);
hdr->flags = 0;
hdr->hdr_len = 0;
/* Extended header */
hdr->type = BT_MONITOR_TS32;
ts32 = sys_tick_get_32() * sys_clock_us_per_tick / 100;
hdr->ts32 = sys_cpu_to_le32(ts32);
}
static int log_out(int c, void *unused)

View file

@ -39,11 +39,25 @@
#define BT_MONITOR_TYPE_PRIMARY 0
#define BT_MONITOR_TYPE_AMP 1
/* Extended header types */
#define BT_MONITOR_COMMAND_DROPS 1
#define BT_MONITOR_EVENT_DROPS 2
#define BT_MONITOR_ACL_RX_DROPS 3
#define BT_MONITOR_ACL_TX_DROPS 4
#define BT_MONITOR_SCO_RX_DROPS 5
#define BT_MONITOR_SCO_TX_DROPS 6
#define BT_MONITOR_OTHER_DROPS 7
#define BT_MONITOR_TS32 8
struct bt_monitor_hdr {
uint16_t data_len;
uint16_t opcode;
uint8_t flags;
uint8_t hdr_len;
/* Extended header */
uint8_t type;
uint32_t ts32;
} __packed;
struct bt_monitor_new_index {