Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
dune::PennMicroSliceWriter Class Reference

#include <PennMicroSliceWriter.hh>

Inheritance diagram for dune::PennMicroSliceWriter:
dune::PennMicroSlice

Public Member Functions

 PennMicroSliceWriter (uint8_t *address, uint32_t max_size_bytes)
 
bool addData (uint16_t *data, uint16_t data_size)
 
int32_t finalize ()
 
- Public Member Functions inherited from dune::PennMicroSlice
 PennMicroSlice (uint8_t *address)
 
uint8_t * get_payload (uint32_t word_id, Payload_Header::data_packet_type_t &data_packet_type, Payload_Header::short_nova_timestamp_t &short_nova_timestamp, size_t &size, bool swap_payload_header_bytes, size_t override_uslice_size=0) const
 
uint8_t * get_next_payload (uint32_t &word_id, Payload_Header::data_packet_type_t &data_packet_type, Payload_Header::short_nova_timestamp_t &short_nova_timestamp, size_t &size, bool swap_payload_header_bytes, size_t override_uslice_size=0)
 
Header::format_version_t format_version () const
 
Header::sequence_id_t sequence_id () const
 
Header::block_size_t block_size () const
 
dune::PennMicroSlice::microslice_size_t size () const
 
sample_count_t sampleCount (sample_count_t &n_counter_words, sample_count_t &n_trigger_words, sample_count_t &n_timestamp_words, sample_count_t &n_selftest_words, sample_count_t &n_checksum_words, bool swap_payload_header_bytes, size_t override_uslice_size=0) const
 
uint8_t * sampleTimeSplit (uint64_t boundary_time, size_t &remaining_size, bool swap_payload_header_bytes, size_t override_uslice_size=0) const
 
uint8_t * sampleTimeSplitAndCount (uint64_t boundary_time, size_t &remaining_size, sample_count_t &n_words_b, sample_count_t &n_counter_words_b, sample_count_t &n_trigger_words_b, sample_count_t &n_timestamp_words_b, sample_count_t &n_selftest_words_b, sample_count_t &n_checksum_words_b, sample_count_t &n_words_a, sample_count_t &n_counter_words_a, sample_count_t &n_trigger_words_a, sample_count_t &n_timestamp_words_a, sample_count_t &n_selftest_words_a, sample_count_t &n_checksum_words_a, bool swap_payload_header_bytes, size_t override_uslice_size=0) const
 
uint8_t * sampleTimeSplitAndCountTwice (uint64_t boundary_time, size_t &remaining_size, uint64_t overlap_time, size_t &overlap_size, uint8_t *&overlap_data_ptr, sample_count_t &n_words_b, sample_count_t &n_counter_words_b, sample_count_t &n_trigger_words_b, sample_count_t &n_timestamp_words_b, sample_count_t &n_selftest_words_b, sample_count_t &n_checksum_words_b, sample_count_t &n_words_a, sample_count_t &n_counter_words_a, sample_count_t &n_trigger_words_a, sample_count_t &n_timestamp_words_a, sample_count_t &n_selftest_words_a, sample_count_t &n_checksum_words_a, sample_count_t &n_words_o, sample_count_t &n_counter_words_o, sample_count_t &n_trigger_words_o, sample_count_t &n_timestamp_words_o, sample_count_t &n_selftest_words_o, sample_count_t &n_checksum_words_o, uint32_t &checksum, bool swap_payload_header_bytes, size_t override_uslice_size=0) const
 
uint32_t * raw () const
 

Protected Member Functions

Headerheader_ ()
 
uint16_t * data_ ()
 
- Protected Member Functions inherited from dune::PennMicroSlice
Header const * header_ () const
 
uint32_t const * data_ () const
 

Protected Attributes

uint32_t max_size_bytes_
 
- Protected Attributes inherited from dune::PennMicroSlice
uint8_t * buffer_
 
uint8_t * current_payload_
 
uint32_t current_word_id_
 

Additional Inherited Members

- Public Types inherited from dune::PennMicroSlice
typedef Header::block_size_t microslice_size_t
 
typedef uint32_t sample_count_t
 
- Static Public Member Functions inherited from dune::PennMicroSlice
static uint64_t getMask (int param)
 
- Static Public Attributes inherited from dune::PennMicroSlice
static microslice_size_t const payload_size_counter = 4 * sizeof(uint32_t)
 
static microslice_size_t const payload_size_trigger = 1 * sizeof(uint32_t)
 
static microslice_size_t const payload_size_timestamp = 2 * sizeof(uint32_t)
 
static microslice_size_t const payload_size_warning = 0 * sizeof(uint32_t)
 
static microslice_size_t const payload_size_checksum = 0 * sizeof(uint32_t)
 
static const Payload_Header::data_packet_type_t DataTypeWarning = 0x0
 
static const Payload_Header::data_packet_type_t DataTypeCounter = 0x1
 
static const Payload_Header::data_packet_type_t DataTypeTrigger = 0x2
 
static const Payload_Header::data_packet_type_t DataTypeChecksum = 0x4
 
static const Payload_Header::data_packet_type_t DataTypeTimestamp = 0x7
 
static const Warning_Word::warning_type_t WarnUnknownDataType = 0x02
 
static const Warning_Word::warning_type_t WarnTimeout = 0x04
 
static const Warning_Word::warning_type_t WarnFIFOHalfFull = 0x08
 
static const Warning_Word::warning_type_t WarnFIFOFull = 0x10
 
static const uint32_t ROLLOVER_LOW_VALUE = 1 << 13
 
static const uint64_t ROLLOVER_HIGH_VALUE = (1 << 27) -1
 

Detailed Description

Definition at line 10 of file PennMicroSliceWriter.hh.

Constructor & Destructor Documentation

dune::PennMicroSliceWriter::PennMicroSliceWriter ( uint8_t *  address,
uint32_t  max_size_bytes 
)

Definition at line 4 of file PennMicroSliceWriter.cc.

4  :
5  //uint8_t sequence_id) :
6  PennMicroSlice(address), max_size_bytes_(max_size_bytes)
7 {
8  header_()->format_version = 0xE1;
9  //header_()->sequence_id = sequence_id;
10  header_()->block_size = sizeof(Header);
11 
12  if (max_size_bytes_ < size()) {
14  }
15 }
PennMicroSlice(uint8_t *address)
dune::PennMicroSlice::microslice_size_t size() const

Member Function Documentation

bool dune::PennMicroSliceWriter::addData ( uint16_t *  data,
uint16_t  data_size 
)

Definition at line 37 of file PennMicroSliceWriter.cc.

38 {
39  if ((size() + data_size) > max_size_bytes_) {
40  return false;
41  }
42  for(uint16_t i = 0; i < data_size; i++) {
43  uint16_t value = data[i];
44  data_()[i] = value;
45  header_()->block_size += sizeof(value);
46  }
47  return true;
48 }
dune::PennMicroSlice::microslice_size_t size() const
uint16_t * dune::PennMicroSliceWriter::data_ ( )
protected

Definition at line 62 of file PennMicroSliceWriter.cc.

63 {
64  // This is not really a good solution.
65  return reinterpret_cast<uint16_t *>(buffer_ + sizeof(Header));
66 }
int32_t dune::PennMicroSliceWriter::finalize ( )

Definition at line 50 of file PennMicroSliceWriter.cc.

51 {
52  int32_t size_diff = max_size_bytes_ - header_()->block_size;
54  return size_diff;
55 }
dune::PennMicroSlice::Header * dune::PennMicroSliceWriter::header_ ( )
protected

Definition at line 57 of file PennMicroSliceWriter.cc.

58 {
59  return reinterpret_cast<Header *>(buffer_);
60 }

Member Data Documentation

uint32_t dune::PennMicroSliceWriter::max_size_bytes_
protected

Definition at line 44 of file PennMicroSliceWriter.hh.


The documentation for this class was generated from the following files: