industrialNETworXnetx

Rainer Versteeg

Rainer Versteeg

| 24.10.2008 | 14:30 | 6 replies

Start Ethernet IP Protocol stack at runtime

Hi,

How can i start a Ethernet IP Protocol stack at runtime:

Here is my code:

// -----------------------------------------------------------------
// Funktion             : Starte Ethernet/IP Task                  -
// Übergabe             : Keine                                    -
// Rückgabe             : Keine                                    -
// -----------------------------------------------------------------  
void START_TASK_EIP()
{
 #define DRV_PHY_SIZE (RX_OBJECT_SIZE + \
                      sizeof(RX_PHY_SET_T))
   
    
 //========  Definition XPEC & MAC Instanzen =================   
 RX_XC_SET_T atMyEIPXc[] =    
 {{{"XPEC",RX_PERIPHERAL_TYPE_XC,0},
    RX_XC_TYPE_XPEC,
    0,
    XC_CODE_ETH_STD_XPEC0
  },
 }; 
 RX_XC_SET_T atMyEIPXc1[] =    
 {{{"XMACRPU",RX_PERIPHERAL_TYPE_XC,0},
    RX_XC_TYPE_XMACRPU,
    0,
    XC_CODE_ETH_STD_RPU0
  },
 }; 
 RX_XC_SET_T atMyEIPXc2[] =    
 {{{"XMACTPU",RX_PERIPHERAL_TYPE_XC,0},
    RX_XC_TYPE_XMACTPU,
    0,
    XC_CODE_ETH_STD_TPU0
  },   
 }; 
 //------------------------------------------------------------ 
 
 //========  Definition of the LED Instanzen =================   
 RX_LED_SET_T atMyEIPLed1[] = { 
  {{"MS_GREEN", RX_PERIPHERAL_TYPE_LED, 0},
   {"SYSPIO",RX_PERIPHERAL_TYPE_PIO,0},
   {0},
   {0},
   {0, 0, 0x1},
   {0, 0, 0x1},
   Drv_PioSetupLedOperations,
  },
 };
 RX_LED_SET_T atMyEIPLed2[] = { 
  {{"MS_RED", RX_PERIPHERAL_TYPE_LED, 0},
   {"SYSPIO",RX_PERIPHERAL_TYPE_PIO,0},
   {0},
   {0},
   {0, 0, 0x2},
   {0, 0, 0x2},
   Drv_PioSetupLedOperations,
  },
 }; 
 RX_LED_SET_T atMyEIPLed3[] = { 
  {{"NS_GREEN", RX_PERIPHERAL_TYPE_LED, 0},
   {"SYSPIO",RX_PERIPHERAL_TYPE_PIO,0},
   {0},
   {0},
   {0, 0, 0x4},
   {0, 0, 0x4},
   Drv_PioSetupLedOperations,
  },
 }; 
 RX_LED_SET_T atMyEIPLed4[] = { 
  {{"NS_RED", RX_PERIPHERAL_TYPE_LED, 0},
   {"SYSPIO",RX_PERIPHERAL_TYPE_PIO,0},
   {0},
   {0},
   {0, 0, 0x8},
   {0, 0, 0x8},
   Drv_PioSetupLedOperations,
  },
 };   
 //------------------------------------------------------------ 
 
 //========  Definition XPEC Intterrupt =================
 RX_INTERRUPT_SET_T myXPEC0_Int[] = {  
  {{"COM0",RX_PERIPHERAL_TYPE_INTERRUPT,0},       // Communication Channel, Instance 0 
    SRT_NETX_VIC_IRQ_STAT_com0,                   // Use external communication channel 0 Interrupt 
    27,                                           // Priority 28 
    RX_INTERRUPT_MODE_SYSTEM,                     // Allow interrupt to be a thread 
    RX_INTERRUPT_EOI_AUTO,                        // EOI automatically by RX 
    RX_INTERRUPT_TRIGGER_RISING_EDGE,             // Edge triggered 
    RX_INTERRUPT_PRIORITY_STANDARD,               // Normal Priority 
    RX_INTERRUPT_REENTRANCY_DISABLED,             // Interrupt itself is not reentrant 
    TSK_PRIO_8,                                   // Task Priority 
    TSK_TOK_8,                                    // Task Token 
    1024                                          // Task Stack Size 
  },  
 }; 
 //------------------------------------------------------------ 
 
 
 //========  Definition of the EDD Instances =================
 RX_EDD_MAC_ADDR_T tMyMac0 =
  {
    0x00, 0x6e, 0x65, 0x74, 0x78, 0x22
  };
 
 RX_EDD_PARAMETERS_T MyEdd0Param[]=
 {{RX_EDD_PARAM_MAC_ADDR, &tMyMac0, 0},
  {RX_EDD_PARAM_XPEC_NAME, "XPEC", 0},
  {RX_EDD_PARAM_XMAC_RPU_NAME, "XMACRPU", 0},
  {RX_EDD_PARAM_XMAC_TPU_NAME, "XMACTPU", 0},
  {RX_EDD_PARAM_INTERRUPT_NAME, "COM0", 0},
  {RX_EDD_PARAM_END_OF_LIST}
 };
 
 RX_EDD_SET_T MyXEdd[] = {
  {{"EDD0",RX_PERIPHERAL_TYPE_EDD,0}, // Ethernet Device Driver 
    0,  // use Edd0 
    "Got a nice driver", // NIC name 
    RX_EDD_MODE_DEFAULT,
    FALSE,
    (void*)MyEdd0Param,
    &trXEddHalNetX
  }
 }; 
 //------------------------------------------------------------ 
 
 //========  Definition of the PHY-Instances =================
 RX_PHY_SET_T MyPhy[] = {
  {{"PHY", RX_PERIPHERAL_TYPE_PHY, 0},
    0,
    0,
    0,
    0,
    1,
    {{0x00,0x3b00}},
    FALSE,
  },  
  {{"PHY", RX_PERIPHERAL_TYPE_PHY, 1},
    1,
	/* OUI */ 0,
	/* man part */ 0,
	/* man rev */ 0,
	1,
	{{0x00,0x3b00}},
	FALSE,
  }  
 };   
 //------------------------------------------------------------   
    
 TLR_RESULT  eRslt;       
 TLR_HANDLE  hXC; 
 TLR_HANDLE  hXC1; 
 TLR_HANDLE  hXC2; 
 TLR_HANDLE  hLed1;
 TLR_HANDLE  hLed2;
 TLR_HANDLE  hLed3;
 TLR_HANDLE  hLed4; 
 TLR_HANDLE  hEdd; 
 TLR_HANDLE  hPhy; 
 TLR_HANDLE  hInt;
 TLR_UINT8   uNumCfng;
 void*       pvPer;
 
 
 //====== LED Instanzen erzeugen ================
 eRslt=rX_MemAllocateMemory(&hLed1,DRV_LED_SIZE);
 eRslt=rX_MemAllocateMemory(&hLed2,DRV_LED_SIZE);
 eRslt=rX_MemAllocateMemory(&hLed3,DRV_LED_SIZE);
 eRslt=rX_MemAllocateMemory(&hLed4,DRV_LED_SIZE);
 eRslt=Drv_LedCreateLed(hLed1,&atMyEIPLed1[0]);
 eRslt=Drv_LedCreateLed(hLed2,&atMyEIPLed2[0]);
 eRslt=Drv_LedCreateLed(hLed3,&atMyEIPLed3[0]);
 eRslt=Drv_LedCreateLed(hLed4,&atMyEIPLed4[0]);
 //-----------------------------------------------
 
 //====== Ethernet Phy erzeugen ===========
 eRslt=rX_MemAllocateMemory(&hPhy,DRV_PHY_SIZE);
 eRslt=Drv_PhyCreatePhy(hPhy, &MyPhy[0]);
 //-----------------------------------------------
 
 //====== Security memory driver initialisieren ==
 eRslt=DrvSecInit(pvPer,uNumCfng);
   
 //====== Interrupt für XPEC0 erzeugen ===========
 eRslt=rX_MemAllocateMemory(&hInt,DRV_INTERRUPT_SIZE);
 eRslt=Drv_IntCreateInterrupt(hInt, &myXPEC0_Int[0]);
 //-----------------------------------------------
 
 //====== XPEC und XMAC Instanzen erzeugen =====
 eRslt=rX_MemAllocateMemory(&hXC,DRV_XC_SIZE);
 eRslt=rX_MemAllocateMemory(&hXC1,DRV_XC_SIZE);
 eRslt=rX_MemAllocateMemory(&hXC2,DRV_XC_SIZE);
 eRslt=Drv_XcCreateXc(hXC,&atMyEIPXc[0]);
 eRslt=Drv_XcCreateXc(hXC1,&atMyEIPXc1[0]);
 eRslt=Drv_XcCreateXc(hXC2,&atMyEIPXc2[0]);
 //----------------------------------------------
  
 //====== Ethernet device driver erzeugen ===========
 eRslt=rX_MemAllocateMemory(&hEdd,DRV_EDD_SIZE);
 eRslt=Drv_EddCreateEdd(hEdd, &MyXEdd[0]);
 //-----------------------------------------------
  eRslt=rX_SysCreateTask("EIP_DEMO",                        // Set Identification 
                        (void(FAR*)(void FAR*))TaskEnter_EipDemo,   // Task function to schedule 
                        (void (*)(void*))NULL, 
                        (void*)&auTskStack_rcX_EIS[0],    
                        TSK_STACK_SIZE_EIP_DEMO,
                        RX_TASK_AUTO_START_INIT_WAIT,                // Start task automatically 
                        0,                                 // Threshold to maximum possible value
                        TSK_PRIO_40, TSK_TOK_40,           // Set Priority,and Token ID: TSK_PRIO_3 = Higher as IP 
                        0,                                 // Set Instance to 0 
                        (void (*)(void*))NULL);    
 rXStartNextTask();    
}     

In TaskEnter_EiPDemo the task for the EthernetIP Stack are created.
When i create the RX_EDD_SET_T, RX_XC_SET_T and RX_PHY_SET_T over rX_SysEnterKernelExt and the LED and Task´s at runtime then it works.

Something with the creation of Ethernet device driver (EDD), XC or Phy at runtime is wrong.

Can someone help me ?

Br,
Rainer

Andreas Jacob

Andreas Jacob

Hilscher Gesellschaft fuer Systemautomation mbH

| 27.10.2008 | 11:41

Hi Rainer,

the used order is important.
At first the Interrupts, the PHYs, the XC and at the end the EDD.

It would be very helpful to know the error result code, which you received.

How "big" is your stack? You put some Kb on it. You can allocate it as static. In this case it is handled like a global variable but only access able in the used function.

Rainer Versteeg

Rainer Versteeg

| 27.10.2008 | 15:58

Hi AJ,

I get it !.

After creation of the Phy, an init of the Phy must be done.

//====== Ethernet Phy erzeugen ===========
 eRslt=rX_MemAllocateMemory(&hPhy,DRV_PHY_SIZE);
 eRslt=Drv_PhyCreatePhy(hPhy, &MyPhy[0]);
 eRslt=Drv_PhyIdentifyPhy("PHY",0,hPhy1);
 eRslt=DrvPhyInit(&MyPhy[0],1);
 //-----------------------------------------------

Thank you for your help !

Br,
Rainer

Krasi Gichev

Krasi Gichev

AMK

| 14.06.2011 | 09:12

I have similar problem, but I am unable to solve it.

I am performing dynamic startup of the stack, and I get troubles when I come to the final point - init of the EDD.

The problem is that function Drv_EddCreateEdd() never returns - neither with error not with other status code. No exception or driver fault is reported over registered in EarlyCallback callbacks.

I traced down the actions that are done inside and the Drv_EddCreateEdd() fails when in calls Drv_PhyInitialize(). (Phy instances are already created before this point. Also XCs, FIFO channels, HW timers and interrupts).

I made a test - in my code that creates the phy's I added Drv_PhyInitialize() call. I get same result - Drv_PhyInitialize() does not return, never.

Here are some parts of my code (last line is the added test, normally not present, init of the phy should happen later in the EddCreate function?):

                        eRslt=rX_MemAllocateMemory(&hTmp, DRV_PHY_SIZE);
                        ASSERT_ERROR_RETURN(eRslt);
                        eRslt=Drv_PhyCreatePhy(hTmp, &pstiTmp[uliIndex]);
                        ASSERT_ERROR_RETURN(eRslt);
                        eRslt=Drv_PhyIdentifyPhy(pstiTmp[uliIndex].tCfgHd.szIdn,
                                                 pstiTmp[uliIndex].tCfgHd.uInst,
                                                 &hTmp);
                        eRslt=Drv_PhyInitialize(hTmp); // THE TEST CODE, normally not present
