renamed files

This commit is contained in:
Jeff Hill
2000-01-28 02:09:15 +00:00
parent 4126ec79f5
commit d184d47a67
20 changed files with 837 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
#define epicsExportSharedSymbols
#include "osiPoolStatus.h"
/*
* osiSufficentSpaceInPool ()
*
* @@@@@ not implemented @@@@@
*
*/
epicsShareFunc int epicsShareAPI osiSufficentSpaceInPool ()
{
return 1;
}

View File

@@ -0,0 +1,5 @@
#ifdef osdPoolStatush
#define osdPoolStatush
#endif /* osdPoolStatush */

View File

@@ -0,0 +1,49 @@
/* osiSem.c */
/*
* $Id$
* WIN32 version
*
* Author Jeffrey O. Hill
* johill@lanl.gov
* 505 665 1831
*
* Experimental Physics and Industrial Control System (EPICS)
*
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*/
#define epicsExportSharedSymbols
#include "shareLib.h"
#include "osiSem.h"
/*
* semBinaryShow ()
*
*/
epicsShareFunc void epicsShareAPI semBinaryShow (semId id)
{ }
/*
* semMutexShow ()
*
*/
epicsShareFunc void epicsShareAPI semMutexShow (semId id)
{ }

View File

@@ -0,0 +1,240 @@
/* osiSem.c */
/*
* $Id$
* WIN32 version
*
* Author Jeffrey O. Hill
* johill@lanl.gov
* 505 665 1831
*
* Experimental Physics and Industrial Control System (EPICS)
*
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*/
#ifndef osdSemh
#define osdSemh
#ifndef VC_EXTRALEAN
# define VC_EXTRALEAN
#endif
#ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
#endif
/* including less than this causes conflicts with winsock2.h :-( */
#include <winsock2.h>
#include "epicsAssert.h"
#include "cantProceed.h"
static const unsigned mSecPerSecOsdSem = 1000u;
/*
* semBinaryCreate ()
*/
epicsShareFunc INLINE semId epicsShareAPI semBinaryCreate (int initialState)
{
HANDLE newEvent;
newEvent = CreateEvent (NULL, FALSE, initialState?TRUE:FALSE, NULL);
return (semId) newEvent;
}
/*
* semBinaryDestroy ()
*/
epicsShareFunc INLINE void epicsShareAPI semBinaryDestroy (semId id)
{
HANDLE destroyee = (HANDLE) id;
BOOL success;
success = CloseHandle (destroyee);
assert (success);
}
/*
* semBinaryGive ()
*/
epicsShareFunc INLINE void epicsShareAPI semBinaryGive (semId id)
{
HANDLE event = (HANDLE) id;
BOOL status;
status = SetEvent (event);
assert (status);
}
/*
* semBinaryTake ()
*/
epicsShareFunc INLINE semTakeStatus epicsShareAPI semBinaryTake (semId id)
{
HANDLE event = (HANDLE) id;
DWORD status;
status = WaitForSingleObject (event, INFINITE);
if ( status == WAIT_OBJECT_0 ) {
return semTakeOK;
}
else {
return semTakeError;
}
}
/*
* semBinaryTakeTimeout ()
*/
epicsShareFunc INLINE semTakeStatus epicsShareAPI semBinaryTakeTimeout (semId id, double timeOut)
{
HANDLE event = (HANDLE) id;
DWORD status;
DWORD tmo;
tmo = (DWORD) (timeOut * mSecPerSecOsdSem);
status = WaitForSingleObject (event, tmo);
if ( status == WAIT_OBJECT_0 ) {
return semTakeOK;
}
else if (status == WAIT_TIMEOUT) {
return semTakeTimeout;
}
else {
return semTakeError;
}
}
/*
* semBinaryTakeNoWait ()
*/
epicsShareFunc INLINE semTakeStatus epicsShareAPI semBinaryTakeNoWait (semId id)
{
HANDLE mutex = (HANDLE) id;
DWORD status;
status = WaitForSingleObject (mutex, 0);
if ( status == WAIT_OBJECT_0 ) {
return semTakeOK;
}
else if (status == WAIT_TIMEOUT) {
return semTakeTimeout;
}
else {
return semTakeError;
}
}
/*
* semMutexCreate ()
*/
epicsShareFunc INLINE semId epicsShareAPI semMutexCreate (void)
{
HANDLE newMutex;
newMutex = CreateMutex (NULL, FALSE, NULL);
return (semId) newMutex;
}
/*
* semMutexDestroy ()
*/
epicsShareFunc INLINE void epicsShareAPI semMutexDestroy (semId id)
{
HANDLE destroyee = (HANDLE) id;
BOOL success;
success = CloseHandle (destroyee);
assert (success);
}
/*
* semMutexGive ()
*/
epicsShareFunc INLINE void epicsShareAPI semMutexGive (semId id)
{
HANDLE destroyee = (HANDLE) id;
BOOL success;
success = ReleaseMutex (destroyee);
assert (success);
}
/*
* semMutexTake ()
*/
epicsShareFunc INLINE semTakeStatus epicsShareAPI semMutexTake (semId id)
{
HANDLE mutex = (HANDLE) id;
DWORD status;
status = WaitForSingleObject (mutex, INFINITE);
if ( status == WAIT_OBJECT_0 ) {
return semTakeOK;
}
else {
return semTakeError;
}
}
/*
* semMutexTakeTimeout ()
*/
epicsShareFunc INLINE semTakeStatus epicsShareAPI semMutexTakeTimeout (semId id, double timeOut)
{
HANDLE mutex = (HANDLE) id;
DWORD status;
DWORD tmo;
tmo = (DWORD) (timeOut * mSecPerSecOsdSem);
status = WaitForSingleObject (mutex, tmo);
if ( status == WAIT_OBJECT_0 ) {
return semTakeOK;
}
else if (status == WAIT_TIMEOUT) {
return semTakeTimeout;
}
else {
return semTakeError;
}
}
/*
* semMutexTakeNoWait ()
*/
epicsShareFunc INLINE semTakeStatus epicsShareAPI semMutexTakeNoWait (semId id)
{
HANDLE mutex = (HANDLE) id;
DWORD status;
status = WaitForSingleObject (mutex, 0);
if ( status == WAIT_OBJECT_0 ) {
return semTakeOK;
}
else if (status == WAIT_TIMEOUT) {
return semTakeTimeout;
}
else {
return semTakeError;
}
}
#endif /* osdSemh */

