Structure Member Support from Inline Assembly

<< Click to Display Table of Contents >>

Navigation:  ETEC 'C' Compiler Information >

Structure Member Support from Inline Assembly

Previous pageReturn to chapter overviewNext page

Members of channel frame or global variables that are structures can be accessed using C notation in inline assembly. This removes the need for error prone hardcoded offsets. Although less likely to be needed, array variables can also be referenced using the C '[]' syntax, as a long as the index is a constant (and thus the address is static). Below is an example from the NXP set 4 ACIMVC function.

For example try changing from:

struct ACIMVC_channel_params 

   int24 period; 

   int24 start_offset; 

   // ... 

   d_q_t i_dq_desired; 

   // ... 

};

 

// ETPU Function ACIMVC 

void ACIMVC( struct ACIMVC_channel_params this ) 

{

   // ...

 

   // load member q of member i_dq_desired of structure 

   // variable this 

   #asm( ram p <- this.i_dq_desired.q. ) 

 

   // ...