int cfo_bdpi(unsigned int data, int cycle) { Complex signal = unpack(data); // frequency offset in kilohertz double freq_offset = getenvd("CHANNEL_CFO", 0.0); Complex res = cfo(signal, freq_offset, cycle); return pack(res); }
int run_test_forked_in_gdb(execute_context_t * ecp, test_results_t *testp){ int status; char buffer[100] = "unittest_XXXXXX"; char * tempfile = create_tempfile(buffer,testp->suite_name, testp->test_name); pid_t child_pid = run_test_forked_h1(ecp, testp,1); char bufferp[2000]; sprintf(bufferp, "%s -x %s -q -p %u",getenvd("GDB", "gdb"),tempfile, child_pid); system (bufferp); waitpid(child_pid, &status,0); unlink(buffer); return status; }
double get_snr() { return getenvd("ADDNOISE_SNR", DEFAULT_SNR); }
int main(int argc, char *argv[]) { const char *filename = getFilename(argv[0]); std::string target, compilerCommand; splitCompilerName(filename, &target, &compilerCommand); std::string compilerBaseDir = getBaseDir(compilerCommand); if (compilerBaseDir.size() && compilerBaseDir[compilerBaseDir.size() - 1] != '/') { compilerBaseDir += '/'; } compilerCommand = compilerBaseDir + "bin/" + compilerCommand; // Determine SDK and deployment settings. const char *sdkPath = getenvd("IOS_SDK", IOS_SDK_DEFAULT); const char *iOSMinVer = getenvd("IPHONEOS_DEPLOYMENT_TARGET", IOS_MIN_VER_DEFAULT); unsetenv("IPHONEOS_DEPLOYMENT_TARGET"); std::string iOSMinVerParam = "-miphoneos-version-min="; iOSMinVerParam += iOSMinVer; // Set default archtitecture based on minimum iOS version. int major = -1, minor = -1; if (sscanf(iOSMinVer, "%d.%d", &major, &minor) != 2) { abort(); } // armv6 devices only support up to iOS 4.2.1. If we deploy for such an // old version, we default that architecture. const char *arch; if (major <= 4) { arch = "armv6"; } else { arch = "armv7"; } // Make sure all program binaries created are automatically signed. std::string codesign = target + "-codesign_allocate"; setenv("CODESIGN_ALLOCATE", codesign.c_str(), 1); setenv("IOS_FAKE_CODE_SIGN", "1", 1); // Setup environment for proper execution. std::string newLdLibraryPath = compilerBaseDir; newLdLibraryPath += "lib"; char *ldLibraryPath = getenv(LIBRARY_PATH); if (ldLibraryPath && *ldLibraryPath) { newLdLibraryPath += ':'; newLdLibraryPath += ldLibraryPath; } setenv(LIBRARY_PATH, newLdLibraryPath.c_str(), 1); // Setup command line arguments for compiler. char **params = (char **)malloc(sizeof(char *) * (argc + 9)); bool hasArch = false; bool hasIPhoneOSVersionMin = false; for (int i = 1; i < argc; ++i) { if (hasPrefix(argv[i], "-arch")) { hasArch = true; break; } else if (hasPrefix(argv[i], "-miphoneos-version-min")) { hasIPhoneOSVersionMin = true; break; } } int param = 0; #define ADD_PARAM(x) params[param++] = strdup((x)) ADD_PARAM(compilerCommand.c_str()); ADD_PARAM("-target"); ADD_PARAM(target.c_str()); if (!hasArch) { ADD_PARAM("-arch"); ADD_PARAM(arch); } ADD_PARAM("-isysroot"); ADD_PARAM(sdkPath); if (!hasIPhoneOSVersionMin) { ADD_PARAM(iOSMinVerParam.c_str()); } ADD_PARAM("-mlinker-version=" LINKER_VERSION); #undef ADD_PARAM for (int i = 1; i < argc; ++i) { params[param++] = argv[i]; } params[param] = 0; execvp(compilerCommand.c_str(), params); abort(); }