00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include <locale.h>
00034 #include <libintl.h>
00035
00036
00037 #include <fcntl.h>
00038 #include <sys/ioctl.h>
00039
00040 #include "glbvars.h"
00041 #include "comedi_hwi.h"
00042
00043
00044 #include "dsp-pci32/xsm/dpramdef.h"
00045 #include "dsp-pci32/xsm/xsmcmd.h"
00046
00047
00048 #define COMEDI_DEBUG(S) XSM_DEBUG (DBG_L4, "comedi_hwi_dev: " << S )
00049
00050
00051
00052
00053
00054
00055
00056 comedi_hwi_dev::comedi_hwi_dev(){
00057 COMEDI_DEBUG("open driver");
00058 max_points_per_line = 400000;
00059
00060
00061
00062
00063
00064 }
00065
00066
00067
00068
00069 comedi_hwi_dev::~comedi_hwi_dev(){
00070 COMEDI_DEBUG("close driver");
00071
00072 }
00073
00074 void comedi_hwi_dev::ExecCmd(int Cmd){
00075
00076
00077
00078
00079
00080
00081 }
00082
00083 int comedi_hwi_dev::WaitExec(int data){
00084 return 0;
00085 }
00086
00087
00088 void comedi_hwi_dev::SetParameter(PARAMETER_SET &hps, int scanflg){
00089 }
00090
00091 void comedi_hwi_dev::GetParameter(PARAMETER_SET &hps){
00092 }
00093
00094 size_t comedi_hwi_dev::ReadData(void *buf, size_t count) {
00095
00096
00097 return count;
00098 }
00099
00100 int comedi_hwi_dev::ReadScanData(int y_index, int num_srcs, Mem2d *m[MAX_SRCS_CHANNELS]){
00101 static time_t t0 = 0;
00102 int len = m[0]->GetNx();
00103 SHT *linebuffer = new SHT[len*num_srcs];
00104
00105
00106
00107
00108
00109 COMEDI_DEBUG("ReadData:" << y_index);
00110
00111 if (t0 == 0) t0 = time (NULL);
00112 int drift = (int) (time (NULL) - t0);
00113 if (y_index < 0)
00114 for (int k=0; k<m[0]->GetNy (); ++k)
00115 for (int i=0; i<num_srcs; ++i){
00116 for (int j=0; j<len; ++j){
00117 double x = rx*Dx + j*Dx + drift*5;
00118 double y = ry*Dy + k*Dx;
00119 Transform(&x, &y);
00120 linebuffer[i*len + j] = (SHT)(1000.*sin(x/100.*2*M_PI)
00121 *cos(k/100.*2*M_PI));
00122 }
00123 if (m[i])
00124 m[i]->PutDataLine (k, linebuffer+i*len);
00125 }
00126 else
00127 for (int i=0; i<num_srcs; ++i){
00128 for (int j=0; j<len; ++j){
00129 double x = rx*Dx + j*Dx + drift;
00130 double y = ry*Dy;
00131 Transform(&x, &y);
00132 linebuffer[i*len + j] = (SHT)(1000.*sin(x/100.*2*M_PI)
00133 *cos(y_index/100.*2*M_PI));
00134 }
00135 if (m[i])
00136 m[i]->PutDataLine (y_index, linebuffer+i*len);
00137 }
00138
00139
00140
00141
00142
00143
00144 delete[] linebuffer;
00145 return 0;
00146 }
00147
00148 int comedi_hwi_dev::ReadProbeData(int nsrcs, int nprobe, int kx, int ky, Mem2d *m, double scale){
00149
00150 return 1;
00151 }
00152
00153
00154
00155
00156
00157 gchar* comedi_hwi_dev::get_info(){
00158 return g_strdup("*--Gxsm Comedi HwI base class--*\n"
00159 "Comedi device: do not know\n"
00160 "*--Features--*\n"
00161 "SCAN: Yes\n"
00162 "PROBE: No\n"
00163 "ACPROBE: No\n"
00164 "*--EOF--*\n"
00165 );
00166 }