Is there a reason why some enums in SDK are without a typedef and why the functions do not use the enum types as parameters?

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

Is there a reason why some enums in SDK are without a typedef and why the functions do not use the enum types as parameters?

Jump to solution
1,058 Views
imxrtuser
Senior Contributor I

Hello,

I am using SDK 2.7.0 for RT1020 with eDMA driver 2.3.0.

I just realized that the SDK API is sometimes referring to enums which do not have a typedef. For example the eDMA API provides the function

pastedImage_1.png

As mask I should use the type _edma_channel_status_flags_t but this type is not defined in eDMA SDK driver 2.3.0 for RT1020 because the enum is included in fsl_edma.h as the following statement

/*!@brief _edma_channel_status_flags eDMA channel status flags. */
enum
{
    kEDMA_DoneFlag      = 0x1U, /*!< DONE flag, set while transfer finished, CITER value exhausted*/
    kEDMA_ErrorFlag     = 0x2U, /*!< eDMA error flag, an error occurred in a transfer */
    kEDMA_InterruptFlag = 0x4U, /*!< eDMA interrupt flag, set while an interrupt occurred of this channel */
};

The typedef is missing here. That is also the reason why you can't find it easily in the HTML API documentation with the search function.

The same is true for the enum _edma_error_status_flags and _edma_transfer_status.

Is there a reason why some enums in SDK are without a typedef?

Why are the enums not used as parameter types in functions instead of a parameter uint32_t mask and then specifying in the documentation that you should use the enum values?

Kind regards,

Stefan

0 Kudos
Reply
1 Solution
1,000 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Stefan,

Thanks for your reply.
Okay, I'll make your proposal to the SDK team in the next round of field trials of the SDK library.

Have a great day,

TIC

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

View solution in original post

0 Kudos
Reply
3 Replies
1,000 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Stefan Mitterhauser ,

Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
I consider it's just a code style that makes the code look cleaner.

Have a great day,
TIC

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply
1,000 Views
imxrtuser
Senior Contributor I

Hi Jeremy,

thank you for answering my question.

I consider it's just a code style that makes the code look cleaner.

Okay that is a decision made for the uint32_t mask parameter, but I still think that the missing typedef for the enum is just a mistake.

You can not properly search for them in the API documentation and you can not use the enum as a local variable in your code because it has no name.

Why should only a few enums not have a typedef while most enums have one?

Kind regards,

Stefan

0 Kudos
Reply
1,001 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Stefan,

Thanks for your reply.
Okay, I'll make your proposal to the SDK team in the next round of field trials of the SDK library.

Have a great day,

TIC

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos
Reply