From e54166d028ed6c32324d24fc28c54c8194906c60 Mon Sep 17 00:00:00 2001
From: zhangbo <zhangbo@qq.com>
Date: 星期一, 24 二月 2025 16:38:27 +0800
Subject: [PATCH] 测试阶段:可以跟多个UWB基站测距,以及蓝牙协议转发,现在上传协议是强制写进去的,然后还有那个基站,标签时间同步没有调试正常,

---
 keil/include/drivers/mk_mac.h |   42 ++++++++++++++++++++++++++++++++++--------
 1 files changed, 34 insertions(+), 8 deletions(-)

diff --git a/keil/include/drivers/mk_mac.h b/keil/include/drivers/mk_mac.h
index 8297f3a..4b2c5d6 100644
--- a/keil/include/drivers/mk_mac.h
+++ b/keil/include/drivers/mk_mac.h
@@ -47,12 +47,24 @@
  * @{
  */
 
+// 32us
+#define PHY_LIFS_PERIOD_MACCLK (2000) /* MAC 62.4 MHz clock, each step ~16ns */
+#define PHY_SIFS_PERIOD_MACCLK (2000) /* MAC 62.4 MHz clock, each step ~16ns */
+
+// 80us
+#define PHY_LIFS_PERIOD_MACCLK_LONG (5000) /* MAC 62.4 MHz clock, each step ~16ns */
+#define PHY_SIFS_PERIOD_MACCLK_LONG (5000) /* MAC 62.4 MHz clock, each step ~16ns */
+
 /** UWB TX success */
 #define UWB_TX_OK (0)
-/** UWB RX success */
-#define UWB_RX_OK (0)
+
 /** UWB TX error */
 #define UWB_TX_ERR (1 << 0)
+/** UWB TX missed error */
+#define UWB_TX_MISSED_ERR (1 << 8)
+
+/** UWB RX success */
+#define UWB_RX_OK (0)
 
 /**
  * UWB RX error code description:
@@ -78,6 +90,8 @@
 /** UWB RX STS error */
 #define UWB_STS_ERR (1 << 6)
 
+/** UWB RX missed error */
+#define UWB_RX_MISSED_ERR (1 << 8)
 /** UWB RX MAC HW and SW conflict in use AES */
 #define UWB_MAC_AES_CONFLICT_ERR (1 << 9)
 /** UWB RX MAC frame auxiliary security header error */
@@ -85,7 +99,7 @@
 /** UWB RX PHY error */
 #define UWB_PHY_ERR (1 << 11)
 /** UWB RX MAC frame filter error */
-#define UWB_MAC_FILER_ERR (1 << 12)
+#define UWB_MAC_FILTER_ERR (1 << 12)
 /** UWB RX MAC frame format error */
 #define UWB_MAC_FRAME_ERR (1 << 13)
 /** UWB RX MAC frame decryption error */
@@ -209,15 +223,22 @@
 
 /**
  * @brief Set IFS
- * @param[in] mode              1: Long IFS, 0: Short IFS
+ * @param[in] l_ifs              Long IFS, unit: MAC 62.4 MHz clock
+ * @param[in] s_ifs              Short IFS, unit: MAC 62.4 MHz clock
  */
-void mac_ifs_set(uint8_t mode);
+void mac_ifs_set(uint16_t l_ifs, uint16_t s_ifs);
 
 /**
  * @brief Enable/Disable RSSI calculation in MAC interrupt handler, the RSSI value will be reported in MAC_HW_REPORT_T
  * @param[in] en                1: Enable, 0: Disable
  */
 void mac_rssi_calculation_en(uint8_t en);
+
+/**
+ * @brief Enable/Disable AGC gain check to fix rx saturation timeout issue
+ * @param[in] en                1: Enable, 0: Disable
+ */
+void mac_agc_gain_check_en(uint8_t en);
 
 /**
  * @brief Program the MAC to transmit UWB packet.
@@ -261,6 +282,11 @@
 void mac_pending_tx_evt_clear(void);
 
 /**
+ * @brief Clear the pending MAC RX event.
+ */
+void mac_pending_rx_evt_clear(void);
+
+/**
  * @brief Check the MAC busy state.
  * @return MAC busy state
  */
@@ -300,10 +326,10 @@
 
 /**
  * @brief Get MAC CCM key and Nonce informantion, for debug purpose, this API should be called in MAC RX done process handler.
- * @param[out] ccm_key          Pointer of the CCM key buffer
- * @param[out] nonce            Pointer of the Nonce buffer
+ * @param[out] ccm_key          CCM key buffer
+ * @param[out] nonce            Nonce buffer
  */
-void mac_ccm_key_nonce_get(uint32_t **ccm_key, uint32_t **nonce);
+void mac_ccm_key_nonce_get(uint32_t ccm_key[4], uint32_t nonce[4]);
 
 #ifdef __cplusplus
 }

--
Gitblit v1.9.3