Why does the user need to provide DeviceData in every Processor Expert LDD API call?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Why does the user need to provide DeviceData in every Processor Expert LDD API call?

ソリューションへジャンプ
1,023件の閲覧回数
stephenlangstaf
Contributor III

If I create an instance of a driver using Processor Expert, why do I have to pass a DeviceData pointer into the API?

 

For example, if I create a component for the blue LED on my FRDM-KL25Z board named 'LED_BLUE' and of type 'BitIO_LDD', files are created called 'LED_BLUE.c' and 'LED_BLUE.h' and the API functions are prefixed by the name LED_BLUE (e.g. LED_BLUE_Init(), LED_BLUE_PutVal()).

 

I would have thought that this would be enough context for the component to know what object we are talking about without also having to pass LED_BLUE_DeviceData as the first parameter of each function.

 

Couldn't the component store a reference to its own DeviceData? Is there something I am missing?

ラベル(1)
0 件の賞賛
返信
1 解決策
825件の閲覧回数
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Stephen:

Some components require this DeviceData pointer to maintain portability or RTOS compatibility, since this handler stores configuration parameters, component status, events, etc.

However in the case of BitIO_LDD, you are correct that this is a weakness of Processor Expert generated code. Colleague Erich Styger suggests a workaround in his blog:

Optimized BitIO_LDD Programming with Processor Expert | MCU on Eclipse

Regards!

Jorge_Gonzalez

元の投稿で解決策を見る

0 件の賞賛
返信
2 返答(返信)
826件の閲覧回数
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello Stephen:

Some components require this DeviceData pointer to maintain portability or RTOS compatibility, since this handler stores configuration parameters, component status, events, etc.

However in the case of BitIO_LDD, you are correct that this is a weakness of Processor Expert generated code. Colleague Erich Styger suggests a workaround in his blog:

Optimized BitIO_LDD Programming with Processor Expert | MCU on Eclipse

Regards!

Jorge_Gonzalez

0 件の賞賛
返信
825件の閲覧回数
stephenlangstaf
Contributor III

Thanks Jorge,

I see now there is a high(er) level driver 'BitIO' that wraps the 'BitIO_LDD' driver calls, providing the useless DeviceData pointer so I don't have to.

Thanks again,

Steve.

0 件の賞賛
返信