Line data Source code
1 : /**************************************************************************
2 : * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 : * *
4 : * Author: The ALICE Off-line Project. *
5 : * Contributors are mentioned in the code where appropriate. *
6 : * *
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 : **************************************************************************/
15 :
16 : // $Id$
17 : // $MpId: AliMpFrtCrocusConstants.cxx,v 1.4 2006/05/24 13:58:34 ivana Exp $
18 :
19 : //-----------------------------------------------------------------------------
20 : // Class AliMpFrtCrocusConstants
21 : // --------------------
22 : // The class defines the constants for FRT Crocus
23 : // Author: Ch. Finck, Subatech Nantes
24 : //-----------------------------------------------------------------------------
25 :
26 : #include "AliMpFrtCrocusConstants.h"
27 :
28 : /// \cond CLASSIMP
29 18 : ClassImp(AliMpFrtCrocusConstants)
30 : /// \endcond
31 :
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;
38 :
39 : //____________________________________________________________________
40 : Int_t AliMpFrtCrocusConstants::GetGlobalFrtID(Int_t localID, Int_t ddlID)
41 : {
42 : /// return global bus id from local frt and ddl id
43 :
44 0 : return ddlID*fgkOffset + localID;
45 :
46 : }
47 : //____________________________________________________________________
48 : Int_t AliMpFrtCrocusConstants::GetLocalFrtID(Int_t globalID, Int_t ddlID)
49 : {
50 : /// return local bus id from local frt id
51 :
52 0 : return globalID - ddlID*fgkOffset;
53 :
54 : }
55 :
56 : //______________________________________________________________________________
57 : AliMpFrtCrocusConstants::AliMpFrtCrocusConstants()
58 0 : : TObject()
59 0 : {
60 : /// Standard constructor
61 0 : }
62 :
63 :
64 : //______________________________________________________________________________
65 : AliMpFrtCrocusConstants::~AliMpFrtCrocusConstants()
66 0 : {
67 : /// Destructor
68 0 : }
69 :
70 : //
71 : // public methods
72 : //
73 :
74 : //______________________________________________________________________________
75 : UInt_t AliMpFrtCrocusConstants::GetTopAddress(Int_t id)
76 : {
77 : /// return WME top address
78 :
79 0 : Int_t localFrtId = id % fgkOffset;
80 :
81 0 : return fgkBaseAddress + 2*localFrtId * fgkAddressOffset;
82 :
83 : }
84 :
85 : //______________________________________________________________________________
86 : Int_t AliMpFrtCrocusConstants::GetIdFromTopAddress(UInt_t add)
87 : {
88 : /// return id from WME top address
89 :
90 0 : return (add - fgkBaseAddress)/(2*fgkAddressOffset);
91 :
92 : }
93 :
94 :
95 : //______________________________________________________________________________
96 : UInt_t AliMpFrtCrocusConstants::GetBotAddress(Int_t id)
97 : {
98 : /// return WME bottom address
99 :
100 0 : Int_t localFrtId = id % fgkOffset;
101 :
102 0 : return fgkBaseAddress + (2*localFrtId+1) * fgkAddressOffset;
103 :
104 : }
105 :
106 : //______________________________________________________________________________
107 : Int_t AliMpFrtCrocusConstants::GetIdFromBotAddress(UInt_t add)
108 : {
109 : /// return id from WME bottom address
110 :
111 0 : return (add - fgkBaseAddress - fgkAddressOffset)/(2*fgkAddressOffset);
112 :
113 : }
114 :
115 :
116 : //______________________________________________________________________________
117 : MpPair_t AliMpFrtCrocusConstants::GetLinkPortId(Int_t index)
118 : {
119 : /// Return the linkPort/dspId by index
120 :
121 0 : if ( index >= fgkNofBusPatches ) return -1;
122 :
123 : Int_t dspId;
124 0 : if (index < fgkOffset)
125 0 : dspId = 0;
126 : else
127 : dspId = 1;
128 :
129 0 : return AliMp::Pair(dspId, fgkLinkPorts[index]);
130 :
131 0 : }
132 :
133 : //______________________________________________________________________________
134 : Int_t AliMpFrtCrocusConstants::GetNofDsps()
135 : {
136 : /// Return the number of DSPs connected to this FRT
137 :
138 0 : return fgkNofDsps;
139 : }
140 :
141 : //______________________________________________________________________________
142 : Int_t AliMpFrtCrocusConstants::GetNofBusPatches()
143 : {
144 : /// Return the number of BusPatches connected to this FRT
145 :
146 0 : return fgkNofBusPatches;
147 : }
148 :
149 :
|