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.

Unexpected using of XDM_ErrorBit values

 

Hello,

 

I think, there is a small (negligible) issue in algorithm generating wizards and codes examples too.

 

The XDM_ErrorBit values are very often used in wizard generated source files (and the codec examples too).

The problem is, that this values is bitpositions originally (defined in xdm.h), and in the samples these are used as their values.

 

For example, this XDM_ErrorBit value in universal_copy.c of universal_copy example is used in the following form:

 

        outArgs->extendedError = XDM_UNSUPPORTEDPARAM;

 

In this case, extendedError will be 14 instead of (1 << 14), which would equal to 0x4000.

If anybody in the application (or in codec itself) wants to check this value using macro XDM_ISUNSUPPORTEDPARAM(x) will got unexpected result.

 

Although this issue not critical, inexperienced software developers unnecessary spend their time with searching errors.

 

Peter

 

 

  • Peter,

     

    You  are referring this for which codec and implemented for which device. This will help us to correct the problem as reported by you.

     

    Regards

    Deepak Poddar

  •  

     

    Dear Deepak,

     

    I think, it is device and codec independent.
    Rather, it is a general issue.


    When you want to create a new codec you can:

    - use ti.xdais.wizards.genalg wizard,
    - use ti.sdo.ce.wizards.gencodecpkg wizard, or
    - use sample codec (e.g. <xdais_root>\examples\ti\xdais\dm\examples\universal_copy)

    All of them (I've tried more than one interfaces) generate an "empty" codec with its source files (*.c, *.h, etc.).
    For example, In source files you can find the following line:

            outArgs->extendedError = XDM_UNSUPPORTEDPARAM;

    The XDM_UNSUPPORTEDPARAM is a value of an enumeration type (XDM_ErrorBit), which is defined in header xdm.h.
    The main problem/question is about the interpreting of this type and value:

    - this is a bit position, e.g. "b14" (as the XDM_ErrorBit name, the comments and the macros are suggest), or
    - this is an error code, e.g. "14" (as listed in the generated source file)

    I think, if you do not pay attention about this, you can be in trouble...


    Peter

     

     

     

  • Hi Peter,

    You are exactly right, thanks for catching this issue and pointing it out to us. I have verified the issue and we will fix this in the next CE release, here's the CQ entry if you'd like to track it:-

    SDOCM IR:- SDOCM00083904 Codec generated using genalg gencodecpkg wizards populates outArgs->extendedError wrongly

    The solution, as you have also mentioned, is to generate source codec that treats the XDM_ErrorBit as a bit position (per the spec in xdm.h). So something like:-

    outArgs->base.extendedError = 0x1 << XDM_UNSUPPORTEDPARAM;

    Thanks,

    Gunjan.

  •  

     

    Hi Gunjan,

    Thanks, this is great!

    Peter

     

     

     

  • FYI, there are some utility macros available to help with the bit assignments:

            XDM_SETUNSUPPORTEDPARAM(outArgs->base.extendedError);

    Chris