00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #if !defined(rtlinux) && !defined(rtai)
00018 #ifndef UNDER_CE
00019 #include <stdio.h>
00020 #endif
00021 #include "rcs_prnt.hh"
00022 #include "emcglb.h"
00023 #endif
00024 #include "sim.h"
00025
00026
00027
00028 #ifndef __GNUC__
00029 #ifndef __attribute__
00030 #define __attribute__(x)
00031 #endif
00032 #endif
00033
00034 static char __attribute__((unused)) ident[] = "$Id: simaio.c,v 1.3 2001/06/11 17:57:22 wshackle Exp $";
00035
00036
00037
00038
00039
00040
00041
00042 #define SIM_AIO_MAX_INPUTS 8
00043 #define SIM_AIO_MAX_OUTPUTS 8
00044
00045 static double simAioInputs[SIM_AIO_MAX_INPUTS];
00046 static double simAioOutputs[SIM_AIO_MAX_OUTPUTS];
00047
00048 int simAioInit(const char * filename)
00049 {
00050 return 0;
00051 }
00052
00053 int simAioQuit(void)
00054 {
00055 return 0;
00056 }
00057
00058 int simAioMaxInputs(void)
00059 {
00060 return SIM_AIO_MAX_INPUTS;
00061 }
00062
00063 int simAioMaxOutputs(void)
00064 {
00065 return SIM_AIO_MAX_OUTPUTS;
00066 }
00067
00068 int simAioRead(int index, double *volts)
00069 {
00070 if (index < 0 || index >= SIM_AIO_MAX_INPUTS) {
00071 return -1;
00072 }
00073
00074 *volts = simAioInputs[index];
00075
00076 return 0;
00077 }
00078
00079 int simAioWrite(int index, double volts)
00080 {
00081 if (index < 0 || index >= SIM_AIO_MAX_OUTPUTS) {
00082 return -1;
00083 }
00084
00085 simAioOutputs[index] = volts;
00086
00087 #if !defined(rtlinux) && !defined(rtai)
00088 if (EMC_DEBUG & EMC_DEBUG_IO_POINTS) {
00089 rcs_print("[AOUT]\t%d\t%f\n", index, volts);
00090 }
00091 #endif
00092
00093 return 0;
00094 }
00095
00096 int simAioCheck(int index, double *volts)
00097 {
00098 if (index < 0 || index >= SIM_AIO_MAX_OUTPUTS) {
00099 return -1;
00100 }
00101
00102 *volts = simAioOutputs[index];
00103
00104 return 0;
00105 }