EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  <20042005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  <20042005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Motorola 5100
From: Dirk Zimoch <[email protected]>
To: Bob Dalesio <[email protected]>
Cc: TECHTALK <[email protected]>
Date: Fri, 23 Jul 2004 10:36:20 +0200
Bob Dalesio wrote:
Does anyone have any of these in operation under vxWorks and EPICS?
Thanks,
Bob


Yes,


at SLS we have started using MV5110 with EPICS 3.13.9 and Tornado 2.

Unfortunately, the vxWorks Kernel did not satisfy me:

The second network port was not enabled. After enabling it, rebooting took up to 30 seconds with no visible reaction of the ioc. Once the second network port is enabled, it can be confired in the startup script:

ipAttach (1,"fei")
ifMaskSet ("fei1", 0xffffff00) /* or similar */
ifAddrSet ("fei1", "XXX.XXX.XXX.XXX")

Default A32 memory mapping starts at 128MB. Too high for geographical addressing. The A32 window is only 128MB long, but 1GB take a lot of memory and boot time with TLBs. Thus change to BATs. The board in slot 1 exports its local memory on VME A32 at address 0. That might lead to problems with other boards in the same address range. Thus disable memory export.

Relocation value does not fit in 24 bits.
On systems with more than 32MB there is the problem that function calls in user code (EPICS) can't reach the system (vxWorks kernel) because it's more than 32MB away. (ld loads to the upper end of the memory, while vxWorks is in the lower end.) One can solve this problem with -mlongcall, but vxWorks might still have problems to reach user code (e.g. interrupt handlers). One has to set excExtendedVectors=TRUE; to avoid that problem. Note that using longcall is a performance panalty. Therefore, I used another approach.



Here are my changes to the kernel:


in mv5100/ :

config.h:
#define INCLUDE_SECONDARY_ENET /* Enable Secondary Ethernet */
#define VME_A32_MSTR_LOCAL	0x80000000	/* Above 2 GB */
#define	VME_A32_MSTR_BUS	0x00000000	/* Base VME address */
#define VME_A32_MSTR_SIZE	0x40000000      /* 1 GB */
#define VME_A32_SLV_SIZE     0  /* disable A32 export */

/*
I changed A32 access to DBATs (see sysLib.c):
*/
#define VME_A32_USE_BATS /* use DBAT registers to map VME A32 */

sysLib.c:

UINT32 sysBatDesc [2 * (_MMU_NUM_IBAT + _MMU_NUM_DBAT)] =
    {

((ROM_BASE_ADRS & _MMU_UBAT_BEPI_MASK) | (_MMU_UBAT_BL_1M & /* I BAT 0 */
~(_MMU_UBAT_VS & _MMU_UBAT_VP))),
((ROM_BASE_ADRS & _MMU_LBAT_BRPN_MASK) | _MMU_LBAT_PP_RW |
_MMU_LBAT_CACHE_INHIBIT),


0, 0, /* I BAT 1 */

0, 0, /* I BAT 2 */

    0, 0, /* I BAT 3 */
#ifdef VME_A32_USE_BATS /* Use D BATs for VME 32 mapping */
    /* D BAT 0 */
#define MMU_BLOCK_SIZE 0x10000000 /* 256 MB */
    ((VME_A24_MSTR_LOCAL + 0 * MMU_BLOCK_SIZE) & _MMU_UBAT_BEPI_MASK) |
        _MMU_UBAT_BL_256M | _MMU_UBAT_VS | _MMU_UBAT_VP,
    ((VME_A24_MSTR_LOCAL + 0 * MMU_BLOCK_SIZE) & _MMU_LBAT_BRPN_MASK) |
        _MMU_LBAT_PP_RW | _MMU_LBAT_CACHE_INHIBIT | _MMU_LBAT_GUARDED,
    /* D BAT 1 */
    ((VME_A24_MSTR_LOCAL + 1 * MMU_BLOCK_SIZE) & _MMU_UBAT_BEPI_MASK) |
        _MMU_UBAT_BL_256M | _MMU_UBAT_VS | _MMU_UBAT_VP,
    ((VME_A24_MSTR_LOCAL + 1 * MMU_BLOCK_SIZE) & _MMU_LBAT_BRPN_MASK) |
        _MMU_LBAT_PP_RW | _MMU_LBAT_CACHE_INHIBIT | _MMU_LBAT_GUARDED,
    /* D BAT 2 */
    ((VME_A24_MSTR_LOCAL + 2 * MMU_BLOCK_SIZE) & _MMU_UBAT_BEPI_MASK) |
        _MMU_UBAT_BL_256M | _MMU_UBAT_VS | _MMU_UBAT_VP,
    ((VME_A24_MSTR_LOCAL + 2 * MMU_BLOCK_SIZE) & _MMU_LBAT_BRPN_MASK) |
        _MMU_LBAT_PP_RW | _MMU_LBAT_CACHE_INHIBIT | _MMU_LBAT_GUARDED,
    /* D BAT 3 */
    ((VME_A24_MSTR_LOCAL + 3 * MMU_BLOCK_SIZE) & _MMU_UBAT_BEPI_MASK) |
        _MMU_UBAT_BL_256M | _MMU_UBAT_VS | _MMU_UBAT_VP,
    ((VME_A24_MSTR_LOCAL + 3 * MMU_BLOCK_SIZE) & _MMU_LBAT_BRPN_MASK) |
        _MMU_LBAT_PP_RW | _MMU_LBAT_CACHE_INHIBIT | _MMU_LBAT_GUARDED,
#else
    0, 0, /* D BAT 0 */

0, 0, /* D BAT 1 */

0, 0, /* D BAT 2 */

    0, 0  /* D BAT 3 */
#endif
    };

