From fa258414f8d1d6dec4fa565602eba5574c6fa7a1 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Thu, 27 Jun 2024 16:04:04 +0000 Subject: [PATCH] Update Zephyr MSDK Hal based on MSDK PR: https://github.com/analogdevicesinc/msdk/pull/1060 --- MAX/Libraries/PeriphDrivers/Source/CSI2/csi2_reva.c | 13 ++++++++++++- MAX/Libraries/PeriphDrivers/Source/SYS/sys_me14.c | 4 +++- MAX/msdk_sha | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/MAX/Libraries/PeriphDrivers/Source/CSI2/csi2_reva.c b/MAX/Libraries/PeriphDrivers/Source/CSI2/csi2_reva.c index dd3512b8..c2e4e534 100644 --- a/MAX/Libraries/PeriphDrivers/Source/CSI2/csi2_reva.c +++ b/MAX/Libraries/PeriphDrivers/Source/CSI2/csi2_reva.c @@ -37,6 +37,7 @@ #include "dma.h" #include "dma_reva.h" #include "mcr_regs.h" +#include "tmr.h" /* **** Definitions **** */ @@ -67,6 +68,8 @@ ((x) == 2) ? DMA2_IRQn : \ DMA3_IRQn)) +#define MAX_G_FRAME_COMPLETE_US 1500000 // 1.5 seconds + /* **** Globals **** */ static volatile uint32_t dphy_rdy; @@ -361,7 +364,15 @@ int MXC_CSI2_RevA_CaptureFrameDMA() interrupt handler. (MXC_CSI2_RevA_Handler) */ - while (!g_frame_complete) {} + MXC_TMR_SW_Start(MXC_TMR0); // runs in microseconds + + while (!g_frame_complete) { + if (MXC_TMR_TO_Elapsed(MXC_TMR0) > MAX_G_FRAME_COMPLETE_US) { + MXC_CSI2_RevA_Stop((mxc_csi2_reva_regs_t *)MXC_CSI2); + return E_NO_RESPONSE; + } + } + MXC_TMR_SW_Stop(MXC_TMR0); if (!csi2_state.capture_stats.success) return E_FAIL; diff --git a/MAX/Libraries/PeriphDrivers/Source/SYS/sys_me14.c b/MAX/Libraries/PeriphDrivers/Source/SYS/sys_me14.c index d22d481b..142244fa 100644 --- a/MAX/Libraries/PeriphDrivers/Source/SYS/sys_me14.c +++ b/MAX/Libraries/PeriphDrivers/Source/SYS/sys_me14.c @@ -82,9 +82,11 @@ int MXC_SYS_GetUSN(uint8_t *usn, uint8_t *checksum) // Compute the checksum if (checksum != NULL) { + uint8_t usn_copy[MXC_SYS_USN_CHECKSUM_LEN] = { 0 }; uint8_t check_csum[MXC_SYS_USN_CHECKSUM_LEN]; uint8_t key[MXC_SYS_USN_CHECKSUM_LEN]; + memcpy(usn_copy, usn, MXC_SYS_USN_LEN); /* Initialize the remainder of the USN and key */ memset(key, 0, MXC_SYS_USN_CHECKSUM_LEN); memset(checksum, 0, MXC_SYS_USN_CSUM_FIELD_LEN); @@ -94,7 +96,7 @@ int MXC_SYS_GetUSN(uint8_t *usn, uint8_t *checksum) checksum[0] = ((infoblock[4] & 0x007F8000) >> 15); MXC_TPU_Cipher_Config(MXC_TPU_MODE_ECB, MXC_TPU_CIPHER_AES128); - MXC_TPU_Cipher_AES_Encrypt((const char *)usn, NULL, (const char *)key, + MXC_TPU_Cipher_AES_Encrypt((const char *)usn_copy, NULL, (const char *)key, MXC_TPU_CIPHER_AES128, MXC_TPU_MODE_ECB, MXC_AES_DATA_LEN, (char *)check_csum); diff --git a/MAX/msdk_sha b/MAX/msdk_sha index 74b156ce..1f265ecd 100644 --- a/MAX/msdk_sha +++ b/MAX/msdk_sha @@ -1 +1 @@ -e6474dec891fbcaf84802f0b8d7183aa418373b0 +dbd8bc5e5e28a98a8d2d3a6f6be334e858411c8d