fdhwlib  2.0.25
FltMemory Class Reference

#include <FltMemory.h>

Inheritance diagram for FltMemory:
Pbus KaFltTriggerMemory

List of all members.

Public Member Functions

Protected Attributes

Private Attributes


Detailed Description

The ADC memory contains the data read from the PMTs (Channel 0-23).

It is organized in 32 pages for every pixel (0-31), where each page contains the ADC data from the last 1000 x 100ns = 100 us.

This class provides commands to access one complete page, parts of a page or a single value. The first methods will use block transfer mode while the last will use single transfer mode. The methods using block transfer expect an array of unsigned short to store the data. In version 1 an additional block copy will be necessary to separate the values that belong to the even and the odd pixel. These function make use of the convert-methods of the class. To obtain the raw data as it is read from the memory use the method that expects a array of unsigned long. But be careful the interpretation of this data may change with the FPGA design!

Access to the ADC memory

  • Version 1: The data is returned in long words always containing the values for a even and a odd pixel together. This is called the raw format. The method convertToPixelFormat will return a separate array for both pixel.
  • Version 2: The memory access returns the value of two consequtive pixel in one row in Flt version 2.00 - before the data of pixel in two columns was returned.

Note: Autoincrement readout of the hardware

The Flt will automatically read in the cyclic page buffer The start address runs from 0 to 999, increment is always 2. With every access the ADC value of the requested address and the following is transmited - so the increment of 2 will read the next twi ADC values in the series. Only (?) restriction: It is not possible to read an odd number of pixel. If an odd number is required. Provide one element more in the target array and read the next even number of values.

Changes:

  • Added implementation to use auto increment readout of the Flt memory pages.
  • The address model changes in Flt version 2.00
  • The order of the pixel transfered changed in Flt version 2.00
  • The interface now uses arrays of type unsigned short!

Definition at line 75 of file FltMemory.h.


Constructor & Destructor Documentation

FltMemory::FltMemory ( const char *  name,
int  slotID,
int  regID,
int  len 
)

Generic memory definition.

Parameters:
nameName of the memory block
slotIDAddress of the board
regIDRegister address
lenLength of the memory block
virtual FltMemory::~FltMemory ( ) [virtual]

Member Function Documentation

void FltMemory::broadcast ( int  page,
unsigned short  data 
)

Broadcast a constant value to a certain page in all channels.

void FltMemory::broadcast ( int  page,
unsigned short *  data 
)

Broadcast one page of data to all channels.

void FltMemory::clear ( int  ch,
int  page,
unsigned short  data 
)

Set one page to a constant value.

Warning: Writing to one page has side effects on five other pages. While the selected one is filled with the given data the others will contain the ADC data afterwards. To write the same data to all channels use the broadcast command.

void FltMemory::convertToPixelFormat ( unsigned long *  rawdata,
unsigned short *  even,
unsigned short *  odd,
int  start,
int  n 
)

The raw format is not appropiate for further processing.

The function can be used to separate the data for even and odd pixel number. In addition it is possible to use the argument start to perform an cyclic shift of the data. For the shift is assumed that the array is of length FLT_PAGE_SIZE (now 1000). In general it makes no sense to use the shift option (via start), if the size of the array is not equal FLT_PAGE_SIZE

void FltMemory::convertToRawFormat ( unsigned long *  rawdata,
unsigned short *  pixeldata,
int  start,
int  n 
)

To write to the Flt memory it is necessary to convert to the pixel data to the raw data format.

In addition it is possible to use the argument start to perform an cyclic shift of the data. For the shift is assumed that the array is of length FLT_PAGE_SIZE (now 1000). In general it makes no sense to use the shift option (via start), if the size of the array is not equal FLT_PAGE_SIZE

unsigned long FltMemory::getAddr ( )

Get address.

