rmlib.h 11.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
/* $Id: rmlib.h,v 1.1 2002/12/13 12:17:20 hin Exp $  */

/*********************************************************************************
 *                                                                               *
 * Copyright (C) 1993 - 2000                                                     * 
 *         Dolphin Interconnect Solutions AS                                     *
 *                                                                               *
 * This program is free software; you can redistribute it and/or modify          * 
 * it under the terms of the GNU Lesser General Public License as published by   *
 * the Free Software Foundation; either version 2.1 of the License,              *
 * or (at your option) any later version.                                        *
 *                                                                               *
 * This program is distributed in the hope that it will be useful,               *
 * but WITHOUT ANY WARRANTY; without even the implied warranty of                *
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                 * 
 * GNU General Public License for more details.                                  *
 *                                                                               *
 * You should have received a copy of the GNU Lesser General Public License      *
 * along with this program; if not, write to the Free Software                   *
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.   *
 *                                                                               *
 *                                                                               *
 *********************************************************************************/ 

/********************************************************************************/
/*  This header file contains the declarations of the SCI Reflective Memory     */
/*  library rmlib. The implementation of the library functions is in rmlib.c.   */
/*  The library contains all the functions that operate on the reflective       */
/*  memory.                                                                     */
/*                                                                              */
/*  NB!                                                                         */  
/*                                                                              */
/*  DOLPHIN'S SCI REFLECTIVE MEMORY FILES ARE UNDER DEVELOPMENT AND MAY CHANGE. */
/*  PLEASE CONTACT DOLPHIN FOR FURTHER INFORMATION.                             */
/*                                                                              */
/*                                                                              */
/********************************************************************************/

#include "sisci_error.h"
#include "sisci_api.h"
#include "sisci_demolib.h"
#include "sisci_types.h"

unsigned int seqerr, syncseqerr;

#ifndef _RMLIB_H
#define _RMLIB_H


#if defined(_REENTRANT)

#define _RMLIB_EXPAND_NAME(name)  _RMLIB_MT_ ## name

#else

#define _RMLIB_EXPAND_NAME(name)  _RMLIB_ST_ ## name

#endif

#ifdef __sparc
#define CACHE_SIZE 2097152
#else
#define CACHE_SIZE 8192
#endif

/*********************************************************************************/
/*                         FLAG VALUES                                           */
/*********************************************************************************/

#define REFLECT_ERRCHECK          0x2

struct ReflectiveMemorySpace {    
    unsigned int        localAdapterNo;
    unsigned int        localNodeId;
    unsigned int        remoteNodeId;
    sci_desc_t          sd;
    sci_desc_t          syncsd;
    sci_map_t           localMap;
    sci_map_t           remoteMap;
    unsigned int        localSegmentId;
    unsigned int        remoteSegmentId;
    unsigned int        syncSegmentId;
    unsigned int        sync_rSegmentId;
    unsigned int        segmentSize;
    unsigned int        *localMapAddr;
    volatile unsigned int *remoteMapAddr;
    sci_local_segment_t  localSegment;
    sci_remote_segment_t remoteSegment;
    sci_local_segment_t  syncSegment;
    sci_remote_segment_t sync_rSegment;
    sci_map_t            syncMap;
    sci_map_t            sync_rMap;
    sci_sequence_t       syncsequence;
    sci_sequence_t       sequence;    
    unsigned int         protection;
    unsigned int         retry_value;
    sci_sequence_status_t   sequenceStatus, syncsequenceStatus;
    volatile unsigned int *syncMapAddr;
    volatile unsigned int *sync_rMapAddr;    
};

/*********************************************************************************/
/*          P R I N T  R E F L E C T I V E   M E M O R Y   S P A C E             */
/*                                                                               */
/*********************************************************************************/
#define ReflectPrintParameters             _RMLIB_EXPAND_NAME(ReflectPrintParameters)
void ReflectPrintParameters(FILE *stream, struct ReflectiveMemorySpace RM_space);

/*********************************************************************************/
/*      			  R E F L E C T   D M A   S E T U P                          */
/*                                                                               */
/*********************************************************************************/
#define ReflectDmaSetup             _RMLIB_EXPAND_NAME(ReflectDmaSetup)
sci_error_t ReflectDmaSetup(struct ReflectiveMemorySpace RM_space, sci_dma_queue_t *dmaQueue);

/*********************************************************************************/
/*      			  R E F L E C T   D M A   R E M O V E                        */
/*                                                                               */
/*********************************************************************************/
#define ReflectDmaRemove             _RMLIB_EXPAND_NAME(ReflectDmaRemove)
sci_error_t ReflectDmaRemove(sci_dma_queue_t dmaQueue);

/*********************************************************************************/
/*   	    			R E F L E C T   D M A   R U N                            */
/*                                                                               */
/*********************************************************************************/
#define ReflectDmaRun             _RMLIB_EXPAND_NAME(ReflectDmaRun)
sci_error_t ReflectDmaRun(struct ReflectiveMemorySpace RM_space, 
                           unsigned int* privateSrc, 
                           unsigned int size, 
                           unsigned int offset, 
                           sci_dma_queue_t dmaQueue);
/*********************************************************************************/
/*          C L O S E   R E F L E C T I V E   M E M O R Y   S P A C E            */
/*                                                                               */
/*********************************************************************************/
#define ReflectClose             _RMLIB_EXPAND_NAME(ReflectClose)
sci_error_t ReflectClose(struct ReflectiveMemorySpace RM_space, unsigned int segment_no);

/*********************************************************************************/
/*           O P E N  R E F L E C T I V E   M E M O R Y   S P A C E              */
/*                                                                               */
/*********************************************************************************/
#define ReflectOpen             _RMLIB_EXPAND_NAME(ReflectOpen)
sci_error_t ReflectOpen(struct ReflectiveMemorySpace *RM_space, 
                       unsigned int size, 
                       unsigned int segment_no,
                       unsigned int localAdapterNo, 
                       unsigned int remoteNodeId, 
                       unsigned int protection, 
                       unsigned int retry_value);

/*********************************************************************************/
/* 			  	    R E F L E C T   G E T   A C C E S S                          */
/*                                                                               */
/*********************************************************************************/
#define ReflectGetAccess             _RMLIB_EXPAND_NAME(ReflectGetAccess)
sci_error_t ReflectGetAccess(struct ReflectiveMemorySpace *RM_space);

/*********************************************************************************/
/* 			  	 R E F L E C T   R E L E A S E   A C C E S S                     */
/*                                                                               */
/*********************************************************************************/
#define ReflectReleaseAccess             _RMLIB_EXPAND_NAME(ReflectReleaseAccess)
sci_error_t ReflectReleaseAccess(struct ReflectiveMemorySpace *RM_space);

/*********************************************************************************/
/*   	    			  	R E F L E C T   D M A                                */
/*                                                                               */
/*********************************************************************************/
#define ReflectDma             _RMLIB_EXPAND_NAME(ReflectDma)
sci_error_t ReflectDma(struct ReflectiveMemorySpace RM_space,
                           unsigned int* privateSrc, 
                           unsigned int size, 
                           unsigned int offset);

/*********************************************************************************/
/*   	    	         R E F L E C T   M E M C O P Y                           */
/*                                                                               */
/*********************************************************************************/
#define ReflectMemCopy             _RMLIB_EXPAND_NAME(ReflectMemCopy)
sci_error_t ReflectMemCopy(struct ReflectiveMemorySpace RM_space,
                           unsigned int* privateSrc, 
                           unsigned int size, 
                           unsigned int offset,
                           unsigned int flags);

/*********************************************************************************/
/*   	    			  	R E F L E C T   S E T                                */
/*                                                                               */
/*********************************************************************************/
#define ReflectSet             _RMLIB_EXPAND_NAME(ReflectSet)
sci_error_t ReflectSet(struct ReflectiveMemorySpace RM_space,
                           unsigned int value,
                           unsigned int size,                            
                           unsigned int offset,
                           unsigned int flags
                           );

/*********************************************************************************/
/*   	    			R E F L E C T   P R I N T                                */
/*                                                                               */
/*********************************************************************************/
#define ReflectPrint             _RMLIB_EXPAND_NAME(ReflectPrint)
sci_error_t ReflectPrint(FILE *stream, 
                          struct ReflectiveMemorySpace RM_space,
                          unsigned int size, 
                          unsigned int offset
                          );


#endif