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.numSlaves = iluConfig->numSlaves; 00025 00026 if(iluConfig->slaves->Length() != 4) { 00027 throw SctConfiguration::ConfigurationException("RodConfig must contain 4 slaves!"); 00028 } 00029 00030 for(int i=0; i<4; i++) { 00031 realConfig.slaves[i].emifFile = iluConfig->slaves->Nth(i)->emifFile; 00032 realConfig.slaves[i].ipramFile = iluConfig->slaves->Nth(i)->ipramFile; 00033 realConfig.slaves[i].idramFile = iluConfig->slaves->Nth(i)->idramFile; 00034 realConfig.slaves[i].extFile = iluConfig->slaves->Nth(i)->extFile; 00035 } 00036 00037 return realConfig; 00038 } 00039 00040 sctConf_T_RodConfig *copyRodConfigToILU(const SctConfiguration::RodConfig &config) { 00041 sctConf_T_RodConfig *result = new sctConf_T_RodConfig; 00042 00043 result->baseAddress = config.baseAddress; 00044 result->mapSize = config.mapSize; 00045 result->numSlaves = config.numSlaves; 00046 00047 result->slaves = _sctConf_T_SlaveList_sequence::Create(4, NULL); 00048 result->slaves->Clear(0); 00049 00050 for(int i=0; i<4; i++) { 00051 sctConf_T_SlaveConfig *slave = new sctConf_T_SlaveConfig; 00052 00053 const SctConfiguration::SlaveConfig &conf = config.slaves[i]; 00054 00055 slave->emifFile = (char *)malloc((conf.emifFile.length()+1) * sizeof(char)); 00056 strncpy(slave->emifFile, conf.emifFile.c_str(), conf.emifFile.length()); 00057 slave->emifFile[conf.emifFile.length()] = 0; 00058 00059 slave->ipramFile = (char *)malloc((conf.ipramFile.length()+1) * sizeof(char)); 00060 strncpy(slave->ipramFile, conf.ipramFile.c_str(), conf.ipramFile.length()); 00061 slave->ipramFile[conf.ipramFile.length()] = 0; 00062 00063 slave->idramFile = (char *)malloc((conf.idramFile.length()+1) * sizeof(char)); 00064 strncpy(slave->idramFile, conf.idramFile.c_str(), conf.idramFile.length()); 00065 slave->idramFile[conf.idramFile.length()] = 0; 00066 00067 slave->extFile = (char *)malloc((conf.extFile.length()+1) * sizeof(char)); 00068 strncpy(slave->extFile, conf.extFile.c_str(), conf.extFile.length()); 00069 slave->extFile[conf.extFile.length()] = 0; 00070 00071 result->slaves->Append(slave); 00072 } 00073 00074 return result; 00075 } 00076 00077 SctConfiguration::BOCChannelConfig copyILUToBOCChannelConfig(sctConf_T_BOCChannelConfig *iluConfig) { 00078 SctConfiguration::BOCChannelConfig newConf; 00079 00080 newConf.current = iluConfig->current; 00081 newConf.delay = iluConfig->delay; 00082 newConf.markSpace = iluConfig->markSpace; 00083 00084 newConf.threshold0 = iluConfig->threshold0; 00085 newConf.delay0 = iluConfig->delay0; 00086 00087 newConf.threshold1 = iluConfig->threshold1; 00088 newConf.delay1 = iluConfig->delay1; 00089 00090 return newConf; 00091 } 00092 00093 sctConf_T_BOCChannelConfig *copyBOCChannelConfigToILU(const SctConfiguration::BOCChannelConfig &config) { 00094 sctConf_T_BOCChannelConfig *res = new sctConf_T_BOCChannelConfig; 00095 00096 res->current = config.current; 00097 res->delay = config.delay; 00098 res->markSpace = config.markSpace; 00099 00100 res->threshold0 = config.threshold0; 00101 res->delay0 = config.delay0; 00102 00103 res->threshold1 = config.threshold1; 00104 res->delay1 = config.delay1; 00105 00106 return res; 00107 } 00108 00109 SctConfiguration::TimConfig copyILUToTimConfig(sctConf_T_TimConfig *iluConfig) { 00110 SctConfiguration::TimConfig result; 00111 00112 result.baseAddress = iluConfig->baseAddress; 00113 result.mapSize = iluConfig->mapSize; 00114 00115 return result; 00116 } 00117 00118 sctConf_T_TimConfig *copyTimConfigToILU(const SctConfiguration::TimConfig &config) { 00119 sctConf_T_TimConfig *res = new sctConf_T_TimConfig; 00120 00121 res->baseAddress = config.baseAddress; 00122 res->mapSize = config.mapSize; 00123 00124 return res; 00125 } 00126 00127 #endif //SCTCONF_MARSHALLING_H