00001 #include <sys/conf.h> 00002 #include <sys/types.h> 00003 #include <sys/param.h> 00004 #include <sys/errno.h> 00005 #include <sys/file.h> 00006 #include <sys/conf.h> 00007 #include <sys/time.h> 00008 #include <sys/uio.h> 00009 #include <sys/map.h> 00010 #include <sys/debug.h> 00011 #include <sys/modctl.h> 00012 #include <sys/kmem.h> 00013 #include <sys/cmn_err.h> 00014 #include <sys/open.h> 00015 #include <sys/stat.h> 00016 #include <sys/ddi.h> 00017 #include <sys/sunddi.h> 00018 #include <fcntl.h> 00019 #include <values.h> 00020 #include <math.h> 00021 #include <stdio.h> 00022 #include <unistd.h> 00023 #include <pthread.h> 00024 00025 typedef int coord_t; 00026 typedef double velocity_t; 00027 typedef double mass_t; 00028 00029 struct Motion { 00030 int relative; 00031 coord_t pos; 00032 velocity_t vel; 00033 }; 00034 00035 typedef struct Motion* pmotion; 00036 00037 struct Translation { 00038 int device; 00039 const char* label; 00040 pthread_mutex_t modlock; 00041 pthread_cond_t offtrack; 00042 pthread_cond_t ontrack; 00043 pthread_t tid; 00044 int (*step)(int, int); 00045 coord_t pos; 00046 coord_t goalpos; 00047 coord_t backlash; 00048 coord_t maxlash; 00049 velocity_t vel; 00050 velocity_t goalvel; 00051 velocity_t scale; 00052 double attract; 00053 }; 00054 00055 typedef struct Translation* ptranslation; 00056 00057 struct Traject { 00058 pthread_attr_t tattr; 00059 int filedescr; 00060 int naxes; 00061 ptranslation axis; 00062 }; 00063 00064 typedef struct Traject* ptraject; 00065 00066 int openstage (ptraject stage, const char* path); 00067 int closestage (ptraject stage); 00068 void disposestage (ptraject stage); 00069 int movestage (ptraject stage, pmotion motn); 00070 00071 ptraject newxystage (void); 00072 00073 int start (int fd, ptranslation state, pthread_attr_t* ptattr); 00074 int stop (ptranslation state); 00075 int moveto (ptranslation state, pmotion goal); 00076 int where (ptranslation state, pmotion here); 00077 00078 void showreg (int fd); 00079 00080 00081 00082 00083 00084