Acromag, Inc. 30765 S.Wixom Road P.O. Box 437 Wixom, Michigan 48393-7037 Phone: (248)295-0310 FAX: (248)624-9234 VxWorks Software Library Information File for Board Support Routines V3.0 10/17/05 The information in this manual is subject to change without notice. Acromag, Inc. makes no warranty of any kind with regard to this material and accompanying software, including, but not limited to , the implied warranties of merchantability and fitness for a particular purpose. Acromag, Inc. assumes no responsibility for any errors that may appear in this manual and accompanying software. Copyright 1998-2006, Acromag, Inc. Tornado, VxWorks, and the wind kernel are trademarks or registered trademarks of, and developed by Wind River Systems, Inc., Alameda, California, U.S.A. VxWorks - Board Support Functions This document defines the functions that each board support layer must implement in order for the board support layer, carriers, and IPACKS to be portable between different hardware targets. This results in only having to change the carrier and/or board support software and re-link each IPACK with this new module. Data Types word - unsigned short byte - unsigned char CSTATUS - int CSTATUS return values Functions The nHandle value passed to each function represents the carrier board that the function will effect. CSTATUS BspGetCarrierAddress(int nHandle, long* pAddress); This function is general purpose and will return a pointer to the carriers base address. CSTATUS BspSetCarrierAddress(int nHandle, long pAddress); This function is general purpose and will set the carriers base address. CSTATUS BspEnableInterrupts(int nHandle); Calling this function will enable interrupts. The individual IPACKS will still need to have their interrupts enabled before an interrupt will occur. CSTATUS BspDisableInterrupts(int nHandle); Calling this function will disable interrupts. Each IPACK should have its interrupts disabled as well if calling this function. CSTATUS BspSetInterruptLevel(int nHandle, word uLevel); This function is used to set the appropriate interrupt level, or IRQ line to used for interrupts. CSTATUS BspGetInterruptLevel(int nHandle, word* uLevel); This function will return the interrupt level that is currently set. CSTATUS BspSetInterruptHandler(int nHandle, char cSlot, int nRequestNumber, int nVector, BOOL(*pHandler(void*)), void* pData); This function attaches an interrupt handler for one of the two interrupt requests that the IPACK in slot cSlot can generate. The interrupt handler takes a void pointer as a parameter and returns TRUE if it handled the interrupt or FALSE if it did not handle the interrupt. The data that gets passed to the interrupt handler is represented by pData. CSTATUS BspInitCarrierLib(void); This function will initialize any global data areas. CSTATUS BspCarrierOpen(long lBaseAddress, int* pHandle); This function will initialize structures with appropriate values based on pBaseAddress. A handle will be returned in the parameter pHandle. CSTATUS BspCarrierInitialize(int nHandle); Each carrier needs to be software reset, and initialized in a certain way. This function is used to do that. This function should be called before any other function except CarrierOpen(), and CarrierClose(). If it is not called first, the calls to the other functions will return ERROR. CSTATUS BspCarrierClose(int nHandle); This function will clean up all global data for the carrier represented by nHandle. This function should be called once for each succesful call to CarrierOpen(). CSTATUS BspSetMemoryAddress(int nHandle, long lAddress); This function is general purpose and will set the IP module base memory address. CSTATUS BspGetMemoryAddress(int nHandle, long* pAddress); This function is general purpose and will return a pointer to the IP module base memory address. ////////////////////////////// mv2700 BSP adjustments ////////////////////////////// mv2700 BSP adjustments 1. In Vxworks supplied file (WIND_BASE)\target\config\mv2700\universe.h". /* 09/06/01 Without confirmation from WRS During the debugging of function: sysUnivIntConnect() It was noted that 'UNIVERSE_INT_MASK' as suppiled by WRS did not work correctly for the following interrupt types UNIVERSE_VOWN_INT, LVL1, LVL2, LVL3, LVL4, LVL5, LVL6, LVL7 The definition as suppiled by WRS is as follows: #define UNIVERSE_INT_MASK 0x0000f700 We have changed it to the following: */ #define UNIVERSE_INT_MASK 0x0000f7ff /* mask for the interrupts defined above */ Make sure the following define is in place #define UNIVERSE_INT_MASK 0x0000f7ff /* mask for the interrupts defined above */ 2. In Vxworks supplied file "(WIND_BASE)\target\config\mv2700\config.h". Search the file "config.h" for a comment corresponding to "Universe LINT0 ". This is the Universe LINT0 interrupt. - The original WRS supplied code defaults to interrupts disabled. To enable interrupts, remove/comment out the "INT_MASK_BIT" for the Universe LINT0 interrupt. #define INIT_EXT_SRC5 ( /* INT_MASK_BIT | */ LEVEL_SENSE |\ PRIORITY_LVL10 ) /* Universe LINT0 */ 3. Changes 1 and 2 require the rebuilding of the VxWorks kernel. end mv2700 BSP adjustments ////////////////////////////// mv2700 BSP adjustments ////////////////////////////// ////////////////////////////// mcp8540 (mv3100) BSP adjustments ////////////////////////////// 1. Adding geographic addressing support for mcp8540 (mv3100). In Vxworks supplied file (WIND_BASE)\target\config\mcp8540\xxx8540A.h or In Vxworks supplied file (WIND_BASE)\target\config\mv3100\xxx8540A.h File name: xxx8540A.h Modification: The file xxx8540A.h requires modification to support geographic addressing. In the file xxx8540A.h locate and modify the file like the example below. The bracketed areas may be copied and pasted into the file. Areas that require modification are bracketed as follows: /* //////////////////////////// ACROMAG AVME9675 //////////////////////////// */ First modification in: xxx8540A.h /* VME related */ #define VME_MEM_LOCAL_START 0x80000000 #define VME_MEM_BUS_START (VME_MEM_LOCAL_START) #define VME_A32_MSTR_LOCAL VME_MEM_LOCAL_START #define VME_A32_MSTR_BUS (0x08000000) #define VME_A32_MSTR_END (VME_A32_MSTR_LOCAL + VME_A32_MSTR_SIZE) #define VME_A24_MSTR_LOCAL (VME_A32_MSTR_END) #define VME_A24_MSTR_BUS (0x00000000) #define VME_A24_MSTR_END (VME_A24_MSTR_LOCAL + VME_A24_MSTR_SIZE) #define VME_A16_MSTR_LOCAL (VME_A24_MSTR_END) #define VME_A16_MSTR_BUS (0x00000000) #define VME_A16_MSTR_END (VME_A16_MSTR_LOCAL + VME_A16_MSTR_SIZE) /* //////////////////////////// ACROMAG AVME9675 //////////////////////////// */ #define VME_CS_CSR_LOCAL (VME_A24_MSTR_END + VME_A24_MSTR_SIZE) #define VME_CS_CSR_MSTR_BUS (0x00000000) #define VME_CS_CSR_END (VME_CS_CSR_LOCAL + VME_A24_MSTR_SIZE) /* Make sure VME_LOCAL_MEM_END is rounded to nearest 0x0001000 boundary */ /*#define VME_MEM_LOCAL_END (VME_A16_MSTR_END)*/ #define VME_MEM_LOCAL_END (VME_CS_CSR_END) /* //////////////////////////// ACROMAG AVME9675 //////////////////////////// */ Second modification in: xxx8540A.h #define VME_OUT3_CFG_PARAMS \ TRUE, /* Window enabled */ \ 0, VME_OUT3_START, /* Local start addrs (upper = 0) */ \ 0, VME_OUT3_SIZE, /* Size (upper = 0) */ \ 0, VME_OUT3_BUS, /* VME bus addr (upper = 0) */ \ 0, /* 2eSST broadcast select */ \ 0, /* Unused */ \ TRUE, /* Read prefetch enable state */ \ VME_RD_PREFETCH_2_CACHE_LINES, \ VME_SST160, /* 2esst xfer rate */ \ VME_MBLT_OUT, /* transfer mode */ \ VME_D32, /* VME data bus width */ \ FALSE, /* nonsupervisor access */ \ FALSE, /* Not pgm but instead data access */ \ VME_MODE_A16 /* transfer mode */ /* //////////////////////////// ACROMAG AVME9675 //////////////////////////// */ #define VME_OUT4_START (VME_CS_CSR_LOCAL) #define VME_OUT4_SIZE (VME_A24_MSTR_SIZE) #define VME_OUT4_BUS (VME_CS_CSR_MSTR_BUS) #define VME_OUT4_CFG_PARAMS \ TRUE, /* Window enabled */ \ 0, VME_OUT4_START, /* Local start addrs (upper = 0) */ \ 0, VME_OUT4_SIZE, /* Size (upper = 0) */ \ 0, VME_OUT4_BUS, /* VME bus addr (upper = 0) */ \ 0, /* 2eSST broadcast select */ \ 0, /* Unused */ \ TRUE, /* Read prefetch enable state */ \ VME_RD_PREFETCH_2_CACHE_LINES, \ VME_SST160, /* 2esst xfer rate */ \ VME_MBLT_OUT, /* transfer mode */ \ VME_D32, /* VME data bus width */ \ FALSE, /* nonsupervisor access */ \ FALSE, /* Not pgm but instead data access */ \ VME_MODE_CRCSR /* transfer mode */ /*#define VME_OUT4_CFG_PARAMS VME_OUTx_CFG_DISABLED */ /* //////////////////////////// ACROMAG AVME9675 //////////////////////////// */ #define VME_OUT5_CFG_PARAMS VME_OUTx_CFG_DISABLED #define VME_OUT6_CFG_PARAMS VME_OUTx_CFG_DISABLED #define VME_OUT7_CFG_PARAMS VME_OUTx_CFG_DISABLED In Vxworks supplied file (WIND_BASE)\target\config\mcp8540\sysLib.c or In Vxworks supplied file (WIND_BASE)\target\config\mv3100\sysLib.c File name: sysLib.c Modification: Add the following entry to the sysPhysMemDesc[] to enable CS/CSR space. In the file sysLib.c locate and modify the file like the example below. The bracketed areas may be copied and pasted into the file. Areas that require modification are bracketed as follows: /* //////////////////////////// ACROMAG AVME9675 //////////////////////////// */ In: sysLib.c /* Access to VME A16 space */ VME_A16_MSTR_LOCAL, VME_A16_MSTR_LOCAL, VME_A16_MSTR_SIZE, MMU_ATTR_VALID_MSK | MMU_ATTR_PROT_MSK | MMU_ATTR_CACHE_MSK, MMU_ATTR_VALID | MMU_ATTR_SUP_RWX | MMU_ATTR_CACHE_OFF | MMU_ATTR_CACHE_GUARDED }, { /* //////////////////////////// ACROMAG AVME9675 //////////////////////////// */ /* Add access to VME CS CSR space */ VME_CS_CSR_LOCAL, VME_CS_CSR_LOCAL, VME_A24_MSTR_SIZE, MMU_ATTR_VALID_MSK | MMU_ATTR_PROT_MSK | MMU_ATTR_CACHE_MSK, MMU_ATTR_VALID | MMU_ATTR_SUP_RWX | MMU_ATTR_CACHE_OFF | MMU_ATTR_CACHE_GUARDED }, { /* //////////////////////////// ACROMAG AVME9675 //////////////////////////// */ /* Access to PCI non-prefetchable memory space */ PCI_MSTR_MEMIO_LOCAL, PCI_MSTR_MEMIO_LOCAL, PCI_MSTR_MEMIO_SIZE, MMU_ATTR_VALID_MSK | MMU_ATTR_PROT_MSK | MMU_ATTR_CACHE_MSK, MMU_ATTR_VALID | MMU_ATTR_SUP_RWX | MMU_ATTR_CACHE_OFF | MMU_ATTR_CACHE_GUARDED }, { 2. Changes require the rebuilding of the VxWorks kernel and the bootroms. Additional Note: If you receive "WTX 0x10034 (LOADER_RELOCATION_OFFSET_TOO_LARGE)" dialog while downloading to the target, you will need to add the '-mlongcall' compiler flag to the build properties. Basically, choose the "Build" tab, then right click on "PPC604gnu" or whatever tool chain you are using, pick build properties. Then select "C/C++ compiler" tab, and then put in the '-mlongcall' compiler flag. Click on "Apply" and then "Ok". Then select the Rebuild All option for your project and download again. If you are using the diab compiler then add the '-Xcode-absolute-far' compiler flag to the build properties. end mcp8540 (mv3100) BSP adjustments ////////////////////////////// mcp8540 (mv3100) BSP adjustments ////////////////////////////// ////////////////////////////// mv5100 BSP adjustments ////////////////////////////// mv5100 BSP adjustments 1. In Vxworks supplied file (WIND_BASE)\target\config\mv5100\universe.h. /* 03/29/04 Without confirmation from WRS During the debugging of function: sysUnivIntConnect() It was noted that 'UNIVERSE_INT_MASK' as suppiled by WRS did not work correctly for the following interrupt types UNIVERSE_VOWN_INT, LVL1, LVL2, LVL3, LVL4, LVL5, LVL6, LVL7 The definition as suppiled by WRS is as follows: #define UNIVERSE_INT_MASK 0x0000f700 We have changed it to the following: */ #define UNIVERSE_INT_MASK 0x0000f7ff /* mask for the interrupts defined above */ Make sure the following define is in place #define UNIVERSE_INT_MASK 0x0000f7ff /* mask for the interrupts defined above */ 2. In Vxworks supplied file (WIND_BASE)\target\config\mv5100\config.h. Search the file "config.h" for a comment corresponding to "Universe LINT0 ". This is the Universe LINT0 interrupt. - The original WRS supplied code defaults to interrupts disabled. To enable interrupts, remove/comment out the "INT_MASK_BIT" for the Universe LINT0 interrupt. #define INIT_EXT_SRC5 ( /* INT_MASK_BIT | */ LEVEL_SENSE |\ PRIORITY_LVL10 ) */ /* Universe LINT0 */ 3. Changes 1 and 2 require the rebuilding of the VxWorks kernel. end mv5100 BSP adjustments ////////////////////////////// mv5100 BSP adjustments ////////////////////////////// ////////////////////////////// mv5500 BSP adjustments ////////////////////////////// 1. In Vxworks supplied file (WIND_BASE)\target\config\mv5500\universe.h. /* 03/12/04 Without confirmation from WRS During the debugging of function: sysUnivIntConnect() It was noted that 'UNIVERSE_INT_MASK' as suppiled by WRS did not work correctly for the following interrupt types UNIVERSE_VOWN_INT, LVL1, LVL2, LVL3, LVL4, LVL5, LVL6, LVL7 The definition as suppiled by WRS is as follows: #define UNIVERSE_INT_MASK 0x00fff700 We have changed it to the following: #define UNIVERSE_INT_MASK 0x00fff7ff / * mask for the interrupts defined above * / */ /* WRS #define UNIVERSE_INT_MASK 0x00fff700 / * mask for the interrupts defined above * / */ /* updated */ #define UNIVERSE_INT_MASK 0x00fff7ff /* mask for the interrupts defined above */ 2. Changes require the rebuilding of the VxWorks kernel. Additional Note: If you receive "WTX 0x10034 (LOADER_RELOCATION_OFFSET_TOO_LARGE)" dialog while downloading to the target, you will need to add the '-mlongcall' compiler flag to the build properties. Basically, choose the "Build" tab, then right click on "PPC604gnu" or whatever tool chain you are using, pick build properties. Then select "C/C++ compiler" tab, and then put in the '-mlongcall' compiler flag. Click on "Apply" and then "Ok". Then select the Rebuild All option for your project and download again. If you are using the diab compiler then add the '-Xcode-absolute-far' compiler flag to the build properties. end mv5500 BSP adjustments ////////////////////////////// mv5500 BSP adjustments ////////////////////////////// ////////////////////////////// mv6100 BSP adjustments ////////////////////////////// 1. Adding geographic addressing support for mv6100. In Vxworks supplied file (WIND_BASE)\target\config\mv6100\mv6100A.h File name: mv6100A.h Modification: The file mv6100A.h requires modification to support geographic addressing. In the file mv6100A.h locate and modify the file like the example below. The bracketed areas may be copied and pasted into the file. Areas that require modification are bracketed as follows: /* //////////////////////////// ACROMAG AVME9675 //////////////////////////// */ First modification in: mv6100A.h /* Memory mapping defines */ #define IS_DRAM_ADDRESS(addr) (((int)addr >= LOCAL_MEM_LOCAL_ADRS) && \ ((UINT32)addr < (UINT32)sysPhysMemTop())) #define VME_MEM_LOCAL_START 0x80000000 #define VME_A32_MSTR_LOCAL VME_MEM_LOCAL_START #define VME_A32_MSTR_BUS (0x08000000) #define VME_A32_MSTR_END (VME_A32_MSTR_LOCAL + VME_A32_MSTR_SIZE) #define VME_A24_MSTR_LOCAL (VME_A32_MSTR_END) #define VME_A24_MSTR_BUS (0x00000000) #define VME_A24_MSTR_END (VME_A24_MSTR_LOCAL + VME_A24_MSTR_SIZE) #define VME_A16_MSTR_LOCAL (VME_A24_MSTR_END) #define VME_A16_MSTR_BUS (0x00000000) #define VME_A16_MSTR_END (VME_A16_MSTR_LOCAL + VME_A16_MSTR_SIZE) /* //////////////////////////// ACROMAG AVME9675 //////////////////////////// */ #define VME_CS_CSR_LOCAL (VME_A24_MSTR_END + VME_A24_MSTR_SIZE) #define VME_CS_CSR_MSTR_BUS (0x00000000) #define VME_CS_CSR_END (VME_CS_CSR_LOCAL + VME_A24_MSTR_SIZE) /* Make sure VME_LOCAL_MEM_END is rounded to nearest 0x0001000 boundary */ /*#define VME_MEM_LOCAL_END (VME_A16_MSTR_END)*/ #define VME_MEM_LOCAL_END (VME_CS_CSR_END) /* //////////////////////////// ACROMAG AVME9675 //////////////////////////// */ Second modification in: mv6100A.h #define VME_OUT3_CFG_PARAMS \ TRUE, /* Window enabled */ \ 0, VME_OUT3_START, /* Local start addrs (upper = 0) */ \ 0, VME_OUT3_SIZE, /* Size (upper = 0) */ \ 0, VME_OUT3_BUS, /* VME bus addr (upper = 0) */ \ 0, /* 2eSST broadcast select */ \ 0, /* Unused */ \ TRUE, /* Read prefetch enable state */ \ VME_RD_PREFETCH_2_CACHE_LINES, \ VME_SST160, /* 2esst xfer rate */ \ VME_MBLT_OUT, /* transfer mode */ \ VME_D32, /* VME data bus width */ \ FALSE, /* nonsupervisor access */ \ FALSE, /* Not pgm but instead data access */ \ VME_MODE_A16 /* transfer mode */ /* //////////////////////////// ACROMAG AVME9675 //////////////////////////// */ #define VME_OUT4_START (VME_CS_CSR_LOCAL) #define VME_OUT4_SIZE (VME_A24_MSTR_SIZE) #define VME_OUT4_BUS (VME_CS_CSR_MSTR_BUS) #define VME_OUT4_CFG_PARAMS \ TRUE, /* Window enabled */ \ 0, VME_OUT4_START, /* Local start addrs (upper = 0) */ \ 0, VME_OUT4_SIZE, /* Size (upper = 0) */ \ 0, VME_OUT4_BUS, /* VME bus addr (upper = 0) */ \ 0, /* 2eSST broadcast select */ \ 0, /* Unused */ \ TRUE, /* Read prefetch enable state */ \ VME_RD_PREFETCH_2_CACHE_LINES, \ VME_SST160, /* 2esst xfer rate */ \ VME_MBLT_OUT, /* transfer mode */ \ VME_D32, /* VME data bus width */ \ FALSE, /* nonsupervisor access */ \ FALSE, /* Not pgm but instead data access */ \ VME_MODE_CRCSR /* transfer mode */ /*#define VME_OUT4_CFG_PARAMS VME_OUTx_CFG_DISABLED */ /* //////////////////////////// ACROMAG AVME9675 //////////////////////////// */ #define VME_OUT5_CFG_PARAMS VME_OUTx_CFG_DISABLED #define VME_OUT6_CFG_PARAMS VME_OUTx_CFG_DISABLED #define VME_OUT7_CFG_PARAMS VME_OUTx_CFG_DISABLED In Vxworks supplied file (WIND_BASE)\target\config\mv6100\sysLib.c File name: sysLib.c Modification: Add the following entry to the sysPhysMemDesc[] to enable CS/CSR space. In the file sysLib.c locate and modify the file like the example below. The bracketed areas may be copied and pasted into the file. Areas that require modification are bracketed as follows: /* //////////////////////////// ACROMAG AVME9675 //////////////////////////// */ In: sysLib.c /* Access to VME A16 space */ (VIRT_ADDR) VME_A16_MSTR_LOCAL, (PHYS_ADDR) VME_A16_MSTR_LOCAL, VME_A16_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 }, { /* //////////////////////////// ACROMAG AVME9675 //////////////////////////// */ /* Add access to VME CS CSR space */ (VIRT_ADDR) VME_CS_CSR_LOCAL, (PHYS_ADDR) VME_CS_CSR_LOCAL, VME_A24_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 }, { /* //////////////////////////// ACROMAG AVME9675 //////////////////////////// */ /* Access to PCI bus 0.0 non-prefetchable memory space */ (VIRT_ADDR) PCI0_MSTR_MEMIO_LOCAL, (PHYS_ADDR) PCI0_MSTR_MEMIO_LOCAL, PCI0_MSTR_MEMIO_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 }, { 2. Changes require the rebuilding of the VxWorks kernel and the bootroms. Additional Note: If you receive "WTX 0x10034 (LOADER_RELOCATION_OFFSET_TOO_LARGE)" dialog while downloading to the target, you will need to add the '-mlongcall' compiler flag to the build properties. Basically, choose the "Build" tab, then right click on "PPC604gnu" or whatever tool chain you are using, pick build properties. Then select "C/C++ compiler" tab, and then put in the '-mlongcall' compiler flag. Click on "Apply" and then "Ok". Then select the Rebuild All option for your project and download again. If you are using the diab compiler then add the '-Xcode-absolute-far' compiler flag to the build properties. end mv6100 BSP adjustments ////////////////////////////// mv6100 BSP adjustments //////////////////////////////