static void get_global_paddr(struct monitor_blocking_binding *b) { genpaddr_t global = 0; errval_t err; err = invoke_get_global_paddr(cap_kernel, &global); if (err_is_fail(err)) { DEBUG_ERR(err, "get_global_paddr invocation"); } err = b->tx_vtbl.get_global_paddr_response(b, NOP_CONT, global); if (err_is_fail(err)) { USER_PANIC_ERR(err, "sending global paddr failed."); } }
u8 usb_hal_bus_deinit(_adapter * padapter){ u8 tmp8; _func_enter_; //4 Turn off LDO usbvendorrequest(&padapter->dvobjpriv, RT_USB_GET_REGISTER, RT_USB_LDO, 0, &tmp8, 1, _TRUE); DEBUG_ERR(("usb_hal_bus_deinit() : LDO = %d\n", tmp8)); if (tmp8 == 0x00){ DEBUG_ERR(("usb_hal_bus_deinit() : LDO is off. No necessary to Turn it off.\n")); } else { DEBUG_ERR(("usb_hal_bus_deinit() : LDO is on. Need to Turn it off.\n")); usbvendorrequest(&padapter->dvobjpriv, RT_USB_SET_REGISTER, RT_USB_LDO, RT_USB_LDO_OFF, NULL, 0, _FALSE); msleep_os(100); usbvendorrequest(&padapter->dvobjpriv, RT_USB_GET_REGISTER, RT_USB_LDO, 0, &tmp8, 1, _TRUE); DEBUG_ERR(("usb_hal_bus_deinit() : LDO = %d\n", tmp8)); } _func_exit_; return _SUCCESS; }
static void revoke_cap(struct xcorecap_binding *b) { errval_t err; printf("xcorecapserv do revoke cap\n"); err = cap_revoke(sent_cap); if (err_is_fail(err)) { DEBUG_ERR(err, "xcorecapserv: revoke failed\n"); } printf("xcorecapserv revoked cap\n"); fflush(stdout); b->tx_vtbl.send_done(b, NOP_CONT); }
static void send_ints_ready(void *a) { errval_t err; struct xmplmsg_binding *b = (struct xmplmsg_binding*)a; struct event_closure txcont = MKCONT(send_ints_cb, b); err = xmplmsg_msg_ints__tx(b, txcont, 0x1, 0x10); if (err_is_fail(err)) { DEBUG_ERR(err, "error sending msg_ints message\n"); } }
/** * \brief Called when domain gets a interdisp service. * It will set it on the domain_state. */ static void server_listening(void *st, errval_t err, iref_t iref) { if(err_is_fail(err)) { DEBUG_ERR(err, "interdisp service export"); abort(); } struct domain_state *domain_state = get_domain_state(); domain_state->iref = iref; // Also set in the global array allirefs[disp_get_core_id()] = iref; domain_state->conditional = true; }
static void udp_receiver(struct udp_pcb *upcb, struct ip_addr *listen_ip, uint16_t listen_port) { printf("U: Going in UDP_RECEIVER mode\n"); // Bind to specified port errval_t r = udp_bind(upcb, listen_ip, listen_port); if (err_is_fail(r)) { DEBUG_ERR(r, "udp_bind:"); } lwip_benchmark_control(connection_type, BMS_START_REQUEST, iterations, rdtsc()); udp_recv(upcb, udp_recv_handler, 0 /*client data, arg in callback*/); while (true) { r = event_dispatch(ws); if (err_is_fail(r)) { DEBUG_ERR(r, "in event_dispatch"); break; } } } // end function: udp_receiver
errval_t default_start_function(coreid_t where, struct module_info* mi, char* record) { assert(mi != NULL); errval_t err = SYS_ERR_OK; if (is_started(mi)) { return KALUGA_ERR_DRIVER_ALREADY_STARTED; } if (!is_auto_driver(mi)) { return KALUGA_ERR_DRIVER_NOT_AUTO; } // Construct additional command line arguments containing pci-id. // We need one extra entry for the new argument. uint64_t vendor_id, device_id; char **argv = mi->argv; bool cleanup = false; err = oct_read(record, "_ { vendor: %d, device_id: %d }", &vendor_id, &device_id); if (err_is_ok(err)) { // We assume that we're starting a device if the query above succeeds // and therefore append the pci vendor and device id to the argument // list. argv = malloc((mi->argc+1) * sizeof(char *)); memcpy(argv, mi->argv, mi->argc * sizeof(char *)); char *pci_id = malloc(10); // Make sure pci vendor and device id fit into our argument assert(vendor_id < 0x9999 && device_id < 0x9999); snprintf(pci_id, 10, "%04"PRIx64":%04"PRIx64, vendor_id, device_id); argv[mi->argc] = pci_id; mi->argc += 1; argv[mi->argc] = NULL; cleanup = true; } err = spawn_program(where, mi->path, argv, environ, 0, &mi->did); if (err_is_fail(err)) { DEBUG_ERR(err, "Spawning %s failed.", mi->path); } if (cleanup) { // alloc'd string is the last of our array free(argv[mi->argc-1]); free(argv); } return err; }
bool CTeleport::RealizeTeleport() { ADDTOCALLSTACK("CTeleport::RealizeTeleport"); if ( ! IsCharValid() || ! m_ptDst.IsCharValid()) { DEBUG_ERR(( "CTeleport bad coords %s\n", WriteUsed() )); return false; } CSector *pSector = GetSector(); if ( pSector ) return pSector->AddTeleport(this); else return false; }
static void span_cb(void *arg, errval_t err) { if (err_is_fail(err)) { DEBUG_ERR(err, "span failed"); return; } static int num_spanned = 1; num_spanned++; if (num_spanned >= num_to_span) { all_spanned = true; } }
int send_udp_frame(int fd, void *pout, int length, const struct sockaddr_in *sin) { assert( sin && pout ); int send_len = 0; send_len = sendto( fd, pout, length, 0, (struct sockaddr*)sin, sizeof(struct sockaddr_in)); if( send_len < 0) { DEBUG_ERR("udp send failed!"); assert(send_len >= 0); } return send_len; }
/* XAResult XADynamicSourceItfImpl_SetSource * Description: Sets the data source for the object. */ XAresult XADynamicSourceItfImpl_SetSource(XADynamicSourceItf self, XADataSource *pDataSource) { XAresult res = XA_RESULT_SUCCESS; XADynamicSourceItfImpl* impl = (XADynamicSourceItfImpl*) (*self); DEBUG_API("->XADynamicSourceItfImpl_SetSource"); /* check casting */ if (!impl || impl != impl->self || !pDataSource) { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XADynamicSourceItfImpl_SetSource"); return XA_RESULT_PARAMETER_INVALID; } if (!impl->adaptCtx) { DEBUG_ERR("Adaptation not ready!!"); DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); DEBUG_API("<-XADynamicSourceItfImpl_SetSource"); res = XA_RESULT_INTERNAL_ERROR; } else { res = XACommon_CheckDataSource(pDataSource, NULL); if (res == XA_RESULT_SUCCESS) { if (impl->adaptCtx->fwtype == FWMgrFWMMF) { res = XADynamicSourceItfAdaptMMF_SetSource( (XAAdaptationMMFCtx*) impl->adaptCtx, pDataSource); } } } DEBUG_API("<-XADynamicSourceItfImpl_SetSource"); return res; }
bool CItemStone::CheckValidMember( CStoneMember * pMember ) { ADDTOCALLSTACK("CItemStone::CheckValidMember"); ASSERT(pMember); ASSERT( pMember->GetParent() == this ); if ( GetAmount()==0 || g_Serv.m_iExitFlag ) // no reason to elect new if the stone is dead. return( true ); // we are deleting anyhow. switch ( pMember->GetPriv()) { case STONEPRIV_MASTER: case STONEPRIV_MEMBER: case STONEPRIV_CANDIDATE: case STONEPRIV_ACCEPTED: if ( GetMemoryType()) { // Make sure the member has a memory that links them back here. CChar * pChar = pMember->GetLinkUID().CharFind(); if ( pChar == NULL ) break; if ( pChar->Guild_Find( GetMemoryType()) != this ) break; } return( true ); case STONEPRIV_ENEMY: { CItemStone * pEnemyStone = dynamic_cast <CItemStone *>( pMember->GetLinkUID().ItemFind()); if ( pEnemyStone == NULL ) break; CStoneMember * pEnemyMember = pEnemyStone->GetMember(this); if ( pEnemyMember == NULL ) break; if ( pMember->GetWeDeclared() && ! pEnemyMember->GetTheyDeclared()) break; if ( pMember->GetTheyDeclared() && ! pEnemyMember->GetWeDeclared()) break; } return( true ); default: break; } // just delete this member. (it is mislinked) DEBUG_ERR(( "Stone UID=0%lx has mislinked member uid=0%lx\n", (DWORD) GetUID(), (DWORD) pMember->GetLinkUID())); return( false ); }
/** * XAresult XAVideoPostProcessingItfImpl_Commit(XAVideoPostProcessingItf self) * Description: Commit all video post-processing changes since the last Commit(). */ XAresult XAVideoPostProcessingItfImpl_Commit(XAVideoPostProcessingItf self) { XAresult ret = XA_RESULT_SUCCESS; XAVideoPostProcessingItfImpl* impl = GetImpl(self); DEBUG_API("->XAVideoPostProcessingItfImpl_Commit"); if(!impl) { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAVideoPostProcessingItfImpl_Commit"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; } ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); if( ret == XA_RESULT_PARAMETER_INVALID || ret == XA_RESULT_PRECONDITIONS_VIOLATED ) { DEBUG_API("<-XAVideoPostProcessingItfImpl_Commit"); return ret; } ret = XAVideoPostProcessingItfAdapt_Commit((XAAdaptationMMFCtx*)impl->adapCtx, impl->rotation, impl->scaleOptions, impl->backgroundColor, impl->renderingHints, &impl->srcRect, &impl->destRect, impl->mirror, impl->isMirror, impl->isRotate, impl->isDestRect, impl->isSrcRect, impl->isScaleOptions); if( ret == XA_RESULT_SUCCESS ) { impl->isMirror = XA_BOOLEAN_FALSE; impl->isRotate = XA_BOOLEAN_FALSE; impl->isDestRect = XA_BOOLEAN_FALSE; impl->isSrcRect = XA_BOOLEAN_FALSE; impl->isScaleOptions = XA_BOOLEAN_FALSE; } XAAdaptationBase_ThreadExit(impl->adapCtx); DEBUG_API("<-XAVideoPostProcessingItfImpl_Commit"); return ret; }
void CItemSpawn::GenerateChar(CResourceDef *pDef) { ADDTOCALLSTACK("CitemSpawn:GenerateChar"); RESOURCE_ID_BASE rid = pDef->GetResourceID(); if ( rid.GetResType() == RES_SPAWN ) { const CRandGroupDef *pSpawnGroup = static_cast<const CRandGroupDef *>(pDef); ASSERT(pSpawnGroup); size_t i = pSpawnGroup->GetRandMemberIndex(); if ( i != pSpawnGroup->BadMemberIndex() ) rid = pSpawnGroup->GetMemberID(i); } if ( (rid.GetResType() != RES_CHARDEF) && (rid.GetResType() != RES_UNKNOWN) ) return; CPointMap pt = GetTopPoint(); CRegionBase *pRegion = pt.GetRegion(REGION_TYPE_AREA); if ( !pRegion ) return; CChar *pChar = CChar::CreateBasic(static_cast<CREID_TYPE>(rid.GetResIndex())); if ( !pChar ) return; pChar->NPC_LoadScript(true); pChar->StatFlag_Set(STATF_Spawned); // Try placing the char near the spawn if ( !pChar->MoveNearObj(this, m_itSpawnChar.m_DistMax) || !pChar->CanSeeLOS(pt) ) { // If this fails, try placing the char over the spawn if ( !pChar->MoveTo(pt) ) { DEBUG_ERR(("Spawn UID:0%lx is unable to place a character inside the world.\n", static_cast<DWORD>(GetUID()))); pChar->Delete(); return; } } AddObj(pChar->GetUID()); pChar->NPC_CreateTrigger(); // removed from NPC_LoadScript() and triggered after char placement and attachment to the spawnitem pChar->Update(); size_t iCount = GetTopSector()->GetCharComplexity(); if ( iCount > g_Cfg.m_iMaxCharComplexity ) g_Log.Event(LOGL_WARN, "%" FMTSIZE_T " chars at %s. Sector too complex!\n", iCount, GetTopSector()->GetBasePoint().WriteUsed()); }
/** * \brief Initialise the VFS library * * This call initialises the VFS library. It must be called prior to any * other VFS functions being used. It doesn't need to be a constructor * We call it explicitly.. */ void vfs_init(void) { assert(mounts == NULL); errval_t err; // init libc glue vfs_fopen_init(); // mount ramfs on root, as a sensible default setup for the time being err = vfs_mount("/", "ramfs://"); if (err_is_fail(err)) { DEBUG_ERR(err, "error mounting ramfs"); // continue anyway... } }
int camera_profile_write( FILE *fd, camera_profile_format *write_buf ) { assert( fd && write_buf ); if( fd == NULL && write_buf == NULL ) return -1; int ret = Fwrite( fd, write_buf, sizeof(camera_profile_format), 1); if( ret != 1 ) { DEBUG_ERR( "camera profile write ERROR!" ); ret = -1; } return ret; }
static void span_cb(void *arg, errval_t err) { if (err_is_fail(err)) { DEBUG_ERR(err, "span failed"); return; } static int num_spanned = 1; num_spanned++; debug_printf("Span completed, num_spanned: %d\n", num_spanned); if (num_spanned >= num_cores) { all_spanned = true; } }
static void bind_cb(void *st, errval_t err, struct xmplmsg_binding *b) { if (err_is_fail(err)) { USER_PANIC_ERR(err, "bind failed failed"); } struct event_closure txcont = MKCONT(send_ints_cb, b); err = xmplmsg_msg_ints__tx(b, txcont, 0x1, 0x10); if (err_is_fail(err)) { DEBUG_ERR(err, "error sending msg_ints message\n"); if (err_no(err) == FLOUNDER_ERR_TX_BUSY) { struct waitset *ws = get_default_waitset(); txcont = MKCONT(send_ints_ready, b); err = b->register_send(b, ws, txcont); if (err_is_fail(err)) { // note that only one continuation may be registered at a time DEBUG_ERR(err, "register_send on binding failed!"); } } } }
XAresult XAPlaybackRateItfImpl_GetRateRange(XAPlaybackRateItf self, XAuint8 index, XApermille *pMinRate, XApermille *pMaxRate, XApermille *pStepSize, XAuint32 *pCapabilities) { XAresult res = XA_RESULT_SUCCESS; XAPlaybackRateItfImpl *impl = GetImpl(self); DEBUG_API("->XAPlaybackRateItfImpl_GetRateRange"); XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaPlayer ); if( !impl || !pMinRate || !pMaxRate || !pStepSize || !pCapabilities ) { XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAPlaybackRateItfImpl_GetRateRange"); return XA_RESULT_PARAMETER_INVALID; } if(impl->adaptCtx->fwtype == FWMgrFWMMF) { /* needs to be queried from adaptation */ res = XAPlaybackRateItfAdaptMMF_GetRateRange((XAAdaptationMMFCtx*)impl->adaptCtx, index, pMinRate, pMaxRate,pStepSize, pCapabilities); } else { DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); res = XA_RESULT_FEATURE_UNSUPPORTED; } XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); DEBUG_API("<-XAPlaybackRateItfImpl_GetRateRange"); return res; }
static void cap_send_tx_cont(struct intermon_binding *b, struct intermon_msg_queue_elem *e) { DEBUG_CAPOPS("%s: %p %p\n", __FUNCTION__, b, e); errval_t send_err; struct send_cap_st *st = (struct send_cap_st*)e; struct remote_conn_state *conn = remote_conn_lookup(st->my_mon_id); send_err = intermon_cap_send_request__tx(b, NOP_CONT, conn->mon_id, st->capid, st->captx); if (err_is_fail(send_err)) { DEBUG_ERR(send_err, "sending cap_send_request failed"); } free(st); }
static void ring_request_cont(void *arg) { struct rcce_binding *b = arg; errval_t err = b->tx_vtbl.ring_request(b, NOP_CONT); if (err_is_fail(err)) { if (err_no(err) == FLOUNDER_ERR_TX_BUSY) { err = b->register_send(b, get_default_waitset(), MKCONT(ring_request_cont,b)); assert(err_is_ok(err)); return; } DEBUG_ERR(err, "send ring request"); abort(); } }
static void mon_heartbeat(void *arg) { assert(arg != NULL); errval_t err; debug_printf("my_core_id = %d; curr_core_id = %d\n", my_core_id, disp_get_current_core_id()); struct deferred_event *ev = arg; deferred_event_init(ev); // 1 s == 1000 ms == 1e6 us delayus_t one_sec = 15ULL*1000*1000; err = deferred_event_register(ev, get_default_waitset(), one_sec, MKCLOSURE(mon_heartbeat, arg)); if (err_is_fail(err)) { DEBUG_ERR(err, "heartbeat"); } assert(err_is_ok(err)); }
static void error_reply(struct rcce_binding *st, errval_t err, uint64_t state) { struct rcce_state *cs = (struct rcce_state *)(uintptr_t)state; if(err_is_fail(err)) { DEBUG_ERR(err, "error_reply"); } assert(err_is_ok(err)); if(cs != NULL) { assert(!cs->request_done); cs->request_done = true; } else { assert(!request_done); request_done = true; } }
static void status_handler(struct spawn_binding *b, domainid_t domainid) { errval_t err; struct ps_entry *ps = ps_get(domainid); spawn_ps_entry_t pse; memset(&pse, 0, sizeof(pse)); if(ps == NULL) { err = b->tx_vtbl.status_response(b, NOP_CONT, pse, NULL, 0, SPAWN_ERR_DOMAIN_NOTFOUND); if(err_is_fail(err)) { DEBUG_ERR(err, "status_response"); } } pse.status = ps->status; err = b->tx_vtbl.status_response(b, NOP_CONT, pse, ps->argbuf, ps->argbytes, SYS_ERR_OK); if(err_is_fail(err)) { DEBUG_ERR(err, "status_response"); } }
/** * \brief Runs enabled on the remote core to initialize the dispatcher */ static int remote_core_init_enabled(void *arg) { errval_t err; struct remote_core_state *remote_core_state = (struct remote_core_state*)arg; /* Initialize the barrelfish library */ err = barrelfish_init_onthread(NULL); if (err_is_fail(err)) { DEBUG_ERR(err, "barrelfish_init_onthread failed"); abort(); return -1; } // Connect to all dispatchers eagerly remote_core_state->cnt = 0; while(allirefs[remote_core_state->cnt] == NULL_IREF && remote_core_state->cnt < MAX_CPUS) { remote_core_state->cnt++; if(remote_core_state->cnt == disp_get_core_id()) { remote_core_state->cnt++; } } // Don't move before barrelfish_init_onthread() struct domain_state *st = get_domain_state(); if(remote_core_state->cnt != MAX_CPUS) { err = interdisp_bind(allirefs[remote_core_state->cnt], client_connected, remote_core_state, &st->interdisp_ws, IDC_BIND_FLAGS_DEFAULT); if(err_is_fail(err)) { USER_PANIC_ERR(err, "Failure binding to inter-dispatcher service"); } } while(!remote_core_state->initialized) { event_dispatch(get_default_waitset()); } /* Free unnecessary state */ free(remote_core_state); /* XXX: create a thread that will handle the default waitset */ st->default_waitset_handler = thread_create(span_slave_thread, NULL); assert(st->default_waitset_handler != NULL); return interdisp_msg_handler(&st->interdisp_ws); }
void CItem::Spawn_OnTick( bool fExec ) { int iMinutes; if ( m_itSpawnChar.m_TimeHiMin <= 0 ) { iMinutes = Calc_GetRandVal(30) + 1; } else { iMinutes = min( m_itSpawnChar.m_TimeHiMin, m_itSpawnChar.m_TimeLoMin ) + Calc_GetRandVal( abs( m_itSpawnChar.m_TimeHiMin - m_itSpawnChar.m_TimeLoMin )); } if ( iMinutes <= 0 ) iMinutes = 1; if ( !fExec || IsTimerExpired() ) { SetTimeout( iMinutes * 60 * TICK_PER_SEC ); // set time to check again. } if ( ! fExec ) return; CResourceDef * pDef = Spawn_FixDef(); if ( pDef == NULL ) { RESOURCE_ID_BASE rid; if ( IsType(IT_SPAWN_ITEM)) { rid = m_itSpawnItem.m_ItemID; } else { rid = m_itSpawnChar.m_CharID; } DEBUG_ERR(( "Bad Spawn point uid=0%lx, id=%s\n", (DWORD) GetUID(), g_Cfg.ResourceGetName(rid) )); return; } if ( IsType(IT_SPAWN_ITEM)) { Spawn_GenerateItem(pDef); } else { Spawn_GenerateChar(pDef); } }
static void get_monitor_rpc_iref_request(struct monitor_binding *b, uintptr_t st_arg) { errval_t err; if (monitor_rpc_iref == 0) { // Monitor rpc not registered yet DEBUG_ERR(LIB_ERR_GET_MON_BLOCKING_IREF, "got monitor rpc iref request but iref is 0"); } err = b->tx_vtbl.get_monitor_rpc_iref_reply(b, NOP_CONT, monitor_rpc_iref, st_arg); if (err_is_fail(err)) { USER_PANIC_ERR(err, "reply failed"); } }
static int mount(int argc, char *argv[]) { if (argc != 3) { printf("Usage: %s MOUNTPOINT URI\n", argv[0]); return 1; } char *path = vfs_path_mkabsolute(cwd, argv[1]); errval_t err = vfs_mount(path, argv[2]); free(path); if (err_is_fail(err)) { DEBUG_ERR(err, "in vfs_mount %s %s", argv[1], argv[2]); return 1; } return 0; }
static irqreturn_t alsps_irq_handler(int irq, void *dev_id) { if (!g_obj){ DEBUG_ERR("alsps_irq_handler(): g_obj null\n"); return IRQ_NONE; } wake_lock_timeout(&g_obj->alsps_wakelock, 2*HZ); if (apds9900_irq_query()) return IRQ_NONE; schedule_work(&g_obj->alsps_work); return IRQ_HANDLED; }
static void mm_realloc_range_proxy_handler(struct acpi_binding* b, uint8_t sizebits, genpaddr_t minbase) { ACPI_DEBUG("mm_realloc_range_proxy_handler: sizebits: %d, " "minbase: 0x%"PRIxGENPADDR"\n", sizebits, minbase); struct capref devframe = NULL_CAP; errval_t err = mm_realloc_range(&pci_mm_physaddr, sizebits, minbase, &devframe); if (err_is_fail(err)) { DEBUG_ERR(err, "mm alloc range failed...\n"); } err = b->tx_vtbl.mm_realloc_range_proxy_response(b, NOP_CONT, devframe, err); assert(err_is_ok(err)); }