View File

@@ -0,0 +1,11 @@
#define epicsExportSharedSymbols
#include "osiSigPipeIgnore.h"
/*
* NOOP
*/
epicsShareFunc void epicsShareAPI installSigPipeIgnore (void)
{
}

View File

@@ -0,0 +1,5 @@
#ifndef osdSigPipeIgnoreh
#define osdSigPipeIgnoreh
#endif /* osdSigPipeIgnoreh */

View File

View File

@@ -0,0 +1,57 @@
#ifndef osdThreadh
#define osdThreadh
#include <assert.h>
#ifndef VC_EXTRALEAN
# define VC_EXTRALEAN
#endif
#ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
#endif
/* including less than this causes conflicts with winsock2.h :-( */
#include <winsock2.h>
struct osdThreadPrivate
{
#ifdef __cpluplus
osdThreadPrivate ();
~osdThreadPrivate ();
#endif
DWORD key;
};
#ifdef __cpluplus
template <class T>
inline T *osiThreadPrivate<T>::get ()
{
return static_cast<T *> (TlsGetValue (this->key));
}
template <class T>
inline void osiThreadPrivate<T>::set (T *pIn)
{
BOOL stat = TlsSetValue (this->key, static_cast<void *> (pIn) );
assert (stat);
}
#else /* ifdef __cplusplus */
epicsShareFunc INLINE void epicsShareAPI threadPrivateSet (threadVarId id, void *pVal)
{
struct osdThreadPrivate *pPvt = (struct osdThreadPrivate *) id;
BOOL stat = TlsSetValue (pPvt->key, (void *) pVal );
assert (stat);
}
epicsShareFunc INLINE void * epicsShareAPI threadPrivateGet (threadVarId id)
{
struct osdThreadPrivate *pPvt = (struct osdThreadPrivate *) id;
return (void *) TlsGetValue (pPvt->key);
}
#endif /* ifdef/else __cplusplus */
#endif /* osdThreadh */

View File

@@ -0,0 +1,12 @@
#include <assert.h>
#include <windows.h>
#ifdef __cplusplus
#endif /* __cplusplus */

View File

@@ -0,0 +1,86 @@
/* $Id$
* assertVX.c
* Author: Jeff Hill
* Date: 02-27-95
*
* Experimental Physics and Industrial Control System (EPICS)
*
* Copyright 1991, the Regents of the University of California,
* and the University of Chicago Board of Governors.
*
* This software was produced under U.S. Government contracts:
* (W-7405-ENG-36) at the Los Alamos National Laboratory,
* and (W-31-109-ENG-38) at Argonne National Laboratory.
*
* Initial development by:
* The Controls and Automation Group (AT-8)
* Ground Test Accelerator
* Accelerator Technology Division
* Los Alamos National Laboratory
*
* Co-developed with
* The Controls and Computing Group
* Accelerator Systems Division
* Advanced Photon Source
* Argonne National Laboratory
*
*
***************************************************************************
*/
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>
#define epicsExportSharedSymbols
#include "osiThread.h"
#include "epicsPrint.h"
#include "epicsVersion.h"
#include "epicsAssert.h"
/*
* epicsAssert ()
*
* This forces assert failures into the log file and then
* calls threadSuspend() instead of exit() so that we can debug
* the problem.
*/
epicsShareFunc void epicsShareAPI epicsAssert (const char *pFile, const unsigned line, const char *pExp,
const char *pAuthorName)
{
threadId threadid = threadGetIdSelf();
epicsPrintf (
"\n\n\n%s: A call to \"assert (%s)\" failed in %s at %d\n",
threadGetName (threadid),
pExp,
pFile,
line);
if (pAuthorName) {
epicsPrintf (
"Please send a copy of the output from \"tt (%p)\" and a copy of this message\n",
threadid);
epicsPrintf (
"to \"%s\" (the author of this call to assert()) or \"tech-talk@aps.anl.gov\"\n",
pAuthorName);
}
else {
epicsPrintf (
"Please send a copy of the output from \"tt (%p)\" and a copy of this message\n",
threadid);
epicsPrintf (
"to the author or \"tech-talk@aps.anl.gov\"\n");
}
epicsPrintf ("This problem occurred in \"%s\"\n", epicsReleaseVersion);
threadSuspend (threadid);
}

View File

@@ -0,0 +1,33 @@
/* osi/os/vxWorks/osiFindGlobalSymbol */
#include <vxWorks.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <symLib.h>
#include <sysSymTbl.h>
#include "dbmf.h"
#include "osiFindGlobalSymbol.h"
void *osiFindGlobalSymbol(const char *name)
{
STATUS status;
SYM_TYPE type;
char *pvalue;
status = symFindByName( sysSymTbl, (char *)name, &pvalue, &type );
if(status) {
if(name[0] == '_' ) {
status = symFindByName(sysSymTbl, (char *)(name+1), &pvalue, &type);
} else {
char *pname;
pname = dbmfMalloc(strlen(name) + 2);
strcpy(pname,"_");
strcat(pname,name);
status = symFindByName(sysSymTbl,pname, &pvalue, &type);
dbmfFree(pname);
}
}
if(status) return(0);
return((void *)pvalue);
}

View File

@@ -0,0 +1,16 @@
/* osi/os/vxWorks/osiInterrupt.c */
/* Author: Marty Kraimer Date: 25AUG99 */
/********************COPYRIGHT NOTIFICATION**********************************
This software was developed under a United States Government license
described on the COPYRIGHT_UniversityOfChicago file included as part
of this distribution.
****************************************************************************/
/* Entire implementation is in header file */
static void dummy()
{
}

View File

@@ -0,0 +1,10 @@
#include <vxWorks.h>
#include <intLib.h>
#include <logLib.h>
#define interruptLock intLock
#define interruptUnlock intUnlock
#define interruptIsInterruptContext intContext
#define interruptContextMessage(MESSAGE) \
(logMsg((char *)(MESSAGE),0,0,0,0,0,0))

View File

@@ -0,0 +1,14 @@
#define epicsExportSharedSymbols
#include "osiPoolStatus.h"
/*
* osiSufficentSpaceInPool ()
*
* @@@@@ not implemented @@@@@
*
*/
epicsShareFunc int epicsShareAPI osiSufficentSpaceInPool ()
{
return 1;
}

View File

@@ -0,0 +1,14 @@
/* osiRing.c */
/* Author: Marty Kraimer Date: 09SEP99 */
/********************COPYRIGHT NOTIFICATION**********************************
This software was developed under a United States Government license
described on the COPYRIGHT_UniversityOfChicago file included as part
of this distribution.
****************************************************************************/
/* Entire implementation is in header file */
static void dummy()
{ }