Here is the code around EDD create:
                        RX_EDD_SET_T* pstiTmp = (RX_EDD_SET_T*)pstiCfg->pvPer;
                        for (uliIndex=0; uliIndex < uliPerfCnt; uliIndex ++)
                        {
                          // Init XC channels[]
                          eRslt=rX_MemAllocateMemory(&hTmp, DRV_EDD_SIZE);
                          ASSERT_ERROR_RETURN(eRslt);
                          eRslt=Drv_EddCreateEdd(hTmp, &pstiTmp[uliIndex]); //NEVER RETURNS FROM HERE
                          ASSERT_ERROR_RETURN(eRslt); // NEVER COMES HERE
                          eRslt=Drv_EddIdentifyEdd(pstiTmp[uliIndex].tCfgHd.szIdn,
                                                         pstiTmp[uliIndex].tCfgHd.uInst,
                                                         &hTmp);
                          ASSERT_ERROR_RETURN(eRslt);
Do you have any idea what is wrong with the PHY instance init? I am using directly the RX_PHY_SET_T structures from EIP_Demo (that init both phy's). Is there anything specific that is required by Drv_PhyInitialize() - some kind of pre-requirements - interrupts, leds, gpios? Loaded XC microcodes?
Edit: reading through the forum I saw a topic about dynamic init in rcX. It claims that even in the case of dynamic init, the DrvXXXInit() call must remain in config_netx.c because of usage of global variables. Is this right (is it still valid), I see no reason for this? Probably requirement for calling DrvXXXInit() ( DrvPhyInit() in my case) once, in static config? But what kind of arguments to pass to it? NULLs?
I see that the code above calls DrvPhyInit() after creation of the phy instances. Is this the right way to do it? I expected that DrvPhyInit() is used only in initialization phase (it is claimed that it must be called only during initialization of the rcX system). Also, I see in that code that only one of the PHYs is initialized???
Edit:
Another question or clarification - where is done miimu init and XC microcode load - I suppose that this happens automatically in the EDD init function (controlled by RX_EDD_SET_T type structure)?
Andreas Jacob

Andreas Jacob

Hilscher Gesellschaft fuer Systemautomation mbH

| 20.06.2011 | 15:26

Hello Krasi,

maybe you can post the complete sequence of what you are doing to start the stack. The snippets you provide are not very helpful because it is only a part.

Please do it like Rainer did in his initial post. It includes the complete sequence and his used configuration.

Thanks in advance

Regards
AJ

Krasi Gichev

Krasi Gichev

AMK

| 21.06.2011 | 14:33

Thanks for response.

It is not so easy to post complete configuration. In fact I have two-stage configuration. First stage is static (config.c) and declares only one static task. This task is in fact our "wrapper" around the LOM stack.

Second stage is executed by this static task. It creates dynamically all of the resources that are used by the stack. Configuration structures are taken directly from config.c file of the EIPDemo, just renamed. These structures are passed to my initialization function that performs call of allocate and create driver function for every peripheral resource in the config.

I know that there is something wrong with the order of callings, because the same application runs fine if the init is done statically. I know where exactly the init fails - in Drv_PhyInitializePhy(). So I think that there should be an easy-to-find explanation what could "break" this function.

I am afraid that even if you give the correct order and my dynamic inits starts, I wouldn't know the real reason for the problem. So next time when similar problem appears I will have to wait for support reaction to get the problem fixed. 

Also, I would like to know that I can safely modify the startup in the future - probably separate it in more stages. I don't want to get in similar hanging problem later.

That's why I asked for some more information, to be able to understand the problem. If I get to know what are prerequirements of the Phy driver init function, I will be able to find the problem on my own. And next time when somebody gets into Phy init trouble, all of us will know what is required and what can break it. 

My impression is that there is not-so-well handled situation in this function - because I get no error code in return. 

 

Directly to the point - here are my functions - ALL OF THEM are #if 0 excluded because now they are moved to the static initialization. In my test they were enabled. I don't want to edit them just for posting.

/*
  rcX type resources that are required for EtherNetIP Adapter stack
  (tasks, interrupts, HW configuration)
*/

#include "EipAdapterStackData.h"
/*
************************************************************
*   Stack Inclusion Area
************************************************************
*/
#include "TlrTimer_Functionlist.h"                            /* Include Timer Task specifics header      */
//#include "ShmDemo_Functionlist.h"                             /* Include Shm Demo specifics header        */
#include "EipDemo_Functionlist.h"                             /* Include Packet API Demo specifics header */

#include "TLR_CipProductCode.h"                               /* Include Define of Hilscher Device Codes                */
#include "EipEncap_Functionlist.h"                            /* Include EtherNetIP Adapter Encap Functionlist header   */
#include "EipDLR_Functionlist.h"                              /* Include EtherNetIP Adapter DLR Functionlist header     */
#include "EipCl1_Functionlist.h"                              /* Include EtherNetIP Adapter Cl1 Functionlist header     */
#include "EipObject_Functionlist.h"                           /* Include EtherNetIP Adapter Object Functionlist header  */
#include "EipAps_Functionlist.h"                              /* Include EtherNetIP Adapter APS Functionlist header     */

#include "Hal_EddEthernetIP_DLR.h"                            /* Include EtherNetIP Adapter HAL EDD Functionlist header */
#include "EipObject_Public.h"                                 /* Include EtherNetIP Adapter Object public header        */

#include "TcpipTcpTask_Functionlist.h"                        /* Include Tcpip TcpTask Functionlist header              */





/*
************************************************************
*   Static Variables - Memory for EtherNetIP
************************************************************
*/
 UINT auTskStack_Pck_API_Demo[TSK_STACK_SIZE_PCK_DEMO]; /* Task Packet API Demo stack pointer */
 UINT auTskStack_Tlr_Timer[TSK_STACK_SIZE_TLR_TIMER];   /* Task TLR TIMER stack pointer */
 UINT auTskStack_Tcp_Task[TSK_STACK_SIZE_TCP_TASK];     /* Task TCPIP Task stack pointer */
 UINT auTskStack_EIS_ENCAP[TSK_STACK_SIZE_EIS_ENCAP];   /* Task stack pointer EtherNetIP protocol stack task  */
 UINT auTskStack_EIS_DLR[TSK_STACK_SIZE_EIS_DLR];       /* Task stack pointer EtherNetIP protocol stack task  */
 UINT auTskStack_EIS_CL1[TSK_STACK_SIZE_EIS_CL1];       /* Task stack pointer EtherNetIP protocol stack task  */
 UINT auTskStack_EIS_OBJECT[TSK_STACK_SIZE_EIS_OBJECT]; /* Task stack pointer EtherNetIP protocol stack task  */






/*
************************************************************
*   Definition of the HWTimer-Instances for EtherNetIP stack
************************************************************
 List of HW timers that are required by Hilscher LOM stack
 (our timers are defined in PlaformConfDat.c)
 These will be created dynamically on startup
*/
#if 0
CONST FAR RX_HWTIMER_SET_T atrXHwTim_HiLomStack[] =
{
  {
    {"DLRTIMER", RX_PERIPHERAL_TYPE_TIMER, 0},                /* System Timer               */
    1,                                                        /* Use GPIO_counter1          */
    500,                                                      /* 500 Microseconds = 5µsec   */
    FALSE,                                                    /* Once Mode                  */
    TRUE,                                                     /* Interrupt enabled          */
    FALSE,                                                    /* No External Clock          */
    RX_HWTIMER_TRIGGER_NONE,                                  /* No Trigger                 */
    0,                                                        /* No I/O reference           */
    0                                                         /* No Prescaler               */
  },
};
#endif
/* ****************************************************** */



/*
************************************************************
*   Definition of the Interrupt-Instances for EtherNetIP stack
************************************************************
 List of HW interrupts that are required by Hilscher LOM stack
 (our interrupts are defined in PlaformConfDat.c)
*/
#if 0
CONST FAR RX_INTERRUPT_SET_T atrXInt_HiLomStack[] =
{
  {
    {"DLRTIMER", RX_PERIPHERAL_TYPE_INTERRUPT, 0},            /* DLR Timer Interrupt                            */
    SRT_NETX_VIC_IRQ_STAT_timer1,                             /* Use External Timer1 Interrupt                  */
    EN_Ax_P2_HILOMIF_INTERRUPT_PRIO_DLRTIMER,                     /* Priority 24                                    */
    RX_INTERRUPT_MODE_SYSTEM,                                 /* Allow interrupt to be nested                   */
    RX_INTERRUPT_EOI_AUTO,                                    /* EOI automatically by RX                        */
    RX_INTERRUPT_TRIGGER_RISING_EDGE,                         /* Edge Triggered                                 */
    RX_INTERRUPT_PRIORITY_STANDARD,                           /* Normal Priority                                */
    RX_INTERRUPT_REENTRANCY_DISABLED,                         /* Interrupt Itself is not reentrant              */
  },
  {
    {"COM0", RX_PERIPHERAL_TYPE_INTERRUPT, 0},                /* Communication Channel, Instance 0              */
    SRT_NETX_VIC_IRQ_STAT_com0,                               /* Use external communication channel 0 Interrupt */
    EN_Ax_P2_HILOMIF_INTERRUPT_PRIO_COM0,                         /* Priority 28                                    */
    RX_INTERRUPT_MODE_TASK,                                   /* Allow interrupt to be a thread                 */
    RX_INTERRUPT_EOI_AUTO,                                    /* EOI automatically by RX                        */
    RX_INTERRUPT_TRIGGER_RISING_EDGE,                         /* Edge triggered                                 */
    RX_INTERRUPT_PRIORITY_STANDARD,                           /* Normal Priority                                */
    RX_INTERRUPT_REENTRANCY_DISABLED,                         /* Interrupt itself is not reentrant              */
    AMK_COM0_ISR_TASK_PRIO,                                   /* Task Priority                                  */
    AMK_COM0_ISR_TASK_PRIO,                                   /* Task Token                                     */
    1024                                                      /* Task Stack Size                                */
  },
  {
    {"COM1", RX_PERIPHERAL_TYPE_INTERRUPT, 0},                /* Communication Channel, Instance 0              */
    SRT_NETX_VIC_IRQ_STAT_com1,                               /* Use external communication channel 1 Interrupt */
    EN_Ax_P2_HILOMIF_INTERRUPT_PRIO_COM1,                         /* Priority 27                                    */
    RX_INTERRUPT_MODE_TASK,                                   /* Allow interrupt to be a thread                 */
    RX_INTERRUPT_EOI_AUTO,                                    /* EOI self by RX                                 */
    RX_INTERRUPT_TRIGGER_RISING_EDGE,                         /* Edge triggered                                 */
    RX_INTERRUPT_PRIORITY_STANDARD,                           /* Normal Priority                                */
    RX_INTERRUPT_REENTRANCY_DISABLED,                         /* Interrupt itself is not reentrant              */
    AMK_COM1_ISR_TASK_PRIO,                                   /* Task Priority                                  */
    AMK_COM1_ISR_TASK_PRIO,                                   /* Task Token                                     */
    1024                                                      /* Task Stack Size                                */
  },
  {
    {"MSYNC0", RX_PERIPHERAL_TYPE_INTERRUPT, 0},              /* Motion sync channel, Instance 0                */
    SRT_NETX_VIC_IRQ_STAT_msync0,                             /* Use motion sync 0 interrupt                    */
    EN_Ax_P2_HILOMIF_INTERRUPT_PRIO_MSYNC0,                       /* Priority 17                                    */
    RX_INTERRUPT_MODE_SYSTEM,                                 /* Allow interrupt to be nested                   */
    RX_INTERRUPT_EOI_AUTO,                                    /* EOI automatically by RX                        */
    RX_INTERRUPT_TRIGGER_RISING_EDGE,                         /* Edge triggered                                 */
    RX_INTERRUPT_PRIORITY_STANDARD,                           /* Normal Priority                                */
    RX_INTERRUPT_REENTRANCY_DISABLED,                         /* Interrupt itself is not reentrant              */
    AMK_MSYNC0_ISR_TASK_PRIO,                                 /* Task Priority                                  */
    AMK_MSYNC0_ISR_TASK_PRIO,                                 /* Task Token                                     */
    1024                                                      /* Task Stack Size                                */
  },
  {
    {"MSYNC1", RX_PERIPHERAL_TYPE_INTERRUPT, 0},              /* Motion sync channel, Instance 0                */
    SRT_NETX_VIC_IRQ_STAT_msync1,                             /* Use motion sync 1 interrupt                    */
    EN_Ax_P2_HILOMIF_INTERRUPT_PRIO_MSYNC1,                       /* Priority 16                                    */
    RX_INTERRUPT_MODE_SYSTEM,                                 /* Allow interrupt to be nested                   */
    RX_INTERRUPT_EOI_AUTO,                                    /* EOI automatically by RX                        */
    RX_INTERRUPT_TRIGGER_RISING_EDGE,                         /* Edge triggered                                 */
    RX_INTERRUPT_PRIORITY_STANDARD,                           /* Normal Priority                                */
    RX_INTERRUPT_REENTRANCY_DISABLED,                         /* Interrupt itself is not reentrant              */
    AMK_MSYNC1_ISR_TASK_PRIO,                                 /* Task Priority                                  */
    AMK_MSYNC1_ISR_TASK_PRIO,                                 /* Task Token                                     */
    1024                                                      /* Task Stack Size                                */
  },
}; 
#endif
/* ****************************************************** */


// FIXME: set assignment to correct pins
/*
************************************************************
*   Definition of the LED-Instances for EtherNetIP stack
************************************************************
*/
#if 0
STATIC CONST FAR RX_LED_SET_T atrXLed_HiLomStack[] =
{
  {
    {"MS_GREEN", RX_PERIPHERAL_TYPE_LED, 0},                  /* MS_GREEN LED Object Configuration                        */
    {"SYSPIO", RX_PERIPHERAL_TYPE_PIO, 0},                    /* Register Destination Definition                        */
    {(RX_LED_VALUE_TYPE)0, 0, 0},                             /* Optional Register to make LED Pin to output at startup */
    {(RX_LED_VALUE_TYPE)0, 0, 0},                             /* Optional Register to make LED Pin to output at startup */
    {RX_LED_VALUE_TYPE_OR, 0, 0x01},                          /* LED Enable Register and Value                          */
    {RX_LED_VALUE_TYPE_OR, 0, 0x01},                          /* LED Disable Register and Value                         */
    Drv_PioSetupLedOperations,                                /* Set of LED functions                                   */
  },
  {
    {"MS_RED", RX_PERIPHERAL_TYPE_LED, 0},                    /* MS_RED LED Object Configuration                        */
    {"SYSPIO", RX_PERIPHERAL_TYPE_PIO, 0},                    /* Register Destination Definition                        */
    {(RX_LED_VALUE_TYPE)0, 0, 0},                             /* Optional Register to make LED Pin to output at startup */
    {(RX_LED_VALUE_TYPE)0, 0, 0},                             /* Optional Register to make LED Pin to output at startup */
    {RX_LED_VALUE_TYPE_OR, 0, 0x02},                          /* LED Enable Register and Value                          */
    {RX_LED_VALUE_TYPE_OR, 0, 0x02},                          /* LED Disable Register and Value                         */
    Drv_PioSetupLedOperations,                                /* Set of LED functions                                   */
  },
  {
    {"NS_GREEN", RX_PERIPHERAL_TYPE_LED, 0},                  /* NS_GREEN LED Object Configuration                        */
    {"SYSPIO", RX_PERIPHERAL_TYPE_PIO, 0},                    /* Register Destination Definition                        */
    {(RX_LED_VALUE_TYPE)0, 0, 0},                             /* Optional Register to make LED Pin to output at startup */
    {(RX_LED_VALUE_TYPE)0, 0, 0},                             /* Optional Register to make LED Pin to output at startup */
    {RX_LED_VALUE_TYPE_OR, 0, 0x04},                          /* LED Enable Register and Value                          */
    {RX_LED_VALUE_TYPE_OR, 0, 0x04},                          /* LED Disable Register and Value                         */
    Drv_PioSetupLedOperations,                                /* Set of LED functions                                   */
  },
  {
    {"NS_RED", RX_PERIPHERAL_TYPE_LED, 0},                    /* NS_RED LED Object Configuration                        */
    {"SYSPIO", RX_PERIPHERAL_TYPE_PIO, 0},                    /* Register Destination Definition                        */
    {(RX_LED_VALUE_TYPE)0, 0, 0},                             /* Optional Register to make LED Pin to output at startup */
    {(RX_LED_VALUE_TYPE)0, 0, 0},                             /* Optional Register to make LED Pin to output at startup */
    {RX_LED_VALUE_TYPE_OR, 0, 0x08},                          /* LED Enable Register and Value                          */
    {RX_LED_VALUE_TYPE_OR, 0, 0x08},                          /* LED Disable Register and Value                         */
    Drv_PioSetupLedOperations,                                /* Set of LED functions                                   */
  }
};
#endif


/*
************************************************************
*   Configuration of the PHY-Instances for EtherNetIP stack
************************************************************
 Definition of the PHY-Instances that are required by Hilscher LOM stack
*/
#if 0
CONST FAR RX_PHY_SET_T atrXPhy_HiLomStack[] =
{
  {
    {"PHY", RX_PERIPHERAL_TYPE_PHY, 0},
    0,                                                        /* Physical port number of PHY (MDIO)         */
    0,                                                        /* Organizationally Unique Identifier         */
    0,                                                        /* Manufacturer specific Part Number          */
    0,                                                        /* Manufacturer Revision Number               */
    0,                                                        /* Number of following Registers to write to  */
    {
      {0x00, 0x3b00}                                          /* Register set to write the values to        */
    },
    TLR_FALSE,                                                /* Power down phy on init                     */
    TLR_FALSE,                                                /* Custom init                                */
    6,                                                        /* Custom init, Set PHY to powerdown          */
    TLR_FALSE,                                                /* Custom init, Use auto-crossover            */
    TLR_FALSE                                                 /* Custom init, Enable fiber optics           */
  },
  {
    {"PHY", RX_PERIPHERAL_TYPE_PHY, 1},
    1,                                                        /* Physical port number of PHY  (MDIO)        */
    0,                                                        /* Organizationally Unique Identifier         */
    0,                                                        /* Manufacturer specific Part Number          */
    0,                                                        /* Manufacturer Revision Number               */
    0,                                                        /* Number of following Registers to write to  */
    {
      {0x00, 0x3b00}                                          /* Register set to write the values to        */
    },
    TLR_FALSE,                                                /* Power down phy on init                     */
    TLR_FALSE,                                                /* Custom init                                */
    6,                                                        /* Custom init, Set PHY to powerdown          */
    TLR_FALSE,                                                /* Custom init, Use auto-crossover            */
    TLR_FALSE                                                 /* Custom init, Enable fiber optics           */
  }
};
#endif



/*
************************************************************
*   Configuration of the XC-Instances for EtherNetIP stack
************************************************************
 List of HW interrupts that are required by Hilscher LOM stack
*/
#if 0
STATIC CONST FAR RX_XC_SET_T atrXXc_HiLomStack[] =
{
  {
    {"XPEC", RX_PERIPHERAL_TYPE_XC, 0},                       /* Instance 0                         */
    RX_XC_TYPE_XPEC,                                          /* Type of XC unit is xPEC            */
    0,                                                        /* XC channel 0                       */
    (UINT32*)XcCode_xpec_dlr0,                                /* EtherNetIP DLR xPEC start address  */
  },
  {
    {"XMACRPU", RX_PERIPHERAL_TYPE_XC, 0},                    /* Instance 0                         */
    RX_XC_TYPE_XMACRPU,                                       /* Type of XC unit is xMAC            */
    0,                                                        /* XC channel 0                       */
    (UINT32*)XcCode_rpu_dlr0,                                 /* EtherNetIP DLR xRPU start address  */
  },
  {
    {"XMACTPU", RX_PERIPHERAL_TYPE_XC, 0},                    /* Instance 0                         */
    RX_XC_TYPE_XMACTPU,                                       /* Type of XC unit is xMAC            */
    0,                                                        /* XC channel 0                       */
    (UINT32*)XcCode_tpu_dlr0,                                 /* EtherNetIP DLR xTPU start address  */
  },

  {
    {"XPEC", RX_PERIPHERAL_TYPE_XC, 1},                       /* Instance 1                         */
    RX_XC_TYPE_XPEC,                                          /* Type of XC unit is xPEC            */
    1,                                                        /* XC channel 1                       */
    (UINT32*)XcCode_xpec_dlr1,                                /* EtherNetIP DLR xPEC start address  */
  },
  {
    {"XMACRPU", RX_PERIPHERAL_TYPE_XC, 1},                    /* Instance 1                         */
    RX_XC_TYPE_XMACRPU,                                       /* Type of XC unit is xMAC            */
    1,                                                        /* XC channel 1                       */
    (UINT32*)XcCode_rpu_dlr1,                                 /* EtherNetIP DLR xRPU start address  */
  },
  {
    {"XMACTPU", RX_PERIPHERAL_TYPE_XC, 1},                    /* Instance 1                         */
    RX_XC_TYPE_XMACTPU,                                       /* Type of XC unit is xMAC            */
    1,                                                        /* XC channel 1                       */
    (UINT32*)XcCode_tpu_dlr1,                                 /* EtherNetIP DLR xTPU start address  */
  }
};
#endif

/*
************************************************************
*   (Pointer) Fifo Channels for EtherNetIP stack
************************************************************
 List of (Pointer) Fifo Channels that are required by Hilscher
 LOM stack
*/
#if 0
CONST FAR RX_FIFOCHANNEL_SET_T atFifoChannelSets_HiLomStack[2] =
{
  {
    {"FIFO_CHN0", RX_PERIPHERAL_TYPE_FIFOCHANNEL, 0},         /* FIFO-Channel to be configured  */
    RX_FIFOUNIT_CHANNEL0, 64, 64, 64, 64, 64, 64, 64, 64      /* Depths of 8 FIFOs per Channel  */
  },
  {
    {"FIFO_CHN1", RX_PERIPHERAL_TYPE_FIFOCHANNEL, 0},         /* FIFO-Channel to be configured  */
    RX_FIFOUNIT_CHANNEL1, 64, 64, 64, 64, 64, 64, 64, 64      /* Depths of 8 FIFOs per Channel  */
  }
};
#endif


#if 0
/*
************************************************************
*   Definition of the MAC address for EtherNetIP stack
************************************************************
 List of Definition of the EDD Instances that are required by 
 Hilscher LOM stack
 FIXME: comment to next lines show that we don't need this is we have security memory 
        Check if changes to the initialization is required to use SecMem
*/
CONST FAR RX_EDD_MAC_ADDR_T tMyMac0 =
{
  0x00, 0x02, 0xa2, 0x20, 0x00, 0x00            /* Set EDD packets MAC address (not needed if SecMem is available */
};
#endif

/*
************************************************************
*   Definition of the EDD Instances for EtherNetIP stack
************************************************************
 List of Definition of the EDD Instances that are required by 
 Hilscher LOM stack
*/
#if 0
CONST FAR RX_EDD_PARAMETERS_T atrXEdd0Param_HiLomStack[] =
{
  { RX_EDD_PARAM_MAC_ADDR,        &tMyMac0,           0 },    /* Object name reference for the MAC address        */

  { RX_EDD_PARAM_XPEC_NAME,       "XPEC",             0 },    /* Object name reference for the xPEC               */
  { RX_EDD_PARAM_XMAC_RPU_NAME,   "XMACRPU",          0 },    /* Object name reference for the xMAC RPU           */
  { RX_EDD_PARAM_XMAC_TPU_NAME,   "XMACTPU",          0 },    /* Object name reference for the xMAC TPU           */
  { RX_EDD_PARAM_INTERRUPT_NAME,  "COM0",             0 },    /* Object name reference for the hardware interrupt */
  { RX_EDD_PARAM_FIFO_NAME,       "FIFO_CHN0",        0 },    /* Object name reference for the FIFO               */
  { RX_EDD_PARAM_PHY_NAME,        "PHY",              0 },    /* Object name reference for the PHY                */

  { RX_EIPDLR_EDD_PARAM_MSYNC0_INTERRUPT_NAME, "MSYNC0", 0 }, /* Object name reference for the EIP DLR MSYNC0 interrupt */

  { RX_EDD_PARAM_XPEC1_NAME,      "XPEC",             1 },    /* Object name reference for the xPEC               */
  { RX_EDD_PARAM_XMAC1_RPU_NAME,  "XMACRPU",          1 },    /* Object name reference for the xMAC RPU           */
  { RX_EDD_PARAM_XMAC1_TPU_NAME,  "XMACTPU",          1 },    /* Object name reference for the xMAC TPU           */
  { RX_EDD_PARAM_INTERRUPT1_NAME, "COM1",             0 },    /* Object name reference for the hardware interrupt */
  { RX_EDD_PARAM_FIFO1_NAME,      "FIFO_CHN1",        0 },    /* Object name reference for the FIFO               */
  { RX_EDD_PARAM_PHY1_NAME,       "PHY",              1 },    /* Object name reference for the PHY                */

  { RX_EIPDLR_EDD_PARAM_MSYNC1_INTERRUPT_NAME, "MSYNC1", 0 }, /* Object name reference for the EIP DLR MSYNC1 interrupt */

  { RX_EIPDLR_EDD_PARAM_TASK_NAME, "DLR_IRQ_TSK",     0 },    /* Object name reference for the task name for IRT  */
  { RX_EIPDLR_EDD_PARAM_TASK_PRIO, (void*)AMK_MSYNC0_ISR_TASK_PRIO, 0 },    /* Object name reference for the task prio for IRT  */
  { RX_EIPDLR_EDD_PARAM_TASK_TOK,  (void*)AMK_MSYNC0_ISR_TASK_PRIO, 0 },    /* Object name reference for the task token for IRT */

  { RX_EDD_PARAM_AGING_TIME,      (VOID FAR*)120,     0 },    /* Object name reference for the aging time         */
  { RX_EDD_PARAM_USED_IND_BORDER, (VOID FAR*)7,       0 },    /* Object name reference for the indication border  */
  { RX_EDD_PARAM_END_OF_LIST }                                /* Object name reference for end of list parameter  */
};
#endif



#if 0
/*
************************************************************
*   Definition of the EDD SET for EtherNetIP stack
************************************************************
 List of Definition of the EDD SET that are required by 
 Hilscher LOM stack
*/
CONST FAR RX_EDD_SET_T atrXEdd_HiLomStack[] =
{
  {
    {"EDD0", RX_PERIPHERAL_TYPE_EDD, 0},                      /* Ethernet Device Driver     */
    0,                                                        /* Number of Edd Unit to use  */
    AMK_DEF_EIP_ADAPTER_STACK_NIC_NAME,                       /* NIC name                   */
    RX_EDD_MODE_DEFAULT,                                      /* Edd mode                   */
    FALSE,                                                    /* Resource control disabled  */
    (RX_EDD_PARAMETERS_T*)atrXEdd0Param_HiLomStack,           /* Pointer to parameter array */
    (HAL_EDD_OPERATIONS_T*)&trEddHalDLR,                      /* Pointer to Hal operations  */
  }
};
#endif

#if 0
/*
************************************************************
*   Configuration of the Fieldbus Specific Task for EtherNetIP stack
************************************************************
 Startup parameter EtherNetIP Adapter Encapsulation Task
 that are required by Hilscher LOM stack
*/
CONST FAR EIP_ENCAP_PARAMETER_T g_tEipEncapParameter_HiLomStack[] =
{
  {
    0                                                         /* Dummy */
  }
};
#endif



#if 0
/*
************************************************************
*   Configuration of the Fieldbus Specific Task for EtherNetIP stack
************************************************************
 Startup parameter EtherNetIP Adapter DLR Task
 that are required by Hilscher LOM stack
*/
CONST FAR EIP_DLR_STARTUPPARAMETER_T g_tEipDLRTaskParam[] =
{
  {
    0x00950000,                                               /* ulTaskIdentifier EthernetIP DLR Task */
    EIP_DLR_STARTUP_PARAM_VERSION,                            /* Version of parameter data set        */
    "EDD0",                                                   /* EDD name                             */
    TLR_FALSE,                                                /* Ring SV enable                       */
    0,                                                        /* Precedence                           */
    400,                                                      /* Beacon interval, in micro sec        */
    1960,                                                     /* Beacon timeout, in micro sec         */
    0                                                         /* Vlan identification                  */
  }
};
#endif


/*
************************************************************
*   Configuration of the Fieldbus Specific Task for EtherNetIP stack
************************************************************
 Startup parameter EtherNetIP Adapter CL1 Task
 that are required by Hilscher LOM stack
*/
#if 0
CONST FAR EIP_CL1_STARTUPPARAMETER_T g_tEipCl1TaskParam[] =
{
  {
    TLR_TASK_EIP_CL1,                                         /* ulTaskIdentifier EthernetIP Encapsulation Task Class 1 services  */
    EIP_CL1_STARTUP_PARAM_VERSION,                            /* Version of parameter data set                                    */
    "EDD0",                                                   /* EDD name                                                         */
  }
};
#endif


/*
************************************************************
*   Configuration of the Demo Task for EtherNetIP stack
************************************************************
 Startup parameter EtherNetIP Adapter Object Task
 that are required by Hilscher LOM stack
*/
#if 0
CONST FAR EIP_OBJECT_PARAMETER_T g_tEipObjectParameter[] =
{
  {
    TLR_TASK_EIP_OBJECT,                                      /* ulTaskIdentifier EthernetIP Object Task                    */
    EIP_OBJECT_STARTUP_PARAM_VERSION_V2,                      /* Version of parameter data set                              */
    CIP_VENDORID_HILSCHER,                                    /* Vendor identification                                      */
    PRODUCT_TYP_COMMUNICATION,                                /* Product type                                               */
    PRODUCT_CODE_EIS_NETX500,                                 /* Product code                                               */
    1,                                                        /* Major revision                                             */
    1,                                                        /* Minor revision                                             */
    0,                                                        /* Serial number of the device                                */
    { 15,'N','E','T','X',' ','5','0',                         /* Product name (first byte must be the length of the string) */
    '0',' ','R','E','/','E','I','S',
    0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,
    0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,},
    5000,                                                     /* Timer for trigger the ScanList in ticks                    */
    "EDD0",                                                   /* Edd name port 0                                            */
    NULL,                                                     /* Edd name port 1                                            */
    EIP_INPUTONLY_INSTANCE,                                   /* Instance of the connection point Input Only                */
    EIP_LISTENONLY_INSTANCE,                                  /* Instance of the connection point Listen Only               */
  }
};
#endif

/*
************************************************************
*   Startup parameter EtherNetIP Adapter AP Task (Application) for EtherNetIP stack
************************************************************
 Startup parameter EtherNetIP Adapter AP Task (Application)
 that are required by Hilscher LOM stack
*/
/* Startup parameter EtherNetIP Adapter AP Task (Application) */
#if 0
CONST FAR EIP_DPMINTF_STARTUPPARAMETER_T g_tEipApsTaskParam[] =
{
  {
    TLR_TASK_EIP_APS,                                         /* ulTaskIdentifier EtherNet/Ip Adapter Application-Task  */
    EIP_DPMINTF_STARTUP_PARAM_VERSION_V3,                     /* Version of parameter data set                          */
    "EDD0",                                                   /* EDD name                                               */
    0,                                                        /* Dual Port Memory channel instance                      */
    100,                                                      /* Default input assembly                                 */
    EIP_AS_FLAG_READONLY,                                     /* Default input assembly flags                           */
    101,                                                      /* Default output assembly                                */
    0,                                                        /* Default output assembly flags                          */
  }
};
#endif

#if 0
/*
************************************************************
*   Configuration of the Demo Task for EtherNetIP stack
************************************************************
 Startup parameters EtherNetIP Adapter Packet API demo task
 that are required by Hilscher LOM stack
*/
CONST FAR EIP_DEMO_STARTUPPARAMETER_T g_tPckAPIPrm[] =
{
  {
    TLR_TASK_EIP_DEMO,                                        /* ulTaskIdentifier EtherNetIP Adapter Packet API Demo Task */
    EIP_DEMO_STARTUP_PARAM_VERSION,                           /* Version of parameter data set                            */
  }
};
#endif


/*
************************************************************
*   Configuration of the TLR TIMER Task for EtherNetIP stack
************************************************************
 Configuration of the TLR TIMER Task for EtherNetIP
 that are required by Hilscher LOM stack
*/
#if 0
CONST TLR_TIMER_STARTUPPARAMETER_T tTlrTimerPrm[] =
{
  {
    TLR_TASK_TIMER,                                           /* ulTaskIdentifier TLR Timer Task  */
    1,                                                        /* Version of parameter data set    */
    128,                                                      /* Max. number of application timer */
    10,                                                       /* Max. number of interrupt timer   */
    128,                                                      /* Max. number of retry packets     */
  }
};
#endif


#if 0
/*
************************************************************
*   Configuration of the TCP/IP Interface Timer Task for EtherNetIP stack
************************************************************
 Configuration of the TCP/IP Interface Timer Task
 that are required by Hilscher LOM stack
*/
CONST FAR TLR_TIMER_STARTUPPARAMETER_T tTcpipTimerTaskParam =
{ 
  TLR_TASK_TIMER,                                             /* ulTaskIdentifier TLR Timer Task  */
  1,                                                          /* Version of parameter data set    */
  32,                                                         /* Application timer resouces       */
  2,                                                          /* Interrupt timer resources        */
  2                                                           /* Retry packet resources           */
};
#endif


/*
************************************************************
*   Configuration of the TCP/IP Interface Task for EtherNetIP stack
************************************************************
 Configuration of the TCP/IP Interface Task
 that are required by Hilscher LOM stack
*/
#if 0
CONST FAR TCPIP_TCP_TASK_STARTUPPARAMETER_T tTcpipTcpTaskParam =
{
  TLR_TASK_TCPUDP,                                            /* ulTaskIdentifier TCPUDP task (TCP/IP stack)                  */
  TCPIP_STARTUPPARAMETER_VERSION_5,                           /* ulParamVersion Version of parameter data set                 */
  TCPIP_SRT_QUE_ELEM_CNT_AP_DEFAULT,                          /* TCP/IP stacks process queue size for AP packets              */
  TCPIP_SRT_POOL_ELEM_CNT_DEFAULT,                            /* Size of pool elements for indication packets to AP           */
  TCPIP_SRT_FLAG_DBM
  | TCPIP_SRT_FLAG_ACTIVATE_ACD
  | TCPIP_SRT_FLAG_ACD_DEFEND_COND,                           /* TCP/IP Stacks configuration start flags (TCPIP_SRT_FLAG_xx)  */
  TCPIP_SRT_TCP_CYCLE_EVENT_DEFAULT,                          /* Cycletime of "TCP_UDP" task in millisecond                   */
  TCPIP_SRT_QUE_FREE_ELEM_CNT_DEFAULT,                        /* Count of free queue elements                                 */
  TCPIP_SRT_SOCKET_MAX_CNT_DEFAULT,                           /* Count of sockets                                             */
  TCPIP_SRT_ARP_CACHE_SIZE_DEFAULT,                           /* Number of entries in ARP cache, must be multiple of 16       */
  "EDD0",                                                     /* EDD name                                                     */
  TCPIP_SRT_EDD_QUE_POOL_ELEM_CNT_DEFAULT,                    /* Sizes of queue and resource pool for received EDD packets    */
  TCPIP_SRT_EDD_OUT_BUF_MAX_CNT_DEFAULT,                      /* Maximum count of outgoing EDD buffers                        */
  NULL,                                                       /* EIF Ethernet Interface Set it fix to NULL                    */
  TCPIP_SRT_ARP_TIMEOUT_CACHE_DEFAULT,                        /* ARP cache timeout in second                                  */
  NULL,                                                       /* netX hardware name                                           */
};
#endif



/*
************************************************************
*   Configuration of the Application Task-List for EtherNetIP stack
************************************************************
 Configuration of the Application Task-List 
 that are required by Hilscher LOM stack
*/
#if 0
CONST FAR RX_STATIC_TASK_T FAR atrXStaticTasks_HiLomStack[] =
{
  {
    "TLR_TIMER",                                              /* Set Identification                         */
    AMK_TASK_PRIO_EIPSTACK_TLR_TIMER,// TSK_PRIO_9,           /* Set Priority */
    AMK_TASK_PRIO_EIPSTACK_TLR_TIMER,// TSK_TOK_9,            /* Token ID                  */
    0,                                                        /* Set Instance to 0                          */
    &auTskStack_Tlr_Timer[0],                                 /* Pointer to Stack                           */
    TSK_STACK_SIZE_TLR_TIMER,                                 /* Size of Task Stack                         */
    0,                                                        /* Threshold to maximum possible value        */
    RX_TASK_AUTO_START,                                       /* Start task automatically                   */
    (void (FAR*)(void FAR*))TaskEnter_TlrTimer,               /* Task function to schedule                  */
    (void (FAR*)(void FAR*))TaskExit_TlrTimer,                /* Function called when Task will be deleted  */
    (UINT32)&tTlrTimerPrm[0],                                 /* Startup Parameter                          */
    {0, 0, 0, 0, 0, 0, 0, 0}                                  /* Reserved Region                            */
  },
  {
    "EIS_ENCAP_TASK",                                         /* Set Identification                         */
    AMK_TASK_PRIO_EIPSTACK_EIS_ENCAP_TASK,//  TSK_PRIO_30,    
    AMK_TASK_PRIO_EIPSTACK_EIS_ENCAP_TASK,//TSK_TOK_30,       /* Set Priority, and Token ID                 */
    0,                                                        /* Set Instance to 0                          */
    &auTskStack_EIS_ENCAP[0],                                 /* Pointer to Stack                           */
    TSK_STACK_SIZE_EIS_ENCAP,                                 /* Size of Task Stack                         */
    0,                                                        /* Threshold to maximum possible value        */
    RX_TASK_AUTO_START,                                       /* Start task automatically                   */
    (void (FAR*)(void FAR*))TaskEnter_EipEncap,               /* Task function to schedule                  */
    (void (FAR*)(void FAR*))TaskExit_EipEncap,                /* Function called when Task will be deleted  */
    (UINT32)&g_tEipEncapParameter_HiLomStack[0],              /* Startup Parameter                          */
    {0, 0, 0, 0, 0, 0, 0, 0}                                  /* Reserved Region                            */
  },
  {
    "EIS_DLR_TASK",                                           /* Set Identification                         */
    AMK_TASK_PRIO_EIPSTACK_EIS_DLR_TASK,  //TSK_PRIO_11,
    AMK_TASK_PRIO_EIPSTACK_EIS_DLR_TASK,  //TSK_TOK_11,       /* Set Priority,and Token ID                  */
    0,                                                        /* Set Instance to 0                          */
    &auTskStack_EIS_DLR[0],                                   /* Pointer to Stack                           */
    TSK_STACK_SIZE_EIS_DLR,                                   /* Size of Task Stack                         */
    0,                                                        /* Threshold to maximum possible value        */
    RX_TASK_AUTO_START,                                       /* Start task automatically                   */
    (void (FAR*)(void FAR*))TaskEnter_EipDLR,                 /* Task function to schedule                  */
    (void (FAR*)(void FAR*))TaskExit_EipDLR,                  /* Function called when Task will be deleted  */
    (UINT32)&g_tEipDLRTaskParam[0],                           /* Startup Parameter                          */
    {0, 0, 0, 0, 0, 0, 0, 0}                                  /* Reserved Region                            */
  },
  {
    "EIS_CL1_TASK",                                           /* Set Identification                         */
    AMK_TASK_PRIO_EIPSTACK_EIS_CL1_TASK,//TSK_PRIO_10,
    AMK_TASK_PRIO_EIPSTACK_EIS_CL1_TASK,//TSK_TOK_10,         /* Set Priority, and Token ID                 */
    0,                                                        /* Set Instance to 0                          */
    &auTskStack_EIS_CL1[0],                                   /* Pointer to Stack                           */
    TSK_STACK_SIZE_EIS_CL1,                                   /* Size of Task Stack                         */
    0,                                                        /* Threshold to maximum possible value        */
    RX_TASK_AUTO_START,                                       /* Start task automatically                   */
    (void (FAR*)(void FAR*))TaskEnter_EipCl1,                 /* Task function to schedule                  */
    (void (FAR*)(void FAR*))TaskExit_EipCl1,                  /* Function called when Task will be deleted  */
    (UINT32)&g_tEipCl1TaskParam[0],                           /* Startup Parameter                          */
    {0, 0, 0, 0, 0, 0, 0, 0}                                  /* Reserved Region                            */
  },
  {
    "EIS_OBJECT_TASK",                                        /* Set Identification                         */
    AMK_TASK_PRIO_EIPSTACK_EIS_OBJECT_TASK,//TSK_PRIO_31, 
    AMK_TASK_PRIO_EIPSTACK_EIS_OBJECT_TASK,//TSK_TOK_31,      /* Set Priority, and Token ID                 */
    0,                                                        /* Set Instance to 0                          */
    &auTskStack_EIS_OBJECT[0],                                /* Pointer to Stack                           */
    TSK_STACK_SIZE_EIS_OBJECT,                                /* Size of Task Stack                         */
    0,                                                        /* Threshold to maximum possible value        */
    RX_TASK_AUTO_START,                                       /* Start task automatically                   */
    (void (FAR*)(void FAR*))TaskEnter_EipObject,              /* Task function to schedule                  */
    (void (FAR*)(void FAR*))TaskExit_EipObject,               /* Function called when Task will be deleted  */
    (UINT32)&g_tEipObjectParameter[0],                        /* Startup Parameter                          */
    {0, 0, 0, 0, 0, 0, 0, 0}                                  /* Reserved Region                            */
  },
  {
    "TCP_UDP",                                                /* Set Identification                         */
    AMK_TASK_PRIO_EIPSTACK_TCP_UDP, //TSK_PRIO_15, 
    AMK_TASK_PRIO_EIPSTACK_TCP_UDP, //TSK_TOK_15,             /* Set Priority,and Token ID                  */
    0,                                                        /* Set Instance to 0                          */
    &auTskStack_Tcp_Task[0],                                  /* Pointer to Stack                           */
    TSK_STACK_SIZE_TCP_TASK,                                  /* Size of Task Stack                         */
    0,                                                        /* Threshold to maximum possible value        */
    RX_TASK_AUTO_START,                                       /* Start task automatically                   */
    (void (FAR*)(void FAR*))TaskEnter_TcpipTcpTask,           /* Task function to schedule                  */
    (void (FAR*)(void FAR*))TaskExit_TcpipTcpTask,            /* Function called when Task will be deleted  */
    (UINT32)&tTcpipTcpTaskParam,                              /* Startup Parameter                          */
    {0, 0, 0, 0, 0, 0, 0, 0}                                  /* Reserved Region                            */
  },
  {
    "EIPDemo",                                                /* Set Identification                         */
    AMK_TASK_PRIO_EIPSTACK_EIPDEMO, //TSK_PRIO_40,
    AMK_TASK_PRIO_EIPSTACK_EIPDEMO, //TSK_TOK_40,             /* Set Priority,and Token ID                  */
    0,                                                        /* Set Instance to 0                          */
    &auTskStack_Pck_API_Demo[0],                              /* Pointer to Stack                           */
    TSK_STACK_SIZE_PCK_DEMO,                                  /* Size of Task Stack                         */
    0,                                                        /* Threshold to maximum possible value        */
    RX_TASK_AUTO_START,                                       /* Start task automatically                   */
    (void (FAR*)(void FAR*))TaskEnter_EipDemo,                /* Task function to schedule                  */
    (void (FAR*)(void FAR*))TaskExit_EipDemo,                 /* Function called when Task will be deleted  */
    NULL,                                                     /* Startup Parameter                          */
    {0, 0, 0, 0, 0, 0, 0, 0}                                  /* Reserved Region                            */
  }
};
#endif


/*
***************************************************************************
*  Peripheral Driver Configuration loaded after the Kernel has been started 
   for HiLomIf firmware
***************************************************************************
*/
#if 0
CONST FAR RX_DRIVER_PERIPHERAL_CONFIG_T atrXDrvCfgPost_HiLomStack[] = 
{
  {  // HW timer init
      DrvTimerInit,
      RX_PERIPHERAL_TYPE_TIMER,		   
      atrXHwTim_HiLomStack,	  
      MAX_CNT(atrXHwTim_HiLomStack)
  },
  {  // Interrupt driver init
      DrvInterruptInit, 	
      RX_PERIPHERAL_TYPE_INTERRUPT,	 
      atrXInt_HiLomStack,	    
      MAX_CNT(atrXInt_HiLomStack)
  },
  { // LED driver init
      DrvLedInit, 	      
      RX_PERIPHERAL_TYPE_LED,		     
      atrXLed_HiLomStack,	    
      MAX_CNT(atrXLed_HiLomStack)
  },
/*  
  { // Security Eeprom driver init
      DrvSecInit // Security Memory Driver 
  },
*/
  { // PHY instances init  
      DrvPhyInit, 	      
      RX_PERIPHERAL_TYPE_PHY,		     
      atrXPhy_HiLomStack,	    
      MAX_CNT(atrXPhy_HiLomStack)
  },
  { // XC channel init
      DrvXcInit,         
      RX_PERIPHERAL_TYPE_XC,         
      atrXXc_HiLomStack,      
      MAX_CNT(atrXXc_HiLomStack)
  },
  { // pointer FIFO init
      DrvFifInit,        
      RX_PERIPHERAL_TYPE_FIFOCHANNEL,
      atFifoChannelSets_HiLomStack,  
      MAX_CNT(atFifoChannelSets_HiLomStack)
  },
  { // EDD init
      DrvEddInit,        
      RX_PERIPHERAL_TYPE_EDD,        
      atrXEdd_HiLomStack,     
      MAX_CNT(atrXEdd_HiLomStack)
  }
};

// number of entries in the previous list of structures:
CONST UINT ulCntOfAtrXDrvCfgPost_HiLomStack = MAX_CNT(atrXDrvCfgPost_HiLomStack);

#endif

Here is the init function that uses this structures. The order of calling is given by the order of elements in the supplied structure "atrXDrvCfgPost_HiLomStack".

HiLomStack_CreateStackResources(
                                            CONST FAR RX_DRIVER_PERIPHERAL_CONFIG_T* pstCfgPost, 
                                            UNS32 ulCfgPostCount
                                           )
{
    CONST FAR RX_DRIVER_PERIPHERAL_CONFIG_T* pstiCfg;
    UNS32 uliPerfCnt, uliIndex, uliCfgIndex;
    RX_RESULT eRslt;
    RX_HANDLE hTmp;
    
    // POST CFG processing:
    if ( (pstCfgPost != NULL) && (ulCfgPostCount > 0) )
    {
        for (uliCfgIndex=0; uliCfgIndex < ulCfgPostCount; uliCfgIndex ++)
        {
            pstiCfg = &pstCfgPost[uliCfgIndex];
            if ( /*(pstiCfg->pfnDrvInit != NULL) &&*/
                 (pstiCfg->eTyp < RX_PERIPHERAL_COUNT_TYPES) )
            {
                uliPerfCnt = pstiCfg->uNum;
              
                switch(pstiCfg->eTyp)
                {
                    // ======= PHYS ========
                    case RX_PERIPHERAL_TYPE_PHY:
                    {
                      RX_PHY_SET_T* pstiTmp = (RX_PHY_SET_T*)pstiCfg->pvPer;
                      for (uliIndex=0; uliIndex < uliPerfCnt; uliIndex ++)
                      {
                        // Init Phy[]
                        eRslt=rX_MemAllocateMemory(&hTmp, DRV_PHY_SIZE);
                        ASSERT_ERROR_RETURN(eRslt);
                        eRslt=Drv_PhyCreatePhy(hTmp, &pstiTmp[uliIndex]);
                        ASSERT_ERROR_RETURN(eRslt);
                        /*eRslt=Drv_PhyIdentifyPhy(pstiTmp[uliIndex].tCfgHd.szIdn,
                                                 pstiTmp[uliIndex].tCfgHd.uInst,
                                                 &hTmp);*/
                        //eRslt=DrvPhyInit(&pstiTmp[uliIndex],1); // TEST
                        eRslt=Drv_PhyInitialize(hTmp); // THE TEST CODE, normally not present
                                                 
                        ASSERT_ERROR_RETURN(eRslt);
                      }
                    break;
                    }

                    // ======= INTERRUPTS ========
                    case RX_PERIPHERAL_TYPE_INTERRUPT:
                    {
                        RX_INTERRUPT_SET_T* pstiTmp = (RX_INTERRUPT_SET_T*)pstiCfg->pvPer;
                        for (uliIndex=0; uliIndex < uliPerfCnt; uliIndex ++)
                        {
                          // Init Ints[]
                          eRslt=rX_MemAllocateMemory(&hTmp, DRV_INTERRUPT_SIZE);
                          ASSERT_ERROR_RETURN(eRslt);
                          eRslt=Drv_IntCreateInterrupt(hTmp, &pstiTmp[uliIndex]);
                          ASSERT_ERROR_RETURN(eRslt);
                          eRslt=Drv_IntIdentifyInterrupt(pstiTmp[uliIndex].tCfgHd.szIdn,
                                                         pstiTmp[uliIndex].tCfgHd.uInst,
                                                         &hTmp);
                          ASSERT_ERROR_RETURN(eRslt);
                        }
                        break;
                    }
      
                    // ======= HW TIMERS ========
                    case RX_PERIPHERAL_TYPE_TIMER:
                    {
                        RX_HWTIMER_SET_T* pstiTmp = (RX_HWTIMER_SET_T*)pstiCfg->pvPer;
                        for (uliIndex=0; uliIndex < uliPerfCnt; uliIndex ++)
                        {
                          // Init Hw Timers[]
                          eRslt=rX_MemAllocateMemory(&hTmp, DRV_HWTIMER_SIZE);
                          ASSERT_ERROR_RETURN(eRslt);
                          eRslt=Drv_TimCreateTimer(hTmp, &pstiTmp[uliIndex]);
                          ASSERT_ERROR_RETURN(eRslt);
                          eRslt=Drv_TimIdentifyTimer(pstiTmp[uliIndex].tCfgHd.szIdn,
                                                         pstiTmp[uliIndex].tCfgHd.uInst,
                                                         &hTmp);
                          ASSERT_ERROR_RETURN(eRslt);
                        }
                        break;
                    }
      
      
                    // ======= XC channels ========
                    case RX_PERIPHERAL_TYPE_XC:
                    {
                        RX_XC_SET_T* pstiTmp = (RX_XC_SET_T*)pstiCfg->pvPer;
                        for (uliIndex=0; uliIndex < uliPerfCnt; uliIndex ++)
                        {
                          // Init XC channels[]
                          eRslt=rX_MemAllocateMemory(&hTmp, DRV_XC_SIZE);
                          ASSERT_ERROR_RETURN(eRslt);
                          eRslt=Drv_XcCreateXc(hTmp, &pstiTmp[uliIndex]);
                          ASSERT_ERROR_RETURN(eRslt);
                          eRslt=Drv_XcIdentifyXc(pstiTmp[uliIndex].tCfgHd.szIdn,
                                                         pstiTmp[uliIndex].tCfgHd.uInst,
                                                         &hTmp);
                          ASSERT_ERROR_RETURN(eRslt);
                        }
                        break;
                    }
                  
      
                    // ======= pointer FIFO channels ========
                    case RX_PERIPHERAL_TYPE_FIFOCHANNEL:
                    {
                        RX_FIFOCHANNEL_SET_T* pstiTmp = (RX_FIFOCHANNEL_SET_T*)pstiCfg->pvPer;
                        for (uliIndex=0; uliIndex < uliPerfCnt; uliIndex ++)
                        {
                          // Init XC channels[]
                          eRslt=rX_MemAllocateMemory(&hTmp, DRV_FIF_SIZE);
                          ASSERT_ERROR_RETURN(eRslt);
                          eRslt=Drv_FifCreateFifochannel(hTmp, &pstiTmp[uliIndex]);
                          ASSERT_ERROR_RETURN(eRslt);
                          eRslt=Drv_FifIdentifyFifochannel(pstiTmp[uliIndex].tCfgHd.szIdn,
                                                         pstiTmp[uliIndex].tCfgHd.uInst,
                                                         &hTmp);
                          ASSERT_ERROR_RETURN(eRslt);
                          // FIXME: Check if next lines are required:
                          //Drv_FifInitializeFifochannel()
                        }
                        break;
                    }
      
      
                    // ======= EDD channels ========
                    case RX_PERIPHERAL_TYPE_EDD:
                    {
                        RX_EDD_SET_T* pstiTmp = (RX_EDD_SET_T*)pstiCfg->pvPer;
                        for (uliIndex=0; uliIndex < uliPerfCnt; uliIndex ++)
                        {
                          // Init EDD channels[]
                          eRslt=rX_MemAllocateMemory(&hTmp, DRV_EDD_SIZE);
                          ASSERT_ERROR_RETURN(eRslt);
                          eRslt=Drv_EddCreateEdd(hTmp, &pstiTmp[uliIndex]);
                          ASSERT_ERROR_RETURN(eRslt);
                          eRslt=Drv_EddIdentifyEdd(pstiTmp[uliIndex].tCfgHd.szIdn,
                                                         pstiTmp[uliIndex].tCfgHd.uInst,
                                                         &hTmp);
                          ASSERT_ERROR_RETURN(eRslt);
                        }
                        break;
                    }
      
                    default:
                      if (pstiCfg->pfnDrvInit != NULL)
                      {
                        eRslt = pstiCfg->pfnDrvInit(pstiCfg->pvPer, pstiCfg->uNum);
                        ASSERT_ERROR_RETURN(eRslt);
                      }
                    break;
                }// end of switch    
            } // end of if()    
        }// end of for()
    }// end of if()


 return (0);
 
}    
I suppose that static init is also important:
STATIC CONST FAR RX_DRIVER_PERIPHERAL_CONFIG_T atrXDrvCfgPost[] = {
  //{DrvLedInit, 	RX_PERIPHERAL_TYPE_LED,		atrXLed,	MAX_CNT(atrXLed)},
  {DrvPioInit, 	RX_PERIPHERAL_TYPE_PIO,		atrXPio,	MAX_CNT(atrXPio)},
  {DrvGpioInit, RX_PERIPHERAL_TYPE_GPIO,	atrXGpio,	MAX_CNT(atrXGpio)},
  //{DrvVolInit,  RX_PERIPHERAL_TYPE_VOLUME,  atrXVol,    MAX_CNT(atrXVol)},  /* Volume Driver for Flash File System */
  {DrvHifInit,  RX_PERIPHERAL_TYPE_HOST,    atrXHif1,   MAX_CNT(atrXHif1)},
  {DrvSecInit}/* Security Memory Driver */
};
I don't think that this can help you to find my problem. But I think that it should be quite easy to check what is done inside of Drv_PhyInitializePhy() and to check if it is dependend on some other drivers.
I could not imagine what this could be - I think Phy are not dependent on other peripherals, they should be inited before XCs or EDDs, they should not be dependent on interrupts or tasks, nor to the security eeprom driver?
Using Rainer's code is not correct - he shows init of only one PHY, while we (all) have 2 PHYs. Also, he uses DrvPhyInit(), that is restricted to be called only in initalization phase of the rcX startup - this doesn't fit to my requirements. 
Hope that you can help me.

 

 

Krasi Gichev

Krasi Gichev

AMK

| 24.06.2011 | 13:55

Hi, 

I saw that there are some bugfixes in rcX ver. 2.0.8.5 - one of them is:

If PHY reset fails(e.g. invalid MDIO address), rcX stuck in an endless startup.

Seems to me that I run into this case. I will try with new rcX. I hope to see meaningful error code when I call Drv_PhyInitializePhy().

Login