Changeset 10973


Ignore:
Timestamp:
06/10/11 09:18:02 (10 years ago)
Author:
tbretz
Message:
Implemented the new execute command for the write command.
Location:
trunk/FACT++/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/HeadersFAD.h

    r10924 r10973  
    3333    enum Commands
    3434    {
     35        kCmdWriteExecute      = 0x0400,         // Configure FAD with the current config ram
     36
    3537        kCmdWrite             = 0x0500,         // write to Config-RAM
    3638        kCmdWriteRoi          = kCmdWrite|0x00, // Baseaddress ROI-Values
  • trunk/FACT++/src/fad.cc

    r10926 r10973  
    3232
    3333    double   fStartTime;
    34     uint32_t fRunNumber;
    3534
    3635    void AsyncRead(ba::mutable_buffers_1 buffers)
     
    7271
    7372    FAD::EventHeader   fHeader;
     73    FAD::EventHeader   fRam;
    7474    FAD::ChannelHeader fChHeader[kNumChannels];
     75
     76    uint16_t fRamRoi[kNumChannels];
    7577
    7678    ba::deadline_timer fTriggerSendData;
     
    8991        fHeader.fEventCounter++;
    9092        fHeader.fTimeStamp = uint32_t((Time(Time::utc).UnixTime()-fStartTime)*10000);
    91         fHeader.fRunNumber = fRunNumber;
    92 
    9393
    9494        fBuffer.resize(0);
     
    228228                cout << "-> Trigger" << endl;
    229229                SendData();
     230                break;
     231
     232            case kCmdWriteExecute:
     233                cout << "-> Execute" << endl;
     234                memcpy(fHeader.fDac, fRam.fDac, sizeof(fHeader.fDac));
     235                for (int i=0; i<kNumChannels; i++)
     236                    fChHeader[i].fRegionOfInterest = fRamRoi[i];
     237                fHeader.fRunNumber = fRam.fRunNumber;
    230238                break;
    231239
     
    270278        {
    271279        case kCmdWriteRunNumberMSW:
    272             fRunNumber &= 0xffff;
    273             fRunNumber |= fBufCommand[0]<<16;
     280            fRam.fRunNumber &= 0xffff;
     281            fRam.fRunNumber |= fBufCommand[0]<<16;
    274282            cout << "-> Set RunNumber MSW" << endl;
    275283            break;
    276284        case kCmdWriteRunNumberLSW:
    277             fRunNumber &= 0xffff0000;
    278             fRunNumber |= fBufCommand[0];
     285            fRam.fRunNumber &= 0xffff0000;
     286            fRam.fRunNumber |= fBufCommand[0];
    279287            cout << "-> Set RunNumber LSW" << endl;
    280288            break;
    281289        case kCmdWriteRoi:
    282290            cout << "-> Set Roi[" << fCommand[1] << "]=" << fBufCommand[0] << endl;
    283             fChHeader[fCommand[1]].fRegionOfInterest = fBufCommand[0];
     291            //fChHeader[fCommand[1]].fRegionOfInterest = fBufCommand[0];
     292            fRamRoi[fCommand[1]] = fBufCommand[0];
    284293            break;
    285294
    286295        case kCmdWriteDac:
    287296            cout << "-> Set Dac[" << fCommand[1] << "]=" << fBufCommand[0] << endl;
    288             fHeader.fDac[fCommand[1]] = fBufCommand[0];
     297            fRam.fDac[fCommand[1]] = fBufCommand[0];
    289298            break;
    290299        }
     
    310319        fTriggerEnabled=false;
    311320        fCommandSocket=true;
    312         fRunNumber = 1;
    313321
    314322        fHeader.fStartDelimiter = FAD::kDelimiterStart;
    315323        fHeader.fVersion = 0x104;
    316324        fHeader.fBoardId = (fBoardId%10) | ((fBoardId/10)<<8);
     325        fHeader.fRunNumber = 1;
    317326        fHeader.fStatus = 0xf<<12 |
    318327            FAD::EventHeader::kDenable    |
  • trunk/FACT++/src/fadctrl.cc

    r10966 r10973  
    378378
    379379        PostCmd(FAD::kCmdWriteRate, val);//uint8_t(1000./val/12.5));
     380        PostCmd(FAD::kCmdWriteExecute);
    380381        //PostCmd(kCmdContTriggerRate, uint8_t(80/val));
    381382
     
    387388        PostCmd(FAD::kCmdWriteRunNumberLSW, num&0xffff);
    388389        PostCmd(FAD::kCmdWriteRunNumberMSW, num>>16);
     390        PostCmd(FAD::kCmdWriteExecute);
    389391    }
    390392
     
    394396        // Allowed value: [0, MAX_VAL]
    395397        PostCmd(FAD::kCmdWrite + addr, val);
     398        PostCmd(FAD::kCmdWriteExecute);
    396399    }
    397400
     
    401404            return false;
    402405
    403         PostCmd(FAD::kCmdWriteDac + addr, val);
     406        PostCmd(FAD::kCmdWriteExecute);
    404407        return true;
    405408    }
     
    414417            for (unsigned int i=0; i<=FAD::kMaxRoiAddr; i++)
    415418                PostCmd(FAD::kCmdWriteRoi + i, val);
     419            PostCmd(FAD::kCmdWriteExecute);
    416420            return true;
    417421        }
     
    421425
    422426        PostCmd(FAD::kCmdWriteRoi + addr, val);
     427        PostCmd(FAD::kCmdWriteExecute);
    423428        return true;
    424429    }
Note: See TracChangeset for help on using the changeset viewer.