iMX6's bufdesc structure changed from SDK L3.0.35_4.0.0_130424

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

iMX6's bufdesc structure changed from SDK L3.0.35_4.0.0_130424

469 Views
liujianbo
Contributor II

Hi Experts:

In linux latest mainline's iMX6 fec driver, the bufdesc structure use the first 2 bytes as Control and Status info, but from the SDK L3.0.35_4.0.0_130424, it use the first two bytes as Data length, which one is right?

From SDK 3.0.35, it add a patch:

/***************************************/

/*

   *     Define the buffer descriptor structure.

   */

-#if defined(CONFIG_ARCH_MXC) || defined(CONFIG_SOC_IMX28)

+#if defined(CONFIG_ARCH_MXC) || defined(CONFIG_SOC_IMX28) || \

+                               defined(CONFIG_ARCH_MX6)

/***************************************/

The specific codes is here listed:

/************************************************************************************/

/*

*      Define the buffer descriptor structure.

*/

#if defined(CONFIG_ARCH_MXC) || defined(CONFIG_SOC_IMX28) || \

                                defined(CONFIG_ARCH_MX6)

struct bufdesc {

        unsigned short cbd_datlen;      /* Data length */

        unsigned short cbd_sc;  /* Control and status info */

        unsigned long cbd_bufaddr;      /* Buffer address */

#ifdef CONFIG_ENHANCED_BD

        unsigned long cbd_esc;

        unsigned long cbd_prot;

        unsigned long cbd_bdu;

        unsigned long ts;

        unsigned short res0[4];

#endif

};

#else

struct bufdesc {

        unsigned short  cbd_sc;                 /* Control and status info */

        unsigned short  cbd_datlen;             /* Data length */

        unsigned long   cbd_bufaddr;            /* Buffer address */

};

#endif

/************************************************************************************/

When we build MX6 project, it will use deferent bufdesc with before.

You can found this structure in drivers/net/ethernet/freescale/fec.h, why this modification happened, and which one is right(latest mainline and SDK)?

And iMX6 have several EVM, if all of them are little endian?

Thanks a lot!!

Labels (2)
Tags (1)
0 Kudos
1 Reply

327 Views
Yuri
NXP Employee
NXP Employee

ENET (FEC) Buffer Descriptors may be described as following :

typedef struct BufferDescriptor
{
U16 length;      // transfer length  - this field is Low Significant 16-bit field of 32-bit word
U16 cstatus;     // control and status - Most Significant 16-bit field
U32 addr;        // buffer address

}BD;

    

  Please pay attention, the first structure field is length, not status as it may be shown
in the Reference Manual. This is because of little endian mode of the ARM core. 

Have a great day,
Yuri

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

0 Kudos