Main Page | Class List | Class Members

hcalDCC::Motherboard Class Reference

The class Motherboard is used to instanciate the different Universe2 motherboards found in a crate. This class provides methods for the low level access to settings and transfers with the Tundra Universe II chip as VME-PCI bridge. More...

#include <motherboard.hh>

List of all members.

Public Member Functions

unsigned char getSlotNo () const
unsigned int getVraiAddress () const
unsigned int getVsiBaseAddress (const char *vsiName)
unsigned int getU2PciConfBaseAddress ()
 Motherboard (VMEBusAdapterInterface &busAdapter, unsigned char slotNumber, Logger logger, unsigned long baseAddress=0, bool readonly=false, int debug=0) throw (hcalDCC::Exception)
void setVraiAddress (unsigned int newAddress)
int init () throw (hcalDCC::Exception)
int u2SetUpVrai ()
int u2SetUpVsi (const char *sVsiName)
U2image * getImage (const char *imageType) const
void updateVmeBase (const U2image *vsi)
void updatePciBase (const U2image *vsi)
int pciMemAlloc ()
int initPciDev ()
const char * getDevAlias (unsigned char busNo, unsigned char devNo)
const char * getDevDescription (unsigned char busNo, unsigned char devNo)
Logger getLogger () const
void setLogger (Logger logger)
 ~Motherboard ()
bool isReadOnly ()

Static Public Attributes

const unsigned char maxNumOfDev = 14
const unsigned char maxNumOfBuses = 3
const unsigned char maxNumOfDevPerBus = 5
const unsigned char u2ConnectedBusNum = 0
const unsigned char u2ConnectedDevNum = 0
const unsigned int u2ConnectedPciId = 0xAC21104C
const char * devAlias [maxNumOfDev]
const char * devDescription [maxNumOfDev]
const unsigned char bNo [maxNumOfDev] = {0,0,0,0,0, 1,1,1,1,1, 2,2,2,2}
const unsigned char dNo [maxNumOfDev] = {0,1,2,3,4, 0,1,2,3,4, 1,2,3,4}


Detailed Description

The class Motherboard is used to instanciate the different Universe2 motherboards found in a crate. This class provides methods for the low level access to settings and transfers with the Tundra Universe II chip as VME-PCI bridge.

Author:
Fernando Varela (Boston University)
Revision
1.1

Date
2005/04/29 19:52:42

The class Motherboard is used to instanciate the different U2 motherboards found in a crate. This class provides methods for the low level access to settings and transfers with the Tundra Universe II chip as VME-PCI bridge. Each Motherboard object has a VME Register Access Image (VRAI) and VME Slave Images (VSI) to access the PCI Configuration, Memory, Fast Memory and IO spaces. There is one of these images per U2 motherboard. The size of the VRAI, which is used for the configuration of the U2 chip, is fixed 4Kbytes (0x1000). The size of the ocnfiguration VSI is also fixed taking into account that there are 2 PCI buses and the configuration of each bus requires 64 kbytes, thus the configuration VSI is 192 kbytes big. The sizes of the memory, fast memory and IO VSI is determined by scanning the PCI buses and querying the attached devices for memory needs. This is done by the function CUniverse::pciScanBuses.


Constructor & Destructor Documentation

hcalDCC::Motherboard::Motherboard VMEBusAdapterInterface &  busAdapter,
unsigned char  slotNumber,
Logger  logger,
unsigned long  baseAddress = 0,
bool  readonly = false,
int  debug = 0
throw (hcalDCC::Exception)
 

Class constructor

hcalDCC::Motherboard::~Motherboard  ) 
 

class destructor


Member Function Documentation

const char * hcalDCC::Motherboard::getDevAlias unsigned char  busNo,
unsigned char  devNo
 

Given a pair bus and device numbers, this function returns the device alias as defined in the file logicalAliases.hh

Parameters:
busNo is the bus number (Geographical location)
devNo is the device number (Geographical location)
Returns:
Device alias as a const char*

const char * hcalDCC::Motherboard::getDevDescription unsigned char  busNo,
unsigned char  devNo
 

Given a pair bus and device numbers, this function returns the device description as defined in the file logicalAliases.hh

Parameters:
busNo is the bus number (Geographical location)
devNo is the device number (Geographical location)
Returns:
Device description as a const char*

Motherboard::U2image * hcalDCC::Motherboard::getImage const char *  imageType  )  const
 

This method returns a pointer to the requested U2 image. Images supported: "vrai", "conf", "mem", "fmem" and "io" which are VRAI, PCI configuration, PCI memory, PCI *fast* memory and PCI I/O respectively.

Parameters:
imageType is the image type name as a const char*
Returns:
A U2image* to the corresponding VSI image.

Logger hcalDCC::Motherboard::getLogger  )  const
 

Get access to an appropriate logger

unsigned char hcalDCC::Motherboard::getSlotNo  )  const [inline]
 

Returns the slot number in the VME crate for the current motherboard

Returns:
Slot number as unsigned char

unsigned int hcalDCC::Motherboard::getU2PciConfBaseAddress  )  [inline]
 

Wrapper function to get the U2 PCI configuration base address

unsigned int hcalDCC::Motherboard::getVraiAddress  )  const [inline]
 

Returns the VRAI VME base address

Returns:
VRAI VME base address as unsigned int

unsigned int hcalDCC::Motherboard::getVsiBaseAddress const char *  vsiName  ) 
 

Returns the VSI base address from the VSI name

int hcalDCC::Motherboard::init  )  throw (hcalDCC::Exception)
 

This method allows initializing all PCI devices connected to the tree PCI buses of the current motherboard. In order to achive this, the method performs several steps:

  • Sets up a VME image for register access (VRAI) by calling u2SetUpVrai

  • Sets up a VME slave image to access the PCI configuration space.

  • Using the PCI configuration VSI set up in the previous step, it scans the three PCI buses for PCI devices. At this stage, each PCI device is requested to report its memory needs in terms of type of memory (mem, fmem and io) and its size. These values will be added up in order to determine the size of the mem, fmem and io VSIs.

  • Allocates the memory requests determined in the previous step.

  • Sets up the VSIs for the mem, fmem and io spaces using the values determined previously.

  • Initializes all PCI devices connected to the motherboard by calling the method initPciDev()
    Returns:
    int OK or ERROR depeding upon the execution of the method.

int hcalDCC::Motherboard::initPciDev  ) 
 

This method performs the initialization of all PCI devices of the current U2 motherboard. Essetially, it loops over the devices and calls the method PciDev::initDev() for each of them.

Returns:
int OK or ERROR depending upon the execution of the procedure.

bool hcalDCC::Motherboard::isReadOnly  )  [inline]
 

Checks if we are dealing with a read-only motherboard

Returns:
Read-only flag

int hcalDCC::Motherboard::pciMemAlloc  ) 
 

This utility function is called by initU2 in order to allocate the memory requested by the PCI devices for each of the types mem, fmem, and io. This function loops over the different PCI devices in the current motherboard and for each of the devices, loops over the memory requests and calls the function PciDev::doMemAlloc() for each of these devices.

Returns:
int OK or ERROR depending upon the execution of the procedure.

void hcalDCC::Motherboard::setLogger Logger  logger  ) 
 

Change the logger for this motherboard

void hcalDCC::Motherboard::setVraiAddress unsigned int  newAddress  ) 
 

Utility method to set the VME VRAI base address of a motherboard. Note that the value is not written to the hardware but only in the code

Parameters:
newAddress is the new VME VRAI base address to be set as unsigned int.

int hcalDCC::Motherboard::u2SetUpVrai  ) 
 

This method set ups the U2 VRAI at the level of software, i.e. sets the data members of the U2image for the VRAI, but also writes the corresponding parameters to the U2 chip using HAL

Returns:
int OK or ERROR depeding upon the execution of the method.

int hcalDCC::Motherboard::u2SetUpVsi const char *  sVsiName  ) 
 

This method set ups the U2 VSI specified by the char* sVsiName: "conf", "mem", "fmem" or "io". The method initializes the U2image data members for the VSIs. The values are also written to the corresponding parameters to the U2 chip using HAL

Returns:
int OK or ERROR depeding upon the execution of the method.

void hcalDCC::Motherboard::updatePciBase const U2image *  vsi  ) 
 

This utility function is called by u2SetUpVsi in order to increase the PCI base address counter. This parameter will then be used as PCI base addresss of the next VSI.

Parameters:
vsi is a pointer to the VSI image

void hcalDCC::Motherboard::updateVmeBase const U2image *  vsi  ) 
 

This utility function is called by u2SetUpVsi in order to increase the VME base address counter. This parameter will then be used as VME base addresss of the next VSI.

Parameters:
vsi is a pointer to the VSI image


Member Data Documentation

const unsigned char hcalDCC::Motherboard::bNo = {0,0,0,0,0, 1,1,1,1,1, 2,2,2,2} [static]
 

Array of PCI bus numbers

const char * hcalDCC::Motherboard::devAlias [static]
 

Initial value:

 {DA00, DA01, DA02, DA03, DA04,
                                                                 DA10, DA11, DA12, DA13, DA14,
                                                                 DA21, DA22, DA23, DA24}
Mnemonic names of STT PCI devices and corresponding bus and device numbers

const char * hcalDCC::Motherboard::devDescription [static]
 

Initial value:

 {DD00, DD01, DD02, DD03, DD04,
                                                                       DD10, DD11, DD12, DD13, DD14,
                                                                       DD21, DD22, DD23, DD24}
Device's descriptions of STT PCI devices and corresponding bus and device numbers

const unsigned char hcalDCC::Motherboard::dNo = {0,1,2,3,4, 0,1,2,3,4, 1,2,3,4} [static]
 

Array of PCI device numbers

const unsigned char hcalDCC::Motherboard::maxNumOfBuses = 3 [static]
 

Maximum number of PCI buses per U2 motherboard

const unsigned char hcalDCC::Motherboard::maxNumOfDev = 14 [static]
 

Maximum number of PCI device per U2 motherboard

const unsigned char hcalDCC::Motherboard::maxNumOfDevPerBus = 5 [static]
 

Maximum number of PCI device per PCI bus

const unsigned char hcalDCC::Motherboard::u2ConnectedBusNum = 0 [static]
 

U2 primary PCI bus number (Texas intrument bridge, br3, is connected to this bus)

const unsigned char hcalDCC::Motherboard::u2ConnectedDevNum = 0 [static]
 

Device number of a device permanently connected to the PCI primary bus (Texas Inst. "PCI2301" PCI-to-PCI bridge)

const unsigned int hcalDCC::Motherboard::u2ConnectedPciId = 0xAC21104C [static]
 

PCI Id of a device permanently connected to the PCI primary bus (Texas Inst. "PCI2301" PCI-to-PCI bridge)


The documentation for this class was generated from the following files:
Generated on Fri Jul 8 20:52:05 2005 for HCAL Data Concentrator Card by  doxygen 1.3.9.1