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 Generic Carrier Boards V3.0 01/20/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 - IPACK Carrier Functions This document defines the functions that each IPACK carrier board software must implement in order for the software drivers for the IPACKS to be portable between different hardware targets. This results in only having to change the carrier software and re-link each IPACK with this new module. Selecting carrier support is accomplished by copying the specific carrier's source files to the generic names "carrier.c" and "carrier.h" in the carrier subdirectory. --- Acromag PCI IP Carrier Boards Using VxWorks 6.x The file PCICarrierHelper.c must be added to the vxWorks Pentium kernel project. The function MapAcromagPCICarriers() must be added as the last line of code in the vxWorks kernel function sysHwInit() found in the file sysLib.c in the Pentium BSP tree. The function MapAcromagPCICarriers() will search the PCI bus mapping the I/O and IP memory spaces of all Acromag PCI carriers. Memory spaces must be mapped prior to the call to usrMmuInit() to initialize the CPU's MMU. --- Acromag PCI IP Carrier Boards Using VxWorks 5.5.1 and earlier PCI IP Carrier source files contain a define for VxWorks 5.5.1 and earlier versions. The BUILD_FOR_VXWORKS_5DOT5_AND_EARLIER define may be uncommented for users of VxWorks 5.5.1 or earlier. It should remain commented out for VxWorks 6.x versions. The file PCICarrierHelper.c is not required for VxWorks 5.5.1 and earlier. --- For the APC8610 ISA carrier, jumpers select the address of the carrier control registers (four bytes in I/O space required). This is in addition to the I/O space required by the IP modules. The address for IP module I/O space is programmed by the carrier Base address register. This register selects the I/O space address for all four IP modules. The base address corresponds to the address of the IP module in slot A. Slot B = base + 0x400, Slot C = base + 0x800, Slot D = base + 0xC00. Initial values: jumpers select the address of the carrier control registers = 0x180. base address = 0x100. IP module in Slot A = 0x100 to 0x17F, Slot B = 0x500 to 0x57F, Slot C = 0x900 to 0x97F, Slot D = 0xD00 to 0xD7F. 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 GetCarrierAddress(int nHandle, long* pAddress); This function is general purpose and will return a pointer to the carriers base address. CSTATUS SetCarrierAddress(int nHandle, long pAddress); This function is general purpose and will set the carriers base address. Carriers base address can also be set when calling CarrierOpen(). CSTATUS GetIpackAddress(int nHandle, char chSlot, long* pAddress); This function should be used by the IPACK software drivers to get the base address of the IPACK's I/O space for a given slot on the carrier. The address can be a pointer to memory in case of the PCI/VME, or the I/O address in the case of an ISA carrier. CSTATUS ReadIpackID(int nHandle, char chSlot, word* pWords, int nWords); This function will read nWords words from the ID space of the IPACK located in slot chSlot on the carrier. The memory for the word array must be allocated by the caller of this function. CSTATUS EnableInterrupts(int nHandle); Calling this function will enable interrupts on the carrier board. The individual IPACKS will still need to have their interrupts enabled before an interrupt will occur. CSTATUS DisableInterrupts(int nHandle); Calling this function will disable interrupts on the carrier board. Each IPACK should have its interrupts disabled as well if calling this function. CSTATUS SetInterruptLevel(int nHandle, word uLevel); This function is used by the ISA/VME carriers to set the appropriate interrupt level, or IRQ line that the carrier will use for interrupts. Calling this function for the PCI carrier will return an error value, because the PCI interrupt line is set by the system BIOS on system power up. CSTATUS GetInterruptLevel(int nHandle, word* uLevel); This function will return the interrupt level that is currently set for the carrier board. CSTATUS SetInterruptHandler(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 InitCarrierLib(void); This function will initialize all the global data needed for the carrier driver. CSTATUS CarrierOpen(long lBaseAddress, int* pHandle); This function will initialize the carrier structures with the appropriate values based on pBaseAddress. A carrier handle will be returned in the parameter pHandle. CSTATUS CarrierInitialize(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 CarrierClose(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(). byte GetLastSlotLetter(void); This function returns the ASCII value of the Capital letter for the last slot letter that this carrier supports. ///////////////// enhanced functions ///////////////// This library may be used with both enhanced and non-enhanced carriers. Calling the enhanced functions will not harm existing non-enhanced hardware. The enhanced functions check to be sure of the carrier's capabilities. CarrierInitialize() must be called before calling any enhanced function. Enhanced functions will return "E_NOT_IMPLEMENTED" for a non-enhanced carrier. //////////////////////////////////////////////////////////////// CSTATUS GetMemoryAddress(int nHandle, long* pAddress) This function is general purpose and will return a pointer to the IP module memory base address. CSTATUS SetMemoryAddress(int nHandle, long lAddress) This function is general purpose and will set the IP module memory base address. CSTATUS GetIpackMemoryAddress(int nHandle, char chSlot, long* pAddress); This function should be used by the IPACK software drivers to get the base address of the IPACK's Memory space for a given slot on the carrier. The address is a pointer to memory. CarrierInitialize() must be called before calling GetIpackMemoryAddress(). CSTATUS SetIPClockControl(int nHandle, char chSlot, word uControl); This function will set the state of the carriers IP clock control bit for the specified slot, 0 = 8MHZ, 1 = 32MHZ IP clock. CarrierInitialize() must be called before calling SetIPClockControl(). CSTATUS GetIPClockControl(int nHandle, char chSlot, word* pControl); This function will return the state of the carriers IP clock control bit for the specified slot, 0 = 8MHZ, 1 = 32MHZ IP clock. CarrierInitialize() must be called before calling GetIPClockControl(). CSTATUS GetCarrierID(int nHandle, word* pCarrierID); This function is general purpose and will return the carriers ID value. CarrierInitialize() must be called before calling GetCarrierID().