KSDK-1.1.0 EDMA documentation error?

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

KSDK-1.1.0 EDMA documentation error?

549 Views
oaf
Contributor IV

This is the HTML documentation for KSDK v.1.1

18837_18837.pngpastedImage_0.png

Telling to use kEDMATransferSize_2Bytes as size argument,

BUT when open the EDMA_DRV_ConfigLoopTransfer source code the size is transfered to kEDMATransferSize_XBytes!!!

This must be an error???

 

edma_status_t EDMA_DRV_ConfigLoopTransfer(

                            edma_chn_state_t *chn, edma_software_tcd_t *stcd,

                            edma_transfer_type_t type,

                            uint32_t srcAddr, uint32_t destAddr, uint32_t size,

                            uint32_t bytesOnEachRequest, uint32_t totalLength, uint8_t number)

{

    assert(stcd);

 

    uint8_t i;

    edma_software_tcd_t *stcdAddr = (edma_software_tcd_t *)STCD_ADDR(stcd);

    edma_transfer_size_t transfersize;

    edma_transfer_config_t config;

 

    /* Set the software TCD memory to default value. */

    memset(stcdAddr, 0, number * sizeof(edma_software_tcd_t));

 

    /* translate the transfer size to eDMA allowed transfer size enum type. */

    switch(size)

    {

        case 1:

            transfersize = kEDMATransferSize_1Bytes;

            break;

        case 2:

            transfersize = kEDMATransferSize_2Bytes;

            break;

        case 4:

            transfersize = kEDMATransferSize_4Bytes;

            break;

        case 16:

            transfersize = kEDMATransferSize_16Bytes;

            break;

        case 32:

            transfersize = kEDMATransferSize_32Bytes;

            break;

        default:

            return kStatus_EDMA_InvalidArgument;

    }

Labels (1)
Tags (2)
0 Kudos
3 Replies

317 Views
adriancano
NXP Employee
NXP Employee

Hi,

I am not sure what you mean with: "BUT when open the EDMA_DRV_ConfigLoopTransfer source code the size is transfered to kEDMATransferSize_XBytes!!!" but I think you are getting confused with the documentation.

The SIZE parameter is to set the size of the destination address and the source address that should be the same. That is the reason why the driver is resolving the parameter size for the transfersize variable with the values  kEDMATransferSize_XBytes. The SIZE parameter is used to set the value of the DMA_TCDn_ATTR register of the DMA. Please refer to the image below for your reference.

attr dma.png

I hope this solves your queries.


Hope this information can help you

Best Regards,
Adrian Sanchez Cano
Technical Support Engineer
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

317 Views
oaf
Contributor IV

Hi,

I'm trying to explain what I mean.

The DMA_TCDn_Attr field should be filled in with the edma_transfer_size_t enum values

/*! @brief eDMA transfer configuration */

typedef enum _edma_transfer_size {

    kEDMATransferSize_1Bytes = 0x0U,

    kEDMATransferSize_2Bytes = 0x1U,

    kEDMATransferSize_4Bytes = 0x2U,

    kEDMATransferSize_16Bytes = 0x4U,

    kEDMATransferSize_32Bytes = 0x5U

} edma_transfer_size_t;

which are defined in the platform\hal\inc\fsl_edma_hal.h.

This is performed by the EDMA driver.

I on the other hand uses this API:

edma_status_t EDMA_DRV_ConfigLoopTransfer(

                            edma_chn_state_t *chn, edma_software_tcd_t *stcd,

                            edma_transfer_type_t type,

                            uint32_t srcAddr, uint32_t destAddr, uint32_t size,

                            uint32_t bytesOnEachRequest, uint32_t totalLength, uint8_t number)

And when studying the manual file:///C:/Freescale/KSDK_1.1.0/doc/Kinetis%20SDK%20v.1.1%20API%20Reference%20Manual/group__edma__driver.html#ga2cbe648d04e75b237eaa21f68fafa11c

it show an example of how to use this API, which suggest kEDMATransferSize_2Bytes for the 'size' parameter.

This could NOT be correct as the enum (shown above) don't have any value for 32, which is needed in the forementioned switch (KSDK_1.1.0\platform\drivers\src\edma\fsl_edma_driver.c

aproximately at line 450)

0 Kudos

317 Views
adriancano
NXP Employee
NXP Employee

Hi,

Thank you for the clarification, I see what you mean.

This is a documentation error for sure. The API EDMA_DRV_ConfigLoopTransfer is in charge of translate the "size" parameter into the correct value for the DMA_TCDn_Attr field, therefore in the given example the values from the enum: kEDMATransferSize_XBytes should not be used because it configures the values of the edma_transfer_config_t config wrong.

The valid values for the size parameter should be like the listed in the EDMA_DRV_ConfigLoopTransfer code: 1, 2, 4, 16 or 32 bytes for the transfer size. I will report this issue, thank your for you contribution.


Hope this information can help you

Best Regards,
Adrian Sanchez Cano
Technical Support Engineer
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos