Assert Macro in Kinetis SDK

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Assert Macro in Kinetis SDK

Jump to solution
1,589 Views
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 Kudos
Reply
1 Solution
1,586 Views
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

View solution in original post

1 Reply
1,587 Views
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