[PATCH 04/12] move "virtual os" definition to a seperate file

The virtual os table is not something ordinary devLib users
should know or care about.
This commit is contained in:
Michael Davidsaver
2010-05-25 13:58:44 +01:00
committed by Michael Davidsaver
parent ad8cd28f7d
commit 83adda7e6c
4 changed files with 116 additions and 58 deletions

View File

@@ -192,6 +192,7 @@ INC += epicsStdioRedirect.h
INC += epicsGetopt.h
INC += devLib.h
INC += devLibImpl.h
INC += osdVME.h
SRCS += epicsThread.cpp

View File

@@ -29,7 +29,10 @@ static const char sccsID[] = "@(#) $Id$";
#include "epicsMutex.h"
#include "errlog.h"
#include "ellLib.h"
#define NO_DEVLIB_COMPAT
#include "devLib.h"
#include "devLibImpl.h"
static ELLLIST addrAlloc[atLast];
static ELLLIST addrFree[atLast];

View File

@@ -46,6 +46,21 @@ typedef enum {
*/
extern const char *epicsAddressTypeName[];
#ifdef __cplusplus
}
#endif
/*
* To retain compatibility include everything by default
*/
#ifndef NO_DEVLIB_COMPAT
# include "devLibImpl.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
epicsShareFunc long devAddressMap(void); /* print an address map */
/*
@@ -280,64 +295,6 @@ epicsShareFunc void devLibA24Free(void *pBlock);
*/
#define devPtrAlignTest(PTR) (!(devCreateAlignmentMask(*PTR)&(long)(PTR)))
/*
* virtual OS layer for devLib.c
*/
typedef struct devLibVirtualOS {
/*
* maps logical address to physical address, but does not detect
* two device drivers that are using the same address range
*/
long (*pDevMapAddr) (epicsAddressType addrType, unsigned options,
size_t logicalAddress, size_t size, volatile void **ppPhysicalAddress);
/*
* a bus error safe "wordSize" read at the specified address which returns
* unsuccessful status if the device isnt present
*/
long (*pDevReadProbe) (unsigned wordSize, volatile const void *ptr, void *pValueRead);
/*
* a bus error safe "wordSize" write at the specified address which returns
* unsuccessful status if the device isnt present
*/
long (*pDevWriteProbe) (unsigned wordSize, volatile void *ptr, const void *pValueWritten);
/*
* connect ISR to a VME interrupt vector
* (required for backwards compatibility)
*/
long (*pDevConnectInterruptVME) (unsigned vectorNumber,
void (*pFunction)(void *), void *parameter);
/*
* disconnect ISR from a VME interrupt vector
* (required for backwards compatibility)
*/
long (*pDevDisconnectInterruptVME) (unsigned vectorNumber,
void (*pFunction)(void *));
/*
* enable VME interrupt level
*/
long (*pDevEnableInterruptLevelVME) (unsigned level);
/*
* disable VME interrupt level
*/
long (*pDevDisableInterruptLevelVME) (unsigned level);
/* malloc/free A24 address space */
void *(*pDevA24Malloc)(size_t nbytes);
void (*pDevA24Free)(void *pBlock);
long (*pDevInit)(void);
/*
* test if VME interrupt has an ISR connected
*/
int (*pDevInterruptInUseVME) (unsigned vectorNumber);
}devLibVirtualOS;
epicsShareExtern devLibVirtualOS *pdevLibVirtualOS;
/*
* error codes (and messages) associated with devLib.c
*/

View File

@@ -0,0 +1,97 @@
/*************************************************************************\
* Copyright (c) 2008 UChicago Argonne LLC, as Operator of Argonne
* National Laboratory.
* Copyright (c) 2002 The Regents of the University of California, as
* Operator of Los Alamos National Laboratory.
* EPICS BASE is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
\*************************************************************************/
/* devLibImpl.h */
/* */
/*
* Original Author: Marty Kraimer
* Author: Jeff Hill
* Date: 03-10-93
*/
#ifndef INCdevLibImplh
#define INCdevLibImplh 1
#include "dbDefs.h"
#include "shareLib.h"
#include "devLib.h"
#ifdef __cplusplus
extern "C" {
#endif
/*
* virtual OS layer for devLib.c
*
* The global virtual OS table pdevLibVirtualOS controls
* the behaviour of the functions defined in devLib.h.
* All of which call into the functions found in this table
* to perform system specific tasks.
*/
typedef struct devLibVirtualOS {
/*
* maps logical address to physical address, but does not detect
* two device drivers that are using the same address range
*/
long (*pDevMapAddr) (epicsAddressType addrType, unsigned options,
size_t logicalAddress, size_t size, volatile void **ppPhysicalAddress);
/*
* a bus error safe "wordSize" read at the specified address which returns
* unsuccessful status if the device isnt present
*/
long (*pDevReadProbe) (unsigned wordSize, volatile const void *ptr, void *pValueRead);
/*
* a bus error safe "wordSize" write at the specified address which returns
* unsuccessful status if the device isnt present
*/
long (*pDevWriteProbe) (unsigned wordSize, volatile void *ptr, const void *pValueWritten);
/*
* connect ISR to a VME interrupt vector
* (required for backwards compatibility)
*/
long (*pDevConnectInterruptVME) (unsigned vectorNumber,
void (*pFunction)(void *), void *parameter);
/*
* disconnect ISR from a VME interrupt vector
* (required for backwards compatibility)
*/
long (*pDevDisconnectInterruptVME) (unsigned vectorNumber,
void (*pFunction)(void *));
/*
* enable VME interrupt level
*/
long (*pDevEnableInterruptLevelVME) (unsigned level);
/*
* disable VME interrupt level
*/
long (*pDevDisableInterruptLevelVME) (unsigned level);
/* malloc/free A24 address space */
void *(*pDevA24Malloc)(size_t nbytes);
void (*pDevA24Free)(void *pBlock);
long (*pDevInit)(void);
/*
* test if VME interrupt has an ISR connected
*/
int (*pDevInterruptInUseVME) (unsigned vectorNumber);
}devLibVirtualOS;
epicsShareExtern devLibVirtualOS *pdevLibVirtualOS;
#ifdef __cplusplus
}
#endif
#endif /* INCdevLibImplh */