Exemplo n.º 1
0
void CodecCommander::onTimerAction()
{
    // if infinite checks are enabled - essentially are for monitoring fugue state, sleep is fine with finite check
    if (checkInfinite) {
        // check if hda codec is powered
        parseCodecPowerState();
        // if no power after semi-sleep (fugue) state and power was restored - set EAPD bit
        if (eapdPoweredDown && (hdaCurrentPowerState == 0x1 || hdaCurrentPowerState == 0x2)) {
            DEBUG_LOG("CodecCommander: cc: --> hda codec power restored\n");
            setOutputs();
            // if popping requested - generate stream at fugue-wake
            if (!coldBoot && generatePop){
                createAudioStream();
            }
            // simulate headphone jack replug
            simulateHedphoneJack(); // <------ makes sure this is needed?
        }
    }
    
    // check if audio stream is up on given output
    parseAudioEngineState();
    // get EAPD bit status from command response if audio stream went up
    if (hdaEngineState == 0x1) {
        getOutputs();
         // if engine output stream has started, but EAPD isn't up
        if(response == 0x0) {
            // set EAPD bit
            setOutputs();
        }
    }

    fTimer->setTimeoutMS(updateInterval);
}
Exemplo n.º 2
0
void MonitoringDevice::commandGetEvent(unsigned char* _pArea){
	const unsigned int EVENT_ID_OFFSET = 5;
	const unsigned int EVENT_FAULT_OFFSET = 7;
	const unsigned int EVENT_COUNT_OFFSET = 8;

	setFault(_pArea[EVENT_FAULT_OFFSET]);

	unsigned short _eventId = _pArea[EVENT_ID_OFFSET] + _pArea[EVENT_ID_OFFSET + 1] * 256;
	if (_eventId != eventId){
		if (_pArea[EVENT_COUNT_OFFSET] != 0){
			if (!SerialDebug::getSingleton().isOn())
				redirectToPc(_pArea);

			unsigned int messageCount = firstMessage(&_pArea);
			for (unsigned int i = 0; i < messageCount; ++i){
				if (isEventMessage(_pArea)){
					toLog(_pArea);
					setOutputs(_pArea);
				}

				nextMessage(&_pArea);
			}
		}
	}

	eventId = _eventId;
}
Exemplo n.º 3
0
void StereoSample::init() {
	targetPan = pan = 0.5;
	targetVolume = volume = 1.0;
    fadePos = -1;
    setOutputs(0, 1);
	busRef = 0;
}
Exemplo n.º 4
0
void SSAOComputeTOP::setInputs( Texture *normal_depth )
{
	// if we dont have an output by now we create one ourselfs
	if( !out0 )
		setOutputs( normal_depth->copy() );

	// adobt the size of the input
	TOP::setSize( normal_depth->m_xres, normal_depth->m_yres );

	// set input with the shader
	ssaoComputeShader->setUniform( "normal", normal_depth->getUniform() );
}
Exemplo n.º 5
0
void SSAOBlurTOP::setInputs( Texture *ao )
{
	// if we dont have an output by now we create one ourselfs
	if( !out0 )
		setOutputs( ao->copy() );

	// adobt the size of the input
	TOP::setSize( ao->m_xres, ao->m_yres );

	// set input with the shader
	ssaoBlurShader->setUniform( "input", ao->getUniform() );
}
Exemplo n.º 6
0
void RenderTOP::setInputs( int xres, int yres )
{
	// if we dont have an output by now we create one ourselfs
	if( !out0 )
		setOutputs( Texture::createRGBA8(xres, yres) );

	// adobt the size of the input
	TOP::setSize( xres, yres );

	// set rendercallback
	//renderCallback = _renderCallback;
}
Exemplo n.º 7
0
IOReturn CodecCommander::setPowerState(unsigned long powerStateOrdinal, IOService *policyMaker)
{

    if (kPowerStateSleep == powerStateOrdinal) {
        DEBUG_LOG("CodecCommander: cc: --> asleep\n");
        eapdPoweredDown = true;
        // though this probably has been determined after parsing codec power state, we set this as false again
        coldBoot = false;
	}
	else if (kPowerStateNormal == powerStateOrdinal) {
        DEBUG_LOG("CodecCommander: cc: --> awake\n");
        updateCount = 0;
// This operation has to be performed right at wake or codec will enter power mode 0 immediately!
// *****
        // set EAPD bit at wake or cold boot
        if (eapdPoweredDown) {
            DEBUG_LOG("CodecCommander: cc: --> hda codec power restored\n");
            // delay setting by 100ms, otherwise immediate command won't be received
            IOSleep(100);
            setOutputs();
        }
        // only when this is done we can stars a check workloop!
// *****
        
        // if infinite checking requested
        if (checkInfinite){
            // if checking infinitely then make sure to delay workloop
            if (coldBoot) {
                fTimer->setTimeoutMS(20000); // create a nasty 20sec delay for AudioEngineOutput to initialize
            }
            // if we are waking it will be already initialized
            else {
                fTimer->setTimeoutMS(100); // so fire timer for workLoop almost immediately
            }
            DEBUG_LOG("CodecCommander: cc: --> workloop started\n");
        }
        
        // generate audio stream at wake if requested
        if (!coldBoot && generatePop){
            // apply delay or it will not trigger a system event
            IOSleep(streamDelay);
            createAudioStream();
        }
        
        // simulate headphone jack replug
        simulateHedphoneJack();
    }
    
    return IOPMAckImplied;
}
Exemplo n.º 8
0
	void beginOperation() {
		switch(this->jobStatus) {
		case 100:
			setOutputs();
		break;

		case 1:
			enableLED();
		break;

		case 2:
			disableLED();
		break;
		}
	}
Exemplo n.º 9
0
std::shared_ptr<BuildItem>
CodeFilter::transform( TransformSet &xform ) const
{
	std::shared_ptr<BuildItem> ret = xform.getTransform( this );
	if ( ret )
		return ret;

	DEBUG( "transform CodeFilter " << getName() );
	ret = std::make_shared<BuildItem>( getName(), getDir() );
	ret->setUseName( false );

	VariableSet buildvars;
	extractVariables( buildvars );
	ret->setVariables( std::move( buildvars ) );

	if ( myTool )
	{
		ItemPtr genExe = myTool->getGeneratedExecutable();
		if ( genExe )
		{
			std::shared_ptr<BuildItem> exeDep = genExe->transform( xform );
			ret->addDependency( DependencyType::IMPLICIT, exeDep );
		}

		for ( const ItemPtr &i: myItems )
		{
			// huh, we can't call transform on these because then
			// cpp files we're going to filter will be transformed to
			// .o files.
			auto inp = std::make_shared<BuildItem>( i->getName(), i->getDir() );
			inp->setUseName( false );
			inp->setOutputDir( getDir() );
			inp->setOutputs( { i->getName() } );
			ret->addDependency( DependencyType::EXPLICIT, inp );
		}
		
		ret->setTool( myTool );
		auto outd = getDir()->reroot( xform.getArtifactDir() );
		ret->setOutputDir( outd );
		ret->setVariable( "current_output_dir", outd->fullpath() );
		ret->setOutputs( myOutputs );
	}

	xform.recordTransform( this, ret );

	return ret;
}
Exemplo n.º 10
0
//Process logic, calls init and then loops through in->work->out
void Process::process() 
{
  init();
  
  while (m_run)
  {
    if (getInputs())
    {
      work();
      setOutputs();
    }
    else
    {
      //Don't spin
      usleep(100);
    }
  }
}
Exemplo n.º 11
0
void Outputs::updateOutputs(void)
{
    unsigned int mask = 0x01;
    unsigned int i;
    unsigned int state     = _relayState ^ _inverted;
    unsigned int prevState = _prevRelayState ^  _inverted;
    unsigned int toggle    = pendingChanges();

#ifndef ZERO_DETECT
    if ((state ^ prevState) & state)
    {   // at least one outputs needs to be switched ON -> disable
        // the PWM
        timer16_0.match(MAT2, PWM_PERIOD);// disable the PWM
        _pwm_timeout.start(PWM_TIMEOUT);
    }
#endif
    for(i = 0; i < NO_OF_CHANNELS; i++, mask <<= 1)
    {
    	unsigned int value = state & mask;
    	if (mask & toggle)
    	{
    		unsigned int pinMask = digitalPinToBitMask(outputPins[i]);
			if (digitalPinToPort(outputPins[i]) != 0)
			{
				if (value) _port_2_set |= pinMask;
				else       _port_2_clr |= pinMask;
			}
			else
			{
				if (value) _port_0_set |= pinMask;
				else       _port_0_clr |= pinMask;
			}
    	}
    }
    _prevRelayState = _relayState;
#ifdef ZERO_DETECT
    _state = 1;
#else
    setOutputs();
    clrOutputs();
#endif
}
Exemplo n.º 12
0
void Blur1DTOP::setInputs( Texture *tex )
{
	// if we dont have an output by now we create one ourselfs
	if( !out0 )
		setOutputs( tex->copy() );

	// adobt the size of the input
	TOP::setSize( tex->m_xres, tex->m_yres );

	// set pixelstep value in the shader which is used to work on pixels
	float tmp;

	if( m_direction == Horizontal )
		tmp = 1.0f/ tex->m_xres;  // use x or y depending on direction of blur
	else
		tmp = 1.0f/ tex->m_yres;  // use x or y depending on direction of blur

	pixelStep->setElement( 0, &tmp );


	// set input with the shader
	shader->setUniform( "input", tex->getUniform() );
}
Exemplo n.º 13
0
main (int argc, char *argv[])
{
    int done;
    char buffer[256];
    char msge[10];
    char *bptr, *tmpptr;
    char Current_InjectValve_Loc;
    int  CurrentXYmm[2],CurrentZmm,Current_AirValve_Loc,CurrentVol;
    int xAxis,yAxis;
    int i,maxflow;
    int sampZtop,sampZbottom;
    /* int xyzMinMax[6]; */
    double flowrate, zspeed,ztravel;
    int buflen = 1;

    if (argc < 2)
    {
        fprintf(stdout, "usage:  %s <devicename> (i.e. /dev/term/b)\n",
                argv[0]);
        exit(1);
    }

    if (argc > 2)
    {
        verbose = 0;
    }

    /* initialize environment parameter vnmrsystem value */
    tmpptr = getenv("vnmrsystem");      /* vnmrsystem */
    if (tmpptr != (char *) 0) {
        strcpy(systemdir,tmpptr);       /* copy value into global */
    }
    else {   
        strcpy(systemdir,"/vnmr");      /* use /vnmr as default value */
    }

    if (verbose)
        fprintf(stdout,
                "Init Default Injector 'm215_inj.grk' at 558.2, 3.8\n");

    strcpy(path,systemdir);
    strcat(path,"/asm/racks/m215_inj.grk");
    inject = rackCreate(path);
    if (inject == NULL)
    {
        fprintf(stderr,
                "\nSystem failed to init '%s'\n", path);
        fprintf(stderr,"\ngilalign Aborted.\n");
        exit(1);
    }

    rackCenter(inject, 5582 ,38);  /* 558.2, 3.8,  84.2 Gilson position */
    if (verbose)
        rackShow(inject, 1);

    if (verbose)
        fprintf(stdout,"Init Default Rack 'code_205.grk' at 54.6, 187.2\n");

    strcpy(path,systemdir);
    strcat(path,"/asm/racks/code_205.grk");
    rack = rackCreate(path);
    if (rack == NULL)
    {
        fprintf(stderr,"\nSystem failed to init '%s'\n", path);
        fprintf(stderr,"\ngilalign Aborted.\n");
        exit(1);
    }
    rackCenter(rack, 546,1872);
    if (verbose)
        rackShow(rack, 1);

    if (verbose)
        fprintf(stdout,"Init Device: %s\n",argv[1]);

    /*
     * Convert old style comm description to new style:
     *   Old Style: /dev/term/a
     *   New Style: GIL_TTYA
     */
    if ( (!strcmp(argv[1], "/dev/term/a")) ||
         (!strcmp(argv[1], "/dev/ttya")) )
        pGilObjId = gilsonCreate("GIL_TTYA", 22, 29, 3);

    else if ( (!strcmp(argv[1], "/dev/term/b")) ||
              (!strcmp(argv[1], "/dev/ttyb")) )
        pGilObjId = gilsonCreate("GIL_TTYB", 22, 29, 3);

    else if (!strcmp(argv[1], "/dev/ttyS0"))
        pGilObjId = gilsonCreate("GIL_COM1", 22, 29, 3);

    else
        pGilObjId = gilsonCreate(argv[1], 22, 29, 3);

    if (pGilObjId == NULL)
    {
        fprintf(stderr,"\nFailure to initialize Gilson '%s'\n", argv[1]);
        fprintf(stderr,"\nCheck that the i/o cable is properly attached.\n");
        fprintf(stderr,"\ngilalign Aborted.\n");
        exit(1);
    }


    /* Initialize Rinse Station Location */
    RinseStation[0] = pGilObjId->RinseStation[0];
    RinseStation[1] = pGilObjId->RinseStation[1];
    RinseStationZ = pGilObjId->RinseStation[2];

    xAxis = rackGetX(inject, ZONE1,1);
    yAxis = rackGetY(inject, ZONE1,1);
    sampZtop = rackSampTop(inject,ZONE1,1);
    sampZbottom = rackSampBottom(inject,ZONE1,1);
    /* gilInitInjLoc(pGilObjId,xAxis, yAxis, bottom); */
    gilInitInjLoc(pGilObjId,xAxis, yAxis, InjectorBot);

    MaxFlow = gilsonMaxFlowRate(pGilObjId);  /* ml/min */
    MaxVolume = gilsonMaxVolume(pGilObjId); /* ul */
    gilGetContacts(pGilObjId, 2, &Current_AirValve_Loc);
    gilGetInjectValveLoc(pGilObjId,&Current_InjectValve_Loc);
    gilGetXY(pGilObjId,CurrentXYmm);
    gilGetZ(pGilObjId,&CurrentZmm);
    CurrentVol = gilsonCurrentVolume(pGilObjId);

    if (verbose)
        PrintSet();

    done = 1;
    fprintf(stdout,"\n\n");

    gilXYZMinMax(pGilObjId,xyzMinMax);

    /**********/
    fprintf(stdout,"%d %d %d %d %d %d %d %lf %d %c %d %d %d %d\n",
            xyzMinMax[0],xyzMinMax[1],
            xyzMinMax[2],xyzMinMax[3],
            xyzMinMax[4],xyzMinMax[5],
            MaxVolume,MaxFlow,
            Current_AirValve_Loc,Current_InjectValve_Loc,
            CurrentXYmm[0],CurrentXYmm[1],
            CurrentZmm,CurrentVol);
    fflush(stdout);

    while (done)
    {
        if (verbose)
        {
            fprintf(stdout,"T)ray Alignment, R)inse Station Alignment, "
                           "I)njector Alignment,  \n");
            fprintf(stdout,"N)ew Syringe, C) Set Injector/Rack Centers, "
                           "L)ist Present Settings \n");
            fprintf(stdout,"K - Reset&Home Gilson, V)alve, "
                           "inJ)ector Valve,  \n");
            fprintf(stdout,"D)efine Rack, A)rm Hight, P)rime pump, "
                           "S)ave Parameters, Q)uit,  \n");
            fprintf(stdout,"F)req Liq Detect X)GoToHome "
                           "Z)Test Rack Definition  \n");
            fprintf(stdout,"O)utputs - sets Gilson contact states, "
                           "E)xternal Inputs, Y) Transparent Mode \n");
            fprintf(stdout,"\nCmds:  ");
        }
        else if (buflen)
        {
            fprintf(stdout,"Cmds:\n");
        }

        /**********/

        fflush(stdout);
        bptr = gets(buffer);
        buflen = strlen(buffer);
        if (bptr == NULL)
            break;
        switch( toupper(buffer[0]) )
        {
            case 'D':
                DefineRack();
                break;

            case 'R':
                RinseAlignment();
                break;

            case 'I':
                InjectAlignment();
                break;

            case 'T':
                TrayAlignment();
                break;

            case 'N':
                PumpReplace();
                break;

            case 'C':                /* set rack centers */
                setCenters();
                break;

            case 'L':
                PrintSet();
                break;

            case 'O':
                setOutputs();
                break;

            case 'E':
                getInputs();
                break;

            case 'P':
                PrimePump();
                break;

            case 'V':
                setValve();
                break;

            case 'J':
                setInjector();
                break;

            case 'K':
                gilsonReset(pGilObjId);
                gilsonHome(pGilObjId);
                break;

/*
 *          case 'B':
 *              saveAlignments();
 *              break;
 */

            case 'A':
                setArmHeight();
                break;

            case 'Q':
                done = 0;
                gilsonDelete(pGilObjId);
                return;
                break;

            case 'S':       /* Store alignment parameters */
                SaveParameter();
                break;

            case 'X':       /* Move to Home Position */
                gotoHome();
                break;

            case 'F':
                chkLQZ();
                break;

            case 'Y':
                GilsonTransparentMode();
                break;

            case 'Z':
                chkRack();
                break;

        }
    }
}