Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields   Globals  

globmem.hh

Go to the documentation of this file.
00001 
00002 /*************************************************************************
00003 * File: globmem.hh                                                       *
00004 * Authors: Fred Proctor, Will Shackleford                                *
00005 * Purpose: C++ Header file for the Communication Management System(CMS). *
00006 * Includes:                                                              *
00007 *          1. class GLOBMEM.                                             *
00008 * Note: GLOBMEM is used for communication between multiple VxWorks       *
00009 * boards in a single backplane.                                          *
00010 *************************************************************************/
00011 
00012 #ifndef GLOBMEM_HH
00013 #define GLOBMEM_HH
00014 
00015 /* Include Files */
00016 
00017 #ifdef VXWORKS
00018 extern "C"
00019 {
00020 #include <vxWorks.h>            /* NULL */
00021 #include <stddef.h>             /* size_t */
00022 }
00023 
00024 #else /* !VXWORKS */
00025 extern "C"
00026 {
00027 #include <stdio.h>              /* NULL */
00028 #include <stddef.h>             /* size_t */
00029 }
00030 
00031 #endif                          /* !VXWORKS */
00032 
00033 #include "cms.hh"
00034 
00035 #if defined(WIN32) && defined(USE_BIT3)
00036 #include "btapi.h"
00037 #endif
00038 
00039 
00040 
00041 /* default base address of most of our VME memory boards, which run from
00042    0x04E00000 to 0x04FFFFFF */
00043 #define GLOBMEM_DEFAULT_ADDRESS ((void *) 0x04E00000)
00044 #define GLOBMEM_DEFAULT_LOCK    ((void *) 0x04FFFF00)
00045 #define GLOBMEM_MASTER 1        /* exactly one process, the first to connect */
00046 #define GLOBMEM_NOMASTER 0      /* all other processes */
00047 
00048 
00049 enum GLOBMEM_ADDRESS_TYPE
00050 {
00051   INVALID_ADDRESS_TYPE,
00052   PROCESS_SPECIFIC_ADDRESS,
00053   HOST_SPECIFIC_ADDRESS,
00054   VME_ADDRESS,
00055   EISA_ADDRESS,
00056   GENERIC_ADDRESS,
00057   ISA_ADDRESS,
00058   PCI_ADDRESS
00059 };
00060 
00061 struct BL_ADDR_INFO;
00062 struct DMA_ADDR_INFO;
00063 
00064 class GLOBMEM:public CMS
00065 {
00066 public:
00067   GLOBMEM (char *bufline, char *procline, int set_to_server = 0,
00068            int set_to_master = 0);
00069     virtual ~ GLOBMEM ();
00070 
00071   CMS_STATUS main_access (void *user_data);
00072   GLOBMEM_ADDRESS_TYPE address_type;
00073   char address_string[CMS_CONFIG_LINELEN];
00074   unsigned long physical_address;
00075   virtual unsigned long get_physical_address (char *);
00076   PHYSMEM_HANDLE *physmem_handle;
00077   int get_access ();
00078   int release_access ();
00079 #ifdef VXWORKS
00080   CMS_STATUS write (void *user_data);
00081   CMS_STATUS write_if_read (void *user_data);
00082   int check_if_transfers_complete ();   /* Has DMA completed */
00083   CMS_STATUS read ();
00084   CMS_STATUS blocking_read (double);
00085   CMS_STATUS peek ();
00086 #endif
00087 private:
00088   int I_locked_the_task;        /* BOOLEAN: Was this globmem object the one */
00089   /* that locked the task if it is locked? */
00090 
00091   /* data buffer stuff */
00092   char address_type_name[CMS_CONFIG_LINELEN];   /* name of address space */
00093   /* or ascii code */
00094   char *local_locks;            /* address of short int for TAS mutex */
00095   double sem_delay;             /* Time to wait between polling the semaphore. */
00096   int read_only;
00097   BL_ADDR_INFO *bl_info;
00098   DMA_ADDR_INFO *dma_info;
00099 #ifdef VXWORKS
00100   char *my_lock;
00101   char *toggle_bit_address;
00102   char *was_read_address;
00103   SEM_ID bsem;
00104   int board_type;
00105 #endif
00106   int lock_bus;
00107   int use_dma;
00108 
00109 #if defined(USE_BIT3) && defined(WIN32)
00110   int unit;                     /* Which board to use */
00111   bt_desc_t btd;                /* Unit descriptor */
00112   char devname[BT_MAX_DEV_NAME];        /* Device name string */
00113   bt_error_t bt_status;         /* Mirror API return value */
00114   bt_dev_t bt_type;
00115   int bt_use_mmap;
00116   unsigned long remote_address;
00117   void *remote_p;               /* holds pointer to a memory region */
00118 #endif
00119 #ifdef VXWORKS
00120   int lock_task;
00121   int use_test_and_set;
00122 #endif
00123 };
00124 
00125 extern unsigned long (*get_physical_address_func) (char *);
00126 
00127 #endif /* !defined(GLOBMEM_HH) */

Generated on Sun Dec 2 15:56:49 2001 for rcslib by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001