This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

PROCESSOR-SDK-DRA8X-TDA4X: HrH search logic in Can_mcanGetMailboxObj

Part Number: PROCESSOR-SDK-DRA8X-TDA4X

Hello,

I used TDA4x RTOS MCAL software.

When I test CAN Rx message, MCAL CAN call to CanIf with incorrect HrH value. So I checked MCAL CAN source code, I found strange HrH checking logic.

Function name is "Can_mcanGetMailboxObj", I think it can search proper HrH using double 'for' loop.

If this function find matched HrH in inner 'for' loop, execute the 'break;'. But can't break outer 'for' loop. At result 'htrh' has always max count number.

Could you please check this logic? I think it needs to change from 'break' to 'return htrh'.

CAN_FUNC_TEXT_SECTION static uint32 Can_mcanGetMailboxObj(

    const Can_ControllerObjType *controllerObj,

    const Can_MailboxObjType *canMailbox, uint32 maxMbCnt,

    uint32 canIdentifier)

{

    uint32 htrh, hwFilterIdx;

    Can_HwFilterType  *pHwFilter;

 

    for (htrh = 0U; htrh < maxMbCnt; htrh++)

    {

        for (hwFilterIdx = 0U;

             hwFilterIdx < canMailbox[htrh].mailBoxConfig.HwFilterCnt;

             hwFilterIdx++)

        {

            pHwFilter = canMailbox[htrh].mailBoxConfig.

                                HwFilterList[hwFilterIdx];

            uint32 tmpIdValue = pHwFilter->IDValue;

            /* Check for Controller type and Active state as well

             * as MailBox Direction */

            if ((CAN_MAILBOX_DIRECTION_RX ==

                                canMailbox[htrh].mailBoxConfig.MBDir)

                && ((boolean) TRUE ==

                controllerObj->canControllerConfig_PC.CntrActive) &&

                /* ANDing with XTD_MSGID_MASK as that is maximum range for both

                 * standard and extended type of identifier */

               ((canIdentifier & XTD_MSGID_MASK) ==

                        (tmpIdValue & XTD_MSGID_MASK)))

            {

                break;

            }

        }

    }

 

    return htrh;

}