PHYS_MEM_DESC sysPhysMemDesc [] =
    {
......
    /* MODIFY A32 VME WINDOW HERE */

#ifndef VME_A32_USE_BATS
{
(void *) VME_A32_MSTR_LOCAL,
(void *) VME_A32_MSTR_LOCAL,
VME_A32_MSTR_SIZE,
VM_STATE_MASK_VALID | VM_STATE_MASK_WRITABLE | VM_STATE_MASK_CACHEABLE |
VM_STATE_MASK_GUARDED,
VM_STATE_VALID | VM_STATE_WRITABLE | VM_STATE_CACHEABLE_NOT |
VM_STATE_GUARDED
},
#endif
......


/*
To avoid problems with loading code above 32MB, I limit sysMemTop to 32MB. At the end of the startup script (after all 'ld' commands and after iocInit) enable remaining memory with:
memAddToPool (sysMemTop(),sysPhysMemTop()-sysMemTop())
*/


char * sysMemTop (void)
    {
    static char * memTop = NULL;

    if (memTop == NULL)
        {
        memTop = sysPhysMemTop () - USER_RESERVED_MEM;
        }
    /* limit to 32M because of short calls (DZ) */
#warning Dirk Zimoch`s sysMemTop hack (limit to 32MB)
    if (memTop > (char*)0x2000000)
        {
        memTop = (char*)0x2000000;
        }
    return memTop;
    }

sysFei82557End.c:
/*
It took ages (10 seconds!) to read the ROM of the 2 network cards. I replaced all 'sysUsDelay (1000)' by 'sysUsDelay (10)'. It's much faster at reboot (below 1 second) and still works fine.
*/


fei82557End.c:
/*
Copy this file from $WIND_BASE/target/src/drv/end/fei82557End.c and in Makefile add fei82557End.o to MACH_EXTRA.


The driver uses the global variable fei82557ClkRate for calculating delays. The variable is initialized at boot time with sysClkRateGet() but ClkRate might be changed after booting! Thus, replace the variable with a macro:

LOCAL int	fei82557ClkRate = 0;
*/
#define fei82557ClkRate (sysClkRateGet())

......

#ifndef fei82557ClkRate
    if (fei82557ClkRate == 0)
	fei82557ClkRate = sysClkRateGet ();
#endif

/*
The driver tries autonegotiation even if it knows that there is no cable in the (second) network port. This costs 20 seconds during reboot!
*/


LOCAL STATUS fei82557PhyInit
    (
    DRV_CTRL *  pDrvCtrl       /* pointer to DRV_CTRL structure */
    )

    {
.....
    /*  Try a few more times to get a valid link */

    if (status != OK)
	{
        return status; /* don't try more */
.....

LOCAL STATUS fei82557MDIPhyLinkSet
    (
    DRV_CTRL *  pDrvCtrl,       /* pointer to DRV_CTRL structure */
    int phyAddr			/* physical address */
    )

    {
.....
    /* in case the status bit is the latched bit */

    if ( !(statusReg & MDI_SR_LINK_STATUS))
	fei82557MDIRead (pDrvCtrl, MDI_STATUS_REG, phyAddr, &statusReg);

    if (statusReg & MDI_SR_LINK_STATUS)
	return (OK);  /* Device found and link OK */
    return (PHY_LINK_ERROR);   /* quick exit saves 20 secs boot time */

/*
With this hack, it is still possible to plug and use the 2nd port at run time. So why wasting time?
*/







romInit.s:
Sometimes the ioc hangs after reboot. Add isync in romInit function to fix that:


FUNC_LABEL(_romInit)
FUNC_BEGIN(romInit)
    isync                           /* required for Max errata 2 */

bl cold

isync /* rebooting often hangs without it */

bl warm

/* copyright notice appears at beginning of ROM (in TEXT segment) */

    .ascii   "Copyright 1984-2001 Wind River Systems, Inc."
    .align 2

cold:
    li     r31, BOOT_COLD
    bl     start                    /* skip over next instruction */

......


in all/ :


configAll.h:

/*
added modules:
*/

#define INCLUDE_CPLUS		/* include C++ support */
#define INCLUDE_CPLUS_IOSTREAMS	/* include basic iostreams classes */
#define INCLUDE_CPLUS_STL	/* include Standard Template Library core */
#define INCLUDE_CPLUS_STRING      /* include string class */
#define INCLUDE_CPLUS_STRING_IO   /* include i/o for string class */
#define INCLUDE_CPLUS_COMPLEX     /* include complex number class */
#define INCLUDE_CPLUS_COMPLEX_IO  /* include i/o for complex number class */
#define INCLUDE_CPLUS_IOSTREAMS_FULL  /* include all of iostreams */
#define INCLUDE_DEBUG           /* pre-tornado debugging */
#define INCLUDE_DISK_UTIL       /* ls, cd, mkdir, xcopy, etc. */
#define INCLUDE_LOADER          /* object module loading */
#define INCLUDE_SHELL           /* interactive c-expression interpreter */
#define INCLUDE_SHOW_ROUTINES   /* show routines for system facilities*/
#define INCLUDE_SPY             /* spyLib for task monitoring */
#define INCLUDE_STAT_SYM_TBL    /* create user-readable error status */
#define INCLUDE_SYM_TBL         /* symbol table package */
#define INCLUDE_STARTUP_SCRIPT  /* execute start-up script */

#define INCLUDE_NET_SHOW        /* network info and status facilities */
#define INCLUDE_NET_SYM_TBL     /* load symbol table from network */
#define INCLUDE_NFS             /* nfs package */
#define INCLUDE_POSIX_ALL       /* include all available POSIX functions */
#define INCLUDE_PING		/* ping() utility */
#define INCLUDE_SNTPC           /* SNTP client */
#define INCLUDE_TELNET          /* telnet-style remote login */
/*
removed modules:
*/
#define INCLUDE_WDB		/* WDB debug agent */

/*
changed parameters:
*/
#define NUM_FILES		250
#define NFS_USER_ID  <your ioc user id>
#define NFS_GROUP_ID <your ioc group id>

/*
network stack constants as recommended by EPICS
*/
#undef NUM_64
#undef NUM_128
#undef NUM_256
#undef NUM_512
#undef NUM_1024
#undef NUM_2048
#undef NUM_NET_MBLKS
#undef NUM_SYS_64
#undef NUM_SYS_128
#undef NUM_SYS_256
#undef NUM_SYS_512
#undef NUM_SYS_1024
#undef NUM_SYS_2048
#undef NUM_SYS_MBLKS
#define NUM_64		250		/* default 100 */
#define NUM_128		400		/* default 100 */
#define NUM_256		50		/* default 40  */
#define NUM_512		50		/* default 40  */
#define NUM_1024	25		/* default 25  */
#define NUM_2048	25		/* default 25  */
#define NUM_NET_MBLKS	1200		/* default 400 */
#define NUM_SYS_64	1024		/* default 64  */
#define NUM_SYS_128	1024		/* default 64  */
#define NUM_SYS_256	512		/* default 64  */
#define NUM_SYS_512	512		/* default 64  */
#define NUM_SYS_MBLKS	NUM_SYS_CL_BLKS	/* default (2 * NUM_SYS_CL_BLKS)

--
Dr. Dirk Zimoch
Swiss Light Source
Paul Scherrer Institut
Computing and Controls
phone +41 56 310 5182
fax   +41 56 310 4413


Replies:
Re: Motorola 5100 Ralph Lange
References:
Motorola 5100 Bob Dalesio

Navigate by Date:
Prev: RE: Motorola 5100 jihkim
Next: Re: Motorola 5100 Ralph Lange
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  <20042005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Motorola 5100 Bob Dalesio
Next: Re: Motorola 5100 Ralph Lange
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  <20042005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 10 Aug 2010 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·