bool XC2C64A::verify_eeprom(const verify_blocks_t& blocks) {
	tap.set_repeat(0);
	tap.set_end_ir(state_t::run_test_idle);
	tap.set_end_dr(state_t::run_test_idle);

	reset();
	bypass();
	enable();

	shift_ir(instruction_t::ISC_READ);

	const jtag::tap::bits_t empty_row { block_length };

	auto error = false;
	for(const auto& block : blocks) {
		tap.set_end_dr(state_t::pause_dr);
		tap.shift_dr({ &block.id, block_id_length });
		tap.set_end_ir(state_t::run_test_idle);
		tap.wait(state_t::pause_dr, state_t::pause_dr, 20);
		tap.set_end_ir(state_t::run_test_idle);
		tap.wait(state_t::run_test_idle, state_t::run_test_idle, 100);
		error |= tap.shift_dr(empty_row, { block.data.data(), block_length }, { block.mask.data(), block_length });
		tap.wait(state_t::run_test_idle, state_t::run_test_idle, 100);
	}

	disable();
	bypass();

	tap.state(state_t::test_logic_reset);

	return !error;
}
Exemple #2
0
int
Module::handle ( int m )
{
    switch ( m )
    {
        case FL_KEYBOARD:
        {
            if ( Fl_Group::handle( m ) )
                return 1;

            if ( Fl::event_key() == FL_Menu )
            {
                menu_popup( &menu(), x(), y() );
                return 1;
            }
            else
                return menu().test_shortcut() != 0;
        }
        case FL_PUSH:
        {
            take_focus();

            if ( Fl_Group::handle( m ) )
                return 1;
            else if ( test_press( FL_BUTTON3 ) )
            {
                menu_popup( &menu() );
                return 1;
            }
            else if ( test_press( FL_BUTTON1 ) )
            {
                command_open_parameter_editor();
                return 1;
            }
            else if ( test_press( FL_BUTTON3 | FL_CTRL ) )
            {
                command_remove();
                return 1;
            }
            else if ( test_press( FL_BUTTON2 ) )
            {
                bypass( !bypass() );
                redraw();
                return 1;
            }

            return 0;
        }
        case FL_FOCUS:
        case FL_UNFOCUS:
            redraw();
            return 1;
    }

    return Fl_Group::handle( m );
}
Exemple #3
0
Fichier : Module.C Projet : 0mk/non
void
Module::menu_cb ( const Fl_Menu_ *m )
{
    char picked[256];

    if ( ! m->mvalue() || m->mvalue()->flags & FL_SUBMENU_POINTER || m->mvalue()->flags & FL_SUBMENU )
        return;

    strncpy( picked, m->mvalue()->label(), sizeof( picked ) );

//    m->item_pathname( picked, sizeof( picked ) );

    DMESSAGE( "%s", picked );

    Logger log( this );

    if ( ! strcmp( picked, "Edit Parameters" ) )
        command_open_parameter_editor();
    else if ( ! strcmp( picked, "Bypass" ) )
    {
        if ( ! bypassable() )
        {
            fl_alert( "Due to its channel configuration, this module cannot be bypassed." );
        }
        else
        {
            bypass( !bypass() );
            redraw();
        }
    }
    else if ( ! strcmp( picked, "Cut" ) )
    {
        if ( copy() )
        {
            chain()->remove( this );
            Fl::delete_widget( this );
        }
    }
    else if ( ! strcmp( picked, "Copy" ) )
    {
        copy();
    }
    else if ( ! strcmp( picked, "Paste" ) )
    {
        paste_before();
    }
    else if ( ! strcmp( picked, "Show Analysis" ) )
    {
        show_analysis_window();
    }
    else if ( ! strcmp( picked, "Remove" ) )
        command_remove();
}
// chop the GBYPASS or GIBYPASS variable out of a bypass URL
// This function ASSUMES that you really know what you are doing
// Do NOT run this function unless you know that the URL contains a valid bypass code
// Ernest W Lessenger
void HTTPHeader::chopBypass(String url, bool infectionbypass)
{
	if (url.contains(infectionbypass ? "GIBYPASS="******"GBYPASS="******"?GIBYPASS="******"?GBYPASS="******"?GIBYPASS="******"?GBYPASS="******"?GIBYPASS="******"?GBYPASS="******"&GIBYPASS="******"&GBYPASS="******"&GIBYPASS="******"&GBYPASS="******"";
}
// same for scan bypass
void HTTPHeader::chopScanBypass(String url)
{
	if (url.contains("GSBYPASS="******"?GSBYPASS="******"?GSBYPASS="******"?GSBYPASS="******"&GSBYPASS="******"&GSBYPASS="******"";
}
Exemple #6
0
void readCoherentGraph(Graph * inGraph, boolean(*isUnique) (Node * node),
		       double coverage, ReadSet * reads)
{
	IDnum nodeIndex;
	Node *node;
	IDnum previousNodeCount = 0;

	graph = inGraph;
	listMemory = newRecycleBin(sizeof(PassageMarkerList), 100000);
	expected_coverage = coverage;
	sequences = reads->tSequences;

	velvetLog("Read coherency...\n");
	resetNodeStatus(graph);
	identifyUniqueNodes(isUnique);
	trimLongReadTips();

	previousNodeCount = 0;
	while (previousNodeCount != nodeCount(graph)) {

		previousNodeCount = nodeCount(graph);

		for (nodeIndex = 1; nodeIndex <= nodeCount(graph);
		     nodeIndex++) {

			node = getNodeInGraph(graph, nodeIndex);

			if (node == NULL || !getUniqueness(node))
				continue;

			while (uniqueNodesConnect(node))
				node = bypass();

			node = getTwinNode(node);

			while (uniqueNodesConnect(node))
				node = bypass();

		}

		renumberNodes(graph);
	}

	destroyRecycleBin(listMemory);
	destroyRecycleBin(nodeListMemory);

	velvetLog("Confronted to %li multiple hits and %li null over %li\n",
	       (long) multCounter, (long) nullCounter, (long) dbgCounter);

	velvetLog("Read coherency over!\n");
}
void OTBRescaleIntensityImageFilterProcessor::process() {

    //LINFO("Rescale Intensity Image Filter Enabled!");
    //check bypass switch
    if (!enableSwitch_.get()) {
        bypass(&inPort_, &outPort_);
        return;
    }

    try
    {
        filter->SetInput(inPort_.getData());
        filter->SetOutputMinimum(OutputMin_.get());
        filter->SetOutputMaximum(OutputMax_.get());
        filter->Update();
        outPort_.setData(filter->GetOutput());
        LINFO("Rescale Intensity Image Filter Connected!");
    }
    catch (int e)
    {
        LERROR("Error in Rescale Intensity Image Filter");
        return;
    }

}
void OTBGeodesicMorphologyLevelingFilterProcessor::process() {

    //check bypass switch
    if (!enableSwitch_.get()) {
        bypass(&inPort_, &outPort_);
        return;
    }
    LINFO("Geodesic Morphology Leveling Image Filter Enabled!");

    try
    {
        filter->SetInput(inPort_.getData());

        filter->SetInputConvexMap(convexMapPort_.getData());
        filter->SetInputConcaveMap(concaveMapPort_.getData());
        filter->Update();

        outPort_.setData(filter->GetOutput());

        LINFO("Geodesic Morphology Leveling Image Filter Connected!");
    }
    catch (int e)
    {
        LERROR("Error in Geodesic Morphology Leveling Image Filter!");
        return;
    }
}
void OTBBinaryDilateFilterProcessor::process() {

    //check bypass switch
    if (!enableSwitch_.get()){
        bypass(&inPort_, &outPort_);
        return;
    }
    
    //Property validation
    structuringElement.SetRadius(radius_.get());
    structuringElement.CreateStructuringElement();
    filter->SetKernel(structuringElement);
    filter->SetDilateValue(foreground_.get());
    
    try
    {
	byterescaler->SetOutputMinimum(0);
	byterescaler->SetOutputMaximum(255);
        byterescaler->SetInput(inPort_.getData());
	
	filter->SetInput(byterescaler->GetOutput());
	
	doublerescaler->SetOutputMinimum(0);
	doublerescaler->SetOutputMaximum(255);
	doublerescaler->SetInput(filter->GetOutput());
	
	outPort_.setData(doublerescaler->GetOutput());
    }
    catch (int e)
    {
	LERROR("Problem with Binary Dilation Image Filter!");
	return;
    }
    
}
Exemple #10
0
void Fade::process() {

    if (!enableSwitch_.get()){
        bypass(&inport_, &outport_);
        return;
    }

    outport_.activateTarget();

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    TextureUnit colorUnit, depthUnit;
    inport_.bindTextures(colorUnit.getEnum(), depthUnit.getEnum());

    // intialize shader
    program_->activate();
    setGlobalShaderParameters(program_);
    program_->setUniform("colorTex_", colorUnit.getUnitNumber());
    program_->setUniform("depthTex_", depthUnit.getUnitNumber());
    inport_.setTextureParameters(program_, "texParams_");
    program_->setUniform("fading_", 1-fading_.get());
    program_->setUniform("fadeColor_",color_.get());

    renderQuad();

    program_->deactivate();
    outport_.deactivateTarget();
    LGL_ERROR;
}
void OTBZeroCrossingBasedEdgeDetectionImageFilterProcessor::process() {

    //check bypass switch
    if (!enableSwitch_.get()) {
        bypass(&inPort_, &outPort_);
        return;
    }

    ZeroCrossingType::ArrayType var;
    ZeroCrossingType::ArrayType error;
    ImageType::PixelType bValue;
    ImageType::PixelType fValue;

    var.Fill(variance_.get());
    error.Fill(maxError_.get());
    bValue = backgroundValue_.get();
    fValue = foregroundValue_.get();

    try
    {
        filter->SetInput(inPort_.getData());
        filter->SetVariance(var);
        filter->SetMaximumError(error);
        filter->SetBackgroundValue(bValue);
        filter->SetForegroundValue(fValue);
        outPort_.setData(filter->GetOutput());
        LINFO("Zero Crossing Based Edge Detection Image Filter Connected!");
    }
    catch (int e)
    {
        LERROR("Error in Zero Crossing Based Edge Detection Image Filter");
        return;
    }

}
void OTBLocalStatisticExtractionApplication::process() {

    //check bypass switch
    if (!enableSwitch_.get()) {
        bypass(&inPort_, &outPort_);
        return;
    }

    try
    {
        extractorFilter->SetInput(inPort_.getData());
        extractorFilter->SetStartX(inPort_.getData()->GetLargestPossibleRegion().GetIndex(0));
        extractorFilter->SetStartY(inPort_.getData()->GetLargestPossibleRegion().GetIndex(1));
        extractorFilter->SetSizeX(inPort_.getData()->GetLargestPossibleRegion().GetSize(0));
        extractorFilter->SetSizeY(inPort_.getData()->GetLargestPossibleRegion().GetSize(1));
        extractorFilter->SetChannel(channel_.get());
        extractorFilter->UpdateOutputInformation();

        filter->SetInput(extractorFilter->GetOutput());
        filter->SetRadius(radius_.get());
        filter->UpdateOutputInformation();

        outPort_.setData(filter->GetOutput());

        LINFO("Local Statistic Extraction Application Connected");

    }
    catch (int e)
    {
        LERROR("Error in Local Statistic Extraction Application");
        return;
    }

}
void OTBLineRatioDetectorImageFilterProcessor::process() {
    //check bypass switch
    if (!enableSwitch_.get()){
        bypass(&inPort_, &outPort_);
        return;
    }

    try
    {
        //rescaler_Filter->SetOutputMinimum(itk::NumericTraits<OutputPixelType>::min());
        //rescaler_Filter->SetOutputMaximum(itk::NumericTraits<OutputPixelType>::max());

        filter->SetInput(inPort_.getData());

        //rescaler_Filter->SetInput(filter->GetOutput());

        //outPort_.setData(rescaler_Filter->GetOutput());
        outPort_.setData(filter->GetOutput());//outPort_.setData(rescaler_Filter->GetOutput());
        outPort_.setData(filter->GetOutput());

        filter->SetLengthLine(lengthLine_.get());
        filter->SetWidthLine(widthLine_.get());

        filter->Update();


    }
    catch (int e)
    {
        LERROR("Problem with LineRatioDetectorImage Filter!");
    return;
    }
}
Exemple #14
0
void ImageThreshold::process() {

    if (!enableSwitch_.get()){
        bypass(&inport_, &outport_);
        return;
    }

    outport_.activateTarget();
    outport_.clearTarget();

    TextureUnit colorUnit, depthUnit;
    inport_.bindTextures(colorUnit, depthUnit);

    // initialize shader
    program_->activate();
    setGlobalShaderParameters(program_);
    program_->setUniform("colorTex_", colorUnit.getUnitNumber());
    program_->setUniform("depthTex_", depthUnit.getUnitNumber());
    inport_.setTextureParameters(program_, "texParams_");
    program_->setUniform("lowerThreshold_", lowerThreshold_.get());
    program_->setUniform("upperThreshold_", upperThreshold_.get());
    program_->setUniform("lowerMaskColor_", lowerMaskColor_.get());
    program_->setUniform("upperMaskColor_", upperMaskColor_.get());

    renderQuad();

    program_->deactivate();
    outport_.deactivateTarget();
    TextureUnit::setZeroUnit();
    LGL_ERROR;
}
void OTBEstimateInnerProductPCAImageFilterProcessor::process() {

    //check bypass switch
    if (!enableSwitch_.get()) {
        bypass(&inPort_, &outPort_);
        return;
    }

    try
    {
        filter->SetInput(inPort_.getData());
        filter->Update();
        filter->SetNumberOfPrincipalComponentsRequired(numberOfPrincipalComponentsReq_.get());
        filter->SetCenterData(centerData_.get());
        outPort_.setData(filter->GetOutput());
        LINFO("Estimate Inner Product PCA Image Filter Connected!");

    }
    catch (int e)
    {
        LERROR("Error in Estimate Inner Product PCA Image Filter");
        return;
    }

}
void OTBMDMDNMFImageFilterProcessor::process() {

    //check bypass switch
    if (!enableSwitch_.get()) {
        bypass(&inPort_, &outPort_);
        return;
    }
    try
    {

        endMember2Matrix->SetInput(endmembersInPort_.getData());
        endMember2Matrix->Update();

        LINFO("Endmembers matrix: ");
        LINFO(endMember2Matrix->GetMatrix());

        filter->SetInput(inPort_.getData());
        filter->SetEndmembersMatrix(endMember2Matrix->GetMatrix());
        filter->Update();
        outPort_.setData(filter->GetOutput());

        LINFO("MDMDNMF Image Filter Connected!");

    }
    catch (int e)
    {
        LERROR("Error in MDMDNMF Image Filter");
        return;
    }

}
 stream_guard<Stream> const &
     operator<<(
         Stream & (*manip)(Stream &)
         ) const
 {
     bypass() << manip;
     return *this;
 }
Exemple #18
0
void
Module::set ( Log_Entry &e )
{
    for ( int i = 0; i < e.size(); ++i )
    {
        const char *s, *v;

        e.get( i, &s, &v );

        if ( ! strcmp( s, ":chain" ) )
        {
            /* This trickiness is because we may need to know the name of
               our chain before we actually get added to it. */
            int i;
            sscanf( v, "%X", &i );
            Chain *t = (Chain*)Loggable::find( i );

            assert( t );

            chain( t );
        }
    }

    for ( int i = 0; i < e.size(); ++i )
    {
        const char *s, *v;

        e.get( i, &s, &v );

/*         if ( ! strcmp( s, ":name" ) ) */
/*             label( v ); */
        if ( ! strcmp( s, ":parameter_values" ) )
        {
            set_parameters( v );
        }
        else if ( ! ( strcmp( s, ":is_default" ) ) )
        {
            is_default( atoi( v ) );
        }
        else if ( ! ( strcmp( s, ":active" ) ) )
        {
            bypass( ! atoi( v ) );
        }
        else if ( ! strcmp( s, ":chain" ) )
        {
            int i;
            sscanf( v, "%X", &i );
            Chain *t = (Chain*)Loggable::find( i );

            assert( t );

            t->add( this );
        }
    }
}
void OTBPerBandVectorImageFilterProcessor::process() {

    //check bypass switch
    if (!enableSwitch_.get()) {
        bypass(&inPort_, &outPort_);
        return;
    }
    try
    {
        if (selectFilter_.get()=="canny") {
            canny->SetVariance( variance_.get() );
            canny->SetUpperThreshold( upper_.get() );
            canny->SetLowerThreshold( lower_.get() );

            cannyPerBand->SetFilter(canny);
            cannyPerBand->SetInput(inPort_.getData());
            cannyPerBand->Update();
            outPort_.setData(cannyPerBand->GetOutput());
            LINFO("Canny Edge Detection Per Band Image Filter connected successfully!");

        } else if (selectFilter_.get()=="gradient") {
            gradient->SetNumberOfIterations(numberOfIterations_.get());
            gradient->SetTimeStep(timeStep_.get());
            gradient->SetConductanceParameter(conductance_.get());

            gradientAnisotropicPerBand->SetFilter(gradient);
            gradientAnisotropicPerBand->SetInput(inPort_.getData());
            gradientAnisotropicPerBand->Update();
            outPort_.setData(gradientAnisotropicPerBand->GetOutput());
            LINFO("Gradient Anisotropic Diffusion Per Band Image Filter connected successfully!");

        } else if(selectFilter_.get()=="mean") {
            //Property validation
            int rad = filterSize_.get();
            ImageType::SizeType indexRadius;
            indexRadius[0] = rad; // radius along x
            indexRadius[1] = rad; // radius along y

            mean->SetRadius(indexRadius);

            meanPerBand->SetFilter(mean);
            meanPerBand->SetInput(inPort_.getData());
            meanPerBand->Update();
            outPort_.setData(meanPerBand->GetOutput());
            LINFO("Mean Per Band Image Filter connected successfully!");
        }

    }
    catch (int e)
    {
        LERROR("Error in Per Band Vector Image Filter");
        return;
    }

}
Exemple #20
0
 static void filterHiddenInPlace(T &mmaps, bool showHidden) {
   typename T::iterator it = mmaps.begin();
   typename T::iterator ittmp;
   while (it != mmaps.end()) {
     if (bypass(it->second.name(), it->second.uid(), showHidden)) {
       ittmp = it;
       ++ittmp;
       mmaps.erase(it);
       it = ittmp;
     } else
       ++it;
   }
 }
Exemple #21
0
TLV320::TLV320(PinName sda, PinName scl, int addr, PinName tx_sda, PinName tx_ws, PinName clk, PinName rx_sda, PinName rx_ws)
                         : mAddr(addr), mI2c_(sda, scl), mI2s_(tx_sda, tx_ws, clk, rx_sda, rx_ws){
    mI2c_.frequency(150000);
    reset();                                //TLV resets
    power(0x07);                            //Power Up the TLV320, but not the MIC, ADC and LINE
    format(16, STEREO);                     //16Bit I2S protocol format, STEREO
    frequency(44100);                       //Default sample frequency is 44.1kHz
    bypass(false);                          //Do not bypass device
    mute(false);                            //Not muted
    activateDigitalInterface_();            //The digital part of the chip is active
    outputVolume(0.7, 0.7);                 //Headphone volume to the default state
    rxBuffer = &mI2s_.rxBuffer[0];
} 
Exemple #22
0
void processBufferStereoToStereo(t_sword * inbuf, t_sword * outbuf, t_uint16 size) {
	mStereoEnhancerData.DataIn[0] = inbuf;
	mStereoEnhancerData.DataIn[1] = inbuf + 1;
	mStereoEnhancerData.InSamples = size >> 1;

	mStereoEnhancerData.DataOut[0] = outbuf;
	mStereoEnhancerData.DataOut[1] = outbuf + 1;

	if (mStereoEnhancerData.Enable) {
		stereo_enhancement(&mStereoEnhancerData);
	}
	else {
		bypass(&mStereoEnhancerData);
	}
}
Exemple #23
0
void
Module::get ( Log_Entry &e ) const
{
//    e.add( ":name",            label()           );
//    e.add( ":color",           (unsigned long)color());
    {
        char *s = get_parameters();
        if ( strlen( s ) )
            e.add( ":parameter_values", s );
        delete[] s;
    }
    e.add( ":is_default", is_default() );
    e.add( ":chain", chain() );
    e.add( ":active", ! bypass() );
}
void XC2C64A::init_from_eeprom() {
	tap.set_repeat(0);
	tap.set_end_ir(state_t::run_test_idle);
	tap.set_end_dr(state_t::run_test_idle);

	reset();
	enable();

	discharge();
	init();
	
	disable();
	bypass();

	tap.state(state_t::test_logic_reset);
}
Exemple #25
0
void
Module::draw_label ( void )
{
    int tw, th, tx, ty;

    bbox( tx, ty, tw, th );

    const char *lp = label();

    int l = strlen( label() );

    Fl_Color c = FL_FOREGROUND_COLOR;

    if ( bypass() || ! active() )
        c = FL_BLACK;

    fl_color( fl_contrast( c, is_default() ? FL_BLACK : color() ) );

    char *s = NULL;

    if ( l > 10 )
    {
        s = new char[l];
        char *sp = s;

        for ( ; *lp; ++lp )
            switch ( *lp )
            {
                case 'i': case 'e': case 'o': case 'u': case 'a':
                    break;
                default:
                    *(sp++) = *lp;
            }
        *sp = '\0';

    }

    if ( l > 20 )
        fl_font( FL_HELVETICA, 10 );
    else
        fl_font( FL_HELVETICA, 14 );

    fl_draw( s ? s : lp, tx, ty, tw, th, (Fl_Align)(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_CLIP ) );

    if ( s )
        delete[] s;
}
Exemple #26
0
void ColorDepth::process() {
    if (!enableSwitch_.get()) {
        bypass(&inport_, &outport_);
        return;
    }

    if (!chromaDepthTex_) {
        LERROR("No chroma depth texture");
        return;
    }

    //compute Depth Range
    tgt::vec2 depthRange = computeDepthRange(&inport_);

    outport_.activateTarget();
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    TextureUnit colorUnit, depthUnit;
    inport_.bindTextures(colorUnit.getEnum(), depthUnit.getEnum());

    // bind chroma depth texture
    TextureUnit chromaDepthUnit;
    chromaDepthUnit.activate();
    //chromaDepthTex_ is 0 here
    chromaDepthTex_->bind();
    LGL_ERROR;

    // initialize shader
    program_->activate();
    setGlobalShaderParameters(program_);
    program_->setUniform("colorTex_", colorUnit.getUnitNumber());
    program_->setUniform("depthTex_", depthUnit.getUnitNumber());
    inport_.setTextureParameters(program_, "texParams_");
    program_->setUniform("chromadepthTex_", chromaDepthUnit.getUnitNumber());
    program_->setUniform("minDepth_", depthRange.x);
    program_->setUniform("maxDepth_", depthRange.y);
    program_->setUniform("colorMode_", colorMode_.getValue());
    program_->setUniform("colorDepthFactor_", factor_.get());

    renderQuad();

    program_->deactivate();
    TextureUnit::setZeroUnit();
    outport_.deactivateTarget();
    LGL_ERROR;
}
Exemple #27
0
void
Module::draw_box ( void )
{
    fl_color( fl_contrast( FL_FOREGROUND_COLOR, color() ) );

    int tw, th, tx, ty;

    tw = w();
    th = h();
    ty = y();
    tx = x();

    fl_push_clip( tx, ty, tw, th );

    Fl_Color c = is_default() ? FL_BLACK : color();

    c = active() && ! bypass() ? c : fl_inactive( c );

    int spacing = w() / instances();
    for ( int i = instances(); i--; )
    {
        fl_draw_box( box(), tx + (spacing * i), ty, tw / instances(), th, Fl::belowmouse() == this ? fl_lighter( c ) : c );
    }

    if ( this == Fl::focus() )
    {
        fl_draw_box( FL_UP_FRAME, x(), y(), w(), h(), selection_color() );
    }

    if ( audio_input.size() && audio_output.size() )
    {
        /* maybe draw control indicators */
        if ( control_input.size() )
            fl_draw_box( FL_ROUNDED_BOX, tx + 4, ty + 4, 5, 5, is_being_controlled() ? FL_YELLOW : fl_inactive( FL_YELLOW ) );
        if ( control_output.size() )
            fl_draw_box( FL_ROUNDED_BOX, tx + tw - 8, ty + 4, 5, 5, is_controlling() ? FL_YELLOW : fl_inactive( FL_YELLOW ) );
    }

    Fl_Group::draw_children();

    fl_pop_clip();
}
void UnaryImageProcessor::process() {

    if (!enableSwitch_.get()) {
        bypass(&inport_, &outport_);
        return;
    }

    outport_.activateTarget();

    // compile program if needed
    if (getInvalidationLevel() >= Processor::INVALID_PROGRAM)
        compile();
    LGL_ERROR;

    // initialize shader
    if (!program_ || !program_->isLinked())
        return;

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    TextureUnit colorUnit, depthUnit;
    inport_.bindTextures(colorUnit.getEnum(), depthUnit.getEnum());

    program_->activate();
    setGlobalShaderParameters(program_);

    program_->setIgnoreUniformLocationError(true);
    program_->setUniform("colorTex_", colorUnit.getUnitNumber());
    program_->setUniform("depthTex_", depthUnit.getUnitNumber());
    inport_.setTextureParameters(program_, "texParams_");
    program_->setIgnoreUniformLocationError(false);

    glDepthFunc(GL_ALWAYS);
    renderQuad();
    glDepthFunc(GL_LESS);

    program_->deactivate();
    outport_.deactivateTarget();
    glActiveTexture(GL_TEXTURE0);
    LGL_ERROR;
}
Exemple #29
0
void Convolution::process() {
    if (!enableSwitch_.get()) {
        bypass(&inport_, &outport_);
        return;
    }

    // activate and clear output render target
    outport_.activateTarget();
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    // bind result from previous processor
    inport_.bindTextures(GL_TEXTURE0, GL_TEXTURE1);
    filterPort_.bindColorTexture(GL_TEXTURE2);

    // activate shader and set uniforms:
    program_->activate();
    setGlobalShaderParameters(program_);
    LGL_ERROR;
    program_->setUniform("colorTex_", 0);
    program_->setUniform("depthTex_", 1);
    inport_.setTextureParameters(program_, "textureParameters_");
    LGL_ERROR;

    program_->setUniform("filter_", 2);
    LGL_ERROR;
    filterPort_.setTextureParameters(program_, "filterParameters_");
    LGL_ERROR;

    program_->setUniform("filterSize_", filterSize_.get());

    LGL_ERROR;
    // render screen aligned quad:
    glDepthFunc(GL_ALWAYS);
    renderQuad();
    glDepthFunc(GL_LESS);

    program_->deactivate();
    outport_.deactivateTarget();
    glActiveTexture(GL_TEXTURE0);
    LGL_ERROR;
}
void XC2C64A::write_sram(const verify_blocks_t& blocks) {
	tap.set_repeat(0);
	tap.set_end_ir(state_t::run_test_idle);
	tap.set_end_dr(state_t::run_test_idle);

	reset();
	enable();

	shift_ir(instruction_t::ISC_WRITE);
	for(const auto& block : blocks) {
		tap.state(state_t::shift_dr);
		tap.shift({ block.data.data(), block_length }, false);
		tap.shift({ &block.id, block_id_length }, true);
		tap.state(state_t::run_test_idle);
	}

	disable();
	bypass();

	tap.state(state_t::test_logic_reset);
}