Assert Macro in Kinetis SDK

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Assert Macro in Kinetis SDK

ソリューションへジャンプ
1,587件の閲覧回数
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,584件の閲覧回数
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,585件の閲覧回数
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