size_t numa_NodeFromProcessor(size_t processor) { (void)ModuleInit(&initState, InitTopology); ENSURE(processor < os_cpu_NumProcessors()); Node* node = FindNodeWithProcessor(processor); ENSURE(node); return nodes-node; }
const Structures* GetStructures() { static ModuleInitState initState; Status ret = ModuleInit(&initState, InitStructures); // (callers have to check if member pointers are nonzero anyway, so // we always return a valid pointer to simplify most use cases.) UNUSED2(ret); return &structures; }
// Create entity system. CEntitySystem *CreateEntitySystem(Env *p_pEnv) { SAM_ASSERT(p_pEnv->m_pEntitySystem == NULL, "Entity System was already created."); ModuleInit(p_pEnv); // TODO: creer le module. return NULL; }
const x86_x64::Cache* Caches(size_t idxCache) { static ModuleInitState initState; ModuleInit(&initState, DetectCacheAndTLB); if(idxCache >= TLB+numTLBs) return 0; return &caches[idxCache]; }
static int ev3dev_ui_init(void) { int ret = -ENXIO; if ( !ev3dev ) { printk( "ev3dev node is not yet registered, load the ev3dev_ev3dev module\n"); goto err0; } ret = -ENOMEM; ui = platform_device_alloc( "ui", -1 ); if (!ui) { printk( KERN_CRIT "failed to allocate ev3dev\\ui device\n"); goto err1; } printk(" ui_init ui allocated %08x\n", (unsigned int)(ui)); ui->dev.parent = &ev3dev->dev; ret = platform_device_add(ui); if (ret) { printk( "failed to register ui device\n"); goto err4; } ret = sysfs_create_group(&ui->dev.kobj, &ev3dev_ui_attr_group); ModuleInit(); return 0; err4: platform_device_put( ui ); err1: err0: return ret; }
Status wmi_GetClass(const wchar_t* className, WmiMap& wmiMap) { RETURN_STATUS_IF_ERR(ModuleInit(&initState, Init)); IEnumWbemClassObjectPtr pEnum = 0; wchar_t query[200]; swprintf_s(query, ARRAY_SIZE(query), L"SELECT * FROM %ls", className); HRESULT hr = pSvc->ExecQuery(L"WQL", _bstr_t(query), WBEM_FLAG_FORWARD_ONLY|WBEM_FLAG_RETURN_IMMEDIATELY, 0, &pEnum); if(FAILED(hr)) WARN_RETURN(ERR::FAIL); ENSURE(pEnum); for(;;) { IWbemClassObjectPtr pObj = 0; ULONG numReturned = 0; hr = pEnum->Next((LONG)WBEM_INFINITE, 1, &pObj, &numReturned); if(FAILED(hr)) WARN_RETURN(ERR::FAIL); if(numReturned == 0) break; ENSURE(pEnum); pObj->BeginEnumeration(WBEM_FLAG_NONSYSTEM_ONLY); for(;;) { BSTR name; VARIANT value; VariantInit(&value); if(pObj->Next(0, &name, &value, 0, 0) != WBEM_S_NO_ERROR) { SysFreeString(name); break; } wmiMap[name] = value; SysFreeString(name); } } return INFO::OK; }
int main(int argc, char** argv) { PowerOn(); ClockInit(); ANSELA = 0; ANSELB = 0; SPLIM = 0xFFFF; // TODO: implement proper handling of SPLIM. ModuleInit(); I2cInit(); ShellTaskInit(); App * first = MainMenuAppInit(&main_menu_app); // Comment out the next line to skip splash. first = SplashAppInit(&splash_app, first); AppTaskInit(first); vTaskStartScheduler(); }
static void initialize(intptr_t unused) { /** * Reset 64-bit GP timer */ TIMERP1.TGCR = 0x0; AINTC.SICR = INTNO_I2C_TIMER; TIMERP1.TIM12 = 0x0; TIMERP1.TIM34 = 0x0; TIMERP1.PRD12 = 0x0; TIMERP1.PRD34 = 0x0; TIMERP1.REL12 = 0x0; TIMERP1.REL34 = 0x0; // TIMERP1.INTCTLSTAT = 0x30003; TIMERP1.TGCR = 0x3; //TIMERP1.TCR = 0x0; //TIMERP1.TGCR = 0x3; ModuleInit(); for(int i = 0; i < TNUM_INPUT_PORT; ++i) { driver_data_i2c_sensor[i].raw = IicCtrl.data_package[i].data; driver_data_i2c_sensor[i].status = &(IicCtrl.data_package[i].transfer_state); } global_brick_info.i2c_sensors = driver_data_i2c_sensor; #if defined(DEBUG_I2C_SENSOR) || 1 syslog(LOG_NOTICE, "i2c_dri initialized."); #if 0 SetGpio(GP8_11); SetGpio(UART1_TXD); SetGpio(UART1_RXD); SetGpio(GP0_2); SetGpio(GP0_15); #endif #endif }
bool numa_IsMemoryInterleaved() { static ModuleInitState initState; (void)ModuleInit(&initState, InitMemoryInterleaved); return isMemoryInterleaved; }
/** * Load the dynamic library related to a gateway module. The routine * will look for library files in the current directory, * $MAXSCALE_HOME/modules and /usr/local/skysql/MaxScale/modules. * * @param module Name of the module to load * @param type Type of module, used purely for registration * @return The module specific entry point structure or NULL */ void * load_module(const char *module, const char *type) { char *home, *version; char fname[MAXPATHLEN]; void *dlhandle, *sym; char *(*ver)(); void *(*ep)(), *modobj; MODULES *mod; MODULE_INFO *mod_info = NULL; if ((mod = find_module(module)) == NULL) { /*< * The module is not already loaded * * Search of the shared object. */ sprintf(fname, "./lib%s.so", module); if (access(fname, F_OK) == -1) { home = get_maxscale_home (); sprintf(fname, "%s/modules/lib%s.so", home, module); if (access(fname, F_OK) == -1) { LOGIF(LE, (skygw_log_write_flush( LOGFILE_ERROR, "Error : Unable to find library for " "module: %s.", module))); return NULL; } } if ((dlhandle = dlopen(fname, RTLD_NOW|RTLD_LOCAL)) == NULL) { LOGIF(LE, (skygw_log_write_flush( LOGFILE_ERROR, "Error : Unable to load library for module: " "%s\n\n\t\t %s." "\n\n", module, dlerror()))); return NULL; } if ((sym = dlsym(dlhandle, "version")) == NULL) { LOGIF(LE, (skygw_log_write_flush( LOGFILE_ERROR, "Error : Version interface not supported by " "module: %s\n\t\t\t %s.", module, dlerror()))); dlclose(dlhandle); return NULL; } ver = sym; version = ver(); /* * If the module has a ModuleInit function cal it now. */ if ((sym = dlsym(dlhandle, "ModuleInit")) != NULL) { void (*ModuleInit)() = sym; ModuleInit(); } if ((sym = dlsym(dlhandle, "info")) != NULL) { int fatal = 0; mod_info = sym; if (strcmp(type, MODULE_PROTOCOL) == 0 && mod_info->modapi != MODULE_API_PROTOCOL) { LOGIF(LE, (skygw_log_write_flush( LOGFILE_ERROR, "Module '%s' does not implement " "the protocol API.\n", module))); fatal = 1; } if (strcmp(type, MODULE_ROUTER) == 0 && mod_info->modapi != MODULE_API_ROUTER) { LOGIF(LE, (skygw_log_write_flush( LOGFILE_ERROR, "Module '%s' does not implement " "the router API.\n", module))); fatal = 1; } if (strcmp(type, MODULE_MONITOR) == 0 && mod_info->modapi != MODULE_API_MONITOR) { LOGIF(LE, (skygw_log_write_flush( LOGFILE_ERROR, "Module '%s' does not implement " "the monitor API.\n", module))); fatal = 1; } if (strcmp(type, MODULE_FILTER) == 0 && mod_info->modapi != MODULE_API_FILTER) { LOGIF(LE, (skygw_log_write_flush( LOGFILE_ERROR, "Module '%s' does not implement " "the filter API.\n", module))); fatal = 1; } if (fatal) { dlclose(dlhandle); return NULL; } } if ((sym = dlsym(dlhandle, "GetModuleObject")) == NULL) { LOGIF(LE, (skygw_log_write_flush( LOGFILE_ERROR, "Error : Expected entry point interface missing " "from module: %s\n\t\t\t %s.", module, dlerror()))); dlclose(dlhandle); return NULL; } ep = sym; modobj = ep(); LOGIF(LM, (skygw_log_write_flush( LOGFILE_MESSAGE, "Loaded module %s: %s from %s", module, version, fname))); register_module(module, type, dlhandle, version, modobj, mod_info); } else { /* * The module is already loaded, get the entry points again and * return a reference to the already loaded module. */ modobj = mod->modobj; } return modobj; }
int CameraInit(void *pData) { PHYSICAL_ADDRESS ioPhysicalBase = {0,0}; RETAILMSG(CAM_INOUT,(TEXT("++%s\n"), __FUNCTION__)); // 0. Map to Virtual Address // GPIO Virtual alloc ioPhysicalBase.LowPart = S3C6410_BASE_REG_PA_GPIO; s6410IOP = (S3C6410_GPIO_REG *)MmMapIoSpace(ioPhysicalBase, sizeof(S3C6410_GPIO_REG), FALSE); if (s6410IOP == NULL) { goto CleanUp; } // Camera Virtual alloc ioPhysicalBase.LowPart = S3C6410_BASE_REG_PA_CAMIF; s6410CAM = (S3C6410_CAMIF_REG *)MmMapIoSpace(ioPhysicalBase, sizeof(S3C6410_CAMIF_REG), FALSE); if (s6410CAM == NULL) { goto CleanUp; } // PWM clock Virtual alloc ioPhysicalBase.LowPart = S3C6410_BASE_REG_PA_SYSCON; s6410PWR = (S3C6410_SYSCON_REG *)MmMapIoSpace(ioPhysicalBase, sizeof(S3C6410_SYSCON_REG), FALSE); if (s6410PWR == NULL) { goto CleanUp; } hPwrControl = CreateFile( L"PWC0:", GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0); if (INVALID_HANDLE_VALUE == hPwrControl ) { RETAILMSG(CAM_ERR, (TEXT("[CAM] CameraInit() : PWC0 Open Device Failed\r\n"))); return FALSE; } ModuleInit(); CameraSetClockDiv(); // 1. Camera IO setup CameraGpioInit(); // 2. Camera Clock setup CameraClockOn(TRUE); // 3. camera module reset CameraModuleReset(); /* // Reserved Step // 4. Write Setting for Module using I2C if(!ModuleWriteBlock()) { return FALSE; } // 5. Camera i/f reset CameraInterfaceReset(); // 6. Initialize I/F source register CameraCaptureSourceSet(); */ // 7. Camera Clock Off CameraClockOn(FALSE); // 8. Allocation Buffer(); if(!InitializeBuffer()) { return FALSE; } // 9. Interrupt Initlaize(); if(!InterruptInitialize()) { return FALSE; } RETAILMSG(CAM_INOUT,(TEXT("--%s Succeeded\n"), __FUNCTION__)); return TRUE; CleanUp: RETAILMSG(1,(TEXT("%s : Failed, ioPhysicalBase(0x%x,0x%x)\r\n"), __FUNCTION__, ioPhysicalBase.LowPart, ioPhysicalBase.HighPart)); return FALSE; }
void h_mgr_init() { ModuleInit(&initState, Init); }
Status mahaf_Init() { return ModuleInit(&initState, Init); }
double numa_Factor() { static ModuleInitState initState; (void)ModuleInit(&initState, InitRelativeDistance); return relativeDistance; }
static UCHAR NodeNumberFromNode(size_t node) { (void)ModuleInit(&initState, InitTopology); ENSURE(node < numa_NumNodes()); return nodes[node].nodeNumber; }
uintptr_t numa_ProcessorMaskFromNode(size_t node) { (void)ModuleInit(&initState, InitTopology); ENSURE(node < numNodes); return nodes[node].processorMask; }
size_t numa_NumNodes() { (void)ModuleInit(&initState, InitTopology); return numNodes; }