This page describes the production AMC13 C++ support software. The software is in git here:

Current tags: browse AMC13SoftwareHistory

$ git clone  ssh://
$ git tag -l (List the available tags)
$ git checkout tags/1.2.13  (To checkout a specific tag - check the list for the most up to date)

Master: browse

$ git clone  ssh://


Install from RPMs using yum:

1) Download the repo file and copy to /etc/yum.repos.d, renaming to cactus-amc13.repo:

sudo cp cactus-amc13.slc6.x86_64.repo /etc/yum.repos.d/cactus-amc13.repo

2) Install the software (from RPMs):

sudo yum clean all
sudo yum groupinstall amc13

The AMC13 low-level libraries are in the amc13 folder, while AMC13Tool and other command-line utilities are in the tools folder.

2a) Install the software (from Source, assuming other CACTUS RPMs like IPBus are installed):

To check out and build the code:

$ git clone  ssh://
$ cd amc13
$ source
$ make

To run the code, from a new shell

$ cd ..../amc13
$ source
$ export AMC13_ADDRESS_TABLE_PATH=/home/hazen/work/check/amc13/amc13/etc/amc13

Please keep up-to-date: Amc13CppProductionSoftwareToDoList

Class AMC13

This class inherits low-level access from AMC13Simple

Method Description
AMC13::AMC13( string& connection_file) Constructor with uHAL connection file [Note 1]
AMC13::AMC13( string& URI1, string& AT1, string& URI2, string& AT2) Constructor with URIs and Address Table File paths
AMC13::~AMC13() Clean up and delete connections

1. The uHAL connection file must contain exactly two entries with id="T1" and "id="T2"

Accessors to uHAL interfaces

Method Description
uhal::HwInterface* AMC13::T1() Returns pointer to T1 interface
uhal::HwInterface* AMC13::T2() Returns pointer to T2 interface

Read/Write functions

Method Description
uint32_t AMC13::read( int chip, string& reg) Single read from named register
uint32_t AMC13::read( int chip, uint32_t addr) Single read from address
size_t AMC13::read( int chip, string& reg, size_t nwords, uint32_t* buffer) Block read from named register [Note 1]
size_t AMC13::read( int chip, uint32_t addr, size_t nwords, uint32_t buffer) Block read from address
void AMC13::write( int chip, string& reg, uint32_t val) Single write to named register
void AMC13::write( int chip, uint32_t addr, uint32_t val) Single write to address
size_t AMC13::write( int chip, string& reg, size_t nwords, uint32_t* buffer) Block write to named register [Note 1]
size_t AMC13::write( int chip, uint32_t addr, size_t nwords, uint32_t* buffer) Block write to address

1. The address table item must have mode="incremental" and size=nnnn attributes defined for the block read/write operations to work

Control Functions

Method Description
void AMC13::reset(int chip) Issues a general reset to tongue chip
void AMC13::AMCInputEnable( uint32_t mask) Enable AMC backplane inputs using bit mask (bit 0=AMC1 etc)
void AMC13::enableAllTTC() Enable all AMC13 TTC backplane outputs
void AMC13::daqLinkEnable(int n, bool b) Enable/disable DAQ fiber link n (0..2) with boolean b
void AMC13::fakeDataEnable(bool b) Enable/disable fake data generation in the AMC13 event builder with boolean b
void AMC13::setFakeSize( int n) set fake event size (0..0x3ffff)
void AMC13::localTtcSignalEnable(bool b) Enables/disable the locally generated TTC signal in the AMC13 with boolean b
void AMC13::genInternalL1AsEnable(bool b) Enable/disable locally generated L1As in the AMC13 with boolean b
void AMC13::ttcRxEnable(bool b) Enable/disable the TTC Rx module on the AMC13 with boolean b
void AMC13::monBufBackPressEnable(bool b) Enable/disable SDRAM backpressure on the AMC13 with boolean b
void AMC13::genInternalPeriodicL1As(bool b) Start/stop the sending of locally generated periodic triggers on the AMC13 with boolean b
void AMC13::megaMonitorScale(bool b) Enable/disable event-number masked prescaling boolean b
void AMC13::setPreScaleFactor(uint32_t noZos) Sets the number of lower bits set to zero in the prescale factor with argument noZos
void AMC13::genInternalSingleL1A(uint32_t n) Generate a burst of n internally generated L1As on the AMC13
void AMC13::setTrigType(uint32_t type) Set the type of periodic trigger to be generated on the AMC13 with argument type
void AMC13::setLocalL1APeriod(uint32_t n) Set the local L1A period to n for internally generated L1As on the AMC13
void AMC13::sendLocalEvnOrnReset(uint32_t a, uint32_t b) Send a local EvN reset if a and OrN reset if b
void AMC13::setFEDid(uint32_t id) Set the AMC13 FED ID to id
void AMC13::sfpOutputEnable(uint32_t mask) Enable SFPs using 3-bit mask, mask enables SFPs 2,1,0
void AMC13::startRun() Put the AMC13 into run mode
void AMC13::endRun() Take the AMC13 out of run mode

DAQ Functions

Method Description
uint64_t * AMC13::readEvent( size_t& nwords, int& rc) Read one (possibly segmented) event. Set nwords to size, return ptr to malloc()'d buffer

Flash Memory Support

Method DescriptionSorted ascending
void eraseFlashSector(uint32_t) Erase sector (256K bytes)
void loadFlash() Force reconfiguration of T1 and T2 FPGAs from flash sectors
void loadFlashT1() Force reconfiguration of T1 FPGA only
void programFlash(const std::string&, uint32_t) Program flash from MCS file to specified address
Flash* AMC13::getFlash() Returns a pointer to flash programming object for an AMC13
void verifyFlash(const std::string&, uint32_t) Verify flash from MCS file at specified address
void writeFlashPage(uint32_t, std::vector<uint32_t>) Write 256-byte page
-- EricHazen - 04 Jun 2014
Edit | Attach | Watch | Print version | History: r28 | r26 < r25 < r24 < r23 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r24 - 22 Feb 2019 - DanielArcaro
  • Edit
  • Attach
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2023 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback