Skip to content

Commit

Permalink
Update Zephyr MSDK Hal based on MSDK PR: analogdevicesinc/msdk#1060
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user authored and ozersa committed Sep 11, 2024
1 parent 357363a commit fa25841
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
13 changes: 12 additions & 1 deletion MAX/Libraries/PeriphDrivers/Source/CSI2/csi2_reva.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "dma.h"
#include "dma_reva.h"
#include "mcr_regs.h"
#include "tmr.h"

/* **** Definitions **** */

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 3 additions & 1 deletion MAX/Libraries/PeriphDrivers/Source/SYS/sys_me14.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion MAX/msdk_sha
Original file line number Diff line number Diff line change
@@ -1 +1 @@
e6474dec891fbcaf84802f0b8d7183aa418373b0
dbd8bc5e5e28a98a8d2d3a6f6be334e858411c8d

0 comments on commit fa25841

Please sign in to comment.