FRONTPANEL: Add OS X support to sim_frontpanel, add build requirements to documentation.

This commit is contained in:
Mark Pizzolato 2015-02-17 16:36:23 -08:00
parent e1b7bb3b56
commit ce3e6358aa
2 changed files with 42 additions and 1 deletions

View file

@ -68,12 +68,44 @@ tp->tv_sec = (long)(now/10000000);
tp->tv_nsec = (now%10000000)*100; tp->tv_nsec = (now%10000000)*100;
return 0; return 0;
} }
#else #else /* NOT _WIN32 */
#include <unistd.h> #include <unistd.h>
#define msleep(n) usleep(1000*n) #define msleep(n) usleep(1000*n)
#include <sys/wait.h> #include <sys/wait.h>
#if defined (__APPLE__)
#define HAVE_STRUCT_TIMESPEC 1 /* OSX defined the structure but doesn't tell us */
#endif #endif
/* on HP-UX, CLOCK_REALTIME is enum, not preprocessor define */
#if !defined(CLOCK_REALTIME) && !defined(__hpux)
#define CLOCK_REALTIME 1
#define NEED_CLOCK_GETTIME 1
#if !defined(HAVE_STRUCT_TIMESPEC)
#define HAVE_STRUCT_TIMESPEC 1
#if !defined(_TIMESPEC_DEFINED)
#define _TIMESPEC_DEFINED
struct timespec {
long tv_sec;
long tv_nsec;
};
#endif /* _TIMESPEC_DEFINED */
#endif /* HAVE_STRUCT_TIMESPEC */
#if defined(NEED_CLOCK_GETTIME)
int clock_gettime(int clk_id, struct timespec *tp)
{
struct timeval cur;
struct timezone foo;
gettimeofday (&cur, &foo);
tp->tv_sec = cur.tv_sec;
tp->tv_nsec = cur.tv_usec*1000;
return 0;
}
#endif /* defined(NEED_CLOCK_GETTIME) */
#endif /* !defined(CLOCK_REALTIME) && !defined(__hpux) */
#endif /* NOT _WIN32 */
typedef struct { typedef struct {
char *name; char *name;
void *addr; void *addr;

View file

@ -29,6 +29,15 @@
simulator. Facilities provide ways to gather information from and to simulator. Facilities provide ways to gather information from and to
observe and control the state of a simulator. observe and control the state of a simulator.
Any application which wants to use this API needs to:
1) include this file in the application code
2) compile sim_frontpanel.c and sim_sock.c from the top level directory
of the simh source.
3) link the sim_frontpanel and sim_sock object modules and libpthreads
into the application.
4) Use a simh simulator built from the same version of simh that the
sim_frontpanel and sim_sock modules came from.
*/ */
#ifndef SIM_FRONTPANEL_H_ #ifndef SIM_FRONTPANEL_H_