From 387d1ffc16ce9e050403baee0ed07f3d9accf632 Mon Sep 17 00:00:00 2001 From: chen <15335560115@163.com> Date: 星期五, 04 七月 2025 14:55:15 +0800 Subject: [PATCH] 初步移植完成0.6.8SDK,但发送有len太长未找到原因 --- keil/include/drivers/mk_mac.h | 53 +++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 43 insertions(+), 10 deletions(-) diff --git a/keil/include/drivers/mk_mac.h b/keil/include/drivers/mk_mac.h index 8297f3a..56c6390 100644 --- a/keil/include/drivers/mk_mac.h +++ b/keil/include/drivers/mk_mac.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019-2023 Beijing Hanwei Innovation Technology Ltd. Co. and + * Copyright (c) 2019-2025 Beijing Hanwei Innovation Technology Ltd. Co. and * its subsidiaries and affiliates (collectly called MKSEMI). * * All rights reserved. @@ -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: @@ -77,7 +89,10 @@ #define UWB_TO_ERR (1 << 5) /** UWB RX STS error */ #define UWB_STS_ERR (1 << 6) - +/** UWB Loopback error */ +#define UWB_LOOPBACK_ERR (1 << 7) +/** 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 +100,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 +224,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 +283,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 +327,16 @@ /** * @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]); + +/** + * @brief Set loopback mode, the loopback mode will be cleared automatically in loopback event done interrupt handler + * @param[in] en Enable(1) or disable(0) loopback mode + */ +void mac_loopback_mode_set(bool en); #ifdef __cplusplus } -- Gitblit v1.9.3