int FltMemory::getBlockLen ( )
int FltMemory::getLength ( )
char* FltMemory::getName ( )
int FltMemory::getPageAddrLen ( )
int FltMemory::getPixelAddrLen ( )
virtual unsigned long FltMemory::read ( unsigned long  addr) [virtual]

Base read.

Reimplemented from Pbus.

Reimplemented in KaFltTriggerMemory.

virtual void FltMemory::read ( unsigned long *  data,
int  len = 0 
) [virtual]

Base read.

Reimplemented in KaFltTriggerMemory.

int FltMemory::read ( int  ch,
int  page,
unsigned long *  data 
)

Read one page of data (1024 elements).

This function will use a single block transfer to copy the ADC data. The function returns the raw ADC data!

unsigned short FltMemory::read ( int  ch,
int  page,
int  addr 
)

Read a single value.

int FltMemory::read ( int  ch,
int  page,
unsigned short *  data 
)

Read one page of data (The number of elements is FLT_PAGE_SIZE).

This function will use a single block transfer to copy the ADC data. The start point of the ADC data is not considered.

int FltMemory::read ( int  ch,
int  page,
int  start,
unsigned short *  data,
int  n 
)

Read a block of data, if start+n exceeds 1000 the reading will be continued at the beginning of the page.

If this command is used the data transfer is divided into at least two block tranfers. If the start address is odd in addition a few words have to be transfered in single access mode.

void FltMemory::read ( int  ch,
int  page,
int  start,
unsigned short *  even,
unsigned short *  odd 
)

Read the data for a odd and a even page.

Use the even channel number.

void FltMemory::read ( int  ch,
int  page,
int  start,
unsigned short *  even,
unsigned short *  odd,
int  n 
)

Read a block of data and return the values for the even and the odd pixel.

If necessary the reading is continued at the beginning of the page

void FltMemory::write ( int  ch,
int  page,
unsigned long *  data 
)

Write one page of raw data.

The write command is intended for use in test mode (see FltPeriphStatus).

Warning: Writing to one page has side effects on five other pages. While the selected one is filled with the given data the others will contain the ADC data afterwards. To write the same data to all channels use the broadcast command.

void FltMemory::write ( int  ch,
int  page,
int  addr,
unsigned short  data 
)

Write a single value.

Warning: Writing to one page has side effects on five other pages. While the selected one is filled with the given data the others will contain the ADC data afterwards. To write the same data to all channels use the broadcast command.

void FltMemory::write ( int  ch,
int  page,
unsigned short *  data 
)

Write one page of data (The number of elements is FLT_PAGE_SIZE)

Warning: Writing to one page has side effects on five other pages. While the selected one is filled with the given data the others will contain the ADC data afterwards. To write the same data to all channels use the broadcast command.


Member Data Documentation

unsigned long FltMemory::addr [protected]

Definition at line 226 of file FltMemory.h.

int FltMemory::blockLen [protected]

page size in bit

Definition at line 231 of file FltMemory.h.

unsigned long FltMemory::buffer[FLT_PAGE_SIZE] [private]

The buffer is used in the methods where a conversion to unsigned short is required.

This array will increase the memory requiredment, but will probably also increase the performance, as it is not necessary to allocate memory?!

Definition at line 258 of file FltMemory.h.

int FltMemory::len [protected]

Definition at line 228 of file FltMemory.h.

const char* FltMemory::name [private]

Definition at line 242 of file FltMemory.h.

unsigned short FltMemory::nextpixel[FLT_PAGE_SIZE] [private]

Definition at line 260 of file FltMemory.h.

int FltMemory::pageAddrLen [protected]

page addr size in bit

Definition at line 234 of file FltMemory.h.

int FltMemory::pixelAddrLen [protected]

pixel addr size in bit

Definition at line 237 of file FltMemory.h.

bool FltMemory::readable [private]

Definition at line 244 of file FltMemory.h.

bool FltMemory::writeable [private]

Definition at line 246 of file FltMemory.h.


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