View File

@@ -0,0 +1,20 @@
#ifndef osiRingh
#define osiRingh
#include <vxWorks.h>
#include <rngLib.h>
#define ringId RING_ID
#define ringCreate rngCreate
#define ringDelete rngDelete
#define ringGet rngBufGet
#define ringPut rngBufPut
#define ringFlush rngFlush
#define ringFreeBytes rngFreeBytes
#define ringUsedBytes rngNBytes
#define ringSize(ID) (rngFreeBytes((ID)) + rngNBytes((ID)))
#define ringIsEmpty rngIsEmpty
#define ringIsFull rngIsFull
#endif /* osiRingh */

View File

@@ -0,0 +1,29 @@
/* os/vxWorks/osiSem.c */
/* Author: Marty Kraimer Date: 25AUG99 */
/********************COPYRIGHT NOTIFICATION**********************************
This software was developed under a United States Government license
described on the COPYRIGHT_UniversityOfChicago file included as part
of this distribution.
****************************************************************************/
#include "osiSem.h"
#include "cantProceed.h"
semBinaryId semBinaryMustCreate(int initialState)
{
semBinaryId id;
id = semBinaryCreate(initialState);
if(!id) cantProceed("semBinaryMustCreate");
return(id);
}
semMutexId semMutexMustCreate(void)
{
semMutexId id;
id = semMutexCreate();
if(!id) cantProceed("semMutexMustCreate");
return(id);
}

View File

@@ -0,0 +1,53 @@
#ifndef osiSemh
#define osiSemh
#include <vxWorks.h>
#include <semLib.h>
#include <time.h>
#include <objLib.h>
#include <sysLib.h>
#include "epicsAssert.h"
#define semBinaryId SEM_ID
#define semMutexId SEM_ID
#define semEmpty SEM_EMPTY
#define semFull SEM_FULL
typedef enum {semTakeOK,semTakeTimeout,semTakeError} semTakeStatus;
#define semBinaryCreate(IS) semBCreate(SEM_Q_FIFO,(IS))
semBinaryId semBinaryMustCreate(int initialState);
#define semBinaryDestroy semDelete
#define semBinaryGive semGive
#define semBinaryTake(ID) \
((semTake((ID),WAIT_FOREVER)==OK ? semTakeOK : semTakeError))
#define semBinaryMustTake(ID) \
assert(semTake((ID),WAIT_FOREVER)==OK)
#define semBinaryTakeTimeout(ID,TIMEOUT) \
((semTake((ID),((int)((TIMEOUT)*sysClkRateGet())))==OK ? semTakeOK \
: (errno==S_objLib_OBJ_TIMEOUT ? semTakeTimeout : semTakeError)))
#define semBinaryTakeNoWait(ID) \
((semTake((ID),NO_WAIT)==OK ? semTakeOK \
: (errno==S_objLib_OBJ_UNAVAILABLE ? semTakeTimeout : semTakeError)))
#define semBinaryShow(ID) semShow((ID),1)
#define semMutexCreate() \
semMCreate(SEM_DELETE_SAFE|SEM_INVERSION_SAFE|SEM_Q_PRIORITY)
semMutexId semMutexMustCreate();
#define semMutexDestroy semDelete
#define semMutexGive semGive
#define semMutexTake(ID) \
((semTake((ID),WAIT_FOREVER)==OK ? semTakeOK : semTakeError))
#define semMutexMustTake(ID) \
assert(semTake((ID),WAIT_FOREVER)==OK)
#define semMutexTakeTimeout(ID,TIMEOUT) \
((semTake((ID),((int)((TIMEOUT)*sysClkRateGet())))==OK ? semTakeOK \
: (errno==S_objLib_OBJ_TIMEOUT ? semTakeTimeout : semTakeError)))
#define semMutexTakeNoWait(ID) \
((semTake((ID),NO_WAIT)==OK ? semTakeOK \
: (errno==S_objLib_OBJ_UNAVAILABLE ? semTakeTimeout : semTakeError)))
#define semMutexShow(ID) semShow((ID),1)
#endif /*osiSemh*/

View File

@@ -0,0 +1,11 @@
#define epicsExportSharedSymbols
#include "osiSigPipeIgnore.h"
/*
* NOOP
*/
epicsShareFunc void epicsShareAPI installSigPipeIgnore (void)
{
}

