diff --git a/configs/attic/demo_mazak/README b/configs/attic/demo_mazak/README deleted file mode 100644 index e86942d0578..00000000000 --- a/configs/attic/demo_mazak/README +++ /dev/null @@ -1,5 +0,0 @@ -Demo_mazak is a complex set of HAL drivers. These include the Motenc-Lite motion card, a PMDX parport card, and a general purpose ISA slot IO card. This setup is used for the Mazak V5 at Cardinal Engineering and is included here as an example of a way to spread HAL abilities across a number of devices. - -This demo includes an example of using a parallel port to read a handwheel encoder. It brings in ClassicLadder to handle most of the machine logic for gear and tool change. - -Don't expect to be able to run this as is unless you have a matching set of hardware. Without the exact set of devices you can still study the hal files to see how many of these things are accomplished. diff --git a/configs/attic/demo_mazak/demo_mazak.clp b/configs/attic/demo_mazak/demo_mazak.clp deleted file mode 100644 index 2b71e563f8a..00000000000 --- a/configs/attic/demo_mazak/demo_mazak.clp +++ /dev/null @@ -1,527 +0,0 @@ -_FILES_CLASSICLADDER -_FILE-timers.csv -; Timers : -; Base(see classicladder.h),Preset -2,20 -2,15 -2,2 -2,1 -2,5 -2,5 -2,2 -2,3 -2,3 -2,3 -2,20 -2,5 -1,0 -1,0 -1,0 -1,0 -1,0 -1,0 -1,0 -1,0 -_/FILE-timers.csv -_FILE-monostables.csv -; Monostables : -; Base(see classicladder.h),Preset -1,5 -1,0 -1,0 -1,0 -1,0 -1,0 -1,0 -1,0 -1,0 -1,0 -_/FILE-monostables.csv -_FILE-counters.csv -; Counters : -; Preset -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -_/FILE-counters.csv -_FILE-arithmetic_expressions.csv -; Arithmetic expressions : -; Compare or Operate ones - - - - -_/FILE-arithmetic_expressions.csv -_FILE-rung_0.csv -; Rung : -; all the blocks with the following format : -; type (see classicladder.h) - ConnectedWithTop - VarType (see classicladder.h) / VarOffset -#VER=2.0 -#LABEL= -#COMMENT= -#PREVRUNG=0 -#NEXTRUNG=1 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -_/FILE-rung_0.csv -_FILE-rung_1.csv -; Rung : -; all the blocks with the following format : -; type (see classicladder.h) - ConnectedWithTop - VarType (see classicladder.h) / VarOffset -#VER=2.0 -#LABEL=Estop off -#COMMENT=Axis/Hydraulic Power -#PREVRUNG=8 -#NEXTRUNG=14 -1-0-60/22 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 99-0-0/0 , 10-0-0/0 , 9-0-0/0 , 50-0-60/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 99-0-0/0 , 99-0-0/0 , 0-0-0/0 , 0-0-60/1 -1-0-60/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 99-0-0/0 , 10-0-0/1 , 9-0-0/0 , 50-0-60/1 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 99-0-0/0 , 99-0-0/0 , 0-0-0/0 , 0-0-0/0 -1-0-60/1 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 50-0-60/9 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -_/FILE-rung_1.csv -_FILE-rung_2.csv -; Rung : -; all the blocks with the following format : -; type (see classicladder.h) - ConnectedWithTop - VarType (see classicladder.h) / VarOffset -#VER=2.0 -#LABEL=Estop off -#COMMENT=Initialize Motion -#PREVRUNG=14 -#NEXTRUNG=3 -1-0-60/1 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 99-0-0/0 , 10-0-0/3 , 9-0-0/0 , 50-0-60/5 -0-0-60/1 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 99-0-0/0 , 99-0-0/0 , 0-0-0/0 , 0-0-0/0 -1-0-60/5 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 99-0-0/0 , 11-0-0/0 , 9-0-0/0 , 50-0-0/1 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 99-0-0/0 , 99-0-0/0 , 0-0-0/0 , 99-0-0/0 -1-0-0/1 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 50-0-0/10 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -_/FILE-rung_2.csv -_FILE-rung_3.csv -; Rung : -; all the blocks with the following format : -; type (see classicladder.h) - ConnectedWithTop - VarType (see classicladder.h) / VarOffset -#VER=2.0 -#LABEL=Mach On -#COMMENT=Amp Fault Mask -#PREVRUNG=2 -#NEXTRUNG=9 -1-0-50/1 , 9-0-50/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 99-0-0/0 , 10-0-0/2 , 9-0-0/0 , 50-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 99-0-0/0 , 99-0-0/0 , 0-0-0/0 , 0-0-0/0 -1-0-0/0 , 9-0-0/0 , 2-0-50/2 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 50-0-60/2 -0-0-0/0 , 9-1-0/0 , 2-0-50/3 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 50-0-60/3 -0-0-0/0 , 9-1-0/0 , 2-0-50/4 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 50-0-60/4 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -_/FILE-rung_3.csv -_FILE-rung_4.csv -; Rung : -; all the blocks with the following format : -; type (see classicladder.h) - ConnectedWithTop - VarType (see classicladder.h) / VarOffset -#VER=2.0 -#LABEL= -#COMMENT=Magazine Forward -#PREVRUNG=17 -#NEXTRUNG=7 -1-0-50/10 , 9-0-0/0 , 9-0-0/0 , 1-0-60/10 , 2-0-50/11 , 9-0-0/0 , 9-0-0/0 , 2-0-60/11 , 9-0-0/0 , 50-0-60/10 -0-0-0/0 , 1-1-50/26 , 1-0-50/27 , 9-0-50/0 , 1-0-50/16 , 0-1-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 9-1-0/0 , 1-0-50/18 , 9-0-0/0 , 1-0-50/14 , 0-1-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 2-1-50/26 , 9-0-0/0 , 1-0-50/12 , 1-0-50/16 , 0-1-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -_/FILE-rung_4.csv -_FILE-rung_5.csv -; Rung : -; all the blocks with the following format : -; type (see classicladder.h) - ConnectedWithTop - VarType (see classicladder.h) / VarOffset -#VER=2.0 -#LABEL= -#COMMENT=Tool Push Buttons -#PREVRUNG=6 -#NEXTRUNG=-1 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -1-0-50/10 , 9-0-50/0 , 1-0-50/13 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 50-0-0/7 -0-0-0/0 , 1-1-0/7 , 9-0-0/0 , 2-0-50/14 , 9-0-0/0 , 0-1-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-60/13 -0-0-0/0 , 9-1-0/0 , 1-0-50/15 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 50-0-0/8 -0-0-0/0 , 1-1-0/8 , 9-0-0/0 , 2-0-50/16 , 9-0-0/0 , 0-1-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -_/FILE-rung_5.csv -_FILE-rung_6.csv -; Rung : -; all the blocks with the following format : -; type (see classicladder.h) - ConnectedWithTop - VarType (see classicladder.h) / VarOffset -#VER=2.0 -#LABEL= -#COMMENT= -#PREVRUNG=22 -#NEXTRUNG=5 -9-0-0/0 , 1-0-50/31 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 1-0-0/16 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 50-0-0/15 -0-0-0/0 , 1-1-0/15 , 0-1-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -_/FILE-rung_6.csv -_FILE-rung_7.csv -; Rung : -; all the blocks with the following format : -; type (see classicladder.h) - ConnectedWithTop - VarType (see classicladder.h) / VarOffset -#VER=2.0 -#LABEL= -#COMMENT=FIXME Prox -#PREVRUNG=4 -#NEXTRUNG=23 -2-0-60/17 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 99-0-0/0 , 10-0-0/10 , 9-0-0/0 , 50-0-60/27 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 99-0-0/0 , 99-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -_/FILE-rung_7.csv -_FILE-rung_8.csv -; Rung : -; all the blocks with the following format : -; type (see classicladder.h) - ConnectedWithTop - VarType (see classicladder.h) / VarOffset -#VER=2.0 -#LABEL= -#COMMENT=Main Estop -#PREVRUNG=-1 -#NEXTRUNG=1 -1-0-50/0 , 1-0-50/20 , 9-0-0/0 , 9-0-0/0 , 1-0-50/21 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 50-0-60/22 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 1-1-60/22 , 0-1-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -_/FILE-rung_8.csv -_FILE-rung_9.csv -; Rung : -; all the blocks with the following format : -; type (see classicladder.h) - ConnectedWithTop - VarType (see classicladder.h) / VarOffset -#VER=2.0 -#LABEL= -#COMMENT=gear shift in progress -#PREVRUNG=3 -#NEXTRUNG=10 -1-0-50/5 , 2-0-50/6 , 1-0-50/23 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 50-0-60/8 -2-0-50/5 , 2-0-50/7 , 1-1-60/28 , 0-1-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-60/8 , 0-0-50/9 , 0-0-50/25 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/7 , 0-0-0/0 , 0-0-60/24 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -_/FILE-rung_9.csv -_FILE-rung_10.csv -; Rung : -; all the blocks with the following format : -; type (see classicladder.h) - ConnectedWithTop - VarType (see classicladder.h) / VarOffset -#VER=2.0 -#LABEL= -#COMMENT=ok to disengage -#PREVRUNG=9 -#NEXTRUNG=11 -1-0-60/8 , 1-0-50/9 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 99-0-0/0 , 10-0-0/4 , 9-0-0/0 , 50-0-0/3 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 99-0-0/0 , 99-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -_/FILE-rung_10.csv -_FILE-rung_11.csv -; Rung : -; all the blocks with the following format : -; type (see classicladder.h) - ConnectedWithTop - VarType (see classicladder.h) / VarOffset -#VER=2.0 -#LABEL= -#COMMENT=ok to engage -#PREVRUNG=10 -#NEXTRUNG=12 -1-0-50/8 , 1-0-0/3 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 99-0-0/0 , 10-0-0/5 , 9-0-0/0 , 50-0-0/4 -1-0-0/4 , 0-1-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 99-0-0/0 , 99-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -_/FILE-rung_11.csv -_FILE-rung_12.csv -; Rung : -; all the blocks with the following format : -; type (see classicladder.h) - ConnectedWithTop - VarType (see classicladder.h) / VarOffset -#VER=2.0 -#LABEL= -#COMMENT=engage low -#PREVRUNG=11 -#NEXTRUNG=16 -1-0-60/6 , 2-0-0/3 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 2-0-60/7 , 9-0-0/0 , 50-0-60/6 -1-0-50/5 , 1-0-0/4 , 0-1-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -_/FILE-rung_12.csv -_FILE-rung_13.csv -; Rung : -; all the blocks with the following format : -; type (see classicladder.h) - ConnectedWithTop - VarType (see classicladder.h) / VarOffset -#VER=2.0 -#LABEL= -#COMMENT=Feed Hold -#PREVRUNG=15 -#NEXTRUNG=24 -1-0-50/22 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 50-0-60/26 -1-1-50/23 , 2-0-60/24 , 0-1-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -_/FILE-rung_13.csv -_FILE-rung_14.csv -; Rung : -; all the blocks with the following format : -; type (see classicladder.h) - ConnectedWithTop - VarType (see classicladder.h) / VarOffset -#VER=2.0 -#LABEL= -#COMMENT=Spindle Drive RUN -#PREVRUNG=1 -#NEXTRUNG=2 -1-0-60/22 , 1-0-50/23 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 50-0-60/23 -103-1-60/28 , 1-1-60/28 , 103-1-0/0 , 103-0-0/0 , 103-1-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -103-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 103-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -_/FILE-rung_14.csv -_FILE-rung_15.csv -; Rung : -; all the blocks with the following format : -; type (see classicladder.h) - ConnectedWithTop - VarType (see classicladder.h) / VarOffset -#VER=2.0 -#LABEL= -#COMMENT=Spindle Status Out -#PREVRUNG=16 -#NEXTRUNG=13 -1-0-50/9 , 2-0-60/28 , 2-0-60/8 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 99-0-0/0 , 10-0-0/8 , 9-0-0/0 , 50-0-60/24 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 99-0-0/0 , 99-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -1-0-50/9 , 1-0-50/24 , 1-0-60/28 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 99-0-0/0 , 10-0-0/9 , 9-0-0/0 , 50-0-60/25 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 99-0-0/0 , 99-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -_/FILE-rung_15.csv -_FILE-rung_16.csv -; Rung : -; all the blocks with the following format : -; type (see classicladder.h) - ConnectedWithTop - VarType (see classicladder.h) / VarOffset -#VER=2.0 -#LABEL= -#COMMENT=engage high -#PREVRUNG=12 -#NEXTRUNG=15 -1-0-60/7 , 2-0-0/3 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 2-0-60/6 , 9-0-0/0 , 50-0-60/7 -2-1-50/5 , 1-0-0/4 , 0-1-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -_/FILE-rung_16.csv -_FILE-rung_17.csv -; Rung : -; all the blocks with the following format : -; type (see classicladder.h) - ConnectedWithTop - VarType (see classicladder.h) / VarOffset -#VER=2.0 -#LABEL= -#COMMENT=Magazine Reverse -#PREVRUNG=24 -#NEXTRUNG=4 -1-0-50/10 , 9-0-0/0 , 9-0-0/0 , 1-0-60/11 , 2-0-50/11 , 9-0-0/0 , 9-0-0/0 , 2-0-60/10 , 9-0-0/0 , 50-0-60/11 -0-0-0/0 , 1-1-50/26 , 1-0-50/28 , 9-0-50/0 , 1-0-50/16 , 0-1-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 9-1-0/0 , 1-0-50/19 , 9-0-0/0 , 1-0-50/14 , 0-1-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -_/FILE-rung_17.csv -_FILE-rung_18.csv -; Rung : -; all the blocks with the following format : -; type (see classicladder.h) - ConnectedWithTop - VarType (see classicladder.h) / VarOffset -#VER=2.0 -#LABEL= -#COMMENT=Load/Unload -#PREVRUNG=25 -#NEXTRUNG=19 -1-0-50/10 , 1-0-0/16 , 1-0-50/30 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 2-0-0/15 , 50-0-60/12 -0-0-0/0 , 0-1-60/12 , 1-1-50/14 , 0-1-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-1-0/0 -0-0-0/0 , 2-1-50/30 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 1-0-0/15 , 0-1-0/0 -0-0-0/0 , 2-1-50/38 , 0-1-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-1-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 2-1-60/12 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 50-0-60/13 -_/FILE-rung_18.csv -_FILE-rung_19.csv -; Rung : -; all the blocks with the following format : -; type (see classicladder.h) - ConnectedWithTop - VarType (see classicladder.h) / VarOffset -#VER=2.0 -#LABEL= -#COMMENT=60 deg rotate -#PREVRUNG=18 -#NEXTRUNG=20 -1-0-50/10 , 1-0-0/16 , 1-0-60/25 , 1-0-50/14 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 2-0-0/15 , 50-0-60/16 -0-0-0/0 , 0-1-0/0 , 1-1-60/16 , 0-1-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-1-0/0 -0-0-0/0 , 2-1-50/36 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 1-0-0/15 , 0-1-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -_/FILE-rung_19.csv -_FILE-rung_20.csv -; Rung : -; all the blocks with the following format : -; type (see classicladder.h) - ConnectedWithTop - VarType (see classicladder.h) / VarOffset -#VER=2.0 -#LABEL= -#COMMENT=Unclamp -#PREVRUNG=19 -#NEXTRUNG=21 -1-0-50/10 , 1-0-0/16 , 1-0-50/32 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 2-0-0/15 , 50-0-60/18 -0-0-0/0 , 0-1-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-1-0/0 -0-0-0/0 , 2-1-50/34 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 1-0-0/15 , 0-1-0/0 -0-0-0/0 , 0-1-50/17 , 0-0-50/23 , 0-0-0/16 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-1-0/0 -0-0-0/0 , 1-1-50/17 , 2-0-50/23 , 2-0-0/16 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 0-1-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -_/FILE-rung_20.csv -_FILE-rung_21.csv -; Rung : -; all the blocks with the following format : -; type (see classicladder.h) - ConnectedWithTop - VarType (see classicladder.h) / VarOffset -#VER=2.0 -#LABEL= -#COMMENT=Extend/Retract -#PREVRUNG=20 -#NEXTRUNG=22 -1-0-50/10 , 1-0-0/16 , 1-0-50/37 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 2-0-0/15 , 50-0-60/14 -0-0-0/0 , 0-1-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-1-0/0 -0-0-0/0 , 2-1-50/31 , 9-0-0/0 , 2-0-60/25 , 1-0-60/14 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 1-0-0/15 , 0-1-0/0 -0-0-0/0 , 0-1-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-1-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 2-1-60/14 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 50-0-60/15 -_/FILE-rung_21.csv -_FILE-rung_22.csv -; Rung : -; all the blocks with the following format : -; type (see classicladder.h) - ConnectedWithTop - VarType (see classicladder.h) / VarOffset -#VER=2.0 -#LABEL= -#COMMENT=Rotate 180 -#PREVRUNG=21 -#NEXTRUNG=6 -1-0-50/10 , 1-0-0/16 , 1-0-50/33 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 2-0-0/15 , 50-0-60/17 -0-0-0/0 , 0-1-50/34 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-1-0/0 -0-0-0/0 , 1-1-0/16 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 1-0-0/15 , 0-1-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -_/FILE-rung_22.csv -_FILE-rung_23.csv -; Rung : -; all the blocks with the following format : -; type (see classicladder.h) - ConnectedWithTop - VarType (see classicladder.h) / VarOffset -#VER=2.0 -#LABEL= -#COMMENT= -#PREVRUNG=7 -#NEXTRUNG=26 -1-0-50/10 , 3-0-50/35 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 2-0-0/15 , 50-0-0/16 -0-0-0/0 , 1-1-0/16 , 0-1-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-1-0/0 -0-0-0/0 , 2-1-50/16 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 1-0-0/15 , 0-1-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -_/FILE-rung_23.csv -_FILE-rung_24.csv -; Rung : -; all the blocks with the following format : -; type (see classicladder.h) - ConnectedWithTop - VarType (see classicladder.h) / VarOffset -#VER=2.0 -#LABEL= -#COMMENT= -#PREVRUNG=13 -#NEXTRUNG=17 -1-0-50/10 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 99-0-0/0 , 10-0-0/11 , 9-0-0/0 , 50-0-0/17 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 99-0-0/0 , 99-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -_/FILE-rung_24.csv -_FILE-rung_25.csv -; Rung : -; all the blocks with the following format : -; type (see classicladder.h) - ConnectedWithTop - VarType (see classicladder.h) / VarOffset -#VER=2.0 -#LABEL= -#COMMENT=Spindle-do-orient -#PREVRUNG=27 -#NEXTRUNG=18 -1-0-50/10 , 1-0-0/16 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 2-0-0/15 , 50-0-60/28 -0-0-0/0 , 0-1-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-1-0/0 -0-0-0/0 , 2-1-50/30 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 1-0-0/15 , 0-1-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -_/FILE-rung_25.csv -_FILE-rung_26.csv -; Rung : -; all the blocks with the following format : -; type (see classicladder.h) - ConnectedWithTop - VarType (see classicladder.h) / VarOffset -#VER=2.0 -#LABEL= -#COMMENT=Tool Changed -#PREVRUNG=23 -#NEXTRUNG=27 -1-0-50/35 , 4-0-0/16 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 50-0-60/21 -0-0-0/0 , 1-1-60/21 , 0-1-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -_/FILE-rung_26.csv -_FILE-rung_27.csv -; Rung : -; all the blocks with the following format : -; type (see classicladder.h) - ConnectedWithTop - VarType (see classicladder.h) / VarOffset -#VER=2.0 -#LABEL= -#COMMENT=Tool Prepared -#PREVRUNG=26 -#NEXTRUNG=25 -1-0-50/26 , 1-0-50/25 , 1-0-50/16 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 9-0-0/0 , 50-0-60/20 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 , 0-0-0/0 -_/FILE-rung_27.csv -_FILE-sections.csv -; Sections -#VER=1.0 -#NAME000=Prog1 -000,0,-1,8,5,0 -_/FILE-sections.csv -_FILE-sequential.csv -; Sequential -#VER=1.0 -_/FILE-sequential.csv -_FILE-ioconf.csv -; I/O Configuration -_/FILE-ioconf.csv -_FILE-symbols.csv -; Symbols -#VER=1.0 -_/FILE-symbols.csv -_/FILES_CLASSICLADDER diff --git a/configs/attic/demo_mazak/demo_mazak.hal b/configs/attic/demo_mazak/demo_mazak.hal deleted file mode 100644 index 1992c48980a..00000000000 --- a/configs/attic/demo_mazak/demo_mazak.hal +++ /dev/null @@ -1,758 +0,0 @@ -# this file contains the HAL configuration for Roland's Mazak -# -# kinematics -loadrt [KINS]KINEMATICS -# first load the motion controller, get name and thread periods from ini file -loadrt [EMCMOT]EMCMOT base_period_nsec=[EMCMOT]BASE_PERIOD servo_period_nsec=[EMCMOT]SERVO_PERIOD - -# next load I/O drivers. This retrofit uses three different I/O devices -# -# 1) MOTENC-Lite card, for analog outs to drives, encoder feedback, and -# some digital I/O. -# -loadrt hal_motenc - -# 2) AXIOM AX5214H card, for 48 digital I/O -# we are using 32 inputs and 16 outputs, with the outputs on port -# C, which can be converted to inputs 4 bits at a time. -# -loadrt hal_ax5214h cfg="0x220_iiooiioo" - -# 3) Parallel Port, driving PMDX-122 card. This provides a charge pump -# type watchdog, and also provides a small number of inputs that -# can be sampled at a higher rate. The jogwheel comes in thru this -# card and is counted in software. -# -loadrt hal_parport cfg="0x0378_in" - -# 4) Weighted summer, driven by toolchanger slot position inputs -# This adds together the 5 bits (with bit 4 being equal to 13) -# and outputs the sum as an S32 -# -loadrt weighted_sum wsum_sizes=5 - -# I/O Mapping - Physical I/O points to driver pins -# -------------------------------------------------------- -# OPTO-22 board IO-1 input module 0 is ax5214h.0.in-24 -# OPTO-22 board IO-1 input module 1 is ax5214h.0.in-25 -# " " " -# OPTO-22 board IO-1 input module 14 is ax5214h.0.in-38 -# OPTO-22 board IO-1 input module 15 is ax5214h.0.in-39 -# OPTO-22 board IO-1 output module 16 is ax5214h.0.out-40 -# OPTO-22 board IO-1 output module 17 is ax5214h.0.out-41 -# " " " -# OPTO-22 board IO-1 output module 22 is ax5214h.0.out-46 -# OPTO-22 board IO-1 output module 23 is ax5214h.0.out-47 -# -------------------------------------------------------- -# OPTO-22 board IO-2 input module 0 is ax5214h.0.in-00 -# OPTO-22 board IO-2 input module 1 is ax5214h.0.in-01 -# " " " -# OPTO-22 board IO-2 input module 14 is ax5214h.0.in-14 -# OPTO-22 board IO-2 input module 15 is ax5214h.0.in-15 -# OPTO-22 board IO-2 output module 16 is ax5214h.0.out-16 -# OPTO-22 board IO-2 output module 17 is ax5214h.0.out-17 -# " " " -# OPTO-22 board IO-2 output module 22 is ax5214h.0.out-22 -# OPTO-22 board IO-2 output module 23 is ax5214h.0.out-23 -# -------------------------------------------------------- -# OPTO-22 board IO-3 output module 0 is motenc.3.out-15 -# OPTO-22 board IO-3 output module 1 is motenc.3.out-14 -# " " " -# OPTO-22 board IO-3 output module 6 is motenc.3.out-01 -# OPTO-22 board IO-3 output module 7 is motenc.3.out-00 -# OPTO-22 board IO-3 input module 8 is motenc.3.in-16 -# OPTO-22 board IO-3 input module 9 is motenc.3.in-17 -# " " " -# OPTO-22 board IO-3 input module 22 is motenc.3.in-30 -# OPTO-22 board IO-3 input module 23 is motenc.3.in-31 -# -------------------------------------------------------- -# Breakout board IO-4 output chan 0 is motenc.3.out-00 -# Breakout board IO-4 output chan 1 is motenc.3.out-01 -# " " " -# Breakout board IO-4 output chan 6 is motenc.3.out-06 -# Breakout board IO-4 output chan 7 is motenc.3.out-07 -# Breakout board IO-4 input chan 0 is motenc.3.in-00 -# Breakout board IO-4 input chan 1 is motenc.3.in-01 -# " " " -# Breakout board IO-4 input chan 14 is motenc.3.in-14 -# Breakout board IO-4 input chan 15 is motenc.3.in-15 -# -------------------------------------------------------- - -# Now we load some more HAL components: -# -# the rest of these components implement spindle speed -# scaling (for high/low shifting) and spindle orient - -loadrt mux2 count=2 -loadrt mux4 count=1 -loadrt wcomp count=2 -loadrt scale count=3 -loadrt modmath mod_dir=2 -loadrt charge_pump -loadrt tristate_bit -loadrt tristate_float count=3 -loadrt conv_s32_float - -# Software encoder counter, for the jogwheel, and possibly a future -# small manual encoder for a feedrate override knob. -# -loadrt encoder num_chan=1 - -# PID loops: 3 for axis control and one for spindle orient -# -loadrt pid num_chan=4 - -# classicladder for machine logic -# (load the realtime portion) -loadrt classicladder_rt numRungs=50 numBits=50 numWords=8 numTimers=20 numMonostables=10 numPhysInputs=50 numPhysOutputs=40 numArithmExpr=4 numSections=4 - -# invoke the user part of CL to silently load the program -loadusr -w classicladder --nogui demo_mazak.clp - -# load debounce to handle the pushbuttons on the operator panels -loadrt debounce cfg="8" -setp debounce.0.delay 3 - -# ----------------------------------------------- - -# connect I/O driver functions to thread(s) -# -addf motenc.3.encoder-read servo-thread -addf motenc.3.digital-in-read servo-thread -addf ax5214h.0.read servo-thread -addf encoder.capture-position servo-thread -addf motenc.3.adc-read servo-thread - -# convert IO to internally useful representations -addf scale.2 servo-thread -# converter for tool magazine position -addf process_wsums servo-thread -addf mod-dir.0 servo-thread -addf mod-dir.1 servo-thread - -# ladder logic is executed once all the inputs are read -#addf classicladder.0.refresh servo-thread - -# adaptive feedrate mux -addf mux2.1 servo-thread -# now we run the motion controller -addf motion-command-handler servo-thread -addf motion-controller servo-thread - -# ladder logic is executed once all the inputs are read -addf classicladder.0.refresh servo-thread -# charge pump can run just about any time -addf charge-pump servo-thread - -# pid calculations are done after the motion module -# has determined new position commands. -addf pid.0.do-pid-calcs servo-thread -addf pid.1.do-pid-calcs servo-thread -addf pid.2.do-pid-calcs servo-thread - -# spindle signal handling is done next -addf pid.3.do-pid-calcs servo-thread -addf mux2.0 servo-thread -addf scale.0 servo-thread -addf scale.1 servo-thread -addf mux4.0 servo-thread -addf wcomp.0 servo-thread -addf wcomp.1 servo-thread -addf tristate-bit.0 servo-thread - -# misc stuff (jogwheel scale, tool number display) -addf tristate-float.0 servo-thread -addf tristate-float.1 servo-thread -addf tristate-float.2 servo-thread -addf conv-s32-float.0 servo-thread - -# output drivers are loaded last -addf motenc.3.dac-write servo-thread -addf motenc.3.digital-out-write servo-thread -addf ax5214h.0.write servo-thread -addf parport.0.write servo-thread - -# the base thread (fast thread) isn't needed for step pulse -# generation since this is a servo machine. However we use -# it to sample the jogwheel signals and count them in software - -addf parport.0.read base-thread -addf encoder.update-counters base-thread - -# ------------------------------------------------- - -# Next, create signals with meaningful names, and attach them to the -# physical pins. There are a lot of these, so they are broken up - -# --------------------------------------------------- -# ESTOP and related signals -net external-estop-ok ax5214h.0.in-24 -net gui-estop-ok iocontrol.0.user-enable-out -net main-estop-ok parport.0.pin-01-out -net main-estop-ok iocontrol.0.emc-enable-in -net main-estop-ok charge-pump.enable -net estop-reset iocontrol.0.user-request-enable -net charge-pump parport.0.pin-17-out -net charge-pump charge-pump.out - - -# servo power supply control -net AP1 motenc.3.out-00 -net AP2 motenc.3.out-01 - -# motion enable - this signal prevents the motion controller -# from starting unless everything is OK (comes from ladder) -net motion-enable motion.enable - -# servo amp enable (only one, driven by axis 0) -net servo-enable motenc.3.out-02 -net servo-enable joint.0.amp-enable-out - -# servo amp fault signals -# the signals from the amps are actually "not running" -# they are asserted when the amp is faulted, OR just -# disabled. So we use the inverse and call them "running" -net X-amp-running motenc.3.in-12-not -net Y-amp-running motenc.3.in-13-not -net Z-amp-running motenc.3.in-14-not -# need to release the Z-axis brake when running -net Z-amp-running motenc.3.out-15 - -# these are the real fault signals, and go to the motion -# controller, they are derived from the ones above by -# ladder logic -net X-amp-fault joint.0.amp-fault-in -net Y-amp-fault joint.1.amp-fault-in -net Z-amp-fault joint.2.amp-fault-in - -# Limit switches -# (the switches are NC, and open when hit, so -# we invert the signals by using the -not input -# pin - the result is limit signals that are -# TRUE when the machine is on the limit.) -net X-lim-plus motenc.3.in-00-not => joint.0.pos-lim-sw-in -net X-lim-minus motenc.3.in-01-not => joint.0.neg-lim-sw-in -net Y-lim-plus motenc.3.in-02-not => joint.1.pos-lim-sw-in -net Y-lim-minus motenc.3.in-03-not => joint.1.neg-lim-sw-in -net Z-lim-plus motenc.3.in-04-not => joint.2.pos-lim-sw-in -net Z-lim-minus motenc.3.in-05-not => joint.2.neg-lim-sw-in - -# Home switches -# (the switches are NC, see note above) -net X-home motenc.3.in-08-not => joint.0.home-sw-in -net Y-home motenc.3.in-09-not => joint.1.home-sw-in -net Z-home motenc.3.in-10-not => joint.2.home-sw-in - -# spindle related signals: "high level" signals -# ready (from drive to PC) -# run (from motion) -# run (to drive) -# at speed (from drive to PC) -# orient command (to spindle control) -# oriented status (from spindle control) -# commanded speed (from EMC to control) -# spindle current feedback (from drive to PC) - -# spindle related signals: "internal" signal - -# get spindle position from encoder -net sp-enc-pos motenc.3.enc-03-position -# scale spindle position to degrees -# 1440 cnts/rev = 4 cnts/degree -setp motenc.3.enc-03-scale -4.0 - -# get desired orient position from ini file -sets sp-orient-pos-cmd [SPINDLE]ORIENT_POSITION - -# connect commanded and feedback positions to PID loop -net sp-orient-pos-cmd pid.3.command -net sp-enc-pos pid.3.feedback - -# enable PID loop when in orient mode -net spindle-do-orient pid.3.enable - -# tuning params for PID loop -setp pid.3.Pgain 1.0 -setp pid.3.Igain 0.6 -setp pid.3.Dgain 0.2 -setp pid.3.deadband 0.4 - -# prevent integrator windup at the beginning of an orient -# after running the spindle for a long time. The error is -# very high before the first index happens. -setp pid.3.maxerrorI 200.0 - -# limit outputs, we don't want to go fast during orient -setp pid.3.maxoutput 100 - -# check position error with window comparator -net sp-orient-pos-err pid.3.error -net sp-orient-pos-err wcomp.0.in -net sp-orient-pos-ok wcomp.0.out -# set a +/- 1 degree window -setp wcomp.0.min -1.0 -setp wcomp.0.max 1.0 - -# output of loop is velocity for orientation -net sp-orient-rpm-cmd pid.3.output - -# select between normal speed and orient speed -# based on do-orient command -net sp-orient-rpm-cmd mux2.0.in1 -net spindle-rpm-cmd mux2.0.in0 -net spindle-do-orient mux2.0.sel -# output of mux is desired spindle RPM -net sp-rpm-cmd mux2.0.out - -# use scale blocks to calculate required motor RPM for -# both gears based on desired spindle RPM -net sp-rpm-cmd scale.0.in -net sp-mtr-high-rpm-cmd scale.0.out -setp scale.0.gain [SPINDLE]HIGH_GEAR_RATIO -net sp-rpm-cmd scale.1.in -net sp-mtr-low-rpm-cmd scale.1.out -setp scale.1.gain [SPINDLE]LOW_GEAR_RATIO - -# select either high or low speed based on current gear ratio, -# unless shifting, then select a low speed for meshing the gears -net sp-mtr-high-rpm-cmd mux4.0.in0 -net sp-mtr-low-rpm-cmd mux4.0.in1 -net sp-mtr-mesh-rpm-cmd mux4.0.in2 -net sp-mtr-mesh-rpm-cmd mux4.0.in3 -net sp-in-low-gear mux4.0.sel0 -net sp-shifting mux4.0.sel1 -# output of mux is desired motor RPM -net sp-mtr-rpm-cmd mux4.0.out -# set meshing speed -sets sp-mtr-mesh-rpm-cmd 15 - -# link the final motor command to the DAC -net sp-mtr-rpm-cmd motenc.3.dac-03-value -# set scaling - 10V = 4500RPM at the motor -setp motenc.3.dac-03-gain -0.002222 -# correct for offset, it causes drift and hunting -setp motenc.3.dac-03-offset -8 - -# connect other signals to drive -net spindle-ready motenc.3.in-15 -net spindle-drive-run motenc.3.out-03 -net sp-at-speed motenc.3.in-11 -net spindle-amps motenc.3.adc-03-value - -# connect signals to gearbox controls -# need to add a spindle run command -# and a rotating speed I think -net sp-engage-high-gear ax5214h.0.out-21 -net sp-engage-low-gear ax5214h.0.out-20 -net sp-in-high-gear ax5214h.0.in-34 -net sp-in-neutral ax5214h.0.in-35 -net sp-in-low-gear ax5214h.0.in-36 - -# use scale block to convert spindle position in degrees -# to revolutions for rigid tapping -net sp-enc-pos scale.2.in -net sp-pos-revs scale.2.out -setp scale.2.gain 0.002777777777777 -net sp-pos-revs spindle.0.revs - -# rayh begins to screw it up with help from his friends -# connect iocontrol signals for spindle run and speed -# these work as long as a spindle command is being output. -net spindle-run-request spindle.0.on -net spindle-rpm-cmd spindle.0.speed-out - -# end of spindle control - -# ioControl exports some tool pins -# iocontrol.0.tool-prepare -# iocontrol.0.tool-prep-number -# and expects iocontrol.0.tool-prepared (when the tool prep. is done) -# iocontrol.0.tool-change (output) -# and expects iocontrol.0.tool-changed (when tool changed) -# it also exports iocontrol.0.tool-number, which is the current tool -# in the spindle and is used when its time to return that tool to -# the tool magazine -net tool-prepare iocontrol.0.tool-prepare -net tool-prepared iocontrol.0.tool-prepared -net tool-change iocontrol.0.tool-change -net tool-changed iocontrol.0.tool-changed -net tool-requested-number iocontrol.0.tool-prep-number -net tool-current-number iocontrol.0.tool-number - -# misc control -# tool change location push button operators -net magazine-index-pbs ax5214h.0.in-07 -net worklight-pbs ax5214h.0.in-08 -net tool-load-pbs ax5214h.0.in-09 -net tool-unload-pbs ax5214h.0.in-10 - -# add front panel buttons here -net tool-unclamp-pbs ax5214h.0.in-39 -net feed-hold-pbs ax5214h.0.in-14 -net cycle-start-pbs ax5214h.0.in-25 - -# hydraulic pump -net hydraulic-pump-run motenc.3.out-14 -net hydraulic-pump-running ax5214h.0.in-05 - -# hydraulic actuator prox switches -# tool load-unload arm -net tool-unloaded ax5214h.0.in-38 -net tool-loaded ax5214h.0.in-15 - -# double or intermediate arm -net arm-retracted ax5214h.0.in-29 -net arm-extended ax5214h.0.in-30 -# FIXME!! This sensor is broken, so we are using a delay -# instead - 2 seconds after the cylinder is actuated, we -# assume that we have reached the desired position and -# set the signal true. The commented out line below is -# the proper source for the signal. But for now, it is -# driven by classicladder output number 27 (see ladder -# section near end of file). -#linksp arm-at-0/180 ax5214h.0.in-26 -net arm-at-0/60 ax5214h.0.in-27 -net arm-at-60 ax5214h.0.in-28 -net arm-at-180 ax5214h.0.in-31 - -# tool drawbar -net tool-clamped ax5214h.0.in-33 -net tool-unclamped ax5214h.0.in-32 - -# tool magazine or carousel with 0-24 positions -net magazine-in-position ax5214h.0.in-37 -net magazine-not-in-position ax5214h.0.in-37-not -net magazine-not-in-position wsum.0.hold -net magazine-position-0 ax5214h.0.in-00 -net magazine-position-0 wsum.0.bit.0.in -net magazine-position-1 ax5214h.0.in-01 -net magazine-position-1 wsum.0.bit.1.in -net magazine-position-2 ax5214h.0.in-02 -net magazine-position-2 wsum.0.bit.2.in -net magazine-position-3 ax5214h.0.in-03 -net magazine-position-3 wsum.0.bit.3.in -net magazine-position-4 ax5214h.0.in-04 -net magazine-position-4 wsum.0.bit.4.in -# set the bit weight for bit 4 to 13 instead of the default 16 -setp wsum.0.bit.4.weight 13 -# add a signal for magazine position -net magazine-position wsum.0.sum -# add a temporary signal to rotate by one. - -# hydraulic valves -net arm-extend ax5214h.0.out-47 -net arm-retract ax5214h.0.out-46 -net arm-60cw ax5214h.0.out-45 -net arm-180ccw ax5214h.0.out-44 -net tool-load ax5214h.0.out-43 -net tool-unload ax5214h.0.out-42 -net magazine-forward ax5214h.0.out-41 -net magazine-reverse ax5214h.0.out-40 -net tool-unclamp ax5214h.0.out-23 -net head-unclamp ax5214h.0.out-22 - -# other solenoids and such -net spindle-air-blast ax5214h.0.out-19 -net work-air-blast ax5214h.0.out-18 -net mist-coolant ax5214h.0.out-17 - -net coolant-flood iocontrol.0.coolant-flood ax5214h.0.out-16 - -# magazine indexing -net magazine-position mod-dir.0.actual -net tool-requested-number mod-dir.0.desired -net tool-requested-match mod-dir.0.on-target - -net magazine-position mod-dir.1.actual -net tool-current-number mod-dir.1.desired -net tool-current-match mod-dir.1.on-target - -setp mod-dir.0.max-num [EMCIO]TOOL_TURRET_MAX -setp mod-dir.0.wrap [EMCIO]TOOL_TURRET_WRAP -setp mod-dir.1.max-num [EMCIO]TOOL_TURRET_MAX -setp mod-dir.1.wrap [EMCIO]TOOL_TURRET_WRAP -# direction to move to fetch new tool -net magazine-fwd-req-fetch mod-dir.0.up -net magazine-rev-req-fetch mod-dir.0.down -# direction to move to store previous tool -net magazine-fwd-req-store mod-dir.1.up -net magazine-rev-req-store mod-dir.1.down - -# set encoder latch enable TRUE so encoder count "wraps" during toolchanges -# and resets under motion controller command for rigid tapping -net sp-index-enable motenc.3.enc-03-index-enable -net sp-index-enable tristate-bit.0.out -setp tristate-bit.0.in 1 -net tool-change tristate-bit.0.enable -net sp-index-enable spindle.0.index-enable - -# jogwheel signals -setp encoder.0.x4-mode 0 -net jogwheel-phA parport.0.pin-12-in -net jogwheel-phB parport.0.pin-11-in -# route signals to software encoder counter -net jogwheel-phA encoder.0.phase-A - -net jogwheel-phB encoder.0.phase-B -# jogwheel output -net jogwheel-counts encoder.0.counts -# need to release the Z-axis brake when running -net Z-amp-running motenc.3.out-15 - -# feedhold, uses G50 adaptive feed input -sets zero 0.0 -sets one 1.0 -net adaptive-feed mux2.1.out -net adaptive-feed motion.adaptive-feed -net zero mux2.1.in1 -net one mux2.1.in0 -net feed-hold mux2.1.sel - - -# ----------------------------------------------------- -# encoders - signals and scaling -# -# position in counts -net X-enc-counts motenc.3.enc-00-count -net Y-enc-counts motenc.3.enc-01-count -net Z-enc-counts motenc.3.enc-02-count - -# scaling to get inches (scale comes from ini file) -setp motenc.3.enc-00-scale [JOINT_0]INPUT_SCALE -setp motenc.3.enc-01-scale [JOINT_1]INPUT_SCALE -setp motenc.3.enc-02-scale [JOINT_2]INPUT_SCALE - -# position in inches -net X-enc-pos motenc.3.enc-00-position -net Y-enc-pos motenc.3.enc-01-position -net Z-enc-pos motenc.3.enc-02-position - -# index pulses -net X-index-enable motenc.3.enc-00-index-enable joint.0.index-enable -net Y-index-enable motenc.3.enc-01-index-enable joint.1.index-enable -net Z-index-enable motenc.3.enc-02-index-enable joint.2.index-enable - -# ----------------------------------------------------- -# DACs - output to servo amps -# -net X-volts motenc.3.dac-00-value -net Y-volts motenc.3.dac-01-value -net Z-volts motenc.3.dac-02-value -# get scale and offset from the ini file -setp motenc.3.dac-00-gain [JOINT_0]OUTPUT_SCALE -setp motenc.3.dac-01-gain [JOINT_1]OUTPUT_SCALE -setp motenc.3.dac-02-gain [JOINT_2]OUTPUT_SCALE -setp motenc.3.dac-00-offset [JOINT_0]OUTPUT_OFFSET -setp motenc.3.dac-01-offset [JOINT_1]OUTPUT_OFFSET -setp motenc.3.dac-02-offset [JOINT_2]OUTPUT_OFFSET - -# ----------------------------------------------------- -# ADCs - servo amp current feedback -# -net X-amps motenc.3.adc-00-value -net Y-amps motenc.3.adc-01-value -net Z-amps motenc.3.adc-02-value -# set scale and offset (need to calibrate this) -setp motenc.3.adc-00-gain 1.0 -setp motenc.3.adc-01-gain 1.0 -setp motenc.3.adc-02-gain 1.0 -setp motenc.3.adc-00-offset 0.0 -setp motenc.3.adc-01-offset 0.0 -setp motenc.3.adc-02-offset 0.0 - -# ----------------------------------------------------- -# PIDs - position control -# - -# signals for position command -# hook the motion controller outputs to the position command -net X-pos-cmd joint.0.motor-pos-cmd -net Y-pos-cmd joint.1.motor-pos-cmd -net Z-pos-cmd joint.2.motor-pos-cmd -# and to the PID inputs -net X-pos-cmd pid.0.command -net Y-pos-cmd pid.1.command -net Z-pos-cmd pid.2.command - -# hook encoders to PID feedback -net X-enc-pos pid.0.feedback -net Y-enc-pos pid.1.feedback -net Z-enc-pos pid.2.feedback -# and to motion controller -net X-enc-pos joint.0.motor-pos-fb -net Y-enc-pos joint.1.motor-pos-fb -net Z-enc-pos joint.2.motor-pos-fb - -# hook PID outputs to DACs -net X-volts pid.0.output -net Y-volts pid.1.output -net Z-volts pid.2.output - -# use 'servo-enable' to enable PID blocks -# need to release the Z-axis brake when running -net Z-amp-running motenc.3.out-15 - -net servo-enable pid.0.enable -net servo-enable pid.1.enable -net servo-enable pid.2.enable - -# get tuning params from ini file -setp pid.0.deadband [JOINT_0]DEADBAND -setp pid.0.Pgain [JOINT_0]PGAIN -setp pid.0.Igain [JOINT_0]IGAIN -setp pid.0.Dgain [JOINT_0]DGAIN -setp pid.0.FF0 [JOINT_0]FF0 -setp pid.0.FF1 [JOINT_0]FF1 -setp pid.0.FF2 [JOINT_0]FF2 -setp pid.0.bias [JOINT_0]BIAS -setp pid.1.deadband [JOINT_1]DEADBAND -setp pid.1.Pgain [JOINT_1]PGAIN -setp pid.1.Igain [JOINT_1]IGAIN -setp pid.1.Dgain [JOINT_1]DGAIN -setp pid.1.FF0 [JOINT_1]FF0 -setp pid.1.FF1 [JOINT_1]FF1 -setp pid.1.FF2 [JOINT_1]FF2 -setp pid.1.bias [JOINT_1]BIAS -setp pid.2.deadband [JOINT_2]DEADBAND -setp pid.2.Pgain [JOINT_2]PGAIN -setp pid.2.Igain [JOINT_2]IGAIN -setp pid.2.Dgain [JOINT_2]DGAIN -setp pid.2.FF0 [JOINT_2]FF0 -setp pid.2.FF1 [JOINT_2]FF1 -setp pid.2.FF2 [JOINT_2]FF2 -setp pid.2.bias [JOINT_2]BIAS -# get maximum (and minimum) output volts from ini file -setp pid.0.maxoutput [JOINT_0]MAX_OUTPUT -setp pid.1.maxoutput [JOINT_1]MAX_OUTPUT -setp pid.2.maxoutput [JOINT_2]MAX_OUTPUT - -# LADDER LOGIC!!! -# -# Classic ladder doesn't let you use meaningful names, so this -# will be the magic decoder ring - -# INPUTS to CL -# I0 = the GUI estop "button" isn't pressed -net gui-estop-ok classicladder.0.in-00 -# I1 = servo-enable, used to mask amp faults when not enabled -net servo-enable classicladder.0.in-01 -# I2 thru I4, amp running signal (FALSE when faulted OR disabled) -net X-amp-running classicladder.0.in-02 -net Y-amp-running classicladder.0.in-03 -net Z-amp-running classicladder.0.in-04 -net spindle-use-low-gear classicladder.0.in-05 -net sp-in-low-gear classicladder.0.in-06 -net sp-in-high-gear classicladder.0.in-07 -net sp-in-neutral classicladder.0.in-08 -net sp-at-speed classicladder.0.in-09 -net hydraulic-pump-running classicladder.0.in-10 -net magazine-in-position classicladder.0.in-11 -net magazine-index-pbs classicladder.0.in-12 -net tool-load-pbs classicladder.0.in-13 -net tool-loaded classicladder.0.in-14 -net tool-unload-pbs classicladder.0.in-15 -net tool-unloaded classicladder.0.in-16 -net tool-unclamp-pbs classicladder.0.in-17 -# based on difference between current position and -# the slot for the tool currently in the spindle -net magazine-fwd-req-store classicladder.0.in-18 -net magazine-rev-req-store classicladder.0.in-19 -# I20 = means the external estop chain is OK -net external-estop-ok classicladder.0.in-20 -# I21 = estop-reset, pulsed to reset the estop relay -net estop-reset classicladder.0.in-21 -net feed-hold-pbs classicladder.0.in-22 -net spindle-run-request classicladder.0.in-23 -net sp-orient-pos-ok classicladder.0.in-24 -net tool-requested-match classicladder.0.in-25 -net tool-prepare classicladder.0.in-26 -# based on difference between current position and EMC -# requested position (from a T block) -net magazine-fwd-req-fetch classicladder.0.in-27 -net magazine-rev-req-fetch classicladder.0.in-28 -# tool changer proxes -net arm-at-0/180 classicladder.0.in-29 -net arm-at-0/60 classicladder.0.in-30 -net arm-at-180 classicladder.0.in-31 -net arm-at-60 classicladder.0.in-32 -net arm-extended classicladder.0.in-33 -net arm-retracted classicladder.0.in-34 -net tool-change classicladder.0.in-35 -net tool-clamped classicladder.0.in-36 -net tool-unclamped classicladder.0.in-37 -net tool-current-match classicladder.0.in-38 - - - -# OUTPUTS from CL -# Q0 = AP1, first stage power up (applies power thru resistors) -net AP1 classicladder.0.out-00 -# Q1 = AP2, second stage (bypasses resistors) -net AP2 classicladder.0.out-01 -# Q2 thru Q4, amp faulted signal (ENABLED and NOT RUNNING) -net X-amp-fault classicladder.0.out-02 -net Y-amp-fault classicladder.0.out-03 -net Z-amp-fault classicladder.0.out-04 -# Q5 is motion enable (after chain) -net motion-enable classicladder.0.out-05 -# Q6 and 7 are the gear shift outputs -net sp-engage-low-gear classicladder.0.out-06 -net sp-engage-high-gear classicladder.0.out-07 -# Q8 indicates that a shift is in progress -net sp-shifting classicladder.0.out-08 -net hydraulic-pump-run classicladder.0.out-09 -net magazine-forward classicladder.0.out-10 -net magazine-reverse classicladder.0.out-11 -net tool-load classicladder.0.out-12 -net tool-unload classicladder.0.out-13 -net arm-extend classicladder.0.out-14 -net arm-retract classicladder.0.out-15 -net arm-60cw classicladder.0.out-16 -net arm-180ccw classicladder.0.out-17 -net tool-unclamp classicladder.0.out-18 -net head-unclamp classicladder.0.out-19 -net tool-prepared classicladder.0.out-20 -net tool-changed classicladder.0.out-21 -# Q22 indicates that the estop ladder rung (latch) is ok -net main-estop-ok classicladder.0.out-22 -net spindle-drive-run classicladder.0.out-23 -net spindle-at-speed classicladder.0.out-24 -net spindle-oriented classicladder.0.out-25 -net feed-hold classicladder.0.out-26 -# FIXME! this is a temporary replacement for a bad sensor -net arm-at-0/180 classicladder.0.out-27 -net spindle-do-orient classicladder.0.out-28 - -# CL internals (not HAL data, just here for documentation -# -# T0 = delay from estop OK to AP1 -# T1 = delay from AP1 to AP2 -# T2 = delay to allow servo amps to respond to enable -# T3 = delay between AP2 close and motion enable -# T4 = delay before shifting out of gear -# T5 = delay before shifting into gear -# T6 = oneshot for tool magazine advance -# T7 = hydraulic pump delay -# T8 = at-speed delay -# T9 = oriented delay -# T10 = bad prox delay - - -# B0 = delayed servo-enable, for fault masking -# B1 = five second initialization signal -# B2 = gear shifting in progress -# B3 = ok to shift into neutral -# B4 = ok to shift into gear -# B5 = magazine-index delay -# B6 = magazine stop delay -# B7 = tool load virtual -# B8 = tool unload virtual -# B9 = arm extend virtual -# B10 = arm retract virtual -# B11 = arm arm-60cw virtual -# B12 = arm arm 180ccw virtual -# B13 = arm tool unclamp virtual -# B14 = tool change preconditions ready -# B15 = cycle midpoint -# B16 = tool cycle start - diff --git a/configs/attic/demo_mazak/demo_mazak.ini b/configs/attic/demo_mazak/demo_mazak.ini deleted file mode 100644 index fbe52b1d7e3..00000000000 --- a/configs/attic/demo_mazak/demo_mazak.ini +++ /dev/null @@ -1,248 +0,0 @@ -# mazak_rf.ini EMC controller parameters for Roland Friestad's Mazak mill. -# General note: Comments can either be preceded with a # or ; - either is -# acceptable, although # is in keeping with most linux config files. -# General section ------------------------------------------------------------- - -[EMC] -# Version of this INI file -VERSION = 1.1 -# Name of machine, for use with display, etc. -MACHINE = LinuxCNC-MAZAK-RF -# Debug level, 0 means no messages. See src/emc/nml_int/emcglb.h for others -# DEBUG = 0x00000003 -# DEBUG = 0x00000007 -DEBUG = 0 -# enable adaptive feed input, we use it for feedhold button and to -# prevent motion during spindle accel, gear changes, etc -RS274NGC_STARTUP_CODE = M52 P1 -# Sections for display options ------------------------------------------------ - -[DISPLAY] -# Name of display program, e.g., xlinuxcnc -DISPLAY = axis -# DISPLAY = tklinuxcnc -# DISPLAY = mini -# Cycle time, in seconds, that display will sleep between polls -CYCLE_TIME = 0.100 -# Path to help file -HELP_FILE = tklinuxcnc.txt -# Initial display setting for position, RELATIVE or MACHINE -POSITION_OFFSET = RELATIVE -# Initial display setting for position, COMMANDED or ACTUAL -POSITION_FEEDBACK = ACTUAL -# Highest value that will be allowed for feed override, 1.0 = 100% -MAX_FEED_OVERRIDE = 1.2 -# Prefix to be used -PROGRAM_PREFIX = ../../nc_files/ -# side panel with some extra controls -PYVCP=panel.xml -# Introductory graphic -INTRO_GRAPHIC = linuxcnc.gif -INTRO_TIME = 1 -#EDITOR = geany -INCREMENTS = 0.010 0.001 0.0001 -# Task controller section ----------------------------------------------------- - -[FILTER] -#No Content - -[RS274NGC] -# File containing interpreter variables -PARAMETER_FILE = demo_mazak.var -# Motion control section ------------------------------------------------------ - -[EMCMOT] -EMCMOT = motmod -# Timeout for comm to emcmot, in seconds -COMM_TIMEOUT = 1.0 -# Base task period, in nanoseconds - this is the fastest thread in the machine -BASE_PERIOD = 100000 -# Servo task period, in nanoseconds - will be rounded to an integer multiple -# of BASE_PERIOD -SERVO_PERIOD = 500000 -# Hardware Abstraction Layer section -------------------------------------------------- - -[TASK] -# Name of task controller program, e.g., milltask -TASK = milltask -# Cycle time, in seconds, that task controller will sleep between polls -CYCLE_TIME = 0.010 -# Part program interpreter section -------------------------------------------- - -[HAL] -# The run script first uses halcmd to execute any HALFILE -# files, and then to execute any individual HALCMD commands. -# list of hal config files to run through halcmd -# files are executed in the order in which they appear -HALFILE = demo_mazak.hal -HALFILE = tester.hal -# list of halcmd commands to execute -# commands are executed in the order in which they appear -#HALCMD = save neta -# Single file that is executed after the GUI has started. -# used for "control panel" stuff, since the panel widgets -# don't exist until the GUI starts -POSTGUI_HALFILE = panel.hal -# Spindle Controller Section -------------------------------------------------- - -[HALUI] -#No Content - -[TRAJ] -# COORDINATES = X Y Z A B C -COORDINATES = X Y Z -HOME = 0 0 0 -LINEAR_UNITS = inch -ANGULAR_UNITS = degree -DEFAULT_LINEAR_VELOCITY = 1.0 -MAX_LINEAR_VELOCITY = 5.0 -DEFAULT_LINEAR_ACCELERATION = 20.0 -MAX_LINEAR_ACCELERATION = 20.0 -# Axes sections --------------------------------------------------------------- -# First axis - -[EMCIO] -# change tools in the upper left corner of the table -# to avoid hitting the vice or workpiece with the tool -TOOL_CHANGE_POSITION = -13.75 7.5 -0.022 -# tool table file -TOOL_TABLE = demo_mazak.tbl -# tool turret info -TOOL_TURRET_MAX = 24 -TOOL_TURRET_WRAP = 1 -# wait times in seconds for spindle brake, release -SPINDLE_OFF_WAIT = 1.0 -SPINDLE_ON_WAIT = 1.5 - -[KINS] -KINEMATICS = trivkins -JOINTS = 3 - -[AXIS_X] -MIN_LIMIT = -14.0 -MAX_LIMIT = 14.0 -MAX_VELOCITY = 5.0 -MAX_ACCELERATION = 20.0 - -[JOINT_0] -TYPE = LINEAR -HOME = 0.000 -MAX_VELOCITY = 5.0 -MAX_ACCELERATION = 20.0 -# Yes really, this .0024 backlash is right, workshop 2007 -BACKLASH = 0.0024 -# 2000 cycles/rev * 4 counts/cycle * 1.6 gear ratio * -# 1.0 cm pitch * 2.54 cm/in = 32512 (tweaked later) -INPUT_SCALE = 33865 -OUTPUT_SCALE = 1.000 -OUTPUT_OFFSET = -0.032 -MAX_OUTPUT = 10.0 -MIN_LIMIT = -14.0 -MAX_LIMIT = 14.0 -FERROR = 0.050 -MIN_FERROR = 0.010 -HOME_OFFSET = 14.3 -HOME_SEARCH_VEL = 2.5 -HOME_LATCH_VEL = -0.25 -HOME_USE_INDEX = YES -HOME_IGNORE_LIMITS = NO -HOME_SEQUENCE = 1 -# PID tuning params -DEADBAND = 0.000035 -PGAIN = 4000.0 -IGAIN = 6400.0 -DGAIN = 15.0 -FF0 = 0.000 -FF1 = 0.000 -FF2 = 0.0 -BIAS = 0.000 -# Second axis - -[AXIS_Y] -MIN_LIMIT = -7.7 -MAX_LIMIT = 7.7 -MAX_VELOCITY = 5.0 -MAX_ACCELERATION = 20.0 - -[JOINT_1] -TYPE = LINEAR -HOME = 0.000 -MAX_VELOCITY = 5.0 -MAX_ACCELERATION = 20.0 -BACKLASH = 0.000 -# 2000 cycles/rev * 4 counts/cycle * 1.6 gear ratio * -# 1.0 cm pitch * 2.54 cm/in = 32512 (tweaked later) -INPUT_SCALE = 33865 -OUTPUT_SCALE = 1.000 -OUTPUT_OFFSET = 0.006 -MAX_OUTPUT = 10.0 -MIN_LIMIT = -7.7 -MAX_LIMIT = 7.7 -FERROR = 0.050 -MIN_FERROR = 0.010 -HOME_OFFSET = 7.37 -HOME_SEARCH_VEL = 2.5 -HOME_LATCH_VEL = -0.25 -HOME_USE_INDEX = YES -HOME_IGNORE_LIMITS = NO -HOME_SEQUENCE = 1 -# PID tuning params -DEADBAND = 0.000035 -PGAIN = 4000.0 -IGAIN = 6400.0 -DGAIN = 15.0 -FF0 = 0.000 -FF1 = 0.000 -FF2 = 0.0 -BIAS = 0.000 -# Third axis - -[AXIS_Z] -MIN_LIMIT = -7.75 -MAX_LIMIT = 0.025 -MAX_VELOCITY = 3.0 -MAX_ACCELERATION = 20.0 - -[JOINT_2] -TYPE = LINEAR -HOME = 0.0 -MAX_VELOCITY = 3.0 -MAX_ACCELERATION = 20.0 -BACKLASH = 0.000 -# 2000 cycles/rev * 4 counts/cycle * 2.0 gear ratio * -# 1.0 cm pitch * 2.54 cm/in = 40640 -# 2007 workshop: we found that the scale was 20% low -# and has apparently been that way for a couple years -# dunno whether the gear ratio is actually 2.5, or the -# screw is actually 8mm instead of 10mm, or something -# else, but the number below gives correct results -INPUT_SCALE = 50800 -OUTPUT_SCALE = 1.000 -OUTPUT_OFFSET = -0.014 -MAX_OUTPUT = 10.0 -MIN_LIMIT = -7.75 -MAX_LIMIT = 0.025 -FERROR = 0.050 -MIN_FERROR = 0.010 -HOME_OFFSET = -0.2 -HOME_SEARCH_VEL = 1.0 -HOME_LATCH_VEL = -0.25 -HOME_USE_INDEX = YES -HOME_IGNORE_LIMITS = NO -HOME_SEQUENCE = 0 -# PID tuning params -DEADBAND = 0.00003 -PGAIN = 4000.0 -IGAIN = 6400.0 -DGAIN = 15.0 -FF0 = 0.000 -FF1 = 0.000 -FF2 = 0.0 -BIAS = 0.000 -# section for main IO controller parameters ----------------------------------- - -[SPINDLE] -ORIENT_POSITION = -75.0 -LOW_GEAR_RATIO = 4.133 -HIGH_GEAR_RATIO = 1.100 -# Trajectory planner section -------------------------------------------------- diff --git a/configs/attic/demo_mazak/demo_mazak.tbl b/configs/attic/demo_mazak/demo_mazak.tbl deleted file mode 100644 index c0b72de0652..00000000000 --- a/configs/attic/demo_mazak/demo_mazak.tbl +++ /dev/null @@ -1,4 +0,0 @@ -T1 P1 D0.125000 Z+0.511000 ;1/8 end mill -T2 P2 D0.062500 Z+0.100000 ;1/16 end mill -T3 P3 D0.201000 Z+1.273000 ;#7 tap drill -T99999 P99999 Z+0.100000 ;big tool number diff --git a/configs/attic/demo_mazak/tester.hal b/configs/attic/demo_mazak/tester.hal deleted file mode 100644 index 11e79330433..00000000000 --- a/configs/attic/demo_mazak/tester.hal +++ /dev/null @@ -1,119 +0,0 @@ -# this file contains a Virtual Control Panel for testing on Roland's Mazak -# - -loadusr -W halvcp tester.vcp - -net external-estop-ok led.ext-estop -net gui-estop-ok led.gui-estop -net main-estop-ok led.main-estop -net AP1 led.charging -net AP2 led.powered -net motion-enable led.motion-enable - -net spindle-ready led.sp-ready -net spindle-drive-run led.sp-run -net spindle-at-speed led.sp-at-speed -net spindle-use-low-gear led.sp-low-gear -net spindle-use-low-gear button.sp-low-gear -net spindle-do-orient led.sp-do-orient -net spindle-oriented led.sp-oriented - -net X-amp-running led.x-amp-on -net X-amp-fault led.x-amp-flt -net X-lim-plus led.x-pos-lim -net X-lim-minus led.x-neg-lim -net X-lim-plus led.x-home - -net Y-amp-running led.y-amp-on -net Y-amp-fault led.y-amp-flt -net Y-lim-plus led.y-pos-lim -net Y-lim-minus led.y-neg-lim -net Y-lim-plus led.y-home - -net Z-amp-running led.z-amp-on -net Z-amp-fault led.z-amp-flt -net Z-lim-plus led.z-pos-lim -net Z-lim-minus led.z-neg-lim -net Z-lim-plus led.z-home - -net tool-prepare led.tool-prep -net tool-prepared led.tool-prepped -net tool-change led.tool-change -net tool-changed led.tool-changed - -net magazine-index-pbs led.tool-index-pb -net tool-load-pbs led.tool-load-pb -net tool-unload-pbs led.tool-unload-pb - -net magazine-in-position led.mag-in-pos -net magazine-position-0 led.mag-pos-0 -net magazine-position-1 led.mag-pos-1 -net magazine-position-2 led.mag-pos-2 -net magazine-position-3 led.mag-pos-3 -net magazine-position-4 led.mag-pos-4 - -net tool-loaded led.arm1-loaded -net tool-unloaded led.arm1-unloaded - -net arm-retracted led.arm2-retracted -net arm-extended led.arm2-extended -net arm-at-0/180 led.arm2-0/180 -net arm-at-0/60 led.arm2-0/60 -net arm-at-60 led.arm2-60 -net arm-at-180 led.arm2-180 - -net tool-clamped led.tool-clamped -net tool-unclamped led.tool-unclamped - - - - -#loadusr halmeter -s sig magazine-position - -quit -# the following are signals that we might later want to hook -# LEDs and/or switches to, included here for reference only - -# spindle related signals: "internal" signal -#newsig sp-index-enable bit -#newsig sp-orient-pos-ok bit -#newsig sp-engage-high-gear bit -#newsig sp-engage-low-gear bit -#newsig sp-in-high-gear bit -#newsig sp-in-low-gear bit -#newsig sp-in-neutral bit -#newsig sp-shifting bit -#newsig sp-at-speed bit - -# misc control -# tool change location push button operators -#newsig worklight-pbs bit - -# add front panel buttons here - - -# hydraulic pump -#newsig hydraulic-pump-run bit -#newsig hydraulic-pump-running bit - -# add a temporary signal to rotate by one. -#newsig forward-one bit - -# hydraulic valves -#newsig arm-extend bit -#newsig arm-retract bit -#newsig arm-60cw bit -#newsig arm-180ccw bit -#newsig tool-load bit -#newsig tool-unload bit -#newsig magazine-forward bit -#newsig magazine-reverse bit -#newsig tool-unclamp bit -#newsig head-unclamp bit - -# other solenoids and such -#newsig spindle-air-blast bit -#newsig work-air-blast bit -#newsig mist-coolant bit -#newsig flood-coolant bit - diff --git a/configs/attic/demo_mazak/tester.vcp b/configs/attic/demo_mazak/tester.vcp deleted file mode 100644 index 56e14eafb74..00000000000 --- a/configs/attic/demo_mazak/tester.vcp +++ /dev/null @@ -1,488 +0,0 @@ -vcp { - main-window { - title = "Mazak Test" -# width = 300 -# height = 300 - # top level box - box { - # this box holds generic stuff - layout = horizontal - box { - layout = vertical - box { - layout = vertical - title = "ESTOP Chain" - box { - layout = horizontal - LED { - halpin = led.ext-estop - on-color = green - off-color = "#060" - } - label { text = " External" } - } - box { - layout = horizontal - LED { - halpin = led.gui-estop - on-color = green - off-color = "#060" - } - label { text = " GUI" } - } - box { - layout = horizontal - LED { - halpin = led.main-estop - on-color = green - off-color = "#060" - } - label { text = " Master" } - } - box { - layout = horizontal - LED { - halpin = led.charging - on-color = yellow - off-color = yellow4 - } - label { text = " Charging" } - } - box { - layout = horizontal - LED { - halpin = led.powered - on-color = green - off-color = "#060" - } - label { text = " Amp Power" } - } - box { - layout = horizontal - LED { - halpin = led.motion-enable - on-color = green - off-color = "#060" - } - label { text = " Enabled" } - } - } - box { - layout = vertical - title = "Spindle" - box { - layout = horizontal - LED { - halpin = led.sp-ready - on-color = green - off-color = "#060" - } - label { text = " Ready" } - } - box { - layout = horizontal - LED { - halpin = led.sp-run - on-color = yellow - off-color = yellow4 - } - label { text = " Run" } - } - box { - layout = horizontal - LED { - halpin = led.sp-low-gear - on-color = yellow - off-color = yellow4 - } - label { text = " Use Low Gear" } - } - box { - layout = horizontal - LED { - halpin = led.sp-at-speed - on-color = green - off-color = "#060" - } - label { text = " At Speed" } - } - box { - layout = horizontal - LED { - halpin = led.sp-do-orient - on-color = yellow - off-color = yellow4 - } - label { text = " Do Orient" } - } - box { - layout = horizontal - LED { - halpin = led.sp-oriented - on-color = green - off-color = "#060" - } - label { text = " Oriented" } - } - button { - halpin = button.sp-low-gear - label { text = "LowGear" } - } - } - } - # this box holds stuff for the axes - box { - layout = vertical - #title = "Axis Amps" - box { - layout = vertical - title = "X" - box { - layout = horizontal - LED { - halpin = led.x-amp-on - on-color = green - off-color = "#060" - } - label { text = " Running" } - } - box { - layout = horizontal - LED { halpin = led.x-amp-flt } - label { text = " Faulted" } - } - box { - layout = horizontal - LED { halpin = led.x-pos-lim } - label { text = " Max Limit" } - } - box { - layout = horizontal - LED { halpin = led.x-neg-lim } - label { text = " Min Limit" } - } - box { - layout = horizontal - LED { - halpin = led.x-home - on-color = yellow - off-color = yellow4 - } - label { text = " Home" } - } - } - box { - layout = vertical - title = "Y" - box { - layout = horizontal - LED { - halpin = led.y-amp-on - on-color = green - off-color = "#060" - } - label { text = " Running" } - } - box { - layout = horizontal - LED { halpin = led.y-amp-flt } - label { text = " Faulted" } - } - box { - layout = horizontal - LED { halpin = led.y-pos-lim } - label { text = " Max Limit" } - } - box { - layout = horizontal - LED { halpin = led.y-neg-lim } - label { text = " Min Limit" } - } - box { - layout = horizontal - LED { - halpin = led.y-home - on-color = yellow - off-color = yellow4 - } - label { text = " HomeSw" } - } - } - box { - layout = vertical - title = "Z" - box { - layout = horizontal - LED { - halpin = led.z-amp-on - on-color = green - off-color = "#060" - } - label { text = " Running" } - } - box { - layout = horizontal - LED { halpin = led.z-amp-flt } - label { text = " Faulted" } - } - box { - layout = horizontal - LED { halpin = led.z-pos-lim } - label { text = " Max Limit" } - } - box { - layout = horizontal - LED { halpin = led.z-neg-lim } - label { text = " Min Limit" } - } - box { - layout = horizontal - LED { - halpin = led.z-home - on-color = yellow - off-color = yellow4 - } - label { text = " Home" } - } - } - } - # this box holds stuff for the toolchanger - box { - layout = vertical - title = "Tools" - box { - layout = vertical - title = "Control" - box { - layout = horizontal - LED { - halpin = led.tool-prep - on-color = yellow - off-color = yellow4 - } - label { text = " Prepare" } - } - box { - layout = horizontal - LED { - halpin = led.tool-prepped - on-color = green - off-color = "#060" - } - label { text = " Prepared" } - } - box { - layout = horizontal - LED { - halpin = led.tool-change - on-color = yellow - off-color = yellow4 - } - label { text = " Change" } - } - box { - layout = horizontal - LED { - halpin = led.tool-changed - on-color = green - off-color = "#060" - } - label { text = " Changed" } - } - box { - layout = horizontal - LED { - halpin = led.tool-index-pb - on-color = yellow - off-color = yellow4 - } - label { text = " PB Index" } - } - box { - layout = horizontal - LED { - halpin = led.tool-load-pb - on-color = yellow - off-color = yellow4 - } - label { text = " PB Load" } - } - box { - layout = horizontal - LED { - halpin = led.tool-unload-pb - on-color = yellow - off-color = yellow4 - } - label { text = " PB Unload" } - } - } - box { - layout = vertical - title = "Magazine" - box { - layout = horizontal - LED { - halpin = led.mag-in-pos - on-color = green - off-color = red - } - label { text = " In Pos" } - } - box { - layout = horizontal - LED { - halpin = led.mag-pos-0 - on-color = yellow - off-color = yellow4 - } - label { text = " Bit0" } - } - box { - layout = horizontal - LED { - halpin = led.mag-pos-1 - on-color = yellow - off-color = yellow4 - } - label { text = " Bit1" } - } - box { - layout = horizontal - LED { - halpin = led.mag-pos-2 - on-color = yellow - off-color = yellow4 - } - label { text = " Bit2" } - } - box { - layout = horizontal - LED { - halpin = led.mag-pos-3 - on-color = yellow - off-color = yellow4 - } - label { text = " Bit3" } - } - box { - layout = horizontal - LED { - halpin = led.mag-pos-4 - on-color = yellow - off-color = yellow4 - } - label { text = " Bit4" } - } - } - } - # this box holds the prox switches - box { - layout = vertical - title = "Proxen" - box { - layout = vertical - title = "Mag Arm" - box { - layout = horizontal - LED { - halpin = led.arm1-loaded - on-color = yellow - off-color = yellow4 - } - label { text = " Load" } - } - box { - layout = horizontal - LED { - halpin = led.arm1-unloaded - on-color = yellow - off-color = yellow4 - } - label { text = " Unload" } - } - } - box { - layout = vertical - title = "Double Arm" - box { - layout = horizontal - LED { - halpin = led.arm2-retracted - on-color = yellow - off-color = yellow4 - } - label { text = " Retracted" } - } - box { - layout = horizontal - LED { - halpin = led.arm2-extended - on-color = yellow - off-color = yellow4 - } - label { text = " Extended" } - } - box { - layout = horizontal - LED { - halpin = led.arm2-0/180 - on-color = yellow - off-color = yellow4 - } - label { text = " 0/180" } - } - box { - layout = horizontal - LED { - halpin = led.arm2-0/60 - on-color = yellow - off-color = yellow4 - } - label { text = " 0/60" } - } - box { - layout = horizontal - LED { - halpin = led.arm2-180 - on-color = yellow - off-color = yellow4 - } - label { text = " 180" } - } - box { - layout = horizontal - LED { - halpin = led.arm2-60 - on-color = yellow - off-color = yellow4 - } - label { text = " 60" } - } - } - box { - layout = vertical - title = "Drawbar" - box { - layout = horizontal - LED { - halpin = led.tool-clamped - on-color = green - off-color = "#060" - } - label { text = " Clamped" } - } - box { - layout = horizontal - LED { - halpin = led.tool-unclamped - on-color = red - off-color = red4 - } - label { text = " Unclamped" } - } - } - } - } - } # main-window -} diff --git a/configs/by_interface/pluto/.gitignore b/configs/by_interface/pluto/.gitignore deleted file mode 100644 index 568b279a60f..00000000000 --- a/configs/by_interface/pluto/.gitignore +++ /dev/null @@ -1 +0,0 @@ -axis_manualtoolchange.hal diff --git a/configs/by_interface/pluto/README b/configs/by_interface/pluto/README deleted file mode 100644 index f12043a589c..00000000000 --- a/configs/by_interface/pluto/README +++ /dev/null @@ -1 +0,0 @@ -Pluto fpga boards diff --git a/configs/by_interface/pluto/lathe-pluto/README b/configs/by_interface/pluto/lathe-pluto/README deleted file mode 100644 index 53effe92556..00000000000 --- a/configs/by_interface/pluto/lathe-pluto/README +++ /dev/null @@ -1 +0,0 @@ -This configuration is for a hobby sized (Sherline) servo-operated lathe based on the Pluto servo driver. The hardware is a Pluto FPGA board ($60) which counts the encoders and generates up/down PWM at high frequency in order to drive H bridges for the lathe's servos. On this prototype machine both servos are driven with one L298 dual H bridge (which is usually used to drive one stepper.) This is an example of (very) inexpensive servo use on a hobby machine and it gives very good performance. diff --git a/configs/by_interface/pluto/lathe-pluto/emc.tbl b/configs/by_interface/pluto/lathe-pluto/emc.tbl deleted file mode 100644 index 39b5452fded..00000000000 --- a/configs/by_interface/pluto/lathe-pluto/emc.tbl +++ /dev/null @@ -1,9 +0,0 @@ -T1 P1 D0.100000 Z+0.100000 I+95.000000 J+155.000000 Q1 ; -T2 P2 D0.100000 I+85.000000 J+25.000000 Q2 ; -T3 P3 D0.100000 I+275.000000 J+335.000000 Q3 ; -T4 P4 D0.100000 I+265.000000 J+205.000000 Q4 ; -T5 P5 D0.100000 I+210.000000 J+150.000000 Q5 ; -T6 P6 D0.100000 X+0.500000 Z+0.500000 I+120.000000 J+60.000000 Q6 ; -T7 P7 D0.100000 I-30.000000 J+30.000000 Q7 ; -T8 P8 D0.100000 I+240.000000 J+300.000000 Q8 ; -T9 P9 D0.100000 Q9 ; diff --git a/configs/by_interface/pluto/lathe-pluto/lathe-pluto.hal b/configs/by_interface/pluto/lathe-pluto/lathe-pluto.hal deleted file mode 100644 index 8764e52f1b0..00000000000 --- a/configs/by_interface/pluto/lathe-pluto/lathe-pluto.hal +++ /dev/null @@ -1,107 +0,0 @@ -# load realtime modules -loadrt [KINS]KINEMATICS -loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS -loadrt pid num_chan=2 debug=1 -loadrt ddt count=4 -loadrt pluto_servo -loadrt scale -loadrt mux2 -loadrt debounce cfg=1 -loadrt limit1 count=1 - -# define the order of execution for RT code -addf pluto-servo.read servo-thread -addf motion-command-handler servo-thread -addf motion-controller servo-thread -addf pid.0.do-pid-calcs servo-thread -addf pid.1.do-pid-calcs servo-thread -addf pluto-servo.write servo-thread - -addf ddt.0 servo-thread -addf ddt.1 servo-thread -addf ddt.2 servo-thread -addf ddt.3 servo-thread -addf scale.0 servo-thread -addf mux2.0 servo-thread -addf debounce.0 servo-thread -addf limit1.0 servo-thread - -setp pluto-servo.encoder.0.scale [JOINT_0]INPUT_SCALE -setp pluto-servo.encoder.1.scale [JOINT_2]INPUT_SCALE -setp pluto-servo.encoder.2.scale -4096 - -setp pluto-servo.pwm.0.scale 26 # volts supply -setp pluto-servo.pwm.1.scale 26 - -setp pid.0.maxoutput 26 # volts at motor -setp pid.1.maxoutput 26 - -# the values below come from the ini -setp pid.0.Pgain [JOINT_0]P -setp pid.0.Igain [JOINT_0]I -setp pid.0.Dgain [JOINT_0]D -setp pid.0.bias [JOINT_0]BIAS -setp pid.0.FF0 [JOINT_0]FF0 -setp pid.0.FF1 [JOINT_0]FF1 -setp pid.0.FF2 [JOINT_0]FF2 -setp pid.0.deadband [JOINT_0]DEADBAND - -setp pid.1.Pgain [JOINT_2]P -setp pid.1.Igain [JOINT_2]I -setp pid.1.Dgain [JOINT_2]D -setp pid.1.bias [JOINT_2]BIAS -setp pid.1.FF0 [JOINT_2]FF0 -setp pid.1.FF1 [JOINT_2]FF1 -setp pid.1.FF2 [JOINT_2]FF2 -setp pid.1.deadband [JOINT_2]DEADBAND - -net Xpos-fb pluto-servo.encoder.0.position => pid.0.feedback joint.0.motor-pos-fb -net Zpos-fb pluto-servo.encoder.1.position => pid.1.feedback joint.2.motor-pos-fb - -net Xpos-cmd joint.0.motor-pos-cmd => pid.0.command ddt.0.in -net Zpos-cmd joint.2.motor-pos-cmd => pid.1.command ddt.2.in - -net Xvel-cmd pid.0.output => pluto-servo.pwm.0.value -net Zvel-cmd pid.1.output => pluto-servo.pwm.1.value - -net Xvel ddt.0.out => ddt.1.in -net Xacc ddt.1.out - -net Zvel ddt.2.out => ddt.3.in -net Zacc ddt.3.out - -# machine ON -net Xenable joint.0.amp-enable-out => pid.0.enable pluto-servo.pwm.0.enable pluto-servo.dout.09 -net Zenable joint.2.amp-enable-out => pid.1.enable pluto-servo.pwm.1.enable - -net estop-loop iocontrol.0.user-enable-out iocontrol.0.emc-enable-in - -# spindle SSR -# net spindle-fwd spindle.0.forward pluto-servo.dout.00 - -setp debounce.0.delay 3 -net Xswitch pluto-servo.din.00-not => debounce.0.0.in -net Xswitch-debounced debounce.0.0.out => joint.0.home-sw-in joint.0.pos-lim-sw-in - -# tool loading loopback -net tool-prep-loop iocontrol.0.tool-prepare iocontrol.0.tool-prepared -net tool-change-loop iocontrol.0.tool-change iocontrol.0.tool-changed - -# spindle speed control -setp pluto-servo.pwm.3.enable 1 - -# this needs scale/offset to give the right speeds, but 0 should be 0 -net spindle-speed-cmd spindle.0.speed-out => limit1.0.in -net spindle-speed-cmd-limited limit1.0.out => scale.0.in -setp scale.0.gain 0.00026315789 # 1/3800 -setp scale.0.offset 0.105 -setp mux2.0.in0 0 -setp limit1.0.max 1300 -net spindle-speed-scaled scale.0.out => mux2.0.in1 -net spindle-fwd spindle.0.forward => mux2.0.sel pluto-servo.dout.00 -net spindle-pwm mux2.0.out => pluto-servo.pwm.3.value - -# spindle position, for threading -net spindle-index spindle.0.index-enable <=> pluto-servo.encoder.2.index-enable -net spindle-pos pluto-servo.encoder.2.position => spindle.0.revs -net spindle-speed-fb pluto-servo.encoder.2.velocity => spindle.0.speed-in diff --git a/configs/by_interface/pluto/lathe-pluto/lathe-pluto.ini b/configs/by_interface/pluto/lathe-pluto/lathe-pluto.ini deleted file mode 100644 index ea364bd38fe..00000000000 --- a/configs/by_interface/pluto/lathe-pluto/lathe-pluto.ini +++ /dev/null @@ -1,127 +0,0 @@ -[EMC] -VERSION = 1.1 -MACHINE = LATHE-PLUTO -DEBUG = 0 - -[DISPLAY] -PYVCP = vcp.xml -DISPLAY = axis -LATHE = 1 -CYCLE_TIME = 0.200 -POSITION_OFFSET = RELATIVE -POSITION_FEEDBACK = ACTUAL -MAX_FEED_OVERRIDE = 1.5 -PROGRAM_PREFIX = ../../nc_files/ -# Editor to be used with Axis -#EDITOR = geany - -[FILTER] -PROGRAM_EXTENSION = .py Python Script -PROGRAM_EXTENSION = .NGC rs274ngc files -py = python3 - -[RS274NGC] -PARAMETER_FILE = emc.var - -[EMCMOT] -EMCMOT = motmod -COMM_TIMEOUT = 1.0 -SERVO_PERIOD = 500000 - -[TASK] -TASK = milltask -CYCLE_TIME = 0.001 - -[HAL] -HALFILE = lathe-pluto.hal -HALFILE = axis_manualtoolchange.hal -POSTGUI_HALFILE = postgui.hal - -[HALUI] -#No Content - -[TRAJ] -COORDINATES = X Z -HOME = 0 0 0 -LINEAR_UNITS = mm -ANGULAR_UNITS = deg -DEFAULT_LINEAR_VELOCITY = 10 -MAX_LINEAR_VELOCITY = 32.5 -DEFAULT_LINEAR_ACCELERATION = 400 -MAX_LINEAR_ACCELERATION = 707 - -[EMCIO] -TOOL_TABLE = emc.tbl -TOOL_CHANGE_POSITION = 40 0 20 - -[KINS] -KINEMATICS = trivkins -JOINTS = 3 - -[AXIS_X] -MIN_LIMIT = -10.0 -MAX_LIMIT = 40.50001 -MAX_VELOCITY = 23 -MAX_ACCELERATION = 500 - -[JOINT_0] -TYPE = LINEAR -UNITS = 1.0 -HOME = 40.5 -MAX_VELOCITY = 23 -MAX_ACCELERATION = 500 -BACKLASH = 0.06 -CYCLE_TIME = 0.001000 -INPUT_SCALE = 6000 -OUTPUT_SCALE = 1.000 -MIN_LIMIT = -10.0 -MAX_LIMIT = 40.50001 -FERROR = .1 -MIN_FERROR = .03 -HOME_OFFSET = 41.14 -HOME_SEARCH_VEL = 12 -HOME_LATCH_VEL = -0.2 -HOME_USE_INDEX = NO -HOME_IGNORE_LIMITS = YES -P = 1000 -I = 30000 -D = 7 -BIAS = 0 -FF0 = 0 -FF1 = 1 -FF2 = 0.025 -DEADBAND=.00009 - -[AXIS_Z] -MIN_LIMIT = -1.0 -MAX_LIMIT = 90.0 -MAX_VELOCITY = 23 -MAX_ACCELERATION = 500 - -[JOINT_2] -TYPE = LINEAR -UNITS = 1.0 -HOME = 0.000 -MAX_VELOCITY = 23 -MAX_ACCELERATION = 500 -BACKLASH = 0.00 -CYCLE_TIME = 0.001000 -INPUT_SCALE = -6000 -OUTPUT_SCALE = 1.000 -MIN_LIMIT = -1.0 -MAX_LIMIT = 90.0 -FERROR = 0.35 -MIN_FERROR = 0.20 -HOME_OFFSET = 0.0 -HOME_SEARCH_VEL = 0.0 -HOME_LATCH_VEL = 0.0 -HOME_USE_INDEX = NO -HOME_IGNORE_LIMITS = NO -P = 1000 -I = 30000 -D = 7 -BIAS = 0 -FF0 = 0 -FF1 = 1 -FF2 = 0.025 -DEADBAND=.00009 diff --git a/configs/by_interface/pluto/lathe-pluto/postgui.hal b/configs/by_interface/pluto/lathe-pluto/postgui.hal deleted file mode 100644 index be64e66ad85..00000000000 --- a/configs/by_interface/pluto/lathe-pluto/postgui.hal +++ /dev/null @@ -1,4 +0,0 @@ -net Xvel-cmd pyvcp.xpid-bar -net Zvel-cmd pyvcp.zpid-bar - -net spindle-speed-cmd pyvcp.spindle-bar diff --git a/configs/by_interface/pluto/lathe-pluto/vcp.xml b/configs/by_interface/pluto/lathe-pluto/vcp.xml deleted file mode 100644 index 82426276ed4..00000000000 --- a/configs/by_interface/pluto/lathe-pluto/vcp.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - -"xpid-bar"-2626 - - -"zpid-bar"-2626 - - -"spindle-bar"01500 - - diff --git a/configs/by_interface/pluto/pluto_inch/pluto_inch.ini b/configs/by_interface/pluto/pluto_inch/pluto_inch.ini deleted file mode 100644 index e0d6ae524c0..00000000000 --- a/configs/by_interface/pluto/pluto_inch/pluto_inch.ini +++ /dev/null @@ -1,195 +0,0 @@ -# EMC controller parameters for generic controller. Make these what you need -# for your system. -# General note: Comments can either be preceded with a # or ; - either is -# acceptable, although # is in keeping with most linux config files. -# Settings with a + at the front of the comment are likely needed to get -# changed by the user. -# Settings with a - at the front are highly unneeded to be changed -############################################################################### -# General section -############################################################################### - -[EMC] -#- Version of this INI file -VERSION = 1.1 -#+ Name of machine, for use with display, etc. -MACHINE = LinuxCNC-HAL-STEP-PLUTO -#+ Debug level, 0 means no messages. See src/emc/nml_int/emcglb.h for others -DEBUG = 0 -# DEBUG = 0x00000007 -# DEBUG = 0x7FFFFFFF -############################################################################### -# Sections for display options -############################################################################### - -[DISPLAY] -DISPLAY = axis -# Cycle time, in seconds, that display will sleep between polls -CYCLE_TIME = 0.200 -#- Path to help file -HELP_FILE = doc/help.txt -#- Initial display setting for position, RELATIVE or MACHINE -POSITION_OFFSET = RELATIVE -#- Initial display setting for position, COMMANDED or ACTUAL -POSITION_FEEDBACK = ACTUAL -#+ Highest value that will be allowed for feed override, 1.0 = 100% -MAX_FEED_OVERRIDE = 1.2 -#- Prefix to be used -PROGRAM_PREFIX = ../../nc_files/ -#- Introductory graphic -INTRO_GRAPHIC = linuxcnc.gif -INTRO_TIME = 5 -# Editor to be used with Axis -#EDITOR = geany -############################################################################### -# Task controller section -############################################################################### - -[FILTER] -#No Content - -[RS274NGC] -#- File containing interpreter variables -PARAMETER_FILE = stepper.var -############################################################################### -# Motion control section -############################################################################### - -[EMCMOT] -#- Name of the motion controller to use (only one exists for nontrivkins) -EMCMOT = motmod -#- Timeout for comm to emcmot, in seconds -COMM_TIMEOUT = 1.0 -#- Servo task period, in nanosecs -SERVO_PERIOD = 1000000 -############################################################################### -# Hardware Abstraction Layer section -############################################################################### - -[TASK] -# Name of task controller program, e.g., milltask -TASK = milltask -#- Cycle time, in seconds, that task controller will sleep between polls -CYCLE_TIME = 0.010 -############################################################################### -# Part program interpreter section -############################################################################### - -[HAL] -# The run script first uses halcmd to execute any HALFILE -# files, and then to execute any individual HALCMD commands. -# -# list of hal config files to run through halcmd -#+ files are executed in the order in which they appear -HALFILE = pluto_pinout.hal -HALFILE = -#- list of halcmd commands to execute -# commands are executed in the order in which they appear -#HALCMD = save neta -############################################################################### -# Trajectory planner section -############################################################################### - -[HALUI] -#No Content - -[TRAJ] -#+ machine specific settings -# COORDINATES = X Y Z A B C -COORDINATES = X Y Z -HOME = 0 0 0 -LINEAR_UNITS = inch -ANGULAR_UNITS = degree -DEFAULT_LINEAR_VELOCITY = 1.2 -MAX_LINEAR_VELOCITY = 1.2 -DEFAULT_LINEAR_ACCELERATION = 15.0 -MAX_LINEAR_ACCELERATION = 20.0 -############################################################################### -# Axes sections -############################################################################### -#+ First axis - -[EMCIO] -#- tool table file -TOOL_TABLE = stepper.tbl - -[KINS] -KINEMATICS = trivkins -JOINTS = 3 - -[AXIS_X] -MIN_LIMIT = -10.0 -MAX_LIMIT = 10.0 -MAX_VELOCITY = .5667 -MAX_ACCELERATION = 20.0 - -[JOINT_0] -TYPE = LINEAR -HOME = 0.000 -MAX_VELOCITY = .5667 -MAX_ACCELERATION = 20.0 -BACKLASH = 0.000 -SCALE = 6400 -OUTPUT_SCALE = 1.000 -MIN_LIMIT = -10.0 -MAX_LIMIT = 10.0 -FERROR = 0.050 -MIN_FERROR = 0.010 -HOME_OFFSET = 0.0 -HOME_SEARCH_VEL = 0.0 -HOME_LATCH_VEL = 0.0 -HOME_USE_INDEX = NO -HOME_IGNORE_LIMITS = NO -#+ Second axis - -[AXIS_Y] -MIN_LIMIT = -10.0 -MAX_LIMIT = 10.0 -MAX_VELOCITY = .5667 -MAX_ACCELERATION = 20.0 - -[JOINT_1] -TYPE = LINEAR -HOME = 0.000 -MAX_VELOCITY = .5667 -MAX_ACCELERATION = 20.0 -BACKLASH = 0.000 -SCALE = 6400 -OUTPUT_SCALE = 1.000 -MIN_LIMIT = -10.0 -MAX_LIMIT = 10.0 -FERROR = 0.050 -MIN_FERROR = 0.010 -HOME_OFFSET = 0.0 -HOME_SEARCH_VEL = 0.0 -HOME_LATCH_VEL = 0.0 -HOME_USE_INDEX = NO -HOME_IGNORE_LIMITS = NO -#+ Third axis - -[AXIS_Z] -MIN_LIMIT = -2.0 -MAX_LIMIT = 4.0 -MAX_VELOCITY = .3667 -MAX_ACCELERATION = 15.0 - -[JOINT_2] -TYPE = LINEAR -HOME = 0.0 -MAX_VELOCITY = .3667 -MAX_ACCELERATION = 15.0 -BACKLASH = 0.000 -SCALE = 8000 -OUTPUT_SCALE = 1.000 -MIN_LIMIT = -2.0 -MAX_LIMIT = 4.0 -FERROR = 0.050 -MIN_FERROR = 0.010 -HOME_OFFSET = 0.0 -HOME_SEARCH_VEL = 0.0 -HOME_LATCH_VEL = 0.0 -HOME_USE_INDEX = NO -HOME_IGNORE_LIMITS = NO -############################################################################### -# section for main IO controller parameters -############################################################################### diff --git a/configs/by_interface/pluto/pluto_inch/pluto_pinout.hal b/configs/by_interface/pluto/pluto_inch/pluto_pinout.hal deleted file mode 100644 index c50cf7b91f5..00000000000 --- a/configs/by_interface/pluto/pluto_inch/pluto_pinout.hal +++ /dev/null @@ -1,40 +0,0 @@ -# first load the core RT modules that will be needed -# kinematics -loadrt [KINS]KINEMATICS -# motion controller, get name and thread periods from ini file -loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS - -loadrt pluto_step -addf pluto-step.read servo-thread -addf motion-command-handler servo-thread -addf motion-controller servo-thread -addf pluto-step.write servo-thread - -setp pluto-step.stepgen.0.scale [JOINT_0]SCALE -setp pluto-step.stepgen.1.scale [JOINT_1]SCALE -setp pluto-step.stepgen.2.scale [JOINT_2]SCALE - -net Xpos-cmd joint.0.motor-pos-cmd => pluto-step.stepgen.0.position-cmd -net Ypos-cmd joint.1.motor-pos-cmd => pluto-step.stepgen.1.position-cmd -net Zpos-cmd joint.2.motor-pos-cmd => pluto-step.stepgen.2.position-cmd - -net Xpos-fb pluto-step.stepgen.0.position-fb => joint.0.motor-pos-fb -net Ypos-fb pluto-step.stepgen.1.position-fb => joint.1.motor-pos-fb -net Zpos-fb pluto-step.stepgen.2.position-fb => joint.2.motor-pos-fb - -net Xen joint.0.amp-enable-out => pluto-step.stepgen.0.enable -net Yen joint.1.amp-enable-out => pluto-step.stepgen.1.enable -net Zen joint.2.amp-enable-out => pluto-step.stepgen.2.enable - -# create a signal for the estop loopback -net estop-loop iocontrol.0.user-enable-out iocontrol.0.emc-enable-in - -# create signals for tool prepare loopback -net tool-prep-loop iocontrol.0.tool-prepare iocontrol.0.tool-prepared - -# create a signal for "spindle on" -net spindle_on spindle.0.on => pluto-step.dout.00 - -setp pluto-step.stepgen.steplen 20000 -setp pluto-step.stepgen.stepspace 20000 -setp pluto-step.stepgen.dirtime 20000 diff --git a/configs/by_interface/servotogo/README b/configs/by_interface/servotogo/README deleted file mode 100644 index 45f30ef1b79..00000000000 --- a/configs/by_interface/servotogo/README +++ /dev/null @@ -1 +0,0 @@ -ServoToGo diff --git a/configs/by_interface/servotogo/stg.ini b/configs/by_interface/servotogo/stg.ini deleted file mode 100644 index 65af0f3122c..00000000000 --- a/configs/by_interface/servotogo/stg.ini +++ /dev/null @@ -1,244 +0,0 @@ -# EMC controller parameters for generic controller. Make these what you need -# for your system. -# General note: Comments can either be preceded with a # or ; - either is -# acceptable, although # is in keeping with most linux config files. -# Settings with a + at the front of the comment are likely needed to get -# changed by the user. -# Settings with a - at the front are highly unneeded to be changed -############################################################################### -# General section -############################################################################### - -[EMC] -#- Version of this INI file -VERSION = 1.1 -#+ Name of machine, for use with display, etc. -MACHINE = LinuxCNC-HAL-STG -#+ Debug level, 0 means no messages. See src/emc/nml_int/emcglb.h for others -DEBUG = 0 -# DEBUG = 0x00000007 -# DEBUG = 0x7FFFFFFF -############################################################################### -# Sections for display options -############################################################################### - -[DISPLAY] -#+ Name of display program, e.g., axis -# DISPLAY = axis - DISPLAY = tklinuxcnc -# Cycle time, in seconds, that display will sleep between polls -CYCLE_TIME = 0.200 -#- Path to help file -HELP_FILE = tklinuxcnc.txt -#- Initial display setting for position, RELATIVE or MACHINE -POSITION_OFFSET = RELATIVE -#- Initial display setting for position, COMMANDED or ACTUAL -POSITION_FEEDBACK = ACTUAL -#+ Highest value that will be allowed for feed override, 1.0 = 100% -MAX_FEED_OVERRIDE = 1.2 -#- Prefix to be used -PROGRAM_PREFIX = ../../nc_files/ -#- Introductory graphic -INTRO_GRAPHIC = linuxcnc.gif -INTRO_TIME = 5 -############################################################################### -# Task controller section -############################################################################### - -[FILTER] -#No Content - -[RS274NGC] -#- File containing interpreter variables -PARAMETER_FILE = stg.var -############################################################################### -# Motion control section -############################################################################### - -[EMCMOT] -#- Name of the motion controller to use (only one exists for nontrivkins) -EMCMOT = motmod -#- Timeout for comm to emcmot, in seconds -COMM_TIMEOUT = 1.0 -#- Servo task period, in nanosecs - will be rounded to an int multiple of BASE_PERIOD -SERVO_PERIOD = 1000000 -############################################################################### -# Hardware Abstraction Layer section -############################################################################### - -[TASK] -# Name of task controller program, e.g., milltask -TASK = milltask -#- Cycle time, in seconds, that task controller will sleep between polls -CYCLE_TIME = 0.010 -############################################################################### -# Part program interpreter section -############################################################################### - -[HAL] -# The run script first uses halcmd to execute any HALFILE -# files, and then to execute any individual HALCMD commands. -# -# list of hal config files to run through halcmd -#+ files are executed in the order in which they appear -HALFILE = core_servo.hal -HALFILE = stg_motion.hal -HALFILE = stg_io.hal -#- list of halcmd commands to execute -# commands are executed in the order in which they appear -#HALCMD = save neta -############################################################################### -# Trajectory planner section -############################################################################### - -[HALUI] -#No Content - -[TRAJ] -#+ machine specific settings -# COORDINATES = X Y Z R P W -COORDINATES = X Y Z -HOME = 0 0 0 -LINEAR_UNITS = mm -ANGULAR_UNITS = degree -DEFAULT_LINEAR_VELOCITY = 0.424 -MAX_LINEAR_VELOCITY = 30.48 -DEFAULT_LINEAR_ACCELERATION = 300.0 -MAX_LINEAR_ACCELERATION = 500.0 -############################################################################### -# Axes sections -############################################################################### -#+ First axis -# each setting is commented for axis_0 - -[EMCIO] -#- tool table file -TOOL_TABLE = stg.tbl - -[KINS] -KINEMATICS = trivkins -JOINTS = 3 - -[AXIS_X] -MIN_LIMIT = -1000.0 -MAX_LIMIT = 1000.0 -MAX_VELOCITY = 30.48 -MAX_ACCELERATION = 500.0 - -[JOINT_0] -# type of axis, LINEAR vs. ROTARY -TYPE = LINEAR -# home position -HOME = 0.000 -# maximum velocity -MAX_VELOCITY = 30.48 -# maximum acceleration -MAX_ACCELERATION = 500.0 -# mechanical backlash measured -BACKLASH = 0.000 -# time to update the axis -# number of encoder ticks / unit -INPUT_SCALE = 200 -# dac gain for output -OUTPUT_SCALE = 1.000 -# dac bias for output -OUTPUT_OFFSET = 0.000 -# minimum travel limit (from position 0) -MIN_LIMIT = -1000.0 -# maximum travel limit (from position 0) -MAX_LIMIT = 1000.0 -# following error at max speed -FERROR = 1.270 -# following error when halted -MIN_FERROR = 0.254 -# read HAL_Introduction.pdf for an insight about Homing -HOME_OFFSET = 0.0 -HOME_SEARCH_VEL = 0.0 -HOME_LATCH_VEL = 0.0 -HOME_USE_INDEX = NO -HOME_IGNORE_LIMITS = NO -# PID tuning params -MAX_OUTPUT = 1.0 -DEADBAND = 0.000381 -P = 100.0 -I = 0.000 -D = 0.000 -FF0 = 0.000 -FF1 = 0.000 -FF2 = 0.0 -BIAS = 0.000 -#+ Second axis - -[AXIS_Y] -MIN_LIMIT = -1000.0 -MAX_LIMIT = 1000.0 -MAX_VELOCITY = 30.48 -MAX_ACCELERATION = 500.0 - -[JOINT_1] -TYPE = LINEAR -HOME = 0.000 -MAX_VELOCITY = 30.48 -MAX_ACCELERATION = 500.0 -BACKLASH = 0.000 -INPUT_SCALE = 200 -OUTPUT_SCALE = 1.000 -OUTPUT_OFFSET = 0.000 -MIN_LIMIT = -1000.0 -MAX_LIMIT = 1000.0 -FERROR = 1.270 -MIN_FERROR = 0.254 -HOME_OFFSET = 0.0 -HOME_SEARCH_VEL = 0.0 -HOME_LATCH_VEL = 0.0 -HOME_USE_INDEX = NO -HOME_IGNORE_LIMITS = NO -# PID tuning params -MAX_OUTPUT = 1.0 -DEADBAND = 0.000381 -P = 100.0 -I = 0.000 -D = 0.000 -FF0 = 0.000 -FF1 = 0.000 -FF2 = 0.0 -BIAS = 0.000 -#+ Third axis - -[AXIS_Z] -MIN_LIMIT = -1000.0 -MAX_LIMIT = 1000.0 -MAX_VELOCITY = 30.48 -MAX_ACCELERATION = 500.0 - -[JOINT_2] -TYPE = LINEAR -HOME = 0.0 -MAX_VELOCITY = 30.48 -MAX_ACCELERATION = 500.0 -BACKLASH = 0.000 -INPUT_SCALE = 200 -OUTPUT_SCALE = 1.000 -OUTPUT_OFFSET = 0.000 -MIN_LIMIT = -1000.0 -MAX_LIMIT = 1000.0 -FERROR = 1.270 -MIN_FERROR = 0.254 -HOME_OFFSET = 0.0 -HOME_SEARCH_VEL = 0.0 -HOME_LATCH_VEL = 0.0 -HOME_USE_INDEX = NO -HOME_IGNORE_LIMITS = NO -# PID tuning params -MAX_OUTPUT = 1.0 -DEADBAND = 0.000381 -P = 100.0 -I = 0.000 -D = 0.000 -FF0 = 0.000 -FF1 = 0.000 -FF2 = 0.0 -BIAS = 0.000 -############################################################################### -# section for main IO controller parameters -############################################################################### diff --git a/configs/by_interface/servotogo/stg.tbl b/configs/by_interface/servotogo/stg.tbl deleted file mode 100644 index c0b72de0652..00000000000 --- a/configs/by_interface/servotogo/stg.tbl +++ /dev/null @@ -1,4 +0,0 @@ -T1 P1 D0.125000 Z+0.511000 ;1/8 end mill -T2 P2 D0.062500 Z+0.100000 ;1/16 end mill -T3 P3 D0.201000 Z+1.273000 ;#7 tap drill -T99999 P99999 Z+0.100000 ;big tool number diff --git a/configs/by_interface/servotogo/stg.txt b/configs/by_interface/servotogo/stg.txt deleted file mode 100644 index 1f03171a377..00000000000 --- a/configs/by_interface/servotogo/stg.txt +++ /dev/null @@ -1,32 +0,0 @@ -This configuration step is intended for servo machines running the ServoToGo card. - -Both the STG1 and STG2 are supported. - -You can have either a standard pinout (LinuxCNC style) or you could make a new one which would suit your own custom cabling. - -Right now the ini file is for metric setup, but an inch specific one could be easily added. - -Detailed description: - -* nml files - --- it uses a default nml file (found in configs/common/linuxcnc.nml) - -* hal files - --- it uses a default servo hal file (configs/common/core_servo.hal) - --- stg_motion.hal - this is the main hal file for the STG, it loads the stg driver and sets up motion specific links, it is fairly well commented, so it should be easy to read / modify. - --- stg_io.hal - this is the second hal file for the STG, it configures IO specific links (like the pin number where the X limit switch is, or where the spindle start pin is connected), it is fairly well commented, so it should be easy to read / modify. This servo setup is mostly for serious machines, so the ESTOP should really be planned / implemented properly (that means use an external ESTOP chain, and let LinuxCNC know about it, and let LinuxCNC interrupt the external chain too). - -Read more about this in the wiki at http://wiki.linuxcnc.org/ - -* additional files - --- stg.tbl - this is the tool table file, and it holds definitions for the tools used, along with tool sizes for compensation (tool length & tool diameter) - --- stg.var - the variables file. This file is used by the interpreter to save internal variables when LinuxCNC shuts down, and rereads them on the next startup. - -Further specific information can be found in the LinuxCNC wiki: - http://wiki.linuxcnc.org/ diff --git a/configs/by_interface/servotogo/stg_io.hal b/configs/by_interface/servotogo/stg_io.hal deleted file mode 100644 index 64cea5cc34f..00000000000 --- a/configs/by_interface/servotogo/stg_io.hal +++ /dev/null @@ -1,111 +0,0 @@ -# HAL config file for ServoToGo STG ISA board -# -# install driver (only needed if stg_motion.hal doesn't get run) -#loadrt hal_stg - -# add I/O to servo thread so they will be evaluated -# every servo period -# read inputs first -addf stg.di-read servo-thread 1 -# write outputs last -addf stg.do-write servo-thread 1 - -#uncomment following line if ADC's are needed (for example spindle-tach feedback) -#addf stg.0.read-adcs servo-thread 1 - -# -# Connect motion controller I/Os -# - -# connect limit/home switch outputs to motion controller -net Xminlim <= stg.in-02 -net Xminlim => joint.0.neg-lim-sw-in -net Xmaxlim <= stg.in-01 -net Xmaxlim => joint.0.pos-lim-sw-in -net Xhome <= stg.in-00 -net Xhome => joint.0.home-sw-in - -net Yminlim <= stg.in-06 -net Yminlim => joint.1.neg-lim-sw-in -net Ymaxlim <= stg.in-05 -net Ymaxlim => joint.1.pos-lim-sw-in -net Yhome <= stg.in-04 -net Yhome => joint.1.home-sw-in - -net Zminlim <= stg.in-10 -net Zminlim => joint.2.neg-lim-sw-in -net Zmaxlim <= stg.in-09 -net Zmaxlim => joint.2.pos-lim-sw-in -net Zhome <= stg.in-08 -net Zhome => joint.2.home-sw-in - -#continue in the same manner for further axes (A,B,C) - -# connect amp faults to motion controller -net Xfault <= stg.in-03 -net Xfault => joint.0.amp-fault-in -net Yfault <= stg.in-07 -net Yfault => joint.1.amp-fault-in -net Zfault <= stg.in-11 -net Zfault => joint.2.amp-fault-in - -# connect index pulses to motion controller -# do these when index pulsing is figured out -#newsig Xindex bit -#newsig Yindex bit -#newsig Zindex bit -#linksp Xindex <= stg.0.enc-index -#linksp Xindex => joint.0.index-enable -#linksp Yindex <= stg.1.enc-index -#linksp Yindex => joint.1.index-enable -#linksp Zindex <= stg.2.enc-index -#linksp Zindex => joint.2.index-enable - -# connect amp enables to motion controller -net Xenable => stg.out-00 -net Yenable => stg.out-01 -net Zenable => stg.out-02 - -# connect watchdog reset to motion controller -# needs watchdo -#newsig WatchdogRst bit -#linksp WatchdogRst <= stg.watchdog-reset -#linksp WatchdogRst => motion.watchdog-reset-out - - -# -# Connect I/O controller I/Os -# - -# connect e-stop write/sense to I/O controller -# these connections assume an external ESTOP circuitry will be used -# if it's not used, comment the next lines and uncomment the loopback -net EstopSense <= stg.in-12 -net EstopSense => iocontrol.0.emc-enable-in -net EstopWrite <= stg.out-07 -net EstopWrite => iocontrol.0.user-enable-out - -# ESTOP loopback, only use this for a simple machine without external ESTOP -# you really SHOULDN'T use a servo machine without proper ESTOP -#net estop-loop iocontrol.0.user-enable-out iocontrol.0.emc-enable-in - -# connect spindle fwd/rev to I/O controller -net SpindleFwd <= stg.out-06 -net SpindleFwd => spindle.0.forward -net SpindleRev <= stg.out-05 -net SpindleRev => spindle.0.reverse - -# connect spindle brake to I/O controller -net SpindleBrakeOn <= stg.out-10 -net SpindleBrakeOn => spindle.0.brake - -# connect mist/flood coolant to I/O controller -net MistOn <= stg.out-11 -net MistOn => iocontrol.0.coolant-mist -net FloodOn <= stg.out-12 -net FloodOn => iocontrol.0.coolant-flood - -# create signals for tool loading loopback -net tool-prep-loop iocontrol.0.tool-prepare iocontrol.0.tool-prepared -net tool-change-loop iocontrol.0.tool-change iocontrol.0.tool-changed - diff --git a/configs/by_interface/servotogo/stg_motion.hal b/configs/by_interface/servotogo/stg_motion.hal deleted file mode 100644 index 30a6078fc1e..00000000000 --- a/configs/by_interface/servotogo/stg_motion.hal +++ /dev/null @@ -1,37 +0,0 @@ -# HAL config file for ServoToGo STG ISA board -# -# install driver, this should autodetect the board -# if that doesn't work, try using base=0xABC, where ABC matches your setup -# loadrt hal_stg base=0x200 -loadrt hal_stg - -# add functions to servo thread so they will be evaluated -# every servo period -# read inputs first -addf stg.capture-position servo-thread 1 -# write outputs last -addf stg.write-dacs servo-thread -1 - -# connect position feedback signals to encoders -net Xpos-fb <= stg.0.position -net Ypos-fb <= stg.1.position -net Zpos-fb <= stg.2.position - -# get feedback scaling from ini file -setp stg.0.position-scale [JOINT_0]INPUT_SCALE -setp stg.1.position-scale [JOINT_1]INPUT_SCALE -setp stg.2.position-scale [JOINT_2]INPUT_SCALE - -# connect PID output signals to DACs -net Xoutput => stg.0.dac-value -net Youtput => stg.1.dac-value -net Zoutput => stg.2.dac-value - -# set output scaling from ini file -setp stg.0.dac-gain [JOINT_0]OUTPUT_SCALE -setp stg.1.dac-gain [JOINT_1]OUTPUT_SCALE -setp stg.2.dac-gain [JOINT_2]OUTPUT_SCALE -# set output offset to zero -setp stg.0.dac-offset [JOINT_0]OUTPUT_OFFSET -setp stg.1.dac-offset [JOINT_1]OUTPUT_OFFSET -setp stg.2.dac-offset [JOINT_2]OUTPUT_OFFSET diff --git a/configs/by_interface/vigilant/README b/configs/by_interface/vigilant/README deleted file mode 100644 index 58c8a7c071a..00000000000 --- a/configs/by_interface/vigilant/README +++ /dev/null @@ -1,3 +0,0 @@ -Vigilant Products - -www.vigproducts.com diff --git a/configs/by_interface/vigilant/vti.ini b/configs/by_interface/vigilant/vti.ini deleted file mode 100644 index acbbb80132b..00000000000 --- a/configs/by_interface/vigilant/vti.ini +++ /dev/null @@ -1,244 +0,0 @@ -# EMC controller parameters for generic controller. Make these what you need -# for your system. -# General note: Comments can either be preceded with a # or ; - either is -# acceptable, although # is in keeping with most linux config files. -# Settings with a + at the front of the comment are likely needed to get -# changed by the user. -# Settings with a - at the front are highly unneeded to be changed -############################################################################### -# General section -############################################################################### - -[EMC] -#- Version of this INI file -VERSION = 1.1 -#+ Name of machine, for use with display, etc. -MACHINE = LinuxCNC-HAL-VTI -#+ Debug level, 0 means no messages. See src/emc/nml_int/emcglb.h for others -DEBUG = 0 -# DEBUG = 0x00000007 -# DEBUG = 0x7FFFFFFF -############################################################################### -# Sections for display options -############################################################################### - -[DISPLAY] -#+ Name of display program, e.g., axis -# DISPLAY = axis - DISPLAY = tklinuxcnc -# Cycle time, in seconds, that display will sleep between polls -CYCLE_TIME = 0.200 -#- Path to help file -HELP_FILE = tklinuxcnc.txt -#- Initial display setting for position, RELATIVE or MACHINE -POSITION_OFFSET = RELATIVE -#- Initial display setting for position, COMMANDED or ACTUAL -POSITION_FEEDBACK = ACTUAL -#+ Highest value that will be allowed for feed override, 1.0 = 100% -MAX_FEED_OVERRIDE = 1.2 -#- Prefix to be used -PROGRAM_PREFIX = ../../nc_files/ -#- Introductory graphic -INTRO_GRAPHIC = linuxcnc.gif -INTRO_TIME = 5 -############################################################################### -# Task controller section -############################################################################### - -[FILTER] -#No Content - -[RS274NGC] -#- File containing interpreter variables -PARAMETER_FILE = vti.var -############################################################################### -# Motion control section -############################################################################### - -[EMCMOT] -#- Name of the motion controller to use (only one exists for nontrivkins) -EMCMOT = motmod -#- Timeout for comm to emcmot, in seconds -COMM_TIMEOUT = 1.0 -#- Servo task period, in nanosecs -SERVO_PERIOD = 1000000 -############################################################################### -# Hardware Abstraction Layer section -############################################################################### - -[TASK] -# Name of task controller program, e.g., milltask -TASK = milltask -#- Cycle time, in seconds, that task controller will sleep between polls -CYCLE_TIME = 0.010 -############################################################################### -# Part program interpreter section -############################################################################### - -[HAL] -# The run script first uses halcmd to execute any HALFILE -# files, and then to execute any individual HALCMD commands. -# -# list of hal config files to run through halcmd -#+ files are executed in the order in which they appear -HALFILE = core_servo.hal -HALFILE = vti_motion.hal -HALFILE = vti_io.hal -#- list of halcmd commands to execute -# commands are executed in the order in which they appear -#HALCMD = save neta -############################################################################### -# Trajectory planner section -############################################################################### - -[HALUI] -#No Content - -[TRAJ] -#+ machine specific settings -# COORDINATES = X Y Z R P W -COORDINATES = X Y Z -HOME = 0 0 0 -LINEAR_UNITS = mm -ANGULAR_UNITS = degree -DEFAULT_LINEAR_VELOCITY = 2.000 -MAX_LINEAR_VELOCITY = 30.48 -DEFAULT_LINEAR_ACCELERATION = 300.0 -MAX_LINEAR_ACCELERATION = 500.0 -############################################################################### -# Axes sections -############################################################################### -#+ First axis -# each setting is commented for axis_0 - -[EMCIO] -#- tool table file -TOOL_TABLE = vti.tbl - -[KINS] -KINEMATICS = trivkins -JOINTS = 3 - -[AXIS_X] -MIN_LIMIT = -1000.0 -MAX_LIMIT = 1000.0 -MAX_VELOCITY = 30.48 -MAX_ACCELERATION = 500.0 - -[JOINT_0] -# type of axis, LINEAR vs. ROTARY -TYPE = LINEAR -# home position -HOME = 0.000 -# maximum velocity -MAX_VELOCITY = 30.48 -# maximum acceleration -MAX_ACCELERATION = 500.0 -# mechanical backlash measured -BACKLASH = 0.000 -# time to update the axis -# number of encoder ticks / unit -INPUT_SCALE = 800 -# dac gain for output -OUTPUT_SCALE = 1.000 -# dac bias for output -OUTPUT_OFFSET = 0.000 -# minimum travel limit (from position 0) -MIN_LIMIT = -1000.0 -# maximum travel limit (from position 0) -MAX_LIMIT = 1000.0 -# following error at max speed -FERROR = 1.270 -# following error when halted -MIN_FERROR = 0.254 -# read HAL_Introduction.pdf for an insight about Homing -HOME_OFFSET = 0.0 -HOME_SEARCH_VEL = 0.0 -HOME_LATCH_VEL = 0.0 -HOME_USE_INDEX = NO -HOME_IGNORE_LIMITS = YES -# PID tuning params -MAX_OUTPUT = 1.0 -DEADBAND = 0.000381 -P = 100.0 -I = 0.000 -D = 0.000 -FF0 = 0.000 -FF1 = 0.000 -FF2 = 0.0 -BIAS = 0.000 -#+ Second axis - -[AXIS_Y] -MIN_LIMIT = -1000.0 -MAX_LIMIT = 1000.0 -MAX_VELOCITY = 30.48 -MAX_ACCELERATION = 500.0 - -[JOINT_1] -TYPE = LINEAR -HOME = 0.000 -MAX_VELOCITY = 30.48 -MAX_ACCELERATION = 500.0 -BACKLASH = 0.000 -INPUT_SCALE = 200 -OUTPUT_SCALE = 1.000 -OUTPUT_OFFSET = 0.000 -MIN_LIMIT = -1000.0 -MAX_LIMIT = 1000.0 -FERROR = 1.270 -MIN_FERROR = 0.254 -HOME_OFFSET = 0.0 -HOME_SEARCH_VEL = 0.0 -HOME_LATCH_VEL = 0.0 -HOME_USE_INDEX = NO -HOME_IGNORE_LIMITS = NO -# PID tuning params -MAX_OUTPUT = 1.0 -DEADBAND = 0.000381 -P = 100.0 -I = 0.000 -D = 0.000 -FF0 = 0.000 -FF1 = 0.000 -FF2 = 0.0 -BIAS = 0.000 -#+ Third axis - -[AXIS_Z] -MIN_LIMIT = -1000.0 -MAX_LIMIT = 1000.0 -MAX_VELOCITY = 30.48 -MAX_ACCELERATION = 500.0 - -[JOINT_2] -TYPE = LINEAR -HOME = 0.0 -MAX_VELOCITY = 30.48 -MAX_ACCELERATION = 500.0 -BACKLASH = 0.000 -INPUT_SCALE = 200 -OUTPUT_SCALE = 1.000 -OUTPUT_OFFSET = 0.000 -MIN_LIMIT = -1000.0 -MAX_LIMIT = 1000.0 -FERROR = 1.270 -MIN_FERROR = 0.254 -HOME_OFFSET = 0.0 -HOME_SEARCH_VEL = 0.0 -HOME_LATCH_VEL = 0.0 -HOME_USE_INDEX = NO -HOME_IGNORE_LIMITS = NO -# PID tuning params -MAX_OUTPUT = 1.0 -DEADBAND = 0.000381 -P = 100.0 -I = 0.000 -D = 0.000 -FF0 = 0.000 -FF1 = 0.000 -FF2 = 0.0 -BIAS = 0.000 -############################################################################### -# section for main IO controller parameters -############################################################################### diff --git a/configs/by_interface/vigilant/vti.tbl b/configs/by_interface/vigilant/vti.tbl deleted file mode 100644 index c0b72de0652..00000000000 --- a/configs/by_interface/vigilant/vti.tbl +++ /dev/null @@ -1,4 +0,0 @@ -T1 P1 D0.125000 Z+0.511000 ;1/8 end mill -T2 P2 D0.062500 Z+0.100000 ;1/16 end mill -T3 P3 D0.201000 Z+1.273000 ;#7 tap drill -T99999 P99999 Z+0.100000 ;big tool number diff --git a/configs/by_interface/vigilant/vti.txt b/configs/by_interface/vigilant/vti.txt deleted file mode 100644 index 2a4df1ebbfb..00000000000 --- a/configs/by_interface/vigilant/vti.txt +++ /dev/null @@ -1,30 +0,0 @@ -This configuration step is intended for servo machines running the Vigilant Technologies PCI-ENCDAC 4 channel card. - -Check www.Vigilanttech.com for additional details. - -You can have either a standard pinout (LinuxCNC style) or you could make a new one which would suit your own custom cabling. - -Right now the ini file is for metric setup, but an inch specific one could be easily added. - -Detailed description: - -* nml files - --- it uses a default nml file (found in configs/common/linuxcnc.nml), but copied over here during the first make - -* hal files - --- it uses a default servo hal file (found in configs/common/core_servo.hal), but copied over here during the first make - --- vti_motion.hal - this is the main hal file for the VTI, it loads the vti driver and sets up motion specific links, it is fairly well commented, so it should be easy to read / modify. - --- vti_io.hal - this is the second hal file for the VTI, it configures IO specific links (like the pin number where the X limit switch is, or where the spindle start pin is connected), it is fairly well commented, so it should be easy to read / modify. This servo setup is mostly for serious machines, so the ESTOP should really be planned / implemented properly (that means use an external ESTOP chain, and let LinuxCNC know about it, and let LinuxCNC interrupt the external chain too). Read more about this in the wiki at http://wiki.linuxcnc.org/ - -* additional files - --- vti.tbl - this is the tool table file, and it holds definitions for the tools used, along with tool sizes for compensation (tool length & tool diameter) - --- vti.var - the variables file. This file is used by the interpreter to save internal variables when LinuxCNC shuts down, and rereads them on the next startup. - -Further specific information can be found in the LinuxCNC wiki: -http://wiki.linuxcnc.org/ diff --git a/configs/by_interface/vigilant/vti_io.hal b/configs/by_interface/vigilant/vti_io.hal deleted file mode 100644 index b3c9213aeb1..00000000000 --- a/configs/by_interface/vigilant/vti_io.hal +++ /dev/null @@ -1,125 +0,0 @@ -# HAL config file for Vigilant Technologies Inc. VTI PCA board -# -# install driver (only needed if vti_motion.hal doesn't get run) -#loadrt hal_vti - -# add I/O to servo thread so they will be evaluated -# every servo period -# read inputs first -addf vti.di-read servo-thread 1 -# write outputs last -addf vti.do-write servo-thread -1 - -#uncomment following line if ADC's are needed (for example spindle-tach feedback) -#addf vti.0.read-adcs servo-thread 1 - -# -# Connect motion controller I/Os -# - -# connect limit/home switch outputs to motion controller -#newsig Xminlim bit -#newsig Xmaxlim bit -#newsig Xhome bit -#linksp Xminlim <= vti.in-02 -#linksp Xminlim => joint.0.neg-lim-sw-in -#linksp Xmaxlim <= vti.in-01 -#linksp Xmaxlim => joint.0.pos-lim-sw-in -#linksp Xhome <= vti.in-00 -#linksp Xhome => joint.0.home-sw-in - -#newsig Yminlim bit -#newsig Ymaxlim bit -#newsig Yhome bit -#linksp Yminlim <= vti.in-06 -#linksp Yminlim => joint.1.neg-lim-sw-in -#linksp Ymaxlim <= vti.in-05 -#linksp Ymaxlim => joint.1.pos-lim-sw-in -#linksp Yhome <= vti.in-04 -#linksp Yhome => joint.1.home-sw-in - -#newsig Zminlim bit -#newsig Zmaxlim bit -#newsig Zhome bit -#linksp Zminlim <= vti.in-10 -#linksp Zminlim => joint.2.neg-lim-sw-in -#linksp Zmaxlim <= vti.in-09 -#linksp Zmaxlim => joint.2.pos-lim-sw-in -#linksp Zhome <= vti.in-08 -#linksp Zhome => joint.2.home-sw-in - -#continue in the same manner for further axes (A,B,C) - -# connect amp faults to motion controller -#newsig Xfault bit -#newsig Yfault bit -#newsig Zfault bit -#linksp Xfault <= vti.in-03 -#linksp Xfault => joint.0.amp-fault-in -#linksp Yfault <= vti.in-07 -#linksp Yfault => joint.1.amp-fault-in -#linksp Zfault <= vti.in-11 -#linksp Zfault => joint.2.amp-fault-in - -# connect index pulses to motion controller -# do these when index pulsing is figured out -#newsig Xindex bit -#newsig Yindex bit -#newsig Zindex bit -#linksp Xindex <= vti.0.enc-index -#linksp Xindex => joint.0.index-enable -#linksp Yindex <= vti.1.enc-index -#linksp Yindex => joint.1.index-enable -#linksp Zindex <= vti.2.enc-index -#linksp Zindex => joint.2.index-enable - -# connect amp enables to motion controller -#linksp Xenable => vti.out-00 -#linksp Yenable => vti.out-01 -#linksp Zenable => vti.out-02 - -# connect watchdog reset to motion controller -# needs watchdo -#newsig WatchdogRst bit -#linksp WatchdogRst <= vti.watchdog-reset -#linksp WatchdogRst => motion.watchdog-reset-out - - -# -# Connect I/O controller I/Os -# - -# connect e-stop write/sense to I/O controller -# these connections assume an external ESTOP circuitry will be used -# if it's not used, comment the next lines and uncomment the loopback -#newsig EstopSense bit -#newsig EstopWrite bit -#linksp EstopSense <= vti.in-12 -#linksp EstopSense => iocontrol.0.emc-enable-in -#linksp EstopWrite <= vti.out-07 -#linksp EstopWrite => iocontrol.0.user-enable-out - -# ESTOP loopback, only use this for a simple machine without external ESTOP -# you really SHOULDN'T use a servo machine without proper ESTOP -#net estop-loop iocontrol.0.user-enable-out iocontrol.0.emc-enable-in - -# connect spindle fwd/rev to I/O controller -#newsig SpindleFwd bit -#newsig SpindleRev bit -#linksp SpindleFwd <= vti.out-06 -#linksp SpindleFwd => spindle.0.forward -#linksp SpindleRev <= vti.out-05 -#linksp SpindleRev => spindle.0.reverse - -# connect spindle brake to I/O controller -#newsig SpindleBrakeOn bit -#linksp SpindleBrakeOn <= vti.out-10 -#linksp SpindleBrakeOn => spindle.0.brake - -# connect mist/flood coolant to I/O controller -#newsig MistOn bit -#newsig FloodOn bit -#linksp MistOn <= vti.out-11 -#linksp MistOn => iocontrol.0.coolant-mist -#linksp FloodOn <= vti.out-12 -#linksp FloodOn => iocontrol.0.coolant-flood diff --git a/configs/by_interface/vigilant/vti_motion.hal b/configs/by_interface/vigilant/vti_motion.hal deleted file mode 100644 index d414dcca1c6..00000000000 --- a/configs/by_interface/vigilant/vti_motion.hal +++ /dev/null @@ -1,37 +0,0 @@ -# HAL config file for Vigilant Technologoes VTI PCI board -# -# install driver, this should autodetect the board -# if that doesn't work, try using base=0xABC, where ABC matches your setup -# loadrt hal_stg base=0x200 -loadrt hal_vti num_chan=4 dio="IOIO" - -# add functions to servo thread so they will be evaluated -# every servo period -# read inputs first -addf vti.capture-position servo-thread 1 -# write outputs last -addf vti.write-dacs servo-thread -1 - -# connect position feedback signals to encoders -net Xpos-fb <= vti.0.position -net Ypos-fb <= vti.1.position -net Zpos-fb <= vti.2.position - -# get feedback scaling from ini file -setp vti.0.position-scale [JOINT_0]INPUT_SCALE -setp vti.1.position-scale [JOINT_1]INPUT_SCALE -setp vti.2.position-scale [JOINT_2]INPUT_SCALE - -# connect PID output signals to DACs -net Xoutput => vti.0.dac-value -net Youtput => vti.1.dac-value -net Zoutput => vti.2.dac-value - -# set output scaling from ini file -setp vti.0.dac-gain [JOINT_0]OUTPUT_SCALE -setp vti.1.dac-gain [JOINT_1]OUTPUT_SCALE -setp vti.2.dac-gain [JOINT_2]OUTPUT_SCALE -# set output offset to zero -setp vti.0.dac-offset [JOINT_0]OUTPUT_OFFSET -setp vti.1.dac-offset [JOINT_1]OUTPUT_OFFSET -setp vti.2.dac-offset [JOINT_2]OUTPUT_OFFSET diff --git a/configs/by_interface/vitalsystems/README b/configs/by_interface/vitalsystems/README deleted file mode 100644 index 047f174e2cc..00000000000 --- a/configs/by_interface/vitalsystems/README +++ /dev/null @@ -1,3 +0,0 @@ -Vital Systems, Inc. - -www.vitalsystems.com diff --git a/configs/by_interface/vitalsystems/motenc.ini b/configs/by_interface/vitalsystems/motenc.ini deleted file mode 100644 index 125834c6cee..00000000000 --- a/configs/by_interface/vitalsystems/motenc.ini +++ /dev/null @@ -1,205 +0,0 @@ -# EMC controller parameters for generic controller. Make these what you need -# for your system. -# General note: Comments can either be preceded with a # or ; - either is -# acceptable, although # is in keeping with most linux config files. -# General section ------------------------------------------------------------- - -[EMC] -# Version of this INI file -VERSION = 1.1 -# Name of machine, for use with display, etc. -MACHINE = LinuxCNC-MOTENC -# Debug level, 0 means no messages. See src/emc/nml_int/emcglb.h for others -#DEBUG = 0x00000003 -#DEBUG = 0x00000007 -DEBUG = 0 -# Sections for display options ------------------------------------------------ - -[DISPLAY] -# Name of display program, e.g., tklinuxcnc -DISPLAY = tklinuxcnc -#DISPLAY = axis -# Cycle time, in seconds, that display will sleep between polls -CYCLE_TIME = 0.0500 -# Path to help file -HELP_FILE = tklinuxcnc.txt -# Initial display setting for position, RELATIVE or MACHINE -POSITION_OFFSET = RELATIVE -# Initial display setting for position, COMMANDED or ACTUAL -POSITION_FEEDBACK = ACTUAL -# Highest value that will be allowed for feed override, 1.0 = 100% -MAX_FEED_OVERRIDE = 1.5 -# Prefix to be used -PROGRAM_PREFIX = ../../nc_files/ -# Introductory graphic -INTRO_GRAPHIC = linuxcnc.gif -INTRO_TIME = 5 -# Task controller section ----------------------------------------------------- - -[FILTER] -#No Content - -[RS274NGC] -# File containing interpreter variables -PARAMETER_FILE = motenc.var -# Motion control section ------------------------------------------------------ - -[EMCMOT] -EMCMOT = motmod -# Timeout for comm to emcmot, in seconds -COMM_TIMEOUT = 1.0 -# Servo task period, in nanoseconds -SERVO_PERIOD = 1000000 -# Hardware Abstraction Layer section -------------------------------------------------- - -[TASK] -# Name of task controller program, e.g., milltask -TASK = milltask -# Cycle time, in seconds, that task controller will sleep between polls -CYCLE_TIME = 0.010 -# Part program interpreter section -------------------------------------------- - -[HAL] -# The run script first uses halcmd to execute any HALFILE -# files, and then to execute any individual HALCMD commands. -# list of hal config files to run through halcmd -# files are executed in the order in which they appear -HALFILE = core_servo.hal -HALFILE = motenc_motion.hal -HALFILE = motenc_io.hal -# list of halcmd commands to execute -# commands are executed in the order in which they appear -#HALCMD = save neta -# Trajectory planner section -------------------------------------------------- - -[HALUI] -#No Content - -[TRAJ] -# COORDINATES = X Y Z R P W -COORDINATES = X Y Z -HOME = 0 0 0 -LINEAR_UNITS = inch -ANGULAR_UNITS = degree -DEFAULT_LINEAR_VELOCITY = 3.0 -MAX_LINEAR_VELOCITY = 4.0 -DEFAULT_LINEAR_ACCELERATION = 6.0 -MAX_LINEAR_ACCELERATION = 7.0 -# Axes sections --------------------------------------------------------------- -# First axis - -[EMCIO] -# tool table file -TOOL_TABLE = motenc.tbl - -[KINS] -KINEMATICS = trivkins -JOINTS = 3 - -[AXIS_X] -MIN_LIMIT = -32.0 -MAX_LIMIT = 0.0 -MAX_VELOCITY = 1.0 -MAX_ACCELERATION = 4.0 - -[JOINT_0] -TYPE = LINEAR -HOME = 0.000 -MAX_VELOCITY = 1.0 -MAX_ACCELERATION = 4.0 -BACKLASH = 0.000 -INPUT_SCALE = 81920 -OUTPUT_SCALE = 10.000 -OUTPUT_OFFSET = 0.0 -MIN_LIMIT = -32.0 -MAX_LIMIT = 0.0 -FERROR = 1.000 -MIN_FERROR = 0.002 -HOME_OFFSET = 0.10 -HOME_SEARCH_VEL = 0.10 -HOME_LATCH_VEL = -0.01 -HOME_USE_INDEX = YES -HOME_IGNORE_LIMITS = YES -MAX_OUTPUT = 1.0 -# PID tuning params -DEADBAND = 0.000015 -P = 100.0 -I = 0.000 -D = 0.000 -FF0 = 0.000 -FF1 = 0.000 -FF2 = 0.0 -BIAS = 0.000 -# Second axis - -[AXIS_Y] -MIN_LIMIT = -14.0 -MAX_LIMIT = 0.0 -MAX_VELOCITY = 1.0 -MAX_ACCELERATION = 4.0 - -[JOINT_1] -TYPE = LINEAR -HOME = 0.000 -MAX_VELOCITY = 1.0 -MAX_ACCELERATION = 4.0 -BACKLASH = 0.000 -INPUT_SCALE = -81920 -OUTPUT_SCALE = 10.000 -OUTPUT_OFFSET = 0.0 -MIN_LIMIT = -14.0 -MAX_LIMIT = 0.0 -FERROR = 0.020 -MIN_FERROR = 0.001 -HOME_OFFSET = 0.10 -HOME_SEARCH_VEL = 0.10 -HOME_LATCH_VEL = -0.01 -HOME_USE_INDEX = YES -HOME_IGNORE_LIMITS = YES -MAX_OUTPUT = 1.0 -# PID tuning params -DEADBAND = 0.000015 -P = 100.0 -I = 0.000 -D = 0.000 -FF0 = 0.000 -FF1 = 0.000 -FF2 = 0.0 -BIAS = 0.000 -# Third axis - -[AXIS_Z] -MIN_LIMIT = -6.0 -MAX_LIMIT = 0.0 -MAX_VELOCITY = 1.0 -MAX_ACCELERATION = 4.0 - -[JOINT_2] -TYPE = LINEAR -HOME = 0.0 -MAX_VELOCITY = 1.0 -MAX_ACCELERATION = 4.0 -BACKLASH = 0.000 -INPUT_SCALE = 81920 -OUTPUT_SCALE = 10.000 -OUTPUT_OFFSET = 0.0 -MIN_LIMIT = -6.0 -MAX_LIMIT = 0.0 -FERROR = 0.020 -MIN_FERROR = 0.001 -HOME_OFFSET = 0.10 -HOME_SEARCH_VEL = 0.10 -HOME_LATCH_VEL = -0.01 -HOME_USE_INDEX = YES -HOME_IGNORE_LIMITS = YES -MAX_OUTPUT = 1.0 -# PID tuning params -DEADBAND = 0.000015 -P = 100.0 -I = 0.000 -D = 0.000 -FF0 = 0.000 -FF1 = 0.000 -FF2 = 0.0 -BIAS = 0.000 -# section for main IO controller parameters ----------------------------------- diff --git a/configs/by_interface/vitalsystems/motenc.tbl b/configs/by_interface/vitalsystems/motenc.tbl deleted file mode 100644 index c0b72de0652..00000000000 --- a/configs/by_interface/vitalsystems/motenc.tbl +++ /dev/null @@ -1,4 +0,0 @@ -T1 P1 D0.125000 Z+0.511000 ;1/8 end mill -T2 P2 D0.062500 Z+0.100000 ;1/16 end mill -T3 P3 D0.201000 Z+1.273000 ;#7 tap drill -T99999 P99999 Z+0.100000 ;big tool number diff --git a/configs/by_interface/vitalsystems/motenc.txt b/configs/by_interface/vitalsystems/motenc.txt deleted file mode 100644 index badf95a88ea..00000000000 --- a/configs/by_interface/vitalsystems/motenc.txt +++ /dev/null @@ -1,33 +0,0 @@ -This configuration is intended for servo machines running the Vitalsystems (www.vsi99.com) Motenc-100 or Motenc-Lite card. - -You can either have a standard pinout, or you could make a new one which would suit your own custom cabling. The changes are done in HAL (the Hardware Abstraction Layer), which is very flexible (read more about it at http://wiki.linuxcnc.org/) - -The standard configuration assumes a card installed with the board id jumper set at 0. If you get errors, try to adjust the jumper. - -Multiple cards are supported by reading the board id jumper settings and using them as the in the exported HAL names. There are two jumpers on J3 of the motenc-100 board that are defined as the board id. Installing a jumper causes the corresponding bit to read as zero. Since there are two board id jumpers, up to four cards are supported. Using the board id allows the configuration to be independent of which PCI slot the card is plugged into. - -Detailed description: - -* nml files - --- it uses a default nml file (found in configs/common/linuxcnc.nml) - -* hal files - --- it uses a default servo hal file (configs/common/core_servo.hal) - --- motenc_motion.hal - this is the main hal file for the Motenc, it loads the motenc driver and sets up motion specific links, it is fairly well commented, so it should be easy to read / modify. - --- motenc_io.hal - this is the second hal file for the Motenc, it configures IO specific links (like the pin number where the X limit switch is, or where the spindle start pin is connected), it is fairly well commented, so it should be easy to read / modify. This servo setup is mostly for serious machines, so the ESTOP should really be planned / implemented properly (that means use an external ESTOP chain, and let LinuxCNC know about it, and let LinuxCNC interrupt the external chain too). - -Read more about this in the wiki at http://wiki.linuxcnc.org/ - -* additional files - --- motenc.tbl - this is the tool table file, and it holds definitions for the tools used, along with tool sizes for compensation (tool length & tool diameter) - --- motenc.var - the variables file. This file is used by the interpreter to save internal variables when LinuxCNC shuts down, and rereads them on the next startup. - -Further specific information can be found in the LinuxCNC wiki: -http://wiki.linuxcnc.org/ - diff --git a/configs/by_interface/vitalsystems/motenc_io.hal b/configs/by_interface/vitalsystems/motenc_io.hal deleted file mode 100644 index 6ed452bc5a7..00000000000 --- a/configs/by_interface/vitalsystems/motenc_io.hal +++ /dev/null @@ -1,105 +0,0 @@ -# HAL config file for Vital Systems MOTENC-100 PCI board -# -# Install driver. -#loadrt hal_motenc - -# Classicladder for machine logic (load the realtime portion). -# Just uncomment the following line if you want a Software PLC -#loadrt classicladder_rt numRungs=4 numBits=16 numWords=4 numTimers=2 numMonostables=2 numPhysInputs=16 numPhysOutputs=8 numArithmExpr=4 numSections=1 - -# Invoke the user part of CL to silently load the program. -# Just uncomment the following line if you want a Software PLC -#loadusr -w classicladder --nogui ../configs/common/bridgeport.clp - -# Add I/O to servo thread so they will be evaluated -# every servo period. -# inputs get read at the beginning of the thread -addf motenc.0.misc-update servo-thread 1 -#addf motenc.0.adc-read servo-thread 1 -addf motenc.0.digital-in-read servo-thread 1 -#addf classicladder.0.refresh servo-thread 1 - -# outputs get refreshed at the end of the thread -addf motenc.0.digital-out-write servo-thread -1 - -# -# Connect motion controller I/Os -# - -# Connect limit/home switch outputs to motion controller. -net Xminlim <= motenc.0.in-00 -net Xminlim => joint.0.neg-lim-sw-in -net Xmaxlim <= motenc.0.in-01 -net Xmaxlim => joint.0.pos-lim-sw-in -net Xhome <= motenc.0.in-02 -net Xhome => joint.0.home-sw-in - -net Yminlim <= motenc.0.in-04 -net Yminlim => joint.1.neg-lim-sw-in -net Ymaxlim <= motenc.0.in-05 -net Ymaxlim => joint.1.pos-lim-sw-in -net Yhome <= motenc.0.in-06 -net Yhome => joint.1.home-sw-in - -net Zminlim <= motenc.0.in-08 -net Zminlim => joint.2.neg-lim-sw-in -net Zmaxlim <= motenc.0.in-09 -net Zmaxlim => joint.2.pos-lim-sw-in -net Zhome <= motenc.0.in-10 -net Zhome => joint.2.home-sw-in - -# Connect amp faults to motion controller. -net Xfault <= motenc.0.in-03 -net Xfault => joint.0.amp-fault-in -net Yfault <= motenc.0.in-07 -net Yfault => joint.1.amp-fault-in -net Zfault <= motenc.0.in-11 -net Zfault => joint.2.amp-fault-in - -# Connect amp enables to motion controller. -net Xenable => motenc.0.out-08 -net Yenable => motenc.0.out-09 -net Zenable => motenc.0.out-10 - -# Connect watchdog reset to motion controller. -#newsig WatchdogRst bit -#linksp WatchdogRst <= motenc.watchdog-reset -#linksp WatchdogRst => motion.watchdog-reset-out - - -# -# Connect I/O controller I/Os -# - -# Connect e-stop write/sense to I/O controller. -# -# The estop from the opto module should be jumpered to one of the -# motenc estop pins. This will notify the moten of the estop condition -# and it will zero the DACs and turn off all output even if the PC -# has crashed. -# -net EstopSense <= motenc.0.estop-in-not -#linksp EstopSense <= motenc.0.in-15 -net EstopSense => iocontrol.0.emc-enable-in -net EstopWrite => motenc.0.out-07 -net EstopWrite <= iocontrol.0.user-enable-out - -# ESTOP loopback, only use this for a simple machine without external ESTOP -# you really SHOULDN'T use a servo machine without proper ESTOP -#net estop-loop iocontrol.0.user-enable-out iocontrol.0.emc-enable-in - -# Connect spindle fwd/rev to I/O controller. -net SpindleFwd => motenc.0.out-00 -net SpindleFwd <= spindle.0.forward -net SpindleRev => motenc.0.out-01 -net SpindleRev <= spindle.0.reverse - -# Connect spindle brake to I/O controller. -net SpindleBrakeOn => motenc.0.out-02 -net SpindleBrakeOn <= spindle.0.brake - -# Connect mist/flood coolant to I/O controller. -net MistOn => motenc.0.out-05 -net MistOn <= iocontrol.0.coolant-mist -net FloodOn => motenc.0.out-06 -net FloodOn <= iocontrol.0.coolant-flood diff --git a/configs/by_interface/vitalsystems/motenc_motion.hal b/configs/by_interface/vitalsystems/motenc_motion.hal deleted file mode 100644 index ebd7c141164..00000000000 --- a/configs/by_interface/vitalsystems/motenc_motion.hal +++ /dev/null @@ -1,75 +0,0 @@ -# HAL config file for Vital Systems MOTENC-100 PCI board -# -# Install driver. -loadrt hal_motenc - -# Add functions to servo thread so they will be evaluated -# every servo period. -# inputs get read at the beginning of the thread -addf motenc.0.encoder-read servo-thread 1 - -# outputs get updated at the end of the thread -addf motenc.0.dac-write servo-thread -1 - -# Connect position feedback signals to encoders. -net Xpos-fb <= motenc.0.enc-00-position -net Ypos-fb <= motenc.0.enc-01-position -net Zpos-fb <= motenc.0.enc-02-position - -# Get feedback scaling from ini file. -setp motenc.0.enc-00-scale [JOINT_0]INPUT_SCALE -setp motenc.0.enc-01-scale [JOINT_1]INPUT_SCALE -setp motenc.0.enc-02-scale [JOINT_2]INPUT_SCALE - -# Connect PID output signals to DACs. -net Xoutput => motenc.0.dac-00-value -net Youtput => motenc.0.dac-01-value -net Zoutput => motenc.0.dac-02-value - -# Set output scaling from ini file. -setp motenc.0.dac-00-gain [JOINT_0]OUTPUT_SCALE -setp motenc.0.dac-01-gain [JOINT_1]OUTPUT_SCALE -setp motenc.0.dac-02-gain [JOINT_2]OUTPUT_SCALE - -# Set output offset from ini file. -setp motenc.0.dac-00-offset [JOINT_0]OUTPUT_OFFSET -setp motenc.0.dac-01-offset [JOINT_1]OUTPUT_OFFSET -setp motenc.0.dac-02-offset [JOINT_2]OUTPUT_OFFSET - -# Get tuning params from ini file. -setp pid.0.deadband [JOINT_0]DEADBAND -setp pid.0.Pgain [JOINT_0]P -setp pid.0.Igain [JOINT_0]I -setp pid.0.Dgain [JOINT_0]D -setp pid.0.FF0 [JOINT_0]FF0 -setp pid.0.FF1 [JOINT_0]FF1 -setp pid.0.FF2 [JOINT_0]FF2 -setp pid.0.bias [JOINT_0]BIAS - -setp pid.1.deadband [JOINT_1]DEADBAND -setp pid.1.Pgain [JOINT_1]P -setp pid.1.Igain [JOINT_1]I -setp pid.1.Dgain [JOINT_1]D -setp pid.1.FF0 [JOINT_1]FF0 -setp pid.1.FF1 [JOINT_1]FF1 -setp pid.1.FF2 [JOINT_1]FF2 -setp pid.1.bias [JOINT_1]BIAS - -setp pid.2.deadband [JOINT_2]DEADBAND -setp pid.2.Pgain [JOINT_2]P -setp pid.2.Igain [JOINT_2]I -setp pid.2.Dgain [JOINT_2]D -setp pid.2.FF0 [JOINT_2]FF0 -setp pid.2.FF1 [JOINT_2]FF1 -setp pid.2.FF2 [JOINT_2]FF2 -setp pid.2.bias [JOINT_2]BIAS - -# Get maximum (and minimum) output volts from ini file. -setp pid.0.maxoutput [JOINT_0]MAX_OUTPUT -setp pid.1.maxoutput [JOINT_1]MAX_OUTPUT -setp pid.2.maxoutput [JOINT_2]MAX_OUTPUT - -# Connect index pulses to motion controller. -net Xindex motenc.0.enc-00-index-enable <=> joint.0.index-enable pid.0.index-enable -net Yindex motenc.0.enc-01-index-enable <=> joint.1.index-enable pid.1.index-enable -net Zindex motenc.0.enc-02-index-enable <=> joint.2.index-enable pid.2.index-enable diff --git a/configs/by_interface/vitalsystems/motenc_pidtest.hal b/configs/by_interface/vitalsystems/motenc_pidtest.hal deleted file mode 100644 index 97472159f6f..00000000000 --- a/configs/by_interface/vitalsystems/motenc_pidtest.hal +++ /dev/null @@ -1,185 +0,0 @@ -# PID loop test HAL config file for servos -# -# Do not run this script while you are running emc! -# Run it with: -# halrun -I motenc_pidtest.hal - -# first load the motenc driver -loadrt hal_motenc -# and create a 1mS thread -loadrt threads name1=motenc.thread period1=1000000 - -# then load the PID module, for three PID loops -loadrt pid num_chan=3 - -# and load the signal generator module -loadrt siggen - -# hook functions to realtime thread -addf motenc.0.encoder-read motenc.thread -addf motenc.0.digital-in-read motenc.thread -addf siggen.0.update motenc.thread -addf pid.0.do-pid-calcs motenc.thread -addf pid.1.do-pid-calcs motenc.thread -addf pid.2.do-pid-calcs motenc.thread -addf motenc.0.digital-out-write motenc.thread -addf motenc.0.dac-write motenc.thread - -# create three position feedback signals - -# connect position feedback signals to encoders -net Xpos-fb <= motenc.0.enc-00-position -net Ypos-fb <= motenc.0.enc-01-position -net Zpos-fb <= motenc.0.enc-02-position - -# set feedback scaling -# this is just an example -# 8192 counts/rev * 10 turns per inch = 81920 counts/in -# -setp motenc.0.enc-00-scale 81920 -setp motenc.0.enc-01-scale 81920 -setp motenc.0.enc-02-scale 81920 - -# NOTE: you may want to comment out everything after here, -# and run it... manually move the machine X axis by 1 inch -# and verify that Xpos-fb changes by exactly 1 inch. Then -# do the same for Y and Z. Change the scale factors above -# as needed until it is right. Once you know that the -# scaling is correct, uncomment the following stuff and -# continue on. - -# connect position feedback to PID loop -net Xpos-fb => pid.0.feedback -net Ypos-fb => pid.1.feedback -net Zpos-fb => pid.2.feedback - -# create PID to DAC output signals - -# connect output signals to DACs -net Xoutput => motenc.0.dac-00-value -net Youtput => motenc.0.dac-01-value -net Zoutput => motenc.0.dac-02-value - -# set offset and scale so that +/-1.00 on output -# signals is +/-10V at the physical DAC pins -setp motenc.0.dac-00-gain 10 -setp motenc.0.dac-01-gain 10 -setp motenc.0.dac-02-gain 10 -setp motenc.0.dac-00-offset 0 -setp motenc.0.dac-01-offset 0 -setp motenc.0.dac-02-offset 0 - -# connect output signals to output of PID loops -net Xoutput <= pid.0.output -net Youtput <= pid.1.output -net Zoutput <= pid.2.output - -# set PID loop output limits to +/-1.00 -setp pid.0.maxoutput 1 -setp pid.1.maxoutput 1 -setp pid.2.maxoutput 1 - -# set PID loop gains -# NOTE: eventually these will be non-zero values as -# needed to tune the performance of each axis. The -# initial values shown here are extremely conservative -# to prevent unexpected behavior. After this file -# has been "executed" by halcmd, the gains can be -# interactively adjusted using commands like -# "halcmd setp pid..Pgain " -# Once the axis has been tuned to your satisfaction, -# do "halcmd show param | grep pid" to get a listing -# of the tuning parameters, and enter those values here. - -setp pid.0.Pgain 0.01 -setp pid.0.Igain 0 -setp pid.0.Dgain 0 -setp pid.0.bias 0 -setp pid.0.FF0 0 -setp pid.0.FF1 0 -setp pid.0.FF2 0 -# deadband should be just over 1 count -setp pid.0.deadband 0.000015 - -setp pid.1.Pgain 0.01 -setp pid.1.Igain 0 -setp pid.1.Dgain 0 -setp pid.1.bias 0 -setp pid.1.FF0 0 -setp pid.1.FF1 0 -setp pid.1.FF2 0 -setp pid.1.deadband 0.000015 - -setp pid.2.Pgain 0.01 -setp pid.2.Igain 0 -setp pid.2.Dgain 0 -setp pid.2.bias 0 -setp pid.2.FF0 0 -setp pid.2.FF1 0 -setp pid.2.FF2 0 -setp pid.2.deadband 0.000015 - -# create three position command signals -# eventually, these will come from EMC - -# connect position commands to PID input -net Xpos-cmd => pid.0.command -net Ypos-cmd => pid.1.command -net Zpos-cmd => pid.2.command - -# connect the signal generator sine and cosine outputs -# to X and Y position commands -# this will make the machine move in a circle -# Note that Z isn't connected to anything, so its position -# command will be zero. -# NOTE: once the PID loops are tuned, you might want to -# connect the position commands to the triangle or even -# square wave outputs, to see how well the machine responds -# to direction reversals (triangle) or step changes in -# position (square). Note that step changes in position -# will in general run the motors full blast in an attempt -# to get to the new position as quickly as possible. -# Proceed with caution, keep siggen.0.amplitude small -# until you know that the movement is stable, then increase -# it in small increments only. -net Xpos-cmd <= siggen.0.sine -net Ypos-cmd <= siggen.0.cosine - -# set the siggen parameters for a 0.5" diameter circle, once every 10 seconds -# once the PID loops are tuned, the size and/or speed can be increased -setp siggen.0.frequency 0.1 -setp siggen.0.offset 0 -setp siggen.0.amplitude 0.25 - -# create a bit signal to enable/disable the PID loops - -# connect the signal to all three PID blocks -net pid-enable => pid.0.enable -net pid-enable => pid.1.enable -net pid-enable => pid.2.enable - -# you can either turn pid-enable on and off using the -# "halcmd sets" command, or you can connect it to a -# digital input and turn it on and off with an external -# switch -# The line below sets the signal to 0 to ensure that the PID -# loops are off until you explicitly turn them on. -sets pid-enable 0 - -# The line below connects the signal to a digital input. -# Uncomment and change the input number if that's what you -# want to do -#linksp pid-enable <= motenc.0.in-00 - -# load realtime portion of scope -loadrt scope_rt -# start up scope user interface -loadusr halscope - -# start realtime execution -start - -# end of halcmd file, at this point the motors are "live" -# and if you ran this script with "halrun -I" -# you can do tuning and other experimentation -# to shut down and clean up, simply exit halcmd. diff --git a/configs/by_machine/boss/README b/configs/by_machine/boss/README deleted file mode 100644 index d1438aab762..00000000000 --- a/configs/by_machine/boss/README +++ /dev/null @@ -1,27 +0,0 @@ -This configuration is for my (petev) Bridgeport BOSS6. It shows how I used the boss_plc component. It is intended for servo machines running the Vitalsystems (www.vsi99.com) Motenc-100 or Motenc-Lite card. - -You can either have a standard pinout, or you could make a new one which would suit your own custom cabling. The changes are done in HAL (the Hardware Abstraction Layer), which is very flexible (read more about it at http://wiki.linuxcnc.org/) - -The standard configuration assumes a card installed with the board id jumper set at 0. If you get errors, try to adjust the jumper. - -Multiple cards are supported by reading the board id jumper settings and using them as the in the exported HAL names. There are two jumpers on J3 of the motenc-100 board that are defined as the board id. Installing a jumper causes the corresponding bit to read as zero. Since there are two board id jumpers, up to four cards are supported. Using the board id allows the configuration to be independent of which PCI slot the card is plugged into. - -Detailed description: - -* nml files - --- it uses a default nml file (found in configs/common/linuxcnc.nml) - -* hal files - --- boss.hal - this is the main hal file for the Motenc, it loads the motenc driver and sets up motion and IO links (like the pin number where the X limit switch is, or where the spindle start pin is connected), it is fairly well commented, so it should be easy to read / modify. This servo setup is mostly for serious machines, so the ESTOP should really be planned / implemented properly (that means use an external ESTOP chain, and let LinuxCNC know about it, and let LinuxCNC interrupt the external chain too). Read more about this in the wiki at http://wiki.linuxcnc.org/ - -* additional files - --- boss.tbl - this is the tool table file, and it holds definitions for the tools used, along with tool sizes for compensation (tool length & tool diameter) - --- boss.var - the variables file. This file is used by the interpreter to save internal variables when LinuxCNC shuts down, and rereads them on the next startup. - -Further specific information can be found in the LinuxCNC wiki: -http://wiki.linuxcnc.org/ - diff --git a/configs/by_machine/boss/boss.hal b/configs/by_machine/boss/boss.hal deleted file mode 100644 index 74b2f980bff..00000000000 --- a/configs/by_machine/boss/boss.hal +++ /dev/null @@ -1,300 +0,0 @@ -# HAL config file for Bridgeport BOSS. -# -# Load the core RT modules that will be needed. - -# Kinematics -loadrt [KINS]KINEMATICS - -# motion controller, get name and thread periods from ini file -loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS - -# PID module, for four PID loops -loadrt pid num_chan=4 - -# Install motenc driver. -loadrt hal_motenc - -# Install PLC. -loadrt boss_plc - -# Install debounce filters for operator console (cycle hold/start, -# limit override, spindle increase/decrease/status). -loadrt debounce cfg="7" - -# Add functions to servo thread so they will be evaluated -# every servo period. -# -# Inputs are read at the beginning of the thread -addf debounce.0 servo-thread 1 -addf motenc.0.encoder-read servo-thread 1 -addf motenc.0.misc-update servo-thread 1 -#addf motenc.0.adc-read servo-thread 1 -addf motenc.0.digital-in-read servo-thread 1 -# Do processing. -addf boss_plc.0.refresh servo-thread -1 -addf motion-command-handler servo-thread -1 -addf motion-controller servo-thread -1 -addf pid.0.do-pid-calcs servo-thread -1 -addf pid.1.do-pid-calcs servo-thread -1 -addf pid.2.do-pid-calcs servo-thread -1 -addf pid.3.do-pid-calcs servo-thread -1 -# Outputs are updated at the end of the thread -addf motenc.0.dac-write servo-thread -1 -addf motenc.0.digital-out-write servo-thread -1 - -# PID loops. -# -# Get maximum (and minimum) output volts from ini file. -setp pid.0.maxoutput [JOINT_0]MAX_OUTPUT -setp pid.1.maxoutput [JOINT_1]MAX_OUTPUT -setp pid.2.maxoutput [JOINT_2]MAX_OUTPUT -setp pid.3.maxoutput [JOINT_3]MAX_OUTPUT - -# Set PID loop gains. -setp pid.0.Pgain [JOINT_0]P -setp pid.0.Igain [JOINT_0]I -setp pid.0.Dgain [JOINT_0]D -setp pid.0.bias [JOINT_0]BIAS -setp pid.0.FF0 [JOINT_0]FF0 -setp pid.0.FF1 [JOINT_0]FF1 -setp pid.0.FF2 [JOINT_0]FF2 -# deadband should be just over 1 count -setp pid.0.deadband [JOINT_0]DEADBAND - -setp pid.1.Pgain [JOINT_1]P -setp pid.1.Igain [JOINT_1]I -setp pid.1.Dgain [JOINT_1]D -setp pid.1.bias [JOINT_1]BIAS -setp pid.1.FF0 [JOINT_1]FF0 -setp pid.1.FF1 [JOINT_1]FF1 -setp pid.1.FF2 [JOINT_1]FF2 -# deadband should be just over 1 count -setp pid.1.deadband [JOINT_1]DEADBAND - -setp pid.2.Pgain [JOINT_2]P -setp pid.2.Igain [JOINT_2]I -setp pid.2.Dgain [JOINT_2]D -setp pid.2.bias [JOINT_2]BIAS -setp pid.2.FF0 [JOINT_2]FF0 -setp pid.2.FF1 [JOINT_2]FF1 -setp pid.2.FF2 [JOINT_2]FF2 -# deadband should be just over 1 count -setp pid.2.deadband [JOINT_2]DEADBAND - -setp pid.3.Pgain [JOINT_3]P -setp pid.3.Igain [JOINT_3]I -setp pid.3.Dgain [JOINT_3]D -setp pid.3.bias [JOINT_3]BIAS -setp pid.3.FF0 [JOINT_3]FF0 -setp pid.3.FF1 [JOINT_3]FF1 -setp pid.3.FF2 [JOINT_3]FF2 -# deadband should be just over 1 count -setp pid.3.deadband [JOINT_3]DEADBAND - -# Connect the enable signals to the PID blocks. -net xEnable joint.0.amp-enable-out => pid.0.enable -net yEnable joint.1.amp-enable-out => pid.1.enable -net zEnable joint.2.amp-enable-out => pid.2.enable -net aEnable joint.3.amp-enable-out => pid.3.enable - -# Connect position commands to PID inputs. -net xPosCmd joint.0.motor-pos-cmd => pid.0.command -net yPosCmd joint.1.motor-pos-cmd => pid.1.command -net zPosCmd joint.2.motor-pos-cmd => pid.2.command -net aPosCmd joint.3.motor-pos-cmd => pid.3.command - -# DACs -# -# Set DAC output scaling from ini file. -setp motenc.0.dac-01-gain [JOINT_0]OUTPUT_SCALE -setp motenc.0.dac-03-gain [JOINT_1]OUTPUT_SCALE -setp motenc.0.dac-02-gain [JOINT_2]OUTPUT_SCALE -setp motenc.0.dac-00-gain [JOINT_3]OUTPUT_SCALE - -# Set DAC offset from ini file. -setp motenc.0.dac-01-offset [JOINT_0]OUTPUT_OFFSET -setp motenc.0.dac-03-offset [JOINT_1]OUTPUT_OFFSET -setp motenc.0.dac-02-offset [JOINT_2]OUTPUT_OFFSET -setp motenc.0.dac-00-offset [JOINT_3]OUTPUT_OFFSET - -# Connect PID output signals to DACs. -net xOutput pid.0.output => motenc.0.dac-01-value -net yOutput pid.1.output => motenc.0.dac-03-value -net zOutput pid.2.output => motenc.0.dac-02-value -net aOutput pid.3.output => motenc.0.dac-00-value - -# Encoders. -# -# Set feedback scaling from ini file. -setp motenc.0.enc-01-scale [JOINT_0]INPUT_SCALE -setp motenc.0.enc-03-scale [JOINT_1]INPUT_SCALE -setp motenc.0.enc-02-scale [JOINT_2]INPUT_SCALE -setp motenc.0.enc-00-scale [JOINT_3]INPUT_SCALE - -# Connect position feedback to PID loop. -net xPosFb motenc.0.enc-01-position => pid.0.feedback -net yPosFb motenc.0.enc-03-position => pid.1.feedback -net zPosFb motenc.0.enc-02-position => pid.2.feedback -net aPosFb motenc.0.enc-00-position => pid.3.feedback - -# Connect position feedback to motion module. -net xPosFb => joint.0.motor-pos-fb -net yPosFb => joint.1.motor-pos-fb -net zPosFb => joint.2.motor-pos-fb -net aPosFb => joint.3.motor-pos-fb - -# Connect position feedback to PLC. -net xPosFb => boss_plc.0.x-position-in -net yPosFb => boss_plc.0.y-position-in - -# Connect index pulses to motion controller. -net xIndex motenc.0.enc-01-index-enable <=> joint.0.index-enable -net yIndex motenc.0.enc-03-index-enable <=> joint.1.index-enable -net zIndex motenc.0.enc-02-index-enable <=> joint.2.index-enable -net aIndex motenc.0.enc-00-index-enable <=> joint.3.index-enable - -# Limits. -# -# Connect limit/home switch inputs to PLC and motion controller. -net xLimitSw motenc.0.in-09 => boss_plc.0.x-limit-in -net xLimitSw => joint.0.home-sw-in -net yLimitSw motenc.0.in-13 => boss_plc.0.y-limit-in -net yLimitSw => joint.1.home-sw-in -net zMinlimSw motenc.0.in-26 => boss_plc.0.z-limit-neg-in -net zMaxlimSw motenc.0.in-25 => boss_plc.0.z-limit-pos-in -net zHome motenc.0.in-27 => joint.2.home-sw-in - -# Connect PLC limit switch outputs to motion controller. -net xMinLim boss_plc.0.x-limit-neg-out => joint.0.neg-lim-sw-in -net xMaxLim boss_plc.0.x-limit-pos-out => joint.0.pos-lim-sw-in -net yMinLim boss_plc.0.y-limit-neg-out => joint.1.neg-lim-sw-in -net yMaxLim boss_plc.0.y-limit-pos-out => joint.1.pos-lim-sw-in -net zMinLim boss_plc.0.z-limit-neg-out => joint.2.neg-lim-sw-in -net zMaxLim boss_plc.0.z-limit-pos-out => joint.2.pos-lim-sw-in - -# Amp enables/faults. -# -# Connect amp ready to PLC. -net xReady motenc.0.in-08 => boss_plc.0.x-amp-ready-in -net yReady motenc.0.in-12 => boss_plc.0.y-amp-ready-in -net zReady motenc.0.in-24 => boss_plc.0.z-amp-ready-in -net aReady motenc.0.in-28 => boss_plc.0.a-amp-ready-in - -# Connect amp enables to I/O. -net xEnable => motenc.0.out-00 -net yEnable => motenc.0.out-01 -net zEnable => motenc.0.out-08 -net aEnable => motenc.0.out-09 - -# Connect amp enables to PLC. -net xEnable => boss_plc.0.x-amp-enable-in -net yEnable => boss_plc.0.y-amp-enable-in -net zEnable => boss_plc.0.z-amp-enable-in -net aEnable => boss_plc.0.a-amp-enable-in - -# Connect amp faults to motion controller. -net xFault boss_plc.0.x-amp-fault-out => joint.0.amp-fault-in -net yFault boss_plc.0.y-amp-fault-out => joint.1.amp-fault-in -net zFault boss_plc.0.z-amp-fault-out => joint.2.amp-fault-in -net aFault boss_plc.0.a-amp-fault-out => joint.3.amp-fault-in - -# Spindle. -# -# Connect spindle speed to PLC and spindle fwd/rev/stat to I/O. -net spindleSpeed spindle.0.speed-out => boss_plc.0.spindle-speed-in -net spindleFwd boss_plc.0.spindle-fwd-out => motenc.0.out-11 -net spindleRev boss_plc.0.spindle-rev-out => motenc.0.out-12 -net spindleIsOnSw motenc.0.in-29-not => debounce.0.5.in -net spindleIsOnDly debounce.0.5.out => debounce.0.6.in -net spindleIsOn debounce.0.6.out => boss_plc.0.spindle-is-on-in - -# Connect spindle brake to PLC and PLC brake to I/O. -setp boss_plc.0.brake-on-delay 500 -setp boss_plc.0.brake-off-delay 800 -net spindleBrakeOnMot spindle.0.brake => boss_plc.0.brake-en-in -setp motenc.0.out-02-invert 1 -net spindleBrakeOn boss_plc.0.brake-en-out => motenc.0.out-02 - -# Tool change. -# -# Loop back tool prepare pins. -net toolPrepare iocontrol.0.tool-prepare iocontrol.0.tool-prepared - -# Connect tool change pins to PLC. -net toolChange iocontrol.0.tool-change => boss_plc.0.tool-change-in -net toolChanged boss_plc.0.tool-changed-out => iocontrol.0.tool-changed - -# Coolant. -# -# Connect mist/flood coolant to PLC. -net mistOnIo iocontrol.0.coolant-mist => boss_plc.0.mist-on-in -net floodOnIo iocontrol.0.coolant-flood => boss_plc.0.flood-on-in - -# Connect mist/flood coolant to I/O. -net mistOn boss_plc.0.mist-on-out => motenc.0.out-14 -net floodOn boss_plc.0.flood-on-out => motenc.0.out-15 - -# Operator console. -# -# Set debounce time. -setp debounce.0.delay 20 - -# Connect e-stop I/O. -net eStopSense motenc.0.in-32 => iocontrol.0.emc-enable-in -net eStopWrite iocontrol.0.user-enable-out => motenc.0.out-16 - -# Connect cycle hold/start. -net cycleHoldSw motenc.0.in-33-not => debounce.0.0.in -net cycleHold debounce.0.0.out => boss_plc.0.cycle-hold-in -net cycleStartSw motenc.0.in-34 => debounce.0.1.in -net cycleStart debounce.0.1.out => boss_plc.0.cycle-start-in -net feedHold boss_plc.0.feed-hold-out => motion.feed-hold -net waitUser boss_plc.0.wait-user-out => motenc.0.out-17 - -# Connect speed overrides. -net spindleIncSw motenc.0.enc-04-index => debounce.0.2.in -net spindleIncDb debounce.0.2.out => boss_plc.0.spindle-inc-in -net spindleInc boss_plc.0.spindle-inc-out => motenc.0.out-03 -net spindleDecSw motenc.0.enc-06-index => debounce.0.3.in -net spindleDecDb debounce.0.3.out => boss_plc.0.spindle-dec-in -net spindleDec boss_plc.0.spindle-dec-out => motenc.0.out-04 - -# Connect limit override. -net limitOverrideSw motenc.0.in-35-not => debounce.0.4.in -net limitOverride debounce.0.4.out => boss_plc.0.limit-override-in -net limitActive boss_plc.0.limit-active-out => motenc.0.out-18 - -# Connect rapid/feed overrides. -net adaptiveFeed boss_plc.0.adaptive-feed-out => motion.adaptive-feed -setp halui.feed-override.scale 0.01 -net feedOverride motenc.0.enc-04-count => halui.feed-override.counts -#net rapidOverride motenc.0.enc-06-count => halui.rapid-override.counts - -# Set the jog mode so motion stops as soon as the wheel stops. -setp joint.0.jog-vel-mode TRUE -setp joint.1.jog-vel-mode TRUE -setp joint.2.jog-vel-mode TRUE -setp joint.3.jog-vel-mode TRUE - -# Connect jog axis select to motion controller and PLC. -net xJog motenc.0.in-40 => joint.0.jog-enable -net yJog motenc.0.in-41 => joint.1.jog-enable -net zJog motenc.0.in-42 => joint.2.jog-enable -net aJog motenc.0.in-43 => joint.3.jog-enable -net xJog => boss_plc.0.x-jog-en-in -net yJog => boss_plc.0.y-jog-en-in -net zJog => boss_plc.0.z-jog-en-in - -# Connect jog wheel encoder. -net jogCounts motenc.0.enc-05-count => joint.0.jog-counts joint.1.jog-counts joint.2.jog-counts joint.3.jog-counts - -# Connect jog scale selects to PLC. -setp boss_plc.0.jog-scale-0 0.000001 -setp boss_plc.0.jog-scale-1 0.000010 -setp boss_plc.0.jog-scale-2 0.000100 -net jogScaleSel0 motenc.0.in-36 => boss_plc.0.jog-sel-in-0 -net jogScaleSel1 motenc.0.in-37 => boss_plc.0.jog-sel-in-1 -net jogScaleSel2 motenc.0.in-38 => boss_plc.0.jog-sel-in-2 - -# Connect PLC jog scale output. -net jogScale boss_plc.0.jog-scale-out => joint.0.jog-scale joint.1.jog-scale joint.2.jog-scale joint.3.jog-scale diff --git a/configs/by_machine/boss/boss.ini b/configs/by_machine/boss/boss.ini deleted file mode 100644 index 9096851a829..00000000000 --- a/configs/by_machine/boss/boss.ini +++ /dev/null @@ -1,257 +0,0 @@ -# EMC controller parameters for generic controller. Make these what you need -# for your system. -# General note: Comments can either be preceded with a # or ; - either is -# acceptable, although # is in keeping with most linux config files. -# General section ------------------------------------------------------------- - -[EMC] -# Version of this INI file -VERSION = 1.1 -# Name of machine, for use with display, etc. -MACHINE = LinuxCNC-BP-BOSS6 -# Debug level, 0 means no messages. See src/emc/nml_int/emcglb.h for others -#DEBUG = 0x00000003 -#DEBUG = 0x00000007 -DEBUG = 0 -# Sections for display options ------------------------------------------------ - -[DISPLAY] -# Name of display program, e.g., tklinuxcnc -DISPLAY = tklinuxcnc -#DISPLAY = axis -# Cycle time, in seconds, that display will sleep between polls -CYCLE_TIME = 0.0500 -# Path to help file -HELP_FILE = tklinuxcnc.txt -# Initial display setting for position, RELATIVE or MACHINE -POSITION_OFFSET = RELATIVE -# Initial display setting for position, COMMANDED or ACTUAL -POSITION_FEEDBACK = ACTUAL -# Highest value that will be allowed for feed override, 1.0 = 100% -MAX_FEED_OVERRIDE = 1.5 -# Prefix to be used -PROGRAM_PREFIX = ../../nc_files/ -# Introductory graphic -INTRO_GRAPHIC = linuxcnc.gif -INTRO_TIME = 5 -# Task controller section ----------------------------------------------------- - -[FILTER] -#No Content - -[RS274NGC] -# File containing interpreter variables -PARAMETER_FILE = boss.var -# Enable adaptive feed input, we use it to limit rapid/feed when -# limits are being overridden. -RS274NGC_STARTUP_CODE = M52 P1 -# Motion control section ------------------------------------------------------ - -[EMCMOT] -EMCMOT = motmod -# Timeout for comm to emcmot, in seconds -COMM_TIMEOUT = 1.0 -# Servo task period, in nanoseconds -SERVO_PERIOD = 200000 -# Hardware Abstraction Layer section -------------------------------------------------- - -[TASK] -# Name of task controller program, e.g., milltask -TASK = milltask -# Cycle time, in seconds, that task controller will sleep between polls -CYCLE_TIME = 0.010 -# Part program interpreter section -------------------------------------------- - -[HAL] -# HALUI to interact with NML. -# Run before any other HALFILE. -HALUI = halui -# The run script first uses halcmd to execute any HALFILE -# files, and then to execute any individual HALCMD commands. -# list of hal config files to run through halcmd -# files are executed in the order in which they appear -HALFILE = boss.hal -# list of halcmd commands to execute -# commands are executed in the order in which they appear -#HALCMD = save neta -# Trajectory planner section -------------------------------------------------- - -[HALUI] -#No Content - -[TRAJ] -COORDINATES = X Y Z A -HOME = 0 0 0 0 -LINEAR_UNITS = inch -ANGULAR_UNITS = degree -# 2000 rpm, 2:1 reduction, 5 tpi = 200 ipm = 3.33333333333333 ips. -MAX_LINEAR_VELOCITY = 2.5 -DEFAULT_LINEAR_VELOCITY = 0.1 -# 3000 lbs continuous force. Use 1% = 30 lbs for accel. With 600 lbs load -# that's 0.05g * 9.8 mpss * 39.37 i/m = 19.29 ipss. Motor peak torque -# is 3x continuous. -MAX_LINEAR_ACCELERATION = 15.0 -DEFAULT_LINEAR_ACCELERATION = 15.0 -# Axes sections --------------------------------------------------------------- -# First axis - -[EMCIO] -# tool table file -TOOL_TABLE = boss.tbl -TOOL_CHANGE_POSITION = -18.0 -12.0 0.0 - -[KINS] -KINEMATICS = trivkins -JOINTS = 4 - -[AXIS_X] -MIN_LIMIT = 0.0 -MAX_LIMIT = 18.0 -MAX_VELOCITY = 2.0 -MAX_ACCELERATION = 10.0 - -[JOINT_0] -TYPE = LINEAR -HOME = 0.0 -MAX_VELOCITY = 2.0 -MAX_ACCELERATION = 10.0 -BACKLASH = 0.0 -INPUT_SCALE = 100000 -OUTPUT_SCALE = 3.0 -OUTPUT_OFFSET = 0.0 -MIN_LIMIT = 0.0 -MAX_LIMIT = 18.0 -FERROR = 0.005 -MIN_FERROR = 0.001 -HOME_OFFSET = 0.05 -HOME_SEARCH_VEL = -0.5 -HOME_LATCH_VEL = 0.01 -HOME_USE_INDEX = YES -HOME_IGNORE_LIMITS = YES -HOME_SEQUENCE = 1 -# PID tuning params -MAX_OUTPUT = 3.333333 -DEADBAND = 0.000015 -P = 60.0 -I = 1250.0 -D = 0.0 -MAX_ERROR_I = 0.0 -FF0 = 0.0 -FF1 = 1.0 -FF2 = 0.0 -BIAS = 0.0 -# Second axis - -[AXIS_Y] -MIN_LIMIT = 0.0 -MAX_LIMIT = 12.0 -MAX_VELOCITY = 2.0 -MAX_ACCELERATION = 10.0 - -[JOINT_1] -TYPE = LINEAR -HOME = 0.0 -MAX_VELOCITY = 2.0 -MAX_ACCELERATION = 10.0 -BACKLASH = 0.0 -INPUT_SCALE = 100000 -OUTPUT_SCALE = 3.0 -OUTPUT_OFFSET = 0.0 -MIN_LIMIT = 0.0 -MAX_LIMIT = 12.0 -FERROR = 0.005 -MIN_FERROR = 0.001 -HOME_OFFSET = 0.0 -HOME_SEARCH_VEL = -0.4 -HOME_LATCH_VEL = 0.01 -HOME_USE_INDEX = YES -HOME_IGNORE_LIMITS = YES -HOME_SEQUENCE = 1 -# PID tuning params -MAX_OUTPUT = 3.333333 -DEADBAND = 0.000015 -P = 60.0 -I = 1250.0 -D = 0.0 -MAX_ERROR_I = 0.0 -FF0 = 0.0 -FF1 = 1.0 -FF2 = 0.0 -BIAS = 0.0 -# Third axis - -[AXIS_Z] -MIN_LIMIT = -4.75 -MAX_LIMIT = 0.0 -MAX_VELOCITY = 2.0 -MAX_ACCELERATION = 10.0 - -[JOINT_2] -TYPE = LINEAR -HOME = 0.0 -MAX_VELOCITY = 2.0 -MAX_ACCELERATION = 10.0 -BACKLASH = 0.0 -INPUT_SCALE = -100000 -OUTPUT_SCALE = -3.0 -OUTPUT_OFFSET = 0.0 -MIN_LIMIT = -4.75 -MAX_LIMIT = 0.0 -FERROR = 0.005 -MIN_FERROR = 0.001 -HOME_OFFSET = -0.225 -HOME_SEARCH_VEL = 0.1 -HOME_LATCH_VEL = -0.01 -HOME_USE_INDEX = NO -HOME_IGNORE_LIMITS = NO -HOME_SEQUENCE = 0 -# PID tuning params -MAX_OUTPUT = 3.333333 -DEADBAND = 0.000015 -P = 60.0 -I = 1250.0 -D = 0.0 -MAX_ERROR_I = 0.0 -FF0 = 0.0 -FF1 = 1.0 -FF2 = 0.0 -BIAS = 0.0 -# Fourth axis - -[AXIS_A] -MIN_LIMIT = 0.0 -MAX_LIMIT = 0.0 -MAX_VELOCITY = 2.0 -MAX_ACCELERATION = 10.0 - -[JOINT_3] -TYPE = ANGULAR -HOME = 0.0 -MAX_VELOCITY = 2.0 -MAX_ACCELERATION = 10.0 -BACKLASH = 0.0 -INPUT_SCALE = 100000 -OUTPUT_SCALE = 3.0 -OUTPUT_OFFSET = 0.0 -MIN_LIMIT = 0.0 -MAX_LIMIT = 0.0 -FERROR = 0.005 -MIN_FERROR = 0.001 -HOME_OFFSET = 0.0 -HOME_SEARCH_VEL = 0.0 -HOME_LATCH_VEL = -0.01 -HOME_USE_INDEX = YES -HOME_IGNORE_LIMITS = YES -HOME_SEQUENCE = -1 -# PID tuning params -MAX_OUTPUT = 3.333333 -DEADBAND = 0.000015 -P = 60.0 -I = 1250.0 -D = 0.0 -MAX_ERROR_I = 0.0 -FF0 = 0.0 -FF1 = 1.0 -FF2 = 0.0 -BIAS = 0.0 -# section for main IO controller parameters ----------------------------------- diff --git a/configs/by_machine/boss/boss.tbl b/configs/by_machine/boss/boss.tbl deleted file mode 100644 index c0b72de0652..00000000000 --- a/configs/by_machine/boss/boss.tbl +++ /dev/null @@ -1,4 +0,0 @@ -T1 P1 D0.125000 Z+0.511000 ;1/8 end mill -T2 P2 D0.062500 Z+0.100000 ;1/16 end mill -T3 P3 D0.201000 Z+1.273000 ;#7 tap drill -T99999 P99999 Z+0.100000 ;big tool number diff --git a/configs/by_machine/boss/pid_test.hal b/configs/by_machine/boss/pid_test.hal deleted file mode 100644 index dbd376f6bcd..00000000000 --- a/configs/by_machine/boss/pid_test.hal +++ /dev/null @@ -1,381 +0,0 @@ -# HAL config file for Bridgeport BOSS. -# -# Load the core RT modules that will be needed. - -# Kinematics -loadrt [KINS]KINEMATICS - -# motion controller, get name and thread periods from ini file -loadrt [EMCMOT]EMCMOT servo_period_nsec=[EMCMOT]SERVO_PERIOD num_joints=[KINS]JOINTS - -# PID module, for four PID loops -loadrt pid num_chan=4 - -# Install motenc driver. -loadrt hal_motenc - -# Install PLC. -loadrt boss_plc - -# Install debounce filters for operator console (cycle hold/start, -# limit override, spindle increase/decrease/status). -loadrt debounce cfg="6" - -# Load muxes for motion feedback and PID command. -loadrt mux2 count=8 - -# Load differentiators for debug. -loadrt ddt count=3 - -# Load the signal generator module for tuning. -loadrt siggen - -# Add functions to servo thread so they will be evaluated -# every servo period. -# -# Inputs are read at the beginning of the thread -addf mux2.0 servo-thread 1 -addf debounce.0 servo-thread 1 -addf motenc.0.encoder-read servo-thread 1 -addf motenc.0.misc-update servo-thread 1 -#addf motenc.0.adc-read servo-thread 1 -addf motenc.0.digital-in-read servo-thread 1 -addf siggen.0.update servo-thread 1 -# Do processing. -addf boss_plc.0.refresh servo-thread -1 -addf motion-command-handler servo-thread -1 -addf motion-controller servo-thread -1 -addf pid.0.do-pid-calcs servo-thread -1 -addf pid.1.do-pid-calcs servo-thread -1 -addf pid.2.do-pid-calcs servo-thread -1 -addf pid.3.do-pid-calcs servo-thread -1 -# Outputs are updated at the end of the thread -addf motenc.0.dac-write servo-thread -1 -addf motenc.0.digital-out-write servo-thread -1 -addf ddt.0 servo-thread -1 -addf ddt.1 servo-thread -1 -addf ddt.2 servo-thread -1 - -# PID loops. -# -# Get maximum (and minimum) output volts from ini file. -setp pid.0.maxoutput [JOINT_0]MAX_OUTPUT -setp pid.1.maxoutput [JOINT_1]MAX_OUTPUT -setp pid.2.maxoutput [JOINT_2]MAX_OUTPUT -setp pid.3.maxoutput [JOINT_3]MAX_OUTPUT - -# Set PID loop output limits. -setp pid.0.maxoutput [JOINT_0]MAX_VELOCITY -setp pid.1.maxoutput [JOINT_1]MAX_VELOCITY -setp pid.2.maxoutput [JOINT_2]MAX_VELOCITY -setp pid.3.maxoutput [JOINT_3]MAX_VELOCITY - -# Set PID loop gains. -setp pid.0.Pgain [JOINT_0]P -setp pid.0.Igain [JOINT_0]I -setp pid.0.Dgain [JOINT_0]D -setp pid.0.maxerrorI [JOINT_0]MAX_ERROR_I -setp pid.0.bias [JOINT_0]BIAS -setp pid.0.FF0 [JOINT_0]FF0 -setp pid.0.FF1 [JOINT_0]FF1 -setp pid.0.FF2 [JOINT_0]FF2 -# deadband should be just over 1 count -setp pid.0.deadband [JOINT_0]DEADBAND -setp pid.0.tune-effort [JOINT_0]TUNE_EFFORT -setp pid.0.tune-cycles [JOINT_0]TUNE_CYCLES -setp pid.0.tune-type [JOINT_0]TUNE_TYPE - -setp pid.1.Pgain [JOINT_1]P -setp pid.1.Igain [JOINT_1]I -setp pid.1.maxerrorI [JOINT_1]MAX_ERROR_I -setp pid.1.Dgain [JOINT_1]D -setp pid.1.bias [JOINT_1]BIAS -setp pid.1.FF0 [JOINT_1]FF0 -setp pid.1.FF1 [JOINT_1]FF1 -setp pid.1.FF2 [JOINT_1]FF2 -# deadband should be just over 1 count -setp pid.1.deadband [JOINT_1]DEADBAND -setp pid.1.tune-effort [JOINT_1]TUNE_EFFORT -setp pid.1.tune-cycles [JOINT_1]TUNE_CYCLES -setp pid.1.tune-type [JOINT_1]TUNE_TYPE - -setp pid.2.Pgain [JOINT_2]P -setp pid.2.Igain [JOINT_2]I -setp pid.2.Dgain [JOINT_2]D -setp pid.2.maxerrorI [JOINT_2]MAX_ERROR_I -setp pid.2.bias [JOINT_2]BIAS -setp pid.2.FF0 [JOINT_2]FF0 -setp pid.2.FF1 [JOINT_2]FF1 -setp pid.2.FF2 [JOINT_2]FF2 -# deadband should be just over 1 count -setp pid.2.deadband [JOINT_2]DEADBAND -setp pid.2.tune-effort [JOINT_2]TUNE_EFFORT -setp pid.2.tune-cycles [JOINT_2]TUNE_CYCLES -setp pid.2.tune-type [JOINT_2]TUNE_TYPE - -setp pid.3.Pgain [JOINT_3]P -setp pid.3.Igain [JOINT_3]I -setp pid.3.Dgain [JOINT_3]D -setp pid.3.maxerrorI [JOINT_3]MAX_ERROR_I -setp pid.3.bias [JOINT_3]BIAS -setp pid.3.FF0 [JOINT_3]FF0 -setp pid.3.FF1 [JOINT_3]FF1 -setp pid.3.FF2 [JOINT_3]FF2 -# deadband should be just over 1 count -setp pid.3.deadband [JOINT_3]DEADBAND -setp pid.3.tune-effort [JOINT_3]TUNE_EFFORT -setp pid.3.tune-cycles [JOINT_3]TUNE_CYCLES -setp pid.3.tune-type [JOINT_3]TUNE_TYPE - -# Connect the enable signals to the PID blocks. -net xEnable joint.0.amp-enable-out => pid.0.enable -net yEnable joint.1.amp-enable-out => pid.1.enable -net zEnable joint.2.amp-enable-out => pid.2.enable -net aEnable joint.3.amp-enable-out => pid.3.enable - -# Set siggen parameters. -setp siggen.0.frequency 0.5 -setp siggen.0.offset 0 -setp siggen.0.amplitude 0.01 - -# Connect position commands to PID inputs. -net xPosCmd joint.0.motor-pos-cmd => mux2.4.in0 -net yPosCmd joint.1.motor-pos-cmd => mux2.5.in0 -net zPosCmd joint.2.motor-pos-cmd => mux2.6.in0 -net aPosCmd joint.3.motor-pos-cmd => mux2.7.in0 - -net squareWave siggen.0.square => mux2.4.in1 -net squareWave => mux2.5.in1 -net squareWave => mux2.6.in1 -net squareWave => mux2.7.in1 - -net xPidPosCmd mux2.4.out => pid.0.command -net yPidPosCmd mux2.5.out => pid.1.command -net zPidPosCmd mux2.6.out => pid.2.command -net aPidPosCmd mux2.7.out => pid.3.command - -net xTestMode => mux2.4.sel -net yTestMode => mux2.5.sel -net zTestMode => mux2.6.sel -net aTestMode => mux2.7.sel - -# Connect signals to auto-tune pins. -net xStartTune pid.0.tune-start -net xTuneMode pid.0.tune-mode -net yStartTune pid.1.tune-start -net yTuneMode pid.1.tune-mode -net zStartTune pid.2.tune-start -net zTuneMode pid.2.tune-mode -net aStartTune pid.3.tune-start -net aTuneMode pid.3.tune-mode - -# DACs -# -# Set DAC output scaling from ini file. -setp motenc.0.dac-01-gain [JOINT_0]OUTPUT_SCALE -setp motenc.0.dac-03-gain [JOINT_1]OUTPUT_SCALE -setp motenc.0.dac-02-gain [JOINT_2]OUTPUT_SCALE -setp motenc.0.dac-00-gain [JOINT_3]OUTPUT_SCALE - -# Set DAC offset from ini file. -setp motenc.0.dac-01-offset [JOINT_0]OUTPUT_OFFSET -setp motenc.0.dac-03-offset [JOINT_1]OUTPUT_OFFSET -setp motenc.0.dac-02-offset [JOINT_2]OUTPUT_OFFSET -setp motenc.0.dac-00-offset [JOINT_3]OUTPUT_OFFSET - -# Connect PID output signals to DACs. -net xOutput pid.0.output => motenc.0.dac-01-value -net yOutput pid.1.output => motenc.0.dac-03-value -net zOutput pid.2.output => motenc.0.dac-02-value -net aOutput pid.3.output => motenc.0.dac-00-value - -net zPosCmd ddt.0.in -net zVelCmd ddt.0.out => ddt.1.in -net zAccCmd ddt.1.out -net zOutput ddt.2.in -net zPidAccCmd ddt.2.out - -# Encoders. -# -# Set feedback scaling from ini file. -setp motenc.0.enc-01-scale [JOINT_0]INPUT_SCALE -setp motenc.0.enc-03-scale [JOINT_1]INPUT_SCALE -setp motenc.0.enc-02-scale [JOINT_2]INPUT_SCALE -setp motenc.0.enc-00-scale [JOINT_3]INPUT_SCALE - -# Connect position feedback to PID loop. -net xMotorPosFb motenc.0.enc-01-position => pid.0.feedback -net yMotorPosFb motenc.0.enc-03-position => pid.1.feedback -net zMotorPosFb motenc.0.enc-02-position => pid.2.feedback -net aMotorPosFb motenc.0.enc-00-position => pid.3.feedback - -# Connect position feedback to motion module. -net xMotorPosFb => mux2.0.in0 -net yMotorPosFb => mux2.1.in0 -net zMotorPosFb => mux2.2.in0 -net aMotorPosFb => mux2.3.in0 - -net xPosCmd => mux2.0.in1 -net yPosCmd => mux2.1.in1 -net zPosCmd => mux2.2.in1 -net aPosCmd => mux2.3.in1 - -net xPosFb mux2.0.out => joint.0.motor-pos-fb -net yPosFb mux2.1.out => joint.1.motor-pos-fb -net zPosFb mux2.2.out => joint.2.motor-pos-fb -net aPosFb mux2.3.out => joint.3.motor-pos-fb - -net xTuneMode => mux2.0.sel -net yTuneMode => mux2.1.sel -net zTuneMode => mux2.2.sel -net aTuneMode => mux2.3.sel - -# Connect position feedback to PLC. -net xMotorPosFb => boss_plc.0.x-position-in -net yMotorPosFb => boss_plc.0.y-position-in - -# Connect index pulses to motion controller. -net xIndex motenc.0.enc-01-index-enable <=> joint.0.index-enable -net yIndex motenc.0.enc-03-index-enable <=> joint.1.index-enable -net zIndex motenc.0.enc-02-index-enable <=> joint.2.index-enable -net aIndex motenc.0.enc-00-index-enable <=> joint.3.index-enable - -# Limits. -# -# Connect limit/home switch inputs to PLC and motion controller. -net xLimitSw motenc.0.in-09 => boss_plc.0.x-limit-in -net xLimitSw => joint.0.home-sw-in -net yLimitSw motenc.0.in-13 => boss_plc.0.y-limit-in -net yLimitSw => joint.1.home-sw-in -net zMinlimSw motenc.0.in-26 => boss_plc.0.z-limit-neg-in -net zMaxlimSw motenc.0.in-25 => boss_plc.0.z-limit-pos-in -net zHome motenc.0.in-27 => joint.2.home-sw-in - -# Connect PLC limit switch outputs to motion controller. -net xMinLim boss_plc.0.x-limit-neg-out => joint.0.neg-lim-sw-in -net xMaxLim boss_plc.0.x-limit-pos-out => joint.0.pos-lim-sw-in -net yMinLim boss_plc.0.y-limit-neg-out => joint.1.neg-lim-sw-in -net yMaxLim boss_plc.0.y-limit-pos-out => joint.1.pos-lim-sw-in -net zMinLim boss_plc.0.z-limit-neg-out => joint.2.neg-lim-sw-in -net zMaxLim boss_plc.0.z-limit-pos-out => joint.2.pos-lim-sw-in - -# Amp enables/faults. -# -# Connect amp ready to PLC. -net xReady motenc.0.in-08 => boss_plc.0.x-amp-ready-in -net yReady motenc.0.in-12 => boss_plc.0.y-amp-ready-in -net zReady motenc.0.in-24 => boss_plc.0.z-amp-ready-in -net aReady motenc.0.in-28 => boss_plc.0.a-amp-ready-in - -# Connect amp enables to I/O. -net xEnable => motenc.0.out-00 -net yEnable => motenc.0.out-01 -net zEnable => motenc.0.out-08 -net aEnable => motenc.0.out-09 - -# Connect amp enables to PLC. -net xEnable => boss_plc.0.x-amp-enable-in -net yEnable => boss_plc.0.y-amp-enable-in -net zEnable => boss_plc.0.z-amp-enable-in -net aEnable => boss_plc.0.a-amp-enable-in - -# Connect amp faults to motion controller. -net xFault boss_plc.0.x-amp-fault-out => joint.0.amp-fault-in -net yFault boss_plc.0.y-amp-fault-out => joint.1.amp-fault-in -net zFault boss_plc.0.z-amp-fault-out => joint.2.amp-fault-in -net aFault boss_plc.0.a-amp-fault-out => joint.3.amp-fault-in - -# Spindle. -# -# Connect spindle speed to PLC and spindle fwd/rev/stat to I/O. -net spindleSpeed spindle.0.speed-out => boss_plc.0.spindle-speed-in -net spindleFwd boss_plc.0.spindle-fwd-out => motenc.0.out-11 -net spindleRev boss_plc.0.spindle-rev-out => motenc.0.out-12 -net spindleIsOnSw motenc.0.in-29-not => debounce.0.5.in -net spindleIsOn debounce.0.5.out => boss_plc.0.spindle-is-on-in - -# Connect spindle brake to PLC and PLC brake to I/O. -setp boss_plc.0.brake-on-delay 500 -setp boss_plc.0.brake-off-delay 800 -net spindleBrakeOnMot spindle.0.brake => boss_plc.0.brake-en-in -net spindleBrakeOn boss_plc.0.brake-en-out => motenc.0.out-02 - -# Tool change. -# -# Loop back tool prepare pins. -net toolPrepare iocontrol.0.tool-prepare iocontrol.0.tool-prepared - -# Connect tool change pins to PLC. -net toolChange iocontrol.0.tool-change => boss_plc.0.tool-change-in -net toolChanged boss_plc.0.tool-changed-out => iocontrol.0.tool-changed - -# Coolant. -# -# Connect mist/flood coolant to I/O. -net mistOn iocontrol.0.coolant-mist => motenc.0.out-14 -net floodOn iocontrol.0.coolant-flood => motenc.0.out-15 - -# Operator console. -# -# Set debounce time. -setp debounce.0.delay 20 - -# Connect e-stop I/O. -net eStopSense motenc.0.in-32 => iocontrol.0.emc-enable-in -net eStopWrite iocontrol.0.user-enable-out => motenc.0.out-16 - -# Connect cycle hold/start. -net cycleHoldSw motenc.0.in-33-not => debounce.0.0.in -net cycleHold debounce.0.0.out => boss_plc.0.cycle-hold-in -net cycleStartSw motenc.0.in-34 => debounce.0.1.in -net cycleStart debounce.0.1.out => boss_plc.0.cycle-start-in -net feedHold boss_plc.0.feed-hold-out => motion.feed-hold -net waitUser boss_plc.0.wait-user-out => motenc.0.out-17 - -# Connect speed overrides. -net spindleIncSw motenc.0.enc-04-index => debounce.0.2.in -net spindleIncDb debounce.0.2.out => boss_plc.0.spindle-inc-in -net spindleInc boss_plc.0.spindle-inc-out => motenc.0.out-03 -net spindleDecSw motenc.0.enc-06-index => debounce.0.3.in -net spindleDecDb debounce.0.3.out => boss_plc.0.spindle-dec-in -net spindleDec boss_plc.0.spindle-dec-out => motenc.0.out-04 - -# Connect limit override. -net limitOverrideSw motenc.0.in-35-not => debounce.0.4.in -net limitOverride debounce.0.4.out => boss_plc.0.limit-override-in -net limitActive boss_plc.0.limit-active-out => motenc.0.out-18 - -# Connect rapid/feed overrides. -net adaptiveFeed boss_plc.0.adaptive-feed-out => motion.adaptive-feed -setp halui.feed-override.scale 0.01 -net feedOverride motenc.0.enc-04-count => halui.feed-override.counts -#net rapidOverride motenc.0.enc-06-count => halui.rapid-override.counts - -# Set the jog mode so motion stops as soon as the wheel stops. -setp joint.0.jog-vel-mode TRUE -setp joint.1.jog-vel-mode TRUE -setp joint.2.jog-vel-mode TRUE -setp joint.3.jog-vel-mode TRUE - -# Connect jog axis select to motion controller and PLC. -net xJog motenc.0.in-40 => joint.0.jog-enable -net yJog motenc.0.in-41 => joint.1.jog-enable -net zJog motenc.0.in-42 => joint.2.jog-enable -net aJog motenc.0.in-43 => joint.3.jog-enable -net xJog => boss_plc.0.x-jog-en-in -net yJog => boss_plc.0.y-jog-en-in -net zJog => boss_plc.0.z-jog-en-in - -# Connect jog wheel encoder. -net jogCounts motenc.0.enc-05-count => joint.0.jog-counts joint.1.jog-counts joint.2.jog-counts joint.3.jog-counts - -# Connect jog scale selects to PLC. -setp boss_plc.0.jog-scale-0 0.000001 -setp boss_plc.0.jog-scale-1 0.000010 -setp boss_plc.0.jog-scale-2 0.000100 -net jogScaleSel0 motenc.0.in-36 => boss_plc.0.jog-sel-in-0 -net jogScaleSel1 motenc.0.in-37 => boss_plc.0.jog-sel-in-1 -net jogScaleSel2 motenc.0.in-38 => boss_plc.0.jog-sel-in-2 - -# Connect PLC jog scale output. -net jogScale boss_plc.0.jog-scale-out => joint.0.jog-scale joint.1.jog-scale joint.2.jog-scale joint.3.jog-scale diff --git a/configs/by_machine/boss/pid_test.ini b/configs/by_machine/boss/pid_test.ini deleted file mode 100644 index db6926cc0cc..00000000000 --- a/configs/by_machine/boss/pid_test.ini +++ /dev/null @@ -1,269 +0,0 @@ -# EMC controller parameters for generic controller. Make these what you need -# for your system. -# General note: Comments can either be preceded with a # or ; - either is -# acceptable, although # is in keeping with most linux config files. -# General section ------------------------------------------------------------- - -[EMC] -# Version of this INI file -VERSION = 1.1 -# Name of machine, for use with display, etc. -MACHINE = LinuxCNC-BP-BOSS6 -# Debug level, 0 means no messages. See src/emc/nml_int/emcglb.h for others -#DEBUG = 0x00000003 -#DEBUG = 0x00000007 -DEBUG = 0 -# Sections for display options ------------------------------------------------ - -[DISPLAY] -# Name of display program, e.g., tklinuxcnc -DISPLAY = tklinuxcnc -#DISPLAY = axis -# Cycle time, in seconds, that display will sleep between polls -CYCLE_TIME = 0.0500 -# Path to help file -HELP_FILE = tklinuxcnc.txt -# Initial display setting for position, RELATIVE or MACHINE -POSITION_OFFSET = RELATIVE -# Initial display setting for position, COMMANDED or ACTUAL -POSITION_FEEDBACK = ACTUAL -# Highest value that will be allowed for feed override, 1.0 = 100% -MAX_FEED_OVERRIDE = 1.5 -# Prefix to be used -PROGRAM_PREFIX = ../../nc_files/ -# Introductory graphic -INTRO_GRAPHIC = linuxcnc.gif -INTRO_TIME = 5 -# Task controller section ----------------------------------------------------- - -[FILTER] -#No Content - -[RS274NGC] -# File containing interpreter variables -PARAMETER_FILE = boss.var -# Enable adaptive feed input, we use it to limit rapid/feed when -# limits are being overridden. -RS274NGC_STARTUP_CODE = M52 P1 -# Motion control section ------------------------------------------------------ - -[EMCMOT] -EMCMOT = motmod -# Timeout for comm to emcmot, in seconds -COMM_TIMEOUT = 1.0 -# Servo task period, in nanoseconds -SERVO_PERIOD = 200000 -# Hardware Abstraction Layer section -------------------------------------------------- - -[TASK] -# Name of task controller program, e.g., milltask -TASK = milltask -# Cycle time, in seconds, that task controller will sleep between polls -CYCLE_TIME = 0.010 -# Part program interpreter section -------------------------------------------- - -[HAL] -# HALUI to interact with NML. -# Run before any other HALFILE. -HALUI = halui -# The run script first uses halcmd to execute any HALFILE -# files, and then to execute any individual HALCMD commands. -# list of hal config files to run through halcmd -# files are executed in the order in which they appear -HALFILE = pid_test.hal -# list of halcmd commands to execute -# commands are executed in the order in which they appear -#HALCMD = save neta -# Trajectory planner section -------------------------------------------------- - -[HALUI] -#No Content - -[TRAJ] -COORDINATES = X Y Z A -HOME = 0 0 0 0 -LINEAR_UNITS = inch -ANGULAR_UNITS = degree -# 2000 rpm, 2:1 reduction, 5 tpi = 200 ipm = 3.33333333333333 ips. -MAX_LINEAR_VELOCITY = 2.5 -DEFAULT_LINEAR_VELOCITY = 0.1 -# 3000 lbs continuous force. Use 1% = 30 lbs for accel. With 600 lbs load -# that's 0.05g * 9.8 mpss * 39.37 i/m = 19.29 ipss. Motor peak torque -# is 3x continuous. -MAX_LINEAR_ACCELERATION = 3.0 -DEFAULT_LINEAR_ACCELERATION = 3.0 -# Axes sections --------------------------------------------------------------- -# First axis - -[EMCIO] -# tool table file -TOOL_TABLE = boss.tbl -TOOL_CHANGE_POSITION = -18.0 -12.0 0.0 - -[KINS] -KINEMATICS = trivkins -JOINTS = 4 - -[AXIS_X] -MIN_LIMIT = 0.0 -MAX_LIMIT = 18.0 -MAX_VELOCITY = 2.0 -MAX_ACCELERATION = 2.0 - -[JOINT_0] -TYPE = LINEAR -HOME = 0.0 -MAX_VELOCITY = 2.0 -MAX_ACCELERATION = 2.0 -BACKLASH = 0.0 -INPUT_SCALE = 100000 -OUTPUT_SCALE = 3.0 -OUTPUT_OFFSET = 0.0 -MIN_LIMIT = 0.0 -MAX_LIMIT = 18.0 -FERROR = 0.005 -MIN_FERROR = 0.001 -HOME_OFFSET = 0.05 -HOME_SEARCH_VEL = -0.5 -HOME_LATCH_VEL = 0.01 -HOME_USE_INDEX = YES -HOME_IGNORE_LIMITS = YES -HOME_SEQUENCE = 1 -# PID tuning params -MAX_OUTPUT = 3.333333 -DEADBAND = 0.000015 -P = 100.0 -I = 0.0 -D = 0.0 -MAX_ERROR_I = 0.0 -FF0 = 0.0 -FF1 = 0.0 -FF2 = 0.0 -BIAS = 0.0 -TUNE_EFFORT = 0.5 -TUNE_CYCLES = 50 -TUNE_TYPE = 1 -# Second axis - -[AXIS_Y] -MIN_LIMIT = 0.0 -MAX_LIMIT = 12.0 -MAX_VELOCITY = 2.0 -MAX_ACCELERATION = 2.0 - -[JOINT_1] -TYPE = LINEAR -HOME = 0.0 -MAX_VELOCITY = 2.0 -MAX_ACCELERATION = 2.0 -BACKLASH = 0.0 -INPUT_SCALE = 100000 -OUTPUT_SCALE = 3.0 -OUTPUT_OFFSET = 0.0 -MIN_LIMIT = 0.0 -MAX_LIMIT = 12.0 -FERROR = 0.005 -MIN_FERROR = 0.001 -HOME_OFFSET = 0.0 -HOME_SEARCH_VEL = -0.4 -HOME_LATCH_VEL = 0.01 -HOME_USE_INDEX = YES -HOME_IGNORE_LIMITS = YES -HOME_SEQUENCE = 1 -# PID tuning params -MAX_OUTPUT = 3.333333 -DEADBAND = 0.000015 -P = 100.0 -I = 0.0 -D = 0.0 -MAX_ERROR_I = 0.0 -FF0 = 0.0 -FF1 = 0.0 -FF2 = 0.0 -BIAS = 0.0 -TUNE_EFFORT = 0.5 -TUNE_CYCLES = 50 -TUNE_TYPE = 1 -# Third axis - -[AXIS_Z] -MIN_LIMIT = -4.75 -MAX_LIMIT = 0.0 -MAX_VELOCITY = 2.0 -MAX_ACCELERATION = 2.0 - -[JOINT_2] -TYPE = LINEAR -HOME = 0.0 -MAX_VELOCITY = 2.0 -MAX_ACCELERATION = 2.0 -BACKLASH = 0.0 -INPUT_SCALE = -100000 -OUTPUT_SCALE = -3.0 -OUTPUT_OFFSET = 0.0 -MIN_LIMIT = -4.75 -MAX_LIMIT = 0.0 -FERROR = 0.005 -MIN_FERROR = 0.001 -HOME_OFFSET = -0.225 -HOME_SEARCH_VEL = 0.1 -HOME_LATCH_VEL = -0.01 -HOME_USE_INDEX = NO -HOME_IGNORE_LIMITS = NO -HOME_SEQUENCE = 0 -# PID tuning params -MAX_OUTPUT = 3.333333 -DEADBAND = 0.000015 -P = 100.0 -I = 0.0 -D = 0.0 -MAX_ERROR_I = 0.0 -FF0 = 0.0 -FF1 = 0.0 -FF2 = 0.0 -BIAS = 0.0 -TUNE_EFFORT = 0.5 -TUNE_CYCLES = 50 -TUNE_TYPE = 1 -# Fourth axis - -[AXIS_A] -MIN_LIMIT = 0.0 -MAX_LIMIT = 0.0 -MAX_VELOCITY = 2.0 -MAX_ACCELERATION = 2.0 - -[JOINT_3] -TYPE = ANGULAR -HOME = 0.0 -MAX_VELOCITY = 2.0 -MAX_ACCELERATION = 2.0 -BACKLASH = 0.0 -INPUT_SCALE = 100000 -OUTPUT_SCALE = 3.0 -OUTPUT_OFFSET = 0.0 -MIN_LIMIT = 0.0 -MAX_LIMIT = 0.0 -FERROR = 0.005 -MIN_FERROR = 0.001 -HOME_OFFSET = 0.0 -HOME_SEARCH_VEL = 0.0 -HOME_LATCH_VEL = -0.01 -HOME_USE_INDEX = YES -HOME_IGNORE_LIMITS = YES -HOME_SEQUENCE = -1 -# PID tuning params -MAX_OUTPUT = 3.333333 -DEADBAND = 0.000015 -P = 100.0 -I = 0.0 -D = 0.0 -MAX_ERROR_I = 0.0 -FF0 = 0.0 -FF1 = 0.0 -FF2 = 0.0 -BIAS = 0.0 -TUNE_EFFORT = 0.5 -TUNE_CYCLES = 50 -TUNE_TYPE = 1 -# section for main IO controller parameters ----------------------------------- diff --git a/debian/changelog b/debian/changelog index 6d24473b7ab..58caefd7cf0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -6,6 +6,14 @@ linuxcnc (1:2.10.0~pre1) UNRELEASED; urgency=medium [ andypugh ] * Add a finite-jerk trajectory planner + [ Luca Toniolo ] + * Remove the RTAI-kernel-only hardware drivers (hal_stg, hal_motenc, + hal_vti, hal_evoreg, hal_tiro, hal_ax5214h, opto_ac5, pci_8255, + pcl720, pluto_servo, pluto_step) and hal_skeleton. They were never + built for uspace, a user poll found no remaining users, and no + testers are available. Sample configs for these cards are removed + as well. + -- andypugh Wed, 07 Jan 2026 22:15:18 +0000 linuxcnc (1:2.9.8) UNRELEASED; urgency=medium diff --git a/debian/copyright b/debian/copyright index 3908cc8cb82..2990935668f 100644 --- a/debian/copyright +++ b/debian/copyright @@ -237,20 +237,10 @@ Files: src/emc/tp/* src/emc/usr_intf/* src/hal/drivers/bcm2835.h - src/hal/drivers/hal_ax5214h.c src/hal/drivers/hal_bb_gpio.c - src/hal/drivers/hal_evoreg.c - src/hal/drivers/hal_motenc.c src/hal/drivers/hal_pi_gpio.c src/hal/drivers/hal_ppmc.c - src/hal/drivers/hal_skeleton.c src/hal/drivers/hal_speaker.c - src/hal/drivers/hal_stg.c - src/hal/drivers/hal_stg.h - src/hal/drivers/hal_tiro.c - src/hal/drivers/hal_vti.c - src/hal/drivers/hal_vti.h - src/hal/drivers/motenc.h src/hal/hal.h src/hal/user_comps/gs2_vfd.c src/hal/user_comps/hy_gt_vfd.c diff --git a/docs/po4a.cfg b/docs/po4a.cfg index 61308113169..799ccb35cf1 100644 --- a/docs/po4a.cfg +++ b/docs/po4a.cfg @@ -58,7 +58,6 @@ [type: AsciiDoc_def] src/config/stepper.adoc $lang:build/adoc/$lang/config/stepper.adoc [type: AsciiDoc_def] src/config/stepper-diagnostics.adoc $lang:build/adoc/$lang/config/stepper-diagnostics.adoc [type: AsciiDoc_def] src/config/stepper-quickstart.adoc $lang:build/adoc/$lang/config/stepper-quickstart.adoc -[type: AsciiDoc_def] src/drivers/ax5214h.adoc $lang:build/adoc/$lang/drivers/ax5214h.adoc [type: AsciiDoc_def] src/drivers/gm.adoc $lang:build/adoc/$lang/drivers/gm.adoc [type: AsciiDoc_def] src/drivers/gs2.adoc $lang:build/adoc/$lang/drivers/gs2.adoc [type: AsciiDoc_def] src/drivers/hal_pi_gpio.adoc $lang:build/adoc/$lang/drivers/hal_pi_gpio.adoc @@ -67,12 +66,8 @@ [type: AsciiDoc_def] src/drivers/mb2hal.adoc $lang:build/adoc/$lang/drivers/mb2hal.adoc [type: AsciiDoc_def] src/drivers/mesa_modbus.adoc $lang:build/adoc/$lang/drivers/mesa_modbus.adoc [type: AsciiDoc_def] src/drivers/mitsub-vfd.adoc $lang:build/adoc/$lang/drivers/mitsub-vfd.adoc -[type: AsciiDoc_def] src/drivers/motenc.adoc $lang:build/adoc/$lang/drivers/motenc.adoc -[type: AsciiDoc_def] src/drivers/opto22.adoc $lang:build/adoc/$lang/drivers/opto22.adoc [type: AsciiDoc_def] src/drivers/pico-ppmc.adoc $lang:build/adoc/$lang/drivers/pico-ppmc.adoc -[type: AsciiDoc_def] src/drivers/pluto-p.adoc $lang:build/adoc/$lang/drivers/pluto-p.adoc [type: AsciiDoc_def] src/drivers/pmx485.adoc $lang:build/adoc/$lang/drivers/pmx485.adoc -[type: AsciiDoc_def] src/drivers/servo-to-go.adoc $lang:build/adoc/$lang/drivers/servo-to-go.adoc [type: AsciiDoc_def] src/drivers/shuttle.adoc $lang:build/adoc/$lang/drivers/shuttle.adoc [type: AsciiDoc_def] src/drivers/vfs11.adoc $lang:build/adoc/$lang/drivers/vfs11.adoc [type: AsciiDoc_def] src/examples/gcode.adoc $lang:build/adoc/$lang/examples/gcode.adoc @@ -344,7 +339,6 @@ [type: AsciiDoc_def] src/man/man9/lcd.9.adoc $lang:build/adoc/$lang/man/man9/lcd.9.adoc [type: AsciiDoc_def] src/man/man9/lineardeltakins.9.adoc $lang:build/adoc/$lang/man/man9/lineardeltakins.9.adoc [type: AsciiDoc_def] src/man/man9/motion.9.adoc $lang:build/adoc/$lang/man/man9/motion.9.adoc -[type: AsciiDoc_def] src/man/man9/opto_ac5.9.adoc $lang:build/adoc/$lang/man/man9/opto_ac5.9.adoc [type: AsciiDoc_def] src/man/man9/rosekins.9.adoc $lang:build/adoc/$lang/man/man9/rosekins.9.adoc [type: AsciiDoc_def] src/man/man9/sampler.9.adoc $lang:build/adoc/$lang/man/man9/sampler.9.adoc [type: AsciiDoc_def] src/man/man9/setsserial.9.adoc $lang:build/adoc/$lang/man/man9/setsserial.9.adoc diff --git a/docs/src/Master_Documentation.adoc b/docs/src/Master_Documentation.adoc index 993f6a318bc..ccb22a0d90c 100644 --- a/docs/src/Master_Documentation.adoc +++ b/docs/src/Master_Documentation.adoc @@ -123,7 +123,6 @@ include::hal/canonical-devices.adoc[] :leveloffset: 2 include::hal/parallel-port.adoc[] -include::drivers/ax5214h.adoc[] include::drivers/gm.adoc[] @@ -141,17 +140,13 @@ include::drivers/mesa_modbus.adoc[] include::drivers/mitsub-vfd.adoc[] -include::drivers/motenc.adoc[] -include::drivers/opto22.adoc[] include::drivers/pico-ppmc.adoc[] -include::drivers/pluto-p.adoc[] include::drivers/pmx485.adoc[] -include::drivers/servo-to-go.adoc[] include::drivers/shuttle.adoc[] diff --git a/docs/src/Submakefile b/docs/src/Submakefile index b585ee4574b..4de5d811f00 100644 --- a/docs/src/Submakefile +++ b/docs/src/Submakefile @@ -160,7 +160,6 @@ DOC_SRCS_EN := \ config/stepper-diagnostics.adoc \ config/stepper.adoc \ config/stepper-quickstart.adoc \ - drivers/ax5214h.adoc \ drivers/vfs11.adoc \ drivers/mitsub-vfd.adoc \ drivers/gm.adoc \ @@ -170,12 +169,8 @@ DOC_SRCS_EN := \ drivers/hostmot2.adoc \ drivers/mb2hal.adoc \ drivers/mesa_modbus.adoc \ - drivers/motenc.adoc \ - drivers/opto22.adoc \ drivers/pico-ppmc.adoc \ - drivers/pluto-p.adoc \ drivers/pmx485.adoc \ - drivers/servo-to-go.adoc \ drivers/shuttle.adoc \ examples/gcode.adoc \ examples/gs2-example.adoc \ @@ -495,9 +490,12 @@ docs: manpages clean: clean-manpages clean-translated -rm -f $(DOC_DIR)/html clean-manpages: - -rm -f $(GENERATED_MANPAGES) - # Remove generated alias man pages too. - $(RM) $$(grep -lr '^\.so ' $(DOC_MAN)/man*) + # Everything under $(DOC_MAN) is generated (halcompile output, + # asciidoctor output from docs/src/man, alias pages, translations). + # GENERATED_MANPAGES depends on BUILD_SYS, so removing by list leaves + # stale files behind (e.g. kbuild-only driver manpages on a uspace + # tree), which later confuse gen_complist.py. Wipe the whole tree. + -$(RM) -r $(DOC_MAN) clean-translated: -$(RM) -r $(GENERATED_TRANSLATED) diff --git a/docs/src/docs.xml b/docs/src/docs.xml index 02739f355c1..9298f3a2ed7 100644 --- a/docs/src/docs.xml +++ b/docs/src/docs.xml @@ -53,14 +53,9 @@ - - - - - diff --git a/docs/src/drivers/ax5214h.adoc b/docs/src/drivers/ax5214h.adoc deleted file mode 100644 index d1365899503..00000000000 --- a/docs/src/drivers/ax5214h.adoc +++ /dev/null @@ -1,69 +0,0 @@ -:lang: en -:toc: - -[[cha:ax5214-driver]] -= AX5214H Driver - -The Axiom Measurement & Control AX5214H is a 48 channel digital I/O -board. It plugs into an ISA bus, and resembles a pair of 8255 chips. In -fact it may be a pair of 8255 chips, but I'm not sure. If/when someone -starts a driver for an 8255 they should look at the ax5214 code, much -of the work is already done. - -== Installing - -[source,hal] ----- -loadrt hal_ax5214h cfg="" ----- - -The config string consists of a hex port address, followed by an 8 -character string of "I" and "O" which sets groups of pins as inputs and -outputs. The first two character set the direction of the first two 8 -bit blocks of pins (0-7 and 8-15). The next two set blocks of 4 pins -(16-19 and 20-23). The pattern then repeats, two more blocks of 8 bits -(24-31 and 32-39) and two blocks of 4 bits (40-43 and 44-47). If more -than one board is installed, the data for the second board follows the -first. As an example, the string '"0x220 IIIOIIOO 0x300 OIOOIOIO"' -installs drivers for two boards. The first board is at address 0x220, -and has 36 inputs (0-19 and 24-39) and 12 outputs (20-23 and 40-47). -The second board is at address 0x300, and has 20 inputs (8-15, 24-31, -and 40-43) and 28 outputs (0-7. 16-23, 32-39, and 44-47). Up to 8 -boards may be used in one system. - -== Pins - -* '(bit) ax5214..out-' -- Drives a physical output pin. -* '(bit) ax5214..in-' -- Tracks a physical input pin. -* '(bit) ax5214..in--not' -- Tracks a physical input pin, inverted. - -For each pin, is the board number (starts at zero), and - is the I/O channel number (0 to 47). - -Note that the driver assumes active LOW signals. This is so that -modules such as OPTO-22 will work correctly (TRUE means output ON, or -input energized). If the signals are being used directly without -buffering or isolation the inversion needs to be accounted for. The in- -HAL pin is TRUE if the physical pin is low (OPTO-22 module energized), -and FALSE if the physical pin is high (OPTO-22 module off). The -in--not HAL pin is inverted -- it is FALSE if the physical pin -is low (OPTO-22 module energized). By connecting a signal to one or the -other, the user can determine the state of the input. - -== Parameters - -* '(bit) ax5214..out--invert' -- Inverts an output pin. - -The -invert parameter determines whether an output pin is active high -or active low. If -invert is FALSE, setting the HAL out- pin TRUE -drives the physical pin low, turning ON an attached OPTO-22 module, and -FALSE drives it high, turning OFF the OPTO-22 module. If -invert is -TRUE, then setting the HAL out- pin TRUE will drive the physical pin -high and turn the module OFF. - -== Functions - -* '(funct) ax5214..read' -- Reads all digital inputs on one board. -* '(funct) ax5214..write' -- Writes all digital outputs on one board. - -// vim: set syntax=asciidoc: diff --git a/docs/src/drivers/motenc.adoc b/docs/src/drivers/motenc.adoc deleted file mode 100644 index fee21dac40c..00000000000 --- a/docs/src/drivers/motenc.adoc +++ /dev/null @@ -1,117 +0,0 @@ -:lang: en -:toc: - -[[cha:motenc]] -= Motenc Driver - -Vital Systems Motenc-100 and Motenc-LITE - -The Vital Systems Motenc-100 and Motenc-LITE are 8- and 4-channel -servo control boards. The Motenc-100 provides 8 quadrature encoder -counters, 8 analog inputs, 8 analog outputs, 64 (68?) digital inputs, -and 32 digital outputs. The Motenc-LITE has only 4 encoder counters, 32 -digital inputs and 16 digital outputs, but it still has 8 analog inputs -and 8 analog outputs. The driver automatically identifies the installed -board and exports the appropriate HAL objects. - -Installing: - -[source,hal] ----- -loadrt hal_motenc ----- - -During loading (or attempted loading) the driver prints some useful -debugging messages to the kernel log, which can be viewed with dmesg. - -Up to 4 boards may be used in one system. - -== Pins - -In the following pins, parameters, and functions, is the board -ID. According to the naming conventions the first board should always -have an ID of zero. However this driver sets the ID based on a pair of -jumpers on the board, so it may be non-zero even if there is only one -board. - -* '(s32) motenc..enc--count' - Encoder position, in - counts. -* '(float) motenc..enc--position' - Encoder position, in - user units. -* '(bit) motenc..enc--index' - Current status of index - pulse input. -* '(bit) motenc..enc--idx-latch' - Driver sets this pin - true when it latches an index pulse (enabled by latch-index). Cleared - by clearing latch-index. -* '(bit) motenc..enc--latch-index' - If this pin is true, - the driver will reset the counter on the next index pulse. -* '(bit) motenc..enc--reset-count' - If this pin is true, - the counter will immediately be reset to zero, and the pin will be - cleared. -* '(float) motenc..dac--value' - Analog output value for - DAC (in user units, see -gain and -offset) -* '(float) motenc..adc--value' - Analog input value read - by ADC (in user units, see -gain and -offset) -* '(bit) motenc..in-' - State of digital input pin, see - canonical digital input. -* '(bit) motenc..in--not' - Inverted state of digital - input pin, see canonical digital input. -* '(bit) motenc..out-' - Value to be written to digital - output, seen canonical digital output. -* '(bit) motenc..estop-in' - Dedicated estop input, more details - needed. -* '(bit) motenc..estop-in-not' - Inverted state of dedicated - estop input. -* '(bit) motenc..watchdog-reset' - Bidirectional, - Set TRUE to - reset watchdog once, is automatically cleared. - -== Parameters - -* '(float) motenc..enc--scale' - - The number of counts / user unit (to convert from counts to units). -* '(float) motenc..dac--offset' - - Sets the DAC offset. -* '(float) motenc..dac--gain' - - Sets the DAC gain (scaling). -* '(float) motenc..adc--offset' - - Sets the ADC offset. -* '(float) motenc..adc--gain' - - Sets the ADC gain (scaling). -* '(bit) motenc..out--invert' - - Inverts a digital output, see canonical digital output. -* '(u32) motenc..watchdog-control' - - Configures the watchdog. + - The value may be a bitwise OR of the following values: -+ -[width="90%",options="header",cols="2*^1,^6"] -|=== -|Bit # | Value | Meaning -|0 | 1 | Timeout is 16ms if set, 8ms if unset -|1 | 2 | -|2 | 4 | Watchdog is enabled -|3 | 8 | -|4 | 16 | Watchdog is automatically reset by DAC writes (the HAL dac-write function) -|=== - -Typically, the useful values are 0 (watchdog disabled) or 20 (8ms -watchdog enabled, cleared by dac-write). - -* '(u32) motenc..led-view' - - Maps some of the I/O to onboard LEDs. - -== Functions - -* '(funct) motenc..encoder-read' - - Reads all encoder counters. -* '(funct) motenc..adc-read' - - Reads the analog-to-digital converters. -* '(funct) motenc..digital-in-read' - - Reads digital inputs. -* '(funct) motenc..dac-write' - - Writes the voltages to the DACs. -* '(funct) motenc..digital-out-write' - - Writes digital outputs. -* '(funct) motenc..misc-update' - - Updates misc stuff. - -// vim: set syntax=asciidoc: diff --git a/docs/src/drivers/opto22.adoc b/docs/src/drivers/opto22.adoc deleted file mode 100644 index e6c18d4e1a8..00000000000 --- a/docs/src/drivers/opto22.adoc +++ /dev/null @@ -1,164 +0,0 @@ -:lang: en -:toc: - -[[cha:opto22]] -= Opto22 Driver - -*PCI AC5 ADAPTER CARD / HAL DRIVER* - -== The Adapter Card - -This is a card made by Opto22 for adapting the PCI port to solid state -relay racks such as their standard or G4 series. It has 2 ports that -can control up to 24 points each and has 4 on board LEDs. The ports use -50 pin connectors the same as Mesa boards. Any relay racks/breakout -boards that work with Mesa Cards should work with this card with the -understanding any encoder counters, PWM, etc., would have to be done in -software. The AC5 does not have any 'smart' logic on board, it is just -an adapter. - -See the manufacturer's website for more info: - -https://www.opto22.com/site/pr_details.aspx?cid=4&item=PCI-AC5 - -I would like to thank Opto22 for releasing info in their manual, -easing the writing of this driver! - -== The Driver - -This driver is for the PCI AC5 card and will not work with the ISA AC5 -card. The HAL driver is a realtime module. It will support 4 cards as -is (more cards are possible with a change in the source code). Load the -basic driver like so: - -[source,hal] ----- -loadrt opto_ac5 ----- - -This will load the driver which will search for max 4 boards. It will -set I/O of each board's 2 ports to a default setting. The default -configuration is for 12 inputs then 12 outputs. The pin name numbers -correspond to the position on the relay rack. For example the pin names -for the default I/O setting of port 0 would be: - -* 'opto_ac5.0.port0.in-00' - - They would be numbered from 00 to 11 -* 'opto_ac5.0.port0.out-12' - - They would be numbered 12 to 23 port 1 would be the same. - -== Pins - - * 'opto_ac5.[BOARDNUMBER].port[PORTNUMBER].in-[PINNUMBER] OUT bit' - - - * 'opto_ac5.[BOARDNUMBER].port[PORTNUMBER].in-[PINNUMBER]-not OUT bit' - - Connect a HAL bit signal to this pin to read an I/O point from the - card. The PINNUMBER represents the position in the relay rack. Eg. - PINNUMBER 0 is position 0 in a Opto22 relay rack and would be pin 47 - on the 50 pin header connector. The -not pin is inverted so that LOW - gives TRUE and HIGH gives FALSE. - - * 'opto_ac5.[BOARDNUMBER].port[PORTNUMBER].out-[PINNUMBER] IN bit' - - Connect a HAL bit signal to this pin to write to an I/O point of the - card. The PINNUMBER represents the position in the relay rack.Eg. - PINNUMBER 23 is position 23 in a Opto22 relay rack and would be pin 1 - on the 50 pin header connector. - - * 'opto_ac5.[BOARDNUMBER].led[NUMBER] OUT bit' - - Turns one of the 4 onboard LEDs on/off. LEDs are numbered 0 to 3. - -BOARDNUMBER can be 0-3 PORTNUMBER can be 0 or 1. Port 0 is closest to -the card bracket. - -== Parameters - -* 'opto_ac5.[BOARDNUMBER].port[PORTNUMBER].out-[PINNUMBER]-invert W bit' - - When TRUE, invert the meaning of the corresponding -out pin so that - TRUE gives LOW and FALSE gives HIGH. - -== FUNCTIONS - -* 'opto_ac5.0.digital-read' - - Add this to a thread to read all the input points. - -* 'opto_ac5.0.digital-write' - - Add this to a thread to write all the output points and LEDs. - -For example the pin names for the default I/O setting of port 0 would -be: - ----- -opto_ac5.0.port0.in-00 ----- - -They would be numbered from 00 to 11 - ----- -opto_ac5.0.port0.out-12 ----- - -They would be numbered 12 to 23 port 1 would be the same. - -== Configuring I/O Ports - -To change the default setting load the driver something like so: - -[source,hal] ----- -loadrt opto_ac5 portconfig0=0xffff portconfig1=0xff0000 ----- - -Of course changing the numbers to match the I/O you would like. Each -port can be set up different. - -Here's how to figure out the number: The configuration number -represents a 32 bit long code to tell the card which I/O points are -output vrs input. The lower 24 bits are the I/O points of one port. The -2 highest bits are for 2 of the on board LEDs. A one in any bit -position makes the I/O point an output. The two highest bits must be -output for the LEDs to work. The driver will automatically set the two -highest bits for you, we won't talk about them. - -The easiest way to do this is to fire up the calculator under -APPLICATIONS/ACCESSORIES. Set it to scientific (click view). Set it -BINARY (radio button Bin). Press 1 for every output you want and/or -zero for every input. Remember that HAL pin 00 corresponds to the -rightmost bit. 24 numbers represent the 24 I/O points of one port. So -for the default setting (12 inputs then 12 outputs) you would push 1 -twelve times (that's the outputs) then 0 twelve times (that's the -inputs). Notice the first I/O point is the lowest (rightmost) bit. -(that bit corresponds to HAL pin 00 .looks backwards) You should have -24 digits on the screen. Now push the Hex radio button. The displayed -number (fff000) is the configport number ( put a '0x' in front of it -designating it as a HEX number). - -Another example: To set the port for 8 outputs and 16 inputs (the -same as a Mesa card). Here is the 24 bits represented in a BINARY -number. Bit 1 is the rightmost number: - -.16 zeros for the 16 inputs and 8 ones for the 8 outputs ----- -000000000000000011111111 ----- - -This converts to FF on the calculator, so 0xff is the number to use -for portconfig0 and/or portconfig1 when loading the driver. - -== Pin Numbering - -HAL pin 00 corresponds to bit 1 (the rightmost) which represents -position 0 on an Opto22 relay rack. HAL pin 01 corresponds to bit 2 -(one spot to the left of the rightmost) which represents position 1 on -an Opto22 relay rack. HAL pin 23 corresponds to bit 24 (the -leftmost) which represents position 23 on an Opto22 relay rack. - -HAL pin 00 connects to pin 47 on the 50 pin connector of each port. -HAL pin 01 connects to pin 45 on the 50 pin connector of each port. -HAL pin 23 connects to pin 1 on the 50 pin connector of each port. - -Note that Opto22 and Mesa use opposite numbering systems: Opto22 -position 23 = connector pin 1, and the position goes down as the -connector pin number goes up. Mesa Hostmot2 position 1 = connector pin -1, and the position number goes up as the connector pin number goes up. - -// vim: set syntax=asciidoc: diff --git a/docs/src/drivers/pluto-p.adoc b/docs/src/drivers/pluto-p.adoc deleted file mode 100644 index f98605368d4..00000000000 --- a/docs/src/drivers/pluto-p.adoc +++ /dev/null @@ -1,281 +0,0 @@ -:lang: en -:toc: - -[[cha:pluto-p-driver]] -= Pluto P Driver - -== General Info - -The Pluto-P is a FPGA board featuring the ACEX1K chip from Altera. - -=== Requirements - -. A Pluto-P board -. An EPP-compatible parallel port, configured for EPP mode in the system - BIOS or a PCI EPP compatible parallel port card. - -[NOTE] -The Pluto P board requires EPP mode. Netmos98xx chips do not work in EPP -mode. -The Pluto P board will work on some computers and not on others. -There is no known pattern to which computers work and which don't work. - -For more information on PCI EPP compatible parallel port cards see the -https://wiki.linuxcnc.org/cgi-bin/wiki.pl?LinuxCNC_Supported_Hardware[LinuxCNC Supported Hardware] page on the wiki. - -=== Connectors - -* The Pluto-P board is shipped with the left connector presoldered, with - the key in the indicated position. The other connectors are - unpopulated. There does not seem to be a standard 12-pin IDC connector, - but some of the pins of a 16P connector can hang off the board next to - QA3/QZ3. -* The bottom and right connectors are on the same .1" grid, but the left - connector is not. If OUT2…OUT9 are not required, a single IDC connector - can span the bottom connector and the bottom two rows of the right - connector. - -=== Physical Pins - -* Read the ACEX1K datasheet for information about input and output - voltage thresholds. The pins are all configured in 'LVTTL/LVCMOS' mode - and are generally compatible with 5V TTL logic. -* Before configuration and after properly exiting LinuxCNC, all Pluto-P - pins are tristated with weak pull-ups (20 kΩ min, 50 kΩ max). - If the watchdog timer is enabled (the default), - these pins are also tristated after an interruption of communication - between LinuxCNC and the board. The watchdog timer takes approximately - 6.5 ms to activate. However, software bugs in the pluto_servo firmware - or LinuxCNC can leave the Pluto-P pins in an undefined state. -* In pwm+dir mode, by default dir is HIGH for negative values and LOW - for positive values. To select HIGH for positive values and LOW for - negative values, set the corresponding dout-NN-invert parameter TRUE - to invert the signal. -* The index input is triggered on the rising edge. Initial testing has - shown that the QZx inputs are particularly noise sensitive, due to - being polled every 25 ns. Digital filtering has been added to filter - pulses shorter than 175 ns (seven polling times). Additional external - filtering on all input pins, such as a Schmitt buffer or inverter, RC - filter, or differential receiver (if applicable) is recommended. -* The IN1…IN7 pins have 22 Ω series resistors to their associated FPGA - pins. No other pins have any sort of protection for out-of-spec - voltages or currents. It is up to the integrator to add appropriate - isolation and protection. Traditional parallel port optoisolator - boards do not work with pluto_servo due to the bidirectional nature of - the EPP protocol. - -=== LED - -* When the device is unprogrammed, the LED glows faintly. When the - device is programmed, the LED glows according to the duty cycle of - PWM0 ('LED' = 'UP0' 'xor' 'DOWN0') or - STEPGEN0 ('LED' = 'STEP0' 'xor' 'DIR0'). - -=== Power - -* A small amount of current may be drawn from VCC. The available current - depends on the unregulated DC input to the board. Alternately, - regulated +3.3VDC may be supplied to the FPGA through these VCC pins. - The required current is not yet known, but is probably around 50mA plus - I/O current. -* The regulator on the Pluto-P board is a low-dropout type. Supplying 5V - at the power jack will allow the regulator to work properly. - -=== PC interface - -* Only a single pluto_servo or pluto_step board is supported. - -=== Rebuilding the FPGA firmware - -The 'src/hal/drivers/pluto_servo_firmware/' and -'src/hal/drivers/pluto_step_firmware/' subdirectories contain the -Verilog source code plus additional files -used by Quartus for the FPGA firmwares. Altera's Quartus II software is -required to rebuild the FPGA firmware. To rebuild the firmware from -the .hdl and other source files, open the '.qpf' file and press CTRL-L. -Then, recompile LinuxCNC. - -Like the HAL hardware driver, the FPGA firmware is licensed under the -terms of the GNU General Public License. - -The gratis version of Quartus II runs only on Microsoft Windows, -although there is apparently a paid version that runs on Linux. - -=== For more information - -Some additional information about it is available from -https://www.knjn.com/FPGA-Parallel.html[KNJC LLC] -and from http://emergent.unpy.net/01165081407[the developer's blog]. - -== Pluto Servo - -The pluto_servo system is suitable for control of a 4-axis CNC mill -with servo motors, a 3-axis mill with PWM spindle control, a lathe with -spindle encoder, etc. The large number of inputs allows a full set of -limit switches. - -This driver features: - -* 4 quadrature channels with 40 MHz sample rate. The counters operate in - '4x' mode. The maximum useful quadrature rate is 8191 counts per - LinuxCNC servo cycle, or about 8 MHz for LinuxCNC's default 1 ms servo - rate. -* 4 PWM channels, 'up/down' or 'pwm+dir' style. 4095 duty cycles from - -100% to +100%, including 0%. The PWM period is approximately 19.5 kHz - (40 MHz / 2047). A PDM-like mode is also available. -* 18 digital outputs: 10 dedicated, 8 shared with PWM functions. - (Example: A lathe with unidirectional PWM spindle control may use 13 - total digital outputs) -* 20 digital inputs: 8 dedicated, 12 shared with Quadrature functions. - (Example: A lathe with index pulse only on the spindle may use 13 - total digital inputs.) -* EPP communication with the PC. The EPP communication typically takes - around 100 µs on machines tested so far, enabling servo rates above - 1 kHz. - -=== Pinout - -* 'UPx' - The 'up' (up/down mode) or 'pwm' (pwm+direction mode) signal - from PWM generator X. May be used as a digital output if the - corresponding PWM channel is unused, or the output on the channel is - always negative. The corresponding digital output invert may be set to - TRUE to make UPx active low rather than active high. -* 'DNx' - The 'down' (up/down mode) or 'direction' (pwm+direction mode) - signal from PWM generator X. May be used as a digital output if the - corresponding PWM channel is unused, or the output on the channel is - never negative. The corresponding digital output invert may be set to - TRUE to make DNx active low rather than active high. -* 'QAx, QBx' - The A and B signals for Quadrature counter X. May be used - as a digital input if the corresponding quadrature channel is unused. -* 'QZx' - The Z (index) signal for quadrature counter X. May be used as - a digital input if the index feature of the corresponding quadrature - channel is unused. -* 'INx' - Dedicated digital input #x -* 'OUTx' - Dedicated digital output #x -* 'GND' - Ground -* 'VCC' - +3.3V regulated DC - -(((pluto-servo pinout))) - -.Pluto-Servo Pinout -image::images/pluto-pinout.png["Pluto-Servo Pinout",align="center"] - -.Pluto-Servo Alternate Pin Functions -[width="90%",options="header"] -|=== -|Primary function |Alternate Function |Behavior if both functions used -s|UP0 | PWM0 | When pwm-0-pwmdir is TRUE, this pin is the PWM output -s| | OUT10 | XOR'd with UP0 or PWM0 -s|UP1 | PWM1 | When pwm-1-pwmdir is TRUE, this pin is the PWM output -s| | OUT12 | XOR'd with UP1 or PWM1 -s|UP2 | PWM2 | When pwm-2-pwmdir is TRUE, this pin is the PWM output -s| | OUT14 | XOR'd with UP2 or PWM2 -s|UP3 | PWM3 | When pwm-3-pwmdir is TRUE, this pin is the PWM output -s| | OUT16 | XOR'd with UP3 or PWM3 -s|DN0 | DIR0 | When pwm-0-pwmdir is TRUE, this pin is the DIR output -s| | OUT11 | XOR'd with DN0 or DIR0 -s|DN1 | DIR1 | When pwm-1-pwmdir is TRUE, this pin is the DIR output -s| | OUT13 | XOR'd with DN1 or DIR1 -s|DN2 | DIR2 | When pwm-2-pwmdir is TRUE, this pin is the DIR output -s| | OUT15 | XOR'd with DN2 or DIR2 -s|DN3 | DIR3 | When pwm-3-pwmdir is TRUE, this pin is the DIR output -s| | OUT17 | XOR'd with DN3 or DIR3 -s|QZ0 | IN8 | Read same value -s|QZ1 | IN9 | Read same value -s|QZ2 | IN10 | Read same value -s|QZ3 | IN11 | Read same value -s|QA0 | IN12 | Read same value -s|QA1 | IN13 | Read same value -s|QA2 | IN14 | Read same value -s|QA3 | IN15 | Read same value -s|QB0 | IN16 | Read same value -s|QB1 | IN17 | Read same value -s|QB2 | IN18 | Read same value -s|QB3 | IN19 | Read same value -|=== - -=== Input latching and output updating - -* PWM duty cycles for each channel are updated at different times. -* Digital outputs OUT0 through OUT9 are all updated at the same time. - Digital outputs OUT10 through OUT17 are updated at the same time as - the pwm function they are shared with. -* Digital inputs IN0 through IN19 are all latched at the same time. -* Quadrature positions for each channel are latched at different times. - -=== HAL Functions, Pins and Parameters - -A list of all 'loadrt' arguments, HAL function names, pin names and -parameter names is in the manual page, 'pluto_servo.9'. - -=== Compatible driver hardware - -A schematic for a 2A, 2-axis PWM servo amplifier board is available from the -(http://emergent.unpy.net/projects/01148303608[the software developer]). -The L298 H-Bridge can be used for motors up to 4A (one motor per -L298) or up to 2A (two motors per L298) with the supply voltage up to -46V. However, the L298 does not have built-in current limiting, a -problem for motors with high stall currents. For higher currents and -voltages, some users have reported success with International -Rectifier's integrated high-side/low-side drivers. - -[[sec:Pluto-step:-Hardware-step]] -== Pluto Step - -(((pluto-step))) -Pluto-step is suitable for control of a 3- or 4-axis CNC mill with -stepper motors. The large number of inputs allows for a full set of -limit switches. - -The board features: - -* 4 'step+direction' channels with 312.5 kHz maximum step rate, - programmable step length, space, and direction change times -* 14 dedicated digital outputs -* 16 dedicated digital inputs -* EPP communication with the PC - -=== Pinout - -* 'STEPx' - The 'step' (clock) output of stepgen channel 'x' -* 'DIRx' - The 'direction' output of stepgen channel 'x' -* 'INx' - Dedicated digital input #x -* 'OUTx' - Dedicated digital output #x -* 'GND' - Ground -* 'VCC' - +3.3V regulated DC - -While the 'extended main connector' has a superset of signals usually -found on a Step & Direction DB25 connector--4 step generators, 9 -inputs, and 6 general-purpose outputs--the layout on this header is -different than the layout of a standard 26-pin ribbon cable to DB25 -connector. - -.Pluto-Step Pinout (((pluto-step pinout))) -image::images/pluto-step-pinout.png["Pluto-Step Pinout",align="center"] - -=== Input latching and output updating - -* Step frequencies for each channel are updated at different times. -* Digital outputs are all updated at the same time. -* Digital inputs are all latched at the same time. -* Feedback positions for each channel are latched at different times. - -=== Step Waveform Timings - -The firmware and driver enforce step length, space, and direction -change times. Timings are rounded up to the next multiple of -1.6μs, with a maximum of 49.6μs. The timings -are the same as for the software stepgen component, except that -'dirhold' and 'dirsetup' have been merged into a single parameter -'dirtime' which should be the maximum of the two, and that the same -step timings are always applied to all channels. - -.Pluto-Step Timings (((pluto-step timings))) -image::images/pluto_step_waveform.png["Pluto-Step Timings",align="center"] - -=== HAL Functions, Pins and Parameters - -A list of all 'loadrt' arguments, HAL function names, pin names and -parameter names is in the manual page, 'pluto_step.9'. - -// vim: set syntax=asciidoc: diff --git a/docs/src/drivers/servo-to-go.adoc b/docs/src/drivers/servo-to-go.adoc deleted file mode 100644 index 205a8ced029..00000000000 --- a/docs/src/drivers/servo-to-go.adoc +++ /dev/null @@ -1,121 +0,0 @@ -:lang: en -:toc: - -[[cha:servo-to-go]] -= Servo To Go Driver - -The Servo-To-Go (STG) is one of the first PC motion control cards supported -by LinuxCNC. It is an ISA card and it exists in different flavors (all -supported by this driver). The board includes up to 8 channels of -quadrature encoder input, 8 channels of analog input and output, 32 -bits digital I/O, an interval timer with interrupt and a watchdog. - -NOTE: We have had reports that the opamps on the Servo To Go card do -not work with newer ATX power supplies that use modern switch -mode DC-DC converters. The failure mode is that STG card outputs a -constant voltage regardless of what the driver is commanding it to do. -Older ATX power supplies with linear voltage regulators do not have -this problem, and work fine with the STG cards. - -== Installing - -[source,hal] ----- -loadrt hal_stg [base=
] [num_chan=] [dio=""] \ - [model=] ----- - -The base address field is optional; if it's not provided the driver -attempts to autodetect the board. The num_chan field is used to specify -the number of channels available on the card, if not used the 8 axis -version is assumed. The digital inputs/outputs configuration is -determined by a config string passed to insmod when loading the module. -The format consists of a four character string that sets the direction -of each group of pins. Each character of the direction string is either -"I" or "O". The first character sets the direction of port A (Port A - -DIO.0-7), the next sets port B (Port B - DIO.8-15), the next sets port -C (Port C - DIO.16-23), and the fourth sets port D (Port D - -DIO.24-31). The model field can be used in case the driver doesn't -autodetect the right card version. - -HINT: after starting up the driver, 'dmesg' can be consulted for -messages relevant to the driver (e.g. autodetected version number and -base address). For example: - -[source,hal] ----- -loadrt hal_stg base=0x300 num_chan=4 dio="IOIO" ----- - -This example installs the STG driver for a card found at the base -address of 0x300, 4 channels of encoder feedback, DACs and ADCs, -along with 32 bits of I/O configured like this: the first 8 (Port A) -configured as Input, the next 8 (Port B) configured as Output, the next -8 (Port C) configured as Input, and the last 8 (Port D) configured as -Output - -[source,hal] ----- -loadrt hal_stg ----- - -This example installs the driver and attempts to autodetect the board -address and board model, it installs 8 axes by default along with a -standard I/O setup: Port A & B configured as Input, Port C & D -configured as Output. - -== Pins - -* 'stg..counts' - (s32) Tracks the counted encoder ticks. -* 'stg..position' - (float) Outputs a converted position. -* 'stg..dac-value' - (float) Drives the voltage for the - corresponding DAC. -* 'stg..adc-value' - (float) Tracks the measured voltage from - the corresponding ADC. -* 'stg.in-' - (bit) Tracks a physical input pin. -* 'stg.in--not' - (bit) Tracks a physical input pin, but - inverted. -* 'stg.out-' - (bit) Drives a physical output pin - -For each pin, is the axis number, and is the logic -pin number of the STG if `IIOO` is defined, there are 16 input pins -(in-00 .. in-15) and 16 output pins (out-00 .. out-15), and they -correspond to PORTs ABCD (in-00 is PORTA.0, out-15 is PORTD.7). - -The in- HAL pin is TRUE if the physical pin is high, and FALSE -if the physical pin is low. The in--not HAL pin is inverted -- -it is FALSE if the physical pin is high. By connecting a signal to one -or the other, the user can determine the state of the input. - -== Parameters - -* 'stg..position-scale' - (float) The number of counts / user - unit (to convert from counts to units). -* 'stg..dac-offset' - (float) Sets the offset for the - corresponding DAC. -* 'stg..dac-gain' - (float) Sets the gain of the corresponding - DAC. -* 'stg..adc-offset' - (float) Sets the offset of the - corresponding ADC. -* 'stg..adc-gain' - (float) Sets the gain of the corresponding - ADC. -* 'stg.out--invert' - (bit) Inverts an output pin. - -The -invert parameter determines whether an output pin is active high -or active low. If -invert is FALSE, setting the HAL out- pin TRUE -drives the physical pin high, and FALSE drives it low. If -invert is -TRUE, then setting the HAL out- pin TRUE will drive the physical pin -low. - -== Functions - -* 'stg.capture-position' - Reads the encoder counters from the axis - . -* 'stg.write-dacs' - Writes the voltages to the DACs. -* 'stg.read-adcs' - Reads the voltages from the ADCs. -* 'stg.di-read' - Reads physical in- pins of all ports and updates - all HAL in- and in--not pins. -* 'stg.do-write' - Reads all HAL out- pins and updates all - physical output pins. - -// vim: set syntax=asciidoc: diff --git a/docs/src/getting-started/running-linuxcnc.adoc b/docs/src/getting-started/running-linuxcnc.adoc index e2ef13026e7..6bd984a3325 100644 --- a/docs/src/getting-started/running-linuxcnc.adoc +++ b/docs/src/getting-started/running-linuxcnc.adoc @@ -66,10 +66,6 @@ interfaces like: * mesa * parport * pico -* pluto -* servotogo -* vigilant -* vitalsystems Related hardware may be required to use these configurations as starting points for a system. diff --git a/docs/src/hal/components.adoc b/docs/src/hal/components.adoc index 8e04a648a93..333c6b4e418 100644 --- a/docs/src/hal/components.adoc +++ b/docs/src/hal/components.adoc @@ -127,9 +127,6 @@ To search in the man pages, use the UNIX tool `apropos`. | link:../man/man9/mesa_7i65.9.html[mesa_7i65] |Mesa Electronics driver for the 7I65 eight-axis servo card. (See the man page for more information) || | link:../man/man9/mesa_pktgyro_test.9.html[mesa_pktgyro_test] |PktUART simple test with Microstrain 3DM-GX3-15 gyro || | link:../man/man9/mesa_uart.9.html[mesa_uart] |An example component demonstrating how to access the Hostmot2 UART || -| link:../man/man9/opto_ac5.9.html[opto_ac5] |Realtime driver for opto22 PCI-AC5 cards || -| pluto_servo |Pluto-P <> and firmware for the parallel port FPGA, for servos || -| pluto_step |Pluto-P <> for the parallel port FPGA, for steppers || | link:../man/man9/serport.9.html[serport] |Hardware driver for the digital I/O bits of the 8250 and 16550 serial port || | link:../man/man9/setsserial.9.html[setsserial] |An utility for setting Smart Serial NVRAM parameters || | link:../man/man9/sserial.9.html[sserial] |hostmot2 - Smart Serial LinuxCNC HAL driver for the Mesa Electronics HostMot2 Smart-Serial remote cards || diff --git a/docs/src/index.tmpl b/docs/src/index.tmpl index d82c576d947..c409b4125f4 100644 --- a/docs/src/index.tmpl +++ b/docs/src/index.tmpl @@ -107,7 +107,6 @@
diff --git a/docs/src/man/man9/opto_ac5.9.adoc b/docs/src/man/man9/opto_ac5.9.adoc deleted file mode 100644 index 0461756caf2..00000000000 --- a/docs/src/man/man9/opto_ac5.9.adoc +++ /dev/null @@ -1,73 +0,0 @@ -= opto_ac5(9) - -== NAME - -opto_ac5 - Realtime driver for opto22 PCI-AC5 cards - -== SYNOPSIS - -*loadrt opto_ac5* [**portconfig0=0x**_N_] [**portconfig1=0x**_N_] - -== DESCRIPTION - -These pins and parameters are created by the realtime *opto_ac5* module. -The portconfig0 and portconfig1 variables are used to configure the two -ports of each card. The first 24 bits of a 32 bit number represent the -24 i/o points of each port. The lowest (rightmost) bit would be HAL pin -0 which is header connector pin 47. Then next bit to the left would be -HAL pin 1, header connector pin 45 and so on, until bit 24 would be HAL -pin 23, header connector pin 1. "1" bits represent output points. So -channel 0..11 as inputs and 12..23 as outputs would be represented by -(in binary) 111111111111000000000000 which is 0xfff000 in hexadecimal. -That is the number you would use, e.g. - -[source,hal] ----- -loadrt opto_ac5 portconfig0=0xfff000 ----- - -If no portconfig variable is specified the default configuration is 12 -inputs then 12 outputs. - -Up to 4 boards are supported. Boards are numbered starting at 0. - -Portnumber can be 0 or 1. Port 0 is closest to the card bracket. - -== PINS - -**opto_ac5.**_BOARDNUMBER_**.port.**_PORTNUMBER_**.in-**_PINNUMBER_ OUT bit:: - + - -**opto_ac5.**_BOARDNUMBER_**.port.**_PORTNUMBER_**.in-**_PINNUMBER_**-not** OUT bit:: - Connect a HAL bit signal to this pin to read an i/o point from the card. - The PINNUMBER represents the position in the relay rack. E.g., PINNUMBER 0 is - position 0 in a opto22 relay rack and would be pin 47 on the 50 pin header connector. - The *-not* pin is inverted so that LOW gives TRUE and HIGH gives FALSE. -**opto_ac5.**_BOARDNUMBER_**.port.**_PORTNUMBER_**.out-**_PINNUMBER_ IN bit:: - Connect a HAL bit signal to this pin to write to an i/o point of the - card. The PINNUMBER represents the position in the relay rack. E.g., - PINNUMBER 23 is position 23 in a opto22 relay rack and would be pin 1 - on the 50 pin header connector. -**opto_ac5.**_BOARDNUMBER_**.led.**_NUMBER_ OUT bit:: - Turns one of the on board LEDS on/off. LEDS are numbered 0 to 3. - -== PARAMETERS - -**opto_ac5.**_BOARDNUMBER_**.port.**_PORTNUMBER_**.out-**_PINNUMBER_**-invert** W bit:: - When TRUE, invert the meaning of the corresponding *-out* pin so that - TRUE gives LOW and FALSE gives HIGH. - -== FUNCTIONS - -*opto_ac5.0.digital-read*:: - Add this to a thread to read all the input points. -*opto_ac5.0.digital-write*:: - Add this to a thread to write all the output points and LEDS. - -== BUGS - -All boards are loaded with the same port configurations as the first board. - -== SEE ALSO - -https://wiki.linuxcnc.org/cgi-bin/wiki.pl?OptoPciAc5 diff --git a/src/Makefile b/src/Makefile index ce0192abd38..22973911e77 100644 --- a/src/Makefile +++ b/src/Makefile @@ -543,7 +543,7 @@ genclean: -rm -rf objects -rm -f $(TARGETS) -rm -f ../lib/*.so.[0-9]* - -rm -f $(GENERATED_MANPAGES) + -rm -rf ../docs/build/man -rm -f ../rtlib/*.$(MODULE_EXT) -rm -f hal/components/conv_*.comp @@ -987,26 +987,6 @@ ifeq ($(X86ARCH),true) obj-$(CONFIG_HAL_SPEAKER) += hal_speaker.o hal_speaker-objs := hal/drivers/hal_speaker.o $(MATHSTUB) endif -ifneq ($(BUILD_SYS),uspace) -obj-$(CONFIG_PCI_8255) += pci_8255.o -pci_8255-objs := hal/drivers/pci_8255.o -obj-$(CONFIG_HAL_TIRO) += hal_tiro.o -hal_tiro-objs := hal/drivers/hal_tiro.o $(MATHSTUB) -obj-$(CONFIG_HAL_STG) += hal_stg.o -hal_stg-objs := hal/drivers/hal_stg.o $(MATHSTUB) -obj-$(CONFIG_HAL_VTI) += hal_vti.o -hal_vti-objs := hal/drivers/hal_vti.o $(MATHSTUB) -obj-$(CONFIG_HAL_EVOREG) += hal_evoreg.o -hal_evoreg-objs := hal/drivers/hal_evoreg.o $(MATHSTUB) -obj-$(CONFIG_HAL_MOTENC) += hal_motenc.o -hal_motenc-objs := hal/drivers/hal_motenc.o $(MATHSTUB) -obj-$(CONFIG_HAL_AX521H) += hal_ax5214h.o -hal_ax5214h-objs := hal/drivers/hal_ax5214h.o $(MATHSTUB) -obj-$(CONFIG_HAL_SKELETON) += hal_skeleton.o -hal_skeleton-objs := hal/drivers/hal_skeleton.o $(MATHSTUB) -obj-$(CONFIG_OPTO_AC5) += opto_ac5.o -opto_ac5-objs := hal/drivers/opto_ac5.o $(MATHSTUB) -endif obj-$(CONFIG_HAL_GM) += hal_gm.o hal_gm-objs := hal/drivers/hal_gm.o $(MATHSTUB) obj-$(CONFIG_HAL_PPMC) += hal_ppmc.o @@ -1399,17 +1379,6 @@ endif ../rtlib/sampler$(MODULE_EXT): $(addprefix objects/rt,$(sampler-objs)) ../rtlib/hal_parport$(MODULE_EXT): $(addprefix objects/rt,$(hal_parport-objs)) #../rtlib/uparport$(MODULE_EXT): $(addprefix objects/rt,$(uparport-objs)) -ifneq ($(BUILD_SYS),uspace) -../rtlib/pci_8255$(MODULE_EXT): $(addprefix objects/rt,$(pci_8255-objs)) -../rtlib/hal_tiro$(MODULE_EXT): $(addprefix objects/rt,$(hal_tiro-objs)) -../rtlib/hal_stg$(MODULE_EXT): $(addprefix objects/rt,$(hal_stg-objs)) -../rtlib/hal_vti$(MODULE_EXT): $(addprefix objects/rt,$(hal_vti-objs)) -../rtlib/hal_evoreg$(MODULE_EXT): $(addprefix objects/rt,$(hal_evoreg-objs)) -../rtlib/hal_motenc$(MODULE_EXT): $(addprefix objects/rt,$(hal_motenc-objs)) -../rtlib/hal_ax5214h$(MODULE_EXT): $(addprefix objects/rt,$(hal_ax5214h-objs)) -../rtlib/hal_skeleton$(MODULE_EXT): $(addprefix objects/rt,$(hal_skeleton-objs)) -../rtlib/opto_ac5$(MODULE_EXT): $(addprefix objects/rt,$(opto_ac5-objs)) -endif ../rtlib/hal_ppmc$(MODULE_EXT): $(addprefix objects/rt,$(hal_ppmc-objs)) ifeq ($(X86ARCH),true) ../rtlib/hal_speaker$(MODULE_EXT): $(addprefix objects/rt,$(hal_speaker-objs)) diff --git a/src/Makefile.inc.in b/src/Makefile.inc.in index c0ab1ceb631..ffaaa804292 100644 --- a/src/Makefile.inc.in +++ b/src/Makefile.inc.in @@ -211,18 +211,9 @@ CONFIG_SAMPLER=m CONFIG_UPARPORT=m CONFIG_HAL_PARPORT=m CONFIG_PROBE_PARPORT=m -CONFIG_HAL_TIRO=m -CONFIG_HAL_EVOREG=m -CONFIG_HAL_MOTENC=m -CONFIG_HAL_SKELETON=m CONFIG_HAL_SPEAKER=m -CONFIG_HAL_STG=m -CONFIG_HAL_VTI=m -CONFIG_HAL_AX521H=m CONFIG_HAL_PPMC=m -CONFIG_PCI_8255=m CONFIG_HOSTMOT2=m -CONFIG_OPTO_AC5=m CONFIG_HAL_GM=m CONFIG_HAL_BB_GPIO=m CONFIG_HAL_PI_GPIO=m diff --git a/src/hal/drivers/Submakefile b/src/hal/drivers/Submakefile deleted file mode 100644 index b4ff16113ef..00000000000 --- a/src/hal/drivers/Submakefile +++ /dev/null @@ -1,41 +0,0 @@ -hal/drivers/pluto_servo_rbf.h: hal/drivers/pluto_servo_firmware/pluto_servo.rbf hal/drivers/rbf2h.py - $(PYTHON) hal/drivers/rbf2h.py -g \ - -c "This is a component of pluto_servo, a PWM servo driver and" \ - -c "quadrature counter for emc2" \ - -c "Copyright (C) 2006, 2007 Jeff Epler" \ - $< > $@ - -hal/drivers/pluto_step_rbf.h: hal/drivers/pluto_step_firmware/pluto_step.rbf hal/drivers/rbf2h.py - $(PYTHON) hal/drivers/rbf2h.py -g \ - -c "This is a component of pluto_step, a hardware step generator for emc2" \ - -c "Copyright (C) 2006, 2007 Jeff Epler" \ - $< > $@ - -clean: pluto_clean -pluto_clean: - rm -rf \ - pluto_servo_firmware/db \ - pluto_servo_firmware/pluto_servo.asm.rpt \ - pluto_servo_firmware/pluto_servo.done \ - pluto_servo_firmware/pluto_servo.fit.rpt \ - pluto_servo_firmware/pluto_servo.fit.summary \ - pluto_servo_firmware/pluto_servo.flow.rpt \ - pluto_servo_firmware/pluto_servo.map.rpt \ - pluto_servo_firmware/pluto_servo.map.summary \ - pluto_servo_firmware/pluto_servo.pin \ - pluto_servo_firmware/pluto_servo.pof \ - pluto_servo_firmware/pluto_servo.qws \ - pluto_servo_firmware/pluto_servo.rbf \ - pluto_servo_firmware/pluto_servo.sof \ - pluto_servo_firmware/pluto_servo.tan.rpt \ - pluto_servo_firmware/pluto_servo.tan.summary \ - pluto_servo_firmware/undo_redo.txt - -# The kernel's build system won't know how to rebuild generated files -# so modules must depend on them explicitly -ifneq ($(BUILD_SYS),uspace) -modules: \ - hal/drivers/pluto_servo_rbf.h \ - hal/drivers/pluto_step_rbf.h -endif - diff --git a/src/hal/drivers/hal_ax5214h.c b/src/hal/drivers/hal_ax5214h.c deleted file mode 100644 index 84dd3781d51..00000000000 --- a/src/hal/drivers/hal_ax5214h.c +++ /dev/null @@ -1,672 +0,0 @@ -/******************************************************************** -* Description: AX5214H.c -* This file, 'AX5214H.c', is a HAL component that -* provides a driver for the Axiom Measurement & Control -* AX5241H 48 channel digital I/O board. -* -* Author: John Kasunich -* License: GPL Version 2 -* -* Copyright (c) 2005 All rights reserved. -* -* Last change: -********************************************************************/ -/** This file, 'AX5214H.c', is a HAL component that provides a - driver for the Axiom Measurement & Control AX5241H 48 channel - digital I/O board. - - The configuration is determined by a config string passed to - insmod when loading the module. The format consists of a base - address, followed by a eight character string that sets the - direction of each group of pins, repeated for each card (if - more than one card is used). Each character of the direction - string is either "I" or "O". The first character sets the - direction of port A on channel 1 (Port 1A), the next sets - port B on channel 1 (port 1B), the next sets the low nibble - of port C on channel 1 (port 1CL), and the fourth sets the - high nibble of port C on channel 1 (port 1CH). The next four - characters do the same thing for channel 2 (ports 2A, 2B, - 2CL, and 2CH). - - example: insmod AX5214.o cfg="0x220 IIIOIIOO" - - The example above is for one card, with its base address - set to hex 220, and with 36 channels of input (Ports 1A, - 1B, 1CL, 2A, and 2B) and 12 channels of output (Ports 1CH, - 2CL, and 2CH). - - The driver creates HAL pins and parameters for each port pin - as follows: - Each physical output has a corresponding HAL pin, named - 'ax5214..out-', and a HAL parameter - 'ax5214..out--invert'. - Each physical input has two corresponding HAL pins, named - 'ax5214..in-' and - 'ax5214..in--not'. - - is the board number, starting from zero. - is the pin number, from 0 to 47. - - Note that the driver assumes active LOW signals. This - is so that modules such as OPTO-22 will work correctly - (TRUE means output ON, or input energized). If the - signals are being used directly without buffering or - isolation the inversion needs to be accounted for. - - The driver exports two HAL functions for each board, - 'ax5214..read' and 'ax5214..write'. - -*/ - -/** Copyright (C) 2005 John Kasunich - -*/ - -/** This program is free software; you can redistribute it and/or - modify it under the terms of version 2 of the GNU General - Public License as published by the Free Software Foundation. - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - THE AUTHORS OF THIS LIBRARY ACCEPT ABSOLUTELY NO LIABILITY FOR - ANY HARM OR LOSS RESULTING FROM ITS USE. IT IS _EXTREMELY_ UNWISE - TO RELY ON SOFTWARE ALONE FOR SAFETY. Any machinery capable of - harming persons must have provisions for completely removing power - from all motors, etc, before persons enter any danger area. All - machinery must be designed to comply with local and national safety - codes, and the authors of this software can not, and do not, take - any responsibility for such compliance. - - This code was written as part of the EMC HAL project. For more - information, go to www.linuxcnc.org. -*/ - -#include /* isspace() */ -#include /* RTAPI realtime OS API */ -#include /* RTAPI realtime module decls */ -#include /* HAL public API decls */ - -/* If FASTIO is defined, uses outb() and inb() from , - instead of rtapi_outb() and rtapi_inb() - the ones - are inlined, and save a microsecond or two (on my 233MHz box) -*/ -#define FASTIO - -#ifdef FASTIO -#define rtapi_inb inb -#define rtapi_outb outb -#include -#endif - -/* module information */ -MODULE_AUTHOR("John Kasunich"); -MODULE_DESCRIPTION("Axiom AX5214H Driver for HAL"); -MODULE_LICENSE("GPL"); -static char *cfg = ""; /* config string, default no boards */ -RTAPI_MP_STRING(cfg, "config string"); - -/*********************************************************************** -* STRUCTURES AND GLOBAL VARIABLES * -************************************************************************/ - -/* this structure contains the runtime data needed by the - driver for a single board -*/ - -typedef struct { - hal_bool_t data; /* basic pin for input or output */ - union { - hal_bool_t not; /* pin for inverted data (input only) */ - hal_bool_t invert; /* param for inversion (output only) */ - } io; -} io_pin_t; - - -typedef struct { - unsigned short base_addr; /* base I/O address (0x220, etc.) */ - unsigned char dir_bits; /* LSB is port 1A, MSB is port 2CH, */ - /* 1 means output, 0 means input */ - unsigned char port1config; /* config register value for port 1 */ - unsigned char port2config; /* config register value for port 1 */ - io_pin_t port_1A[8]; - io_pin_t port_1B[8]; - io_pin_t port_1CL[4]; - io_pin_t port_1CH[4]; - io_pin_t port_2A[8]; - io_pin_t port_2B[8]; - io_pin_t port_2CL[4]; - io_pin_t port_2CH[4]; -} board_t; - -/* pointer to array of board_t structs in shared memory, 1 per board */ -static board_t *board_array; - -/* other globals */ -static int comp_id; /* component ID */ -static int num_boards; /* number of ports configured */ - -/*********************************************************************** -* LOCAL FUNCTION DECLARATIONS * -************************************************************************/ - -/* These are the functions that actually do the I/O - everything else is just init code -*/ - -static void read_board(void *arg, long period); -static void write_board(void *arg, long period); - -/* 'pins_and_params()' does most of the work involved in setting up - the driver. It parses the command line (argv[]), then if the - command line is OK, it calls hal_init(), allocates shared memory - for the parport_t data structure(s), and exports pins and parameters - It does not set up functions, since that is handled differently in - realtime and user space. -*/ -static int pins_and_params(char *argv[]); - -static unsigned short parse_board_addr(char *cp); - -static int export_board(int boardnum, board_t * board); -static int export_port(int boardnum, int pin_num, io_pin_t *pin, int num_pins, int dir); -static int export_input_pin(int boardnum, int pinnum, io_pin_t *pin); -static int export_output_pin(int boardnum, int pinnum, io_pin_t *pin); - - -/*********************************************************************** -* INIT AND EXIT CODE * -************************************************************************/ - -#define MAX_BOARDS 8 - -#define MAX_TOK ((MAX_BOARDS*2)+3) - -int rtapi_app_main(void) -{ - char *cp; - char *argv[MAX_TOK]; - int n, retval; - - /* test for config string */ - if ((cfg == 0) || (cfg[0] == '\0')) { - rtapi_print_msg(RTAPI_MSG_ERR, "AX5214H: ERROR: no config string\n"); - return -1; - } - /* as a RT module, we don't get a nice argc/argv command line, we only - get a single string... so we need to tokenize it ourselves */ - /* and to make things worse, it seems that insmod under kernel 2.6 - ends the config string at the first space, so I added the ability - to use '_' as a token separator. What an ugly hack... HAL needs - a better way to handle insmod time config data */ - cp = cfg; - for (n = 0; n < MAX_TOK; n++) { - /* strip leading whitespace or token separators */ - while ((*cp != '\0') && ( isspace(*cp) || ( *cp == '_') )) - cp++; - /* mark beginning of token */ - argv[n] = cp; - /* find end of token */ - while ((*cp != '\0') && !( isspace(*cp) || ( *cp == '_') )) - cp++; - /* mark end of this token, prepare to search for next one */ - if (*cp != '\0') { - *cp = '\0'; - cp++; - } - } - for (n = 0; n < MAX_TOK; n++) { - /* is token empty? */ - if (argv[n][0] == '\0') { - /* yes - make pointer NULL */ - argv[n] = NULL; - } - } - /* parse "command line", set up pins and parameters */ - retval = pins_and_params(argv); - if (retval != 0) { - return retval; - } - /* export functions for each board */ - for (n = 0; n < num_boards; n++) { - /* export read function */ - retval = hal_export_functf(read_board, &(board_array[n]), - 0, 0, comp_id, "ax5214h.%d.read", n); - if (retval != 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "AX5214H: ERROR: port %d read funct export failed\n", n); - hal_exit(comp_id); - return -1; - } - /* export write function */ - retval = hal_export_functf(write_board, &(board_array[n]), - 0, 0, comp_id, "ax5214h.%d.write", n); - if (retval != 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "AX5214H: ERROR: port %d write funct export failed\n", n); - hal_exit(comp_id); - return -1; - } - } - rtapi_print_msg(RTAPI_MSG_INFO, - "AX5214H: installed driver for %d boards\n", num_boards); - hal_ready(comp_id); - return 0; -} - -void rtapi_app_exit(void) -{ - int n; - board_t *board; - - for ( n = 0 ; n < num_boards ; n++ ) { - board = &(board_array[n]); - /* reset all outputs to high/off */ - outb(0xff, board->base_addr+0); - outb(0xff, board->base_addr+1); - outb(0xff, board->base_addr+2); - outb(0xff, board->base_addr+3); - outb(0xff, board->base_addr+4); - outb(0xff, board->base_addr+5); - outb(0xff, board->base_addr+6); - outb(0xff, board->base_addr+7); - } - hal_exit(comp_id); -} - - -/*********************************************************************** -* REALTIME PORT READ AND WRITE FUNCTIONS * -************************************************************************/ - - -static void split_input(unsigned char data, io_pin_t *dest, int num) -{ - int b; - unsigned char mask; - - /* splits a byte into 'num' HAL pins (and their NOTs) */ - mask = 0x01; - for (b = 0 ; b < num ; b++ ) { - if ( data & mask ) { - /* input high, which means FALSE (active low) */ - hal_set_bool(dest->data, 0); - hal_set_bool(dest->io.not, 1); - } else { - /* input low, which means TRUE */ - hal_set_bool(dest->data, 1); - hal_set_bool(dest->io.not, 0); - } - mask <<= 1; - dest++; - } -} - -static void read_board(void *arg, long period) -{ - board_t *board; - unsigned char indata; - - board = arg; - if ( (board->dir_bits & 0x01) == 0 ) { - indata = rtapi_inb(board->base_addr+0); - split_input(indata, &(board->port_1A[0]), 8); - } - if ( (board->dir_bits & 0x02) == 0 ) { - indata = rtapi_inb(board->base_addr+1); - split_input(indata, &(board->port_1B[0]), 8); - } - if ( (board->dir_bits & 0x0A) != 0x0A ) { - indata = rtapi_inb(board->base_addr+2); - if ( (board->dir_bits & 0x04) == 0 ) { - split_input(indata, &(board->port_1CL[0]), 4); - } - indata >>= 4; - if ( (board->dir_bits & 0x08) == 0 ) { - split_input(indata, &(board->port_1CH[0]), 4); - } - } - if ( (board->dir_bits & 0x10) == 0 ) { - indata = rtapi_inb(board->base_addr+4); - split_input(indata, &(board->port_2A[0]), 8); - } - if ( (board->dir_bits & 0x20) == 0 ) { - indata = rtapi_inb(board->base_addr+5); - split_input(indata, &(board->port_2B[0]), 8); - } - if ( (board->dir_bits & 0xA0) != 0xA0 ) { - indata = rtapi_inb(board->base_addr+6); - if ( (board->dir_bits & 0x40) == 0 ) { - split_input(indata, &(board->port_2CL[0]), 4); - } - indata >>= 4; - if ( (board->dir_bits & 0x80) == 0 ) { - split_input(indata, &(board->port_2CH[0]), 4); - } - } -} - -unsigned char build_output(io_pin_t *src, int num) -{ - int b; - unsigned char data, mask; - - data = 0x00; - mask = 0x01; - /* assemble output byte for data port from 'num' source variables */ - for (b = 0; b < num; b++) { - /* get the data, add to output byte */ - if ( hal_get_bool(src->data) ) { - if ( !hal_get_bool(src->io.invert) ) { - data |= mask; - } - } else { - if ( hal_get_bool(src->io.invert) ) { - data |= mask; - } - } - mask <<= 1; - src++; - } - return data; -} - -static void write_board(void *arg, long period) -{ - board_t *board; - unsigned char outdata, tmp; - - board = arg; - if ( (board->dir_bits & 0x01) == 0x01 ) { - outdata = build_output(&(board->port_1A[0]), 8); - rtapi_outb(~outdata, board->base_addr+0); - } - if ( (board->dir_bits & 0x02) == 0x02 ) { - outdata = build_output(&(board->port_1B[0]), 8); - rtapi_outb(~outdata, board->base_addr+1); - } - if ( (board->dir_bits & 0x0A) != 0x00 ) { - outdata = 0; - if ( (board->dir_bits & 0x04) == 0x04 ) { - tmp = build_output(&(board->port_1CL[0]), 4); - outdata = tmp; - } - if ( (board->dir_bits & 0x08) == 0x08 ) { - tmp = build_output(&(board->port_1CH[0]), 4); - outdata = outdata | (tmp << 4); - } - rtapi_outb(~outdata, board->base_addr+2); - } - if ( (board->dir_bits & 0x10) == 0x10 ) { - outdata = build_output(&(board->port_2A[0]), 8); - rtapi_outb(~outdata, board->base_addr+4); - } - if ( (board->dir_bits & 0x20) == 0x20 ) { - outdata = build_output(&(board->port_2B[0]), 8); - rtapi_outb(~outdata, board->base_addr+5); - } - if ( (board->dir_bits & 0xA0) != 0x00 ) { - outdata = 0; - if ( (board->dir_bits & 0x40) == 0x40 ) { - tmp = build_output(&(board->port_2CL[0]), 4); - outdata = tmp; - } - if ( (board->dir_bits & 0x80) == 0x80 ) { - tmp = build_output(&(board->port_2CH[0]), 4); - outdata = outdata | (tmp << 4); - } - rtapi_outb(~outdata, board->base_addr+6); - } -} - -/*********************************************************************** -* LOCAL FUNCTION DEFINITIONS * -************************************************************************/ - -static int pins_and_params(char *argv[]) -{ - unsigned short board_addr[MAX_BOARDS]; - unsigned char dir_bits[MAX_BOARDS], mask; - int n, m, retval; - - /* clear port_addr and dir_bits arrays */ - for (n = 0; n < MAX_BOARDS; n++) { - board_addr[n] = 0; - dir_bits[n] = 0; - } - /* parse config string, results in port_addr[] and data_dir[] arrays */ - num_boards = 0; - n = 0; - while ((num_boards < MAX_BOARDS) && (argv[n] != 0)) { - board_addr[num_boards] = parse_board_addr(argv[n]); - if (board_addr[num_boards] == 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "AX5124H: ERROR: bad port address '%s'\n", argv[n]); - return -1; - } - n++; - if (argv[n] == 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "AX5124H: ERROR: no config info for port %s\n", argv[n-1]); - return -1; - } - /* should be a string of 8 'I" or "O" characters */ - dir_bits[num_boards] = 0; - mask = 0x01; - for ( m = 0 ; m < 8 ; m++ ) { - /* test character and set/clear bit */ - if ((argv[n][m] == 'i') || (argv[n][m] == 'I')) { - /* input, set mask bit to zero */ - dir_bits[num_boards] &= ~mask; - } else if ((argv[n][m] == 'o') || (argv[n][m] == 'O')) { - /* output, set mask bit to one */ - dir_bits[num_boards] |= mask; - } else { - rtapi_print_msg(RTAPI_MSG_ERR, - "AX5124H: ERROR: bad config info for port %s: '%s'\n", argv[n-1], argv[n]); - return -1; - } - /* shift mask for next but */ - mask <<= 1; - } - n++; - num_boards++; - } - /* OK, now we've parsed everything */ - if (num_boards == 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "AX5214H: ERROR: no ports configured\n"); - return -1; - } - /* have good config info, connect to the HAL */ - comp_id = hal_init("hal_ax5214h"); - if (comp_id < 0) { - rtapi_print_msg(RTAPI_MSG_ERR, "AX5214H: ERROR: hal_init() failed\n"); - return -1; - } - /* allocate shared memory for board data */ - board_array = hal_malloc(num_boards * sizeof(board_t)); - if (board_array == 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "AX5214H: ERROR: hal_malloc() failed\n"); - hal_exit(comp_id); - return -1; - } - /* export all the pins and params for each board */ - for (n = 0; n < num_boards; n++) { - /* config addr and direction */ - board_array[n].base_addr = board_addr[n]; - board_array[n].dir_bits = dir_bits[n]; - /* export all vars */ - retval = export_board(n, &(board_array[n])); - if (retval != 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "AX5214H: ERROR: board %d (%04X) var export failed\n", n, board_addr[n]); - hal_exit(comp_id); - return -1; - } - } - return 0; -} - -static unsigned short parse_board_addr(char *cp) -{ - unsigned short result; - - /* initial value */ - result = 0; - /* test for leading '0x' */ - if (cp[0] == '0') { - if ((cp[1] == 'X') || (cp[1] == 'x')) { - /* leading '0x', skip it */ - cp += 2; - } - } - /* ok, now parse digits */ - while (*cp != '\0') { - /* if char is a hex digit, add it to result */ - if ((*cp >= '0') && (*cp <= '9')) { - result <<= 4; - result += *cp - '0'; - } else if ((*cp >= 'A') && (*cp <= 'F')) { - result <<= 4; - result += (*cp - 'A') + 10; - } else if ((*cp >= 'a') && (*cp <= 'f')) { - result <<= 4; - result += (*cp - 'a') + 10; - } else { - /* not a valid hex digit */ - return 0; - } - /* next char */ - cp++; - } - return result; -} - -static int export_board(int boardnum, board_t * board) -{ - int retval, msg, dir; - unsigned char config; - - /* This function exports a lot of stuff, which results in a lot of - logging if msg_level is at INFO or ALL. So we save the current value - of msg_level and restore it later. If you actually need to log this - function's actions, change the second line below */ - - msg = rtapi_get_msg_level(); - rtapi_set_msg_level(RTAPI_MSG_WARN); - retval = 0; - config = 0x80; - dir = board->dir_bits & 0x01; - retval += export_port ( boardnum, 0, &(board->port_1A[0]), 8, dir ); - if ( dir == 0 ) { - config |= 0x10; - } - dir = board->dir_bits & 0x02; - retval += export_port ( boardnum, 8, &(board->port_1B[0]), 8, dir ); - if ( dir == 0 ) { - config |= 0x02; - } - dir = board->dir_bits & 0x04; - retval += export_port ( boardnum, 16, &(board->port_1CL[0]), 4, dir ); - if ( dir == 0 ) { - config |= 0x01; - } - dir = board->dir_bits & 0x08; - retval += export_port ( boardnum, 20, &(board->port_1CH[0]), 4, dir ); - if ( dir == 0 ) { - config |= 0x08; - } - board->port1config = config; - config = 0x80; - - dir = board->dir_bits & 0x10; - retval += export_port ( boardnum, 24, &(board->port_2A[0]), 8, dir ); - if ( dir == 0 ) { - config |= 0x10; - } - dir = board->dir_bits & 0x20; - retval += export_port ( boardnum, 32, &(board->port_2B[0]), 8, dir ); - if ( dir == 0 ) { - config |= 0x02; - } - dir = board->dir_bits & 0x40; - retval += export_port ( boardnum, 40, &(board->port_2CL[0]), 4, dir ); - if ( dir == 0 ) { - config |= 0x01; - } - dir = board->dir_bits & 0x80; - retval += export_port ( boardnum, 44, &(board->port_2CH[0]), 4, dir ); - if ( dir == 0 ) { - config |= 0x08; - } - board->port2config = config; - /* initialize hardware - all outputs high - (since outputs are active low) */ - outb(board->port1config, board->base_addr+3); - outb(0xff, board->base_addr+0); - outb(0xff, board->base_addr+1); - outb(0xff, board->base_addr+2); - outb(board->port2config, board->base_addr+7); - outb(0xff, board->base_addr+4); - outb(0xff, board->base_addr+5); - outb(0xff, board->base_addr+6); - /* restore saved message level */ - rtapi_set_msg_level(msg); - return retval; -} - -static int export_port(int boardnum, int pin_num, io_pin_t *pin, int num_pins, int dir) -{ - int n, retval; - - retval = 0; - for ( n = 0 ; n < num_pins ; n++ ) { - if ( dir == 0 ) { - retval += export_input_pin(boardnum, pin_num, pin ); - } else { - retval += export_output_pin(boardnum, pin_num, pin ); - } - pin_num++; - pin++; - } - return retval; -} - -static int export_input_pin(int boardnum, int pinnum, io_pin_t *pin) -{ - int retval; - - /* export read only HAL pin for input data */ - retval = hal_pin_new_bool(comp_id, HAL_OUT, &(pin->data), 0, - "ax5214h.%d.in-%02d", boardnum, pinnum); - if (retval != 0) { - return retval; - } - /* export additional pin for inverted input data */ - retval = hal_pin_new_bool(comp_id, HAL_OUT, &(pin->io.not), 1, - "ax5214h.%d.in-%02d-not", boardnum, pinnum); - return retval; -} - -static int export_output_pin(int boardnum, int pinnum, io_pin_t *pin) -{ - int retval; - - /* export read only HAL pin for output data */ - retval = hal_pin_new_bool(comp_id, HAL_IN, &(pin->data), 0, - "ax5214h.%d.out-%02d", boardnum, pinnum); - if (retval != 0) { - return retval; - } - /* export parameter for polarity */ - retval = hal_param_new_bool(comp_id, HAL_RW, &(pin->io.invert), 0, - "ax5214h.%d.out-%02d-invert", boardnum, pinnum); - return retval; -} diff --git a/src/hal/drivers/hal_evoreg.c b/src/hal/drivers/hal_evoreg.c deleted file mode 100644 index 01c82f992d5..00000000000 --- a/src/hal/drivers/hal_evoreg.c +++ /dev/null @@ -1,349 +0,0 @@ -/******************************************************************** -* Description: hal_evoreg.c -* This file, 'hal_evoreg.c', is a HAL component that -* provides a driver for the Siemens EVOREG motion -* control board. -* -* Author: Martin Kuhnle, John Kasunich -* License: GPL Version 2 -* -* Copyright (c) 2003 All rights reserved. -* -* Last change: -********************************************************************/ - -/** This file, 'hal_evoreg.c', is a HAL component that provides a - driver for the Siemens EVOREG motion control board. - This board provides three 16bit DAC's, three encoder inputs, - 46 digital inputs and 21 digital outputs - - Fixme: error messages are not proper up to now - ToDo: better error messages - make inverted bits available - possibility to read back outputs - check dac values for limits - scale for every dacs - scale for every encoder - check if the dacs are updated all at the same time - enable Interrupts - check for wire break - watchdog - - - - Copyright (C) 2003 Martin Kuhnle - - John Kasunich - - -*/ - -/** This program is free software; you can redistribute it and/or - modify it under the terms of version 2 of the GNU General - Public License as published by the Free Software Foundation. - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - THE AUTHORS OF THIS LIBRARY ACCEPT ABSOLUTELY NO LIABILITY FOR - ANY HARM OR LOSS RESULTING FROM ITS USE. IT IS _EXTREMELY_ UNWISE - TO RELY ON SOFTWARE ALONE FOR SAFETY. Any machinery capable of - harming persons must have provisions for completely removing power - from all motors, etc, before persons enter any danger area. All - machinery must be designed to comply with local and national safety - codes, and the authors of this software can not, and do not, take - any responsibility for such compliance. - - This code was written as part of the EMC HAL project. For more - information, go to www.linuxcnc.org. -*/ - -#include /* isspace() */ -#include /* RTAPI realtime OS API */ -#include /* RTAPI realtime module decls */ -#include /* rtapi_inb(), rtapi_outb() */ -#include /* HAL public API decls */ - -/* module information */ -MODULE_AUTHOR("Martin Kuhnle"); -MODULE_DESCRIPTION("SIEMENS-EVOREG Driver for EMC HAL"); -MODULE_LICENSE("GPL"); -/* static char *cfg = 0; */ -/* config string -RTAPI_MP_STRING(cfg, "config string"); */ - -/*********************************************************************** -* STRUCTURES AND GLOBAL VARIABLES * -************************************************************************/ - -/* this structure contains the runtime data needed by the - driver for a single port/channel -*/ - -typedef struct { - void *io_base; - hal_real_t dac_out[3]; /* ptrs for dac output */ - hal_real_t position[3]; /* ptrs for encoder input */ - hal_bool_t digital_in[47]; /* ptrs for digital input pins 0 - 45 */ - hal_bool_t digital_out[25]; /* ptrs for digital output pins 0 - 20 */ - rtapi_u16 raw_counts_old[3]; - rtapi_s32 counts[3]; - hal_real_t pos_scale; /*! \todo scale for position command FIXME should be one per axis */ -} evoreg_t; - -/* pointer to array of evoreg_t structs in shared memory, 1 per port */ -static evoreg_t *port_data_array; - -/* other globals */ -static int comp_id; /* component ID */ -static int num_ports; /* number of ports configured */ - -/*********************************************************************** -* LOCAL FUNCTION DECLARATIONS * -************************************************************************/ -/* These is the functions that actually do the I/O - everything else is just init code -*/ -static void update_port(void *arg, long period); - -/*********************************************************************** -* INIT AND EXIT CODE * -************************************************************************/ - -#define MAX_PORTS 8 -#define MAX_DAC 3 /* number of DACs per card */ -#define MAX_ENC 3 /* number of Encoders per card */ - -#define MAX_TOK ((MAX_PORTS*2)+3) - -int rtapi_app_main(void) -{ - int n,i , retval, num_dac, num_enc; - - unsigned int base=0x300; - - /* only one port at the moment */ - num_ports = 1; - n = 0; - - #define ISA_BASE 0xC9000 - #define ISA_MAX 0x100000 /* allgemeiner Speicherzugriff */ - - - /* STEP 1: initialise the driver */ - comp_id = hal_init("hal_evoreg"); - if (comp_id < 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "EVOREG: ERROR: hal_init() failed\n"); - return -1; - } - - /* STEP 2: allocate shared memory for EVOREG data */ - port_data_array = hal_malloc(num_ports * sizeof(evoreg_t)); - if (port_data_array == 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "EVOREG: ERROR: hal_malloc() failed\n"); - hal_exit(comp_id); - return -1; - } - - /*! \todo FIXME: Test memory area and setup the card */ - port_data_array->io_base = ioremap(ISA_BASE, ISA_MAX - ISA_BASE); - rtapi_print_msg(RTAPI_MSG_ERR,"EVOREG: io_base: %p \n", port_data_array->io_base); - outw(0x82c9,base); /* set indexregister */ - - /* Set all outputs to zero */ - writew(0, (char *)port_data_array->io_base + 0x20); /* digital out 0-15 */ - writew(0, (char *)port_data_array->io_base + 0x40); /* digital out 16-23 */ - writew(0, (char *)port_data_array->io_base + 0x60); /* DAC 1 */ - writew(0, (char *)port_data_array->io_base + 0x80); /* DAC 2 */ - writew(0, (char *)port_data_array->io_base + 0xa0); /* DAC 3 */ - /* Reset Encoder's */ - writew(0, (char *)port_data_array->io_base + 0x02); /* ENCODER 1 */ - writew(0, (char *)port_data_array->io_base + 0x0a); /* ENCODER 2 */ - writew(0, (char *)port_data_array->io_base + 0x12); /* ENCODER 3 */ - - /* STEP 3: export the pin(s) */ - - /* Export DAC pin's */ - for ( num_dac=1; num_dac<=MAX_DAC; num_dac++) { - retval = hal_pin_new_real(comp_id, HAL_IN, &(port_data_array->dac_out[num_dac-1]), - 0.0, "evoreg.%d.dac-%02d-out", 1, num_dac); - if (retval < 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "EVOREG: ERROR: port %d var export failed with err=%i\n", n + 1, - retval); - hal_exit(comp_id); - return -1; - } - } - - /* Export Encoder pin's */ - for ( num_enc=1; num_enc<=MAX_ENC; num_enc++) { - retval = hal_pin_new_real(comp_id, HAL_OUT, &(port_data_array->position[num_enc - 1]), - 0.0, "evoreg.%d.position-%02d-in", 1, num_enc); - if (retval < 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "EVOREG: ERROR: port %d var export failed with err=%i\n", n + 1, - retval); - hal_exit(comp_id); - return -1; - } - } - - /* Export IO pin's */ - - /* export write only HAL pin's for the input bit */ - for ( i=0; i<=45;i++) { - retval += hal_pin_new_bool(comp_id, HAL_OUT, &(port_data_array->digital_in[i]), - 0, "evoreg.%d.pin-%02d-in", 1, i); - - /* export another write only HAL pin for the same bit inverted */ - /* - retval += hal_pin_bit_newf(HAL_OUT, &(port_data_array->digital_in[(2*i)+1]), - comp_id, "evoreg.%d.pin-%02d-in-not", 1, i); */ - if (retval < 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "EVOREG: ERROR: port %d var export failed with err=%i\n", n + 1, - retval); - hal_exit(comp_id); - return -1; - } - } - - /* export read only HAL pin's for the output bit */ - for ( i=0; i<=23;i++) { - retval += hal_pin_new_bool(comp_id, HAL_IN, &(port_data_array->digital_out[i]), - 0, "evoreg.%d.pin-%02d-out", 1, i); - - /* export another read only HAL pin for the same bit inverted */ - /* - retval += hal_pin_bit_newf(HAL_IN, &(port_data_array->digital_out[(2*i)+1]), - comp_id, "evoreg.%d.pin-%02d-out-not", 1, i)); */ - if (retval < 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "EVOREG: ERROR: port %d var export failed with err=%i\n", n + 1, - retval); - hal_exit(comp_id); - return -1; - } - } - - /* export parameter for scaling */ - retval = hal_param_new_real(comp_id, HAL_RW, &(port_data_array->pos_scale), - 0.0, "evoreg.%d.position-scale", 1); - if (retval != 0) { - return retval; - } - - - /* STEP 4: export function */ - retval = hal_export_functf(update_port, &(port_data_array[n]), 1, 0, - comp_id, "evoreg.%d.update", n + 1); - if (retval < 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "EVOREG: ERROR: port %d write funct export failed\n", n + 1); - hal_exit(comp_id); - return -1; - } - - rtapi_print_msg(RTAPI_MSG_INFO, - "EVOREG: installed driver for %d card(s)\n", num_ports); - hal_ready(comp_id); - return 0; -} - -void rtapi_app_exit(void) -{ - outw(0x0,0x300); - hal_exit(comp_id); -} - -/************************************************************** -* REALTIME PORT WRITE FUNCTION * -**************************************************************/ - -static void update_port(void *arg, long period) -{ - evoreg_t *port; - int pin; - unsigned char tmp, mask; - __u16 raw_counts[3]; - - port = arg; - -/* write DAC's */ - writew((hal_get_real(port->dac_out[0])/10 * 0x7fff), (char *)port->io_base + 0x60); - writew((hal_get_real(port->dac_out[1])/10 * 0x7fff), (char *)port->io_base + 0x80); - writew((hal_get_real(port->dac_out[2])/10 * 0x7fff), (char *)port->io_base + 0xa0); - -/* Read Encoders, improve the 16bit hardware counters to 32bit and scale the values */ - raw_counts[0] = (__u16) readw(port->io_base); - raw_counts[1] = (__u16) readw((char *)port->io_base + 0x08 ); - raw_counts[2] = (__u16) readw((char *)port->io_base + 0x10 ); - - port->counts[0] += (__s16) (raw_counts[0] - port->raw_counts_old[0]); - port->raw_counts_old[0] = raw_counts[0]; - - port->counts[1] += (__s16) (raw_counts[1] - port->raw_counts_old[1]); - port->raw_counts_old[1] = raw_counts[1]; - - port->counts[2] += (__s16) (raw_counts[2] - port->raw_counts_old[2]); - port->raw_counts_old[2] = raw_counts[2]; - - rtapi_real pos_scale = hal_get_real(port->pos_scale); - hal_set_real(port->position[0], port->counts[0] * pos_scale); - hal_set_real(port->position[1], port->counts[1] * pos_scale); - hal_set_real(port->position[2], port->counts[2] * pos_scale); - - -/* read digital inputs */ - tmp = readw((char *)port->io_base + 0x20); /* digital input 0-15 */ - mask = 0x01; - for (pin=0 ; pin < 16 ; pin++) { - hal_set_bool(port->digital_in[pin], (tmp & mask) ? 1:0); - mask <<= 1; - } - tmp = readw((char *)port->io_base + 0x40); /* digital input 16-31 */ - mask = 0x01; - for (pin=16 ; pin < 32 ; pin++) { - hal_set_bool(port->digital_in[pin], (tmp & mask) ? 1:0); - mask <<= 1; - } - - tmp = readw((char *)port->io_base + 0x60); /* digital input 32-45 */ - mask = 0x01; - for (pin=32 ; pin < 46 ; pin++) { - hal_set_bool(port->digital_in[pin], (tmp & mask) ? 1:0); - mask <<= 1; - } - - -/* write digital outputs */ - tmp = 0x0; - mask = 0x01; - for (pin=0; pin < 16; pin++) { - if (hal_get_bool(port->digital_out[pin])) { - tmp |= mask; - } - mask <<= 1; - } - writew( tmp, (char *)port->io_base + 0x20); /* digital output 0-15 */ - - - tmp = 0x0; - mask = 0x01; - for (pin=16; pin < 24; pin++) { - if (hal_get_bool(port->digital_out[pin])) { - tmp |= mask; - } - mask <<= 1; - } - writew( tmp, (char *)port->io_base + 0x40); /* digital output 16-23 */ - -} diff --git a/src/hal/drivers/hal_motenc.c b/src/hal/drivers/hal_motenc.c deleted file mode 100644 index 01471f7c679..00000000000 --- a/src/hal/drivers/hal_motenc.c +++ /dev/null @@ -1,1011 +0,0 @@ -/****************************************************************************** - * - * Copyright (C) 2005 Peter G. Vavaroutsos - * License: GPL Version 2 - * - * - * This is the driver for the Vital Systems MOTENC-100 board. - * The board includes 8 quadrature decoders, 8 analog inputs, - * 8 analog outputs, 68 digital inputs, 32 digital outputs, - * programmable timer interrupts, a watch dog timer, and a hardware - * E-STOP circuit. - * - * Installation of the driver (realtime only): - * - * insmod hal_motenc - * - * - * The following items are exported to the HAL. is read - * from the jumper settings on the MOTENC-100 board and is formatted - * as "%d". is formatted as "%02d". - * - * Encoders: - * Parameters: - * float motenc..enc--scale - * - * Pins: - * s32 motenc..enc--count - * float motenc..enc--position - * bit motenc..enc--index - * bit motenc..enc--index-enable - * bit motenc..enc--reset - * - * Functions: - * void motenc..encoder-read - * - * - * DACs: - * Parameters: - * float motenc..dac--offset - * float motenc..dac--gain - * - * Pins: - * float motenc..dac--value - * - * Functions: - * void motenc..dac-write - * - * - * ADC: - * Parameters: - * float motenc..adc--offset - * float motenc..adc--gain - * - * Pins: - * float motenc..adc--value - * - * Functions: - * void motenc..adc-read - * - * - * Digital In: - * Pins: - * bit motenc..pin--in - * bit motenc..pin--in-not - * - * Functions: - * void motenc..digital-in-read - * - * - * Digital Out: - * Parameters: - * bit motenc..pin--out-invert - * - * Pins: - * bit motenc..pin--out - * - * Functions: - * void motenc..digital-out-write - * - * - * Miscellaneous: - * Parameters: - * u32 motenc..watchdog-control - * MOTENC_WATCHDOG_CTL_8MS 0x00000000 - * MOTENC_WATCHDOG_CTL_16MS 0x00000001 - * MOTENC_WATCHDOG_CTL_ENABLE 0x00000004 - * MOTENC_WATCHDOG_CTL_AUTO_RESET 0x00000010 // Reset by DAC writes. - * - * Pins: - * bit motenc..estop-in - * bit motenc..estop-in-not - * bit motenc..watchdog-reset - * - * Functions: - * void motenc..misc-update - * - ****************************************************************************** - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General - * Public License as published by the Free Software Foundation. - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * THE AUTHORS OF THIS LIBRARY ACCEPT ABSOLUTELY NO LIABILITY FOR - * ANY HARM OR LOSS RESULTING FROM ITS USE. IT IS _EXTREMELY_ UNWISE - * TO RELY ON SOFTWARE ALONE FOR SAFETY. Any machinery capable of - * harming persons must have provisions for completely removing power - * from all motors, etc, before persons enter any danger area. All - * machinery must be designed to comply with local and national safety - * codes, and the authors of this software can not, and do not, take - * any responsibility for such compliance. - * - * This code was written as part of the EMC HAL project. For more - * information, go to www.linuxcnc.org. - * - ******************************************************************************/ - -#include - -#include // RTAPI realtime OS API. -#include // RTAPI realtime module decls. -#include // HAL public API decls. -#include "motenc.h" // Hardware dependent defines. - -// Module information. -MODULE_AUTHOR("Pete Vavaroutsos"); -MODULE_DESCRIPTION("Driver for Vital Systems MOTENC-100 for EMC HAL"); -MODULE_LICENSE("GPL"); - - -/****************************************************************************** - * DEVICE OBJECT - * - * This object contains all the data for one card. A device object is - * dynamically allocated in shmem for each card during initialization. - * - ******************************************************************************/ - - -typedef struct { - // Pins. - hal_sint_t pCount; // Captured binary count value. - hal_real_t pPosition; // Scaled position (floating point). - hal_bool_t pIndex; // Current state of index. - hal_bool_t pIndexEnable; // Setting this pin causes the count - // to be cleared on the next index pulse. - // Use this feature at your own risk as the PID loop - // may get upset. This pin is self clearing. - hal_bool_t pReset; // Setting this pin causes Count to be reset. - - // Parameters. - hal_real_t scale; // Scaling factor for position. - - // Private data. - double oldScale; // Stored scale value. - double scaleRecip; // Reciprocal value used for scaling. -} EncoderPinsParams; - -typedef struct { - // Pins. - hal_real_t pValue; // Desired value. - - // Parameters. - hal_real_t offset; - hal_real_t gain; -} DacPinsParams; - -typedef struct { - // Pins. - hal_real_t pValue; // Converted value. - - // Parameters. - hal_real_t offset; - hal_real_t gain; -} AdcPinsParams; - -typedef struct { - // Pins. - hal_bool_t pValue; - hal_bool_t pValueNot; -} DigitalInPinsParams; - -typedef struct { - // Pins. - hal_bool_t pValue; - - // Parameters. - hal_bool_t invert; -} DigitalOutPinsParams; - -typedef struct { - // Pins. - hal_bool_t pEstopIn; - hal_bool_t pEstopInNot; - hal_bool_t pWatchdogReset;// This pin is self clearing. - - // Parameters. - hal_uint_t watchdogControl; -} MiscPinsParams; - -typedef struct { - // Private data. - MotencRegMap *pCard; - int boardType; - char *pTypeName; - int boardID; - int numFpga; - int adcState; - rtapi_u32 watchdogControl;// Shadow HW register. - - // Exported to HAL. - EncoderPinsParams encoder[MOTENC_NUM_ENCODER_CHANNELS]; - DacPinsParams dac[MOTENC_NUM_DAC_CHANNELS]; - AdcPinsParams adc[MOTENC_NUM_ADC_CHANNELS]; - DigitalInPinsParams in[MOTENC_NUM_DIGITAL_INPUTS]; - DigitalOutPinsParams out[MOTENC_NUM_DIGITAL_OUTPUTS]; - MiscPinsParams misc; -} Device; - - -// These methods are used for initialization. -static int Device_Init(Device *this, MotencRegMap *pCard); -static int Device_ExportPinsParametersFunctions(Device *this, int componentId); -static int Device_ExportEncoderPinsParametersFunctions(Device *this, int componentId, int boardId); -static int Device_ExportDacPinsParametersFunctions(Device *this, int componentId, int boardId); -static int Device_ExportAdcPinsParametersFunctions(Device *this, int componentId, int boardId); -static int Device_ExportDigitalInPinsParametersFunctions(Device *this, int componentId, int boardId); -static int Device_ExportDigitalOutPinsParametersFunctions(Device *this, int componentId, int boardId); -static int Device_ExportMiscPinsParametersFunctions(Device *this, int componentId, int boardId); - -// These methods are exported to the HAL. -static void Device_EncoderRead(void *this, long period); -static void Device_DacWrite(void *this, long period); -static void Device_AdcRead(void *this, long period); -static void Device_DigitalInRead(void *this, long period); -static void Device_DigitalOutWrite(void *this, long period); -static void Device_MiscUpdate(void *this, long period); - -// Private helper methods. -static int Device_AdcRead4(Device *this, int startChannel); - - -/****************************************************************************** - * DRIVER OBJECT - * - * This object contains all the data for this HAL component. - * - ******************************************************************************/ - -#define MAX_DEVICES 4 // Since there are 2 board id bits. - -typedef struct { - int componentId; // HAL component ID. - Device *deviceTable[MAX_DEVICES]; - unsigned char idPresent[MAX_DEVICES]; -} Driver; - -static Driver driver; - - -/****************************************************************************** - * INIT AND EXIT CODE - ******************************************************************************/ - -int -rtapi_app_main(void) -{ - int i, j; - struct pci_dev *pDev = NULL; - MotencRegMap *pCard = NULL; - Device *pDevice; - - // Connect to the HAL. - driver.componentId = hal_init("hal_motenc"); - if (driver.componentId < 0) { - rtapi_print_msg(RTAPI_MSG_ERR, "MOTENC: ERROR: hal_init() failed\n"); - return(-EINVAL); - } - - for(i = 0; i < MAX_DEVICES; i++){ - driver.deviceTable[i] = NULL; - driver.idPresent[i] = 0; - } - - i = 0; - // Find a MOTENC card. - while((i < MAX_DEVICES) && ((pDev = pci_get_device(MOTENC_VENDOR_ID, MOTENC_DEVICE_ID, pDev)) != NULL)){ - - // Allocate memory for device object. - pDevice = hal_malloc(sizeof(Device)); - - if (pDevice == 0) { - rtapi_print_msg(RTAPI_MSG_ERR, "MOTENC: ERROR: hal_malloc() failed\n"); - hal_exit(driver.componentId); - return(-ENOMEM); - } - - // Save pointer to device object. - driver.deviceTable[i++] = pDevice; - - // Map card into memory. - pCard = (MotencRegMap *)ioremap_nocache(pci_resource_start(pDev, 2), pci_resource_len(pDev, 2)); - rtapi_print_msg(RTAPI_MSG_INFO, "MOTENC: Card detected in slot %2x\n", PCI_SLOT(pDev->devfn)); - rtapi_print_msg(RTAPI_MSG_INFO, "MOTENC: Card address @ %p, Len = %d\n", pCard, (int)pci_resource_len(pDev, 2)); - - // Initialize device. - Device_Init(pDevice, pCard); - rtapi_print_msg(RTAPI_MSG_INFO, "MOTENC: Card is %s, ID: %d\n", pDevice->pTypeName, pDevice->boardID); - if ( pDevice->boardType == 0 ) { - rtapi_print_msg(RTAPI_MSG_ERR, "MOTENC: ERROR, unknown card detected\n"); - hal_exit(driver.componentId); - return(-ENODEV); - } - - - if ( driver.idPresent[pDevice->boardID] != 0 ) { - // duplicate ID... a strict driver would bail out, but - // we are nice, we try to find an unused ID - j = 0; - while ( driver.idPresent[j] != 0 ) { - j++; - if ( j >= MAX_DEVICES ) { - rtapi_print_msg(RTAPI_MSG_ERR, "MOTENC: ERROR, duplicate ID, can't remap\n"); - hal_exit(driver.componentId); - return(-EINVAL); - } - } - pDevice->boardID = j; - rtapi_print_msg(RTAPI_MSG_WARN, "MOTENC: WARNING, duplicate ID, remapped to %d\n", j); - } - driver.idPresent[pDevice->boardID] = 1; - - // Export pins, parameters, and functions. - if(Device_ExportPinsParametersFunctions(pDevice, driver.componentId)){ - hal_exit(driver.componentId); - return(-EINVAL); - } - } - - if(pCard == NULL){ - // No card present. - rtapi_print_msg(RTAPI_MSG_WARN, "MOTENC: **** No MOTENC card detected ****\n"); - hal_exit(driver.componentId); - return -ENODEV; - } - - hal_ready(driver.componentId); - return(0); -} - - -void -rtapi_app_exit(void) -{ - int i, j; - Device *pDevice; - - hal_exit(driver.componentId); - - for(i = 0; i < MAX_DEVICES; i++){ - if((pDevice = driver.deviceTable[i]) != NULL){ - // turn off digital outputs - for(j = 0; j < pDevice->numFpga; j++){ - pDevice->pCard->fpga[j].digitalIo = MOTENC_DIGITAL_OUT; - } - // set DAC outputs to zero volts - for(j = 0; j < MOTENC_NUM_DAC_CHANNELS; j++){ - pDevice->pCard->dac[j] = MOTENC_DAC_COUNT_ZERO; - } - - // Unmap card. - iounmap((void *)(pDevice->pCard)); - - // TODO: Free device object when HAL supports free. -// hal_free(pDevice); - } - } -} - - -/****************************************************************************** - * DEVICE OBJECT FUNCTION DEFINITIONS - ******************************************************************************/ - -/* - * LOCAL FUNCTIONS - */ - -static int -Device_Init(Device *this, MotencRegMap *pCard) -{ - int i, status; - - this->pCard = pCard; - this->adcState = 0; - this->watchdogControl = 0; - - // Identify type of board. - status = pCard->fpga[0].boardVersion; - if ( status == 0 ) { - // MOTENC-100. - this->boardType = 1; - this->pTypeName = "MOTENC-100"; - this->numFpga = 2; - } else if ( status == 1 ) { - // MOTENC-Lite. - this->boardType = 2; - this->pTypeName = "MOTENC-Lite"; - this->numFpga = 1; - } else { - // No idea what it is. - this->boardType = 2; - this->pTypeName = "unknown"; - rtapi_print_msg(RTAPI_MSG_ERR, "MOTENC: unknown board type - %i\n", status); - this->numFpga = 0; - //return -1; - } - - // Extract board id from first FPGA. The user sets this via jumpers on the card. - status = pCard->fpga[0].statusControl; - this->boardID = (status & MOTENC_STATUS_BOARD_ID) >> MOTENC_STATUS_BOARD_ID_SHFT; - - // Initialize hardware. - for(i = 0; i < this->numFpga; i++){ - pCard->fpga[i].digitalIo = MOTENC_DIGITAL_OUT; - pCard->fpga[i].statusControl = MOTENC_CONTROL_ENCODER_RESET; - } - - for(i = 0; i < MOTENC_NUM_DAC_CHANNELS; i++){ - pCard->dac[i] = MOTENC_DAC_COUNT_ZERO; - } - - pCard->timerIrqDisable = 1; - pCard->watchdogControl = this->watchdogControl; - - return(0); -} - - -static int -Device_ExportPinsParametersFunctions(Device *this, int componentId) -{ - int msgLevel, boardId, error; - - // This function exports a lot of stuff, which results in a lot of - // logging if msg_level is at INFO or ALL. So we save the current value - // of msg_level and restore it later. If you actually need to log this - // function's actions, change the second line below. - msgLevel = rtapi_get_msg_level(); - rtapi_set_msg_level(RTAPI_MSG_WARN); - - boardId = this->boardID; - - // Export encoders. - error = Device_ExportEncoderPinsParametersFunctions(this, componentId, boardId); - - // Export DACs. - if(!error) error = Device_ExportDacPinsParametersFunctions(this, componentId, boardId); - - // Export ADCs. - if(!error) error = Device_ExportAdcPinsParametersFunctions(this, componentId, boardId); - - // Export digital I/O. - if(!error) error = Device_ExportDigitalInPinsParametersFunctions(this, componentId, boardId); - if(!error) error = Device_ExportDigitalOutPinsParametersFunctions(this, componentId, boardId); - - // Export miscellaneous. - if(!error) error = Device_ExportMiscPinsParametersFunctions(this, componentId, boardId); - - // Restore saved message level. - rtapi_set_msg_level(msgLevel); - - return(error); -} - - -static int -Device_ExportEncoderPinsParametersFunctions(Device *this, int componentId, int boardId) -{ - int halError, channel; - - // Export pins and parameters. - halError = 0; - for(channel = 0; channel < this->numFpga * MOTENC_FPGA_NUM_ENCODER_CHANNELS; channel++){ - // Pins. - if((halError = hal_pin_new_si32(componentId, HAL_OUT, &(this->encoder[channel].pCount), - 0, "motenc.%d.enc-%02d-count", boardId, channel)) != 0) - break; - - if((halError = hal_pin_new_real(componentId, HAL_OUT, &(this->encoder[channel].pPosition), - 0.0, "motenc.%d.enc-%02d-position", boardId, channel)) != 0) - break; - - if((halError = hal_pin_new_bool(componentId, HAL_OUT, &(this->encoder[channel].pIndex), - 0, "motenc.%d.enc-%02d-index", boardId, channel)) != 0) - break; - - if((halError = hal_pin_new_bool(componentId, HAL_IO, &(this->encoder[channel].pIndexEnable), - 0, "motenc.%d.enc-%02d-index-enable", boardId, channel)) != 0) - break; - - if((halError = hal_pin_new_bool(componentId, HAL_IN, &(this->encoder[channel].pReset), - 0, "motenc.%d.enc-%02d-reset", boardId, channel)) != 0) - break; - - // Parameters. - if((halError = hal_param_new_real(componentId, HAL_RW, &(this->encoder[channel].scale), - 1.0, "motenc.%d.enc-%02d-scale", boardId, channel)) != 0) - break; - - // Init encoder. - this->encoder[channel].oldScale = 1.0; - this->encoder[channel].scaleRecip = 1.0 / hal_get_real(this->encoder[channel].scale); - } - - // Export functions. - if(!halError){ - halError = hal_export_functf(Device_EncoderRead, this, 1, 0, componentId, "motenc.%d.encoder-read", boardId); - } - - if(halError){ - rtapi_print_msg(RTAPI_MSG_ERR, "MOTENC: ERROR: export encoder failed\n"); - return(-1); - } - - return(0); -} - - -static int -Device_ExportDacPinsParametersFunctions(Device *this, int componentId, int boardId) -{ - int halError, channel; - - // Export pins and parameters. - halError = 0; - for(channel = 0; channel < MOTENC_NUM_DAC_CHANNELS; channel++){ - // Pins. - if((halError = hal_pin_new_real(componentId, HAL_IN, &(this->dac[channel].pValue), - 0.0, "motenc.%d.dac-%02d-value", boardId, channel)) != 0) - break; - - // Parameters. - if((halError = hal_param_new_real(componentId, HAL_RW, &(this->dac[channel].offset), - 0.0, "motenc.%d.dac-%02d-offset", boardId, channel)) != 0) - break; - - if((halError = hal_param_new_real(componentId, HAL_RW, &(this->dac[channel].gain), - 1.0, "motenc.%d.dac-%02d-gain", boardId, channel)) != 0) - break; - } - - // Export functions. - if(!halError){ - halError = hal_export_functf(Device_DacWrite, this, 1, 0, componentId, "motenc.%d.dac-write", boardId); - } - - if(halError){ - rtapi_print_msg(RTAPI_MSG_ERR, "MOTENC: ERROR: export DAC failed\n"); - return(-1); - } - - return(0); -} - - -static int -Device_ExportAdcPinsParametersFunctions(Device *this, int componentId, int boardId) -{ - int halError, channel; - - // Export pins and parameters. - halError = 0; - for(channel = 0; channel < MOTENC_NUM_ADC_CHANNELS; channel++){ - // Pins. - if((halError = hal_pin_new_real(componentId, HAL_OUT, &(this->adc[channel].pValue), - 0.0, "motenc.%d.adc-%02d-value", boardId, channel)) != 0) - break; - - // Parameters. - if((halError = hal_param_new_real(componentId, HAL_RW, &(this->adc[channel].offset), - 0.0, "motenc.%d.adc-%02d-offset", boardId, channel)) != 0) - break; - - if((halError = hal_param_new_real(componentId, HAL_RW, &(this->adc[channel].gain), - 1.0, "motenc.%d.adc-%02d-gain", boardId, channel)) != 0) - break; - } - - // Export functions. - if(!halError){ - halError = hal_export_functf(Device_AdcRead, this, 1, 0, componentId, "motenc.%d.adc-read", boardId); - } - - if(halError){ - rtapi_print_msg(RTAPI_MSG_ERR, "MOTENC: ERROR: export ADC failed\n"); - return(-1); - } - - return(0); -} - - -static int -Device_ExportDigitalInPinsParametersFunctions(Device *this, int componentId, int boardId) -{ - int halError, channel; - - // Export pins and parameters. - halError = 0; - for(channel = 0; channel < (this->numFpga * MOTENC_FPGA_NUM_DIGITAL_INPUTS - 4); channel++){ - // Pins. - if((halError = hal_pin_new_bool(componentId, HAL_OUT, &(this->in[channel].pValue), - 0, "motenc.%d.in-%02d", boardId, channel)) != 0) - break; - - if((halError = hal_pin_new_bool(componentId, HAL_OUT, &(this->in[channel].pValueNot), - 1, "motenc.%d.in-%02d-not", boardId, channel)) != 0) - break; - } - - // Export functions. - if(!halError){ - halError = hal_export_functf(Device_DigitalInRead, this, 0, 0, componentId, "motenc.%d.digital-in-read", boardId); - } - - if(halError){ - rtapi_print_msg(RTAPI_MSG_ERR, "MOTENC: ERROR: export digital in failed\n"); - return(-1); - } - - return(0); -} - - -static int -Device_ExportDigitalOutPinsParametersFunctions(Device *this, int componentId, int boardId) -{ - int halError, channel; - - // Export pins and parameters. - halError = 0; - for(channel = 0; channel < this->numFpga * MOTENC_FPGA_NUM_DIGITAL_OUTPUTS; channel++){ - // Pins. - if((halError = hal_pin_new_bool(componentId, HAL_IN, &(this->out[channel].pValue), - 0, "motenc.%d.out-%02d", boardId, channel)) != 0) - break; - - // Parameters. - if((halError = hal_param_new_bool(componentId, HAL_RW, &(this->out[channel].invert), - 0, "motenc.%d.out-%02d-invert", boardId, channel)) != 0) - break; - } - - // Export functions. - if(!halError){ - halError = hal_export_functf(Device_DigitalOutWrite, this, 0, 0, componentId, "motenc.%d.digital-out-write", boardId); - } - - if(halError){ - rtapi_print_msg(RTAPI_MSG_ERR, "MOTENC: ERROR: export digital out failed\n"); - return(-1); - } - - return(0); -} - - -static int -Device_ExportMiscPinsParametersFunctions(Device *this, int componentId, int boardId) -{ - int halError; - - // Export Pins. - halError = hal_pin_new_bool(componentId, HAL_OUT, &(this->misc.pEstopIn), 0, - "motenc.%d.estop-in", boardId); - - if(!halError){ - halError = hal_pin_new_bool(componentId, HAL_OUT, &(this->misc.pEstopInNot), 1, - "motenc.%d.estop-in-not", boardId); - } - - if(!halError){ - halError = hal_pin_new_bool(componentId, HAL_IO, &(this->misc.pWatchdogReset), 0, - "motenc.%d.watchdog-reset", boardId); - } - - // Export Parameters. - if(!halError){ - halError = hal_param_new_ui32(componentId, HAL_RW, &(this->misc.watchdogControl), this->watchdogControl, - "motenc.%d.watchdog-control", boardId); - } - - // Export functions. - if(!halError){ - halError = hal_export_functf(Device_MiscUpdate, this, 0, 0, componentId, "motenc.%d.misc-update", boardId); - } - - if(halError){ - rtapi_print_msg(RTAPI_MSG_ERR, "MOTENC: ERROR: export miscellaneous failed\n"); - return(-1); - } - - return(0); -} - - -/* - * HAL EXPORTED FUNCTIONS - */ - -static void -Device_EncoderRead(void *arg, long period) -{ - Device *this = (Device *)arg; - MotencRegMap *pCard = this->pCard; - EncoderPinsParams *pEncoder; - int i, j; - rtapi_u32 status; - - pEncoder = &this->encoder[0]; - - // For each FPGA. - for(i = 0; i < this->numFpga; i++){ - - // read status register just once, before writing anything to the card - status = pCard->fpga[i].statusControl; - - // For each encoder. - for(j = 0; j < MOTENC_FPGA_NUM_ENCODER_CHANNELS; j++, pEncoder++){ - - // Check reset pin. - if(hal_get_bool(pEncoder->pReset)){ - // Reset encoder. - pCard->fpga[i].statusControl = 1 << (MOTENC_CONTROL_ENCODER_RESET_SHFT + j); - } - - // check state of hardware index pin - hal_set_bool(pEncoder->pIndex, (status >> (MOTENC_STATUS_INDEX_SHFT + j)) & 1); - - // check for index pulse detected - if((status >> (MOTENC_STATUS_INDEX_LATCH_SHFT + j)) & 1){ - // cancel index-enable - hal_set_bool(pEncoder->pIndexEnable, 0); - } - - // Check for index enable request from HAL - if(hal_get_bool(pEncoder->pIndexEnable)){ - // tell hardware to latch on index - pCard->fpga[i].encoderCount[j] = 1; - } else { - // cancel hardware latch on index - pCard->fpga[i].encoderCount[j] = 0; - } - - // Read encoder counts. - hal_set_si32(pEncoder->pCount, pCard->fpga[i].encoderCount[j]); - - // Check for change in scale value. - if ( hal_get_real(pEncoder->scale) != pEncoder->oldScale ) { - // Get ready to detect future scale changes. - pEncoder->oldScale = hal_get_real(pEncoder->scale); - - // Validate the new scale value. - if ((hal_get_real(pEncoder->scale) < 1e-20) && (hal_get_real(pEncoder->scale) > -1e-20)) { - // Value too small, divide by zero is a bad thing. - hal_set_real(pEncoder->scale, 1.0); - } - - // We will need the reciprocal. - pEncoder->scaleRecip = 1.0 / hal_get_real(pEncoder->scale); - } - - // Scale count to make floating point position. - hal_set_real(pEncoder->pPosition, hal_get_si32(pEncoder->pCount) * pEncoder->scaleRecip); - } - } -} - - -static void -Device_DacWrite(void *arg, long period) -{ - Device *this = (Device *)arg; - MotencRegMap *pCard = this->pCard; - DacPinsParams *pDac; - int i; - rtapi_real volts; - rtapi_u32 dacCount; - - pDac = &this->dac[0]; - - // For each DAC. - for(i = 0; i < MOTENC_NUM_DAC_CHANNELS; i++, pDac++){ - - // Calculate hardware register value. - volts = (hal_get_real(pDac->pValue) - hal_get_real(pDac->offset)) * hal_get_real(pDac->gain); - - // Truncate volts to DAC limits. - if(volts > MOTENC_DAC_VOLTS_MAX){ - volts = MOTENC_DAC_VOLTS_MAX; - }else if(volts < MOTENC_DAC_VOLTS_MIN){ - volts = MOTENC_DAC_VOLTS_MIN; - } - - // Transform volts to counts. - dacCount = (rtapi_u32)(volts * MOTENC_DAC_SCALE_MULTIPLY / - MOTENC_DAC_SCALE_DIVIDE + MOTENC_DAC_COUNT_ZERO); - - // Write DAC. - pCard->dac[i] = dacCount; - } -} - - -static void -Device_AdcRead(void *arg, long period) -{ - Device *this = (Device *)arg; - MotencRegMap *pCard = this->pCard; - - switch(this->adcState){ - // Start conversion on first 4 channels. - case 0: - this->adcState++; - pCard->adcDataCommand = MOTENC_ADC_COMMAND_CHN_0_1_2_3; - pCard->adcStartConversion = 1; - break; - - // Wait for first conversion, start conversion on second 4 channels. - case 1: - if(Device_AdcRead4(this, 0)){ - this->adcState++; - - // Start next conversion. - pCard->adcDataCommand = MOTENC_ADC_COMMAND_CHN_4_5_6_7; - pCard->adcStartConversion = 1; - } - break; - - // Wait for second conversion, start conversion on first 4 channels. - case 2: - if(Device_AdcRead4(this, 4)){ - this->adcState = 1; - - // Start next conversion. - pCard->adcDataCommand = MOTENC_ADC_COMMAND_CHN_0_1_2_3; - pCard->adcStartConversion = 1; - } - break; - - default: - this->adcState = 0; - } -} - - -static int -Device_AdcRead4(Device *this, int startChannel) -{ - MotencRegMap *pCard = this->pCard; - AdcPinsParams *pAdc; - int i; - rtapi_s32 adcCount; - rtapi_real volts; - - if(pCard->fpga[0].statusControl & MOTENC_STATUS_ADC_DONE) - return(0); - - pAdc = &this->adc[startChannel]; - - // Get conversion results. - for(i = 0; i < 4; i++, pAdc++){ - adcCount = pCard->adcDataCommand; - - // Sign extend result. - if(adcCount & MOTENC_ADC_SIGN_BIT){ - adcCount |= MOTENC_ADC_SIGN_EXTEND; - } - - // Transform count to volts. - volts = adcCount * MOTENC_ADC_SCALE_MULTIPLY / MOTENC_ADC_SCALE_DIVIDE; - - // Scale and offset volts. - volts = volts * hal_get_real(pAdc->gain) - hal_get_real(pAdc->offset); - - // Update pin. - hal_set_real(pAdc->pValue, volts); - } - - return(1); -} - - -static void -Device_DigitalInRead(void *arg, long period) -{ - Device *this = (Device *)arg; - MotencRegMap *pCard = this->pCard; - DigitalInPinsParams *pDigitalIn; - int i, j, n; - rtapi_u32 pins; - - pDigitalIn = &this->in[0]; - - // For each FPGA. - for(i = 0; i < this->numFpga; i++){ - - // Read digital I/O register. - pins = ~pCard->fpga[i].digitalIo >> MOTENC_DIGITAL_IN_SHFT; - - // For each pin. - for(j = 0; j < 16; j++, pDigitalIn++){ - - // Update pins. - rtapi_bool b = hal_set_bool(pDigitalIn->pValue, pins & 1); - hal_set_bool(pDigitalIn->pValueNot, !b); - - pins >>= 1; - } - - // Read status register. - pins = ~pCard->fpga[i].statusControl >> MOTENC_STATUS_DIGITAL_IN_SHFT; - - // First FPGA only has 16 inputs in the status register. The other 4 are - // used for special purpose inputs like board id, ADC done, and E-STOP. - n = (i)? 20: 16; - - // For each pin. - for(j = 0; j < n; j++, pDigitalIn++){ - - // Update pins. - rtapi_bool b = hal_set_bool(pDigitalIn->pValue, pins & 1); - hal_set_bool(pDigitalIn->pValueNot, !b); - - pins >>= 1; - } - } -} - - -static void -Device_DigitalOutWrite(void *arg, long period) -{ - Device *this = (Device *)arg; - MotencRegMap *pCard = this->pCard; - DigitalOutPinsParams *pDigitalOut; - int i, j; - rtapi_u32 pins, mask; - - pDigitalOut = &this->out[0]; - - // For each FPGA. - for(i = 0; i < this->numFpga; i++){ - - pins = 0; - mask = 1; - - // For each pin. - for(j = 0; j < MOTENC_FPGA_NUM_DIGITAL_OUTPUTS; j++, pDigitalOut++){ - - // Build hardware register value. - if(hal_get_bool(pDigitalOut->pValue) != hal_get_bool(pDigitalOut->invert)){ - pins |= mask; - } - - mask <<=1; - } - - // Write digital I/O register. - // invert for active low OPTO-22 modules - pCard->fpga[i].digitalIo = ~pins << MOTENC_DIGITAL_OUT_SHFT; - } -} - - -static void -Device_MiscUpdate(void *arg, long period) -{ - Device *this = (Device *)arg; - MotencRegMap *pCard = this->pCard; - - // Check watchdog control parameter. - if(this->watchdogControl != hal_get_ui32(this->misc.watchdogControl)){ - // Update shadow register. - this->watchdogControl = hal_get_ui32(this->misc.watchdogControl); - - // Write hardware. - pCard->watchdogControl = this->watchdogControl; - } - - // Check watchdog reset pin. - if(hal_get_bool(this->misc.pWatchdogReset)){ - // Clear pin. - hal_set_bool(this->misc.pWatchdogReset, 0); - - // Reset the watchdog timer. - pCard->watchdogReset = MOTENC_WATCHDOG_RESET_VALUE; - } - - // Update E-STOP pin. - rtapi_bool b = hal_set_bool(this->misc.pEstopIn, (pCard->fpga[0].statusControl & MOTENC_STATUS_ESTOP)? 1: 0); - hal_set_bool(this->misc.pEstopInNot, !b); -} diff --git a/src/hal/drivers/hal_skeleton.c b/src/hal/drivers/hal_skeleton.c deleted file mode 100644 index 2496f066152..00000000000 --- a/src/hal/drivers/hal_skeleton.c +++ /dev/null @@ -1,208 +0,0 @@ -/******************************************************************** -* Description: hal_skeleton.c -* This file, 'hal_skeleton.c', is a example that shows -* how drivers for HAL components will work and serve as -* a skeleton for new hardware drivers. -* -* Author: John Kasunich -* License: GPL Version 2 -* -* Copyright (c) 2003 All rights reserved. -* -* Last change: -********************************************************************/ - -/** This file, 'hal_skeleton.c', is a example that shows how - drivers for HAL components will work and serve as a skeleton - for new hardware drivers. - - Most of this code is taken from the hal_parport driver from John Kasunich, - which is also a good starting point for new drivers. - - This driver supports only for demonstration how to write a byte (char) - to a hardware address, here we use the parallel port (0x378). - - This driver support no configuration strings so installing is easy: - realtime: halcmd loadrt hal_skeleton - - The driver creates a HAL pin and if it run in realtime a function - as follows: - - Pin: 'skeleton..pin--out' - Function: 'skeleton..write' - - This skeleton driver also doesn't use arguments you can pass to the driver - at startup. Please look at the parport driver how to implement this if you need - this for your driver. - - (added 17 Nov 2006) - The approach used for writing HAL drivers has evolved quite a bit over the - three years since this was written. Driver writers should consult the HAL - User Manual for information about canonical device interfaces, and should - examine some of the more complex drivers, before using this as a basis for - a new driver. - -*/ - -/** Copyright (C) 2003 John Kasunich - - Martin Kuhnle - -*/ - -/** This program is free software; you can redistribute it and/or - modify it under the terms of version 2 of the GNU General - Public License as published by the Free Software Foundation. - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - THE AUTHORS OF THIS LIBRARY ACCEPT ABSOLUTELY NO LIABILITY FOR - ANY HARM OR LOSS RESULTING FROM ITS USE. IT IS _EXTREMELY_ UNWISE - TO RELY ON SOFTWARE ALONE FOR SAFETY. Any machinery capable of - harming persons must have provisions for completely removing power - from all motors, etc, before persons enter any danger area. All - machinery must be designed to comply with local and national safety - codes, and the authors of this software can not, and do not, take - any responsibility for such compliance. - - This code was written as part of the EMC HAL project. For more - information, go to www.linuxcnc.org. -*/ - -#include /* RTAPI realtime OS API */ -#include /* RTAPI realtime module decls */ - -#include /* HAL public API decls */ - -/* If FASTIO is defined, uses outb() and inb() from , - instead of rtapi_outb() and rtapi_inb() - the ones - are inlined, and save a microsecond or two (on my 233MHz box) -*/ -#define FASTIO - -#ifdef FASTIO -#define rtapi_inb inb -#define rtapi_outb outb -#include -#endif - -/* module information */ -MODULE_AUTHOR("Martin Kuhnle"); -MODULE_DESCRIPTION("Test Driver for ISA-LED Board for EMC HAL"); -MODULE_LICENSE("GPL"); -/* static char *cfg = 0; */ -/* config string -RTAPI_MP_STRING(cfg, "config string"); */ - -/*********************************************************************** -* STRUCTURES AND GLOBAL VARIABLES * -************************************************************************/ - -/* this structure contains the runtime data needed by the - driver for a single port/channel -*/ - -typedef struct { - hal_uint_t data_out; /* ptrs for output */ -} skeleton_t; - -/* pointer to array of skeleton_t structs in shared memory, 1 per port */ -static skeleton_t *port_data_array; - -/* other globals */ -static int comp_id; /* component ID */ -static int num_ports; /* number of ports configured */ - -/*********************************************************************** -* LOCAL FUNCTION DECLARATIONS * -************************************************************************/ -/* These is the functions that actually do the I/O - everything else is just init code -*/ -static void write_port(void *arg, long period); - -/*********************************************************************** -* INIT AND EXIT CODE * -************************************************************************/ - -#define MAX_PORTS 8 - -#define MAX_TOK ((MAX_PORTS*2)+3) - -int rtapi_app_main(void) -{ - int n, retval; - - /* only one port at the moment */ - num_ports = 1; - n = 0; /* port number */ - - /* STEP 1: initialise the driver */ - comp_id = hal_init("hal_skeleton"); - if (comp_id < 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "SKELETON: ERROR: hal_init() failed\n"); - return -1; - } - - /* STEP 2: allocate shared memory for skeleton data */ - port_data_array = hal_malloc(num_ports * sizeof(skeleton_t)); - if (port_data_array == 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "SKELETON: ERROR: hal_malloc() failed\n"); - hal_exit(comp_id); - return -1; - } - - /* STEP 3: export the pin(s) */ - retval = hal_pin_new_ui32(comp_id, HAL_IN, &(port_data_array->data_out), - 0, "skeleton.%d.pin-%02d-out", n, 1); - if (retval < 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "SKELETON: ERROR: port %d var export failed with err=%i\n", n, - retval); - hal_exit(comp_id); - return -1; - } - - /* STEP 4: export write function */ - retval = hal_export_functf(write_port, &(port_data_array[n]), 0, 0, - comp_id, "skeleton.%d.write", n); - if (retval < 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "SKELETON: ERROR: port %d write funct export failed\n", n); - hal_exit(comp_id); - return -1; - } - - rtapi_print_msg(RTAPI_MSG_INFO, - "SKELETON: installed driver for %d ports\n", num_ports); - hal_ready(comp_id); - return 0; -} - -void rtapi_app_exit(void) -{ - hal_exit(comp_id); -} - -/************************************************************** -* REALTIME PORT WRITE FUNCTION * -**************************************************************/ - -static void write_port(void *arg, long period) -{ - skeleton_t *port; - unsigned char outdata; - port = arg; - - outdata = hal_get_ui32(port->data_out) & 0xFF; - /* write it to the hardware */ - rtapi_outb(outdata, 0x378); -} diff --git a/src/hal/drivers/hal_stg.c b/src/hal/drivers/hal_stg.c deleted file mode 100644 index 95d2c5c1766..00000000000 --- a/src/hal/drivers/hal_stg.c +++ /dev/null @@ -1,1645 +0,0 @@ -/******************************************************************** -* Description: hal_stg.c -* This is the driver for Servo-To-Go Model I & II board. -* -* Author: Alex Joni -* License: GPL Version 2 -* -* Copyright (c) 2004 All rights reserved. -* see below for additional notes -* -* Last change: -********************************************************************/ - -/** This is the driver for Servo-To-Go Model I & II board. - The board includes 8 channels of quadrature encoder input, - 8 channels of analog input and output, 32 bits digital I/O, - and an interval timer with interrupt. - - Installation of the driver only realtime: - - insmod hal_stg num_chan=8 dio="IIOO" - - autodetects the address - or - - insmod hal_stg base=0x200 num_chan=8 dio="IIOO" - - Check your Hardware manual for your base address. - - The digital inputs/outputs configuration is determined by a - config string passed to insmod when loading the module. - The format consists by a four character string that sets the - direction of each group of pins. Each character of the direction - string is either "I" or "O". The first character sets the - direction of port A (Port A - DIO.0-7), the next sets - port B (Port B - DIO.8-15), the next sets port C (Port C - DIO.16-23), - and the fourth sets port D (Port D - DIO.24-31). - - The following items are exported to the HAL. - - Encoders: - Parameters: - float stg..position-scale (counts per unit) - - Pins: - s32 stg..counts - float stg..position - -/todo bit stg..index-enable -/todo bit stg..enc-reset-count - - Functions: - void stg..capture_position - - - DACs: - Parameters: - float stg..dac-offset - float stg..dac-gain - - Pins: - float stg..dac-value - - Functions: - void stg..dac-write - - - ADC: - Parameters: - float stg..adc-offset - float stg..adc-gain - - Pins: - float stg..adc-value - - Functions: - void stg..adc-read - - - Digital In: - Pins: - bit stg.in- - bit stg.in--not - - Functions: - void stg.digital-in-read - - - Digital Out: - Parameters: - bit stg.out--invert - - Pins: - bit stg.out- - - Functions: - void stg.digital-out-write - -*/ - -/** Copyright (C) 2004 Alex Joni - -*/ - -/** Copyright (C) 2003 John Kasunich - -*/ - -/* Based on STGMEMBS.CPP from the Servo To Go Windows drivers - - Copyright (c) 1996 Servo To Go Inc and released under GPL Version 2 */ -/* Also relates to the EMC1 code (very similar to STGMEMBS.CPP) - work done by Fred Proctor, Will Shackleford */ - -/** This program is free software; you can redistribute it and/or - modify it under the terms of version 2 of the GNU General - Public License as published by the Free Software Foundation. - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - THE AUTHORS OF THIS LIBRARY ACCEPT ABSOLUTELY NO LIABILITY FOR - ANY HARM OR LOSS RESULTING FROM ITS USE. IT IS _EXTREMELY_ UNWISE - TO RELY ON SOFTWARE ALONE FOR SAFETY. Any machinery capable of - harming persons must have provisions for completely removing power - from all motors, etc, before persons enter any danger area. All - machinery must be designed to comply with local and national safety - codes, and the authors of this software can not, and do not, take - any responsibility for such compliance. - - This code was written as part of the EMC HAL project. For more - information, go to www.linuxcnc.org. -*/ - -#include -#include /* RTAPI realtime OS API */ -#include /* RTAPI realtime module decls */ -#include /* HAL public API decls */ -#include "hal_stg.h" /* STG related defines */ - -/* module information */ -MODULE_AUTHOR("Alex Joni"); -MODULE_DESCRIPTION("Driver for Servo-to-Go Model I & II for EMC HAL"); -MODULE_LICENSE("GPL"); -static int base = 0x00; /* board base address, 0 means autodetect */ -RTAPI_MP_INT(base, "board base address, don't use for autodetect"); -static int model = 0; /* board model, leave empty and autodetect */ -RTAPI_MP_INT(model, "board model, use with caution. it overrides the detected model"); -static int num_chan = MAX_CHANS; /* number of channels - default = 8 */ -RTAPI_MP_INT(num_chan, "number of channels"); -static char *dio = "IIOO"; /* dio config - default = port A&B inputs, port C&D outputs */ -RTAPI_MP_STRING(dio, "dio config string - expects something like IIOO"); - -#define EPSILON 1e-20 - -/*********************************************************************** -* STRUCTURES AND GLOBAL VARIABLES * -************************************************************************/ - -typedef struct { - hal_bool_t data; /* basic pin for input or output */ - union { - hal_bool_t not; /* pin for inverted data (input only) */ - hal_bool_t invert; /* param for inversion (output only) */ - } io; -} io_pin; - -typedef struct { -/* counter data */ - hal_sint_t count[MAX_CHANS]; /* captured binary count value */ - rtapi_s32 offset[MAX_CHANS]; /* offset to hold latched position from index pulse */ - hal_real_t pos[MAX_CHANS]; /* scaled position (floating point) */ - hal_real_t pos_scale[MAX_CHANS]; /* parameter: scaling factor for pos */ - hal_bool_t index_enable[MAX_CHANS]; /* pins for index homing */ - hal_bool_t index_latch[MAX_CHANS]; /* value of the index latch for the axis */ -// hal_s32_t check_index[MAX_CHANS]; /* internal marker for two stage index pulse check */ - hal_bool_t index_polarity[MAX_CHANS]; /* Polarity of index pulse */ - -/* dac data */ - hal_real_t dac_value[MAX_CHANS]; /* value to be written to dac */ - hal_real_t dac_offset[MAX_CHANS]; /* offset value for DAC */ - hal_real_t dac_gain[MAX_CHANS]; /* gain to be applied */ - -/* adc data */ - hal_real_t adc_value[MAX_CHANS]; /* value to be read from adc */ - hal_real_t adc_offset[MAX_CHANS]; /* offset value for ADC */ - hal_real_t adc_gain[MAX_CHANS]; /* gain to be applied */ - int adc_current_chan; /* holds the currently converting channel */ - -/* dio data */ - io_pin port[4][8]; /* holds 4 ports each 8 pins, either input or output */ - unsigned char dir_bits; /* remembers config (which port is input which is output) */ - - unsigned char model; - -} stg_struct; - -static stg_struct *stg_driver; - -/* other globals */ -static int comp_id; /* component ID */ -static int outpinnum=0, inputpinnum=0; -//const int STG_MSG_LEVEL = RTAPI_MSG_ALL; -const int STG_MSG_LEVEL = RTAPI_MSG_INFO; - -#define DATA(x) (base + (2 * x) - (x % 2)) /* Address of Data register 0 */ -#define CTRL(x) (base + (2 * (x+1)) - (x % 2)) /* Address of Control register 0 */ - -/*********************************************************************** -* LOCAL FUNCTION DECLARATIONS * -************************************************************************/ -/* helper functions, to export HAL pins & co. */ -static int export_counter(int num, stg_struct * addr); -static int export_dac(int num, stg_struct * addr); -static int export_adc(int num, stg_struct * addr); -static int export_pins(int num, int dir, stg_struct * addr); -static int export_input_pin(int pinnum, io_pin * pin); -static int export_output_pin(int pinnum, io_pin * pin); - -/* Board specific functions */ - -/* initializes the STG, takes care of autodetection, all initialisations */ -static int stg_init_card(void); -/* sets up interrupt to be used */ -static int stg_set_interrupt(short interrupt); -/* scans possible addresses for STG cards */ -static unsigned short stg_autodetect(void); - -/* counter related functions */ -static int stg_counter_init(int ch); -static long stg_counter_read(int i); -static void stg_counter_latch(int i); -static void stg1_select_index_axis(void *arg, unsigned int chan); -static void stg1_reset_index_latch(void *arg, unsigned int chan); -static unsigned short stg1_get_index_pulse_latch(void *arg, unsigned int chan); - -static void stg2_reset_all_index_latches( void *arg ); -static void stg2_select_index_axes( void *arg, unsigned char mask ); -static unsigned char stg2_get_all_index_pulse_latches( void *arg ); - -/* dac related functions */ -static int stg_dac_init(int ch); -static int stg_dac_write(int ch, short value); - -/* adc related functions */ -static int stg_adc_init(int ch); -static int stg_adc_start(void *arg, unsigned short wAxis); -static short stg_adc_read(void *arg, int ch); - -/* dio related functions */ -static int stg_dio_init(void); - -/* periodic functions registered to HAL */ -static void stg_adcs_read(void *arg, long period); //reads adc data from the board, check long description at the beginning of the function -static void stg_dacs_write(void *arg, long period); //writes dac's to the STG -static void stg_counter_capture(void *arg, long period); //captures encoder counters -static void stg_di_read(void *arg, long period); //reads digital inputs from the STG -static void stg_do_write(void *arg, long period); //writes digital outputs to the STG -//static void stg_debug_print( void *, long ); - -/*********************************************************************** -* INIT AND EXIT CODE * -************************************************************************/ - -#define MAX_CHAN 8 - -int rtapi_app_main(void) -{ - int n, retval, mask, m; - unsigned char dir_bits; - int msg; - - msg = rtapi_get_msg_level(); - rtapi_set_msg_level( STG_MSG_LEVEL ); - - /* test for number of channels */ - if ((num_chan <= 0) || (num_chan > MAX_CHAN)) { - rtapi_print_msg(RTAPI_MSG_ERR, - "STG: ERROR: invalid num_chan: %d\n", num_chan); - return -1; - } - - /* test for config string */ - if ((dio == 0) || (dio[0] == '\0')) { - rtapi_print_msg(RTAPI_MSG_ERR, "STG: ERROR: no dio config string\n"); - return -1; - } - - /* have good config info, connect to the HAL */ - comp_id = hal_init("hal_stg"); - if (comp_id < 0) { - rtapi_print_msg(RTAPI_MSG_ERR, "STG: ERROR: hal_init() failed\n"); - return -1; - } - - /* allocate shared memory for stg data */ - stg_driver = hal_malloc(num_chan * sizeof(stg_struct)); - if (stg_driver == 0) { - rtapi_print_msg(RTAPI_MSG_ERR, "STG: ERROR: hal_malloc() failed\n"); - hal_exit(comp_id); - return -1; - } - - /* takes care of all initialisations, also autodetection and model if necessary */ - if ((retval=stg_init_card()) != 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "STG: ERROR: stg_init_card() failed\n"); - hal_exit(comp_id); - return retval; - } - - /* dio should be a string of 4 'I" or "O" characters */ - dir_bits = 0; - mask = 0x01; - for ( m = 0 ; m < 4 ; m++ ) { - /* test character and set/clear bit */ - if ((dio[m] == 'i') || (dio[m] == 'I')) { - /* input, set mask bit to zero */ - dir_bits &= ~mask; - } else if ((dio[m] == 'o') || (dio[m] == 'O')) { - /* output, set mask bit to one */ - dir_bits |= mask; - } else { - rtapi_print_msg(RTAPI_MSG_ERR, - "STG: ERROR: bad config info for port %d\n", m); - return -1; - } - /* shift mask for next bit */ - mask <<= 1; - } - - /* we now should have directions figured out, next is exporting the pins based on that */ - mask = 0x01; - for ( m = 0 ; m < 4 ; m++ ) { - - /* port, direction, driver */ - export_pins(m, (dir_bits & mask), stg_driver); - - /* shift mask for next bit */ - mask <<= 1; - } - stg_driver->dir_bits = dir_bits; /* remember direction of each port, will be used in the write / read functions */ - - stg_dio_init(); - - /* export all the variables for each counter, dac */ - for (n = 0; n < num_chan; n++) { - /* export all vars */ - retval = export_counter(n, stg_driver); - if (retval != 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "STG: ERROR: counter %d var export failed\n", n + 1); - hal_exit(comp_id); - return -1; - } - /* init counter */ - hal_set_si32(stg_driver->count[n], 0); - stg_driver->offset[n] = 0; - hal_set_real(stg_driver->pos[n], 0.0); - - /* By default the index pulse is not processed/used */ - hal_set_bool(stg_driver->index_enable[n], 0); - - /* Default polarity for the index pulse is active high */ - if( stg_driver->model == 1 ) - { - hal_set_bool(stg_driver->index_polarity[n], 1); - } - - /* Default value for the index latch output is false */ - hal_set_bool(stg_driver->index_latch[n], 0); - - hal_set_real(stg_driver->pos_scale[n], 1.0); - - /* init counter chip */ - stg_counter_init(n); - - retval = export_dac(n, stg_driver); - if (retval != 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "STG: ERROR: dac %d var export failed\n", n + 1); - hal_exit(comp_id); - return -1; - } - /* init counter */ - hal_set_real(stg_driver->dac_value[n], 0); - hal_set_real(stg_driver->dac_offset[n], 0.0); - hal_set_real(stg_driver->dac_gain[n], 1.0); - - /* init dac chip */ - stg_dac_init(n); - - retval = export_adc(n, stg_driver); - if (retval != 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "STG: ERROR: adc %d var export failed\n", n + 1); - hal_exit(comp_id); - return -1; - } - /* init counter */ - hal_set_real(stg_driver->adc_value[n], 0); - hal_set_real(stg_driver->adc_offset[n], 0.0); - hal_set_real(stg_driver->adc_gain[n], 1.0); - - stg_driver->adc_current_chan = -1; /* notify that no conversion has been started yet */ - - /* init adc chip */ - stg_adc_init(n); - } - - /* export functions */ - retval = hal_export_funct("stg.capture-position", stg_counter_capture, - stg_driver, 1, 0, comp_id); - if (retval != 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "STG: ERROR: stg.counter-capture funct export failed\n"); - hal_exit(comp_id); - return -1; - } - rtapi_print_msg(RTAPI_MSG_INFO, - "STG: installed %d encoder counters\n", num_chan); - - retval = hal_export_funct("stg.write-dacs", stg_dacs_write, - stg_driver, 1, 0, comp_id); - if (retval != 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "STG: ERROR: stg.write-dacs funct export failed\n"); - hal_exit(comp_id); - return -1; - } - rtapi_print_msg(RTAPI_MSG_INFO, - "STG: installed %d dacs\n", num_chan); - - retval = hal_export_funct("stg.read-adcs", stg_adcs_read, - stg_driver, 1, 0, comp_id); - if (retval != 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "STG: ERROR: stg.read-adcs funct export failed\n"); - hal_exit(comp_id); - return -1; - } - rtapi_print_msg(RTAPI_MSG_INFO, - "STG: installed %d adcs\n", num_chan); - - retval = hal_export_funct("stg.di-read", stg_di_read, - stg_driver, 0, 0, comp_id); - if (retval != 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "STG: ERROR: stg.di-read funct export failed\n"); - hal_exit(comp_id); - return -1; - } - - rtapi_print_msg(RTAPI_MSG_INFO, - "STG: installed %d digital inputs\n", inputpinnum); - - retval = hal_export_funct("stg.do-write", stg_do_write, - stg_driver, 0, 0, comp_id); - if (retval != 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "STG: ERROR: stg.do-write funct export failed\n"); - hal_exit(comp_id); - return -1; - } - rtapi_print_msg(RTAPI_MSG_INFO, - "STG: installed %d digital outputs\n", outpinnum); - - /* - retval = hal_export_funct("stg.debug_print", stg_debug_print, stg_driver, 0, 0, comp_id); - if (retval != 0) - { - rtapi_print_msg(RTAPI_MSG_ERR, - "STG: ERROR: stg.debug_print funct export failed\n"); - hal_exit(comp_id); - return -1; - } - rtapi_print_msg(RTAPI_MSG_INFO, - "STG: installed periodic debug print\n"); - */ - hal_ready(comp_id); - - /* restore saved message level */ - rtapi_set_msg_level(msg); - - return 0; -} - -void rtapi_app_exit(void) -{ - hal_exit(comp_id); - // FIXME, check for return code ? - return; -} - -/*********************************************************************** -* REALTIME ENCODER COUNTING AND UPDATE FUNCTIONS * -************************************************************************/ - -static void stg_counter_capture(void *arg, long period) -{ - stg_struct *stg = arg; - int n; -// int msg; - unsigned char mask; - unsigned char index_pulse_latches; - - if( stg->model == 1 ) - { - /* - * STG Model 1, stg1 - */ - for( n = 0; n < num_chan; n++ ) - { - /* reset and then select current axes pair to be reset by index - * Because they index polarity is configurable for the stg2 card be select - * even for the odd axes */ - stg1_select_index_axis(arg, n); - - if (stg1_get_index_pulse_latch(arg, n)) - { - hal_set_bool(stg->index_latch[n], 1); - - if (hal_get_bool(stg->index_enable[n])) - { - // read the value without latching, latching was done on index - // remember this as an offset, it will be substracted from nominal - stg->offset[n] = stg_counter_read(n); - /* set index-enable false, so outside knows we found the index, and reset the position */ - hal_set_bool(stg->index_enable[n], 0); - - /* - msg = rtapi_get_msg_level(); - rtapi_set_msg_level( STG_MSG_LEVEL ); - rtapi_print_msg(RTAPI_MSG_DBG, "STG: Index pulse detected on channel %1d\n", n ); - rtapi_set_msg_level(msg); - */ - } else { - /* NOP, no action needed, since the selection of an index pair is just valid until the next - * pair is selected */ - } - } else { - hal_set_bool(stg->index_latch[n], 0); - } - - } - } else if( stg->model == 2 ) - { - /* - * STG Model 2, stg2 - */ - - // Set IDLEN - for( mask = 0, n = 0; n < num_chan; n++ ) - { - if(hal_get_bool(stg->index_enable[n])) - { - mask |= ( 1<index_latch[n], 1); - - if (hal_get_bool(stg->index_enable[n])) - { - // read the value without latching, latching was done on index - // remember this as an offset, it will be substracted from nominal - stg->offset[n] = stg_counter_read(n); - /* set index-enable false, so outside knows we found the index, and reset the position */ - hal_set_bool(stg->index_enable[n], 0); - - /* - msg = rtapi_get_msg_level(); - rtapi_set_msg_level( STG_MSG_LEVEL ); - rtapi_print_msg(RTAPI_MSG_DBG, "STG: Index pulse detected on channel %1d\n", n ); - rtapi_set_msg_level(msg); - */ - } else { - /* NOP, no action needed, since all index latches will be clearer for the next iteration anyway */ - } - } else { - hal_set_bool(stg->index_latch[n], 0); - } - } - // Reset all latches - stg2_reset_all_index_latches( arg ); - - } else { - // NOP, only models stg1 and stg2, thus should never be reached */ - } - - for (n = 0; n < num_chan; n++) - { - /* capture raw counts to latches */ - stg_counter_latch(n); - /* read raw count, and substract the offset (determined by indexed homing) */ - hal_set_si32(stg->count[n], stg_counter_read(n) - stg->offset[n]); - /* make sure scale isn't zero or tiny to avoid divide error */ - if (hal_get_real(stg->pos_scale[n]) < 0.0) { - if (hal_get_real(stg->pos_scale[n]) > -EPSILON) - hal_set_real(stg->pos_scale[n], -1.0); - } else { - if (hal_get_real(stg->pos_scale[n]) < EPSILON) - hal_set_real(stg->pos_scale[n], 1.0); - } - /* scale count to make floating point position */ - hal_set_real(stg->pos[n], hal_get_si32(stg->count[n]) / hal_get_real(stg->pos_scale[n])); - } - /* done */ - return; -} - -/* stg_debug_print - * run this function from a very slow, - * e.g. 1sec thread and it will give some information - */ -/* -static void stg_debug_print( void *arg, long period ) -{ - stg_struct *stg=arg; - int msg; - static int counter; - - // model 2 encoder index registers - unsigned char idlen_reg; - unsigned char seldi_reg; - - //model 1 encoder index registers - unsigned char intc_reg; - - msg = rtapi_get_msg_level(); - rtapi_set_msg_level( STG_MSG_LEVEL ); - - if( stg->model == 1 ) - { - intc_reg = inb(base + INTC); - rtapi_print_msg(RTAPI_MSG_DBG, "STG: %04d: IXS1 is %s\n", counter, ( intc_reg & IXS1 ) ? "TRUE" : "FALSE" ); - rtapi_print_msg(RTAPI_MSG_DBG, "STG: %04d: IXS0 is %s\n", counter, ( intc_reg & IXS0 ) ? "TRUE" : "FALSE" ); - rtapi_print_msg(RTAPI_MSG_DBG, "STG: %04d: IXLVL is active %s\n", counter, ( intc_reg & IXLVL ) ? "TRUE" : "FALSE" ); - - } else if (stg->model == 2 ) - { - idlen_reg = inb( base + IDLEN ); - seldi_reg = inb( base + SELDI ); - - rtapi_print_msg(RTAPI_MSG_DBG, "STG: %04d: IDLEN is 0x%02x\n", counter, idlen_reg ); - rtapi_print_msg(RTAPI_MSG_DBG, "STG: %04d: SELDI is 0x%02x\n", counter, seldi_reg ); - - } else { - // NOP, should never be reached - } - - // restore saved message level - rtapi_set_msg_level(msg); - - counter++; - - return; -} -*/ - -/* stg_dacs_write() - writes all dac's to the board - - calls stg_dac_write() */ -static void stg_dacs_write(void *arg, long period) -{ - stg_struct *stg; - double volts; - short ncounts, i; - - stg=arg; - for (i=0;i < num_chan; i++) { - /* scale the voltage to be written based on offset and gain */ - volts = (hal_get_real(stg->dac_value[i]) - hal_get_real(stg->dac_offset[i])) * hal_get_real(stg->dac_gain[i]); - /* clamp the scaled voltage value to the -10V to 10V output range of the STG */ - if (volts < -10.0) - volts = -10.0; - if (volts > 10.0) - volts = 10.0; - /* compute the value for the DAC, the extra - in there is STG specific */ - ncounts = (short) ((((-10.0 - volts) * 0x1FFF) / 20.0) - 1 ); - /* write it to the card */ - stg_dac_write(i, ncounts); - } - return; -} - -/* stg_adcs_read() - reads one adc at a time from the board to hal - - calls stg_adc_read() */ - -/* long description : - - Because the conversion takes a while (first mux to the right channel ~5usecs, - then start the conversion, and wait for it to finish ~16-20 usecs) for all the - 8 channels, it would be too much to start the conversion, wait for the result - for all the 8 axes. - Instead a different approach is chosen: - - on the beginning of the function the conversion should already be done - - it gets read and sent to HAL - - the new channel gets mux'ed - - and at the end of the function the new conversion is started, so that the data - will be available at the next run. - This way 8 periods are needed to read 8 ADC's. It is possible to set the board - to do faster conversions (AZ bit on INTC off), but that would make it less - reliable (autozero takes care of temp. errors).*/ -/*! \todo STG_ADC_Improvement (if any user requests it). - Another improvement might be to let the user chose what channels he would like - for ADC (having only 2 channels might speed things up considerably). -*/ -static void stg_adcs_read(void *arg, long period) -{ - stg_struct *stg; - double volts; - short ncounts; - int i; - - stg = arg; - i = stg->adc_current_chan; - if ((i >= 0) && (i < num_chan)) { - /* we should have the conversion done for adc_num_chan */ - ncounts = stg_adc_read(stg,i); - volts = ncounts * 10.0 / 4096; - hal_set_real(stg->adc_value[i], volts * hal_get_real(stg->adc_gain[i]) - hal_get_real(stg->adc_offset[i])); - } - /* if adc_num_chan < 0, it's the first time this routine runs - thus we don't have any ready data, we simply start the next conversion */ - if (stg->adc_current_chan++ >= num_chan) - stg->adc_current_chan=0; //increase the channel, and roll back to 0 after all chans are done - - /* select the current channel with the mux, and start the conversion */ - stg_adc_start(stg,stg->adc_current_chan); - /* the next time this function runs, the result should be available */ - return; -} - - -// helper function to extract the data out of a char and place it into HAL data -// written by JMK -static void split_input(unsigned char data, io_pin *dest, int num) -{ - int b; - unsigned char mask; - - /* splits a byte into 'num' HAL pins (and their NOTs) */ - mask = 0x01; - for (b = 0 ; b < num ; b++ ) { - if ( data & mask ) { - /* input high, which means FALSE (active low) */ - hal_set_bool(dest->data, 0); - hal_set_bool(dest->io.not, 1); - } else { - /* input low, which means TRUE */ - hal_set_bool(dest->data, 1); - hal_set_bool(dest->io.not, 0); - } - mask <<= 1; - dest++; - } - return; -} - -// helper function to extract the data out of HAL and place it into a char -// written by JMK -unsigned char build_output(io_pin *src, int num) -{ - int b; - unsigned char data, mask; - - data = 0x00; - mask = 0x01; - /* assemble output byte for data port from 'num' source variables */ - for (b = 0; b < num; b++) { - /* get the data, add to output byte */ - if ( hal_get_bool(src->data) ) { - if ( !hal_get_bool(src->io.invert) ) { - data |= mask; - } - } else { - if ( hal_get_bool(src->io.invert) ) { - data |= mask; - } - } - mask <<= 1; - src++; - } - return data; -} - - -static void stg_di_read(void *arg, long period) //reads digital inputs from the STG -{ - stg_struct *stg; - unsigned char val; - stg=arg; - - if ( (stg->dir_bits & 0x01) == 0) { // if port A is set as input, read the bits - if (stg->model == 1) - val = inb(base + DIO_A); - else - val = inb(base + PORT_A); - split_input(val, &(stg->port[0][0]), 8); - } - if ( (stg->dir_bits & 0x02) == 0) { // if port B is set as input, read the bits - if (stg->model == 1) - val = inb(base + DIO_B); - else - val = inb(base + PORT_B); - split_input(val, &(stg->port[1][0]), 8); - } - if ( (stg->dir_bits & 0x04) == 0) { // if port C is set as input, read the bits - if (stg->model == 1) - val = inb(base + DIO_C); - else - val = inb(base + PORT_C); - split_input(val, &(stg->port[2][0]), 8); - } - if ( (stg->dir_bits & 0x08) == 0) { // if port D is set as input, read the bits - if (stg->model == 1) - val = inb(base + DIO_D); - else - val = inb(base + PORT_D); - split_input(val, &(stg->port[3][0]), 8); - } -} - -static void stg_do_write(void *arg, long period) //writes digital outputs to the STG -{ - stg_struct *stg; - unsigned char val; - stg=arg; - - if ( (stg->dir_bits & 0x01) != 0) { // if port A is set as output, write the bits - val = build_output(&(stg->port[0][0]), 8); - if (stg->model == 1) - outb(val, base + DIO_A); - else - outb(val, base + PORT_A); - } - if ( (stg->dir_bits & 0x02) != 0) { // if port B is set as output, write the bits - val = build_output(&(stg->port[1][0]), 8); - if (stg->model == 1) - outb(val, base + DIO_B); - else - outb(val, base + PORT_B); - } - if ( (stg->dir_bits & 0x04) != 0) { // if port C is set as output, write the bits - val = build_output(&(stg->port[2][0]), 8); - if (stg->model == 1) - outb(val, base + DIO_C); - else - outb(val, base + PORT_C); - } - if ( (stg->dir_bits & 0x08) != 0) { // if port D is set as output, write the bits - val = build_output(&(stg->port[3][0]), 8); - if (stg->model == 1) - outb(val, base + DIO_D); - else - outb(val, base + PORT_D); - } -} - -/*********************************************************************** -* BOARD SPECIFIC FUNCTIONS * -* execute board related things (write/read to/from the stg) * -************************************************************************/ - - -/*********************************************************************** -* INIT FUNCTIONS * -************************************************************************/ - -/* - stg_counter_init() - Initializes the channel - - works the same for both cards (STG & STG2) -*/ -static int stg_counter_init(int ch) -{ - /* Set Counter Command Register - Master Control, Master Reset (MRST), */ - /* and Reset address pointer (RADR). */ - outb(0x23, CTRL(ch)); - - /* Set Counter Command Register - Input Control, OL Load (P3), */ - /* and Enable Inputs A and B (INA/B). */ - outb(0x68, CTRL(ch)); - - /* Set Counter Command Register - Output Control */ - outb(0x80, CTRL(ch)); - - /* Set Counter Command Register - Quadrature */ - outb(0xC3, CTRL(ch)); - return 0; -} - -/* - stg_dac_init() - Initializes the dac channel - - works the same for both cards (STG & STG2) -*/ -static int stg_dac_init(int ch) -{ - int i; - - /* set all DAC's to 0 on startup */ - for (i=0; i < num_chan; i++) { - stg_dac_write(i, 0x1000); //by Xuecheng, 0x1000 corresponds to 0V - } - return 0; -} - - -/* - stg_adc_init() - Initializes the adc channel -*/ -static int stg_adc_init(int ch) -{ - - /* not much to setup for the ADC's */ - /* only select the mode of operation we will work with AutoZero */ - if (stg_driver->model == 1) - outb(0x0f, base + MIO_2); // the second 82C55 is already configured (by running stg_dio_init) - // we only set bit 8 (AZ) to 1 to enable it - return 0; -} - - -/* - stg_dio_init() - Initializes the dio's -*/ -static int stg_dio_init(void) -{ - /* we will select the directions of each port */ - unsigned char control, tempINTC, tempIMR, tempCtrl0, tempCtrl1; - - control = 0x80; //set up |1|0|0|A|CH|0|B|CL| - if ( (stg_driver->dir_bits & 0x01) == 0) // if port A is set as input, set bit accordingly - control |= 0x10; - if ( (stg_driver->dir_bits & 0x02) == 0) // if port B is set as input, set bit accordingly - control |= 0x02; - if ( (stg_driver->dir_bits & 0x04) == 0) // if port C is set as input, set bits accordingly - control |= 0x09; - - if (stg_driver->model == 1) { - // write the computed control to MIO_1 - outb(control, base+MIO_1); - } else { //model STG2 - // write port A,B,C direction to ABC_DIR - outb(control, base+ABC_DIR); - } - - tempINTC = inb(base + INTC); - - if (stg_driver->model == 1) { - // next compute the directions for port D, located on the second 82C55 - control = 0x82; - - if ( (stg_driver->dir_bits & 0x08) == 0)// if port D is set as input, set bits accordingly - control = 0x92; - - tempIMR = inb(base + IMR); // get the current interrupt mask - - outb(0xff, base + OCW1); //mask off all interrupts - - // write the computed control to MIO_2 - outb(control, base+MIO_2); - - outb(tempINTC, base + INTC); //restore interrupt control reg. - - outb(tempIMR, base+ OCW1); //restore int mask - - } else { //model STG2 - - // save contents of CNTRL0, it will get reinitialized - tempCtrl0 = inb(base+CNTRL0); - tempCtrl1 = inb(base+CNTRL1); - - // CNTRL0 output, BRDTST input, D output - control = 0x82; - - if ( (stg_driver->dir_bits & 0x08) == 0)// if port D is set as input, set bits accordingly - control = 0x8b; - - outb(0xff, base + CNTRL1); // disable interrupts - - outb(control, base + D_DIR); // set port D direction, also resets CNTRL0 - - outb(tempCtrl0, base + CNTRL0); - outb( (tempCtrl1 & 0x0f) | 0xf0, base + CNTRL1); - } - - return 0; -} - - -/*********************************************************************** -* ACTION FUNCTIONS * -* these do the actual data exchange with the board * -************************************************************************/ - -static void stg_counter_latch(int i) -{ - outb(0x03, CTRL(i)); -} - - -/* - stg_counter_read() - reads one channel - FIXME - todo, extend to 32 bits in software - - works the same for both cards (STG & STG2) -*/ -static long stg_counter_read(int i) -{ - union pos_tag { - long l; - struct byte_tag { - char b0; - char b1; - char b2; - char b3; - } byte; - } pos; - - pos.byte.b0 = inb(DATA(i)); - pos.byte.b1 = inb(DATA(i)); - pos.byte.b2 = inb(DATA(i)); - if (pos.byte.b2 < 0) { - pos.byte.b3 = -1; - } else { - pos.byte.b3 = 0; - } - return pos.l; -} - -static void stg1_select_index_axis(void *arg, unsigned int channel) -{ - stg_struct *stg = arg; - unsigned char byIntc,byAxis; - unsigned char byPol = 1; - - if (stg->model == 1) - { - /* - * Set polarity to low active if that is requested - */ - if( hal_get_bool(stg->index_polarity[channel]) == 0 ) - { - byPol = 0; - } - - /* Stg manual p. 21: "The bits are level triggered and cannot be reset if they are active" - * So it is save to reset them and only those which are really active will remain */ - stg1_reset_index_latch(arg, channel); - - // routine for Model 1 - // initialize stuff to poll index pulse - byAxis = channel; - - byAxis &= 0x6; // ignore low bit, we check 2 axes at a time - byAxis <<= 3; // shift into position for IXS1, IXS0 - byIntc = inb(base + INTC); // get a copy of INTC, we'll change - // some bits in it, not all - byIntc &= ~(IXLVL | IXS1 | IXS0); // zero bits for axis and polarity - byIntc |= byAxis; // put axes address in INTC - if (byPol != 0) // is index pulse active high? - byIntc |= IXLVL; - outb(byIntc, base + INTC); - } -} - -static void stg2_select_index_axes( void *arg, unsigned char mask ) -{ - /* stg2 manual, p.21 - * writing 0 to the corresponding bit disables the index pulse - * writing 1 enables it - */ - outb( mask, base + IDLEN ); - return; -} - -/* Note that for stg1 cards this function will clear the index pulse latches for the two selected axes, - */ -static void stg1_reset_index_latch(void *arg, unsigned int channel) -{ - stg_struct *stg = arg; - - if (stg->model == 1) - { // routine for Model 1 - inb(base + ODDRST); //reset index pulse latch for ODD axis - inb(base + BRDTST); //reset index pulse latch for EVEN axis - } - return; -} - -static void stg2_reset_all_index_latches( void *arg ) -{ - stg_struct *stg = arg; - if( stg->model == 2 ) - { - /* - * stg2 manual p.22, - * writing 0 to IDL resets the index latch, - * writing 1 has no effect - */ - outb( 0x00, base + IDL); - } - return; -} - -unsigned char stg1_get_current_IRR(void) -{ - outb(base + OCW3, 0x0a); // IRR on next read - return inb(base + IRR); -} - -static unsigned short stg1_get_index_pulse_latch(void *arg, unsigned int chan) -{ - // routine for Model 1 board - - stg_struct *stg = arg; - unsigned char byIRR, byAxisMask; - - if (stg->model == 1){ // routine for Model 1 - byIRR = stg1_get_current_IRR(); - byAxisMask = (chan & 1) ? LIXODD : LIXEVN; // even or odd axis? - if (byIRR & byAxisMask) // check latched index pulse - return 1; - return 0; - } else if (stg->model == 2) { - //FIXME: return if latched index pulse is there - return 0; - } - return 0; -} - -static unsigned char stg2_get_all_index_pulse_latches( void *arg ) -{ - stg_struct *stg = arg; - unsigned char indexRegister = 0; - - if( stg-> model == 2 ) - indexRegister = inb( base + IDL ); - return indexRegister; -} - - -/* - stg_dac_write() - writes a dac channel - - works the same for both cards (STG & STG2) -*/ -static int stg_dac_write(int ch, short value) -{ - /* write the DAC */ - outw(value, base + DAC_0 + (ch << 1)); - - return 0; -} - - - -int stg_adc_start(void *arg, unsigned short wAxis) -{ - stg_struct *stg; - unsigned char tempCtrl0; - - stg = arg; - - if (stg->model == 1) { - /* do a dummy read from the ADC, just to set the input multiplexer to - the right channel */ - inw(base + ADC_0 + (wAxis << 1)); - - /* wait 4 uS for settling time on the multiplexer and ADC. You probably - shouldn't really have a delay in a driver */ - outb(0, 0x80); - outb(0, 0x80); - outb(0, 0x80); - outb(0, 0x80); - - /* now start conversion */ - outw(0, base + ADC_0 + (wAxis << 1)); - } else { //model STG2 - - tempCtrl0 = inb(base+CNTRL0) & 0x07; // save IRQ - tempCtrl0 |= (wAxis << 4) | 0x88; //autozero & cal cycle - outb(tempCtrl0, base + CNTRL0); // select channel - - /* wait 4 uS for settling time on the multiplexer and ADC. You probably - shouldn't really have a delay in a driver */ - outb(0, 0x80); - outb(0, 0x80); - outb(0, 0x80); - outb(0, 0x80); - - /* now start conversion */ - outw(0, base + ADC_0); - } - return 0; -}; - -static short stg_adc_read(void *arg, int axis) -{ - short j; - stg_struct *stg; - - stg = arg; - - /* - there must have been a delay between stg_adc_start() and - stg_adc_read(), of 19 usec if autozeroing (we are), 4 usecs - otherwise. In code that calls this, make sure you split these - calls up with some intervening code - */ - - - if (stg->model == 1) { - - /* make sure conversion is done, assume polling delay is done. - EOC (End Of Conversion) is bit 0x08 in IIR (Interrupt Request - Register) of Interrupt Controller. Don't wait forever though - bail out eventually. */ - - for (j = 0; !(inb(base + IRR) & 0x08) && (j < 1000); j++); - - j = inw(base + ADC_0 + (axis << 1)); - - } else { //model 2 - - for (j = 0; (inb(base + BRDTST) & 0x08) && (j < 1000); j++); - - j = inw(base + ADC_0 + (axis << 1)); - - } - - - if (j & 0x1000) /* is sign bit negative? */ - j |= 0xf000; /* sign extend */ - else - j &= 0xfff; /* make sure high order bits are zero. */ - - return j; -}; - -/*********************************************************************** -* BOARD INIT FUNCTIONS * -* functions for autodetec, irq init * -************************************************************************/ - -static int stg_set_interrupt(short interrupt) -{ - unsigned char tempINTC; - - if (stg_driver->model == 1) - tempINTC=0x80; - else - tempINTC=0x88;//also CAL low, don|t want ADC to calibrate - - switch (interrupt) { - case 3: break; - case 5: tempINTC |= 4;break; - case 7: tempINTC |= 2;break; - case 9: tempINTC |= 6;break; - case 10: tempINTC |= 5;break; - case 11: tempINTC |= 7;break; - case 12: tempINTC |= 3;break; - case 15: tempINTC |= 1;break; - default: tempINTC |= 4;break; - } - if (stg_driver->model == 1) - outb(tempINTC, base + INTC); - else - outb(tempINTC, base + CNTRL0); - - return 0; -} - -static int stg_init_card() -{ - int msg; - - msg = rtapi_get_msg_level(); - rtapi_set_msg_level( STG_MSG_LEVEL ); - - /* - * If both stg card model and base address are set - * then no autodetecting is necessary. - * Else we need to autodetect - */ - if ( (model != 0) && (base != 0) ) - { - stg_driver->model = model; - } else { - base = stg_autodetect(); - } - - /* - * Now check if the settings for a card a ok - */ - if ( (base == 0x00) || (stg_driver->model == 0) ) - { - rtapi_print_msg(RTAPI_MSG_ERR, "STG: ERROR: no stg1 or stg2 card could be initialised\n"); - return -ENODEV; - } - - if (stg_driver->model == 1) { - /* - * STG1 - */ - // initialize INTC as output - outb(0x92, base + MIO_2); - - stg_set_interrupt(5); // initialize it to smthg, we won't use it anyways - - outb(0x1a, base + ICW1); // initialize the 82C59 as single chip (STG docs say so:) - outb(0x00, base + ICW2); // ICW2 not used, must init it to 0 - outb(0xff, base + OCW1); // mask off all interrupts - rtapi_print_msg(RTAPI_MSG_INFO, - "STG: Initialised stg%1d card at address %x\n", stg_driver->model, base); - } else if (stg_driver->model == 2 ) { - /* - * STG2 - */ - outb(0x8b, base + D_DIR); // initialize CONTRL0 output, BRDTST input - - /* stg2 manual, p.21 - * writing 0 to the corresponding bit disables the index pulse - * writing 1 enables it - */ - outb( 0x00, base + IDLEN ); - - /* stg2 manual, p.21 - * writing 0 to the corresponding bit selects the index pulse to latch the counter - * writing 1 to the corresponding bit selects EXLATCH to latch the counter - */ - outb( 0x00, base + SELDI ); - - stg_set_interrupt(5); // initialize it to something, we won't use it anyways - rtapi_print_msg(RTAPI_MSG_INFO, - "STG: Initialised stg%1d card at address %x\n", stg_driver->model, base); - } else { - rtapi_print_msg(RTAPI_MSG_ERR, "STG: ERROR: The model stg%1d is not correct\n", stg_driver->model ); - return -ENODEV; - } - - /* restore saved message level */ - rtapi_set_msg_level(msg); - - // all ok - return 0; -} - -/* scans possible addresses for STG cards */ -unsigned short stg_autodetect() -{ - - short i, j, k, ofs; - unsigned short address; - unsigned short retval = 0; - int msg; - - msg = rtapi_get_msg_level(); - rtapi_set_msg_level( STG_MSG_LEVEL ); - - /* search all possible addresses */ - for (i = 15; i >= 0; i--) { - address = i * 0x20 + 0x200; - - /* does jumper = i? */ - //if ((inb(address + BRDTST) & 0x0f) == i) { // by Xuecheng, not necessary - k = 0; // var for getting the serial - for (j = 0; j < 8; j++) { - ofs = (inb(address + BRDTST) >> 4); - - if (ofs & 8) { /* is SER set? */ - ofs = ofs & 7; /* mask for Q2,Q1,Q0 */ - k += (1 << ofs); /* shift bit into position specified - by Q2, Q1, Q0 */ - } - } - - if (k == 0x75) { - rtapi_print_msg(RTAPI_MSG_INFO, - "STG: Autodetected stg1 card at address %x\n", address); - stg_driver->model=1; - retval = address; /* SER sequence is 01110101 */ - break; - } - - if (k == 0x74) { - rtapi_print_msg(RTAPI_MSG_INFO, - "STG: Autodetected stg2 card at address %x\n", address); - stg_driver->model=2; - retval = address; - break; - } - //} - } - - if ( ( retval == 0 ) || ( stg_driver->model == 0 ) ) - { - rtapi_print_msg(RTAPI_MSG_ERR, - "STG: stg_autodetect() did not find any stg1 or stg2 card\n"); - } - - /* restore saved message level */ - rtapi_set_msg_level(msg); - - return retval; -} - -/*********************************************************************** -* LOCAL FUNCTION DEFINITIONS * -* these are functions used for exporting various HAL pins/prams * -************************************************************************/ -static int export_counter(int num, stg_struct *addr) -{ - int retval, msg; - - /* This function exports a lot of stuff, which results in a lot of - logging if msg_level is at INFO or ALL. So we save the current value - of msg_level and restore it later. If you actually need to log this - function's actions, change the second line below */ - msg = rtapi_get_msg_level(); - rtapi_set_msg_level( STG_MSG_LEVEL ); - - /* export pin for counts captured by update() */ - retval = hal_pin_new_si32(comp_id, HAL_OUT, &addr->count[num], - 0, "stg.%d.counts", num); - if (retval != 0) { - return retval; - } - /* export pin for scaled position captured by update() */ - retval = hal_pin_new_real(comp_id, HAL_OUT, &addr->pos[num], - 0.0, "stg.%d.position", num); - if (retval != 0) { - return retval; - } - /* export parameter for scaling */ - retval = hal_param_new_real(comp_id, HAL_RW, &addr->pos_scale[num], - 1.0, "stg.%d.position-scale", num); - if (retval != 0) { - return retval; - } - - /* export pin for index homing */ - retval = hal_pin_new_bool(comp_id, HAL_IO, &addr->index_enable[num], - 0, "stg.%d.index-enable", num); - if (retval != 0) { - return retval; - } - - /* export pin for reading the index latch */ - retval = hal_pin_new_bool(comp_id, HAL_OUT, &addr->index_latch[num], - 0, "stg.%d.index-latch", num); - if (retval != 0) { - return retval; - } - - - /* - * The index polarity is configurable for the stg1 cards only, - * but not for the stg2 cards - */ - if( addr->model == 1 ) - { - /* export read only HAL pin for index pulse polarity */ - retval = hal_pin_new_bool(comp_id, HAL_IN, &addr->index_polarity[num], - 0, "stg.%d.index-polarity", num); - if (retval != 0) - { - return retval; - } - } - - /* restore saved message level */ - rtapi_set_msg_level(msg); - - return 0; -} - -static int export_dac(int num, stg_struct *addr) -{ - int retval, msg; - - /* This function exports a lot of stuff, which results in a lot of - logging if msg_level is at INFO or ALL. So we save the current value - of msg_level and restore it later. If you actually need to log this - function's actions, change the second line below */ - msg = rtapi_get_msg_level(); - rtapi_set_msg_level( STG_MSG_LEVEL ); - - /* export pin for voltage received by the board() */ - retval = hal_pin_new_real(comp_id, HAL_IN, &addr->dac_value[num], - 0.0, "stg.%d.dac-value", num); - if (retval != 0) { - return retval; - } - /* export parameter for offset */ - retval = hal_param_new_real(comp_id, HAL_RW, &addr->dac_offset[num], - 0.0, "stg.%d.dac-offset", num); - if (retval != 0) { - return retval; - } - /* export parameter for gain */ - retval = hal_param_new_real(comp_id, HAL_RW, &addr->dac_gain[num], - 1.0, "stg.%d.dac-gain", num); - if (retval != 0) { - return retval; - } - - /* restore saved message level */ - rtapi_set_msg_level(msg); - return 0; -} - -static int export_adc(int num, stg_struct *addr) -{ - int retval, msg; - - /* This function exports a lot of stuff, which results in a lot of - logging if msg_level is at INFO or ALL. So we save the current value - of msg_level and restore it later. If you actually need to log this - function's actions, change the second line below */ - msg = rtapi_get_msg_level(); - rtapi_set_msg_level( STG_MSG_LEVEL ); - - /* export pin for voltage received by the board() */ - retval = hal_pin_new_real(comp_id, HAL_OUT, &addr->adc_value[num], - 0.0, "stg.%d.adc-value", num); - if (retval != 0) { - return retval; - } - /* export parameter for offset */ - retval = hal_param_new_real(comp_id, HAL_RW, &addr->adc_offset[num], - 0.0, "stg.%d.adc-offset", num); - if (retval != 0) { - return retval; - } - /* export parameter for gain */ - retval = hal_param_new_real(comp_id, HAL_RW, &addr->adc_gain[num], - 1.0, "stg.%d.adc-gain", num); - if (retval != 0) { - return retval; - } - /* restore saved message level */ - rtapi_set_msg_level(msg); - return 0; -} - -static int export_pins(int num, int dir, stg_struct *addr) -{ - int retval, msg, i; - - /* This function exports a lot of stuff, which results in a lot of - logging if msg_level is at INFO or ALL. So we save the current value - of msg_level and restore it later. If you actually need to log this - function's actions, change the second line below */ - msg = rtapi_get_msg_level(); - rtapi_set_msg_level( STG_MSG_LEVEL ); - - for (i=0; i<8; i++) { - - if (dir != 0) - retval=export_output_pin(outpinnum++, &(addr->port[num][i]) ); - else - retval=export_input_pin(inputpinnum++, &(addr->port[num][i]) ); - - if (retval != 0) { - return retval; - } - } - /* restore saved message level */ - rtapi_set_msg_level(msg); - return 0; -} - -static int export_input_pin(int pinnum, io_pin * pin) -{ - int retval; - int msg; - - /* This function exports a lot of stuff, which results in a lot of - logging if msg_level is at INFO or ALL. So we save the current value - of msg_level and restore it later. If you actually need to log this - function's actions, change the second line below */ - msg = rtapi_get_msg_level(); - rtapi_set_msg_level( STG_MSG_LEVEL ); - - /* export read only HAL pin for input data */ - retval = hal_pin_new_bool(comp_id, HAL_OUT, &(pin->data), 0, - "stg.in-%02d", pinnum); - if (retval != 0) { - return retval; - } - /* export additional pin for inverted input data */ - retval = hal_pin_new_bool(comp_id, HAL_OUT, &(pin->io.not), 1, - "stg.in-%02d-not", pinnum); - - /* restore saved message level */ - rtapi_set_msg_level(msg); - - return retval; -} - -static int export_output_pin(int pinnum, io_pin * pin) -{ - int retval; - int msg; - - /* - * This function exports a lot of stuff, which results in a lot of - * logging if msg_level is at INFO or ALL. So we save the current value - * of msg_level and restore it later. If you actually need to log this - * function's actions, change the second line below - */ - msg = rtapi_get_msg_level(); - rtapi_set_msg_level( STG_MSG_LEVEL ); - - /* export read only HAL pin for output data */ - retval = hal_pin_new_bool(comp_id, HAL_IN, &(pin->data), - 0, "stg.out-%02d", pinnum); - if (retval != 0) { - return retval; - } - /* export parameter for polarity */ - retval = hal_param_new_bool(comp_id, HAL_RW, &(pin->io.invert), - 0, "stg.out-%02d-invert", pinnum); - - /* restore saved message level */ - rtapi_set_msg_level(msg); - - return retval; -} diff --git a/src/hal/drivers/hal_stg.h b/src/hal/drivers/hal_stg.h deleted file mode 100644 index 196c841ade4..00000000000 --- a/src/hal/drivers/hal_stg.h +++ /dev/null @@ -1,138 +0,0 @@ -#ifndef STG_H -#define STG_H - -/** This is the driver for an Servo-To-Go Model I board. - The board includes 8 channels of quadrature encoder input, - 8 channels of analog input and output, 32 bits digital I/O, - and an interval timer with interrupt. -**/ - -/** Copyright (C) 2005 Alex Joni - -**/ - -/** This program is free software; you can redistribute it and/or - modify it under the terms of version 2 of the GNU General - Public License as published by the Free Software Foundation. - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - THE AUTHORS OF THIS LIBRARY ACCEPT ABSOLUTELY NO LIABILITY FOR - ANY HARM OR LOSS RESULTING FROM ITS USE. IT IS _EXTREMELY_ UNWISE - TO RELY ON SOFTWARE ALONE FOR SAFETY. Any machinery capable of - harming persons must have provisions for completely removing power - from all motors, etc, before persons enter any danger area. All - machinery must be designed to comply with local and national safety - codes, and the authors of this software can not, and do not, take - any responsibility for such compliance. - - This code was written as part of the EMC HAL project. For more - information, go to www.linuxcnc.org. -**/ - -/* - Servo To Go board decls -*/ -#define MAX_CHANS 8 - -#define CNT0_D 0x00 -#define CNT1_D 0x01 -#define CNT0_C 0x02 -#define CNT1_C 0x03 -#define CNT2_D 0x04 -#define CNT3_D 0x05 -#define CNT2_C 0x06 -#define CNT3_C 0x07 -#define CNT4_D 0x08 -#define CNT5_D 0x09 -#define CNT4_C 0x0a -#define CNT5_C 0x0b -#define CNT6_D 0x0c -#define CNT7_D 0x0d -#define CNT6_C 0x0e -#define CNT7_C 0x0f - -#define DAC_0 0x10 -#define DAC_1 0x12 -#define DAC_2 0x14 -#define DAC_3 0x16 -#define DAC_4 0x18 -#define DAC_5 0x1a -#define DAC_6 0x1c -#define DAC_7 0x1e - -#define ADC_0 0x410 -#define ADC_1 0x412 -#define ADC_2 0x414 -#define ADC_3 0x416 -#define ADC_4 0x418 -#define ADC_5 0x41a -#define ADC_6 0x41c -#define ADC_7 0x41e - -#define BRDTST 0x403 - -#define DIO_A 0x400 /* Model 1 */ -#define DIO_B 0x402 /* Model 1 */ -#define DIO_C 0x404 /* Model 1 */ -#define DIO_D 0x401 /* Model 1 */ -#define PORT_A 0x400 /* Model 2, same function as DIO_A */ -#define PORT_B 0x402 /* Model 2, same function as DIO_B */ -#define PORT_C 0x404 /* Model 2, same function as DIO_C */ -#define PORT_D 0x405 /* Model 2, same function as DIO_D */ - -#define CNTRL0 0x401 /* Model 2 */ -#define CNTRL1 0x40f /* Model 2 */ -#define ABC_DIR 0x406 /* Model 2 */ -#define D_DIR 0x407 /* Model 2 */ - -#define MIO_1 0x406 -#define INTC 0x405 -#define MIO_2 0x407 -#define ODDRST 0x407 -#define TIMER_0 0x408 -#define TIMER_1 0x40a -#define TIMER_2 0x40c -#define TMRCMD 0x40e -#define ICW1 0x409 -#define ICW2 0x40b -#define OCW1 0x40b -#define OCW2 0x409 -#define OCW3 0x409 -#define IRR 0x409 -#define ISR 0x409 -#define IMR 0x40b - -#define IDLEN 0x409 -#define SELDI 0x40B -#define IDL 0x40D - -/* - * Some bit masks for various registers for Model 1 - */ -// for IRR, ISR, and IMR -#define IXEVN 0x80 -#define IXODD 0x40 -#define LIXEVN 0x20 -#define LIXODD 0x10 -#define EOC 0x08 -#define TP0 0x04 -#define USR_INT 0x02 -#define TP2 0x01 -// for INTC -#define AUTOZERO 0x80 -#define IXLVL 0x40 -#define IXS1 0x20 -#define IXS0 0x10 -#define USRINT 0x08 -#define IA2 0x04 -#define IA1 0x02 -#define IA0 0x01 - -#endif diff --git a/src/hal/drivers/hal_tiro.c b/src/hal/drivers/hal_tiro.c deleted file mode 100644 index eba33782d3a..00000000000 --- a/src/hal/drivers/hal_tiro.c +++ /dev/null @@ -1,277 +0,0 @@ -/******************************************************************** -* Description: hal_tiro.c -* This is the driver for an ISA (PC104) encoder reading -* board. -* -* Author: Alex Joni -* License: GPL Version 2 -* -* Copyright (c) 2003 All rights reserved. -* -* Last change: -********************************************************************/ - -/** This is the driver for an ISA (PC104) encoder reading board. - The board includes up to 4 channels of LS7166 chips for counting - quadrature encoders. Schematics of the board will be included on - my webpage www.juve.ro. - - Installation of the driver only realtime: - - insmod hal_tiro base=0x300 num_chan=4 - - This code can to some extent be used for the DRO board (with minor - adjustments). If it is required a DRO driver will follow. -*/ - -/** Copyright (C) 2004 Alex Joni - -*/ - -/** Copyright (C) 2003 John Kasunich - -*/ - -/** This program is free software; you can redistribute it and/or - modify it under the terms of version 2 of the GNU General - Public License as published by the Free Software Foundation. - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - THE AUTHORS OF THIS LIBRARY ACCEPT ABSOLUTELY NO LIABILITY FOR - ANY HARM OR LOSS RESULTING FROM ITS USE. IT IS _EXTREMELY_ UNWISE - TO RELY ON SOFTWARE ALONE FOR SAFETY. Any machinery capable of - harming persons must have provisions for completely removing power - from all motors, etc, before persons enter any danger area. All - machinery must be designed to comply with local and national safety - codes, and the authors of this software can not, and do not, take - any responsibility for such compliance. - - This code was written as part of the EMC HAL project. For more - information, go to www.linuxcnc.org. -*/ - -#include /* RTAPI realtime OS API */ -#include /* RTAPI realtime module decls */ -#include /* HAL public API decls */ - -#define FASTIO - -#ifdef FASTIO -#define rtapi_inb inb -#define rtapi_outb outb -#include -#endif - -/* module information */ -MODULE_AUTHOR("Alex Joni"); -MODULE_DESCRIPTION("Driver for Tiro-PC104 board for EMC HAL"); -MODULE_LICENSE("GPL"); -static int base = 0x300; /* board base address */ -RTAPI_MP_INT(base, "board base address"); -static int num_chan = 4; /* number of channels - default = 4 */ -RTAPI_MP_INT(num_chan, "number of channels"); - -/*********************************************************************** -* STRUCTURES AND GLOBAL VARIABLES * -************************************************************************/ - -/* this structure contains the runtime data for a single counter */ - -typedef struct { - hal_sint_t count; /* captured binary count value */ - hal_real_t pos; /* scaled position (floating point) */ - hal_real_t pos_scale; /* parameter: scaling factor for pos */ -} counter_t; - -/* pointer to array of counter_t structs in shmem, 1 per counter */ -static counter_t *counter_array; - -/* other globals */ -static int comp_id; /* component ID */ - -#define DATA(x) (base + (2 * x)) /* Address of Data register */ -#define CTRL(x) (base + (2 * x) + 1) /* Address of Control register */ - -/*********************************************************************** -* LOCAL FUNCTION DECLARATIONS * -************************************************************************/ - -static int export_counter(int num, counter_t * addr); -static void capture(void *arg, long period); -static int LS7166Init(int ch); -static long LS7166Read(int i); - -/*********************************************************************** -* INIT AND EXIT CODE * -************************************************************************/ - -#define MAX_CHAN 4 - -int rtapi_app_main(void) -{ - int n, retval; - - /* test for number of channels */ - if ((num_chan <= 0) || (num_chan > MAX_CHAN)) { - rtapi_print_msg(RTAPI_MSG_ERR, - "TIRO: ERROR: invalid num_chan: %d\n", num_chan); - return -1; - } - /* have good config info, connect to the HAL */ - comp_id = hal_init("hal_tiro"); - if (comp_id < 0) { - rtapi_print_msg(RTAPI_MSG_ERR, "TIRO: ERROR: hal_init() failed\n"); - return -1; - } - /* allocate shared memory for counter data */ - counter_array = hal_malloc(num_chan * sizeof(counter_t)); - if (counter_array == 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "TIRO: ERROR: hal_malloc() failed\n"); - hal_exit(comp_id); - return -1; - } - /* export all the variables for each counter */ - for (n = 0; n < num_chan; n++) { - /* export all vars */ - retval = export_counter(n, &(counter_array[n])); - if (retval != 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "TIRO: ERROR: counter %d var export failed\n", n + 1); - hal_exit(comp_id); - return -1; - } - /* init counter */ - hal_set_si32(counter_array[n].count, 0); - hal_set_real(counter_array[n].pos, 0.0); - hal_set_real(counter_array[n].pos_scale, 1.0); - - /* init counter chip */ - LS7166Init(n); - } - /* export functions */ - retval = hal_export_funct("tiro.capture-position", capture, - counter_array, 1, 0, comp_id); - if (retval != 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "TIRO: ERROR: capture funct export failed\n"); - hal_exit(comp_id); - return -1; - } - rtapi_print_msg(RTAPI_MSG_INFO, - "TIRO: installed %d encoder counters\n", num_chan); - hal_ready(comp_id); - return 0; -} - -void rtapi_app_exit(void) -{ - hal_exit(comp_id); -} - -/*********************************************************************** -* REALTIME ENCODER COUNTING AND UPDATE FUNCTIONS * -************************************************************************/ - -static void capture(void *arg, long period) -{ - counter_t *cntr; - int n; - - cntr = arg; - for (n = 0; n < num_chan; n++) { - - /* capture raw counts to latches */ - hal_set_si32(cntr->count, LS7166Read(n)); - /* scale count to make floating point position */ - hal_set_real(cntr->pos, hal_get_si32(cntr->count) * hal_get_real(cntr->pos_scale)); - /* move on to next channel */ - cntr++; - } - /* done */ -} - - -/*********************************************************************** -* BOARD SPECIFIC FUNCTIONS * -************************************************************************/ -/* - LS7166Init() - Initializes the channel -*/ - -int LS7166Init(int ch) -{ - rtapi_outb(CTRL(ch), 0x49); - rtapi_outb(CTRL(ch), 0xC3); - rtapi_outb(CTRL(ch), 0x80); - return 0; -} - - -/* - LS7166Read() - reads one channel -*/ -long LS7166Read(int i) -{ - union pos_tag { - long l; - struct byte_tag { char b0; char b1; char b2; char b3;} byte; - } pos; - - rtapi_outb(CTRL(i), 0x03); - pos.byte.b0=rtapi_inb(DATA(i)); - pos.byte.b1=rtapi_inb(DATA(i)); - pos.byte.b2=rtapi_inb(DATA(i)); - if (pos.byte.b2 < 0) { - pos.byte.b3 = -1; - } - else { - pos.byte.b3 = 0; - } - return pos.l; -} - -/*********************************************************************** -* LOCAL FUNCTION DEFINITIONS * -************************************************************************/ - -static int export_counter(int num, counter_t * addr) -{ - int retval, msg; - - /* This function exports a lot of stuff, which results in a lot of - logging if msg_level is at INFO or ALL. So we save the current value - of msg_level and restore it later. If you actually need to log this - function's actions, change the second line below */ - msg = rtapi_get_msg_level(); - rtapi_set_msg_level(RTAPI_MSG_WARN); - - /* export pin for counts captured by update() */ - retval = hal_pin_new_si32(comp_id, HAL_OUT, &(addr->count), 0, - "tiro.%d.counts", num); - if (retval != 0) { - return retval; - } - /* export pin for scaled position captured by update() */ - retval = hal_pin_new_real(comp_id, HAL_OUT, &(addr->pos), 0.0, - "tiro.%d.position", num); - if (retval != 0) { - return retval; - } - /* export parameter for scaling */ - retval = hal_param_new_real(comp_id, HAL_RW, &(addr->pos_scale), 1.0, - "tiro.%d.position-scale", num); - if (retval != 0) { - return retval; - } - /* restore saved message level */ - rtapi_set_msg_level(msg); - return 0; -} diff --git a/src/hal/drivers/hal_vti.c b/src/hal/drivers/hal_vti.c deleted file mode 100644 index 7f5cb7c7ce8..00000000000 --- a/src/hal/drivers/hal_vti.c +++ /dev/null @@ -1,968 +0,0 @@ -/******************************************************************** -* Description: hal_vti.c -* This is the driver for the Vigilant Technologies -* PCI-ENCDAC 4 channel controller. -* -* Author: Eric H. Johnson from template by Alex Joni and EMC1 driver -* by Paul C. -* License: GPL Version 2 -* -* Copyright (c) 2006 All rights reserved. -* see below for additional notes -* -* Last change: -********************************************************************/ - -/** This is the driver for Vigilant Technologies (VTI) ENCDAC controller. - The board includes 4 channels of quadrature encoder input, - 4 channels of analog input and output, 8 bits digital I/O plus up to - 128 bits digital I/O on digital expander module, and three - timers with interrupt. - - Installation of the driver only realtime: - - insmod hal_vti num_chan=4 dio="IOiooi" - BNF -> dio="*nI|O|ii|io|oi|oo" - where n=number of enabled I/O ports - - autodetects the address - or - - insmod hal_vti base=0x200 num_chan=4 dio="I|O|ii|io|oi|oo..." - - Check your Hardware manual for your base address (ISA bus only). - - The digital inputs/outputs configuration is determined by a - config string passed to insmod when loading the module. - The format consists of a character string that sets the - direction of each group of pins. Each character or character pair - of the direction string is one of "I", "O", "ii", "io", "oi" or "oo". - The individual and character pair formats may be used interchangeably in - the same string, however the lower case format must always appear in - pairs. The representatiom of each character or character pair is as follows: - - I: 8 (0..7) Inputs - O: 8 (0..7) Outputs - ii: 4 (0..3) Inputs / 4 (4..7) Inputs - io: 4 (0..3) Inputs / 4 (4..7) Outputs - oi: 4 (0..3) Outputs / 4 (4..7) Inputs - oo: 4 (0..3) Outputs / 4 (4..7) Outputs - - There are characters or character pairs equal to the number of I/O - ports (sets of 8 DIO) configured on the ENCDAC board and the expanded - I/O module, where the first port is for the I/O on the ENCDAC board - itself. - - The following items are exported to the HAL. - - Encoders: - Parameters: - float vti..position-scale - - Pins: - s32 vti..counts - float vti..position - -/todo bit vti..enc-index -/todo bit vti..enc-idx-latch -/todo bit vti..enc-latch-index -/todo bit vti..enc-reset-count - - Functions: - void vti..capture_position - - DACs: - Parameters: - float vti..dac-offset - float vti..dac-gain - - Pins: - float vti..dac-value - - Functions: - void vti..dac-write - - ADC: - Parameters: -/totest float vti..adc-offset -/totest float vti..adc-gain - - Pins: -/totest float vti..adc-value - - Functions: -/totest void vti..adc-read - - Digital In: - Pins: - bit vti.in- - bit vti.in--not - - Functions: - void vti.digital-in-read - - Digital Out: - Parameters: - bit vti.out--invert - - Pins: - bit vti.out- - - Functions: - void vti.digital-out-write - -*/ - -/** Copyright (C) 2006 Eric Johnson - -*/ - -/** Copyright (C) 2004 Alex Joni - -*/ - -/** Copyright (C) 2003 John Kasunich - -*/ - -/* Also relates to the EMC1 code (very similar to STGMEMBS.CPP) - work done by Fred Proctor, Will Shackleford */ - -/** This program is free software; you can redistribute it and/or - modify it under the terms of version 2 of the GNU General - Public License as published by the Free Software Foundation. - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - THE AUTHORS OF THIS LIBRARY ACCEPT ABSOLUTELY NO LIABILITY FOR - ANY HARM OR LOSS RESULTING FROM ITS USE. IT IS _EXTREMELY_ UNWISE - TO RELY ON SOFTWARE ALONE FOR SAFETY. Any machinery capable of - harming persons must have provisions for completely removing power - from all motors, etc, before persons enter any danger area. All - machinery must be designed to comply with local and national safety - codes, and the authors of this software can not, and do not, take - any responsibility for such compliance. - - This code was written as part of the EMC HAL project. For more - information, go to www.linuxcnc.org. -*/ - -#include -#include /* RTAPI realtime OS API */ -#include /* RTAPI realtime module decls */ -#include -#include /* HAL public API decls */ -#include "hal_vti.h" /* VTI related defines */ - -/* module information */ -MODULE_AUTHOR("Eric Johnson"); -MODULE_DESCRIPTION - ("Driver for Vigilant Technologies ENCDAC 4 channel controller"); -MODULE_LICENSE("GPL"); -static int num_chan = MAX_CHANS; /* number of channels - default = 4 */ -RTAPI_MP_INT(num_chan, "number of channels"); -static char *dio = "ii"; /* dio config - default = port A&B inputs, port C&D outputs */ -RTAPI_MP_STRING(dio, "dio config string - expects something like IOiooi"); - -/*********************************************************************** - * STRUCTURES AND GLOBAL VARIABLES * -************************************************************************/ - -typedef struct { - hal_bool_t data; /* basic pin for input or output */ - union { - hal_bool_t not; /* pin for inverted data (input only) */ - hal_bool_t invert; /* param for inversion (output only) */ - } io; -} io_pin; - -typedef struct { -/* counter data */ - hal_sint_t count[MAX_CHANS]; /* captured binary count value */ - hal_real_t pos[MAX_CHANS]; /* scaled position (floating point) */ - hal_real_t pos_scale[MAX_CHANS]; /* parameter: scaling factor for pos */ - -/* dac data */ - hal_real_t dac_value[MAX_CHANS]; /* value to be written to dac */ - hal_real_t dac_offset[MAX_CHANS]; /* offset value for DAC */ - hal_real_t dac_gain[MAX_CHANS]; /* gain to be applied */ - -/* adc data */ - // These adc thingies are apparently unused... - hal_real_t adc_value[MAX_CHANS]; /* value to be read from adc */ - hal_real_t adc_offset[MAX_CHANS]; /* offset value for ADC */ - hal_real_t adc_gain[MAX_CHANS]; /* gain to be applied */ - int adc_current_chan; /* holds the currently converting channel */ - -/* dio data */ - io_pin port[MAX_IO_PORTS][PINS_PER_PORT]; /* Holds MAX_IO_PORTS X PINS_PER_PORT - number of discrete I/O points */ - unsigned char dir_bits[MAX_IO_PORTS * 2]; /* remembers config (which port is input which is output) */ - - unsigned char model; - -} vti_struct; - -static vti_struct *vti_driver; -struct pci_dev *dev = NULL; -struct pci_access *device; -volatile struct encoder *encoder = NULL; -volatile struct timer *timer = NULL; -volatile struct dac *dac = NULL; -volatile struct ip *ip = NULL; - -/* other globals */ -static int comp_id; /* component ID */ -static int outpinnum = 0, inputpinnum = 0; -static int diocount = 0; -static rtapi_s32 enc_counts[MAX_CHANS]; - -/*********************************************************************** -* LOCAL FUNCTION DECLARATIONS * -************************************************************************/ -/* helper functions, to export HAL pins & co. */ -static int export_counter(int num, vti_struct * addr); -static int export_dac(int num, vti_struct * addr); -// static int export_adc(int num, vti_struct * addr); -static int export_dio_pins(int io_points); -static int export_pin(int num, int dir, vti_struct * addr); -static int export_input_pin(int pinnum, io_pin * pin); -static int export_output_pin(int pinnum, io_pin * pin); - -/* Board specific functions */ - -/* initializes the vti, takes care of autodetection, all initialisations */ -static int vti_init_card(void); -/* sets up interrupt to be used - unused for now*/ -/*static int vti_set_interrupt(short interrupt);*/ -/* scans possible addresses for vti cards */ -static int vti_autodetect(void); - -/* counter related functions */ -static int vti_counter_init(int channels); -static long vti_counter_read(int i); - -/* dac related functions */ -static int vti_dac_init(int channels); -static int vti_dac_write(int ch, short value); - -/* adc related functions */ -static int vti_adc_init(int channels); -// static int vti_adc_start(void *arg, unsigned short wAxis); -// static short vti_adc_read(void *arg, int ch); - -/* dio related functions */ -static int vti_dio_init(int nibbles); -static int vti_parse_dio(void); - -/* periodic functions registered to HAL */ -static void vti_adcs_read(void *arg, long period); //reads adc data from the board, check long description at the beginning of the function -static void vti_dacs_write(void *arg, long period); //writes dac's to the vti -static void vti_counter_capture(void *arg, long period); //captures encoder counters -static void vti_di_read(void *arg, long period); //reads digital inputs from the vti -static void vti_do_write(void *arg, long period); //writes digital outputs to the vti - -/*********************************************************************** -* INIT AND EXIT CODE * -************************************************************************/ - -#define MAX_CHAN 8 - -int rtapi_app_main(void) -{ - int retval; - - /* test for number of channels */ - if ((num_chan <= 0) || (num_chan > MAX_CHAN)) { - rtapi_print_msg(RTAPI_MSG_ERR, - "VTI: ERROR: invalid num_chan: %d\n", num_chan); - return -1; - } - - /* test for config string */ - if ((dio == 0) || (dio[0] == '\0')) { - rtapi_print_msg(RTAPI_MSG_ERR, "VTI: ERROR: no dio config string\n"); - return -1; - } - - /* have good config info, connect to the HAL */ - comp_id = hal_init("hal_vti"); - if (comp_id < 0) { - rtapi_print_msg(RTAPI_MSG_ERR, "VTI: ERROR: hal_init() failed\n"); - return -1; - } - - /* allocate shared memory for vti data */ - vti_driver = hal_malloc(num_chan * sizeof(vti_struct)); - if (vti_driver == 0) { - rtapi_print_msg(RTAPI_MSG_ERR, "VTI: ERROR: hal_malloc() failed\n"); - hal_exit(comp_id); - return -1; - } - - /* takes care of all initialisations, also autodetection and model if necessary */ - if ((retval=vti_init_card()) != 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "VTI: ERROR: vti_init_card() failed\n"); - hal_exit(comp_id); - return retval; - } - - diocount = vti_parse_dio(); - if (diocount == -1) { - rtapi_print_msg(RTAPI_MSG_ERR, - "VTI: ERROR: bad config info for port.\n"); - return -1; - } - export_dio_pins(diocount); - - vti_dio_init(diocount / 4); - - /* init counter chip */ - if (vti_counter_init(num_chan) == -1) { - rtapi_print_msg(RTAPI_MSG_ERR, - "VTI: ERROR: bad config info counter.\n"); - return -1; - } - - /* init dac chip */ - vti_dac_init(num_chan); - - /* init adc chip */ - vti_adc_init(0); // VTI controller has no ADCs - - /* export functions */ - retval = hal_export_funct("vti.capture-position", vti_counter_capture, - vti_driver, 1, 0, comp_id); - if (retval != 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "VTI: ERROR: vti.counter-capture funct export failed\n"); - hal_exit(comp_id); - return -1; - } - rtapi_print_msg(RTAPI_MSG_INFO, - "VTI: installed %d encoder counters\n", num_chan); - - retval = hal_export_funct("vti.write-dacs", vti_dacs_write, - vti_driver, 1, 0, comp_id); - if (retval != 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "VTI: ERROR: vti.write-dacs funct export failed\n"); - hal_exit(comp_id); - return -1; - } - rtapi_print_msg(RTAPI_MSG_INFO, "VTI: installed %d dacs\n", num_chan); - - retval = hal_export_funct("vti.read-adcs", vti_adcs_read, - vti_driver, 1, 0, comp_id); - if (retval != 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "VTI: ERROR: vti.read-adcs funct export failed\n"); - hal_exit(comp_id); - return -1; - } - rtapi_print_msg(RTAPI_MSG_INFO, "VTI: installed %d adcs\n", 0); - - retval = hal_export_funct("vti.di-read", vti_di_read, - vti_driver, 0, 0, comp_id); - if (retval != 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "VTI: ERROR: vti.di-read funct export failed\n"); - hal_exit(comp_id); - return -1; - } - - rtapi_print_msg(RTAPI_MSG_INFO, - "VTI: installed %d digital inputs\n", inputpinnum); - - retval = hal_export_funct("vti.do-write", vti_do_write, - vti_driver, 0, 0, comp_id); - if (retval != 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "VTI: ERROR: vti.do-write funct export failed\n"); - hal_exit(comp_id); - return -1; - } - rtapi_print_msg(RTAPI_MSG_INFO, - "VTI: installed %d digital outputs\n", outpinnum); - - hal_ready(comp_id); - return 0; -} - -static int vti_parse_dio(void) -{ - int i = 0, nibble = 0; - - if (strlen(dio) == 0) - return 0; - while (i < strlen(dio)) { - switch (dio[i]) { - case 'I': - vti_driver->dir_bits[nibble] = 0; - vti_driver->dir_bits[nibble + 1] = 0; - break; - case 'O': - vti_driver->dir_bits[nibble] = 1; - vti_driver->dir_bits[nibble + 1] = 1; - break; - case 'i': - vti_driver->dir_bits[nibble] = 0; - i++; - if (dio[i] == 'i') - vti_driver->dir_bits[nibble + 1] = 0; - else if (dio[i] == 'o') - vti_driver->dir_bits[nibble + 1] = 1; - else - return -1; - break; - case 'o': - vti_driver->dir_bits[nibble] = 1; - i++; - if (dio[i] == 'i') - vti_driver->dir_bits[nibble + 1] = 0; - else if (dio[i] == 'o') - vti_driver->dir_bits[nibble + 1] = 1; - else - return -1; - break; - default: - return -1; - } - nibble += 2; - i++; - } - return nibble * 4; // Number of IO points defined -} - -void rtapi_app_exit(void) -{ - hal_exit(comp_id); -} - -/*********************************************************************** -* REALTIME ENCODER COUNTING AND UPDATE FUNCTIONS * -************************************************************************/ - -static void vti_counter_capture(void *arg, long period) -{ - vti_struct *vti; - int i; - - vti = arg; - for (i = 0; i < num_chan; i++) { - /* capture raw counts to latches */ - hal_set_si32(vti->count[i], vti_counter_read(i)); - /* scale count to make floating point position */ - if (hal_get_real(vti->pos_scale[i]) < 0.0) { - if (hal_get_real(vti->pos_scale[i]) > -EPSILON) - hal_set_real(vti->pos_scale[i], -1.0);} - else { - if (hal_get_real(vti->pos_scale[i]) < EPSILON) - hal_set_real(vti->pos_scale[i], 1.0); } - hal_set_real(vti->pos[i], hal_get_si32(vti->count[i]) / hal_get_real(vti->pos_scale[i])); - } - /* done */ -} - -/* vti_dacs_write() - writes all dac's to the board - - calls vti_dac_write() */ -static void vti_dacs_write(void *arg, long period) -{ - vti_struct *vti; - double volts; - unsigned short ncounts, i; - - vti = arg; - for (i = 0; i < num_chan; i++) { - /* scale the voltage to be written based on offset and gain */ - volts = - (hal_get_real(vti->dac_value[i]) - hal_get_real(vti->dac_offset[i])) * hal_get_real(vti->dac_gain[i]); - /* compute the value for the DAC, the extra - in there is vti specific */ - ncounts = ((volts / 10) * 0x7fff) + 0x8000; - - /* write it to the card */ - vti_dac_write(i, ncounts); - } -} - -/* The VTI board has no ADCs. Procedure is retained only as a stub, should it be called from - elsewhere in the application. */ - -static void vti_adcs_read(void *arg, long period) -{ - return; -} - -// helper function to extract the data out of a char and place it into HAL data -// written by JMK -static void split_input(unsigned char data, io_pin * dest, int num) -{ - int b; - unsigned char mask; - - /* splits a byte into 'num' HAL pins (and their NOTs) */ - mask = 0x01; - for (b = 0; b < num; b++) { - if (data & mask) { - /* input high, which means FALSE (active low) */ - hal_set_bool(dest->data, 0); - hal_set_bool(dest->io.not, 1); - } else { - /* input low, which means TRUE */ - hal_set_bool(dest->data, 1); - hal_set_bool(dest->io.not, 0); - } - mask <<= 1; - dest++; - } -} - -// helper function to extract the data out of HAL and place it into a char -// written by JMK -unsigned char build_output(io_pin * src, int num) -{ - int b; - unsigned char data, mask; - - data = 0x00; - mask = 0x01; - /* assemble output byte for data port from 'num' source variables */ - for (b = 0; b < num; b++) { - /* get the data, add to output byte */ - if (hal_get_bool(src->data)) { - if (!hal_get_bool(src->io.invert)) { - data |= mask; - } - } else { - if (hal_get_bool(src->io.invert)) { - data |= mask; - } - } - mask <<= 1; - src++; - } - return data; -} - -static void vti_di_read(void *arg, long period) //reads digital inputs from the vti -{ - vti_struct *vti; - int i; - char latchedVal; - - vti = arg; - if (diocount == 0) return; // No DIO enabled - /* Get ENCDAC onboard inputs */ - latchedVal = encoder->DIO; - if (vti->dir_bits[0] == 0) - split_input(latchedVal, &(vti->port[0][0]), 4); - if (vti->dir_bits[1] == 0) - split_input(latchedVal, &(vti->port[0][4]), 4); - - /* Get Extended I/O inputs */ - if (diocount <= 8) return; // No extended I/O enabled - for (i = 1; i < (diocount / 8); i++) { - latchedVal = dac->DIO[i - 1]; - if (vti->dir_bits[i * 2] == 0) - split_input(latchedVal, &(vti->port[i][0]), 4); - if (vti->dir_bits[i * 2 + 1] == 0) - split_input(latchedVal, &(vti->port[i][4]), 4); - } -} - -static void vti_do_write(void *arg, long period) //writes digital outputs to the vti -{ - vti_struct *vti; - int i; - - vti = arg; - /* Write ENCDAC onboard outputs */ - if (diocount == 0) return; // No DIO - encoder->DIO = build_output(&(vti->port[0][0]), 8); - if (diocount <= 8) return; // No extended I/O - - /* Write Extended I/O outputs */ - for (i = 1; i < diocount / 8; i++) { - dac->DIO[i - 1] = build_output(&(vti->port[i][0]), 8); - } - -} - -/*********************************************************************** -* BOARD SPECIFIC FUNCTIONS * -* execute board related things (write/read to/from the vti) * -************************************************************************/ - -/*********************************************************************** -* INIT FUNCTIONS * -************************************************************************/ - -/* - vti_counter_init() - Initializes the channel - - works the same for both cards (vti & STG2) -*/ -static int vti_counter_init(int counters) -{ - - int i, retval=0; - /* export all the variables for each counter, dac */ - for (i = 0; i < counters; i++) { - /* export all vars */ - retval = export_counter(i, vti_driver); - if (retval != 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "VTI: ERROR: counter %d var export failed\n", i + 1); - hal_exit(comp_id); - return -1; - } - /* init counter */ - hal_set_si32(vti_driver->count[i], 0); - hal_set_real(vti_driver->pos[i], 0.0); - hal_set_real(vti_driver->pos_scale[i], 1.0); - } - return 0; -} - -/* - vti_dac_init() - Initializes the dac channel - - works the same for both cards (vti & STG2) -*/ -static int vti_dac_init(int channels) -{ - int retval, i; - - encoder->DAC = DAC_IND_MODE; // Enable DACs for output independent of watchdog - for (i = 0; i < channels; i++) { - retval = export_dac(i, vti_driver); - if (retval != 0) { - rtapi_print_msg(RTAPI_MSG_ERR, - "VTI: ERROR: dac %d var export failed\n", i + 1); - hal_exit(comp_id); - return -1; - } - /* init counter */ - hal_set_real(vti_driver->dac_value[i], 0); - hal_set_real(vti_driver->dac_offset[i], 0.0); - hal_set_real(vti_driver->dac_gain[i], 1.0); - vti_dac_write(i, DAC_ZERO_VOLTS); - } - return 0; -} - -/* vti_adc_init() - Initializes the adc channel */ -/* VTI card has no ADCs. */ - -static int vti_adc_init(int channels) -{ - return 0; -} - -static int vti_dio_init(int nibbles) -{ - unsigned int mask; - int i; - - /* we will select the directions of each port */ - /* First initialize the 8 on board I/O points */ - if (diocount == 0) return 0; // No DIO - encoder->DIO = 0; // Turn all inputs / outputs off - mask = encoder->Interrupt; - mask &= 0xfffffcff; // Mask off direction bits - if (vti_driver->dir_bits[0] == 1) - mask |= 0x00000100; // Set mask for bits 0-3 - if (vti_driver->dir_bits[1] == 1) - mask |= 0x00000200; // Set mask for bits 4-7 - encoder->Interrupt = mask; - /* Now initialize all extended I/O */ - if (diocount <= 8) return 0; // No extended I/O - for (i = 0; i < (diocount - 8) / 8; i++) { - dac->DIO[i] = 0; // Turn all extended I/O off - } - - mask = 0; - for (i = 0; i < 8; i++) { // Set direction for extended I/O points 0..63 - if (vti_driver->dir_bits[(i * 2) + 2] == 1) - mask |= (1 << i); - } - dac->config0 = mask; - mask = 0; - for (i = 0; i < 8; i++) { // Set direction for extended I/O points 64..127 - if (vti_driver->dir_bits[(i * 2) + 18] == 1) - mask |= (1 << i); - } - dac->config1 = mask; - return 0; -} - -/*********************************************************************** -* ACTION FUNCTIONS * -* these do the actual data exchange with the board * -************************************************************************/ - -/* - vti_counter_read() - reads one channel - FIXME - todo, extend to 32 bits in software - - works the same for both cards (vti & STG2) -*/ -static long vti_counter_read(int axis) -{ - unsigned int status; - unsigned int count; - Longword EncData; - static long int lastCount; -// static unsigned short lastdac; - - if ((axis >= MAX_CHANS) || (axis < 0)) { - return 0x80000000; // Return encoder error value - } - lastCount = enc_counts[axis]; - status = encoder->Status; // latch status from vti board - count = encoder->Counter[axis]; // latch count from vti board - - EncData.Long = (long int)enc_counts[axis]; - if (status & (1 << axis)) { - if (status & (1 << (axis + 4))) { - EncData.Word[1] += 1; - } - else { - EncData.Word[1] -= 1; - } - } - - - EncData.Word[0] = count; -// Filter out spurious roll overs / roll unders - if ((EncData.Long - lastCount) > 0x7fff) - EncData.Word[1] -= 1; - else - if ((lastCount - EncData.Long) > 0x7fff) - EncData.Word[1] += 1; - enc_counts[axis] = EncData.Long; - - return EncData.Long; -} - -/* - vti_dac_write() - writes a dac channel -*/ -static int vti_dac_write(int axis, short value) -{ - short junk; - /* write the DAC */ - if ((axis >= MAX_CHANS) || (axis < 0)) { - return -1; - } - - junk = dac->mode; // Read from mode to trigger update dac immediately - dac->dac[axis] = value; // Write dac value - - return 0; -} - -/* int vti_adc_start(void *arg, unsigned short wAxis) -{ - return 0; // VTI card has do ADCs -} */ - -/* static short vti_adc_read(void *arg, int axis) -{ - - return 0; // VTI card has no ADCs -} */ - -/*********************************************************************** -* BOARD INIT FUNCTIONS * -* functions for autodetec, irq init * -************************************************************************/ -/* -static int vti_set_interrupt(short interrupt) -{ - return 0; // No interrupts necessary for VTI board -}*/ - -static int vti_init_card() -{ - int retval=vti_autodetect(); - if (retval == 0) { - encoder = (volatile struct encoder *) - ioremap(pci_resource_start(dev, 2), sizeof(encoder)); - dac = - (volatile struct dac *) ioremap(pci_resource_start(dev, - 4), sizeof(dac)); - timer = - (volatile struct timer *) ioremap(pci_resource_start(dev, - 3), sizeof(timer)); - ip = (volatile struct ip *) ioremap(pci_resource_start(dev, 5), - sizeof(ip)); - } else { - return (retval); - } - rtapi_print_msg(RTAPI_MSG_INFO, "VTI: Encoders mapped to : %p\n", - encoder); - rtapi_print_msg(RTAPI_MSG_INFO, "VTI: DACs mapped to : %p\n", - dac); - rtapi_print_msg(RTAPI_MSG_INFO, "VTI: Timers mapped to : %p\n", - timer); - rtapi_print_msg(RTAPI_MSG_INFO, "VTI: Industry pack mapped to : %p\n", - ip); - encoder->Status = 0; - encoder->Reset = 0; - // all ok - return 0; -} - -/* scans possible addresses for vti cards */ -static int vti_autodetect() -{ - dev = pci_get_device(VENDOR, DEVICE, dev); - if (dev) { - pci_dev_put(dev); - rtapi_print_msg(RTAPI_MSG_INFO, - "VTI: Card detected in slot: %2x\n", PCI_SLOT(dev->devfn)); - return (0); - } else { - rtapi_print_msg(RTAPI_MSG_INFO, "VTI: Exiting with auto detect failed\n"); - return (-ENODEV); - } -} - -/*********************************************************************** -* LOCAL FUNCTION DEFINITIONS * -* these are functions used for exporting various HAL pins/prams * -************************************************************************/ -static int export_counter(int num, vti_struct * addr) -{ - int retval, msg; - /* This function exports a lot of stuff, which results in a lot of - logging if msg_level is at INFO or ALL. So we save the current value - of msg_level and restore it later. If you actually need to log this - function's actions, change the second line below */ - msg = rtapi_get_msg_level(); - rtapi_set_msg_level(RTAPI_MSG_WARN); - /* export pin for counts captured by update() */ - retval = hal_pin_new_si32(comp_id, HAL_OUT, &addr->count[num], - 0, "vti.%d.counts", num); - if (retval != 0) { - return retval; - } - /* export pin for scaled position captured by update() */ - retval = hal_pin_new_real(comp_id, HAL_OUT, &addr->pos[num], - 0.0, "vti.%d.position", num); - if (retval != 0) { - return retval; - } - /* export parameter for scaling */ - retval = hal_param_new_real(comp_id, HAL_RW, &addr->pos_scale[num], - 1.0, "vti.%d.position-scale", num); - if (retval != 0) { - return retval; - } - /* restore saved message level */ - rtapi_set_msg_level(msg); - return 0; -} - -static int export_dac(int num, vti_struct * addr) -{ - int retval, msg; - /* This function exports a lot of stuff, which results in a lot of - logging if msg_level is at INFO or ALL. So we save the current value - of msg_level and restore it later. If you actually need to log this - function's actions, change the second line below */ - msg = rtapi_get_msg_level(); - rtapi_set_msg_level(RTAPI_MSG_WARN); - /* export pin for voltage received by the board() */ - retval = hal_pin_new_real(comp_id, HAL_IN, &addr->dac_value[num], - 0.0, "vti.%d.dac-value", num); - if (retval != 0) { - return retval; - } - /* export parameter for offset */ - retval = hal_param_new_real(comp_id, HAL_RW, &addr->dac_offset[num], - 0.0, "vti.%d.dac-offset", num); - if (retval != 0) { - return retval; - } - /* export parameter for gain */ - retval = hal_param_new_real(comp_id, HAL_RW, &addr->dac_gain[num], - 1.0, "vti.%d.dac-gain", num); - if (retval != 0) { - return retval; - } - - /* restore saved message level */ - rtapi_set_msg_level(msg); - return 0; -} - -/* static int export_adc(int num, vti_struct * addr) -{ - return 0; // No ADCs to export -} */ - -static int export_dio_pins(int io_points) -{ - int i, msg, retval=0; - /* This function exports a lot of stuff, which results in a lot of - logging if msg_level is at INFO or ALL. So we save the current value - of msg_level and restore it later. If you actually need to log this - function's actions, change the second line below */ - if (io_points == 0) return 0; - msg = rtapi_get_msg_level(); - rtapi_set_msg_level(RTAPI_MSG_WARN); - for (i = 0; i < io_points; i++) { - /* point, direction, driver */ - retval |= export_pin(i, vti_driver->dir_bits[i / 4], vti_driver); - } - /* restore saved message level */ rtapi_set_msg_level(msg); - return retval; -} - -static int export_pin(int num, int dir, vti_struct * addr) -{ - int retval; - if (dir != 0) - retval = - export_output_pin(outpinnum++, &(addr->port[num / 8][num % 8])); - else - retval = - export_input_pin(inputpinnum++, &(addr->port[num / 8][num % 8])); - if (retval != 0) - return retval; - return 0; -} -static int export_input_pin(int pinnum, io_pin * pin) -{ - int retval; - /* export read only HAL pin for input data */ - retval = hal_pin_new_bool(comp_id, HAL_OUT, &(pin->data), - 0, "vti.in-%02d", pinnum); - if (retval != 0) - return retval; - /* export additional pin for inverted input data */ - retval = hal_pin_new_bool(comp_id, HAL_OUT, &(pin->io.not), - 1, "vti.in-%02d-not", pinnum); - return retval; -} -static int export_output_pin(int pinnum, io_pin * pin) -{ - int retval; - /* export read only HAL pin for output data */ - retval = hal_pin_new_bool(comp_id, HAL_IN, &(pin->data), - 0, "vti.out-%02d", pinnum); - if (retval != 0) - return retval; - /* export parameter for polarity */ - retval = hal_param_new_bool(comp_id, HAL_RW, &(pin->io.invert), - 0, "vti.out-%02d-invert", pinnum); - return retval; -} diff --git a/src/hal/drivers/hal_vti.h b/src/hal/drivers/hal_vti.h deleted file mode 100644 index 30b72024fed..00000000000 --- a/src/hal/drivers/hal_vti.h +++ /dev/null @@ -1,119 +0,0 @@ -#ifndef VTI_H -#define VTI_H - -/** This is the driver for a Vigilant technologies ENCDAC board. - The board includes 4 channels of quadrature encoder input, - 4 channels of analog output, 8 on board digital I/O, and up - to 128 digital I/O on the expanded I/O module, 3 timers - with interrupt. - - A further 4 quadrature encoder inputs, 4 channels of DAC - output and 8 additional channels of digital I/O are - available through the Industry Pack interface. While some - of the hooks are in place, the IP interface is not - currently supported, nor is the ISA version of the board. - - To Do: Add full support for the Industray pack - Add support for the ISA version of the board. - Add support for timers -**/ - -/** Copyright (C) 2006 Eric H. Johnson - -**/ - -/** This program is free software; you can redistribute it and/or - modify it under the terms of version 2 of the GNU General - Public License as published by the Free Software Foundation. - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - - THE AUTHORS OF THIS LIBRARY ACCEPT ABSOLUTELY NO LIABILITY FOR - ANY HARM OR LOSS RESULTING FROM ITS USE. IT IS _EXTREMELY_ UNWISE - TO RELY ON SOFTWARE ALONE FOR SAFETY. Any machinery capable of - harming persons must have provisions for completely removing power - from all motors, etc, before persons enter any danger area. All - machinery must be designed to comply with local and national safety - codes, and the authors of this software can not, and do not, take - any responsibility for such compliance. - - This code was written as part of the EMC HAL project. For more - information, go to www.linuxcnc.org. -**/ - -/* - Vigilant Technologies' board decls -*/ -#define VENDOR 0x10b5 -#define DEVICE 0x9050 - -#define MAX_CHANS 4 -#define MAX_IO_PORTS 17 -#define PINS_PER_PORT 8 - -#define DAC_DISABLE 0x00a5 -#define DAC_IND_MODE 0x005a -#define DAC_WATCHDOG_MODE 0x000f -#define DAC_ZERO_VOLTS 0x8000 - -#define EPSILON 1e-20 - -/* Structures used by the PCI card */ -struct encoder { - u16 Counter[4]; - u8 Status; // 0x08 - u8 dummy; // dummy space - u16 Reset; // 0x0a - u8 reserved[3]; // dummy space 0x0c - 0x0f - u16 Interrupt; // 0x10 - u16 DAC; // 0x12 - u16 DIO; // 0x14 - }; - -struct timer { - u8 reserved[0x2c]; - u8 ctc0; // 8254 Counter 0 - u8 ctc1; // 8254 Counter 1 - u8 ctc2; // 8254 Counter 2 - u8 control; // 8254 command register - }; - -struct dac { - u8 reserved1[0x13f]; // dummy space - u16 dac[4]; - u16 dac_adj[4]; - u16 mode; - u16 update; - u16 reset; - u8 dummy[0x2a]; // dummy space - u8 DIO[0x10]; // Digital IO channels - u16 config0; // Direction configs for channels 00-63 - u16 config1; // Direction configs for channels 64-127 - u16 status; - }; - -/* IndustryPack mappings - Need to check IF u8 or u16, also check boundary address*/ -struct ip { - u8 ID[0x40]; // IndustryPack ID - The first (12*2) addresses used for ID info - // consult P20 of vip-4encdac.pdf for more info. - u16 IP_int; // Interrupt status - u8 reserved[0x3e]; // dummy space - u16 IO[0x30]; // IndustryPack IO - Only need the first 0x30 address. - // Again, consult manual - Might it be better to use another struct here ?? - // and also for the ID stuff.... - }; - -typedef union -{ - signed long int Long; - signed short int Word[2]; -} Longword; - - -#endif diff --git a/src/hal/drivers/motenc.h b/src/hal/drivers/motenc.h deleted file mode 100644 index efdd4f5f8c7..00000000000 --- a/src/hal/drivers/motenc.h +++ /dev/null @@ -1,146 +0,0 @@ -/****************************************************************************** - * - * Copyright (C) 2005 Peter G. Vavaroutsos - * - * - * Hardware register defines for Vital Systems MOTENC-100 board. - * The board includes an 8 channel quadrature decoder, 8 analog inputs, - * 8 analog outputs, 68 digital inputs, 32 digital outputs, programmable - * timer interrupts, a watch dog timer, and a hardware E-STOP circuit. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General - * Public License as published by the Free Software Foundation. - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * - * THE AUTHORS OF THIS LIBRARY ACCEPT ABSOLUTELY NO LIABILITY FOR - * ANY HARM OR LOSS RESULTING FROM ITS USE. IT IS _EXTREMELY_ UNWISE - * TO RELY ON SOFTWARE ALONE FOR SAFETY. Any machinery capable of - * harming persons must have provisions for completely removing power - * from all motors, etc, before persons enter any danger area. All - * machinery must be designed to comply with local and national safety - * codes, and the authors of this software can not, and do not, take - * any responsibility for such compliance. - * - * This code was written as part of the EMC HAL project. For more - * information, go to www.linuxcnc.org. - * - ******************************************************************************/ - -#ifndef _MOTENC_H_ -#define _MOTENC_H_ - - -#include - - -// Vendor and device ID. -#define MOTENC_VENDOR_ID 0x10B5 // PLX. -#define MOTENC_DEVICE_ID 0x3001 // MOTENC-100. -#define MOTENC_SUB_SYS_VENDOR_ID 0x10B5 // PLX. -#define MOTENC_SUB_SYS_DEVICE_ID 0x9030 // 9030 SMARTarget I/O Accelerator. - -#define MOTENC_PCI_MEM_LEN 512 - -#define MOTENC_NUM_ADC_CHANNELS 8 -#define MOTENC_NUM_DAC_CHANNELS 8 - -#define MOTENC_FPGA_NUM_ENCODER_CHANNELS 4 -#define MOTENC_FPGA_NUM_DIGITAL_INPUTS 36 -#define MOTENC_FPGA_NUM_DIGITAL_OUTPUTS 16 - -#define MOTENC_NUM_FPGA 2 -#define MOTENC_NUM_ENCODER_CHANNELS (MOTENC_NUM_FPGA * MOTENC_FPGA_NUM_ENCODER_CHANNELS) -#define MOTENC_NUM_DIGITAL_INPUTS (MOTENC_NUM_FPGA * MOTENC_FPGA_NUM_DIGITAL_INPUTS - 4) -#define MOTENC_NUM_DIGITAL_OUTPUTS (MOTENC_NUM_FPGA * MOTENC_FPGA_NUM_DIGITAL_OUTPUTS) - - - -typedef struct { - volatile rtapi_s32 encoderCount[MOTENC_FPGA_NUM_ENCODER_CHANNELS]; - volatile rtapi_u32 digitalIo; - volatile rtapi_u32 statusControl; - volatile rtapi_u32 reserved; - volatile rtapi_u32 boardVersion; -} volatile MotencFpgaRegMap; - -// For use with digitalIo reg. -#define MOTENC_DIGITAL_OUT 0x0000FFFF -#define MOTENC_DIGITAL_OUT_SHFT 0 -#define MOTENC_DIGITAL_IN 0xFFFF0000 -#define MOTENC_DIGITAL_IN_SHFT 16 - -// For use with statusControl reg. -#define MOTENC_CONTROL_ENCODER_RESET 0x0000000F -#define MOTENC_CONTROL_ENCODER_RESET_SHFT 0 - -#define MOTENC_STATUS_DIGITAL_IN 0x0000FFFF -#define MOTENC_STATUS_DIGITAL_IN_SHFT 0 -#define MOTENC_STATUS_BOARD_ID 0x00030000 // FPGA 0. -#define MOTENC_STATUS_BOARD_ID_SHFT 16 -#define MOTENC_STATUS_ADC_DONE 0x00040000 -#define MOTENC_STATUS_ESTOP 0x00080000 -#define MOTENC_STATUS_DIGITAL_IN2 0x000F0000 // FPGA 1. -#define MOTENC_STATUS_DIGITAL_IN2_SHFT 16 -#define MOTENC_STATUS_INDEX 0x00F00000 -#define MOTENC_STATUS_INDEX_SHFT 20 -#define MOTENC_STATUS_INDEX_LATCH 0x0F000000 -#define MOTENC_STATUS_INDEX_LATCH_SHFT 24 - -typedef struct { - MotencFpgaRegMap fpga[MOTENC_NUM_FPGA]; - volatile rtapi_u32 timerCompare; - volatile rtapi_u32 timerIrqDisable; - volatile rtapi_u32 timerIrqEnable; - volatile rtapi_u32 watchdogControl; - volatile rtapi_u32 watchdogReset; - volatile rtapi_u32 reserved1[3]; - volatile rtapi_u32 dac[MOTENC_NUM_DAC_CHANNELS]; - volatile rtapi_u32 adcDataCommand; - volatile rtapi_u32 reserved2[7]; - volatile rtapi_u32 adcStartConversion; -} volatile MotencRegMap; - -// For use with watchdogControl reg. -#define MOTENC_WATCHDOG_CTL_TIMEBASE 0x00000001 -#define MOTENC_WATCHDOG_CTL_8MS 0x00000000 -#define MOTENC_WATCHDOG_CTL_16MS 0x00000001 -#define MOTENC_WATCHDOG_CTL_ENABLE 0x00000004 -#define MOTENC_WATCHDOG_CTL_AUTO_RESET 0x00000010 // Reset by DAC writes. - -// For use with watchdogReset reg. -#define MOTENC_WATCHDOG_RESET_VALUE 0x0000005A - -// For use with dac reg. -#define MOTENC_DAC_COUNT_ZERO 0x00001000 // 0 volts. -#define MOTENC_DAC_VOLTS_MIN -10.0 // For converting volts to counts. -#define MOTENC_DAC_VOLTS_MAX 10.0 -#define MOTENC_DAC_SCALE_MULTIPLY -8191.0 // Higher counts are lower voltage. -#define MOTENC_DAC_SCALE_DIVIDE (MOTENC_DAC_VOLTS_MAX - MOTENC_DAC_VOLTS_MIN) - -// For use with adcDataCommand reg. -#define MOTENC_ADC_COMMAND_CHN_0 0 -#define MOTENC_ADC_COMMAND_CHN_0_1 1 -#define MOTENC_ADC_COMMAND_CHN_0_1_2 2 -#define MOTENC_ADC_COMMAND_CHN_0_1_2_3 3 -#define MOTENC_ADC_COMMAND_CHN_4 4 -#define MOTENC_ADC_COMMAND_CHN_4_5 5 -#define MOTENC_ADC_COMMAND_CHN_4_5_6 6 -#define MOTENC_ADC_COMMAND_CHN_4_5_6_7 7 -#define MOTENC_ADC_COMMAND_POWER_DOWN 8 -#define MOTENC_ADC_SIGN_BIT 0x00002000 -#define MOTENC_ADC_SIGN_EXTEND 0xFFFFC000 -#define MOTENC_ADC_VOLTS_MIN -5.0 // For converting counts to volts. -#define MOTENC_ADC_VOLTS_MAX 5.0 -#define MOTENC_ADC_SCALE_MULTIPLY (MOTENC_ADC_VOLTS_MAX - MOTENC_ADC_VOLTS_MIN) -#define MOTENC_ADC_SCALE_DIVIDE 16384.0 - - -#endif diff --git a/src/hal/drivers/opto_ac5.c b/src/hal/drivers/opto_ac5.c deleted file mode 100644 index cb90507bf1b..00000000000 --- a/src/hal/drivers/opto_ac5.c +++ /dev/null @@ -1,432 +0,0 @@ -#include -#include // RTAPI realtime OS API. -#include // RTAPI realtime module decls. -#include // HAL public API decls. -#include "opto_ac5.h" // Hardware dependent defines. - -#ifndef MODULE -#define MODULE -#endif - -#ifdef MODULE -// Module information. -MODULE_AUTHOR("Chris Morley"); -MODULE_DESCRIPTION("Driver for opto22 pci AC5 for EMC HAL"); -MODULE_LICENSE("GPL"); -#endif // MODULE - - -/************************************************************************* - typedefs and defines -*************************************************************************/ - - -// Vendor and device ID. "magic numbers" -#define opto22_VENDOR_ID 0x148a // opto22 corp -#define opto22_pci_AC5_DEVICE_ID 0xac05 // AC5 relay board interface -#define MAX_BOARDS 4 // could be higher uses more memory - -// OFFSETS FROM BASE ADDRESS FOR COMMANDS TO OPTO CARD -// for port 0 -#define CONFIG_WRITE_OFFSET_0 0x00000004 -#define CONFIG_READ_OFFSET_0 0x00000100 -#define DATA_WRITE_OFFSET_0 0X00000008 -#define DATA_READ_OFFSET_0 0X00000300 - -// for port 1 -#define CONFIG_WRITE_OFFSET_1 0x00000014 -#define CONFIG_READ_OFFSET_1 0x00000500 -#define DATA_WRITE_OFFSET_1 0X00000018 -#define DATA_READ_OFFSET_1 0X00000700 - -// These methods are used for initialization. -static int Device_Init(board_data_t *pboard); -static int Device_ExportPinsParametersFunctions(board_data_t *pboard, int comp_id, int boardId); -static int Device_ExportDigitalInPinsParametersFunctions(board_data_t *pboard, int comp_id, int boardId); -static int Device_ExportDigitalOutPinsParametersFunctions(board_data_t *pboard, int comp_id, int boardId); -// These methods are exported to the HAL. -static void Device_DigitalInRead(void *this, long period); -static void Device_DigitalOutWrite(void *this, long period); -/************************************************************************* - Globals -*************************************************************************/ - - -typedef struct { - int comp_id; /* HAL component ID */ - board_data_t *boards[MAX_BOARDS]; - int num_of_boards; -} Driver_t; - -static Driver_t driver; - -// in case no portconfig is given when loading driver -// sets 12 inputs then 12 outputs per port and sets leds (bit 31,32) for output -// could define more variables so the ports of extra cards could be configured differently but -// I doubt if anyone will use more then one card - -static unsigned long portconfig0 = 0Xc0fff000; -RTAPI_MP_LONG(portconfig0, "port 0 i/o configuration number"); -static unsigned long portconfig1 = 0Xc0fff000; -RTAPI_MP_LONG(portconfig1, "port 1 i/o configuration number"); - -/****************************************************************************** - Init and exit code - ******************************************************************************/ - -int rtapi_app_main(void) -{ - int n; - board_data_t *pboard; - struct pci_dev *pDev; - - // Connect to the HAL. - driver.comp_id = hal_init("opto_ac5"); - if (driver.comp_id < 0) { - rtapi_print_msg(RTAPI_MSG_ERR, " ERROR OPTO_AC5--- hal_init() failed\n"); - return(-1); - } - for ( n = 0 ; n < MAX_BOARDS ; n++ ) { - driver.boards[n] = NULL; - } - pDev = NULL; - for ( n = 0 ; n < MAX_BOARDS ; n++ ) - { - // Find a M5I20 card. - pDev = pci_get_device(opto22_VENDOR_ID, opto22_pci_AC5_DEVICE_ID, pDev); - if ( pDev == NULL ) { /* no more boards */break;} - - - /* Allocate HAL memory for the board */ - pboard = (board_data_t *)(hal_malloc(sizeof(board_data_t))); - if ( pboard == NULL ) { - rtapi_print_msg(RTAPI_MSG_ERR, "ERROR OPTO_AC5--- hal_malloc() failed\n"); - rtapi_app_exit(); - return -1; - } - // save pointer - driver.boards[n] = pboard; - - /* gather info about the board and save it */ - pboard->pci_dev = pDev; - pboard->slot = PCI_SLOT(pDev->devfn); - pboard->num = n; - rtapi_print("INFO OPTO_AC5--- Board %d detected in PCI Slot: %2x\n", pboard->num, pboard->slot); - /* region 0 is the 32 bit memory mapped I/O region */ - pboard->len = pci_resource_len(pDev, 0); - pboard->base = ioremap_nocache(pci_resource_start(pDev, 0), pboard->len); - if ( pboard->base == NULL ) { - rtapi_print_msg(RTAPI_MSG_ERR, - "ERROR OPTO_AC5--- could not find board %d PCI base address\n", pboard->num ); - rtapi_app_exit(); - return -1; - } else { - rtapi_print( - "INFO OPTO_AC5--- board %d mapped to %08lx, Len = %ld\n", - pboard->num, (long)pboard->base,(long)pboard->len); - } - // Initialize device. - if(Device_Init(pboard)){ - hal_exit(driver.comp_id); - return(-1); - } - - // Export pins, parameters, and functions. - if(Device_ExportPinsParametersFunctions(pboard, driver.comp_id, n)){ - hal_exit(driver.comp_id); - return(-1); - } - - } - - if(n == 0){ - /* No cards detected */ - rtapi_print ("ERROR OPTO_AC5--- No opto PCI-AC5 card(s) detected\n"); - rtapi_app_exit(); - return(-1); - } - - hal_ready(driver.comp_id); - return(0); -} - -// here we turn the leds and outputs off and unmap the pci driver -void rtapi_app_exit(void) -{ - int n; - board_data_t *pDevice; - - pDevice = driver.boards[0]; - - - hal_exit(driver.comp_id); - for ( n = 0; n < MAX_BOARDS; n++ ) - { - if ( driver.boards[n] != NULL) - { - rtapi_print ("INFO OPTO_AC5--- board %i driver removed.\n",n); - writel(0XC0FFFFFF, driver.boards[n]->base + (DATA_WRITE_OFFSET_0)); - writel(0XC0FFFFFF, driver.boards[n]->base + (DATA_WRITE_OFFSET_1)); - // Unmap board memory - if ( driver.boards[n]->base != NULL ) - { - iounmap(driver.boards[n]->base); - } - } - } -} - -/****************************************************************************** - * DEVICE OBJECT FUNCTION DEFINITIONS - ******************************************************************************/ - -/* - * LOCAL FUNCTIONS - */ -static int Device_Init(board_data_t *pboard) -{ - - // Initialize hardware. -// portconfig[0 or 1] are either the default number from global or mapped from the command line -// make sure last two bits are set for output so leds will work - - if ((portconfig0 & 0x80000000) ==0) { portconfig0 |=0x80000000; } - if ((portconfig0 & 0x40000000) ==0) { portconfig0 |=0x40000000; } - if ((portconfig1 & 0x80000000) ==0) { portconfig1 |=0x80000000; } - if ((portconfig1 & 0x40000000) ==0) { portconfig1 |=0x40000000; } - writel(portconfig0, pboard->base + (CONFIG_WRITE_OFFSET_0)); - writel(portconfig1, pboard->base + (CONFIG_WRITE_OFFSET_1)); - - // Initialize digital I/O structure mask. - - pboard->port[0].mask = portconfig0; - pboard->port[1].mask = portconfig1; - - return(0); -} - -static int Device_ExportPinsParametersFunctions(board_data_t *this, int componentId, int boardId) -{ - int msgLevel, error=0; - -// This function exports a lot of stuff, which results in a lot of -// logging if msg_level is at INFO or ALL. So we save the current value -// of msg_level and restore it later. If you actually need to log this -// function's actions, change the second line below. - - msgLevel = rtapi_get_msg_level(); - rtapi_set_msg_level(RTAPI_MSG_WARN); - -// Export digital I/O. - - if(!error) error = Device_ExportDigitalInPinsParametersFunctions(this, componentId, boardId); - if(!error) error = Device_ExportDigitalOutPinsParametersFunctions(this, componentId, boardId); - -// Restore saved message level. - - rtapi_set_msg_level(msgLevel); - - return(error); -} - -// we check each ports mask (port[portnum].mask) against a mask bit to see which of the 24 points of i/o are inputs (a false bit is an input) -// then export HAL pins mapped to the proper io structure -// HAL pin numbers represent position in an opto22 relay rack (eg. pin 00 is position 0) -// this way you can configure the i/o in any way for all the 24 points of each port - -static int Device_ExportDigitalInPinsParametersFunctions(board_data_t *this, int comp_id, int boardId) -{ - int halError=0, channel,mask,portnum=0; - - // Export pins and parameters. - while (portnum<2) - { - mask=1; - for(channel = 0; channel < 24; channel++) - { - if ((this->port[portnum].mask & mask)==0)//physical input? - { - // Pins. - if((halError = hal_pin_new_bool(comp_id, HAL_OUT, &(this->port[portnum].io[channel].pValue), - 0, "opto-ac5.%d.port%d.in-%02d", boardId, portnum, channel)) != 0) - break; - - if((halError = hal_pin_new_bool(comp_id, HAL_OUT, &(this->port[portnum].io[channel].pValueNot), - 1, "opto-ac5.%d.port%d.in-%02d-not", boardId, portnum, channel)) != 0) - break; - } - mask <<=1; - } - - portnum ++; - } - - // Export functions. - if(!halError){ - halError = hal_export_functf(Device_DigitalInRead, this, 0, 0, comp_id, "opto-ac5.%d.digital-read", boardId); - } - - if(halError){ - rtapi_print_msg(RTAPI_MSG_ERR, "ERROR OPTO22_AC5---exporting digital inputs to HAL failed\n"); - return(-1); - } - - return(0); -} - - -// we check each ports mask (port[portnum].mask) against a mask bit to see which of the 24 points of i/o are outputs (a true bit is an output) -// then export HAL pins mapped to the proper io structure -// this way you can configure the i/o in any way for all the 24 points of each port -// HAL pin numbers represent position in an opto22 relay rack (eg. pin 00 is position 0) -// the LEDS are bits 31 and 32 of the portmask but are mapped to 24 and 25 of the i0 structure - -static int Device_ExportDigitalOutPinsParametersFunctions(board_data_t *this, int comp_id, int boardId) -{ - int halError=0, channel,mask,portnum=0; - - // Export pins and parameters. - - while (portnum<2) - { - mask=1; - for(channel = 0; channel < 24; channel++) - { - if ((this->port[portnum].mask & mask)!=0)//phyical output? - { - // Pins. - if((halError = hal_pin_new_bool(comp_id, HAL_IN, &(this->port[portnum].io[channel].pValue), - 0, "opto-ac5.%d.port%d.out-%02d", boardId, portnum, channel)) != 0) - break; - - // Parameters. - if((halError = hal_param_new_bool(comp_id, HAL_RW, &(this->port[portnum].io[channel].invert), - 0, "opto-ac5.%d.port%d.out-%02d-invert", boardId, portnum, channel)) != 0) - break; - } - mask <<=1; - } - portnum++; - } - // led Pins. - portnum=0; - for(channel = 0; channel < 2; channel++) - { - if((halError = hal_pin_new_bool(comp_id, HAL_IN, &(this->port[portnum].io[24].pValue), - 0, "opto-ac5.%d.led%d", boardId, channel+portnum)) != 0) - break; - - if((halError = hal_pin_new_bool(comp_id, HAL_IN, &(this->port[portnum].io[25].pValue), - 0, "opto-ac5.%d.led%d", boardId, channel+portnum+1)) != 0) - break; - portnum++; - } - // Export functions. - if(!halError){ - halError = hal_export_functf(Device_DigitalOutWrite, this, 0, 0, comp_id, "opto-ac5.%d.digital-write", boardId); - } - - if(halError){ - rtapi_print_msg(RTAPI_MSG_ERR, "ERROR OPTO_AC5---exporting digital outputs to HAL failed\n"); - return(-1); - } - - return(0); -} - -// here we read inputs from board -// we read the current data (variable 'pins') of the first port. Then for each of the 24 points -// we compare to the mask of the first port to see which of the 24 io points are inputs (the bits that are false) -// if it is an input then check 'pins' against the mask to see if input bit is true -// update the HAL pin and not-pin accordingly. shift the mask then do the next point (of 24 io points) -// after all pins done-increase 'portnum' to 1 set offset to the offset for port1 -// then do it all again on the second port - -static void -Device_DigitalInRead(void *arg, long period) -{ - board_data_t *pboard = (board_data_t *)arg; - DigitalPinsParams *pDigital; - int i, portnum=0; - unsigned long pins, offset=DATA_READ_OFFSET_0, mask; - - // For each port. - while (portnum<2) - { - mask=1; - pDigital = &pboard->port[portnum].io[0]; - - // Read digital I/O register. - pins= readl (pboard->base + (offset)); - for(i = 0; i < 24; i++,pDigital++) - { - if ((pboard->port[portnum].mask & mask) ==0) // is it an input bit ? - { - if ((pins & mask) !=0){ hal_set_bool(pDigital->pValue, 0); - }else{ hal_set_bool(pDigital->pValue, 1); } - // Update not pin. - hal_set_bool(pDigital->pValueNot, !hal_get_bool(pDigital->pValue)); - } - mask <<=1;// shift mask - } - portnum++; - offset=DATA_READ_OFFSET_1;// change to offset for port1 - } -} - -// here we output data and update LEDS -// we look at the mask of the first port to see which of the 24 io points are outputs (the bits that are true) -// then check the OUT HAL pins to see if output should be on and if it should - OR the bit (using 'mask') to the variable 'pins' -// then set 'mask' to the last bit (32) and check the HAL led pin to see if true- OR the bit to 'pins' if it is -// set 'mask to second to second to last bit (31) do the same -// have to remember that a 1 sent to the hardware turns an output OFF -// finally write the variable 'pins' to the boards first port -// reset offset to the next port offset, increase portnum for port 1 -// then do it all again on the second port - -static void -Device_DigitalOutWrite(void *arg, long period) -{ - board_data_t *pboard = (board_data_t *)arg; - DigitalPinsParams *pDigital; - int portnum=0; - unsigned int i,j; - unsigned long pins, offset=DATA_WRITE_OFFSET_0,mask; - - // For each port. - while (portnum<2) - { - pDigital = &pboard->port[portnum].io[0]; - mask=1; - pins=0; - - // For each pin. - for(j = 0; j < 24; j++, pDigital++) - { - if ((pboard->port[portnum].mask & mask) !=0) //is it an output? - { - // add mask to pins if HAL pin + invert =true. - if( (!hal_get_bool(pDigital->pValue) && !hal_get_bool(pDigital->invert) ) || - ( hal_get_bool(pDigital->pValue) && hal_get_bool(pDigital->invert) )) - { pins |= mask; } - } - mask <<=1; // shift mask - - } - - // CHECK LED PINS - pDigital = &pboard->port[portnum].io[23];//one before what we want to check - for (i = 0; i < 2; i++) - { - mask = (unsigned int) 1 << (31-i); - pDigital++; - - if ( hal_get_bool(pDigital->pValue) == 0 ) { pins |= mask; } - } - // Write digital I/O register. - writel(pins,pboard->base + (offset)); - portnum++; - offset=DATA_WRITE_OFFSET_1; // set to port1 offset - } -} - diff --git a/src/hal/drivers/opto_ac5.h b/src/hal/drivers/opto_ac5.h deleted file mode 100644 index eab07dac2a9..00000000000 --- a/src/hal/drivers/opto_ac5.h +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2005-2008, various authors -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -/************************************************************************* - -Header for opto22 pci AC5 board driver - -Copyright (C) 2008 Chris Morley - -*************************************************************************/ - -#include - -/* code assumes that PINS_PER_PORT is <= 24 */ -//there are 2 ports on a opto22 pci AC5 card -//number of i/o per board = 48 + 4 LEDS -#define OPTO_NUM_DIGITAL 52 - -/************************************************************************* - Data Structures -*************************************************************************/ -typedef struct DigitalPinsParams { - // Pins. - hal_bool_t pValue; - hal_bool_t pValueNot; - // Parameters. - hal_bool_t invert; -} DigitalPinsParams; - - - -typedef struct port_t { - __u32 mask; - struct DigitalPinsParams io[OPTO_NUM_DIGITAL/2]; -} port_t; - - - - -/* master board structure */ -typedef struct board_data_t { - struct pci_dev *pci_dev; /* PCI bus info */ - int slot; /* PCI slot number */ - int num; /* HAL board number */ - void __iomem *base; /* base address */ - int len; /* length of address space*/ - struct port_t port[2]; - - -} board_data_t; - -/************************************************************************* - Globals -*************************************************************************/ - -//extern int comp_id; /* HAL component ID */ - - -/************************************************************************* - Functions -*************************************************************************/ - - - diff --git a/src/hal/drivers/pci_8255.c b/src/hal/drivers/pci_8255.c deleted file mode 100644 index 682a9e09cf9..00000000000 --- a/src/hal/drivers/pci_8255.c +++ /dev/null @@ -1,389 +0,0 @@ -// Copyright (C) 2008 Jeff Epler -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -#include -#include -#include -#include - -#define MAX 16 - -MODULE_LICENSE("GPL"); -int io[MAX] = {0,}; -int dir[MAX] = {0,}; -RTAPI_MP_ARRAY_INT(io, MAX, "I/O addresses of 8255s"); -RTAPI_MP_ARRAY_INT(dir, MAX, "I/O direction of 8255s"); - -static int comp_id; - -union inv { hal_bool_t not_; hal_bool_t invert; }; - -struct port { - hal_bool_t a[8]; - hal_bool_t b[8]; - hal_bool_t c[8]; - union inv ai[8]; - union inv bi[8]; - union inv ci[8]; - hal_uint_t dir_; - hal_uint_t ioaddr; -}; - -struct state { - struct port ports[3]; - hal_bool_t relay; - hal_bool_t relay_invert; - hal_uint_t ioaddr; -}; - -static void read(struct port *inst, long period); -static void write(struct port *inst, long period); -static void write_relay(struct state *inst, long period); -static void write_all(struct state *inst, long period); -static void read_all(struct state *inst, long period); - -static void extra_cleanup(void); - -#include -#define SHIFT 4 -static inline void pci_8255_outb(int value, rtapi_u32 base, int offset) { - // int *mem = (int*) base; - outb(value, base + SHIFT*offset); - // mem[offset] = value; -} - -static inline int pci_8255_inb(rtapi_u32 base, int offset) { - return inb(base + SHIFT*offset); - // int *mem = (int*) base; - // return mem[offset]; -} - - -static int export(char *prefix, struct port *inst, int ioaddr, int dir) { - int r = 0; - int i; - hal_pin_dir_t direction; - int sz = sizeof(struct port); - memset(inst, 0, sz); - if(0 != (r = hal_param_new_fake(comp_id, (hal_refs_u *)&inst->ioaddr))) - return r; - hal_set_ui32(inst->ioaddr, ioaddr); - - if(dir & 8) direction = HAL_OUT; else direction = HAL_IN; - for(i=0; i<8; i++) { - r = hal_pin_new_bool(comp_id, direction, &(inst->a[i]), 0, - "%s.a%d", prefix, i); - if(r != 0) return r; - if(direction == HAL_OUT) { - r = hal_pin_new_bool(comp_id, direction, &(inst->ai[i].not_), 0, - "%s.a%d-not", prefix, i); - } else { - r = hal_param_new_bool(comp_id, HAL_RW, &(inst->ai[i].invert), 0, - "%s.a%d-invert", prefix, i); - } - if(r != 0) return r; - } - if(dir & 2) direction = HAL_OUT; else direction = HAL_IN; - for(i=0; i<8; i++) { - r = hal_pin_new_bool(comp_id, direction, &(inst->b[i]), 0, - "%s.b%d", prefix, i); - if(r != 0) return r; - if(direction == HAL_OUT) { - r = hal_pin_new_bool(comp_id, direction, &(inst->bi[i].not_), 0, - "%s.b%d-not", prefix, i); - } else { - r = hal_param_new_bool(comp_id, HAL_RW, &(inst->bi[i].invert), 0, - "%s.b%d-invert", prefix, i); - } - if(r != 0) return r; - } - for(i=0; i<8; i++) { - if(i < 4) { - if(dir & 1) direction = HAL_OUT; - else direction = HAL_IN; - } else { - if(dir & 4) direction = HAL_OUT; - else direction = HAL_IN; - } - r = hal_pin_new_bool(comp_id, direction, &(inst->c[i]), 0, - "%s.c%d", prefix, i); - if(r != 0) return r; - if(direction == HAL_OUT) { - r = hal_pin_new_bool(comp_id, direction, &(inst->ci[i].not_), 0, - "%s.c%d-not", prefix, i); - } else { - r = hal_param_new_bool(comp_id, HAL_RW, &(inst->ci[i].invert), 0, - "%s.c%d-invert", prefix, i); - } - if(r != 0) return r; - } - r = hal_param_new_ui32(comp_id, HAL_RO, &(inst->dir_), dir, - "%s.dir", prefix); - if(r != 0) return r; - r = hal_export_functf((void(*)(void *inst, long))read, inst, 0, 0, comp_id, "%s.read", prefix); - if(r != 0) return r; - r = hal_export_functf((void(*)(void *inst, long))write, inst, 0, 0, comp_id, "%s.write", prefix); - if(r != 0) return r; - - rtapi_print_msg(RTAPI_MSG_DBG, "registering %s ... %x %x\n", prefix, - (dir&3) | ((dir & 0xc) << 1) | 0x80, ioaddr); - - pci_8255_outb((dir&3) | ((dir & 0xc) << 1) | 0x80, ioaddr, 3); - - return 0; -} - -static struct state *inst = 0; -static int count = 0; - -static void write_relay(struct state *inst, long period) { - int val = (!hal_get_bool(inst->relay)) ^ (!hal_get_bool(inst->relay_invert)); - // relay is active low - if(val) { - pci_8255_outb(0, hal_get_ui32(inst->ioaddr), 3); - } else { - pci_8255_outb(0x10, hal_get_ui32(inst->ioaddr), 3); - } -} - -static void write_all(struct state *inst, long period) { - int i; - for(i=0; i> (4*j)) & 0xf); - if(r != 0) goto out_error; - } - hal_pin_new_bool(comp_id, HAL_IN, &(inst[i].relay), 0, "pci8255.%d.relay", i); - hal_param_new_bool(comp_id, HAL_RW, &(inst[i].relay_invert), 0, - "pci8255.%d.relay-invert", i); - r = hal_export_functf((void(*)(void *inst, long))write_relay, &inst[i], 0, 0, comp_id, "pci8255.%d.write-relay", i); - if(r != 0) return r; - } - r = hal_export_funct("pci8255.read-all", (void(*)(void *inst, long))read_all, inst, 0, 0, comp_id); - r = hal_export_funct("pci8255.write-all", (void(*)(void *inst, long))write_all, inst, 0, 0, comp_id); -out_error: - if(r) { - extra_cleanup(); - hal_exit(comp_id); - } else { - hal_ready(comp_id); - } - return r; -} - -void rtapi_app_exit(void) { - extra_cleanup(); - hal_exit(comp_id); -} - -#define FUNCTION(name) static void name(struct state *inst, long period) -#define EXTRA_CLEANUP() static void extra_cleanup(void) -#define fperiod (period * 1e-9) -#define a(i) (hal_get_bool(inst->a[(i)])) -#define b(i) (hal_get_bool(inst->b[(i)])) -#define c(i) (hal_get_bool(inst->c[(i)])) -#define a_set(i,v) (hal_set_bool(inst->a[(i)], (v))) -#define b_set(i,v) (hal_set_bool(inst->b[(i)], (v))) -#define c_set(i,v) (hal_set_bool(inst->c[(i)], (v))) -#define ai_invert(i) (hal_get_bool(inst->ai[i].invert)) -#define bi_invert(i) (hal_get_bool(inst->bi[i].invert)) -#define ci_invert(i) (hal_get_bool(inst->ci[i].invert)) -#define ai_not_set(i,v) (hal_set_bool(inst->ai[(i)].not_, (v))) -#define bi_not_set(i,v) (hal_set_bool(inst->bi[(i)].not_, (v))) -#define ci_not_set(i,v) (hal_set_bool(inst->ci[(i)].not_, (v))) -#define ioaddr (inst->ioaddr) -#define dir_ (inst->dir_) - -#include - -int get_count(void) { - int i = 0; - for(i=0; i -#define MAX_CHAN 8 - -static int ioaddr[MAX_CHAN] = {-1, -1, -1, -1, -1, -1, -1, -1}; -RTAPI_MP_ARRAY_INT(ioaddr, MAX_CHAN, "Base addresses") - -FUNCTION(read){ - unsigned R; - int i; - R = inb(base_addr) - + (inb(base_addr + 1) << 8) - + (inb(base_addr + 2) << 16) - + (inb(base_addr + 3) << 24); - - for (i = 0;i <= 31;i++){ - pin_in_set(i, R & (1 << i)); - pin_in_not_set(i, !pin_in(i)); - } -} - -FUNCTION(write){ - int i; - unsigned char b; - out = 0; - inv = 0; - for (i = 0;i <= 31 ;i++){ - out |= pin_out(i) << i; - inv |= pin_out_invert(i) << i; - } - - out ^= inv; - - b = (out & 0xff); - outb(b, base_addr); - b = (out & 0xff00) >> 8; - outb(b, base_addr + 1); - b = (out & 0xff0000) >> 16; - outb(b, base_addr + 2); - b = (out & 0xff000000) >> 24; - outb(b, base_addr + 3); - - write_time = rtapi_get_time(); -} - -FUNCTION(reset){ - int i; - unsigned tmp; - unsigned char b; - - res= 0; - for (i = 0;i <= 31 ;i++){ - res |= pin_reset(i) << i; - } - - if (res == 0) {return;} // no pins with reset set - - tmp = (out ^ inv) & (~res); - if (tmp == out) {return;} // nothing to reset - - if(reset_time > period/4) reset_time_set(period/4); - - //compensate for any time elapsed since the write - rtapi_delay(reset_time - (rtapi_get_time() - write_time)); - - b = (tmp & 0xff); - outb(b, base_addr); - b = (tmp & 0xff00) >> 8; - outb(b, base_addr + 1); - b = (tmp & 0xff0000) >> 16; - outb(b, base_addr + 2); - b = (tmp & 0xff000000) >> 24; - outb(b, base_addr + 3); - - out = tmp; -} - - -EXTRA_SETUP(){ - - if (ioaddr[extra_arg] > 0) { - base_addr = ioaddr[extra_arg]; - rtapi_print("Loading Advantech pcl720 driver at base addr %X\n", base_addr); - return 0; - } - return -EINVAL; -} - - -int get_count(void){ - int i; - for (i=0; ioaddr[i] > 0 && i < MAX_CHAN; i++){} - return i; -} diff --git a/src/hal/drivers/pluto_common.h b/src/hal/drivers/pluto_common.h deleted file mode 100644 index 9c6bad1eb17..00000000000 --- a/src/hal/drivers/pluto_common.h +++ /dev/null @@ -1,181 +0,0 @@ -// Copyright (C) 2007 Jeff Epler -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -#if !defined(__KERNEL__) -#include -#include -#else -#include -#endif - -#include "hal/hal_parport.h" - -int ioaddr = 0x378; -int ioaddr_hi = 0; -int epp_wide = 1; -int watchdog = 1; -struct hal_parport_t portdata; - -RTAPI_MP_INT(ioaddr, "Address of parallel port where pluto-p is attached"); -RTAPI_MP_INT(ioaddr_hi, - "Secondary address of parallel port (0 to use ioaddr+0x400)"); -RTAPI_MP_INT(epp_wide, "Use 16- and 32-bit EPP transfers with hardware EPP"); -RTAPI_MP_INT(watchdog, - "Enable hardware watchdog to tristate outputs if EMC crashes"); - -#ifndef llabs // linux/kernel.h may provide labs for realtime systems -static int64_t llabs(int64_t l) { if(l < 0) return -l; return l; } -#endif - -static inline int64_t extend(int64_t old, int newlow, int nbits) { - int64_t mask = (1< maxdelta) - return candidate2; - else - return candidate1; -} - -static inline void EPP_DIR_WRITE(void) { } -static inline void EPP_DIR_READ(void) { } -static inline void EPP_ADDR(int w) { - outb(w, ioaddr+3); -} - -static inline void EPP_WRITE(int w) { - outb(w, ioaddr+4); -} - -static inline int EPP_READ(void) { - return inb(ioaddr+4); -} - - -static inline __u32 read32(void) { - unsigned char a, b, c, d; - - if(epp_wide) - return inl(ioaddr+4); - - a = EPP_READ(); - b = EPP_READ(); - c = EPP_READ(); - d = EPP_READ(); - - return a + (b<<8) + (c<<16) + (d<<24); -} - -static inline void write32(long w) { - if(epp_wide) { - outl(w, ioaddr+4); - return; - } - - EPP_WRITE(w); - EPP_WRITE(w >> 8); - EPP_WRITE(w >> 16); - EPP_WRITE(w >> 24); -} - -static inline void write16(int w) { - if(epp_wide) { - outw(w, ioaddr+4); - return; - } - - EPP_WRITE(w & 0xff); - EPP_WRITE(w >> 8); -} - - -#define FIRMWARE_SIZE 19895 -static void pluto_program(unsigned char firmware[FIRMWARE_SIZE]) { - int byte, bit; - int i; - rtapi_print_msg(RTAPI_MSG_INFO, "uploading firmware\n"); - - // pull the reset low -- bit 2 of status register - // keep it low 2 microseconds - for(i=0; i<4; i++) outb(0, ioaddr+2); - - // let it go high again - // delay 10 microseconds to guarantee nStatus high - for(i=0; i<20; i++) outb(4, ioaddr+2); - - // Now program the device... - for(byte = 0; byte < FIRMWARE_SIZE; byte++) { - for(bit = 0; bit < 8; bit++) { - int v = firmware[byte] & (1< -min_dc && value < 0) value = -min_dc; - else if(value > 0 && value < min_dc) value = min_dc; - else if(value > max_dc) value = max_dc; - - value = 2047 * value; - if(value < -2047) value = -2047; - if(value > 2047) value = 2047; - - if(value < 0) { - if(is_pwmdir) { - result = (1<<13) | (int)(-value); - } else { - result = (1<<15) | (int)(-value); - } - } else result = value; - if(is_pdm) result |= 1<<14; - if(dio0) result ^= 1<<12; - if(dio1) result ^= 1<<13; - - return result; -} - -FUNCTION(write) { - int r = 0; - int i; - if(communication_error) return; - - EPP_ADDR(0); - - for(i=0; i<4; i++) { - if(pwm_max_dc(i) > 1) pwm_max_dc_set(i, 1); - else if(pwm_max_dc(i) < 0) pwm_max_dc_set(i, 0); - if(pwm_min_dc(i) < 0) pwm_min_dc_set(i, 0); - else if(pwm_min_dc(i) > pwm_max_dc(i)) pwm_min_dc_set(i, pwm_max_dc(i)); - } - -#define D(x) (!dout(x) ^ !dout_invert(x)) -#define P(x,y) PWM(pwm_enable(x), pwm_value(x), pwm_offset(x), pwm_scale(x), \ - pwm_min_dc(x), pwm_max_dc(x), D(y), D(y+1), pwm_is_pdm, pwm_pwmdir(x)) - write32( P(0,10) | (P(1, 12) << 16)); - write32( P(2,14) | (P(3, 16) << 16)); - - for(i=0; i<10; i++) { - if(!dout(i) ^ !dout_invert(i)) r |= (1<> W) & MASK; - indexed = ppdata & (1<<(2*W)); - - count = extend(data.last_count[i], newlow, W); - if(indexed) - index = extend(count, indlow, W); - else - index = data.last_index[i]; - - if(encoder_index_enable(i) && indexed) { - encoder_index_enable_set(i, 0); - data.reset_count[i] = index; - } - if(reset) encoder_velocity_set(i, 0); - else encoder_velocity_set(i, (count - data.last_count[i]) / - encoder_scale(i) / fperiod); - data.last_index[i] = index; - data.last_count[i] = count; - if(reset) data.reset_count[i] = count; - encoder_count_set(i, count - data.reset_count[i]); - encoder_position_set(i, encoder_count(i) / encoder_scale(i)); - - if(i == 0) { - debug_0_set(ppdata); debug_1_set(count); - } - } - - ppdata = read32(); - - for(i=0; i< 20; i++) { - int b = ppdata & (1< -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -QUARTUS_VERSION = "6.0" -DATE = "09:23:55 December 23, 2006" -PROJECT_REVISION = "pluto_servo" diff --git a/src/hal/drivers/pluto_servo_firmware/pluto_servo.qsf b/src/hal/drivers/pluto_servo_firmware/pluto_servo.qsf deleted file mode 100644 index 4e0e96145bb..00000000000 --- a/src/hal/drivers/pluto_servo_firmware/pluto_servo.qsf +++ /dev/null @@ -1,103 +0,0 @@ -# This is a component of pluto_servo, a PWM servo driver and quadrature -# counter for emc2 -# Copyright 2006 Jeff Epler -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -set_global_assignment -name ALLOW_ANY_ROM_SIZE_FOR_RECOGNITION ON -set_global_assignment -name ALLOW_ANY_SHIFT_REGISTER_SIZE_FOR_RECOGNITION ON -set_global_assignment -name ALLOW_POWER_UP_DONT_CARE OFF -set_global_assignment -name AUTO_IMPLEMENT_IN_ROM ON -set_global_assignment -name AUTO_PACKED_REGISTERS "MINIMIZE AREA" -set_global_assignment -name DEVICE "EP1K10TC100-3" -set_global_assignment -name ENABLE_INIT_DONE_OUTPUT OFF -set_global_assignment -name FAMILY ACEX1K -set_global_assignment -name FMAX_REQUIREMENT "40 MHz" -set_global_assignment -name FMAX_REQUIREMENT "40 MHz" -section_id clk -set_global_assignment -name GENERATE_RBF_FILE ON -set_global_assignment -name IGNORE_CASCADE_BUFFERS ON -set_global_assignment -name IGNORE_CLOCK_SETTINGS OFF -set_global_assignment -name IGNORE_LCELL_BUFFERS ON -set_global_assignment -name LAST_QUARTUS_VERSION "6.0 SP1" -set_global_assignment -name MESSAGE_SUPPRESSION_RULE_FILE pluto_servo.srf -set_global_assignment -name OPTIMIZE_HOLD_TIMING OFF -set_global_assignment -name ORIGINAL_QUARTUS_VERSION "6.0 SP1" -set_global_assignment -name PROJECT_CREATION_TIME_DATE "08:32:07 NOVEMBER 25, 2006" -set_global_assignment -name REMOVE_REDUNDANT_LOGIC_CELLS ON -set_global_assignment -name SLOW_SLEW_RATE OFF -set_global_assignment -name SMART_RECOMPILE OFF -set_global_assignment -name STATE_MACHINE_PROCESSING AUTO -set_global_assignment -name TOP_LEVEL_ENTITY pluto_servo -set_instance_assignment -name CLOCK_SETTINGS clk -to clk -set_instance_assignment -name FAST_OUTPUT_REGISTER ON -to dout -set_instance_assignment -name POWER_UP_LEVEL LOW -to * -set_location_assignment PIN_5 -to din[3] -set_location_assignment PIN_8 -to din[2] -set_location_assignment PIN_9 -to din[4] -set_location_assignment PIN_10 -to din[5] -set_location_assignment PIN_13 -to din[6] -set_location_assignment PIN_14 -to down[3] -set_location_assignment PIN_15 -to down[2] -set_location_assignment PIN_16 -to din[7] -set_location_assignment PIN_19 -to din[0] -set_location_assignment PIN_20 -to down[0] -set_location_assignment PIN_21 -to up[0] -set_location_assignment PIN_22 -to up[1] -set_location_assignment PIN_23 -to down[1] -set_location_assignment PIN_26 -to up[2] -set_location_assignment PIN_27 -to up[3] -set_location_assignment PIN_28 -to quadA[0] -set_location_assignment PIN_29 -to quadB[0] -set_location_assignment PIN_38 -to quadZ[0] -set_location_assignment PIN_39 -to quadA[1] -set_location_assignment PIN_40 -to quadB[1] -set_location_assignment PIN_43 -to quadZ[1] -set_location_assignment PIN_45 -to quadA[2] -set_location_assignment PIN_46 -to quadB[2] -set_location_assignment PIN_47 -to quadZ[2] -set_location_assignment PIN_48 -to dout[0] -set_location_assignment PIN_49 -to nConfig -set_location_assignment PIN_50 -to led -set_location_assignment PIN_55 -to quadA[3] -set_location_assignment PIN_56 -to quadZ[3] -set_location_assignment PIN_57 -to quadB[3] -set_location_assignment PIN_58 -to dout[1] -set_location_assignment PIN_61 -to dout[2] -set_location_assignment PIN_62 -to dout[3] -set_location_assignment PIN_63 -to dout[4] -set_location_assignment PIN_64 -to dout[5] -set_location_assignment PIN_65 -to dout[6] -set_location_assignment PIN_68 -to dout[7] -set_location_assignment PIN_69 -to dout[8] -set_location_assignment PIN_70 -to dout[9] -set_location_assignment PIN_77 -to pport_data[0] -set_location_assignment PIN_79 -to pport_data[1] -set_location_assignment PIN_80 -to nDataStr -set_location_assignment PIN_81 -to epp_nReset -set_location_assignment PIN_82 -to pport_data[2] -set_location_assignment PIN_84 -to nAddrStr -set_location_assignment PIN_85 -to pport_data[3] -set_location_assignment PIN_86 -to pport_data[4] -set_location_assignment PIN_87 -to nWait -set_location_assignment PIN_90 -to nWrite -set_location_assignment PIN_91 -to clk -set_location_assignment PIN_93 -to din[1] -set_location_assignment PIN_94 -to pport_data[5] -set_location_assignment PIN_96 -to pport_data[6] -set_location_assignment PIN_97 -to pport_data[7] - -set_global_assignment -name VERILOG_FILE wdt.v -set_global_assignment -name VERILOG_FILE quad.v -set_global_assignment -name VERILOG_FILE servo.v \ No newline at end of file diff --git a/src/hal/drivers/pluto_servo_firmware/pluto_servo.rbf b/src/hal/drivers/pluto_servo_firmware/pluto_servo.rbf deleted file mode 100644 index 701c31d53a1..00000000000 Binary files a/src/hal/drivers/pluto_servo_firmware/pluto_servo.rbf and /dev/null differ diff --git a/src/hal/drivers/pluto_servo_firmware/pluto_servo.srf b/src/hal/drivers/pluto_servo_firmware/pluto_servo.srf deleted file mode 100644 index e9fc9f5cb74..00000000000 --- a/src/hal/drivers/pluto_servo_firmware/pluto_servo.srf +++ /dev/null @@ -1,2 +0,0 @@ -{ "Warning" "WCPT_FEATURE_DISABLED_POST" "SignalProbe " "Warning: Feature SignalProbe is not available with your current license" { } { } 0 0 "Feature %1!s! is not available with your current license" 1 0} -{ "Warning" "WSGN_DFF_NOT_FOUND_FROM_PIN" "epp_nReset " "Warning: Pin \"*\" has no register for Power-Up Level option" { } { { "servo.v" "" { Text "Z:/emc2/src/hal/drivers/pluto_servo_firmware/servo.v" 26 -1 0 } } } 0 0 "Pin \"%1!s!\" has no register for Power-Up Level option" 1 1} diff --git a/src/hal/drivers/pluto_servo_firmware/quad.v b/src/hal/drivers/pluto_servo_firmware/quad.v deleted file mode 100644 index 59bd963be0a..00000000000 --- a/src/hal/drivers/pluto_servo_firmware/quad.v +++ /dev/null @@ -1,58 +0,0 @@ -// This is a component of pluto_servo, a PWM servo driver and quadrature -// counter for emc2 -// Copyright 2006 Jeff Epler -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -module quad(clk, A, B, Z, zr, out); -parameter W=14; -input clk, A, B, Z, zr; -reg [(W-1):0] c, i; reg zl; -output [2*W:0] out = { zl, i, c }; -// reg [(W-1):0] c, i; reg zl; - -reg [2:0] Ad, Bd; -reg [2:0] Zc; -always @(posedge clk) Ad <= {Ad[1:0], A}; -always @(posedge clk) Bd <= {Bd[1:0], B}; - -wire good_one = &Zc; -wire good_zero = ~|Zc; -reg last_good; - -wire index_pulse = good_one && ! last_good; - -wire count_enable = Ad[1] ^ Ad[2] ^ Bd[1] ^ Bd[2]; -wire count_direction = Ad[1] ^ Bd[2]; - -always @(posedge clk) -begin - if(Z && !good_one) Zc <= Zc + 2'b1; - else if(!good_zero) Zc <= Zc - 2'b1; - if(good_one) last_good <= 1; - else if(good_zero) last_good <= 0; - if(count_enable) - begin - if(count_direction) c <= c + 1'd1; - else c <= c - 1'd1; - end - if(index_pulse) begin - i <= c; - zl <= 1; - end else if(zr) begin - zl <= 0; - end -end -endmodule diff --git a/src/hal/drivers/pluto_servo_firmware/register-layout.txt b/src/hal/drivers/pluto_servo_firmware/register-layout.txt deleted file mode 100644 index fd3912e6ad3..00000000000 --- a/src/hal/drivers/pluto_servo_firmware/register-layout.txt +++ /dev/null @@ -1,105 +0,0 @@ -Generalities -============ - -The register layout of the pluto-servo is an implementation detail and -may vary from release to release of emc. - -The "address" is auto-incrementing after transfers. - -Multi-byte data is transferred least-significant-byte-first. - - -Read registers -============== - -The "read" registers (data transfer from pluto to PC) are each 4 bytes -long and start at address 0. Beginning a read within a register (e.g., -at address 2) results in undefined behavior. Bits without an -interpretation are undefined. - -Address Bits Interpretation -0..3 0..13 Encoder 0 count - 14..27 Encoder 0 last index pulse count - 15 Encoder 0 index seen -4..7 0..13 Encoder 1 count - 14..27 Encoder 1 last index pulse count - 15 Encoder 0 index seen -8..11 0..13 Encoder 2 count - 14..27 Encoder 2 last index pulse count - 15 Encoder 0 index seen -12..15 0..13 Encoder 3 count - 14..27 Encoder 3 last index pulse count - 15 Encoder 0 index seen -16..19 0..7 Dedicated digital inputs 0..7 - 8..11 Encoder 0..3 "Z" input - 12..15 Encoder 0..3 "B" input - 16..20 Encoder 0..3 "A" input - 21..27 (future) watchdog timer value - - -Write registers -=============== - -The "write" registers (data transfer from pluto to PC) are each 2 bytes -long and start at address 0. Beginning a read within a register (e.g., -at address 1) results in undefined behavior. Bits without an -interpretation should be sent as 0. - -Address Bits Interpretation -0..1 0..10 PWM 0 duty cycle - 12 PWM 0 up invert - 13 PWM 0 down invert - 14 PDM mode indicator for PWM 0..3 - 15 PWM 0 sign (0=force 'up' low; 1=force 'down' low) - -2..3 0..10 PWM 1 duty cycle - 12 PWM 1 up invert - 13 PWM 1 down invert - 15 PWM 1 sign (0=force 'up' low; 1=force 'down' low) - -4..5 0..10 PWM 2 duty cycle - 12 PWM 2 up invert - 13 PWM 2 down invert - 15 PWM 2 sign (0=force 'up' low; 1=force 'down' low) - -6..7 0..10 PWM 3 duty cycle - 12 PWM 3 up invert - 13 PWM 3 down invert - 15 PWM 3 sign (0=force 'up' low; 1=force 'down' low) - -8..9 0..9 Dedicated digital outputs 0..9 - 13 write to 1 to enable encoder test mode - 14 write to 1 to enable watchdog and reset WDT - 15 Index signal polarity for encoder 0..3 - - -Notes -===== - -Encoder -======= -The encoder "count" and "last index pulse count" must be sign extended in the -driver. This makes the maximum count rate 8191 counts per polling period. - -When an index pulse has occurred, "last index pulse count" is updated with the -count on the rising edge of the index, and "index seen" will be set on the next -read cycle. It is up to the HAL driver to perform index-enable logic. - -PWM -=== -In up/down mode, bit 15 functions like a sign bit. In pwm/direction -mode, bit 13 functions like a direction bit. Bits 12 and 13 function as -inverts (when PWM function is used) or as digital outputs (when PWM -function is disabled, bits 10..0 == 0). It's up to the HAL driver to -set all the bits properly for the desired PWM/digital output mode. - -Watchdog -======== -The watchdog consists of a 7-bit counter and a 1-bit enable which gives a -watchdog period of approximately 6.5ms. At power-up the enable is FALSE. When -bit 14 of register 8..9 is written TRUE, the counter is reset to 0 and enable -is set to TRUE. (there is no provision for resetting the watchdog enable to -FALSE) Every time the PWM counter overflows (approximately 51.2us) the watchdog -counter is incremented if it is not already at its maximum. When the watchdog -counter is at its maximum, the dedicated digital outputs and PWM outputs are -tristated. diff --git a/src/hal/drivers/pluto_servo_firmware/servo.v b/src/hal/drivers/pluto_servo_firmware/servo.v deleted file mode 100644 index 746dfcc2f84..00000000000 --- a/src/hal/drivers/pluto_servo_firmware/servo.v +++ /dev/null @@ -1,156 +0,0 @@ -// This is a component of pluto_servo, a PWM servo driver and quadrature -// counter for emc2 -// Copyright 2006 Jeff Epler -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -module pluto_servo(clk, led, nConfig, epp_nReset, pport_data, nWrite, nWait, nDataStr, - nAddrStr, dout, din, quadA, quadB, quadZ, up, down); -parameter QW=14; -input clk; -output led, nConfig; -inout [7:0] pport_data; -input nWrite; -output nWait; -input nDataStr, nAddrStr, epp_nReset; -wire do_tristate; -reg[9:0] real_dout; output [9:0] dout = do_tristate ? 10'bZZZZZZZZZZ : real_dout; -input [7:0] din; -input [3:0] quadA; -input [3:0] quadB; -input [3:0] quadZ; -wire[3:0] real_up; output [3:0] up = do_tristate ? 4'bZZZZ : real_up; -wire[3:0] real_down; output [3:0] down = do_tristate ? 4'bZZZZ : real_down; -reg Zpolarity; - -wire [2*QW:0] quad0, quad1, quad2, quad3; - -wire do_enable_wdt; -wire pwm_at_top; -wdt w(clk, do_enable_wdt, pwm_at_top, do_tristate); - -// PWM stuff -// PWM clock is about 20kHz for clk @ 40MHz, 11-bit cnt -reg [10:0] pwmcnt; -wire [10:0] top = 11'd2046; -assign pwm_at_top = (pwmcnt == top); -reg [15:0] pwm0, pwm1, pwm2, pwm3; -always @(posedge clk) begin - if(pwm_at_top) pwmcnt <= 0; - else pwmcnt <= pwmcnt + 11'd1; -end - -wire [10:0] pwmrev = { - pwmcnt[4], pwmcnt[5], pwmcnt[6], pwmcnt[7], pwmcnt[8], pwmcnt[9], - pwmcnt[10], pwmcnt[3:0]}; -wire [10:0] pwmcmp0 = pwm0[14] ? pwmrev : pwmcnt; -// wire [10:0] pwmcmp1 = pwm1[14] ? pwmrev : pwmcnt; -// wire [10:0] pwmcmp2 = pwm2[14] ? pwmrev : pwmcnt; -// wire [10:0] pwmcmp3 = pwm3[14] ? pwmrev : pwmcnt; -wire pwmact0 = pwm0[10:0] > pwmcmp0; -wire pwmact1 = pwm1[10:0] > pwmcmp0; -wire pwmact2 = pwm2[10:0] > pwmcmp0; -wire pwmact3 = pwm3[10:0] > pwmcmp0; -assign real_up[0] = pwm0[12] ^ (pwm0[15] ? 1'd0 : pwmact0); -assign real_up[1] = pwm1[12] ^ (pwm1[15] ? 1'd0 : pwmact1); -assign real_up[2] = pwm2[12] ^ (pwm2[15] ? 1'd0 : pwmact2); -assign real_up[3] = pwm3[12] ^ (pwm3[15] ? 1'd0 : pwmact3); -assign real_down[0] = pwm0[13] ^ (~pwm0[15] ? 1'd0 : pwmact0); -assign real_down[1] = pwm1[13] ^ (~pwm1[15] ? 1'd0 : pwmact1); -assign real_down[2] = pwm2[13] ^ (~pwm2[15] ? 1'd0 : pwmact2); -assign real_down[3] = pwm3[13] ^ (~pwm3[15] ? 1'd0 : pwmact3); - -// Quadrature stuff -// Quadrature is digitized at 40MHz into 14-bit counters -// Read up to 2^13 pulses / polling period = 8MHz for 1kHz servo period -reg qtest; -wire qr0, qr1, qr2, qr3; -quad q0(clk, qtest ? real_dout[0] : quadA[0], qtest ? real_dout[1] : quadB[0], qtest ? real_dout[2] : quadZ[0]^Zpolarity, qr0, quad0); -quad q1(clk, quadA[1], quadB[1], quadZ[1]^Zpolarity, qr1, quad1); -quad q2(clk, quadA[2], quadB[2], quadZ[2]^Zpolarity, qr2, quad2); -quad q3(clk, quadA[3], quadB[3], quadZ[3]^Zpolarity, qr3, quad3); - -// EPP stuff -wire EPP_write = ~nWrite; -wire EPP_read = nWrite; -wire EPP_addr_strobe = ~nAddrStr; -wire EPP_data_strobe = ~nDataStr; -wire EPP_strobe = EPP_data_strobe | EPP_addr_strobe; - -wire EPP_wait; assign nWait = ~EPP_wait; -wire [7:0] EPP_datain = pport_data; -wire [7:0] EPP_dataout; assign pport_data = EPP_dataout; - -reg [4:0] EPP_strobe_reg; -always @(posedge clk) EPP_strobe_reg <= {EPP_strobe_reg[3:0], EPP_strobe}; -wire EPP_strobe_edge1 = (EPP_strobe_reg[2:1]==2'b01); - -// reg led; - -assign EPP_wait = EPP_strobe_reg[4]; -reg[4:0] addr_reg; -reg[7:0] lowbyte; - -always @(posedge clk) - if(EPP_strobe_edge1 & EPP_write & EPP_addr_strobe) begin - addr_reg <= EPP_datain[4:0]; - end - else if(EPP_strobe_edge1 & !EPP_addr_strobe) addr_reg <= addr_reg + 4'd1; -always @(posedge clk) begin - if(EPP_strobe_edge1 & EPP_write & EPP_data_strobe) begin - if(addr_reg[3:0] == 4'd1) pwm0 <= { EPP_datain, lowbyte }; - else if(addr_reg[3:0] == 4'd3) pwm1 <= { EPP_datain, lowbyte }; - else if(addr_reg[3:0] == 4'd5) pwm2 <= { EPP_datain, lowbyte }; - else if(addr_reg[3:0] == 4'd7) pwm3 <= { EPP_datain, lowbyte }; - else if(addr_reg[3:0] == 4'd9) begin - real_dout <= { EPP_datain[1:0], lowbyte }; - Zpolarity <= EPP_datain[7]; - qtest <= EPP_datain[5]; - end - else lowbyte <= EPP_datain; - end -end - -reg [31:0] data_buf; - -always @(posedge clk) begin - if(EPP_strobe_edge1 & EPP_read && addr_reg[1:0] == 2'd0) begin - if(addr_reg[4:2] == 3'd0) data_buf <= quad0; - else if(addr_reg[4:2] == 3'd1) data_buf <= quad1; - else if(addr_reg[4:2] == 3'd2) data_buf <= quad2; - else if(addr_reg[4:2] == 3'd3) data_buf <= quad3; - else if(addr_reg[4:2] == 3'd4) - data_buf <= {quadA, quadB, quadZ, din}; - end -end - -// the addr_reg test looks funny because it is auto-incremented in an always -// block so "1" reads the low byte, "2 and "3" read middle bytes, and "0" -// reads the high byte I have a feeling that I'm doing this in the wrong way. -wire [7:0] data_reg = addr_reg[1:0] == 2'd1 ? data_buf[7:0] : - (addr_reg[1:0] == 2'd2 ? data_buf[15:8] : - (addr_reg[1:0] == 2'd3 ? data_buf[23:16] : - data_buf[31:24])); - -wire [7:0] EPP_data_mux = data_reg; -assign EPP_dataout = (EPP_read & EPP_wait) ? EPP_data_mux : 8'hZZ; -assign do_enable_wdt = EPP_strobe_edge1 & EPP_write & EPP_data_strobe & (addr_reg[3:0] == 4'd9) & EPP_datain[6]; -assign qr0 = EPP_strobe_edge1 & EPP_read & EPP_data_strobe & (addr_reg[4:2] == 3'd0); -assign qr1 = EPP_strobe_edge1 & EPP_read & EPP_data_strobe & (addr_reg[4:2] == 3'd1); -assign qr2 = EPP_strobe_edge1 & EPP_read & EPP_data_strobe & (addr_reg[4:2] == 3'd2); -assign qr3 = EPP_strobe_edge1 & EPP_read & EPP_data_strobe & (addr_reg[4:2] == 3'd3); -assign led = do_tristate ? 1'BZ : (real_up[0] ^ real_down[0]); -assign nConfig = epp_nReset; // 1'b1; -endmodule diff --git a/src/hal/drivers/pluto_servo_firmware/wdt.v b/src/hal/drivers/pluto_servo_firmware/wdt.v deleted file mode 100644 index 22aafb58365..00000000000 --- a/src/hal/drivers/pluto_servo_firmware/wdt.v +++ /dev/null @@ -1,33 +0,0 @@ -// This is a component of pluto_servo, a PWM servo driver and quadrature -// counter for emc2 -// Copyright 2006 Jeff Epler -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -module wdt(clk, ena, cnt, out); -input clk, ena, cnt; -output out; -reg [6:0] timer; -wire timer_top = (timer == 7'd127); -reg internal_enable; -wire out = internal_enable && timer_top; - -always @(posedge clk) begin - if(ena) begin - internal_enable <= 1; - timer <= 0; - end else if(cnt && !timer_top) timer <= timer + 7'd1; -end -endmodule diff --git a/src/hal/drivers/pluto_step.comp b/src/hal/drivers/pluto_step.comp deleted file mode 100644 index eba52022e01..00000000000 --- a/src/hal/drivers/pluto_step.comp +++ /dev/null @@ -1,326 +0,0 @@ -// Copyright (C) 2007 Jeff Epler -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -component pluto_step """Hardware driver and firmware for the Pluto-P parallel-port FPGA, for use with stepper machines. - -.B loadrt pluto_step ioaddr=\\fIaddr\\fB ioaddr_hi=\\fIaddr\\fB epp_wide=\\fI[0|1]\\fB - -.RS 4 -.TP -\\fBioaddr\\fR [default: 0x378] -The base address of the parallel port. - -.TP -\\fBioaddr_hi\\fR [default: 0] -The secondary address of the parallel port, used to set EPP -mode. 0 means to use ioaddr + 0x400. -1 means there is no -secondary address. - -.TP -\\fBepp_wide\\fR [default: 1] -Set to zero to disable "wide EPP mode". "Wide" mode allows 16- and 32-bit EPP -transfers, which can reduce the time spent in the read and write functions. -However, this mode may not work on all EPP parallel ports. - -.TP -\\fBwatchdog\\fR [default: 1] -Set to zero to disable the "hardware watchdog". "Watchdog" will tristate all -outputs approximately 6ms after the last execution of -\\fBpluto-step.write\\fR, which adds some protection in the case of LinuxCNC -crashes. - -.TP -\\fBspeedrange\\fR [default: 0] -Selects one of four speed ranges: -.RS -.RS 4 -.TQ -0: Top speed 312.5kHz; minimum speed 610Hz -.TQ -1: Top speed 156.25kHz; minimum speed 305Hz -.TQ -2: Top speed 78.125kHz; minimum speed 153Hz -.TQ -3: Top speed 39.06kHz; minimum speed 76Hz -.RE -Choosing the smallest maximum speed that is above the maximum for any one axis -may give improved step regularity at low step speeds. -.RE -.RE"""; - -description """ -Pluto_step is a LinuxCNC software driver and associated firmware that allow the Pluto-P board to be used to control a stepper-based CNC machine. - -The driver has 4 step+direction channels, 14 dedicated digital outputs, and 16 -dedicated digital inputs. - -.SS Step generators -The step generator takes a position input and output. - -The step waveform includes step length/space and direction hold/setup time. -Step length and direction setup/hold time is enforced in the FPGA. Step space -is enforced by a velocity cap in the driver. - -\\fI(all the following numbers are subject to change)\\fR -In \\fIspeedrange=0\\fR, the maximum step rate is 312.5kHz. For position -feedback to be accurate, the maximum step rate is 512 pulses per servo cycle -(so a 1kHz servo cycle does not impose any additional limitation). The maximum -step rate may be lowered by the step length and space parameters, which are -rounded up to the nearest multiple of 1600ns. - -In successive speedranges the maximum step rate is divided in half, as is the -maximum steps per servo cycle, and the minimum nonzero step rate. - -.SS Digital I/O -The digital output pins conform to the `canonical digital output' interface -described in the HAL manual. - -The digital input pins conform to the `canonical digital input' interface -described in the HAL manual. -"""; -pin in real stepgen.#.position-cmd[4]; -pin out real stepgen.#.velocity-fb[4]; -pin out real stepgen.#.position-fb[4]; -pin out si32 stepgen.#.counts[4]; -pin in bool stepgen.#.enable[4]; -pin in bool stepgen.#.reset[4] "When TRUE, reset position-fb to 0"; -param rw real stepgen.#.scale[4] = 1.0; -param rw real stepgen.#.maxvel[4] = 0; -param rw bool stepgen.step_polarity; - -param rw ui32 stepgen.steplen "Step length in ns."; -param rw ui32 stepgen.stepspace "Step space in ns"; -param rw ui32 stepgen.dirtime "Dir hold/setup in ns. Refer to the pdf documentation for a diagram of what these timings mean."; - -pin in bool dout.##[14] -"""dout.\\fIMM\\fR corresponds to the pin labeled -OUT\\fIM\\fR on the pinout diagram."""; -param rw bool dout.##-invert[14] -"If TRUE, the output on the corresponding \\fBdout.\\fIMM\\fR is inverted."; - -pin out bool din.##[16]; -pin out bool din.##_not[16] -"""din.\\fIMM\\fR corresponds to the pin labeled -IN\\fIM\\fR on the pinout diagram."""; - -param rw ui32 communication_error """Incremented each time -pluto-step.read detects an error code in the EPP status register. While -this register is nonzero, new values are not being written to the Pluto-P -board, and the status of digital outputs and the PWM duty cycle of the PWM -outputs will remain unchanged. If the hardware watchdog is enabled, it will -activate shortly after the communication error is detected by LinuxCNC. To continue -after a communication error, set this parameter back to zero."""; - -param rw si32 debug_0; -param rw si32 debug_1; -param rw real debug_2=.5; -param rw real debug_3=2.0 - """Registers that hold debugging information of interest to developers"""; - -option singleton; -option extra_setup; -option extra_cleanup; - -option data internal; - -function read "Read all the inputs from the pluto-step board"; -function write "Write all the outputs on the pluto-step board"; - -see_also """The \\fIpluto_step\\fR section in the HAL User Manual, which shows the location of each physical pin on the pluto board."""; - -license "GPL"; -include ; -include "hal/drivers/pluto_common.h"; -;; - -static int speedrange=0; -RTAPI_MP_INT(speedrange, "Speed range 0..3"); - -#define PLUTO_SPEED_NS (1600) -#define PLUTO_SPEED (PLUTO_SPEED_NS * 1e-9) -#define PLUTO_FREQ (1e9 / PLUTO_SPEED_NS) -#define TMAX ((1<<5)-1) - -#define W 10 -#define F 11 -#define MODULO ((1<<(W+F))-1) -#define MASK ((1<<(W+F))-1) -#define MAXDELTA (MASK/2) - -typedef struct { - int64_t last_count[4]; - int64_t reset_count[4]; - double old_position_cmd[4]; - double old_velocity_cmd[4]; -} internal; - -#define ONE (1< TMAX) { - steplen_ticks = TMAX; - rtapi_print_msg(RTAPI_MSG_ERR, - "Requested step length %dns decreased to %dns " - "due to hardware limitations\n", - stepgen_steplen, TMAX * PLUTO_SPEED_NS); - stepgen_steplen_set(TMAX * PLUTO_SPEED_NS); - } - - if(dirtime_ticks > TMAX) { - dirtime_ticks = TMAX; - rtapi_print_msg(RTAPI_MSG_ERR, - "Requested direction change time %dns decreased to %dns " - "due to hardware limitations\n", - stepgen_dirtime, TMAX * PLUTO_SPEED_NS); - stepgen_dirtime_set(TMAX * PLUTO_SPEED_NS); - } - - // Speed limits come from several sources - // First limit: step waveform timings - fmax = 1. / PLUTO_SPEED / (2 + steplen_ticks + stepspace_ticks); - // Second limit: highest speed command - if(fmax > PLUTO_FREQ / (2< MAXDELTA / fperiod / (1< 0) v = v + .5/scale_abs; - else if(v < 0) v = v - .5/scale_abs; - - data.old_position_cmd[i] = new_position_cmd; - data.old_velocity_cmd[i] = v; - actual_max = fmax / scale_abs; - if(stepgen_maxvel(i) < 0) stepgen_maxvel_set(i, -stepgen_maxvel(i)); - if(stepgen_maxvel(i) != 0 && stepgen_maxvel(i) > actual_max) { - static int message_printed[4] = {0,0,0,0}; - if(!message_printed[i]) { - rtapi_print_msg(RTAPI_MSG_ERR, - "Requested step rate %dHz decreased to %dHz " - "due to hardware or timing limitations\n", - (int)(stepgen_maxvel(i) * scale_abs), - (int)(fmax)); - message_printed[i] = 1; - } - stepgen_maxvel_set(i, actual_max); - } - - if(stepgen_maxvel(i) == 0) { - if(v < -actual_max) v = -actual_max; - if(v > actual_max) v = actual_max; - } else { - if(v < -stepgen_maxvel(i)) v = -stepgen_maxvel(i); - if(v > stepgen_maxvel(i)) v = stepgen_maxvel(i); - } - rate = v * stepgen_scale(i) * ONE * PLUTO_SPEED / (1< maxrate) rate = maxrate; - if(rate < -maxrate) rate = -maxrate; - - if(!stepgen_enable(i)) rate = 0; - if(i == 0) debug_1_set(rate); - write16(rate); - } - - r = 0; - for(i=0; i<14; i++) { - if(!dout(i) ^ !dout_invert(i)) r |= (1< -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -module main(clk, led, nConfig, epp_nReset, pport_data, nWrite, nWait, nDataStr, - nAddrStr, dout, din, step, dir); -parameter W=10; -parameter F=11; -parameter T=4; -input clk; -output led, nConfig; -inout [7:0] pport_data; -input nWrite; -output nWait; -input nDataStr, nAddrStr, epp_nReset; - -input [15:0] din; - -reg Spolarity; -reg[13:0] real_dout; output [13:0] dout = do_tristate ? 14'bZ : real_dout; -wire[3:0] real_step; output [3:0] step = do_tristate ? 4'bZ : real_step ^ {4{Spolarity}}; -wire[3:0] real_dir; output [3:0] dir = do_tristate ? 4'bZ : real_dir; - -wire [W+F-1:0] pos0, pos1, pos2, pos3; -reg [F:0] vel0, vel1, vel2, vel3; -reg [T-1:0] dirtime, steptime; -reg [1:0] tap; - -reg [10:0] div2048; -wire stepcnt = ~|(div2048[5:0]); - -always @(posedge clk) begin - div2048 <= div2048 + 1'd1; -end - -wire do_enable_wdt, do_tristate; -wdt w(clk, do_enable_wdt, &div2048, do_tristate); - -stepgen #(W,F,T) s0(clk, stepcnt, pos0, vel0, dirtime, steptime, real_step[0], real_dir[0], tap); -stepgen #(W,F,T) s1(clk, stepcnt, pos1, vel1, dirtime, steptime, real_step[1], real_dir[1], tap); -stepgen #(W,F,T) s2(clk, stepcnt, pos2, vel2, dirtime, steptime, real_step[2], real_dir[2], tap); -stepgen #(W,F,T) s3(clk, stepcnt, pos3, vel3, dirtime, steptime, real_step[3], real_dir[3], tap); - -// EPP stuff -wire EPP_write = ~nWrite; -wire EPP_read = nWrite; -wire EPP_addr_strobe = ~nAddrStr; -wire EPP_data_strobe = ~nDataStr; -wire EPP_strobe = EPP_data_strobe | EPP_addr_strobe; - -wire EPP_wait; assign nWait = ~EPP_wait; -wire [7:0] EPP_datain = pport_data; -wire [7:0] EPP_dataout; assign pport_data = EPP_dataout; - -reg [4:0] EPP_strobe_reg; -always @(posedge clk) EPP_strobe_reg <= {EPP_strobe_reg[3:0], EPP_strobe}; -wire EPP_strobe_edge1 = (EPP_strobe_reg[2:1]==2'b01); - -// reg led; - -assign EPP_wait = EPP_strobe_reg[4]; -wire[15:0] EPP_dataword = {EPP_datain, lowbyte}; -reg[4:0] addr_reg; -reg[7:0] lowbyte; - -always @(posedge clk) - if(EPP_strobe_edge1 & EPP_write & EPP_addr_strobe) begin - addr_reg <= EPP_datain[4:0]; - end - else if(EPP_strobe_edge1 & !EPP_addr_strobe) addr_reg <= addr_reg + 4'd1; -always @(posedge clk) begin - if(EPP_strobe_edge1 & EPP_write & EPP_data_strobe) begin - if(addr_reg[3:0] == 4'd1) vel0 <= EPP_dataword[F:0]; - else if(addr_reg[3:0] == 4'd3) vel1 <= EPP_dataword[F:0]; - else if(addr_reg[3:0] == 4'd5) vel2 <= EPP_dataword[F:0]; - else if(addr_reg[3:0] == 4'd7) vel3 <= EPP_dataword[F:0]; - else if(addr_reg[3:0] == 4'd9) begin - real_dout <= { EPP_datain[5:0], lowbyte }; - end - else if(addr_reg[3:0] == 4'd11) begin - tap <= lowbyte[7:6]; - steptime <= lowbyte[T-1:0]; - - Spolarity <= EPP_datain[7]; - // EPP_datain[6] is do_enable_wdt - dirtime <= EPP_datain[T-1:0]; - end - else lowbyte <= EPP_datain; - end -end - -reg [31:0] data_buf; - -always @(posedge clk) begin - if(EPP_strobe_edge1 & EPP_read && addr_reg[1:0] == 2'd0) begin - if(addr_reg[4:2] == 3'd0) data_buf <= pos0; - else if(addr_reg[4:2] == 3'd1) data_buf <= pos1; - else if(addr_reg[4:2] == 3'd2) data_buf <= pos2; - else if(addr_reg[4:2] == 3'd3) data_buf <= pos3; - else if(addr_reg[4:2] == 3'd4) - data_buf <= din; - end -end - -// the addr_reg test looks funny because it is auto-incremented in an always -// block so "1" reads the low byte, "2 and "3" read middle bytes, and "0" -// reads the high byte I have a feeling that I'm doing this in the wrong way. -wire [7:0] data_reg = addr_reg[1:0] == 2'd1 ? data_buf[7:0] : - (addr_reg[1:0] == 2'd2 ? data_buf[15:8] : - (addr_reg[1:0] == 2'd3 ? data_buf[23:16] : - data_buf[31:24])); - -wire [7:0] EPP_data_mux = data_reg; -assign EPP_dataout = (EPP_read & EPP_wait) ? EPP_data_mux : 8'hZZ; -// assign do_enable_wdt = EPP_strobe_edge1 & EPP_write & EPP_data_strobe & (addr_reg[3:0] == 4'd9) & EPP_datain[6]; -// assign led = do_tristate ? 1'BZ : (real_step[0] ^ real_dir[0]); -assign led = do_tristate ? 1'bZ : (real_step[0] ^ real_dir[0]); -assign nConfig = epp_nReset; // 1'b1; -assign do_enable_wdt = EPP_strobe_edge1 & EPP_write & EPP_data_strobe & (addr_reg[3:0] == 4'd9) & EPP_datain[6]; -endmodule diff --git a/src/hal/drivers/pluto_step_firmware/pluto_step.qpf b/src/hal/drivers/pluto_step_firmware/pluto_step.qpf deleted file mode 100644 index 41125109264..00000000000 --- a/src/hal/drivers/pluto_step_firmware/pluto_step.qpf +++ /dev/null @@ -1,21 +0,0 @@ -# This is a component of pluto_servo, a PWM servo driver and quadrature -# counter for emc2 -# Copyright 2006 Jeff Epler -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -QUARTUS_VERSION = "6.0" -DATE = "09:23:55 December 23, 2006" -PROJECT_REVISION = "pluto_step" diff --git a/src/hal/drivers/pluto_step_firmware/pluto_step.qsf b/src/hal/drivers/pluto_step_firmware/pluto_step.qsf deleted file mode 100644 index b1c62e5e717..00000000000 --- a/src/hal/drivers/pluto_step_firmware/pluto_step.qsf +++ /dev/null @@ -1,106 +0,0 @@ -set_global_assignment -name ENABLE_DRC_SETTINGS OFF -# This is a component of pluto_step, a hardware step generator for emc2 -# Copyright 2006 Jeff Epler -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -set_global_assignment -name ALLOW_ANY_ROM_SIZE_FOR_RECOGNITION ON -set_global_assignment -name ALLOW_ANY_SHIFT_REGISTER_SIZE_FOR_RECOGNITION ON -set_global_assignment -name ALLOW_POWER_UP_DONT_CARE OFF -set_global_assignment -name AUTO_IMPLEMENT_IN_ROM ON -set_global_assignment -name AUTO_PACKED_REGISTERS "MINIMIZE AREA" -set_global_assignment -name DEVICE "EP1K10TC100-3" -set_global_assignment -name ENABLE_INIT_DONE_OUTPUT OFF -set_global_assignment -name FAMILY ACEX1K -set_global_assignment -name FMAX_REQUIREMENT "40 MHz" -set_global_assignment -name FMAX_REQUIREMENT "40 MHz" -section_id clk -set_global_assignment -name GENERATE_RBF_FILE ON -set_global_assignment -name IGNORE_CASCADE_BUFFERS ON -set_global_assignment -name IGNORE_CLOCK_SETTINGS OFF -set_global_assignment -name IGNORE_LCELL_BUFFERS ON -set_global_assignment -name LAST_QUARTUS_VERSION "6.0 SP1" -set_global_assignment -name MESSAGE_SUPPRESSION_RULE_FILE pluto_step.srf -set_global_assignment -name OPTIMIZE_HOLD_TIMING OFF -set_global_assignment -name ORIGINAL_QUARTUS_VERSION "6.0 SP1" -set_global_assignment -name PROJECT_CREATION_TIME_DATE "08:32:07 NOVEMBER 25, 2006" -set_global_assignment -name REMOVE_REDUNDANT_LOGIC_CELLS ON -set_global_assignment -name SLOW_SLEW_RATE OFF -set_global_assignment -name SMART_RECOMPILE OFF -set_global_assignment -name STATE_MACHINE_PROCESSING AUTO -set_global_assignment -name TOP_LEVEL_ENTITY main -set_instance_assignment -name CLOCK_SETTINGS clk -to clk -set_instance_assignment -name FAST_OUTPUT_REGISTER ON -to dout -set_instance_assignment -name POWER_UP_LEVEL LOW -to * -set_location_assignment PIN_5 -to din[3] -set_location_assignment PIN_8 -to din[2] -set_location_assignment PIN_9 -to din[4] -set_location_assignment PIN_10 -to din[5] -set_location_assignment PIN_13 -to din[6] -set_location_assignment PIN_14 -to dir[3] -set_location_assignment PIN_15 -to dir[2] -set_location_assignment PIN_16 -to din[7] -set_location_assignment PIN_19 -to din[0] -set_location_assignment PIN_20 -to dir[0] -set_location_assignment PIN_21 -to step[0] -set_location_assignment PIN_22 -to step[1] -set_location_assignment PIN_23 -to dir[1] -set_location_assignment PIN_26 -to step[2] -set_location_assignment PIN_27 -to step[3] -set_location_assignment PIN_28 -to din[8] -set_location_assignment PIN_29 -to din[9] -set_location_assignment PIN_38 -to din[10] -set_location_assignment PIN_39 -to din[11] -set_location_assignment PIN_40 -to din[12] -set_location_assignment PIN_43 -to din[13] -set_location_assignment PIN_45 -to din[14] -set_location_assignment PIN_46 -to din[15] -set_location_assignment PIN_47 -to dout[10] -set_location_assignment PIN_48 -to dout[0] -set_location_assignment PIN_49 -to nConfig -set_location_assignment PIN_50 -to led -set_location_assignment PIN_55 -to dout[11] -set_location_assignment PIN_56 -to dout[12] -set_location_assignment PIN_57 -to dout[13] -set_location_assignment PIN_58 -to dout[1] -set_location_assignment PIN_61 -to dout[2] -set_location_assignment PIN_62 -to dout[3] -set_location_assignment PIN_63 -to dout[4] -set_location_assignment PIN_64 -to dout[5] -set_location_assignment PIN_65 -to dout[6] -set_location_assignment PIN_68 -to dout[7] -set_location_assignment PIN_69 -to dout[8] -set_location_assignment PIN_70 -to dout[9] -set_location_assignment PIN_77 -to pport_data[0] -set_location_assignment PIN_79 -to pport_data[1] -set_location_assignment PIN_80 -to nDataStr -set_location_assignment PIN_81 -to epp_nReset -set_location_assignment PIN_82 -to pport_data[2] -set_location_assignment PIN_84 -to nAddrStr -set_location_assignment PIN_85 -to pport_data[3] -set_location_assignment PIN_86 -to pport_data[4] -set_location_assignment PIN_87 -to nWait -set_location_assignment PIN_90 -to nWrite -set_location_assignment PIN_91 -to clk -set_location_assignment PIN_93 -to din[1] -set_location_assignment PIN_94 -to pport_data[5] -set_location_assignment PIN_96 -to pport_data[6] -set_location_assignment PIN_97 -to pport_data[7] - -set_global_assignment -name VERILOG_FILE ../pluto_servo_firmware/wdt.v -set_global_assignment -name VERILOG_FILE ../pluto_servo_firmware/quad.v -set_global_assignment -name VERILOG_FILE main.v -set_global_assignment -name VERILOG_FILE stepgen.v -set_global_assignment -name AUTO_RAM_RECOGNITION OFF -set_global_assignment -name AUTO_ROM_RECOGNITION OFF diff --git a/src/hal/drivers/pluto_step_firmware/pluto_step.rbf b/src/hal/drivers/pluto_step_firmware/pluto_step.rbf deleted file mode 100644 index ec4986bc2fd..00000000000 Binary files a/src/hal/drivers/pluto_step_firmware/pluto_step.rbf and /dev/null differ diff --git a/src/hal/drivers/pluto_step_firmware/register-layout.txt b/src/hal/drivers/pluto_step_firmware/register-layout.txt deleted file mode 100644 index 3ff30f3a107..00000000000 --- a/src/hal/drivers/pluto_step_firmware/register-layout.txt +++ /dev/null @@ -1,62 +0,0 @@ -Generalities -============ - -The register layout of the pluto-servo is an implementation detail and -may vary from release to release of emc. - -The "address" is auto-incrementing after transfers. - -Multi-byte data is transferred least-significant-byte-first. - - -Read registers -============== - -The "read" registers (data transfer from pluto to PC) are each 4 bytes -long and start at address 0. Beginning a read within a register (e.g., -at address 2) results in undefined behavior. Bits without an -interpretation are undefined. - -Address Bits Interpretation -0..3 0..20 Stepgen 0 position in 10.10 fixed-point notation -4..7 0..20 Stepgen 1 position in 10.10 fixed-point notation -8..11 0..20 Stepgen 2 position in 10.10 fixed-point notation -12..15 0..20 Stepgen 3 position in 10.10 fixed-point notation -16..19 0..15 Digital inputs 0..15 - - -Write registers -=============== - -The "write" registers (data transfer from pluto to PC) are each 2 bytes -long and start at address 0. Beginning a read within a register (e.g., -at address 1) results in undefined behavior. Bits without an -interpretation should be sent as 0. - -Address Bits Interpretation -0..1 0..11 Stepgen 0 velocity in +-.10 fixed-point notation -2..3 0..11 Stepgen 1 velocity in +-.10 fixed-point notation -4..5 0..11 Stepgen 2 velocity in +-.10 fixed-point notation -6..7 0..11 Stepgen 3 velocity in +-.10 fixed-point notation -8..9 0..13 Digital outputs 0..13 -10..11 0..3 Step time in units of 1600ns - 8..11 Direction setup/hold time in units of 1600ns - 14 write 1 to enable watchdog and reset WDT - 15 step polarity for stepgen 0..3 - - - -Notes -===== - -Watchdog -======== -The watchdog consists of a 7-bit counter and a 1-bit enable which gives a -watchdog period of approximately 6.5ms. At power-up the enable is FALSE. When -bit 14 of register 8..9 is written TRUE, the counter is reset to 0 and enable -is set to TRUE. (there is no provision for resetting the watchdog enable to -FALSE) Every time the PWM counter overflows (approximately 51.2us) the watchdog -counter is incremented if it is not already at its maximum. When the watchdog -counter is at its maximum, the dedicated digital outputs and PWM outputs are -tristated. - diff --git a/src/hal/drivers/pluto_step_firmware/stepgen.v b/src/hal/drivers/pluto_step_firmware/stepgen.v deleted file mode 100644 index f189322b0f9..00000000000 --- a/src/hal/drivers/pluto_step_firmware/stepgen.v +++ /dev/null @@ -1,101 +0,0 @@ -// This is a component of pluto_step, a hardware step waveform generator -// Copyright 2007 Jeff Epler -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -module stepgen(clk, enable, position, velocity, dirtime, steptime, step, dir, tap); -`define STATE_STEP 0 -`define STATE_DIRCHANGE 1 -`define STATE_DIRWAIT 2 - -parameter W=12; -parameter F=10; -parameter T=5; - -input clk, enable; -output [W+F-1:0] position; reg [W+F-1:0] position; -input [F:0] velocity; -input [T-1:0] dirtime, steptime; -input [1:0] tap; - -output step, dir; -reg step, dir; - -reg [T-1:0] timer; -reg [1:0] state; -reg ones; -wire dbit = velocity[F]; -wire pbit = (tap == 0 ? position[F] - : (tap == 1 ? position[F+1] - : (tap == 2 ? position[F+2] - : position[F+3]))); - -wire [W+F-1:0] xvelocity = {{W{velocity[F]}}, {1{velocity[F-1:0]}}}; - -`ifdef TESTING -// for testing: -initial position = 1'b0; -initial state = `STATE_STEP; -initial timer = 0; -initial dir = 0; -initial ones = 0; -`endif - -always @(posedge clk) begin - if(enable) begin - // $display("state=%d timer=%d position=%h velocity=%h dir=%d dbit=%d pbit=%d ones=%d", state, timer, position, xvelocity, dir, dbit, pbit, ones); - if((dir != dbit) && (pbit == ones)) begin - if(state == `STATE_DIRCHANGE) begin - if(timer == 0) begin - dir <= dbit; - timer <= dirtime; - state <= `STATE_DIRWAIT; - end else begin - timer <= timer - 1'd1; - end - end else begin - if(timer == 0) begin - step <= 0; - timer <= dirtime; - state <= `STATE_DIRCHANGE; - end else begin - timer <= timer - 1'd1; - end - end - end else if(state == `STATE_DIRWAIT) begin - if(timer == 0) begin - state <= `STATE_STEP; - end else begin - timer <= timer - 1'd1; - end - end else begin - if(timer == 0) begin - if(pbit != ones) begin - ones <= pbit; - step <= 1'd1; - timer <= steptime; - end else begin - step <= 0; - end - end else begin - timer <= timer - 1'd1; - end - if(dir == dbit) - position <= position + xvelocity; - end - end -end - -endmodule diff --git a/src/hal/drivers/pluto_step_firmware/test_stepgen.v b/src/hal/drivers/pluto_step_firmware/test_stepgen.v deleted file mode 100644 index 3578b69223e..00000000000 --- a/src/hal/drivers/pluto_step_firmware/test_stepgen.v +++ /dev/null @@ -1,56 +0,0 @@ -// This is a component of pluto_step, a hardware step waveform generator -// Copyright 2007 Jeff Epler -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -// install ubuntu package "verilog" from universe -// Compile with: iverilog -DTESTING test_stepgen.v stepgen.v -// run with "./a.out | less" and look at output for problems - -module test_stepgen(); - -reg clk; -reg [4:0] vel; -wire [19:0] pos; -wire step, dir; - -stepgen #(16,4,16) s(clk, 1, pos, vel, 1, 0, step, dir, 3); -integer q; -reg ost; - -initial begin - vel = 5'h8; // two useful test cases: - // vel=5'h8 (max step speed) - // vel=5'h2 (~1 step per repeat) - q = 0; - repeat(50) begin - repeat(50) begin - #20 clk<=1; - #20 clk<=0; - - if(step && !ost) begin - if(dir) q = q+1; - else q = q - 1; - end - ost <= step; - - $display("%d %d %x %x %d %d %d %d %d", - step, dir, vel, pos, s.state, s.ones, s.pbit, s.timer, q); - end - vel = 6'h20 - vel; - end -end - -endmodule diff --git a/src/hal/drivers/rbf2h.py b/src/hal/drivers/rbf2h.py deleted file mode 100644 index e07321dc301..00000000000 --- a/src/hal/drivers/rbf2h.py +++ /dev/null @@ -1,65 +0,0 @@ -import sys, getopt - -GPL=0 -LGPL=0 -EXTRA=[] -opts, args = getopt.getopt(sys.argv[1:], "glc:") -for k, v in opts: - if k == "-g": - GPL = 1 - elif k == "-l": - LGPL = 1 - elif k == "-c": - EXTRA.append("// " + v) - else: - raise SystemExit("Unknown argument: %r" % k) - -sys.stdout.write("\n".join(EXTRA)) - -print(""" -// This is a generated file; the "corresponding source code" is the set of -// files used by Altera's Quartus software to generate an .rbf-format -// fpga firmware file. -""") - -if GPL: - print("""\ -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -""") - -if LGPL: - print("""\ -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -""") - -h = open(args[0], "rb").read(); - -print("static unsigned char firmware[] = {") -for i, c in enumerate(h): - print("%3d," % c, end=' ') - if i % 16 == 15: print() -print("};")