Skip to content

Commit 062cfe9

Browse files
committed
Added Infineon CyHal SPI support.
1 parent d915287 commit 062cfe9

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

hal/tpm_io_infineon.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,22 @@
162162
#endif
163163

164164
#if defined(CY_USING_HAL)
165+
#include "cyhal_spi.h"
165166
int TPM2_IoCb_Infineon_SPI(TPM2_CTX* ctx, const byte* txBuf,
166167
byte* rxBuf, word16 xferSz, void* userCtx)
167168
{
169+
cyhal_spi_t* spi = (cyhal_spi_t*)userCtx;
170+
cy_rslt_t result;
168171

172+
if (userCtx == NULL) {
173+
return BAD_FUNC_ARG;
174+
}
175+
176+
result = cyhal_spi_transfer(spi, txBuf, xferSz, rxBuf, xferSz, 0);
177+
if (result != CY_RSLT_SUCCESS) {
178+
return TPM_RC_FAILURE;
179+
}
180+
return TPM_RC_SUCCESS;
169181
}
170182
#elif defined(WOLFTPM_INFINEON_TRICORE)
171183

0 commit comments

Comments
 (0)