View File

@@ -0,0 +1,158 @@
/* osi/os/vxWorks/osiThread.c */
/* Author: Marty Kraimer Date: 25AUG99 */
/********************COPYRIGHT NOTIFICATION**********************************
This software was developed under a United States Government license
described on the COPYRIGHT_UniversityOfChicago file included as part
of this distribution.
****************************************************************************/
#include <stddef.h>
#include <string.h>
#include <stdlib.h>
#include <stddef.h>
#include <stdio.h>
#include <vxWorks.h>
#include <taskLib.h>
#include <sysLib.h>
#include "errlog.h"
#include "ellLib.h"
#include "osiThread.h"
#include "cantProceed.h"
/* Just map osi 0 to 99 into vx 100 to 199 */
/* remember that for vxWorks lower number means higher priority */
/* vx = 100 + (99 -osi) = 199 - osi*/
/* osi = 199 - vx */
static unsigned int getOsiPriorityValue(int ossPriority)
{
return(199-ossPriority);
}
static int getOssPriorityValue(unsigned int osiPriority)
{
return(199 - osiPriority);
}
#if CPU_FAMILY == MC680X0
#define ARCH_STACK_FACTOR 1
#elif CPU_FAMILY == SPARC
#define ARCH_STACK_FACTOR 2
#else
#define ARCH_STACK_FACTOR 2
#endif
/*
* threadGetStackSize ()
*/
epicsShareFunc unsigned int epicsShareAPI threadGetStackSize (threadStackSizeClass stackSizeClass)
{
static const unsigned stackSizeTable[threadStackBig+1] =
{4000*ARCH_STACK_FACTOR, 6000*ARCH_STACK_FACTOR, 11000*ARCH_STACK_FACTOR};
if (stackSizeClass<threadStackSmall) {
errlogPrintf("threadGetStackSize illegal argument (too small)");
return stackSizeTable[threadStackBig];
}
if (stackSizeClass>threadStackBig) {
errlogPrintf("threadGetStackSize illegal argument (too large)");
return stackSizeTable[threadStackBig];
}
return stackSizeTable[stackSizeClass];
}
threadId threadCreate(const char *name,
unsigned int priority, unsigned int stackSize,
THREADFUNC funptr,void *parm)
{
int tid;
if(stackSize<100) {
errlogPrintf("threadCreate %s illegal stackSize %d\n",name,stackSize);
return(0);
}
tid = taskSpawn((char *)name,getOssPriorityValue(priority),
VX_FP_TASK, stackSize, (FUNCPTR)funptr,(int)parm,0,0,0,0,0,0,0,0,0);
if(tid==0) {
errlogPrintf("threadCreate taskSpawn failure for %s\n",name);
return(0);
}
return((threadId)tid);
}
void threadSuspend(threadId id)
{
int tid = (int)id;
STATUS status;
status = taskSuspend(tid);
if(status) errlogPrintf("threadSuspend failed\n");
}
void threadResume(threadId id)
{
int tid = (int)id;
STATUS status;
status = taskResume(tid);
if(status) errlogPrintf("threadResume failed\n");
}
unsigned int threadGetPriority(threadId id)
{
int tid = (int)id;
STATUS status;
int priority = 0;
status = taskPriorityGet(tid,&priority);
if(status) errlogPrintf("threadGetPriority failed\n");
return(getOsiPriorityValue(priority));
}
void threadSetPriority(threadId id,unsigned int osip)
{
int tid = (int)id;
STATUS status;
int priority = 0;
priority = getOssPriorityValue(osip);
status = taskPrioritySet(tid,priority);
if(status) errlogPrintf("threadSetPriority failed\n");
}
int threadIsEqual(threadId id1, threadId id2)
{
return((id1==id2) ? 1 : 0);
}
int threadIsReady(threadId id)
{
int tid = (int)id;
return((int)taskIsReady(tid));
}
int threadIsSuspended(threadId id)
{
int tid = (int)id;
return((int)taskIsSuspended(tid));
}
void threadSleep(double seconds)
{
STATUS status;
status = taskDelay((int)(seconds*sysClkRateGet()));
if(status) errlogPrintf(0,"threadSleep\n");
}
threadId threadGetIdSelf(void)
{
return((threadId)taskIdSelf());
}