/******************************************************************************* * xorWinOverlapDetect - Detect XOR address windows overlaping * * DESCRIPTION: * An unpredicted behaviour is expected in case XOR address decode * windows overlaps. * This function detects XOR address decode windows overlaping of a * specified window. The function does not check the window itself for * overlaping. The function also skipps disabled address decode windows. * * INPUT: * winNum - address decode window number. * pAddrDecWin - An address decode window struct. * * OUTPUT: * None. * * RETURN: * MV_TRUE if the given address window overlap current address * decode map, MV_FALSE otherwise, MV_ERROR if reading invalid data * from registers. * *******************************************************************************/ static MV_STATUS xorWinOverlapDetect(MV_U32 unit, MV_U32 winNum, MV_ADDR_WIN *pAddrWin) { MV_U32 baseAddrEnableReg; MV_U32 winNumIndex, chan; MV_UNIT_WIN_INFO addrDecWin; if (pAddrWin == NULL) { DB(mvOsPrintf("%s: ERR. pAddrWin is NULL pointer\n", __func__)); return MV_BAD_PTR; } for (chan = 0; chan < MV_XOR_MAX_CHAN_PER_UNIT; chan++) { /* Read base address enable register. Do not check disabled windows */ baseAddrEnableReg = MV_REG_READ(XOR_WINDOW_CTRL_REG(unit, chan)); for (winNumIndex = 0; winNumIndex < XOR_MAX_ADDR_DEC_WIN; winNumIndex++) { /* Do not check window itself */ if (winNumIndex == winNum) continue; /* Do not check disabled windows */ if ((baseAddrEnableReg & XEXWCR_WIN_EN_MASK(winNumIndex)) == 0) continue; /* Get window parameters */ if (MV_OK != mvXorTargetWinRead(unit, winNumIndex, &addrDecWin)) { DB(mvOsPrintf("%s: ERR. TargetWinGet failed\n", __func__)); return MV_ERROR; } if (MV_TRUE == mvWinOverlapTest(pAddrWin, &(addrDecWin.addrWin))) return MV_TRUE; } } return MV_FALSE; }
omni_thread::init_t::init_t(void) { if (count++ != 0) // only do it once however many objects get created. return; DB(cerr << "omni_thread::init: NT implementation initialising\n"); self_tls_index = TlsAlloc(); if (self_tls_index == 0xffffffff) throw omni_thread_fatal(GetLastError()); next_id_mutex = new omni_mutex; // // Create object for this (i.e. initial) thread. // omni_thread* t = new omni_thread; t->_state = STATE_RUNNING; if (!DuplicateHandle(GetCurrentProcess(), GetCurrentThread(), GetCurrentProcess(), &t->handle, 0, FALSE, DUPLICATE_SAME_ACCESS)) throw omni_thread_fatal(GetLastError()); t->nt_id = GetCurrentThreadId(); DB(cerr << "initial thread " << t->id() << " NT thread id " << t->nt_id << endl); if (!TlsSetValue(self_tls_index, (LPVOID)t)) throw omni_thread_fatal(GetLastError()); if (!SetThreadPriority(t->handle, nt_priority(PRIORITY_NORMAL))) throw omni_thread_fatal(GetLastError()); }
struct direct * readdir (DIR *dir) { struct FAB *dfab = &dir->fab; struct NAM *dnam = (struct NAM *)(dfab->fab$l_nam); struct direct *dentry = &dir->dir; int i; memset (dentry, 0, sizeof *dentry); dnam->nam$l_rsa = dir->d_result; dnam->nam$b_rss = MAXNAMLEN; DB (DB_VERBOSE, (".")); if (!((i = sys$search (dfab)) & 1)) { DB (DB_VERBOSE, (_("sys$search() failed with %d\n"), i)); return (NULL); } dentry->d_off = 0; if (dnam->nam$w_fid == 0) dentry->d_fileno = 1; else dentry->d_fileno = dnam->nam$w_fid[0] + (dnam->nam$w_fid[1] << 16); dentry->d_reclen = sizeof (struct direct); dentry->d_namlen = dnam->nam$b_name + dnam->nam$b_type; strncpy (dentry->d_name, dnam->nam$l_name, dentry->d_namlen); dentry->d_name[dentry->d_namlen] = '\0'; #ifdef HAVE_CASE_INSENSITIVE_FS uppercasify (dentry->d_name); #endif return (dentry); }
void RenderArea::on_realize() { try { DB(cerr << "on_realize called" << endl); queue_draw(); } catch (const asl::Exception & ex) { AC_FATAL << "Exception caught: " << ex; } catch (const exception & ex) { AC_FATAL << "Exception caught: " << ex.what(); } catch (...) { AC_FATAL << "Unknown exception"; } Gtk::DrawingArea::on_realize(); }
static void FreeChannel_m(VP_cl *self, Channel_Endpoint ep ) { dcb_rw_t *rwp = RW(self); dcb_ro_t *rop = RO(self); ep_rw_t *eprw; ep_ro_t *epro; if ( ep >= rop->num_eps ) { DB(eprintf("VP$FreeChannel: invalid EP.\n")); RAISE_Channel$Invalid( ep ); } epro = DCB_EPRO(rop,ep); eprw = DCB_EPRW(rop,ep); if ( epro->peer_dcb != NULL || eprw->state == Channel_State_Free ) { DB(eprintf("VP$FreeChannel: Bad State.\n")); RAISE_Channel$BadState( ep, eprw->state ); } eprw->state = Channel_State_Free; eprw->ack = (word_t)(rwp->free_eps); rwp->free_eps = eprw; }
static void common_init(Flash *fls) { memset(fls, 0, sizeof(*fls)); DB(fls->blk.priv.type = KBT_FLASH); fls->hw = &flash_stm32_hw; fls->blk.blk_size = FLASH_PAGE_SIZE; fls->blk.blk_cnt = (F_SIZE * 1024) / FLASH_PAGE_SIZE; /* Unlock flash memory for the FPEC Access */ EMB_FLASH->KEYR = FLASH_KEY1; EMB_FLASH->KEYR = FLASH_KEY2; }
static void gtk_dateentry_calendar_year(GtkWidget *calendar, GtkDateEntry *dateentry) { guint year, month, day; DB( g_print(" (dateentry) year changed\n") ); gtk_calendar_get_date (GTK_CALENDAR (dateentry->calendar), &year, &month, &day); if( year < 1900) g_object_set(calendar, "year", 1900, NULL); if( year > 2200) g_object_set(calendar, "year", 2200, NULL); }
/******************************************************************************* * mvCpuIfTargetWinEnable - Enable/disable a CPU address decode window * * DESCRIPTION: * This function enable/disable a CPU address decode window. * if parameter 'enable' == MV_TRUE the routine will enable the * window, thus enabling CPU accesses (before enabling the window it is * tested for overlapping). Otherwise, the window will be disabled. * * INPUT: * target - Peripheral target enumerator. * enable - Enable/disable parameter. * * OUTPUT: * N/A * * RETURN: * MV_ERROR if protection window number was wrong, or the window * overlapps other target window. * *******************************************************************************/ MV_STATUS mvCpuIfTargetWinEnable(MV_TARGET target, MV_BOOL enable) { MV_U32 winNum, temp; MV_CPU_DEC_WIN addrDecWin; target = MV_CHANGE_BOOT_CS(target); /* Check parameters */ if (target >= MAX_TARGETS) { mvOsPrintf("mvCpuIfTargetWinEnable: target %d is illegal\n", target); return MV_ERROR; } /* get the window and check if it exist */ temp = mvCpuIfTargetWinGet(target, &addrDecWin); if (MV_NO_SUCH == temp) { return (enable ? MV_ERROR : MV_OK); } else if (MV_OK != temp) { mvOsPrintf("%s: ERR. Getting target %d failed.\n", __func__, target); return MV_ERROR; } /* check overlap */ if (MV_TRUE == enable) { if (MV_TRUE == cpuTargetWinOverlap(target, &addrDecWin.addrWin)) { DB(mvOsPrintf("%s: ERR. Target %d overlap\n", __func__, target)); return MV_ERROR; } } if (MV_TARGET_IS_DRAM(target)) { if (mvDramIfWinEnable(target, enable) != MV_OK) { mvOsPrintf("mvCpuIfTargetWinGet: mvDramIfWinEnable Failed at \n"); return MV_ERROR; } } else { /* get the Window number associated with this target */ winNum = mvAhbToMbusWinTargetGet(target); if (winNum >= MAX_AHB_TO_MBUS_WINS) return (enable ? MV_ERROR : MV_OK); if (mvAhbToMbusWinEnable(winNum, enable) != MV_OK) { mvOsPrintf("mvCpuIfTargetWinGet: Failed to enable window = %d\n", winNum); return MV_ERROR; } } return MV_OK; }
/** * Init serial driver for \a unit. * * Use values SER_UARTn as values for \a unit. */ void ser_init(struct Serial *fds, unsigned int unit) { memset(fds, 0, sizeof(*fds)); DB(fds->fd._type = KFT_SERIAL); fds->fd.reopen = ser_reopen; fds->fd.close = ser_close; fds->fd.read = ser_read; fds->fd.write = ser_write; fds->fd.flush = ser_flush; fds->fd.error = ser_error; fds->fd.clearerr = ser_clearerr; ser_open(fds, unit); }
RenderArea::RenderArea(RenderAreaPtr theContext) : AbstractRenderWindow(jslib::JSApp::ShellErrorReporter), _myContextRefCount(0), _isFirstFrame(true) { GdkGLConfig * myGLConfig = gdk_gl_config_new_by_mode( GdkGLConfigMode(GDK_GL_MODE_RGBA | GDK_GL_MODE_DEPTH | GDK_GL_MODE_DOUBLE | GDK_GL_MODE_ALPHA)); if (myGLConfig == 0) { throw asl::Exception("can't init GL",PLUS_FILE_LINE); } // If another render area is supplied as constructor paramter, this render area is uses as // source for a shared y60-gl-context and gdk-gl-context. GdkGLContext * myGdkGLContext = 0; if (theContext) { myGdkGLContext = theContext->getGdkGlContext(); if (!myGdkGLContext) { throw asl::Exception("RenderArea: Failed to get gdk GL context from shared render area.", PLUS_FILE_LINE); } setGLContext(theContext->getGLContext()); } else { setGLContext(GLContextPtr(new GLContext())); } /* Set OpenGL-capability to the widget. */ DB(cerr << "RenderArea::RenderArea() sharing with " << myGdkGLContext << endl); if (!gtk_widget_set_gl_capability (GTK_WIDGET(gobj()), myGLConfig, myGdkGLContext, true, GDK_GL_RGBA_TYPE)) { throw asl::Exception("RenderArea: could not create GL context!", PLUS_FILE_LINE); } // enable mouse events Gdk::EventMask flags = get_events(); flags |= Gdk::BUTTON_PRESS_MASK; flags |= Gdk::POINTER_MOTION_MASK; flags |= Gdk::BUTTON_RELEASE_MASK; flags |= Gdk::SCROLL_MASK; flags |= Gdk::ENTER_NOTIFY_MASK; flags |= Gdk::LEAVE_NOTIFY_MASK; set_events(flags); y60::EventDispatcher::get().addSource(&_myEventAdapter); y60::EventDispatcher::get().addSink(this); // TODO: createRenderer(theOtherRenderer); ShaderLibrary::setGLisReadyFlag(true); }
bool PhotoCommentQuery(PacketHandlerData d){ NetPacket *p; p = d.pkt; bool ret = true; int min, max; min = NetGetNumberData(p, "min"); max = NetGetNumberData(p, "max"); PhotoComment *plist; NetPacket *pkt; int len; pkt = NetCreatePacket(); plist = QueryPhotoCommentList(DB(d),NetGetNumberData(p, "photo_id") , min, max, &len); if(plist == NULL){ pkt->header.type = PHOTO_COMMENT_QUERY_FAILED; NetAddStringData(pkt, "reason", REASON_MEMORY_ERROR); goto CleanUp; } else pkt->header.type = PHOTO_COMMENT_INFO; NetAddNumberData(pkt, "count", len); for(int i=0;i<len;i++){ char msg[8]; sprintf(msg,"i%d", i+1); NetAddStringData(pkt, msg, plist[i].id); sprintf(msg,"c%d", i+1); NetAddStringData(pkt, msg, plist[i].comment); sprintf(msg,"pi%d", i+1); NetAddNumberData(pkt, msg, plist[i].photo_id); sprintf(msg,"t%d", i+1); NetAddNumberData(pkt, msg, plist[i].time); } CleanUp: NetSendPacket(d.handle,d.io,pkt); NetDisposePacket(pkt, true); free(plist); return ret; }
/* Clean up after an error. The caller should usually call do_request() after this function returns. It can be called from an IRQ handler or the normal kernel context. */ void handle_error(const char *from) { u_long flags; if(current_req == NULL) return; save_flags(flags); cli(); kprintf("\nfd: %s (%s): Error (retry number %d)\n", from, REQ_FD_DEV(current_req)->name, current_req->retries); dump_stat(); fd_intr = NULL; if(current_req->retries++ < MAX_RETRIES) { #if 0 if((current_req->retries % RESET_FREQ) == 0) reset_pending = TRUE; #endif if((current_req->retries % RECAL_FREQ) == 0) REQ_FD_DEV(current_req)->recalibrate = TRUE; /* Retry the current request, this simply means stacking it on the front of the queue and calling do_request(). */ prepend_node(&fd_reqs, ¤t_req->node); current_req = NULL; DB(("fd:handle_error: Retrying request %p\n", current_req)); } else { #if 0 reset_pending = TRUE; #endif REQ_FD_DEV(current_req)->recalibrate = TRUE; DB(("\nfd: handle_error: Request %p has no more retries available.\n", current_req)); fd_end_request(-1); } load_flags(flags); }
/******************************************************************************* * mvXorSetProtWinSet - Configure access attributes of a XOR engine * to one of the XOR memory windows. * * DESCRIPTION: * Each engine can be configured with access attributes for each of the * memory spaces. This function sets access attributes * to a given window for the given engine * * INPUTS: * chan - One of the possible engines. * winNum - One of the possible XOR memory spaces. * access - Protection access rights. * write - Write rights. * * OUTPUT: * None. * * RETURN: * MV_BAD_PARAM if parameters to function invalid, MV_OK otherwise. * *******************************************************************************/ MV_STATUS mvXorProtWinSet(MV_U32 unit, MV_U32 chan, MV_U32 winNum, MV_BOOL access, MV_BOOL write) { MV_U32 temp; /* Parameter checking */ if (chan >= MV_XOR_MAX_CHAN_PER_UNIT) { DB(mvOsPrintf("%s: ERR. Invalid chan num %d\n", __func__, chan)); return MV_BAD_PARAM; } if (winNum >= XOR_MAX_ADDR_DEC_WIN) { DB(mvOsPrintf("%s: ERR. Invalid win num %d\n", __func__, winNum)); return MV_BAD_PARAM; } temp = MV_REG_READ(XOR_WINDOW_CTRL_REG(unit, chan)) & (~XEXWCR_WIN_ACC_MASK(winNum)); /* if access is disable */ if (!access) { /* disable access */ temp |= XEXWCR_WIN_ACC_NO_ACC(winNum); } /* if access is enable */ else { /* if write is enable */ if (write) { /* enable write */ temp |= XEXWCR_WIN_ACC_RW(winNum); } /* if write is disable */ else { /* disable write */ temp |= XEXWCR_WIN_ACC_RO(winNum); } } MV_REG_WRITE(XOR_WINDOW_CTRL_REG(unit, chan), temp); return MV_OK; }
USHORT CHalWaveDevice::Service() // Called at interrupt time to service the circular buffer ///////////////////////////////////////////////////////////////////////////// { ULONG ulReason = kReasonWave; //DC('W'); //DPF(("CHalWaveDevice::Service: ")); //DB('s',COLOR_BOLD); DX8( (BYTE)m_ulDeviceNumber, COLOR_NORMAL ); // go see why we were called ULONG ulStreamStatus = m_RegStreamStatus.Read(); //ULONG ulStreamControl = m_RegStreamControl.Read(); //DC('['); //DX16( (USHORT)(ulStreamStatus & REG_STREAMSTAT_L2PTR_MASK), COLOR_NORMAL ); //DC(','); //DX16( (USHORT)(ulStreamControl & REG_STREAMCTL_PCPTR_MASK), COLOR_NORMAL ); //DC(']'); //DPF(("Stream Status %08lx\n", ulStreamStatus )); // was the limit hit bit set? if( ulStreamStatus & REG_STREAMSTAT_LIMHIT ) { //DC('L'); //DPF(("Limit Hit\n")); } // was the overrun bit set? if( ulStreamStatus & REG_STREAMSTAT_OVER ) { DB('O',COLOR_BOLD); m_ulOverrunCount++; DPF(("\nCHalWaveDevice: Overrun Detected %ld\n", m_ulOverrunCount )); ulReason = kReasonWaveEmpty; } if( m_usMode != MODE_RUNNING ) { //DPF(("<%02ld %08lx %08lx>", m_ulDeviceNumber, m_RegStreamControl.Read(), ulStreamStatus )); Stop(); //DPF(("Interrupt Detected on IDLE device %02ld\n", m_ulDeviceNumber )); return( HSTATUS_INVALID_MODE ); } // let the driver service the interrupt for this device CHalDevice::Service( ulReason ); return( HSTATUS_OK ); }
void sched.insert(int d, object* who) /* schedule THIS to run in ``d'' time units inserted by who */ { register sched * p; register sched * pp; register long tt = s_time = clock + d; DB(("%x->sched::insert( %x, %x )\n",this,d,who)); switch (s_state) { case TERMINATED: task_error(E_RESTERM,this); break; case IDLE: break; case RUNNING: if (this != (class sched *)thistask) task_error(E_RESRUN,this); } if (d<0) task_error(E_NEGTIME,this); if (o_next) task_error(E_RESOBJ,this); s_state = RUNNING; if (o_type == TASK) ((task *) this)->t_alert = who; /* run_chain ordered by s_time */ if (p = run_chain) { if (tt < p->s_time) { o_next = (object*) run_chain; run_chain = this; } else { while (pp = (sched *) p->o_next) { if (tt < pp->s_time) { o_next = pp; p->o_next = this; return; } else p = pp; } p->o_next = this; } } else run_chain = this; }
/******************************************************************************* * ahbToMbusRemapRegOffsGet - Get CPU address remap register offsets * * DESCRIPTION: * CPU to PCI address remap registers offsets are inconsecutive. * This function returns PCI address remap registers offsets. * * INPUT: * cpu - CPU id * winNum - Address decode window number. See MV_U32 enumerator. * * OUTPUT: * None. * * RETURN: * MV_ERROR if winNum is not a PCI one. * *******************************************************************************/ static MV_STATUS ahbToMbusRemapRegOffsGet(MV_U32 cpu, MV_U32 winNum, AHB_TO_MBUS_REMAP_REG_OFFS *pRemapRegs) { pRemapRegs->lowRegOffs = AHB_TO_MBUS_WIN_REMAP_LOW_REG(cpu, winNum); pRemapRegs->highRegOffs = AHB_TO_MBUS_WIN_REMAP_HIGH_REG(cpu, winNum); if ((pRemapRegs->lowRegOffs == 0) || (pRemapRegs->highRegOffs == 0)) { DB(mvOsPrintf("ahbToMbusRemapRegOffsGet: ERR. Invalid winNum %d\n", winNum)); return MV_NO_SUCH; } return MV_OK; }
/** * Init serial driver for a usb-serial port \a unit. * * \return 0 if OK, a negative value in case of error. */ int usbser_init(struct USBSerial *fds, int unit) { memset(fds, 0, sizeof(*fds)); DB(fds->fd._type = KFT_USB_SERIAL); fds->fd.reopen = usb_serial_reopen; fds->fd.close = usb_serial_close; fds->fd.read = usb_serial_read; fds->fd.write = usb_serial_write; /* TODO: properly implement error handling. */ fds->fd.error = usb_serial_error; fds->fd.clearerr = usb_serial_clearerr; return usb_serial_open(fds, unit); }
static inline void map_cga_buffer(struct video *v, bool phys_buf) { int i; DB(("map_cga_buffer: v=%p phys_buf=%#d\n", v, phys_buf)); forbid(); for(i = 0; i < 4; i++) { kernel->set_pte(v->task->page_dir, CGA_VIDEO_MEM + (i * PAGE_SIZE), (phys_buf ? (CGA_VIDEO_MEM + (i * PAGE_SIZE)) : TO_PHYSICAL(v->data.cga.video_buffer[i])) | PTE_USER | PTE_READ_WRITE | PTE_PRESENT); } permit(); }
double MovieDecoderBase::getMovieTime(double theSystemTime) { DB(AC_TRACE << "getMovieTime start: _myMovieTime: " << _myMovieTime << ", theSystemTime: " << theSystemTime << ", _myLastSystemTime: " << _myLastSystemTime); if (theSystemTime <= _myLastSystemTime) { return _myMovieTime; } float myPlaySpeed = _myMovie->get<PlaySpeedTag>(); if (_myLastSystemTime >= 0) { _myMovieTime += (theSystemTime - _myLastSystemTime) * myPlaySpeed; // disabled this code, cause looping movie playback failed with new ffmpeg: the enforced wraparound here is not needed anymore(vs, 2014) // if difference between last system time and current system time is bigger than movie duration /*if (getFrameCount() != -1 && _myMovieTime * getFrameRate() > getFrameCount()) { _myMovieTime = getFrameCount() / getFrameRate(); }*/ // Calculate the wraparaound for reverse playback if (_myMovieTime < 0) { unsigned myFrameCount = getFrameCount(); if (myFrameCount == static_cast<unsigned>(-1) || myFrameCount == 0) { AC_WARNING << "Movie cannot play backwards, because its framecount is unknown (framecount=" << myFrameCount << ")"; _myMovieTime = 0; } else { double myIncrement = getFrameCount() / getFrameRate(); while (_myMovieTime < 0) { _myMovieTime += myIncrement; } } } } _myLastSystemTime = theSystemTime; DB(AC_TRACE << "getMovieTime end: _myMovieTime: " << _myMovieTime << ", theSystemTime: " << theSystemTime << ", _myLastSystemTime: " << _myLastSystemTime); return _myMovieTime; }
void kfileblock_init(KFileBlock *fb, KBlock *blk) { ASSERT(fb); ASSERT(blk); memset(fb, 0, sizeof(*fb)); kfile_init(&fb->fd); DB(fb->fd._type = KFT_KFILEBLOCK); fb->blk = blk; fb->fd.size = blk->blk_cnt * blk->blk_size; fb->fd.read = kfileblock_read; fb->fd.write = kfileblock_write; fb->fd.flush = kfileblock_flush; fb->fd.error = kfileblock_error; fb->fd.clearerr = kfileblock_clearerr; fb->fd.close = kfileblock_close; }
/******************************************************************************* * mvFlashErase - Completly Erase a flash. * * DESCRIPTION: * This function completly erase the given flash, by erasing all the * flash sectors one by one (Currently there is no support for HW * flash erase). * * INPUT: * pFlash - Flash identifier structure. * * OUTPUT: * None. * * RETURN: * MV_BAD_PARAM if pFlash is NULL, * MV_OK if erased completed successfully, * MV_FAIL otherwise. * *******************************************************************************/ MV_STATUS mvFlashErase(MV_FLASH_INFO *pFlash) { MV_U32 i; if (NULL == pFlash) return MV_BAD_PARAM; DB(mvOsPrintf("Flash: mvFlashErase \n")); /* erase all sectors in the flash one by one */ for (i = 0; i < mvFlashNumOfSecsGet(pFlash); i++) { if (MV_OK != mvFlashSecErase(pFlash, i)) return MV_FAIL; } return MV_OK; }
/** * Init AVR flash read/write file. */ void flash_hw_init(struct Flash *fd) { memset(fd, 0, sizeof(*fd)); DB(fd->fd._type = KFT_FLASH); // Set up flash programming functions. fd->fd.reopen = flash_avr_reopen; fd->fd.close = flash_avr_close; fd->fd.read = flash_avr_read; fd->fd.write = flash_avr_write; fd->fd.seek = kfile_genericSeek; fd->fd.flush = flash_avr_kfileFlush; fd->curr_page = 0; flash_avr_open(fd); }
/** * Initialize an USB serial port. * * \param fds KFile Serial struct interface. * \param unit Serial unit to open. */ static int usb_serial_open(struct USBSerial *fds, int unit) { unit = unit; ASSERT(!fds->is_open); /* TODO: only a single usb-serial unit is supported for now */ ASSERT(unit == 0); /* Initialize usb-serial driver */ if (usb_serial_hw_init() < 0) return -1; /* Clear error flags */ fds->status = 0; DB(fds->is_open = true); return 0; }
bool CmdDBJobsList::processArguments( int argc, char** argv, af::Msg &msg) { afsql::DBConnection DB( "afanasy.cmd.JobsList"); DB.DBOpen(); std::list<int> jids = DB.getIntegers( afsql::DBJob::dbGetIDsCmd()); for( std::list<int>::const_iterator it = jids.begin(); it != jids.end(); it++) { afsql::DBJob job( *it); DB.getItem( &job); job.stdOut( false); } DB.DBClose(); return true; }
AVPacket * Demux::getPacket(const int theStreamIndex) { DB(AC_TRACE << "Demux::getPacket for stream: " << theStreamIndex); if (_myPacketLists.find(theStreamIndex) == _myPacketLists.end()) { AC_ERROR << "Demux::getPacket called with nonexistent stream index " << theStreamIndex << "."; } PacketList & myCurPacketList = _myPacketLists.find(theStreamIndex)->second; if (!myCurPacketList.empty()) { DB(AC_TRACE << "Demux::getPacket: packet already there."); AVPacket * myPacket = myCurPacketList.front(); myCurPacketList.pop_front(); return myPacket; } else { DB(AC_TRACE << "Demux::getPacket: packet needs to be read."); AVPacket * myPacket; do { DB(AC_TRACE << "Demux::getPacket: read."); myPacket = new AVPacket; memset(myPacket, 0, sizeof(AVPacket)); bool myEndOfFileFlag = (av_read_frame(_myFormatContext, myPacket) < 0); if (myEndOfFileFlag) { AC_DEBUG << "Demux::getPacket: end of file."; av_free_packet(myPacket); delete myPacket; myPacket = 0; return 0; } if (myPacket->stream_index != theStreamIndex) { if (_myPacketLists.find(myPacket->stream_index) != _myPacketLists.end()) { DB(AC_TRACE << "Demux::getPacket: caching packet."); // Without av_dup_packet, ffmpeg reuses myPacket->data at first // opportunity and trashes our memory. av_dup_packet(myPacket); PacketList& myOtherPacketList = _myPacketLists.find(myPacket->stream_index)->second; myOtherPacketList.push_back(myPacket); } else { DB(AC_DEBUG << "Demux::getPacket: rejecting packet."); av_free_packet(myPacket); delete myPacket; myPacket = 0; } } } while (!myPacket || myPacket->stream_index != theStreamIndex); DB(AC_TRACE << "Demux::getPacket: end."); return myPacket; } }
/* Perform the GNU make expansion function. */ static SCM guile_expand_wrapper (SCM obj) { char *str = cvt_scm_to_str (obj); SCM ret; char *res; DB (DB_BASIC, (_("guile: Expanding '%s'\n"), str)); res = allocated_variable_expand (str); ret = scm_from_locale_string (res); free (str); free (res); return ret; }
/******************************************************************************* * mvNflashInit - Initialize the Flash indetifier structure. * * DESCRIPTION: * This function initialize the Flash indetifier structure. * Note that this function must be called only after the MV_NFLASH_HW_IF * field in the MV_NFLASH_INFO was initialized by the BSP. Only then * access to nflash is possible. * * INPUT: * pFlash - flash information. * * OUTPUT: * Initialize MV_NFLASH_INFO Nflash identifier struct. * * * RETURN: * MV_ERROR if device and vendor ID can't be read. * MV_OK otherwise. * *******************************************************************************/ MV_STATUS mvNflashInit(MV_NFLASH_INFO *pFlash) { MV_U16 flashId; int i = 0; if(NULL == pFlash) return 0; /* Initialize base address and device width from BSP */ pFlash->baseAddr = pFlash->nflashHwIf.devBaseAddr; pFlash->devWidth = pFlash->nflashHwIf.devWidth; /* Initialize HW interface */ mvNflashHwIfInit(&pFlash->nflashHwIf); /* Read the device and vendor ID */ flashId = mvNflashIdGet(pFlash); /* check if this flash is Supported, and Init the pFlash flash feild */ while((supNflashAry[i].devVen != ((flashId << VENDOR_ID_OFFS) & 0xFF) && (supNflashAry[i].devId != ((flashId << DEVICE_ID_OFFS) & 0xFF)))) { if (i++ == (sizeof(supNflashAry) / sizeof(supNflashAry[0]))) { mvOsPrintf("mvNflashInit: Unsupported Flash ID 0x%x.\n", flashId); return MV_ERROR; } } pFlash->pNflashStruct = &supNflashAry[i]; /* Init pFlash sectors */ /* if(MV_OK != flashSecsInit(pFlash)) { mvOsPrintf("Flash: ERROR mvFlashInit flashSecsInit failed \n"); return 0; }*/ /* print all flash information */ DB(mvNflashPrint(pFlash)); /* reset the Flash */ mvNflashReset(pFlash); return MV_OK; }
bool LocationQuery(PacketHandlerData d){ NetPacket *p; p = d.pkt; bool ret = true; int min, max; Location *plist; NetPacket *pkt; int len; pkt = NetCreatePacket(); printf("ASDF"); plist = QueryLocation(DB(d) , &len); if(plist == NULL){ pkt->header.type = LOCATION_QUERY_FAILED; NetAddStringData(pkt, "reason", REASON_MEMORY_ERROR); goto CleanUp; } else pkt->header.type = LOCATION_INFO; NetAddNumberData(pkt, "count", len); for(int i=0;i<len;i++){ char msg[8]; sprintf(msg,"lt%d", i+1); NetAddNumberData(pkt, msg, plist[i].lat); sprintf(msg,"ln%d", i+1); NetAddNumberData(pkt, msg, plist[i].lon); sprintf(msg,"i%d", i+1); NetAddStringData(pkt, msg, plist[i].id); } CleanUp: NetSendPacket(d.handle,d.io,pkt); NetDisposePacket(pkt, true); free(plist); return ret; }
/////////////////////////////////////////////////////////////////////////////// // Version der MetaDatenBank long DatenBasisObjekt::GetPBDVersion(HPROJECT hPr) { #if defined(_FORCE_LEGACY_CODE) if (!IsTRiASDBBased()) { CActDB ActPBD (PbdDB()); if(!ActPBD) return EC_NOOPEN; return PbdDB().GetDBVersion(); } else #endif // _FORCE_LEGACY_CODE { TX_ASSERT(IsTRiASDBBased()); return DB(hPr).GetDBVersion(); // hier wird die Version der GeoDB geliefert } return 0L; }
static int maru_kue_free_callback(void *data, int len) { struct maru_message *msg = data; struct buf *bp; struct maru_token *tok; DB("maru_free_callback(%p, %d)\n", data, len); tok = maru_find_token(msg->mm_id); free(msg, M_DEVBUF); if (!tok) return (EINVAL); bp = tok->qt_bp; maru_release_token(tok); if (bp) maru_berror(bp, ENXIO); return 0; }