⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 target.nr

📁 VxWorks下 Cpv3060的BSP源代码
💻 NR
📖 第 1 页 / 共 4 页
字号:
    /* calculate the local PCI address of the scratchpad 0       register */    bar += DEC2155X_CSR_SCRATCHPAD0;    /* convert the result to the CPU equivalent address */    if (sysBusToLocalAdrs (PCI_LOCAL_MEMORY_SPACE, (char *)bar,                         (char **)&bar) != OK)        {        return (ERROR);        }    return (bar);.CE\f3NOTE:\f1Using the constant DEC2155X_PCI_DEV_NUMBER ensures that theon-board Dec2155x is read. If a search of the local PCI bus hadbeen performed using the Dec2155x device ID, the returned Bus,Device and Function numbers may have corresponded to a Dec2155xpart found on an installed PMC card.Once the local CPU address is known, the cPCI address can be derived byadding the following code fragment before returning the result:.CS    if (sysLocalToBusAdrs (PCI_BACKPANEL_MEMORY_SPACE,                           (char *)bar,                           (char **)&bar) != OK)        return (ERROR);    else        return (bar);.CE.SS "Internal Dec2155x Interrupt Sources"At start-up, all Dec2155x interrupt sources are masked and cleared.Before unmasking an interrupt, an application ISR service routine must beattached to the appropriate Dec2155x interrupt vector using intConnect().Multiple ISR service routines can be connected to each vector if requiredby the application. Once the handler is attached, the interrupt can beenabled and disabled by calling sysDec2155xIntEnable() orsysDec2155xIntDisable() as required. Interrupt vector definitions for theDec2155x internal interrupt sources are defined in cpv3060.h.Unique interrupt vectors are provided for each of the 16 bits in theDec2155x Secondary IRQ register. Bit 0 (LSB) corresponds toDEC2155X_DOORBELL0_INT_VEC with the remaining bits mapped in sequence.These doorbell interrupts can be used for host-to-CPV3060 orCPV3060-to-CPV3060 event notification. The Dec2155x interrupt handlerclears these interrupts which simplifies the application ISR.Individual interrupt vectors are also provided for Dec2155x Hot SwapPower State and I2O in-bound list events. The Dec2155x interrupt handleralso clears these interrupts.The 64 Upstream Memory 2 BAR Page Crossing interrupts are all presentedon a single interrupt vector and the application ISR is responsible forclearing the bits serviced. Calls to sysDec2155xIntEnable() andsysDec2155xIntDisable() enable or disable all 64 interrupts.The Dec2155x interrupt handler provides a default service routine for allunclaimed interrupt vectors, including the Upstream Memory 2 BAR PageCrossing interrupt. The default routine reports the event and clears theinterrupt source..SS "Compact PCI Backpanel Interrupts"The Dec2155x can generate cPCI backpanel interrupts using any of the bitsin the Primary IRQ register if they have been un-masked by the host. Thefollowing code fragment generates a compact PCI backpanel interrupt bysetting bit 15 (MSB) of the Primary IRQ register:    if (sysBusIntGen (DEC2155X_DOORBELL15_INT_LVL,                      DEC2155X_DOORBELL15_INT_VEC) != OK)        return (ERROR);Note that the cPCI bus does not provide an interrupt vector to the host.The vector number passed to sysBusIntGen() simply identifies which bit inthe register to set. It is the host's responsibility to locate theinterrupt source and clear the interrupt.In-bound cPCI backpanel interrupts are routed directed to the CPV3060CPU via the SIU.  They can be enabled, disabled and handled by callingsysIntEnable(), sysIntDisable() and intConnect() with the vectornumber of the desired backpanel interrupt line.\f3NOTE:\f1Great care must be exercised when cPCI backpanel interrupts arebeing generated and received simultaneously. If the packpanelinterrupt line driven by the CPV3060 is also enabled for receivinginterrupts, the CPV3060 will be interrupted by its own backpanelinterrupt. This scenario causes complications because the backpanelinterrupts are configured as level sensitive and difficulties areencountered in determining the party responsible for clearing theinterrupt source. In general, backpanel interrupt generation isuseful for signaling an event to the host, but in-bound packpanelinterrupts have limited usefulness..SS "Altering the Default Dec2155x Configuration:Altering the Dec2155x configuration requires the careful consideration ofseveral items:.IPDec2155x window sizes and alignment..IPDec2155x translation values..IPThe size and alignment of the host's dynamic PCI configuration area..IPThe size and alignment of the CPV3060's dynamic PCI configuration area..LPThe Dec2155x window parameters are controlled by #defines in config.h.There are three defines associated with each window:.TS Ccenter;rw11 lw(4.0i) .\&..._SIZE	T{determines the size of the window in bytes and must be anintegral power of two. The minimum size for a PCI I/Ospace window is 64 bytes. The minimum size for a PCImemory space window is 4KB. To disable a window, set thesize to 0. Note that the Dec2155x will not allow thePrimary CSR and Downstream Memory 0 BAR to 0 to bedisabled. If the size of this window is set to zero, theDec2155x will default to a 4KB window.T}NOTE:	T{If a window value is not a power of 2, or is below the minimum size, sysLib.cwill not compile.T}.TE.TS Ccenter;rw11 lw(4.0i) .\&..._TYPE	T{determines the type of the window and any placementrestrictions. For proper operation, the window must beconfigured for placement anywhere in the 32-bit PCIaddress space.T}.TE.TS Ccenter;rw11 lw(4.0i) .\&..._TRANS	T{determines the base address of the window on the targetPCI bus. It is important to remember that this is a localPCI address (downstream window) or a cPCI address(upstream window). The translation value chosen must bean even multiple if the window size.T}NOTE:	T{If the translation value is not a multiple of the windowsize, sysLib.c will not build.T}.TEThe default window sizes can be reduced without altering the sizes of thedynamic PCI configuration area. However, if the required values aresignificantly reduced from the default values, reducing the size of thedynamic PCI configuration area reduces the size of the MMU page tables atthe ratio of 128:1 (a 128KB reduction saves 1KB of MMU table space).The size of the PCI memory space used for dynamic PCI configuration iscontrolled by PCI_MEM_SIZE in config.h and the area's base address iscontrolled by CPU_PCI_MEM_ADRS in cpv3060.h. By default, the PCI masterMCP750 BSP allocates a 32MB area aligned to a 32MB boundary for dynamicPCI configuration. To access peer CPV3060 DRAM areas, an upstream windowmust be opened which matches the size of the host's dynamic PCIconfiguration area. For translation to work correctly, the host'sdynamic PCI configuration area must be aligned to a multiple of thearea's size and the corresponding Dec2155x upstream translation registermust contain the area's base cPCI address (not CPU address). Since thisBSP supports peer-to-peer access between CPV3060 DRAM areas, the defaultdynamic PCI configuration area for the CPV3060 is 64MB aligned to a 32MBboundary which satisfies these requirements.In addition to the peer access window, sufficient space must also beavailable for mapping the host DRAM upstream window and any spacerequired by CPV3060-resident PCI devices. A margin must also be allowedfor areas that are unusable due to window alignment requirements.If the application does not require peer-to-peer CPV3060 DRAM access, thelarge 32MB window used to contain the host's dynamic PCI configurationarea can be eliminated with a corresponding decrease in the requiredCPV3060 dynamic PCI configuration area. If peer-to-peer doorbellinterrupts are still required, the doorbell interrupt registers of peerCPV3060s may be accessed through an I/O window which has much smallerCPU address space requirements. This would require re-configuring thedefault BSP to access host DRAM through Upstream Memory 1 BAR and usingthe Upstream I/O or Memory 0 BAR to access the peer CPV3060 doorbellinterrupt registers..SS "Shared Memory Support"The CPV3060 supports shared memory backplane communication.The Wind River documentation provides a great deal of informationregarding shared memory concepts.  The section below provides tutorialstyle information regarding the setup of a shared memory systeminvolving the MCP750 (PCI bus master) and CPV3060(s).Setting up a working shared memory system involves proper setting ofcertain "config.h" parameters and proper setting of boot parametersvia the "c" command from the boot prompt.  There are three componentsinvolved in shared memory communication which must be configuredproperly to create a working system:.IP "Anchor:"This is an area of memory which must be accessible to all nodesparticipating in shared memory backplane communication.  The anchorpoints to the actual shared memory buffer pool which must be locatedin the same memory space as the anchor itself.  The associated"config.h" parameter is SM_ANCHOR_ADRS.  In certain configurations,nonzero nodes will "poll" for the location of the anchor.  "config.h"defines which comes into play for polling are SM_OFF_BOARD andSYS_SM_SYSTEM_MEM_POLL..IP "Master node:"This node is always designated as node zero.  It is the node whichsets up the anchor and shared memory pool.  Once the anchor and sharedmemory pool is set up, the master node acts as a peer with the othernodes.  The node number (0 in this case) is one of the boot parameterswhich can be set up with the "c" command from the bootline prompt..IP "Sequential addressing:"This is is governed by a "config.h" parameter, INCLUDE_SM_SEQ_ADDR and isused when sequential IP addresses are assigned to the participatingnodes.  Node zero is assigned the lowest IP address, followed by nodes1, 2 etc. which are assigned the subsequent and sequential IP addresses.The advantage of sequential addressing is that fewer boot parametersmust be specified to configure the system..LPThe following restrictions apply to shared memory configurations..IP "1)"Node zero must not boot over the shared memory interface.  Onlynonzero nodes are allowed to boot over the shared memory "sm"interface..IP "2)"The location of the anchor must be statically determinable by themaster node (node 0).  That is, the location of the anchor musteither be a build-time static parameter or it must be able tobe communicated to the master node via the "sm=xxxxxxxx" bootconfiguration parameter.  The nonzero nodes need not know thelocation of the anchor at build or boot time but can be configuredto poll for the anchor dynamically..LPNote:  Another piece of shared memory terminology is "host node".The "host node" is the node which configures the compact PCI busduring startup initialization.  In a system consisting of an MCP750and one or more CPV3060s, the "host node" is the MCP750.  Don't confuse"host node" with "master node".  "Master node" is simply a synonym for"node 0".  The "host node" may or may not be the "master node".  Notealso that the "host node" need not necessarily be a VxWorks node.Below are the crucial "config.h" parameters involved in shared memory:.IP "SM_OFF_BOARD (TRUE or FALSE):"The parameter has a configurable value of either TRUE or FALSEand directly determines the value of SM_ANCHOR_ADRS (the anchoraddress).If SM_OFF_BOARD is defined as FALSE, then the anchor is on-boardand SM_ANCHOR_ADRS is defined to beLOCAL_MEM_LOCAL_ADRS + SM_ANCHOR_OFFSET.LOCAL_MEM_LOCAL_ADRS is defined as 0x0 in "config.h" andSM_ANCHOR_OFFSET is defined as 0x4100 in "config.h".If defined as TRUE, then SM_ANCHOR_ADRS is defined as a functioncall: sysSmAnchorAdrs() (defined in "sysLib.c").  This functionwill dynamically poll, at system startup, various locations(explained below) for the exact location of the shared memoryanchor.Note that if "sm=xxxxxxxx" is used as a boot parameter, thenSM_OFF_BOARD has no effect.  The value of "xxxxxxxx" will be usedas the anchor location regardless of the setting of SM_OFF_BOARD.If simply "sm" is used as a boot parameter, then SM_OFF_BOARD isqueried at initialization time to determine if polling is requiredor not..IP "SYS_SM_SYSTEM_MEM_POLL (#define or #undef):"This define only has an effect if anchor polling is called for(because SM_OFF_BOARD is defined as TRUE and "sm" is used with no"=xxxxxxxx").  In this case, simply defining SYS_SM_SYSTEM_MEM_POLLwill cause the node to poll for the anchor at compact PCI busaddress PCI2DRAM_BASE_ADRS + SM_ANCHOR_OFFSET (0x80004100)."System memory" (which is the host node's DRAM) willbe included as one of the locations where the anchor might reside.Note that other locations my be polled as well (explained later).Not defining SYS_SM_SYSTEM_MEM_POLL will prevent the polling ofsystem  memory for the anchor..IP "SYS_SM_ANCHOR_POLL_LIST (#define or #undef):"This define has an effect only if polling is called for (seeSM_OFF_BOARD explained above).  When defined,SYS_SM_ANCHOR_POLL_LIST allows a list of devices, identified bydevice/vendor ID and subsystem ID/subsystem vendor ID to bespecified as candidates for the anchor location.  Devices whichappear directly on the compact PCI bus are found and if theyappear on the list defined by SYS_SM_ANCHOR_POLL_LIST, they arechecked to see if they house the shared memory anchor.  The memorydefined by the first memory BAR is queried at offsetSM_ANCHOR_OFFSET (0x4100 by default, defined in "configAll.h").  IfSYS_SM_ANCHOR_POLL_LIST is not defined, ALL devices on the compactPCI bus will be considered candidates for the anchor location andwill be polled.  If SYS_SM_ANCHOR_POLL_LIST defined but empty, NOdevices on the compact PCI bus will be considered candidates forthe anchor location.  In that case, the only location polled wouldbe system memory if SYS_SM_SYSTEM_MEM_POLL (see above) was defined..IP "INCLUDE_SM_SEQ_ADDR (#define or #undef)"If "undef'ed", sequential addressing is disabled.  This symbolis defined by default..LPConsider a system consisting of an MCP750 (host node) and two CPV3060s.The following six configurations are the only ones possible:.TS Eexpand;lf3 lf3 lf3 lf3l l l l ..ne 8.sp .5	Master node on...	Anchor on...	Sequential Addressing?_1.	MCP750	MCP750	NO2.	MCP750	MCP750	YES3.	CPV3060	MCP750	NO4.	CPV3060	MCP750	YES5.	CPV3060	CPV3060	NO6.	CPV3060	CPV3060	YES.TEBelow is a description of how each of the above systems would beconfigured.  Crucial "config.h" and boot parameter settings for anexample system are given.  In each example, SYS_SM_ANCHOR_POLL_LISTwas defined to contain information identifying the Dec2155x bridgechip (present on the CPV3060).  See "config.h" for the example ofhow this was done..ne 6.IP "1)"MCP750 master, MCP750 anchor, no sequential addressing:.CS   MCP750:        #define SM_OFF_BOARD FALSE        #undef  SYS_SM_SYSTEM_MEM_POLL        #undef  INCLUDE_SM_SEQ_ADDR        boot device          : dc        host name            : sunray        processor number     : 0        inet on ethernet (e) : 124.170.16.112        inet on backplane (b): 124.200.200.1:ffffff00        host inet (h)        : 124.170.16.143        gateway inet (g)     : 124.170.16.233        target name (tn)     : gamma   CPV3060-1:        #define SM_OFF_BOARD TRUE        #define SYS_SM_SYSTEM_MEM_POLL        #undef  INCLUDE_SM_SEQ_ADDR        boot device          : sm        host name            : sunray        processor number     : 1        inet on ethernet (e) : 124.170.16.109        inet on backplane (b): 124.200.200.2        host inet (h)        : 124.170.16.143        gateway inet (g)     : 124.200.200.1        target name (tn)     : alpha   CPV3060-2:        (same "config.h" setup as CPV3060-1 above)        boot device          : sm        host name            : sunray        processor number     : 2        inet on ethernet (e) : 124.170.16.110        inet on backplane (b): 124.200.200.3        host inet (h)        : 124.170.16.143        gateway inet (g)     : 124.200.200.1        target name (tn)     : beta.CE.ne 6.IP "2)"MCP750 master, MCP750 anchor, sequential addressing:.CS   MCP750:        #define SM_OFF_BOARD FALSE        #define SYS_CPCI_BUS_NUMBER    1        #undef SYS_SM_SYSTEM_MEM_POLL        /* #undef INCLUDE_SM_SEQ_ADDR */        boot device          : dc        host name            : sunray

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -