00001 #ifndef SCTCONF_MARSHALLING_H 00002 #define SCTCONF_MARSHALLING_H 00003 00004 ABCDModule copyILUToABCDModule(const sctConf_T_ABCDModule& iluModule) { 00006 assert(sizeof(ABCDModule) == sizeof(sctConf_T_ABCDModule)); 00007 00008 return ABCDModule(reinterpret_cast<const ABCDModule&>(iluModule)); 00009 } 00010 00011 sctConf_T_ABCDModule* copyABCDModuleToILU(const ABCDModule &module) { 00012 00014 assert(sizeof(ABCDModule) == sizeof(sctConf_T_ABCDModule)); 00015 00016 return new sctConf_T_ABCDModule(reinterpret_cast<const sctConf_T_ABCDModule&>(module)) ; 00017 } 00018 00019 SctConfiguration::RodConfig copyILUToRodConfig(sctConf_T_RodConfig *iluConfig) { 00020 SctConfiguration::RodConfig realConfig; 00021 00022 realConfig.baseAddress = iluConfig->baseAddress; 00023 realConfig.mapSize = iluConfig->mapSize; 00024 realConfig.resetLevel = 0; 00025 realConfig.numSlaves = iluConfig->numSlaves; 00026 00027 if(iluConfig->slaves->Length() != 4) { 00028 throw SctConfiguration::ConfigurationException("RodConfig must contain 4 slaves!"); 00029 } 00030 00031 for(int i=0; i<4; i++) { 00032 realConfig.slaves[i].emifFile = iluConfig->slaves->Nth(i)->emifFile; 00033 realConfig.slaves[i].ipramFile = iluConfig->slaves->Nth(i)->ipramFile; 00034 realConfig.slaves[i].idramFile = iluConfig->slaves->Nth(i)->idramFile; 00035 realConfig.slaves[i].extFile = iluConfig->slaves->Nth(i)->extFile; 00036 } 00037 00038 return realConfig; 00039 } 00040 00041 sctConf_T_RodConfig *copyRodConfigToILU(const SctConfiguration::RodConfig &config) { 00042 sctConf_T_RodConfig *result = new sctConf_T_RodConfig; 00043 00044 result->baseAddress = config.baseAddress; 00045 result->mapSize = config.mapSize; 00046 result->numSlaves = config.numSlaves; 00047 00048 result->slaves = _sctConf_T_SlaveList_sequence::Create(4, NULL); 00049 result->slaves->Clear(0); 00050 00051 for(int i=0; i<4; i++) { 00052 sctConf_T_SlaveConfig *slave = new sctConf_T_SlaveConfig; 00053 00054 const SctConfiguration::SlaveConfig &conf = config.slaves[i]; 00055 00056 slave->emifFile = (char *)malloc((conf.emifFile.length()+1) * sizeof(char)); 00057 strncpy(slave->emifFile, conf.emifFile.c_str(), conf.emifFile.length()); 00058 slave->emifFile[conf.emifFile.length()] = 0; 00059 00060 slave->ipramFile = (char *)malloc((conf.ipramFile.length()+1) * sizeof(char)); 00061 strncpy(slave->ipramFile, conf.ipramFile.c_str(), conf.ipramFile.length()); 00062 slave->ipramFile[conf.ipramFile.length()] = 0; 00063 00064 slave->idramFile = (char *)malloc((conf.idramFile.length()+1) * sizeof(char)); 00065 strncpy(slave->idramFile, conf.idramFile.c_str(), conf.idramFile.length()); 00066 slave->idramFile[conf.idramFile.length()] = 0; 00067 00068 slave->extFile = (char *)malloc((conf.extFile.length()+1) * sizeof(char)); 00069 strncpy(slave->extFile, conf.extFile.c_str(), conf.extFile.length()); 00070 slave->extFile[conf.extFile.length()] = 0; 00071 00072 result->slaves->Append(slave); 00073 } 00074 00075 return result; 00076 } 00077 00078 SctConfiguration::BOCChannelConfig copyILUToBOCChannelConfig(sctConf_T_BOCChannelConfig *iluConfig) { 00079 SctConfiguration::BOCChannelConfig newConf; 00080 00081 newConf.current = iluConfig->current; 00082 newConf.delay = iluConfig->delay; 00083 newConf.markSpace = iluConfig->markSpace; 00084 00085 newConf.threshold0 = iluConfig->threshold0; 00086 newConf.delay0 = iluConfig->delay0; 00087 00088 newConf.threshold1 = iluConfig->threshold1; 00089 newConf.delay1 = iluConfig->delay1; 00090 00091 return newConf; 00092 } 00093 00094 sctConf_T_BOCChannelConfig *copyBOCChannelConfigToILU(const SctConfiguration::BOCChannelConfig &config) { 00095 sctConf_T_BOCChannelConfig *res = new sctConf_T_BOCChannelConfig; 00096 00097 res->current = config.current; 00098 res->delay = config.delay; 00099 res->markSpace = config.markSpace; 00100 00101 res->threshold0 = config.threshold0; 00102 res->delay0 = config.delay0; 00103 00104 res->threshold1 = config.threshold1; 00105 res->delay1 = config.delay1; 00106 00107 return res; 00108 } 00109 00110 SctConfiguration::BOCGlobalConfig copyILUToBOCGlobalConfig(sctConf_T_BOCGlobalConfig *iluConfig) { 00111 SctConfiguration::BOCGlobalConfig newConf; 00112 00113 newConf.validMask = iluConfig->validMask; 00114 newConf.clockControl = iluConfig->clockControl; 00115 newConf.rxDataMode = iluConfig->rxDataMode; 00116 newConf.rxDacClear = iluConfig->rxDacClear; 00117 newConf.txDacClear = iluConfig->txDacClear; 00118 newConf.vernierFinePhase = iluConfig->vernierFinePhase; 00119 newConf.vernierClockPhase0 = iluConfig->vernierClockPhase0; 00120 newConf.vernierClockPhase1 = iluConfig->vernierClockPhase1; 00121 newConf.bpmClockPhase = iluConfig->bpmClockPhase; 00122 newConf.bregClockPhase = iluConfig->bregClockPhase; 00123 00124 return newConf; 00125 } 00126 00127 sctConf_T_BOCGlobalConfig *copyBOCGlobalConfigToILU(const SctConfiguration::BOCGlobalConfig &config) { 00128 sctConf_T_BOCGlobalConfig *res = new sctConf_T_BOCGlobalConfig; 00129 00130 res->validMask = config.validMask; 00131 res->clockControl = config.clockControl; 00132 res->rxDataMode = config.rxDataMode; 00133 res->rxDacClear = config.rxDacClear; 00134 res->txDacClear = config.txDacClear; 00135 res->vernierFinePhase = config.vernierFinePhase; 00136 res->vernierClockPhase0 = config.vernierClockPhase0; 00137 res->vernierClockPhase1 = config.vernierClockPhase1; 00138 res->bpmClockPhase = config.bpmClockPhase; 00139 res->bregClockPhase = config.bregClockPhase; 00140 00141 return res; 00142 } 00143 00144 SctConfiguration::TimConfig copyILUToTimConfig(sctConf_T_TimConfig *iluConfig) { 00145 SctConfiguration::TimConfig result; 00146 00147 result.baseAddress = iluConfig->baseAddress; 00148 result.mapSize = iluConfig->mapSize; 00149 00150 return result; 00151 } 00152 00153 sctConf_T_TimConfig *copyTimConfigToILU(const SctConfiguration::TimConfig &config) { 00154 sctConf_T_TimConfig *res = new sctConf_T_TimConfig; 00155 00156 res->baseAddress = config.baseAddress; 00157 res->mapSize = config.mapSize; 00158 00159 return res; 00160 } 00161 00162 #endif //SCTCONF_MARSHALLING_H