Assert Macro in Kinetis SDK

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Assert Macro in Kinetis SDK

跳至解决方案
1,596 次查看
guenter_loettrich
NXP Employee
NXP Employee

Hi,

can you please explain what the macro "assert" in fsl_edma.c does?

void EDMA_InstallTCD(DMA_Type *base, uint32_t channel, edma_tcd_t *tcd)
{
assert(channel < (uint32_t)FSL_FEATURE_EDMA_MODULE_CHANNEL);
assert(tcd != NULL);
assert(((uint32_t)tcd & 0x1FU) == 0U);

Especially the last one is of interest and what its purpose is.

Thanks

Guenter

0 项奖励
回复
1 解答
1,593 次查看
ErichStyger
Specialist I

that last assert ensures that the pointer is pointing to an address of a multiple of 32.

I did not check the details of that DMA implementation, but it is common that things point to a buffer with a multiple size of some kind, so pointing to something with a multiple of 32 (or better: aligned to a multiple-of-32) makes sense.

You would need to check the DMA implementation/data sheet, I'm sure there should be a reference about this somewhere.

I hope this helps,

Erich

在原帖中查看解决方案

1 回复
1,594 次查看
ErichStyger
Specialist I

that last assert ensures that the pointer is pointing to an address of a multiple of 32.

I did not check the details of that DMA implementation, but it is common that things point to a buffer with a multiple size of some kind, so pointing to something with a multiple of 32 (or better: aligned to a multiple-of-32) makes sense.

You would need to check the DMA implementation/data sheet, I'm sure there should be a reference about this somewhere.

I hope this helps,

Erich