Esempio n. 1
0
unsigned long OzMilliAlarm(unsigned long msec)
{
    if (currentTask->timer) {
        destroyTimer(currentTask->timer);
    }
    currentTask->timer = createTimer(msec, alarmCallback, currentTask);
    startTimer(currentTask->timer);
    return 0;
}
Esempio n. 2
0
void destroyGame() {

   destroyTimer();
   destroyData();

   inGame = 0;

   pthread_mutex_destroy(&resourceMutex);
   return;
}
Esempio n. 3
0
void tearDown() {
    Pin p = Invalid(Pin);
    if (IsValid(t)) p = getTimerOutputPin(t);
    t = destroyTimer(t);
    TEST_ASSERT_TRUE_MESSAGE(!IsValid(t), "Timer still valid after destroy.");
    if (IsValid(p)) {
        TEST_ASSERT_EQUAL_MESSAGE(PinNoOccupation, pinOccupation(p), "Pin still occupied after pwm-timer destroyed.");
    }
    destroy_fake_port();
}
Esempio n. 4
0
unsigned long OzMilliSleep(unsigned long msec)
{
    struct WaitQueue *wq;
    if (currentTask->timer) {
        destroyTimer(currentTask->timer);
    }
    wq = wqCreate();
    currentTask->timer = createTimer(msec, &sleepCallback, wq);
    startTimer(currentTask->timer);
    sleepOn(wq);
    return 0;
}
Esempio n. 5
0
static rtems_timer_service_routine 
timerService(rtems_id id, void* arg) {
	static int n;
	static uint64_t then;
	uint64_t now;
	TscTestData *argp = (TscTestData *)arg;
	
	rdtscll(now);
	argp->buf[n++] = (uint32_t)(now-then);
	then = now;
	if(n < argp->bufsize) {
		rtems_timer_reset(id);
	}
	else {
		rtems_event_send(argp->taskID, RTEMS_EVENT_13);
		destroyTimer(id);
	}
}
void	SimpleAudioDriver::stop(IOService* inProvider)
{
	//	tear things down
	freeBuffers();
	destroyTimer();
	if(mCommandGate != NULL)
	{
		if(mWorkLoop != NULL)
		{
			mWorkLoop->removeEventSource(mCommandGate);
			mCommandGate->release();
			mCommandGate = NULL;
		}
	}
	if(mWorkLoop != NULL)
	{
		mWorkLoop->release();
		mWorkLoop = NULL;
	}
    IOService::stop(inProvider);
}
static void  onTimerFire(timerElement timer, void* closure)
{
    ASSERT_EQ (0, destroyTimer(closure,timer)) <<"Could not destroy timer!";
}
Esempio n. 8
0
void Vigasoco::end()
{
	// notify the driver that the audioPlugin is going to be disposed
	if (_driver && _audioPlugin){
		if (_audioPlugin->isInitialized()){
			_driver->audioFinalizing(_audioPlugin);
		}
	}

	// ends the audio plugin
	if (_audioPlugin){
		_audioPlugin->end();
	}

	// calls template method to stop and deallocate the audio plugin
	destroyAudioPlugin();

	// stops and deallocates the async thread
	if (_asyncThread){
		destroyAsyncThread();
	}

	// stops and deallocates the timing handler
	if (_timingHandler){
		_timingHandler->end();
		delete _timingHandler;
		_timingHandler = 0;
	}

	// calls template method to dispose the high resolution timer
	destroyTimer();

	// stops and deallocates the input handler
	if (_inputHandler){
		_inputHandler->end();

		// calls template method to remove input plugins
		removeCustomInputPlugins();

		delete _inputHandler;
		_inputHandler = 0;
	}

	// notify the driver that the drawPlugin is going to be disposed
	if (_driver && _drawPlugin){
		if (_drawPlugin->isInitialized()){
			_driver->videoFinalizing(_drawPlugin);
		}
	}

	// ends the draw plugin
	if (_drawPlugin){
		_drawPlugin->end();
	}

	// calls template method to stop and deallocate the draw plugin
	destroyDrawPlugin();

	// ends and deallocates the game driver
	if (_driver){
		_driver->end();
		delete _driver;
		_driver = 0;
	}

	// finish the palette
	if (_palette){
		_palette->end();
	}

	// calls template method to destroy the palette
	destroyPalette();

	// calls template method to perform platform specific finalization
	platformSpecificEnd();

	// disposes the fonts used by the core
	delete _fontManager;
}
Esempio n. 9
0
Watchdog::~Watchdog()
{
    ASSERT(!isArmed());
    stopCountdown();
    destroyTimer();
}
bool	SimpleAudioDriver::start(IOService* inProvider)
{
	//	start the superclass
    bool theAnswer = IOService::start(inProvider);
    if(theAnswer)
	{
		//	create the work loop
		mWorkLoop = IOWorkLoop::workLoop();
		FailIfNULL(mWorkLoop, theAnswer = kIOReturnNoResources, Failure, "SimpleAudioDriver::start: couldn't allocate the work loop");
		
		//	create the command gate
		mCommandGate = IOCommandGate::commandGate(this);
		FailIfNULL(mWorkLoop, theAnswer = kIOReturnNoResources, Failure, "SimpleAudioDriver::start: couldn't allocate the command gate");
		
		//	attach it to the work loop
		mWorkLoop->addEventSource(mCommandGate);
		
		//	initialize the stuff tracked by the IORegistry
		mSampleRate = 44100;
		setProperty(kSimpleAudioDriver_RegistryKey_SampleRate, mSampleRate, sizeof(mSampleRate) * 8);
		
		mIOBufferFrameSize = 16384;
		setProperty(kSimpleAudioDriver_RegistryKey_RingBufferFrameSize, mIOBufferFrameSize, sizeof(mIOBufferFrameSize) * 8);
		
		char theDeviceUID[128];
		snprintf(theDeviceUID, 128, "SimpleAudioDevice-%d", static_cast<int>(random() % 100000));
		setProperty(kSimpleAudioDriver_RegistryKey_DeviceUID, theDeviceUID);

		//	allocate the IO buffers
		IOReturn theError = allocateBuffers();
		FailIfError(theError, theAnswer = false, Failure, "SimpleAudioDriver::start: allocating the buffers failed");
		
		//	initialize the timer that stands in for a real interrupt
		theError = initTimer();
		FailIfError(theError, freeBuffers(); theAnswer = false, Failure, "SimpleAudioDriver::start: initializing the timer failed");
		
		//	initialize the controls
		theError = initControls();
		FailIfError(theError, theAnswer = false, Failure, "SimpleAudioDriver::start: initializing the controls failed");
		
		//	publish ourselves
		registerService();
	}

    return theAnswer;

Failure:
	if(mCommandGate != NULL)
	{
		if(mWorkLoop != NULL)
		{
			mWorkLoop->removeEventSource(mCommandGate);
			mCommandGate->release();
			mCommandGate = NULL;
		}
	}
	
	if(mWorkLoop != NULL)
	{
		mWorkLoop->release();
		mWorkLoop = NULL;
	}
	
	freeBuffers();
	destroyTimer();
	
	return theAnswer;
}