static void cons_write (const char *buf) { unsigned long ch; while ((ch = *buf++) != '\0') { ssc(ch, 0, 0, 0, SSC_PUTCHAR); if (ch == '\n') ssc('\r', 0, 0, 0, SSC_PUTCHAR); } }
/** * \brief Set or clear all the "constant subscripts" (conscripts) in this RTL. */ int RTL::setConscripts(int n, bool bClear) { StmtConscriptSetter ssc(n, bClear); accept(ssc); return ssc.getLast(); }
static int skifs_read(struct open_file *f, void *buf, size_t size, size_t *resid) { struct disk_req req; struct disk_stat stat; req.len = size; req.addr = (u_int64_t) buf; ssc((u_int64_t) f->f_fsdata, 1, (u_int64_t) &req, f->f_offset, SSC_READ); stat.fd = (u_int64_t) f->f_fsdata; ssc((u_int64_t)&stat, 0, 0, 0, SSC_WAIT_COMPLETION); *resid = size - stat.count; f->f_offset += stat.count; return 0; }
static void efi_reset_system (int reset_type, efi_status_t status, unsigned long data_size, efi_char16_t *data) { #if defined(CONFIG_IA64_HP_SIM) || defined(CONFIG_IA64_GENERIC) ssc(status, 0, 0, 0, SSC_EXIT); #else # error Not implemented yet... #endif }
int ia64_platform_enter(const char *kernel) { while (*kernel == '/') kernel++; ssc(0, (uint64_t)kernel, 0, 0, SSC_LOAD_SYMBOLS); return (0); }
time_t time(time_t *tloc) { struct ssc_time time; ssc((u_int64_t) &time, 0, 0, 0, SSC_GET_RTC); return *tloc = EfiTimeToUnixTime(&time); }
int ski_cons_poll() { int c; if (pollchar > 0) return 1; c = ssc(0, 0, 0, 0, SSC_GETCHAR); if (!c) return 0; pollchar = c; return 1; }
static int kh_init(void) { int i, len, r; void *p; devfd = ssc(open(kgpudev, O_RDWR)); /* alloc GPU Pinned memory buffers */ p = (void*)gpu_alloc_pinned_mem(KGPU_BUF_SIZE+PAGE_SIZE); hostbuf.uva = p; hostbuf.size = KGPU_BUF_SIZE; dbg("%p \n", hostbuf.uva); memset(hostbuf.uva, 0, KGPU_BUF_SIZE); ssc( mlock(hostbuf.uva, KGPU_BUF_SIZE)); gpu_init(); hostvma.uva = (void*)mmap( NULL, KGPU_BUF_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, devfd, 0); hostvma.size = KGPU_BUF_SIZE; if (hostvma.uva == MAP_FAILED) { kh_log(KGPU_LOG_ERROR, "set up mmap area failed\n"); perror("mmap for GPU"); abort(); } kh_log(KGPU_LOG_PRINT, "mmap start 0x%lX\n", hostvma.uva); len = sizeof(struct kgpu_gpu_mem_info); /* tell kernel the buffers */ r = ioctl(devfd, KGPU_IOC_SET_GPU_BUFS, (unsigned long)&hostbuf); if (r < 0) { perror("Write req file for buffers."); abort(); } return 0; }
bool ConvertGlobals::preorder(const IR::ExternBlock* block) { // Not really used, but necessary as an argument SharedActionSelectorCheck ssc(ctxt->refMap, ctxt->typeMap); LOG2("Converting " << block); // This object will be lost, but we don't care about // global action profiles here; they are synthesized also // from each table that uses them. auto action_profiles = new Util::JsonArray(); ctxt->action_profiles = action_profiles; ctxt->selector_check = &ssc; ExternConverter::cvtExternInstance(ctxt, block->node->to<IR::Declaration>(), block->to<IR::ExternBlock>(), emitExterns); return false; }
int ski_cons_getchar() { int c; if (pollchar > 0) { c = pollchar; pollchar = -1; return c; } do { c = ssc(0, 0, 0, 0, SSC_GETCHAR); } while (c == 0); return c; }
static efi_status GetTime(struct efi_tm *time, struct efi_tmcap *caps) { uint32_t comps[8]; ssc((uint64_t)comps, 0, 0, 0, SSC_GET_RTC); time->tm_year = comps[0] + 1900; time->tm_mon = comps[1] + 1; time->tm_mday = comps[2]; time->tm_hour = comps[3]; time->tm_min = comps[4]; time->tm_sec = comps[5]; time->__pad1 = time->__pad2 = 0; time->tm_nsec = 0; time->tm_tz = 0; time->tm_dst = 0; return (0); }
static int skifs_open(const char *path, struct open_file *f) { int fd; /* * Skip leading '/' so that our pretend filesystem starts in * the current working directory. */ while (*path == '/') path++; fd = ssc((u_int64_t) path, 1, 0, 0, SSC_OPEN); if (fd > 0) { f->f_fsdata = (void*)(u_int64_t) fd; return 0; } return ENOENT; }
void enter_kernel(const char* filename, u_int64_t start, struct bootinfo *bi) { printf("Entering %s at 0x%lx...\n", filename, start); while (*filename == '/') filename++; ssc(0, (u_int64_t) filename, 0, 0, SSC_LOAD_SYMBOLS); __asm __volatile("mov cr.ipsr=%0" :: "r"(IA64_PSR_IC | IA64_PSR_DT | IA64_PSR_RT | IA64_PSR_IT | IA64_PSR_BN)); __asm __volatile("mov cr.iip=%0" :: "r"(start)); __asm __volatile("mov cr.ifs=r0;;"); __asm __volatile("mov r8=%0" :: "r" (bi)); __asm __volatile("rfi;;"); }
static efi_status_t fw_efi_get_time (efi_time_t *tm, efi_time_cap_t *tc) { #if defined(CONFIG_IA64_HP_SIM) || defined(CONFIG_IA64_GENERIC) struct { int tv_sec; /* must be 32bits to work */ int tv_usec; } tv32bits; ssc((unsigned long) &tv32bits, 0, 0, 0, SSC_GET_TOD); memset(tm, 0, sizeof(*tm)); offtime(tv32bits.tv_sec, tm); if (tc) memset(tc, 0, sizeof(*tc)); #else # error Not implemented yet... #endif return EFI_SUCCESS; }
static struct ia64_sal_result SalProc(u_int64_t a1, u_int64_t a2, u_int64_t a3, u_int64_t a4, u_int64_t a5, u_int64_t a6, u_int64_t a7, u_int64_t a8) { struct ia64_sal_result res; res.sal_status = -3; res.sal_result[0] = 0; res.sal_result[1] = 0; res.sal_result[2] = 0; if (a1 == SAL_FREQ_BASE) { res.sal_status = 0; res.sal_result[0] = 133338184; } else if (a1 == SAL_SET_VECTORS) { /* XXX unofficial SSC function. */ ssc(a2, a3, a4, a5, SSC_SAL_SET_VECTORS); } else if (a1 != SAL_GET_STATE_INFO_SIZE) { puts("SAL: unimplemented function called\n"); } return (res); }
static int kh_send_response(struct kgpu_ku_response *resp) { ssc(write(devfd, resp, sizeof(struct kgpu_ku_response))); return 0; }
void exit(int code) { ssc(code, 0, 0, 0, SSC_EXIT); }
void start_bootloader (void) { static char mem[4096]; static char buffer[1024]; unsigned long off; int fd, i; struct disk_req req; struct disk_stat stat; struct elfhdr *elf; struct elf_phdr *elf_phdr; /* program header */ unsigned long e_entry, e_phoff, e_phnum; register struct ia64_boot_param *bp; char *kpath, *args; long arglen = 0; ssc(0, 0, 0, 0, SSC_CONSOLE_INIT); /* * S.Eranian: extract the commandline argument from the simulator * * The expected format is as follows: * * kernelname args... * * Both are optional but you can't have the second one without the first. */ arglen = ssc((long) buffer, 0, 0, 0, SSC_GET_ARGS); kpath = "vmlinux"; args = buffer; if (arglen > 0) { kpath = buffer; while (*args != ' ' && *args != '\0') ++args, --arglen; if (*args == ' ') *args++ = '\0', --arglen; } if (arglen <= 0) { args = ""; arglen = 1; } fd = ssc((long) kpath, 1, 0, 0, SSC_OPEN); if (fd < 0) { cons_write(kpath); cons_write(": file not found, reboot now\n"); for(;;); } stat.fd = fd; off = 0; req.len = sizeof(mem); req.addr = (long) mem; ssc(fd, 1, (long) &req, off, SSC_READ); ssc((long) &stat, 0, 0, 0, SSC_WAIT_COMPLETION); elf = (struct elfhdr *) mem; if (elf->e_ident[0] == 0x7f && strncmp(elf->e_ident + 1, "ELF", 3) != 0) { cons_write("not an ELF file\n"); return; } if (elf->e_type != ET_EXEC) { cons_write("not an ELF executable\n"); return; } if (!elf_check_arch(elf)) { cons_write("kernel not for this processor\n"); return; } e_entry = elf->e_entry; e_phnum = elf->e_phnum; e_phoff = elf->e_phoff; cons_write("loading "); cons_write(kpath); cons_write("...\n"); for (i = 0; i < e_phnum; ++i) { req.len = sizeof(*elf_phdr); req.addr = (long) mem; ssc(fd, 1, (long) &req, e_phoff, SSC_READ); ssc((long) &stat, 0, 0, 0, SSC_WAIT_COMPLETION); if (stat.count != sizeof(*elf_phdr)) { cons_write("failed to read phdr\n"); return; } e_phoff += sizeof(*elf_phdr); elf_phdr = (struct elf_phdr *) mem; if (elf_phdr->p_type != PT_LOAD) continue; req.len = elf_phdr->p_filesz; req.addr = __pa(elf_phdr->p_paddr); ssc(fd, 1, (long) &req, elf_phdr->p_offset, SSC_READ); ssc((long) &stat, 0, 0, 0, SSC_WAIT_COMPLETION); memset((char *)__pa(elf_phdr->p_paddr) + elf_phdr->p_filesz, 0, elf_phdr->p_memsz - elf_phdr->p_filesz); } ssc(fd, 0, 0, 0, SSC_CLOSE); cons_write("starting kernel...\n"); /* fake an I/O base address: */ ia64_setreg(_IA64_REG_AR_KR0, 0xffffc000000UL); bp = sys_fw_init(args, arglen); ssc(0, (long) kpath, 0, 0, SSC_LOAD_SYMBOLS); debug_break(); jmp_to_kernel((unsigned long) bp, e_entry); cons_write("kernel returned!\n"); ssc(-1, 0, 0, 0, SSC_EXIT); }
static int ski_cons_init(int arg) { ssc(0, 0, 0, 0, SSC_CONSOLE_INIT); return 0; }
void ski_cons_putchar(int c) { ssc(c, 0, 0, 0, SSC_PUTCHAR); }
void VirtualTable::addColumn(const SRCP& column) { // As of bug3695, make sure varbinary is not used in subquery. if (column->resultType().colDataType == CalpontSystemCatalog::VARBINARY && !fVarBinOK) throw runtime_error ("VARBINARY in subquery is not supported."); AggregateColumn* agc = NULL; ArithmeticColumn* arc = NULL; ConstantColumn* cc = NULL; FunctionColumn* fc = NULL; SimpleColumn* sc = NULL; WindowFunctionColumn* wc = NULL; string columnName; ostringstream oss; UniqId colId; if ((sc = dynamic_cast<SimpleColumn*>(column.get())) != NULL) { columnName = sc->columnName(); colId = UniqId(sc); } else if ((agc = dynamic_cast<AggregateColumn*>(column.get())) != NULL) { // oss << agc->functionName() << "_" << agc->expressionId(); // oss << "Aggregate_" << agc->expressionId(); columnName = agc->data(); colId = UniqId(agc->expressionId(), "", "", ""); } else if ((wc = dynamic_cast<WindowFunctionColumn*>(column.get())) != NULL) { // oss << wc->functionName() << "_" << wc->expressionId(); // oss << "Window_" << wc->expressionId(); columnName = wc->data(); colId = UniqId(wc->expressionId(), "", "", ""); } else if ((arc = dynamic_cast<ArithmeticColumn*>(column.get())) != NULL) { // oss << "Arithmetic_" << arc->expressionId(); columnName = arc->data(); colId = UniqId(arc->expressionId(), "", "", ""); } else if ((fc = dynamic_cast<FunctionColumn*>(column.get())) != NULL) { // oss << fc->functionName() << "_" << fc->expressionId(); columnName = fc->data(); colId = UniqId(fc->expressionId(), "", "", ""); } else if ((cc = dynamic_cast<ConstantColumn*>(column.get())) != NULL) { // oss << "Constant_" << cc->expressionId(); columnName = cc->data(); colId = UniqId(cc->expressionId(), cc->alias(), "", fView); } else // new column type has added, but this code is not updated. { oss << "not supported column type: " << typeid(*(column.get())).name(); throw runtime_error(oss.str()); } if (columnName.empty()) columnName = column->alias(); SimpleColumn* vc = new SimpleColumn(); vc->tableName(fName); vc->tableAlias(fAlias); vc->columnName(columnName); vc->alias(column->alias()); vc->viewName(fView); uint32_t index = fColumns.size(); vc->colPosition(index); vc->oid(fTableOid+index+1); vc->resultType(column->resultType()); SSC ssc(vc); fColumns.push_back(ssc); fColumnTypes.push_back(column->resultType()); fColumnMap.insert(make_pair(colId, index)); }
int main(int argc, const char* argv[]) { if(argc != 6) { cerr << "Usage:\n"; cerr << "scanmot <ace_file> <motif_number> <sequence_file> <output_file> <max_sites>\n"; exit(0); } string ace_file(argv[1]); string motnum(argv[2]); string seq_file(argv[3]); string out_file(argv[4]); unsigned int ms = atoi(argv[5]); // Read sequences and create background model vector<string> seqs, nameset; get_fasta_fast(seq_file.c_str(), seqs, nameset, 12); Seqset scan_sseq(seqs); BGModel bgm(scan_sseq, 0.5); // Read motif from ACE file vector<string> hits; string line; ifstream acein(ace_file.c_str()); bool found = false; while(acein.good()) { getline(acein, line); istringstream iss(line); vector<string> fields; copy(istream_iterator<string>(iss), istream_iterator<string>(), back_inserter<vector<string> >(fields)); if(found) { if(line[0] != '*') { hits.push_back(fields[0]); } else { break; } } else { if(fields.size() > 0 && (fields[0].compare("Motif") == 0) && (fields[1].compare(motnum) == 0)) { found = true; } } } if(! found) { cerr << "Motif number " << motnum << " not found in ACE file '" << ace_file << "'\n"; exit(1); } Seqset ace_sseq(hits); Motif mot(ace_sseq, 12, bgm.gcgenome()); mot.clear_cols(); for(unsigned int i = 0; i < line.length(); i++) { if(line[i] == '*') mot.add_col(i); } for(unsigned int i = 0; i < hits.size(); i++) { mot.add_site(i, 0, 1); } acein.close(); // Scan sequences SiteHeap sh(ms); double* sm = new double[mot.ncols() * 4]; double* am = new double[mot.ncols()]; mot.calc_score_matrix(sm, am); int width = mot.get_width(); int n = 0; double msc, bsc, scw, scc; for(int c = 0; c < scan_sseq.num_seqs(); c++) { for(int p = 0; p < scan_sseq.len_seq(c) - width; p++) { msc = mot.score_site(scan_sseq, sm, am, c, p, 1); bsc = bgm.score_site(mot, c, p, 1); scw = msc - bsc; // cerr << c << '\t' << p << '\t' << seqs[c].substr(p, width) << '\t' << 1 << '\t' << setprecision(4) << msc << '\t' << bsc << '\t' << scw << '\n'; ScoredSite ssw(scw, c, p, 1); sh.add(ssw); msc = mot.score_site(scan_sseq, sm, am, c, p, 0); bsc = bgm.score_site(mot, c, p, 0); scc = msc - bsc; // cerr << c << '\t' << p << '\t' << seqs[c].substr(p, width) << '\t' << 0 << '\t' << setprecision(4) << msc << '\t' << bsc << '\t' << scc << '\n'; ScoredSite ssc(scc, c, p, 0); sh.add(ssc); n += 2; } } delete [] sm; // Print out the sites ofstream scout(out_file.c_str()); for(int i = 0; i < sh.sitecount(); i++) { ScoredSite bestss = sh.get_site(i); scout << nameset[bestss.site.chrom()] << '\t'; scout << bestss.site.posit() << '\t'; scout << bestss.site.posit() + width - 1 << '\t'; scout << bestss.site.strand() << "\t"; if(bestss.site.strand()) scout << seqs[bestss.site.chrom()].substr(bestss.site.posit(), width) << '\t'; else scout << reverse_comp(seqs[bestss.site.chrom()].substr(bestss.site.posit(), width)) << '\t'; scout << bestss.score << '\n'; } scout.close(); }
static int skifs_close(struct open_file *f) { ssc((u_int64_t) f->f_fsdata, 0, 0, 0, SSC_CLOSE); return 0; }
RfProfileCapabilities DomainRfProfileControl_001::getRfProfileCapabilities(UIntN participantIndex, UIntN domainIndex) { Frequency defaultCenterFrequency(0); Frequency centerFrequency(0); Frequency frequencyAdjustResolution(0); Frequency minFrequency(0); Frequency maxFrequency(0); Percentage ssc(0.0); try { defaultCenterFrequency = getParticipantServices()->primitiveExecuteGetAsFrequency( esif_primitive_type::GET_RFPROFILE_DEFAULT_CENTER_FREQUENCY, domainIndex); } catch (...) { getParticipantServices()->writeMessageDebug( ParticipantMessage(FLF, "Failed to get default center frequency. ")); } try { centerFrequency = getParticipantServices()->primitiveExecuteGetAsFrequency( esif_primitive_type::GET_RFPROFILE_CENTER_FREQUENCY, domainIndex); } catch (...) { getParticipantServices()->writeMessageDebug( ParticipantMessage(FLF, "Failed to get center frequency. ")); } try { frequencyAdjustResolution = getParticipantServices()->primitiveExecuteGetAsFrequency( esif_primitive_type::GET_RFPROFILE_FREQUENCY_ADJUST_RESOLUTION, domainIndex); } catch (...) { getParticipantServices()->writeMessageDebug( ParticipantMessage(FLF, "Failed to get frequency adjust resolution. ")); } try { minFrequency = getParticipantServices()->primitiveExecuteGetAsFrequency( esif_primitive_type::GET_RFPROFILE_MIN_FREQUENCY, domainIndex); } catch (...) { getParticipantServices()->writeMessageDebug( ParticipantMessage(FLF, "Failed to get min frequency. ")); } try { maxFrequency = getParticipantServices()->primitiveExecuteGetAsFrequency( esif_primitive_type::GET_RFPROFILE_MAX_FREQUENCY, domainIndex); } catch (...) { getParticipantServices()->writeMessageDebug( ParticipantMessage(FLF, "Failed to get max frequency. ")); } try { ssc = getParticipantServices()->primitiveExecuteGetAsPercentage(esif_primitive_type::GET_RFPROFILE_SSC, domainIndex); } catch (...) { getParticipantServices()->writeMessageDebug( ParticipantMessage(FLF, "Failed to get ssc. ")); } RfProfileCapabilities rfProfileCapabilities( defaultCenterFrequency, centerFrequency, frequencyAdjustResolution, minFrequency, maxFrequency, ssc); return rfProfileCapabilities; }
void PIT0_IRQHandler(void) { DisableInterrupts; PIT_Flag_Clear(PIT0); zlf++; sf++; df++; if(b==1) { if(fanzhuan==0) { sdsd=700;//1350 fanzhuan=1; } } if(d==1||g_fCarAngle>=35) while(1) { FTM_PWM_Duty(FTM0, CH0, 0); FTM_PWM_Duty(FTM0, CH1, 0); FTM_PWM_Duty(FTM0, CH2, 0); FTM_PWM_Duty(FTM0, CH3, 0); } /////////////////////////////////////////////////////分段 g_nSpeedControlPeriod++; speedcontrolout(); g_nDirectionControlPeriod++; directcontrolout(); ////////////////////////////////////////////// if(zlf>=5) { zlf=0; AD_Calculate(); Speed_Calculate(g_fCarAngle,Gyro_Now);//清华 // Speed_Calculate(angle,angle_dot);//卡尔曼 ssc();///////////////////////////////////////////////////PWM驱动 } if(df>=10) { df=0; g_nDirectionControlPeriod=0; directcontrol(Find_Mid_Place);///////////////////////////////////传入中线值 } if(sf>=100) { sf=0; g_nSpeedControlPeriod=0; speedcontrol(); } if(js==0) { StartIntegration1(); StartIntegration2(); js=1; } else fs++; EnableInterrupts; }