camacmap.cpp File Reference

#include <config.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <signal.h>
#include <setjmp.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/mman.h>
#include <time.h>
#include <sys/time.h>
#include <fcntl.h>
#include <ctype.h>
#include <sys/ioctl.h>
#include <math.h>
#include <assert.h>
#include <CVMEInterface.h>
#include <camac.h>
#include <Iostream.h>

Go to the source code of this file.

Defines

#define VMECRATES   16
#define BRANCHESINCRATE   8
#define DEF_SIGNAL   SIGUSR1
#define DEF_VECTOR   -1
#define DEF_IRQ   2
#define PAGE_SIZE   4096
#define SLOT_SIZE   2048
#define SLOTS_PER_CRATE   25
#define PAGES_PER_CRATE   ((SLOTS_PER_CRATE*SLOT_SIZE)/PAGE_SIZE)
#define BRANCHES   8
#define CRATES_PER_BRANCH   8

Functions

void * daq_OpenCamacDriver ()
void * daq_MapCamacSpace (void *fid)
void daq_UnmapCamacSpace (void *fd, void *pSpace)
void daq_CloseCamacDriver (void *fid)
void CESBranchAccess (int nBranch)
void WIENERBranchAccess (int nBranch)

Variables

static const char * Copyright = "(C) Copyright Michigan State University 2002, All rights reserved"
static char * pCopyright = "(c) NSCL 1999, All rights reserved\n"
static void * vmeFds [VMECRATES]
void * pBranchBases [VMECRATES *BRANCHESINCRATE]


Define Documentation

#define BRANCHES   8

Definition at line 155 of file camacmap.cpp.

Referenced by daq_MapCamacSpace(), and daq_UnmapCamacSpace().

#define BRANCHESINCRATE   8

Definition at line 141 of file camacmap.cpp.

Referenced by CESBranchAccess(), and WIENERBranchAccess().

#define CRATES_PER_BRANCH   8

Definition at line 156 of file camacmap.cpp.

Referenced by daq_MapCamacSpace(), and daq_UnmapCamacSpace().

#define DEF_IRQ   2

Definition at line 146 of file camacmap.cpp.

#define DEF_SIGNAL   SIGUSR1

Definition at line 144 of file camacmap.cpp.

#define DEF_VECTOR   -1

Definition at line 145 of file camacmap.cpp.

#define PAGE_SIZE   4096

Definition at line 151 of file camacmap.cpp.

Referenced by daq_MapCamacSpace(), and daq_UnmapCamacSpace().

#define PAGES_PER_CRATE   ((SLOTS_PER_CRATE*SLOT_SIZE)/PAGE_SIZE)

Definition at line 154 of file camacmap.cpp.

Referenced by daq_MapCamacSpace(), and daq_UnmapCamacSpace().

#define SLOT_SIZE   2048

Definition at line 152 of file camacmap.cpp.

#define SLOTS_PER_CRATE   25

Definition at line 153 of file camacmap.cpp.

#define VMECRATES   16

Definition at line 140 of file camacmap.cpp.

Referenced by CESBranchAccess(), and WIENERBranchAccess().


Function Documentation

void CESBranchAccess ( int  nBranch  ) 

Definition at line 261 of file camacmap.cpp.

References BRANCHESINCRATE, CAMB, pBranchBases, VMECRATES, and vmeFds.

void daq_CloseCamacDriver ( void *  fid  ) 

Definition at line 233 of file camacmap.cpp.

void* daq_MapCamacSpace ( void *  fid  ) 

Definition at line 180 of file camacmap.cpp.

References BRANCHES, CRATES_PER_BRANCH, PAGE_SIZE, and PAGES_PER_CRATE.

void* daq_OpenCamacDriver (  ) 

Definition at line 164 of file camacmap.cpp.

void daq_UnmapCamacSpace ( void *  fd,
void *  pSpace 
)

Definition at line 211 of file camacmap.cpp.

References BRANCHES, CRATES_PER_BRANCH, PAGE_SIZE, and PAGES_PER_CRATE.

void WIENERBranchAccess ( int  nBranch  ) 

Map to a WIENER crate controller. These take up 0x20 << CAMN bytes of storage. We organize the WIENER crates so that a branch is one crate. This allows 8 WIENER crates to be controlled from one vme crate which, for now, is probably sufficient. If we need to do more, we need to do something more intelligent with the mapping of crates/branches/vme crates. So crates 0-7 are in VME crate 0 etc.

Definition at line 302 of file camacmap.cpp.

References BRANCHESINCRATE, CAMN, pBranchBases, VMECRATES, and vmeFds.


Variable Documentation

const char* Copyright = "(C) Copyright Michigan State University 2002, All rights reserved" [static]

Definition at line 17 of file camacmap.cpp.

void* pBranchBases[VMECRATES *BRANCHESINCRATE]

Definition at line 260 of file camacmap.cpp.

Referenced by CESBranchAccess(), and WIENERBranchAccess().

char* pCopyright = "(c) NSCL 1999, All rights reserved\n" [static]

Definition at line 159 of file camacmap.cpp.

void* vmeFds[VMECRATES] [static]

Access a branch.. This function ensures that a branch of the CAMAC system is mapped to process virtual memory. This function maintains set of 16*8 pointers to branch bases in the pBranchBases array. If the pointer is null, a branch is mapped, otherwise, this is a no-op.

Parameters:
pBranch (int [in]): Branch number to map.
Note:
Each vme crate can accept at most 8 branches. Therefore the branch number is really a VMEcrate/branch: VMEcrate*8+branchincrate

Definition at line 259 of file camacmap.cpp.

Referenced by CESBranchAccess(), and WIENERBranchAccess().


Generated on Wed Sep 17 08:38:10 2008 for NSCL Device support. by  doxygen 1.5.1