changeset 102:3c514e476693

ubx: add UBX-CFG-TP5 & UBX-TIM-TP definitions Signed-off-by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
author Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
date Fri, 22 Sep 2023 09:51:51 -0400
parents 53d4eab866b8
children e43452480870
files ubx.c ubx.h
diffstat 2 files changed, 55 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ubx.c	Fri Sep 22 09:50:41 2023 -0400
+++ b/ubx.c	Fri Sep 22 09:51:51 2023 -0400
@@ -57,6 +57,7 @@
 		[UBX_CFG_PRT]     = "UBX-CFG-PRT",
 		[UBX_CFG_MSG]     = "UBX-CFG-MSG",
 		[UBX_CFG_NAV5]    = "UBX-CFG-NAV5",
+		[UBX_CFG_TP5]     = "UBX-CFG-TP5",
 		[UBX_MON_HW]      = "UBX-MON-HW",
 		[UBX_MON_VER]     = "UBX-MON-VER",
 		[UBX_NAV_CLOCK]   = "UBX-NAV-CLOCK",
@@ -68,6 +69,7 @@
 		[UBX_RXM_RLM]     = "UBX-RXM-RLM",
 		[UBX_RXM_SFRBX]   = "UBX-RXM-SFRBX",
 		[UBX_SEC_UNIQID]  = "UBX-SEC-UNIQID",
+		[UBX_TIM_TP]      = "UBX-TIM-TP",
 	};
 
 	if ((id > ARRAY_LEN(names)) || (names[id] == NULL))
--- a/ubx.h	Fri Sep 22 09:50:41 2023 -0400
+++ b/ubx.h	Fri Sep 22 09:51:51 2023 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2019-2021 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
+ * Copyright (c) 2019-2021,2023 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -63,6 +63,7 @@
 	UBX_CFG_PRT	= (UBX_CLASS_CFG << 8) | 0x00,
 	UBX_CFG_MSG	= (UBX_CLASS_CFG << 8) | 0x01,
 	UBX_CFG_NAV5	= (UBX_CLASS_CFG << 8) | 0x24,
+	UBX_CFG_TP5	= (UBX_CLASS_CFG << 8) | 0x31,
 	UBX_MON_HW	= (UBX_CLASS_MON << 8) | 0x09,
 	UBX_MON_VER     = (UBX_CLASS_MON << 8) | 0x04,
 	UBX_NAV_CLOCK	= (UBX_CLASS_NAV << 8) | 0x22,
@@ -74,6 +75,7 @@
 	UBX_RXM_RLM	= (UBX_CLASS_RXM << 8) | 0x59,
 	UBX_RXM_SFRBX	= (UBX_CLASS_RXM << 8) | 0x13,
 	UBX_SEC_UNIQID	= (UBX_CLASS_SEC << 8) | 0x03,
+	UBX_TIM_TP	= (UBX_CLASS_TIM << 8) | 0x01,
 };
 
 struct ubx_header {
@@ -180,6 +182,30 @@
 	uint8_t _reserved3[2];
 } __attribute__((packed,aligned(4)));
 
+struct ubx_cfg_tp5 {
+	uint8_t tp_idx;
+	uint8_t version; /* 1 */
+	uint8_t _reserved0[2];
+	int16_t antenna_cable_delay; /* ns */
+	int16_t rf_group_delay; /* ns */
+	uint32_t freq_period; /* Hz or us */
+	uint32_t freq_period_locked; /* Hz or us */
+	uint32_t pulse_len_ratio; /* us or fraction */
+	uint32_t pulse_len_ratio_locked; /* us or fraction */
+	int32_t user_config_delay; /* ns */
+	uint32_t flags;
+		/* 0x3800 - sync manager */
+		/* 0x0780 - grid to use */
+		/*   0 = UTC, 1 = GPS, 2 = GLONASS, 3 = BeiDou, 4 = Galileo */
+		/* 0x0040 - polarity (1 = posedge, 0 = negedge) */
+		/* 0x0020 - align to time of week */
+		/* 0x0010 - pulse_len_ratio* are pulse lengths */
+		/* 0x0008 - freq_period* are frequencies */
+		/* 0x0004 - use *_locked when locked to GNSS */
+		/* 0x0002 - lock to GNSS if valid */
+		/* 0x0001 - active */
+} __attribute__((packed,aligned(4)));
+
 struct ubx_nav_posecef {
 	uint32_t itow; /* ms */
 	uint32_t ecefx; /* cm, signed */
@@ -284,6 +310,32 @@
 	uint8_t unique[5];
 } __attribute__((packed,aligned(4)));
 
+struct ubx_tim_tp {
+	uint32_t tow_ms; /* ms */
+	uint32_t tow_subms;
+	int32_t qerr;
+	uint16_t week;
+	uint8_t flags;
+		/* 0x0c - (T)RAIM (0 = not avail, 1 = not active, 2 = active) */
+		/* 0x02 - UTC available */
+		/* 0x01 - time base (0 = GNSS, 1 = UTC) */
+	uint8_t ref_info;
+		/* 0xf0 - UTC standard */
+		/*   0 = info not available */
+		/*   1 = Communications Research Laboratory (CRL) */
+		/*   2 = NIST */
+		/*   3 = USNO */
+		/*   4 = BIPM */
+		/*   5 = European Laboratory (tbd) */
+		/*   6 = Former Soviet Union (SU) */
+		/*  15 = unknown */
+		/* 0x0f - GNSS reference (when time base == 0 == GNSS) */
+		/*   0 = GPS */
+		/*   1 = GLONASS */
+		/*   2 = BeiDou */
+		/*  15 = unknown */
+} __attribute__((packed,aligned(4)));
+
 extern void ubx_init_queue(void);
 extern const char *ubx_msg_name(enum ubx_msg_id id);
 extern int send_ubx(int fd, enum ubx_msg_id id, const void *data,