// // DTrack::RegisterDestruction // // Register the destruction of the item 'info' // void DTrack::RegisterDestruction(Info &info) { // Never registered, or has died - perhaps deleting twice? if (!info.IsSetup()) { ERR_FATAL(("Invalid destruction : Item is NOT setup! (Tracker %s)", name.str)); } // Different id, something bad has happened - perhaps bad memory? if (*info.trackPos != info.id) { ERR_FATAL(("Invalid destruction : Different Id (Tracker %s, %d, %d)", name.str, *info.trackPos, info.id)); } // Set item as empty *info.trackPos = DTRACK_EMPTY; // Add to cache CacheAdd(info.trackPos); // Info is no longer setup info.Clear(); ASSERT(stateInfo.items); // Decrease number of items stateInfo.items--; }
// // GetFreeIndex // // Returns a free instance index // static U32 GetFreeIndex() { ASSERT(initialized); // Fatal if limit exceeded if (instanceCount >= MAX_INSTANCES) { ERR_FATAL(("Maximum footprint instances exceeded!! (%d)", MAX_INSTANCES)); } // Find next available slot for (U32 count = 0, index = nextIndex; count < MAX_INSTANCES; count++) { ASSERT(ValidInstanceIndex(index)); // Is this space available if (!instances[index]) { nextIndex = index; IncrementIndex(nextIndex); return (index); } // Wrap index around IncrementIndex(index); } // This should never happen, but paranoia has set in... ERR_FATAL(("Instance scan found no available index! (%d)", instanceCount)); }
void bootstrap_exception_handler(void) { const unsigned long wlStackSize = 4096; // minimal (KB) static DALSYSEventHandle hEventStart; // context for the error exception handler static DALSYSWorkLoopHandle hWorkLoop; // context for the error exception handler char err_task_name[13]; if ( sizeof(err_task_name) <= tms_utils_fmt(err_task_name, 12, "err_pd_ex_%d", qurt_getpid()) ) { MSG(MSG_SSID_TMS, MSG_LEGACY_ERROR,"Failed to copy task name in err_task_name "); } if (DAL_SUCCESS != DALSYS_EventCreate(DALSYS_EVENT_ATTR_WORKLOOP_EVENT, &hEventStart, NULL)) { ERR_FATAL("Exception Handler initialization failure",0,0,0); } if (DAL_SUCCESS != DALSYS_RegisterWorkLoopEx(err_task_name, wlStackSize, wlPriority, dwMaxNumEvents, &hWorkLoop, NULL)) { ERR_FATAL("Exception Handler initialization failure",0,0,0); } if (DAL_SUCCESS != DALSYS_AddEventToWorkLoop(hWorkLoop, err_exception_task, NULL, hEventStart, NULL)) { ERR_FATAL("Exception Handler initialization failure",0,0,0); } if (DAL_SUCCESS != DALSYS_EventCtrl(hEventStart, DALSYS_EVENT_CTRL_TRIGGER)) { ERR_FATAL("Exception Handler initialization failure",0,0,0); } }
// // FileMap::FileMap // // Constructor // FileMap::FileMap(const char *name, U32 flags, U32 offset, U32 length) { // Build flags from flags U32 f = 0; if (flags & READ) { f |= GENERIC_READ; } if (flags & WRITE) { f |= GENERIC_WRITE; } // Open the file fileHandle = CreateFile(name, f, 0, NULL, OPEN_EXISTING, 0, NULL); if (fileHandle == NULL) { ERR_FATAL(("Could not open file '%s' for mapping", name)) } // Get the size of the file (assume that its is less than 4GB) size = GetFileSize(fileHandle, NULL); // Create the file mapping f = 0; if (flags & WRITE) { f = PAGE_READWRITE; } else { f = PAGE_READONLY; } mapHandle = CreateFileMapping(fileHandle, NULL, f, 0, size, NULL); // Could the file be mapped if (mapHandle == NULL) { ERR_FATAL(("Could not create file mapping for '%s'", name)) } // Get a pointer to the mapping f = 0; if (flags & WRITE) { f = FILE_MAP_WRITE; } else { f = FILE_MAP_READ; } ptr = (U8 *) MapViewOfFile(mapHandle, f, 0, offset, length); // Could we get a view of the mapping ? if (ptr == NULL) { ERR_FATAL(("Could not create a view of the mapping '%s'", name)) } }
static void s_TEST_WinSystemDll(void) { #if defined NCBI_OS_MSWIN CDll dll_user32("USER32", CDll::eLoadLater); CDll dll_userenv("userenv.dll", CDll::eLoadNow, CDll::eAutoUnload); // Load DLL dll_user32.Load(); // DLL functions definition BOOL (STDMETHODCALLTYPE FAR * dllMessageBeep) (UINT type) = NULL; BOOL (STDMETHODCALLTYPE FAR * dllGetProfilesDirectory) (LPTSTR lpProfilesDir, LPDWORD lpcchSize) = NULL; // This is other variant of functions definition // // typedef BOOL (STDMETHODCALLTYPE FAR * LPFNMESSAGEBEEP) ( // UINT uType // ); // LPFNMESSAGEBEEP dllMessageBeep = NULL; // // typedef BOOL (STDMETHODCALLTYPE FAR * LPFNGETPROFILESDIR) ( // LPTSTR lpProfilesDir, // LPDWORD lpcchSize // ); // LPFNGETUSERPROFILESDIR dllGetProfilesDirectory = NULL; dllMessageBeep = dll_user32.GetEntryPoint_Func("MessageBeep", &dllMessageBeep ); if ( !dllMessageBeep ) { ERR_FATAL("Error get address of function MessageBeep()."); } // Call loaded function dllMessageBeep(-1); #ifdef UNICODE dll_userenv.GetEntryPoint_Func("GetProfilesDirectoryW", &dllGetProfilesDirectory); #else dll_userenv.GetEntryPoint_Func("GetProfilesDirectoryA", &dllGetProfilesDirectory); #endif if ( !dllGetProfilesDirectory ) { ERR_FATAL("Error get address of function GetUserProfileDirectory()."); } // Call loaded function TCHAR szProfilePath[1024]; DWORD cchPath = 1024; if ( dllGetProfilesDirectory(szProfilePath, &cchPath) ) { cout << "Profile dir: " << szProfilePath << endl; } else { ERR_FATAL("GetProfilesDirectory() failed"); } // Unload USER32.DLL (our work copy) dll_user32.Unload(); // USERENV.DLL will be unloaded in the destructor // dll_userenv.Unload(); #endif }
void sdm_menu_init ( void ) { uint8 i; #ifdef FEATURE_DS_UI_BAUD /*------------------------------------------------------------------------- SDM DS BAUD rate UI MENU initialization -------------------------------------------------------------------------*/ sdm_ds_baud_ui_menu.heading = " DS BAUD "; /* */ sdm_ds_baud_ui_menu.current_index = SDM_UNKNOWN_INDEX; /* Copy the menu entries */ for( i=0; i < SDM_MAX_UI_ITEMS; i++) { sdm_ds_baud_ui_menu.items[i] = & (sdm_ui_ds_items_struct[i]); if ( *(sdm_ui_ds_items_struct[i].item_string) == '\0' ) { break; /* no more valid entries */ } } if( i >= SDM_MAX_UI_ITEMS ) { ERR_FATAL( "ds baud menu init failure",0,0,0); } sdm_ds_baud_ui_menu.num_items = i; #endif /* FEATURE_DS_UI_BAUD */ #ifdef FEATURE_DIAG_UI_BAUD /*------------------------------------------------------------------------- SDM DIAG BAUD rate UI MENU initialization -------------------------------------------------------------------------*/ sdm_diag_baud_ui_menu.heading = " DIAG BAUD: "; /* */ sdm_diag_baud_ui_menu.current_index = SDM_UNKNOWN_INDEX; /* Copy the menu entries */ for( i=0; i < SDM_MAX_UI_ITEMS; i++) { sdm_diag_baud_ui_menu.items[i] = & (sdm_ui_diag_items_struct[i]); if ( *(sdm_ui_diag_items_struct[i].item_string) == '\0' ) { break; /* no more valid entries */ } } if( i >= SDM_MAX_UI_ITEMS ) { ERR_FATAL( "diag baud menu init failure",0,0,0); } sdm_diag_baud_ui_menu.num_items = i; #endif /* FEATURE_DIAG_UI_BAUD */ } /* sdm_menu_init */
static void s_TEST_SimpleDll(void) { CDll dll("./","test_dll", CDll::eLoadLater); // Load DLL dll.Load(); // DLL variable definition int* DllVar_Counter; // DLL functions definition int (* Dll_Inc) (int) = NULL; int (* Dll_Add) (int, int) = NULL; string* (* Dll_StrRepeat) (const string&, unsigned int) = NULL; // Get addresses from DLL DllVar_Counter = dll.GetEntryPoint_Data("DllVar_Counter", &DllVar_Counter); if ( !DllVar_Counter ) { ERR_FATAL("Error get address of variable DllVar_Counter."); } Dll_Inc = dll.GetEntryPoint_Func("Dll_Inc", &Dll_Inc ); if ( !Dll_Inc ) { ERR_FATAL("Error get address of function Dll_Inc()."); } Dll_Add = dll.GetEntryPoint_Func("Dll_Add", &Dll_Add ); if ( !Dll_Add ) { ERR_FATAL("Error get address of function Dll_Add()."); } Dll_StrRepeat = dll.GetEntryPoint_Func("Dll_StrRepeat", &Dll_StrRepeat ); if ( !Dll_StrRepeat ) { ERR_FATAL("Error get address of function Dll_StrRepeat()."); } // Call loaded function assert( *DllVar_Counter == 0 ); assert( Dll_Inc(3) == 3 ); assert( *DllVar_Counter == 3 ); assert( Dll_Inc(100) == 103); assert( *DllVar_Counter == 103); *DllVar_Counter = 1; assert( Dll_Inc(0) == 1 ); assert( Dll_Add(3,4) == 7 ); assert( Dll_Add(-2,-1) == -3 ); string* str = Dll_StrRepeat("ab",2); assert( *str == "abab"); delete str; str = Dll_StrRepeat("a",4); assert( *str == "aaaa"); delete str; // Unload used dll dll.Unload(); }
void rce_nfy_term_posix(rce_nfy_p nfy_p) { if (RCE_NULL != nfy_p) { ERR_FATAL("no implementation", 0, 0, 0); } else { ERR_FATAL("null handle use", 0, 0, 0); } }
void rce_nfy_init_posix(rce_nfy_p nfy_p, RCEVT_SIGEX sigex) { if (RCE_NULL != nfy_p) { ERR_FATAL("no implementation", 0, 0, 0); } else { ERR_FATAL("null handle use", 0, 0, 0); } sigex = sigex; // unused }
RCEVT_BOOL rce_nfy_eq_posix(rce_nfy_p nfy_p, RCEVT_SIGEX sigex) { if (RCE_NULL != nfy_p) { ERR_FATAL("no implementation", 0, 0, 0); return RCEVT_FALSE; } else { ERR_FATAL("null handle use", 0, 0, 0); return RCEVT_FALSE; } }
/*=========================================================================== FUNCTION rcinit_init DESCRIPTION prepare internal data storage setup DEPENDENCIES none RETURN VALUE none SIDE EFFECTS none ===========================================================================*/ void rcinit_init(void) { rcinit_internal.policy_curr = rcinit_lookup_policy(RCINIT_POLICY_NAME_DEFAULT); if (RCINIT_POLICY_NONE != rcinit_internal.policy_curr) { int group; rcinit_internal_devcfg_check_load(); // load devcfg configs first, potentially allows a runtime override later rcevt_init(); // rcevt events service rcinit_internal_hs_list_init(); rcxh_init(); // internal events for (group = 0; group < RCINIT_GROUP_MAX; group++) { // rcinit_internal.rcevt_handle.init_event[group] = (rce_nde_p)rcevt_create_name(rcinit_init_rcevt[group]); rcinit_internal.rcevt_handle.term_event[group] = (rce_nde_p)rcevt_create_name(rcinit_term_rcevt[group]); } rcinit_internal.define = (rce_nde_p)rcevt_create_name(RCINIT_RCEVT_DEFINE); // handle to define event, internal, ok to observe rcinit_internal.defineack = (rce_nde_p)rcevt_create_name(RCINIT_RCEVT_DEFINEACK); // handle to defineack event, internal, ok to observe if (RCINIT_NULL == rcinit_internal.define || // must have rcevt allocated RCINIT_NULL == rcinit_internal.defineack) // must have rcevt allocated { ERR_FATAL("initialization", 0, 0, 0); } rcinit_internal.policy_base = rcinit_internal_groups[rcinit_internal.policy_curr]; rcinit_internal.group_curr = RCINIT_GROUP_0; rcinit_internal.group_base = rcinit_internal.policy_base[rcinit_internal.group_curr]; rcinit_internal_tls_create_key(&rcinit_internal.tls_key, RCINIT_NULL); rcinit_dal_loop_worker_create(); // internal worker thread rcinit_internal_process_groups(); // sequence groups } else { ERR_FATAL("default policy not available", 0, 0, 0); } }
rce_nde_p rce_nfy_wait_posix(rce_nde_p nde_p, rce_nfy_p nfy_p) { if (RCE_NULL != nfy_p) { nde_p = nde_p; ERR_FATAL("no implementation", 0, 0, 0); return RCE_NULL; } else { ERR_FATAL("null handle use", 0, 0, 0); return RCE_NULL; } }
/*=========================================================================== FUNCTION CMIF_REGISTER_CB_FUNC DESCRIPTION Registers the callback functions.with other tasks. DEPENDENCIES None RETURN VALUE None SIDE EFFECTS None ===========================================================================*/ LOCAL void cmif_register_cb_func ( void ) { cm_client_status_e_type cm_status = CM_CLIENT_OK; /* Register the CM call event callback function */ cm_status = cm_mm_client_call_reg ( dsatcm_client_id, cmif_call_event_cb_func, CM_CLIENT_EVENT_REG, CM_CALL_EVENT_INCOM, CM_CALL_EVENT_CONNECT, NULL ); cm_status |= cm_mm_client_call_reg(dsatcm_client_id, cmif_call_event_cb_func, CM_CLIENT_EVENT_REG, CM_CALL_EVENT_END, CM_CALL_EVENT_END, NULL ); #if defined(FEATURE_WCDMA) || defined(FEATURE_GSM) #error code not present #endif /* This should not happen, raise an error */ if (cm_status!= CM_CLIENT_OK) { ERR_FATAL( "ATCOP unable to register CALL events: %d", cm_status, 0,0 ); } #if defined(FEATURE_WCDMA) || defined(FEATURE_GSM) #error code not present #endif /* defined(FEATURE_WCDMA) || defined(FEATURE_GSM) */ /*----------------------------------------------------------------------- Activate the registered callback functions. -----------------------------------------------------------------------*/ cm_status = cm_client_act( dsatcm_client_id ); if (cm_status!= CM_CLIENT_OK) { ERR_FATAL( "ATCOP unable to activate client: %d", cm_status, 0,0 ); } return; }/* cmif_register_cb_func */
// // LoadCreateObject // // Load a CreateObject function // static void LoadCreateObject(FScope *fScope, Bool doSafeLoad) { ASSERT(fScope); // Get type name const char *typeName = fScope->NextArgString(); // Get claimed id U32 id = fScope->NextArgInteger(); // The id can not be zero if (!id) { ERR_FATAL(("Caught zero id in CreateObject")); } // Get a pointer to the type GameObjType *type = GameObjCtrl::FindType<GameObjType>(typeName); // Make sure we found it if (!type) { LOG_WARN(("Ignoring unknown type in world file '%s'", typeName)); return; } // Do we need to do a safe load if (doSafeLoad) { /* // Filter out certain types if ( Promote::Type<WeaponObjType>(type) // || ) { LOG_DIAG(("Safe Load : Filtering %s (%u)", type->typeId.str, id)); return; } */ // Is this a map object MapObjType *mapType = Promote::Type<MapObjType>(type); // If so, do special safe load if (mapType) { SafeLoadMapObject(mapType, fScope, id); return; } } // Create the object using the type GameObj *obj = type->NewInstance(id); ASSERT(obj); // Load full state info obj->LoadState(fScope); }
// // VarSys::VarItem::SetFloat // // FPOINT type - sets floating point value // void VarSys::VarItem::SetFloat(F32 newVal) { if (type != VI_FPOINT) { ERR_FATAL(("Expected '%s' to be a floating point var (%d)", itemId.str, type)) } // Set the new value fpoint.val = newVal; if (flags & CLAMP) { if (fpoint.val < fpoint.lo) { fpoint.val = fpoint.lo; } else if (fpoint.val > fpoint.hi) { fpoint.val = fpoint.hi; } } // Value may have changed, trigger call back TriggerCallBack(); }
/*=========================================================================== FUNCTION CMIF_CALL_EVENT_CB_FUNC DESCRIPTION CM Call status event callback function DEPENDENCIES None RETURNS None SIDE EFFECTS Adds command in DS command buffer ===========================================================================*/ LOCAL void cmif_call_event_cb_func ( cm_call_event_e_type event, /* Event ID */ const cm_mm_call_info_s_type *event_ptr /* Pointer to Event info */ ) { ds_cmd_type * cmd_buf; ASSERT (event_ptr != NULL); MSG_MED("ATCOP: cm event cb, call_event: %d, call_state: %d", event, event_ptr->call_state,0); if( (cmd_buf = ds_get_cmd_buf()) == NULL) { ERR_FATAL("No ds command buffer",0,0,0); } else { /* send the message to ATCOP */ cmd_buf->hdr.cmd_id = DS_AT_CM_CALL_INFO_CMD; /* If Event_ptr is NULL we should get this far */ /* Pleasing lint here */ if( NULL != event_ptr ) { cmd_buf->cmd.call_event.event_info = *event_ptr; } cmd_buf->cmd.call_event.event = event; ds_put_cmd(cmd_buf); } } /* cmif_call_event_cb_func */
/*=========================================================================== FUNCTION GPIO_TRISTATE DESCRIPTION This function enables/ disables tri-state on specified GPIO. Writing a value 0 (GPIO_TRISTATE_DISABLE) disables the tristate and writing a value 1 (GPIO_TRISTATE_ENABLE) enables tristate. DEPENDENCIES None. RETURN VALUE None ===========================================================================*/ void gpio_tristate( GPIO_SignalType gpio_signal, GPIO_TristateType gpio_tristate_value) { uint32 gpio_oe_register; uint32 gpio_mask; uint8 gpio_number; gpio_number = GPIO_NUMBER(gpio_signal); if (gpio_number >= GPIO_NUM_GPIOS) { #ifndef BUILD_BOOT_CHAIN ERR_FATAL("Invalid GPIO number 0x%x",gpio_number, 0, 0); #endif return; } gpio_oe_register = GPIO_GROUP(gpio_signal); gpio_mask = 1 <<(gpio_number-GPIO_GROUP_START[gpio_oe_register]); if (gpio_tristate_value == GPIO_TRISTATE_DISABLE) { BIO_TRISTATE(gpio_oe_register,gpio_mask,gpio_mask); } else { BIO_TRISTATE(gpio_oe_register,gpio_mask,0); } }
// // VarSys::VarItem::ForgetMe // // Deletes an object from the list of notified objects // void VarSys::VarItem::ForgetMe(VarNotify *obj) { ASSERT(obj); VarNotify *p = pNotify, *prev = NULL; while (p) { if (p == obj) { if (prev == NULL) { // Unlink first element in list pNotify = p->next; } else { // Unlink from middle or end of list prev->next = p->next; } p->next = NULL; return; } prev = p; p = p->next; } // Not found in list ERR_FATAL(("ForgetMe: object not found in list")); }
/* Device initialization function */ F_DRIVER * hfat_device_init (unsigned long driver_param) { F_DRIVER *f_driver; int8 index; index = _f_drivenum_to_index (driver_param); if (index < 0) ERR_FATAL ("HFAT invalid device index",0,0,0); f_driver = &hfat_driver_table[index]; f_driver->readsector = hfat_readsector; f_driver->readmultiplesector = hfat_readmultiplesector; f_driver->writesector = hfat_writesector; f_driver->writemultiplesector = hfat_writemultiplesector; f_driver->write_udata_sector = hfat_write_udata_sector; f_driver->write_udata_multiplesector = hfat_write_udata_multiplesector; f_driver->getphy = hfat_getphy; f_driver->getstatus = hfat_getstatus; f_driver->release = NULL; f_driver->user_ptr = hotplug_hdev (driver_param); return f_driver; }
/*=========================================================================== FUNCTION DS707_ASYNC_TIMER_CB DESCRIPTION Callback for async timer expiration. DEPENDENCIES None RETURN VALUE None SIDE EFFECTS None ===========================================================================*/ LOCAL void ds707_async_timer_cb ( unsigned long timer_id ) { ds_cmd_type *cmd_ptr; /* Pointer to command */ /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ if( ( cmd_ptr = ds_get_cmd_buf() ) == NULL ) { ERR_FATAL( "Can't get cmd buf from DS task", 0, 0, 0 ); } switch ((ds3g_timer_enum_type)timer_id) { case DS3G_TIMER_ASYNC_PTCL_OPENING: cmd_ptr->hdr.cmd_id= DS_707_ASYNC_PTCL_OPENING_TIMER_EXPIRED_CMD; break; default: ERR("Bad timer id on callback %d",timer_id,0,0); ASSERT(0); return; } ds_put_cmd( cmd_ptr ); } /* ds707_async_timer_cb() */
// // IFaceVar::Notify // // The var has changed value // void IFaceVar::Notify(VarNotify::Mode mode) { ASSERT(varPtr); switch (mode) { case VarNotify::CHANGED: { if (ctrl) { VALIDATE(ctrl); // Tell the control that the value changed ctrl->Notify(this); } break; } case VarNotify::DELETED: { Done(); break; } default: { ERR_FATAL(("Unknown VarNotify mode [%d]", U32(mode))); break; } } }
/*=========================================================================== FUNCTION DSMI_VERIFY_PACKET() DESCRIPTION This will verify the correctness of a packet. Check that a packet isn't linked to itself. The algorythm is as follows. Start 2 pointers at the beggining of the list (lead pointer and chase pointer). On every iteration through the loop move the lead pointer down the list by one node, verify that it isn't pointing to the chase pointer. On every other iteration through the loop move the chase pointer down the list. If the packet is linked to itself, eventually these will meet. If the packet is not linked to itself, eventually the lead pointer will get to the end of the packet. DEPENDENCIES item_ptr should be non-null and pointing at a dsm item allocated from dsm. PARAMETERS item_ptr - Pointer to packet to verify RETURN VALUE None (This function won't return if the check fails) SIDE EFFECTS If the item_ptr fails a check then ERR_FATAL is called, otherwise none. ===========================================================================*/ void dsmi_verify_packet ( dsm_item_type *item_ptr ) { uint32 cnt = 0; dsm_item_type *lead_ptr = item_ptr; dsm_item_type *chase_ptr = item_ptr; /*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ DSM_ASSERT(item_ptr != NULL); while(lead_ptr != NULL) { /*----------------------------------------------------------------- Count buffers in packet -----------------------------------------------------------------*/ cnt ++; dsmi_verify_buffer(lead_ptr); /*----------------------------------------------------------------- Check for packet looped to self -----------------------------------------------------------------*/ lead_ptr = lead_ptr->pkt_ptr; if(lead_ptr == chase_ptr) { ERR_FATAL("dsm_verify_packet: Packet Linked to Self",0,0,0); } if((cnt & 0x1) == 0) { chase_ptr = chase_ptr->pkt_ptr; } } }
// // VarSys::VarItem::SetBinary // // BINARY type - sets the binary value // void VarSys::VarItem::SetBinary(U32 size, const U8 *newVal) { if (type != VI_BINARY) { ERR_FATAL(("Expected '%s' to be an binary var (%d)", itemId.str, type)) } // Do we need to enlarge the binary ? if (size > binary.maxSize) { delete [] binary.data; binary.data = new U8[size]; binary.maxSize = size; } // Save the data size binary.size = size; if (newVal) { // Copy the passed in value Utils::Memcpy(binary.data, newVal, size); } else { // Clear to zero Utils::Memset(binary.data, 0x00, size); } // Value may have changed, trigger call back TriggerCallBack(); }
// // VarSys::VarItem::SetInteger // // INTEGER type - sets integer value // void VarSys::VarItem::SetInteger(S32 newVal) { if (type != VI_INTEGER) { ERR_FATAL(("Expected '%s' to be an integer var (%d)", itemId.str, type)) } // Set the new value integer.val = newVal; if (flags & CLAMP) { if (integer.val < integer.lo) { integer.val = integer.lo; } else if (integer.val > integer.hi) { integer.val = integer.hi; } } // Value may have changed, trigger call back TriggerCallBack(); }
// // Constructor // Text::Text(Cineractive *cineractive, FScope *fScope, S32 priority) : StepHoldPrim(cineractive, fScope, priority), text(NULL) { // Font const char *name = StdLoad::TypeString(fScope, "Font", "System"); if ((font = FontSys::GetFont(Crc::CalcStr(name))) == NULL) { ERR_FATAL(("Font not found [%s] for Cineractive Text", name)) } // Text FScope *sScope; if ((sScope = fScope->GetFunction("Text", FALSE)) != NULL) { SetText(TRANSLATE((StdLoad::TypeString(sScope)))); } // Position if ((sScope = fScope->GetFunction("Pos", FALSE)) != NULL) { x = StdLoad::TypeF32(sScope); y = StdLoad::TypeF32(sScope); } else { x = 0.5F; y = 0.5F; } // Color StdLoad::TypeColor(fScope, "Color", clr, Color(255L, 255L, 255L, 255L)); }
static bool IsNewInHeap(CObjectWithNew* ptr) { switch ( ptr->m_Counter ) { case eCounter_new: { char stackObject; const char* stackObjectPtr = &stackObject; const char* objectPtr = reinterpret_cast<const char*>(ptr); bool inStack = (objectPtr > stackObjectPtr) && (objectPtr < stackObjectPtr + STACK_THRESHOLD); if ( inStack ) { ERR_FATAL("!!!InStack," " s_CurrentStep: "<<s_CurrentStep<< " s_CurrentInHeap: "<<s_CurrentInHeap<< " stackObjectPtr: "<<(void*)stackObjectPtr<< " objectPtr: "<<(void*)objectPtr<< CStackTrace()); } _ASSERT(s_CurrentInHeap); _ASSERT(!inStack); return !inStack; } case 0: _ASSERT(!s_CurrentInHeap); return false; } error("invalid CObjectWithNew::new"); return false; }
trm_compatible_mask_t TRM::get_compatibility_mode ( /* Client requesting the compatibility masks */ trm_client_enum_t client, /* Reason for the client's request */ trm_reason_enum_t reason ) { /* Operation "Mode" for the client/reason */ trm_mode_id_t mode_id; /* A bitmask representing the client mode */ trm_compatible_mask_t mode = 0; /*---------------------------------------------------------------------------*/ if ( reason < trmcfg_client[ client ].reasons ) { /* Look up mode from client/reason pair */ mode_id = trmcfg_client[ client ].pri_mode[ reason ].mode; /* Convert mode id into a mode bitmask */ mode = TRM_MASK_FROM_MODE( mode_id ); } else { ERR_FATAL("Client %d: Invalid reason %d", client, reason, 0); } return mode; } /* TRM::get_compatibility_mode( client, reason ) */
/*=========================================================================== FUNCTION GPIO_OUT DESCRIPTION Outputs the given value to the corresponding GPIO register given a GPIO signal type. This function calculates the GPIO register and the mask value. DEPENDENCIES None. RETURN VALUE None ===========================================================================*/ void gpio_out( GPIO_SignalType gpio_signal, GPIO_ValueType gpio_value ) { uint32 gpio_out_register; uint32 gpio_mask; uint8 gpio_number; gpio_number = GPIO_NUMBER(gpio_signal); if (gpio_number >= GPIO_NUM_GPIOS) { #ifndef BUILD_BOOT_CHAIN ERR_FATAL("Invalid GPIO number 0x%x",gpio_number, 0, 0); #endif return; } gpio_out_register = GPIO_GROUP(gpio_signal); gpio_mask = 1 << (gpio_number - GPIO_GROUP_START[gpio_out_register]); if (gpio_value == GPIO_LOW_VALUE) { BIO_OUT(gpio_out_register, gpio_mask, 0); } else { BIO_OUT(gpio_out_register, gpio_mask, gpio_mask); } }
void Camera::CreateOcclusion() { if (Occlusion) { return ; } Occlusion = new OcclusionClass(this); #if 0 //now that everything is initilize try to create the occlusion camera Camera *OcclusionCam = NULL; try { // Attent to create a harware occlusion camera OcclusionCam = new CameraOcclusionHardware( "occlusion"); } catch (char *Message) { LOG_DIAG( (Message) ); // No hardware occlusion support create a software emulation // occlusion OcclusionCam = new CameraOcclusion( "occlusion"); if (!OcclusionCam) { ERR_FATAL( ("can't create OcclusionCamera") ); } } #endif }
/*=========================================================================== FUNCTION GPIO_IN DESCRIPTION Reads the the corresponding GPIO register given a GPIO signal type and extracts the value for that particular GPIO. This function calculates the GPIO register and the mask value required to return the GPIO value. DEPENDENCIES None. RETURN VALUE GPIO value at the given GPIO number ===========================================================================*/ GPIO_ValueType gpio_in( GPIO_SignalType gpio_signal ) { uint32 gpio_in_register; uint32 gpio_mask; uint32 gpio_value; uint8 gpio_number; gpio_number = GPIO_NUMBER(gpio_signal); if (gpio_number >= GPIO_NUM_GPIOS) { #ifndef BUILD_BOOT_CHAIN ERR_FATAL("Invalid GPIO number 0x%x",gpio_number, 0, 0); #endif return; } gpio_in_register = GPIO_GROUP(gpio_signal); gpio_mask = 1 <<(gpio_number-GPIO_GROUP_START[gpio_in_register]); gpio_value = inpdw(bio_gpio[gpio_in_register].in_addr) & gpio_mask; if (gpio_value == 0) { return GPIO_LOW_VALUE; } else { return GPIO_HIGH_VALUE; } }