Doxygen Documentation

Main Index

Package Index

Package:

TPG

Version:

V0-0-0

Marked:

(not marked)

Constituent:

tpg

Tag:

linux-gcc


Interface   Compound List   File List   Compound Members   File Members  

tpg.c File Reference

Trigger Pattern Generator command-line user interface. More...

#include "tpg_p.h"
#include "signal_p.h"
#include "GNAT/ginit.h"
#include "GNAT/gio.h"
#include "MSG/MSG_pubdefs.h"
#include "MSG/MSG_msgs.h"
#include "MSG/MSG_printProc.h"
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>

Functions

TPGTPGnew (unsigned *commAddr)
 Calls calloc to allocate memory for the struct and associated buffers then sets the buffer pointers to the correct offsets.

void TPGclear (TPG *this)
 Sets all the buffers to 0.

void TPGclearBuf (TPG *this, unsigned bufferId)
 Sets the buffer indicated by bufferId to 0.

unsigned TPGsetTEM (TPG *this, unsigned tem_id, temTrg trg, unsigned start, unsigned pattern, unsigned pat_len, unsigned repetitions)
unsigned TPGsetVETO (TPG *this, unsigned free_id, unsigned veto_id, unsigned start, unsigned pattern, unsigned pat_len, unsigned repetitions)
unsigned TPGsetCNO (TPG *this, unsigned free_id, unsigned start, unsigned pattern, unsigned pat_len, unsigned repetitions)
unsigned TPGsetTEMv (TPG *this, unsigned tem_id, temTrg trg, unsigned start, unsigned *pattern, unsigned pat_len, unsigned repetitions)
unsigned TPGsetVETOv (TPG *this, unsigned free_id, unsigned veto_id, unsigned start, unsigned *pattern, unsigned pat_len, unsigned repetitions)
unsigned TPGsetCNOv (TPG *this, unsigned free_id, unsigned start, unsigned *pattern, unsigned pat_len, unsigned repetitions)
unsigned TPGstart (TPG *this, unsigned char *clkDelay)
unsigned TPGdump (TPG *this, unsigned bufferId)
unsigned _checkBounds (unsigned start, unsigned pat_len, unsigned repetitions)
unsigned _checkTEM (unsigned tem_id, temTrg trg)
unsigned _checkFREE (unsigned free_id, unsigned veto_id)
unsigned _checkCNO (unsigned free_id)
void _setBits (unsigned *fifo, unsigned channel, unsigned start, unsigned pattern, unsigned pat_len, unsigned repetitions)
void _setBitsv (unsigned *fifo, unsigned channel, unsigned start, unsigned *pattern, unsigned pat_len, unsigned repetitions)
int TPGmsgInit (void)

Variables

unsigned TPG_LASTWORD = TPG_BUFFER_DEPTH - sizeof(unsigned)


Detailed Description

Trigger Pattern Generator command-line user interface.

Author:
James Swain -- jswain@slac.stanford.edu

Function Documentation

unsigned _checkBounds unsigned  start,
unsigned  pat_len,
unsigned  repetitions
 

unsigned _checkBounds(unsigned start, unsigned pat_len, unsigned repetitions);

Parameters:
start Bit that this pattern begins at
pat_len length of pattern
repetitions Number of times to repeat the pattern in the buffer
Returns:
One of TPG_msgs, TPG_SUCCESS when all is well Checks that the requested addition to the buffer does not exceed the boundaries

unsigned _checkCNO unsigned  free_id  ) 
 

unsigned _checkCNO(unsigned free_id);

Parameters:
free_id ID of the FREE board
Returns:
One of TPG_msgs, TPG_SUCCESS when all is well Checks that the free_id is valid

unsigned _checkFREE unsigned  free_id,
unsigned  veto_id
 

unsigned _checkFREE(unsigned free_id, unsigned veto_id);

Parameters:
free_id ID of the FREE board
veto_id ID of the VETO line
Returns:
One of TPG_msgs, TPG_SUCCESS when all is well Checks that the free_id and veto_id are valid

unsigned _checkTEM unsigned  tem_id,
temTrg  trg
 

unsigned _checkTEM(unsigned tem_id, temTrg trg);

Parameters:
tem_id ID of the TEM
trg Trg of the TEM
Returns:
One of TPG_msgs, TPG_SUCCESS when all is well Checks that the tem_id and trg are valid

void _setBits unsigned *  fifo,
unsigned  channel,
unsigned  start,
unsigned  pattern,
unsigned  pat_len,
unsigned  repetitions
 

void _setBits (unsigned* fifo, unsigned channel, unsigned start, unsigned pattern, unsigned pat_len, unsigned repetitions)

