1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
17 // $MpId: AliMpFrtCrocusConstants.cxx,v 1.4 2006/05/24 13:58:34 ivana Exp $
19 //-----------------------------------------------------------------------------
20 // Class AliMpFrtCrocusConstants
21 // --------------------
22 // The class defines the constants for FRT Crocus
23 // Author: Ch. Finck, Subatech Nantes
24 //-----------------------------------------------------------------------------
26 #include "AliMpFrtCrocusConstants.h"
29 ClassImp(AliMpFrtCrocusConstants)
32 const Int_t AliMpFrtCrocusConstants::fgkLinkPorts[10] = {0, 1, 2, 3, 5, 0, 1, 2, 3, 5};
33 const Int_t AliMpFrtCrocusConstants::fgkOffset = 5;
34 const Int_t AliMpFrtCrocusConstants::fgkNofDsps = 2;
35 const Int_t AliMpFrtCrocusConstants::fgkNofBusPatches = 10;
36 const UInt_t AliMpFrtCrocusConstants::fgkBaseAddress = 0x00040000;
37 const UInt_t AliMpFrtCrocusConstants::fgkAddressOffset = 0x00010000;
39 //____________________________________________________________________
40 Int_t AliMpFrtCrocusConstants::GetGlobalFrtID(Int_t localID, Int_t ddlID)
42 /// return global bus id from local frt and ddl id
44 return ddlID*fgkOffset + localID;
47 //____________________________________________________________________
48 Int_t AliMpFrtCrocusConstants::GetLocalFrtID(Int_t globalID, Int_t ddlID)
50 /// return local bus id from local frt id
52 return globalID - ddlID*fgkOffset;
56 //______________________________________________________________________________
57 AliMpFrtCrocusConstants::AliMpFrtCrocusConstants()
60 /// Standard constructor
64 //______________________________________________________________________________
65 AliMpFrtCrocusConstants::~AliMpFrtCrocusConstants()
74 //______________________________________________________________________________
75 UInt_t AliMpFrtCrocusConstants::GetTopAddress(Int_t id)
77 /// return WME top address
79 Int_t localFrtId = id % fgkOffset;
81 return fgkBaseAddress + 2*localFrtId * fgkAddressOffset;
85 //______________________________________________________________________________
86 Int_t AliMpFrtCrocusConstants::GetIdFromTopAddress(UInt_t add)
88 /// return id from WME top address
90 return (add - fgkBaseAddress)/(2*fgkAddressOffset);
95 //______________________________________________________________________________
96 UInt_t AliMpFrtCrocusConstants::GetBotAddress(Int_t id)
98 /// return WME bottom address
100 Int_t localFrtId = id % fgkOffset;
102 return fgkBaseAddress + (2*localFrtId+1) * fgkAddressOffset;
106 //______________________________________________________________________________
107 Int_t AliMpFrtCrocusConstants::GetIdFromBotAddress(UInt_t add)
109 /// return id from WME bottom address
111 return (add - fgkBaseAddress - fgkAddressOffset)/(2*fgkAddressOffset);
116 //______________________________________________________________________________
117 MpPair_t AliMpFrtCrocusConstants::GetLinkPortId(Int_t index)
119 /// Return the linkPort/dspId by index
121 if ( index >= fgkNofBusPatches ) return -1;
124 if (index < fgkOffset)
129 return AliMp::Pair(dspId, fgkLinkPorts[index]);
133 //______________________________________________________________________________
134 Int_t AliMpFrtCrocusConstants::GetNofDsps()
136 /// Return the number of DSPs connected to this FRT
141 //______________________________________________________________________________
142 Int_t AliMpFrtCrocusConstants::GetNofBusPatches()
144 /// Return the number of BusPatches connected to this FRT
146 return fgkNofBusPatches;