@@ -54,6 +54,8 @@ class BarAccessor
5454 return mBar ->readRegister (Registers::LINK_SUPERPAGES_PUSHED.get (link).index );
5555 }
5656
57+ // / Enables the data emulator
58+ // / \param enabled true for enabled
5759 void setDataEmulatorEnabled (bool enabled) const
5860 {
5961 mBar ->writeRegister (Registers::DMA_CONTROL.index , enabled ? 0x1 : 0x0 );
@@ -62,16 +64,22 @@ class BarAccessor
6264 mBar ->writeRegister (Registers::DATA_GENERATOR_CONTROL.index , bits);
6365 }
6466
67+ // / Resets the data generator counter
6568 void resetDataGeneratorCounter () const
6669 {
6770 mBar ->writeRegister (Registers::RESET_CONTROL.index , 0x2 );
6871 }
6972
73+ // / Performs a general reset of the card
7074 void resetCard () const
7175 {
7276 mBar ->writeRegister (Registers::RESET_CONTROL.index , 0x1 );
7377 }
7478
79+ // / Sets the pattern for the card's internal data generator
80+ // / \param pattern Data generator pattern
81+ // / \param size Size in bytes
82+ // / \param randomEnabled Give true to enable random data size. In this case, the given size is the maximum size (?)
7583 void setDataGeneratorPattern (GeneratorPattern::type pattern, size_t size, bool randomEnabled)
7684 {
7785 uint32_t bits = mBar ->readRegister (Registers::DATA_GENERATOR_CONTROL.index );
@@ -81,11 +89,15 @@ class BarAccessor
8189 mBar ->writeRegister (Registers::DATA_GENERATOR_CONTROL.index , bits);
8290 }
8391
92+ // / Injects a single error into the generated data stream
8493 void dataGeneratorInjectError ()
8594 {
8695 mBar ->writeRegister (Registers::DATA_GENERATOR_CONTROL.index , Registers::DATA_GENERATOR_CONTROL_CMD_INJECT_ERROR);
8796 }
8897
98+ // / Gets the serial number from the card.
99+ // / Note that not all firmwares have a serial number. You should make sure this firmware feature is enabled before
100+ // / calling this function, or the card may crash. See getFirmwareFeatures().
89101 uint32_t getSerialNumber () const
90102 {
91103 assertBarIndex (2 , " Can only get serial number from BAR 2" );
@@ -161,6 +173,7 @@ class BarAccessor
161173 return mBar ->readRegister (Registers::FIRMWARE_TIME.index );
162174 }
163175
176+ // / Get the enabled features for the card's firmware.
164177 FirmwareFeatures getFirmwareFeatures ()
165178 {
166179 assertBarIndex (0 , " Can only get firmware features from BAR 0" );
@@ -190,6 +203,9 @@ class BarAccessor
190203 return features;
191204 }
192205
206+ // / Sets the bits for the data generator pattern in the given integer
207+ // / \param bits Integer with bits to set
208+ // / \param pattern Pattern to set
193209 static void setDataGeneratorPatternBits (uint32_t & bits, GeneratorPattern::type pattern)
194210 {
195211 switch (pattern) {
@@ -211,6 +227,9 @@ class BarAccessor
211227 }
212228 }
213229
230+ // / Sets the bits for the data generator size in the given integer
231+ // / \param bits Integer with bits to set
232+ // / \param size Size to set
214233 static void setDataGeneratorSizeBits (uint32_t & bits, size_t size)
215234 {
216235 if (!Utilities::isMultiple (size, 32ul )) {
@@ -231,34 +250,24 @@ class BarAccessor
231250 bits += sizeValue;
232251 }
233252
253+ // / Sets the bits for the data generator enabled in the given integer
254+ // / \param bits Integer with bits to set
255+ // / \param enabled Generator enabled or not
234256 static void setDataGeneratorEnableBits (uint32_t & bits, bool enabled)
235257 {
236258 Utilities::setBit (bits, 0 , enabled);
237259 }
238260
261+ // / Sets the bits for the data generator random size in the given integer
262+ // / \param bits Integer with bits to set
263+ // / \param enabled Random enabled or not
239264 static void setDataGeneratorRandomSizeBits (uint32_t & bits, bool enabled)
240265 {
241266 Utilities::setBit (bits, 16 , enabled);
242267 }
243268
244-
245- // uint8_t getDebugReadWriteRegister()
246- // {
247- // return mPdaBar->barRead<uint8_t>(toByteAddress(Registers::DEBUG_READ_WRITE));
248- // }
249- //
250- // void setDebugReadWriteRegister(uint8_t value)
251- // {
252- // return mPdaBar->barWrite<uint8_t>(toByteAddress(Registers::DEBUG_READ_WRITE), value);
253- // }
254-
255269 private:
256- // / Convert an index to a byte address
257- size_t toByteAddress (size_t address32) const
258- {
259- return address32 * 4 ;
260- }
261-
270+ // / Checks if this is the correct BAR. Used to check for BAR 2 for special functions.
262271 void assertBarIndex (int index, std::string message) const
263272 {
264273 if (mBar ->getIndex () != index) {
0 commit comments