Parameters:
fifo Array of unsigned representing the Playback FIFO of one COMM I/O board
channel Channel this pattern is destined for
start Start bit for the pattern, 0 ... (32*1024)-1
pattern Up to 32 bit pattern to use (LSB first)
pat_len Pattern length 1 ... 32
repetitions Number of times to repeat the same pattern on this channel, use 0 to request as many reps as will fit in remaining FIFO depth Places the pat_len LSBs of pattern into channel and in buffer indicated by board

void _setBitsv unsigned *  fifo,
unsigned  channel,
unsigned  start,
unsigned *  pattern,
unsigned  pat_len,
unsigned  repetitions
 

void _setBitsv(unsigned* fifo, unsigned channel, unsigned start, unsigned* pattern, unsigned pat_len, unsigned repetitions)

Parameters:
fifo Array of unsigned representing the Playback FIFO of one COMM I/O board
channel Channel this pattern is destined for
start Start bit for the pattern, 0 ... (32*1024)-1
pattern Up to 32 bit pattern to use (LSB first)
pat_len Pattern length 1 ... (32*1024)-1
repetitions Number of times to repeat the same pattern on this channel, use 0 to request as many reps as will fit in remaining FIFO depth Places the pat_len LSBs of pattern into channel and in buffer indicated by board

void TPGclear TPG this  ) 
 

Sets all the buffers to 0.

void TPGclear(TPG* this)

Parameters:
this TPG structure to clear

void TPGclearBuf TPG this,
unsigned  bufferId
 

Sets the buffer indicated by bufferId to 0.

void TPGclearBuf(TPG* this, unsigned bufferId)

Parameters:
this TPG structure containing buffer to clear
bufferId ID of the buffer to clear

unsigned TPGdump TPG this,
unsigned  bufferId
 

unsigned TPGdump(TPG* this, unsigned bufferId)

Parameters:
this TPG struct to use to configure COMM I/O boards
bufferId Buffer to dump, 0 ... TPG_N_BOARDS
Returns:
One of TPG_msgs, TPG_SUCCESS if all goes well. Print out the bit patterns in the buffer

int TPGmsgInit void   ) 
 

int TPGmsgInit(void)

Returns:
0 on success, -1 on failure Starts a simple printf MSG processor

TPG* TPGnew unsigned *  commAddr  ) 
 

Calls calloc to allocate memory for the struct and associated buffers then sets the buffer pointers to the correct offsets.

TPG* TPGnew(unsigned* commAddr)

Parameters:
commAddr Array of addresses (TPG_N_BOARDS long) of the COMM I/O boards
Returns:
Ptr to a new TPG structure containing ptrs to buffers and gnatHandles

unsigned TPGsetCNO TPG this,
unsigned  free_id,
unsigned  start,
unsigned  pattern,
unsigned  pat_len,
unsigned  repetitions
 

unsigned TPGsetCNO(TPG* this, unsigned free_id, unsigned start, unsigned pattern, unsigned pat_len, unsigned repetitions)

Parameters:
this TPG structure being modified
free_id FREE being targeted (gives tgt board), 0 ... 3
start Start bit for the pattern, 0 ... (32*1024)-1
pattern Up to 32 bit pattern to use (LSB first)
pat_len Pattern length 1 ... 32
repetitions Number of times to repeat the same pattern on this channel, use 0 to request as many reps as will fit in remaining FIFO depth
Returns:
One of TPG_msgs, TPG_SUCCESS if all goes well. Places the pat_len LSBs of pattern into the channel and buffer indicated by free_id and veto_id

unsigned TPGsetCNOv TPG this,
unsigned  free_id,
unsigned  start,
unsigned *  pattern,
unsigned  pat_len,
unsigned  repetitions
 

unsigned TPGsetCNOv(TPG* this, unsigned free_id, unsigned start, unsigned pattern, unsigned pat_len, unsigned repetitions)

Parameters:
this TPG structure being modified
free_id FREE being targeted (gives tgt board), 0 ... 3
start Start bit for the pattern, 0 ... (32*1024)-1
pattern Up to 32 bit pattern to use (LSB first)
pat_len Pattern length 1 ... (32*1024) - 1
repetitions Number of times to repeat the same pattern on this channel, use 0 to request as many reps as will fit in remaining FIFO depth
Returns:
One of TPG_msgs, TPG_SUCCESS if all goes well. Places the pat_len LSBs of pattern into the channel and buffer indicated by free_id and veto_id

unsigned TPGsetTEM TPG this,
unsigned  tem_id,
temTrg  trg,
unsigned  start,
unsigned  pattern,
unsigned  pat_len,
unsigned  repetitions
 

unsigned TPGsetTEM(TPG* this, unsigned tem_id, temTrg trg, unsigned start, unsigned pattern, unsigned pat_len, unsigned repetitions)

Parameters:
this TPG structure being modified
tem_id TEM being targeted (gives channel range), 0 ... 3
trg TEM trg being targeted, (gives channel number), 0 ... 3, use temTrg
start Start bit for the pattern, 0 ... (32*1024)-1
pattern Up to 32 bit pattern to use (LSB first)
pat_len Pattern length 1 ... 32
repetitions Number of times to repeat the same pattern on this channel, use 0 to request as many reps as will fit in remaining FIFO depth
Returns:
One of TPG_msgs, TPG_SUCCESS if all goes well. Places the pat_len LSBs of pattern into the channel and buffer indicated by tem_id and trg

unsigned TPGsetTEMv TPG this,
unsigned  tem_id,
temTrg  trg,
unsigned  start,
unsigned *  pattern,
unsigned  pat_len,
unsigned  repetitions
 

unsigned TPGsetTEMv(TPG* this, unsigned tem_id, temTrg trg, unsigned start, unsigned* pattern, unsigned pat_len, unsigned repetitions)

Parameters:
this TPG structure being modified
tem_id TEM being targeted (gives channel range), 0 ... 3
trg TEM trg being targeted, (gives channel number), 0 ... 3, use temTrg
start Start bit for the pattern, 0 ... (32*1024)-1
pattern Up to 32 bit pattern to use (LSB first)
pat_len Pattern length 1 ... (32*1024) - 1
repetitions Number of times to repeat the same pattern on this channel, use 0 to request as many reps as will fit in remaining FIFO depth
Returns:
One of TPG_msgs, TPG_SUCCESS if all goes well. Places the pat_len LSBs of pattern into the channel and buffer indicated by tem_id and trg

unsigned TPGsetVETO TPG this,
unsigned  free_id,
unsigned  veto_id,
unsigned  start,
unsigned  pattern,
unsigned  pat_len,
unsigned  repetitions
 

unsigned TPGsetVETO(TPG* this, unsigned free_id, unsigned veto_id, unsigned start, unsigned pattern, unsigned pat_len, unsigned repetitions)

Parameters:
this TPG structure being modified
free_id FREE being targeted (gives tgt board), 0 ... 3
veto_id VETO bit being targeted, (gives channel number), 0 ... 17
start Start bit for the pattern, 0 ... (32*1024)-1
pattern Up to 32 bit pattern to use (LSB first)
pat_len Pattern length 1 ... 32
repetitions Number of times to repeat the same pattern on this channel, use 0 to request as many reps as will fit in remaining FIFO depth
Returns:
One of TPG_msgs, TPG_SUCCESS if all goes well. Places the pat_len LSBs of pattern into the channel and buffer indicated by free_id and veto_id

unsigned TPGsetVETOv TPG this,
unsigned  free_id,
unsigned  veto_id,
unsigned  start,
unsigned *  pattern,
unsigned  pat_len,
unsigned  repetitions
 

unsigned TPGsetVETOv(TPG* this, unsigned free_id, unsigned veto_id, unsigned start, unsigned* pattern, unsigned pat_len, unsigned repetitions)

Parameters:
this TPG structure being modified
free_id FREE being targeted (gives tgt board), 0 ... 3
veto_id VETO bit being targeted, (gives channel number), 0 ... 17
start Start bit for the pattern, 0 ... (32*1024)-1
pattern Up to 32 bit pattern to use (LSB first)
pat_len Pattern length 1 ... (32*1024) - 1
repetitions Number of times to repeat the same pattern on this channel, use 0 to request as many reps as will fit in remaining FIFO depth
Returns:
One of TPG_msgs, TPG_SUCCESS if all goes well. Places the pat_len LSBs of pattern into the channel and buffer indicated by free_id and veto_id

unsigned TPGstart TPG this,
unsigned char *  clkDelay
 

unsigned TPGstart(TPG* this, unsigned char* clkDelay)

Parameters:
this TPG struct to use to configure COMM I/O boards
clkDelay Array of (6 bit) clock delays (TPG_N_BOARDS long) for the COMM I/O boards, to remove clock skew.
Returns:
One of TPG_msgs, TPG_SUCCESS if all goes well. Use Programmed I/O to fill the COMM board FIFOs, then start the sequence


Variable Documentation

unsigned TPG_LASTWORD = TPG_BUFFER_DEPTH - sizeof(unsigned)
 

first bit of last word of a pattern


Generated on Sat Nov 15 15:27:25 2003 by doxygen 1.3.3