Exemplo n.º 1
0
void KComponentDataPrivate::lazyInit(const KComponentData &component)
{
    if (dirs == 0) {
        dirs = new KStandardDirs();
        // install appdata resource type
        dirs->addResourceType("appdata", "data", aboutData.appName() + QLatin1Char('/'), true);

        configInit(component);

        if (dirs->addCustomized(sharedConfig.data()))
            sharedConfig->reparseConfiguration();
    }

#ifdef Q_OS_WIN
    if (QCoreApplication::instance() && dirs && kdeLibraryPathsAdded != KdeLibraryPathsAddedDone) {
#else
    // the first KComponentData sets the KDE Qt plugin paths
    if (dirs && kdeLibraryPathsAdded != KdeLibraryPathsAddedDone) {
#endif
        kdeLibraryPathsAdded = KdeLibraryPathsAddedDone;
        const QStringList &plugins = dirs->resourceDirs("qtplugins");
        QStringList::ConstIterator it = plugins.begin();
        while (it != plugins.end()) {
            QCoreApplication::addLibraryPath(*it);
            ++it;
        }
    }
}

bool kde_kiosk_exception = false; // flag to disable kiosk restrictions
bool kde_kiosk_admin = false;

void KComponentDataPrivate::configInit(const KComponentData &component)
{
    Q_ASSERT(!sharedConfig);

    if (!configName.isEmpty()) {
        sharedConfig = KSharedConfig::openConfig(component, configName);

        //FIXME: this is broken and I don't know how to repair it
        // Check whether custom config files are allowed.
        KConfigGroup cg(sharedConfig, "KDE Action Restrictions");
        QString kioskException = cg.readEntry("kiosk_exception");
        if (!cg.readEntry("custom_config", true)) {
           sharedConfig = 0;
        }
    }
    
    if (!sharedConfig) {
        sharedConfig = KSharedConfig::openConfig(component);
    }

    // Check if we are excempt from kiosk restrictions
    if (kde_kiosk_admin && !kde_kiosk_exception && !qgetenv("KDE_KIOSK_NO_RESTRICTIONS").isEmpty()) {
        kde_kiosk_exception = true;
        sharedConfig = 0;
        configInit(component); // Reread...
    }
}
Exemplo n.º 2
0
bool Window::_cmdConfigInit( co::Command& command )
{
    const WindowConfigInitPacket* packet =
        command.get<WindowConfigInitPacket>();
    LBLOG( LOG_INIT ) << "TASK window config init " << packet << std::endl;

    WindowConfigInitReplyPacket reply;
    setError( ERROR_NONE );

    if( getPipe()->isRunning( ))
    {
        _state = STATE_INITIALIZING;
        reply.result = configInit( packet->initID );
        if( reply.result )
            _state = STATE_RUNNING;
    }
    else
    {
        setError( ERROR_WINDOW_PIPE_NOTRUNNING );
        reply.result = false;
    }
    LBLOG( LOG_INIT ) << "TASK window config init reply " << &reply <<std::endl;

    commit();
    send( command.getNode(), reply );
    return true;
}
Exemplo n.º 3
0
// Main routine, initialize some basic stuff
void ICACHE_FLASH_ATTR user_init(void)
 {
  // Init some stuff
  stdoutInit();
  batteryInit();
  configInit();
  configLoad();

  // Check if wifi mode is correct
  configCheckWifiMode();

  // Measure battery voltage
  batteryMeasureVoltage();
  if(!batteryCheckVoltage())
   {
    // Voltage too low, go to sleep mode!
    sleepmode();
   }

  // 0x40200000 is the base address for spi flash memory mapping, ESPFS_POS is the position
  // where image is written in flash that is defined in Makefile.
  espFsInit((void*)(0x40200000 + ESPFS_POS));
  httpdInit(builtInUrls, 80);

  // Register callback
  system_init_done_cb(init_done);

  os_printf("Ready\n");
 }
Exemplo n.º 4
0
bool Window::_cmdConfigInit( co::Command& cmd )
{
    co::ObjectCommand command( cmd );

    LBLOG( LOG_INIT ) << "TASK window config init " << command << std::endl;

    setError( ERROR_NONE );

    bool result = false;
    if( getPipe()->isRunning( ))
    {
        _state = STATE_INITIALIZING;
        result = configInit( command.get< uint128_t >( ));
        if( result )
            _state = STATE_RUNNING;
    }
    else
        setError( ERROR_WINDOW_PIPE_NOTRUNNING );

    LBLOG( LOG_INIT ) << "TASK window config init reply " << std::endl;

    commit();
    send( command.getNode(), fabric::CMD_WINDOW_CONFIG_INIT_REPLY ) << result;
    return true;
}
Exemplo n.º 5
0
bool Node::_cmdConfigInit( co::Command& command )
{
    LB_TS_THREAD( _nodeThread );

    const NodeConfigInitPacket* packet = 
        command.get<NodeConfigInitPacket>();
    LBLOG( LOG_INIT ) << "Init node " << packet << std::endl;

    _state = STATE_INITIALIZING;

    _currentFrame  = packet->frameNumber;
    _unlockedFrame = packet->frameNumber;
    _finishedFrame = packet->frameNumber;
    _setAffinity();

    transmitter.start();
    setError( ERROR_NONE );
    NodeConfigInitReplyPacket reply;
    reply.result = configInit( packet->initID );

    if( getIAttribute( IATTR_THREAD_MODEL ) == eq::UNDEFINED )
        setIAttribute( IATTR_THREAD_MODEL, eq::DRAW_SYNC );

    _state = reply.result ? STATE_RUNNING : STATE_INIT_FAILED;

    commit();
    send( command.getNode(), reply );
    return true;
}
Exemplo n.º 6
0
Arquivo: main.c Projeto: Maelok/esc32
void main(void) {
    rccInit();
    timerInit();
    configInit();
    adcInit();
    fetInit();
    serialInit();
    runInit();
    cliInit();
    owInit();

    runDisarm(REASON_STARTUP);
    inputMode = ESC_INPUT_PWM;

    fetSetDutyCycle(0);
    fetBeep(200, 100);
    fetBeep(300, 100);
    fetBeep(400, 100);
    fetBeep(500, 100);
    fetBeep(400, 100);
    fetBeep(300, 100);
    fetBeep(200, 100);

    pwmInit();

    statusLed = digitalInit(GPIO_STATUS_LED_PORT, GPIO_STATUS_LED_PIN);
    digitalHi(statusLed);
    errorLed = digitalInit(GPIO_ERROR_LED_PORT, GPIO_ERROR_LED_PIN);
    digitalHi(errorLed);
#ifdef ESC_DEBUG
    tp = digitalInit(GPIO_TP_PORT, GPIO_TP_PIN);
    digitalLo(tp);
#endif

    // self calibrating idle timer loop
    {
        volatile unsigned long cycles;
        volatile unsigned int *DWT_CYCCNT = (int *)0xE0001004;
        volatile unsigned int *DWT_CONTROL = (int *)0xE0001000;
        volatile unsigned int *SCB_DEMCR = (int *)0xE000EDFC;

        *SCB_DEMCR = *SCB_DEMCR | 0x01000000;
        *DWT_CONTROL = *DWT_CONTROL | 1;	// enable the counter

	minCycles = 0xffff;
        while (1) {
            idleCounter++;

	    NOPS_4;

            cycles = *DWT_CYCCNT;
            *DWT_CYCCNT = 0;		    // reset the counter

            // record shortest number of instructions for loop
	    totalCycles += cycles;
            if (cycles < minCycles)
                minCycles = cycles;
        }
    }
}
Exemplo n.º 7
0
void UVDUvudecUnitTest::helpArgTest(void)
{
	m_args.push_back("--help");		

	CPPUNIT_ASSERT(configInit() == UV_ERR_DONE);
	deinit();
}
Exemplo n.º 8
0
bool Node::_cmdConfigInit( co::ICommand& cmd )
{
    co::ObjectICommand command( cmd );

    LB_TS_THREAD( _nodeThread );
    LBLOG( LOG_INIT ) << "Init node " << command << std::endl;

    _impl->state = STATE_INITIALIZING;

    const uint128_t& initID = command.read< uint128_t >();
    const uint32_t frameNumber = command.read< uint32_t >();

    _impl->currentFrame  = frameNumber;
    _impl->unlockedFrame = frameNumber;
    _impl->finishedFrame = frameNumber;
    _setAffinity();

    _impl->transmitter.start();
    const uint64_t result = configInit( initID );

    if( getIAttribute( IATTR_THREAD_MODEL ) == eq::UNDEFINED )
        setIAttribute( IATTR_THREAD_MODEL, eq::DRAW_SYNC );

    _impl->state = result ? STATE_RUNNING : STATE_INIT_FAILED;

    commit();
    send( command.getRemoteNode(), fabric::CMD_NODE_CONFIG_INIT_REPLY )
            << result;
    return true;
}
Exemplo n.º 9
0
int main (int argc, char ** argv)
{
  configInit();
  if(!declare_pid("player")) {
	puts("Player already found");
	return 1;
  }

  srandom(time(NULL));
  arguments = argv;
  signalsSetup();
  gst_init (NULL,NULL);
  selectSetup();
  onSignal(SIGUSR1,signalNext);
  onSignal(SIGUSR2,restartPlayer);

  preparation_t queries[] = {
    { "getTopRecording",
      "SELECT queue.recording,"
      "replaygain.gain,replaygain.peak,replaygain.level,"
      "recordings.path "
      "FROM queue INNER JOIN replaygain ON replaygain.id = queue.recording  INNER JOIN recordings ON recordings.id = queue.recording ORDER BY queue.id ASC LIMIT 1" },
  };
  prepareQueries(queries);

  GMainLoop* loop = g_main_loop_new (NULL, FALSE);
  void done_quit() {
	g_main_loop_quit(loop);
  }
Exemplo n.º 10
0
void UVDUvudecUnitTest::versionArgTest(void)
{
	m_args.push_back("--version");
	
	CPPUNIT_ASSERT_EQUAL(UV_ERR_DONE, configInit());
	deinit();
}
Exemplo n.º 11
0
LOCAL int ICACHE_FLASH_ATTR resetConfig(const char *value, uint valueLen)
{
	configInit(&config);
	retainInit(&retain);
	retainWrite(&retain);
	return OK;
}
Exemplo n.º 12
0
/*
 * Application entry point.
 */
int main(void) {

	/*
	 * System initializations.
	 * - HAL initialization, this also initializes the configured device drivers
	 *   and performs the board-specific initializations.
	 * - Kernel initialization, the main() function becomes a thread and the
	 *   RTOS is active.
	 */
	halInit();
	chSysInit();

	chEvtInit(&eventImuIrq);
	chEvtInit(&eventMagnIrq);
	chEvtInit(&eventImuRead);
	chEvtInit(&eventMagnRead);
	chEvtInit(&eventEKFDone);

	palSetPadMode(GPIOB, 3, PAL_MODE_OUTPUT_PUSHPULL); // BLUE
	palSetPadMode(GPIOB, 4, PAL_MODE_OUTPUT_PUSHPULL); // GREEN
	palSetPadMode(GPIOB, 5, PAL_MODE_OUTPUT_PUSHPULL); // RED
	chThdCreateStatic(waThreadLed, sizeof(waThreadLed), NORMALPRIO, ThreadLed, NULL );

	I2CInitLocal();
	configInit();
	mavlinkInit();
	initSensors();

	TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
	RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM5, ENABLE);
	TIM_TimeBaseStructure.TIM_Period = 0xFFFFFFFF;
	TIM_TimeBaseStructure.TIM_Prescaler = 84 - 1;
	TIM_TimeBaseStructure.TIM_ClockDivision = 0;
	TIM_TimeBaseStructure.TIM_CounterMode = TIM_CounterMode_Up;
	TIM_TimeBaseInit(TIM5, &TIM_TimeBaseStructure);
	TIM_Cmd(TIM5, ENABLE);

	startEstimation();
	startSensors();
	radioInit();
	motorsInit();

	extStart(&EXTD1, &extcfg);
	extChannelEnable(&EXTD1, 0);
	extChannelEnable(&EXTD1, 1);

	chEvtBroadcastFlags(&eventEKFDone, EVT_EKF_DONE);

	while (TRUE) {
		chThdSleepMilliseconds(1000);
	}
}
Exemplo n.º 13
0
void ICACHE_FLASH_ATTR configRead(Config *config)
{
	spi_flash_read(CONFIG_SAVE_FLASH_ADDR, (uint*)config, sizeof(Config));
	if (config->magic != VALID_MAGIC_NUMBER)
	{
		os_printf("no valid config in flash\n");
		configInit(config);
		configWrite(config);
	}
	else
	{
		os_printf("valid config found\n");
	}
}
Exemplo n.º 14
0
//*****************************************************************************
//	Function:	Initialise
//	Arguments: 	None
//	Action: 	Program Initialisation
//	Returns: 	None
//*****************************************************************************
void initialise( void )
{
  hardwareInit();
  timerInit();
//  eventHandlerInit();
//  motorControlInit();
//  batteryMonitorInit();
//  soundsInit();
  usageCounterInit();
  interruptsInit();
  configInit();
//    asm("SLEEP");

}
Exemplo n.º 15
0
bool Pipe::_cmdConfigInit( co::ICommand& cmd )
{
    LB_TS_THREAD( _pipeThread );

    co::ObjectICommand command( cmd );
    const uint128_t initID = command.get< uint128_t >();
    const uint32_t frameNumber = command.get< uint32_t >();

    LBLOG( LOG_INIT ) << "Init pipe " << command << " init id " << initID
                      << " frame " << frameNumber << std::endl;

    if( !isThreaded( ))
    {
        _impl->windowSystem = selectWindowSystem();
        _setupCommandQueue();
    }

    setError( ERROR_NONE );

    Node* node = getNode();
    LBASSERT( node );
    node->waitInitialized();

    bool result = false;
    if( node->isRunning( ))
    {
        _impl->currentFrame  = frameNumber;
        _impl->finishedFrame = frameNumber;
        _impl->unlockedFrame = frameNumber;
        _impl->state = STATE_INITIALIZING;

        result = configInit( initID );

        if( result )
            _impl->state = STATE_RUNNING;
    }
    else
        setError( ERROR_PIPE_NODE_NOTRUNNING );

    LBLOG( LOG_INIT ) << "TASK pipe config init reply result " << result
                      << std::endl;

    co::NodePtr netNode = command.getNode();

    commit();
    send( netNode, fabric::CMD_PIPE_CONFIG_INIT_REPLY ) << result;
    return true;
}
Exemplo n.º 16
0
/* main start for Arnold CPC emulator for linux */
int main(int argc, char *argv[])
{
	configInit();	//FIXME: disabled for debug

	/* print welcome message */
	printf("Arnold Emulator (c) Kevin Thacker\n");
	printf("Linux Port maintained by Andreas Micklei\n");
	roms_init();
	//printrom();

	if (!CPCEmulation_CheckEndianness())
	{
		printf("%s", Messages[72]);
		exit(1);
	}

//	/* check display */
//	if (!XWindows_CheckDisplay())
//	{
//		printf("Failed to open display. Or display depth is  8-bit\n");
//		exit(-1);
//	}

	 /* initialise cpc hardware */
	CPC_Initialise();

	Multiface_Install();

	/* done before parsing command line args. Command line args
	will take priority */
	loadConfigFile(); //FIXME: disabled for debug

	init_main(argc, argv);

	CPC_Finish();

	Multiface_DeInstall();

	//printf("heello");

	saveConfigFile(); //FIXME: disabled for debug

	configFree(); //FIXME: disabled for debug

	exit(0);

	return 0;	/* Never reached */
}
Exemplo n.º 17
0
int main(int argc, char **argv)
{
	PFWatchdogRegister (argc, argv, EPFWD_MODE_REBOOT, 30);

	notifyInit();
	configEventInit();
	configInit(PFCONFIG_NAME);

	run();

	configEventExit();
	notifyExit();
	
	configUpdate(1);

	PFWatchdogUnregister ();

	return 0;
}
Exemplo n.º 18
0
Http::Http(int num):fpwUrl(NULL), maxthreadnum(num) {
	signal(SIGPIPE, &signalHandler);
	openFile(fpwUrl, "./text", "w+");
	openFile(fprArg, "./config", "r");
	openFile(test, "./test", "r");

	configInit();
	std::unordered_set<std::string>::iterator itr = jobUrl.begin();
	pthis = this;
	curl_global_init(CURL_GLOBAL_ALL);

	try {
		poolInit(maxthreadnum);
		while (true) {
			if (itr == jobUrl.end() || itr->empty()) {
				sleep(1);
				itr = jobUrl.begin();
				continue;
			}

			char* p = (char*)malloc(itr->size()+1);
			if (p == NULL) {
				std::cout << "continue url=" << *itr << std::endl;
				itr = jobUrl.erase(itr);
				continue;
			}
			memset(p, 0, itr->size()+1);
			memcpy(p, itr->c_str(), itr->size());
			poolAddWorker(workJob, (void*)p);
			std::cout << "加入任务" << std::endl; 
			//throw std::string("exit");				//测试
			pthread_mutex_lock(&(pthis->pthreadpool.queuelock));
			itr = jobUrl.erase(itr);
			pthread_mutex_unlock(&(pthis->pthreadpool.queuelock));
		}
	}
	catch (std::string& ex){
		std::cout << "catch=";
		std::cout << ex << std::endl;
	}
}
Exemplo n.º 19
0
void main(void) {
    rccInit();

    statusLed = digitalInit(GPIO_STATUS_LED_PORT, GPIO_STATUS_LED_PIN);
    errorLed = digitalInit(GPIO_ERROR_LED_PORT, GPIO_ERROR_LED_PIN);
#ifdef ESC_DEBUG
    tp = digitalInit(GPIO_TP_PORT, GPIO_TP_PIN);
    digitalLo(tp);
#endif

    timerInit();
    configInit();
    adcInit();
    fetInit();
    serialInit();
    canInit();
    runInit();
    cliInit();
    owInit();

    runDisarm(REASON_STARTUP);
    inputMode = ESC_INPUT_PWM;

    fetSetDutyCycle(0);
    fetBeep(200, 100);
    fetBeep(300, 100);
    fetBeep(400, 100);
    fetBeep(500, 100);
    fetBeep(400, 100);
    fetBeep(300, 100);
    fetBeep(200, 100);

    pwmInit();

    digitalHi(statusLed);
    digitalHi(errorLed);

    // self calibrating idle timer loop
    {
	uint32_t lastRunCount;
	uint32_t thisCycles, lastCycles;
        volatile uint32_t cycles;
        volatile uint32_t *DWT_CYCCNT = (uint32_t *)0xE0001004;
        volatile uint32_t *DWT_CONTROL = (uint32_t *)0xE0001000;
        volatile uint32_t *SCB_DEMCR = (uint32_t *)0xE000EDFC;

        *SCB_DEMCR = *SCB_DEMCR | 0x01000000;
        *DWT_CONTROL = *DWT_CONTROL | 1;	// enable the counter

	minCycles = 0xffff;
        while (1) {
            idleCounter++;

	    if (runCount != lastRunCount && !(runCount % (RUN_FREQ / 1000))) {
		if (commandMode == CLI_MODE)
		    cliCheck();
		else
		    binaryCheck();
		lastRunCount = runCount;
	    }

            thisCycles = *DWT_CYCCNT;
	    cycles = thisCycles - lastCycles;
	    lastCycles = thisCycles;

            // record shortest number of instructions for loop
	    totalCycles += cycles;
            if (cycles < minCycles)
                minCycles = cycles;
        }
    }
}
Exemplo n.º 20
0
int main()
{
	timeInit();
	ledInit();
	traceInit();

	// Enable global interrupts.
	// Needed for RST and ATN interrupt handlers.
	CyGlobalIntEnable;

	// Set interrupt handlers.
	scsiPhyInit();

	configInit(&scsiDev.boardCfg);
	debugInit();

	scsiInit();
	scsiDiskInit();

	// Optional bootup delay
	int delaySeconds = 0;
	while (delaySeconds < scsiDev.boardCfg.startupDelay) {
		// Keep the USB connection working, otherwise it's very hard to revert
		// silly extra-long startup delay settings.
		int i;
		for (i = 0; i < 200; i++) {
			CyDelay(5);
			scsiDev.watchdogTick++;
			configPoll();
		}
		++delaySeconds;
	}

	uint32_t lastSDPoll = getTime_ms();
	sdCheckPresent();

	while (1)
	{
		scsiDev.watchdogTick++;

		scsiPoll();
		scsiDiskPoll();
		configPoll();
		sdPoll();

		if (unlikely(scsiDev.phase == BUS_FREE))
		{
			if (unlikely(elapsedTime_ms(lastSDPoll) > 200))
			{
				lastSDPoll = getTime_ms();
				sdCheckPresent();
			}
			else
			{
				// Wait for our 1ms timer to save some power.
				// There's an interrupt on the SEL signal to ensure we respond
				// quickly to any SCSI commands. The selection abort time is
				// only 250us, and new SCSI-3 controllers time-out very
				// not long after that, so we need to ensure we wake up quickly.
				uint8_t interruptState = CyEnterCriticalSection();
				if (!SCSI_ReadFilt(SCSI_Filt_SEL))
				{
					__WFI(); // Will wake on interrupt, regardless of mask
				}
				CyExitCriticalSection(interruptState);
			}
		}
		else if (scsiDev.phase >= 0)
		{
			// don't waste time scanning SD cards while we're doing disk IO
			lastSDPoll = getTime_ms();
		}
	}
	return 0;
}