From: Walter Fetter Lages Date: Sun, 20 May 2018 06:12:52 +0000 (-0300) Subject: Change Makefiles to use variables defined in the main Makefile. X-Git-Tag: v1.5.1^0 X-Git-Url: http://git.ece.ufrgs.br/?a=commitdiff_plain;h=da484b97f33610d8d6b1f2cf9934dd4f9c81052f;p=aic.git Change Makefiles to use variables defined in the main Makefile. Criado o programa CmdDaemon, semelhante ao IODaemon, mas apenas recebe comandos, sem enviar dados de sensores. Reestruturados os Makefiles. Agora os Makefiles nos diretorios utilizam as variaveis definidas no Makefile no diretorio principal, ao inves de redefini-las. As redefinicoes sao feitas apenas nas (poucas) vezes em que sao necessarias. Removidas as declaracoes de variaveis globais em arquivos em Assembly e criada uma funcao dummy para defini-las nos arquivos C, ja' que nao e' possivel emitir Assembly in-line fora de funcoes. --- diff --git a/AICOff/Makefile b/AICOff/Makefile index 61cc8e0..e19e90a 100644 --- a/AICOff/Makefile +++ b/AICOff/Makefile @@ -1,9 +1,3 @@ -CLASSPATH=-classpath /opt/tini/bin/tini.jar:/opt/tini/bin/tiniclasses.jar:../lib/AIC.jar -APIDBPATH=-d /opt/tini/bin/tini.db -LIBPATH=-path ../lib/AIC.jar -NATLIB=-n brake.tlib -n encoder.tlib -n index.tlib -n pwm.tlib -JAVAFLAGS=-O -target 1.1 -source 1.3 - all: AICOff.tini AICOff.class: AICOff.java ../lib/AIC.jar diff --git a/BrakeRtTest/Makefile b/BrakeRtTest/Makefile index 8244316..6385ca4 100644 --- a/BrakeRtTest/Makefile +++ b/BrakeRtTest/Makefile @@ -1,37 +1,20 @@ -CLASSPATH=-classpath /opt/tini/bin/tini.jar:/opt/tini/bin/tiniclasses.jar -APIDBPATH=-d /opt/tini/bin/tini.db -TINIRTAIPATH=${HOME}/src/tini/rtai -LIBPATH=-PATH ${TINIRTAIPATH}/lib/rtai.jar -JAVAFLAGS=-O -target 1.1 -source 1.3 -ASMINC=-I/opt/tini/native/lib -ASMOPT=-f 1.15 -p 390 -l -ASMMACRO=/opt/tini/native/bin/Linux/macro -ASM=/opt/tini/native/bin/Linux/a390 -CC=sdcc -CFLAGS=-mTININative -S --use-accelerator -CINCLUDE=-I${TINIRTAIPATH}/include -I../include -CMPFLAGS=${CFLAGS} ${CINCLUDE} - all: BrakeRtTest.tini BrakeRtTest.class: BrakeRtTest.java - javac ${CLASSPATH} ${JAVAFLAGS} BrakeRtTest.java + ${JAVAC} ${CLASSPATH} ${JAVAFLAGS} BrakeRtTest.java braketest.mpp: braketest.a51 - ${ASMMACRO} ${ASMINC} -e- braketest.a51 + ${ASMMACRO} -I${ASMINC} -e- braketest.a51 -globals.mpp: globals.a51 - ${ASMMACRO} ${ASMINC} -e- globals.a51 - -braketest.tlib: braketest.mpp globals.mpp ../lib/aicio.mpp.lib - cat braketest.mpp globals.mpp ${TINIRTAIPATH}/lib/rtai.mpp.lib ../lib/aicio.mpp.lib > tmp.mpp +braketest.tlib: braketest.mpp ../lib/aicio.mpp.lib + cat braketest.mpp ${TRTAIPATH}/lib/rtai.mpp.lib ../lib/aicio.mpp.lib > tmp.mpp echo end >> tmp.mpp ${ASM} ${ASMOPT} tmp.mpp mv tmp.tlib braketest.tlib mv tmp.lst braketest.lst braketest.a51: braketest.c - ${CC} ${CMPFLAGS} braketest.c + ${SDCC} ${SDCCCMPFLAGS} braketest.c BrakeRtTest.tini: BrakeRtTest.class braketest.tlib java ${CLASSPATH} TINIConvertor -n braketest.tlib -f BrakeRtTest.class ${APIDBPATH} -o BrakeRtTest.tini diff --git a/BrakeRtTest/braketest.c b/BrakeRtTest/braketest.c index 0531397..504b23a 100644 --- a/BrakeRtTest/braketest.c +++ b/BrakeRtTest/braketest.c @@ -33,6 +33,15 @@ extern volatile pthread_t th; +void braketest_globals(void) _naked +{ + _asm +th: db 0,0,0,0 +braketest_time_1_1: db 0,0,0,0 + _endasm; +} + + void *braketest(void *arg) { static int time=0; diff --git a/BrakeTest/Makefile b/BrakeTest/Makefile index b773886..a214f24 100644 --- a/BrakeTest/Makefile +++ b/BrakeTest/Makefile @@ -1,9 +1,3 @@ -CLASSPATH=-classpath /opt/tini/bin/tini.jar:/opt/tini/bin/tiniclasses.jar:../lib/AIC.jar -APIDBPATH=-d /opt/tini/bin/tini.db -LIBPATH=-path ../lib/AIC.jar -NATLIB=-n brake.tlib -n encoder.tlib -n index.tlib -n pwm.tlib -JAVAFLAGS=-O -target 1.1 -source 1.3 - all: BrakeTest.tini BrakeApply.tini BrakeRelease.tini BrakeTest.class: BrakeTest.java ../lib/AIC.jar diff --git a/CANTest/Makefile b/CANTest/Makefile index 54d8e12..eaae3fc 100644 --- a/CANTest/Makefile +++ b/CANTest/Makefile @@ -1,22 +1,13 @@ -CLASSPATH=-classpath /opt/tini/bin/tini.jar:/opt/tini/bin/tiniclasses.jar:/opt/tini/bin/modules.jar:../lib/AIC.jar -APIDBPATH=-d /opt/tini/bin/tini.db -DEPPATH=-p /opt/tini/bin/modules.jar -DEPFILE=-x /opt/tini/bin/owapi_dep.txt -DEPNAME=-add CAN -LIBPATH=-path ../lib/AIC.jar -JAVAFLAGS=-O -target 1.1 -source 1.3 -TARGET=aic3 aic5 - all: CANRx.tini CANTx.tini CANRx.class: CANRx.java - javac ${JAVAFLAGS} ${CLASSPATH} CANRx.java + ${JAVAC} ${JAVAFLAGS} ${CLASSPATH} CANRx.java CANRx.tini: CANRx.class java ${CLASSPATH} BuildDependency ${DEPNAME} ${DEPFILE} ${DEPPATH} -f CANRx.class ${APIDBPATH} -o CANRx.tini ${LIBPATH} CANTx.class: CANTx.java - javac ${JAVAFLAGS} ${CLASSPATH} CANTx.java + ${JAVAC} ${JAVAFLAGS} ${CLASSPATH} CANTx.java CANTx.tini: CANTx.class java ${CLASSPATH} BuildDependency ${DEPNAME} ${DEPFILE} ${DEPPATH} -f CANTx.class ${APIDBPATH} -o CANTx.tini ${LIBPATH} @@ -25,20 +16,4 @@ clean: rm -f *.bak *~ CANRx.class CANTx.class distclean: clean - rm -f CANRx.tini CANTx.tini *.UPLOADED - -upload: CANRx.UPLOADED CANTx.UPLOADED - -CANRx.UPLOADED: CANRx.tini - for i in ${TARGET}; do \ - ftp $$i < CANRx.upload; \ - echo $$i uploaded; \ - done - date > CANRx.UPLOADED - -CANTx.UPLOADED: CANTx.tini - for i in ${TARGET}; do \ - ftp $$i < CANTx.upload; \ - echo $$i uploaded; \ - done - date > CANTx.UPLOADED \ No newline at end of file + rm -f CANRx.tini CANTx.tini \ No newline at end of file diff --git a/Changes b/Changes index 76f0529..af95534 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,19 @@ +2005.10.19 Criado o programa CmdDaemon, semelhante ao IODaemon, mas + apenas recebe comandos, sem enviar dados de sensores. + +2005.09.25 Reestruturados os Makefiles. Agora os Makefiles nos + diretorios utilizam as variaveis definidas no Makefile no + diretorio principal, ao inves de redefini-las. As + redefinicoes sao feitas apenas nas (poucas) vezes em que sao + necessarias. + + Criada a versao 1.5.1 + + Removidas as declaracoes de variaveis globais em arquivos em + Assembly e criada uma funcao dummy para defini-las nos + arquivos C, ja' que nao e' possivel emitir Assembly in-line + fora de funcoes. + 2005.09.02 Criado o programa EncoderRtRead para teste do encoder em tempo real utilizando as funcoes de ponto flutuante, ou seja, obtendo a leitura em radianos. diff --git a/CmdDaemon/CmdDaemon.java b/CmdDaemon/CmdDaemon.java new file mode 100644 index 0000000..75ef6bc --- /dev/null +++ b/CmdDaemon/CmdDaemon.java @@ -0,0 +1,192 @@ +/****************************************************************************** + + Actuator Interface Card + Command Daemon + Copyright (C) 2005 Walter Fetter Lages + + 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., 675 Mass Ave, Cambridge, MA 02139, USA. + + You can also obtain a copy of the GNU General Public License + at . + +*******************************************************************************/ + +import br.ufrgs.eletro.AIC.*; +import com.dalsemi.comm.*; +import com.dalsemi.system.*; +import java.io.*; +import java.lang.*; + +class CmdDaemon extends Thread +{ + static final int BASE=0x800000; + + static AIC aic; + static Host host; + static boolean debug=false; + static boolean udp=false; + static boolean help=false; + + public static void main(String[] args) throws IOException,CanBusException + { + int i; + int hostarg=0; + + System.out.println("AIC Command Daemon"); + System.out.println("Copyright (C) 2005 Walter Fetter Lages .\n"); + + switch(args.length) + { + case 0: + { + help=true; + break; + } + case 1: + { + if(args[0].equals("-debug") || + args[0].equals("-UDP")) help=true; + break; + } + case 2: + { + hostarg=1; + if(args[0].equals("-debug")) debug=true; + else help=true; + break; + } + case 3: + { + hostarg=1; + if(args[0].equals("-UDP")) udp=true; + else help=true; + break; + } + case 4: + { + hostarg=2; + if(args[0].equals("-debug")) debug=true; + else help=true; + if(args[1].equals("-UDP")) udp=true; + else help=true; + break; + } + default: + { + help=true; + } + } + + + if(help) + { + System.out.println("Usage:\tjava CmdDaemon.tini [-debug] aic_id"); + System.out.println("\tor"); + System.out.println("\tjava CmdDaemon.tini [-debug] -UDP controller_host status_port"); + System.exit(1); + } + try + { + aic=new AIC(BASE,24.0,20e3,2000); + if(udp) host=new HostUDP(args[hostarg],Integer.parseInt(args[hostarg+1])); + else host=new HostCAN(Integer.parseInt(args[hostarg])); + + GetCommand getCommand=new GetCommand(); + getCommand.setPriority(Thread.MAX_PRIORITY); + getCommand.start(); + + if(debug) System.out.println("getCommand priority="+getCommand.getPriority()); + } + catch (NumberFormatException nfe) + { + System.out.println("Usage: java CmdDaemon.tini [-debug] [-UDP controller_host port] | aicid"); + System.exit(1); + } + } +} + + +class GetCommand extends CmdDaemon +{ + public void run() + { + try + { + aic.on(); + aic.brake.release(); + + for(int k=0;;k++) + { + if(debug) System.out.print("k="+k+"\t"); + + int cmd=host.command(); + + if(debug) System.out.print("Command="+ cmd +"\t"); + + switch(cmd) + { + case Host.MOTOR_ON: + { + if(debug) System.out.print("Motor on\t"); + aic.motor.on(); + break; + } + case Host.MOTOR_OFF: + { + if(debug) System.out.print("Motor off\t"); + aic.motor.off(); + break; + } + case Host.MOTOR_ACT: + { + if(debug) System.out.print("Voltage="+host.voltage()+"\t"); + aic.motor.set(host.voltage()); + break; + } + case Host.BRAKE_RELEASE: + { + if(debug) System.out.print("Brake release\t"); + aic.brake.release(); + break; + } + case Host.BRAKE_APPLY: + { + if(debug) System.out.print("Brake apply\t"); + aic.brake.apply(); + break; + } +/* case Host.RESET: + { + if(debug) System.out.print("Reset\t"); + aic.reset(); + break; + } +*/ + default: + { + if(debug) System.out.print("Invalid\t"); + break; + } + + } + if(debug) System.out.println(""); + } + } + catch (Exception all) + { + all.printStackTrace(); + } + } +} diff --git a/CmdDaemon/Makefile b/CmdDaemon/Makefile new file mode 100644 index 0000000..c344464 --- /dev/null +++ b/CmdDaemon/Makefile @@ -0,0 +1,33 @@ +CLASSPATH=-classpath /opt/tini/bin/tini.jar:/opt/tini/bin/tiniclasses.jar:/opt/tini/bin/modules.jar:../lib/AIC.jar +APIDBPATH=-d /opt/tini/bin/tini.db +DEPPATH=-p /opt/tini/bin/modules.jar +DEPFILE=-x /opt/tini/bin/owapi_dep.txt +DEPNAME=-add CAN +LIBPATH=-path ../lib/AIC.jar +NATLIB=-n brake.tlib -n encoder.tlib -n index.tlib -n pwm.tlib +JAVAFLAGS=-O -target 1.1 -source 1.3 +TARGET= aic1 aic2 aic3 aic4 aic5 + +all: CmdDaemon.tini + +CmdDaemon.class: CmdDaemon.java ../lib/AIC.jar + javac ${JAVAFLAGS} ${CLASSPATH} CmdDaemon.java + +CmdDaemon.tini: CmdDaemon.class ../lib/AIC.jar + java ${CLASSPATH} BuildDependency ${DEPNAME} ${DEPFILE} ${DEPPATH} -f CmdDaemon.class ${APIDBPATH} -o CmdDaemon.tini ${LIBPATH} ${NATLIB} + +clean: + rm -f *.bak *~ *.class UPLOADED + +distclean: clean + rm -f CmdDaemon.tini + +upload: UPLOADED + +UPLOADED: CmdDaemon.tini + for i in ${TARGET}; do \ + ftp $$i < upload.ftp; \ + echo $$i uploaded; \ + done + + diff --git a/DoorDaemon/Makefile b/DoorDaemon/Makefile index 61af6de..0c9348c 100644 --- a/DoorDaemon/Makefile +++ b/DoorDaemon/Makefile @@ -1,18 +1,7 @@ -CLASSPATH=-classpath /opt/tini/bin/tini.jar:/opt/tini/bin/tiniclasses.jar:/opt/tini/bin/modules.jar:../lib/AIC.jar -APIDBPATH=-d /opt/tini/bin/tini.db -DEPPATH=-p /opt/tini/bin/modules.jar -DEPFILE=-x /opt/tini/bin/owapi_dep.txt -DEPNAME= -#-add CAN -LIBPATH=-path ../lib/AIC.jar -NATLIB=-n brake.tlib -n encoder.tlib -n index.tlib -n pwm.tlib -JAVAFLAGS=-O -target 1.1 -source 1.3 -TARGET= aic1 aic2 aic3 aic4 aic5 - all: DoorDaemon.tini DoorDaemon.class: DoorDaemon.java ../lib/AIC.jar - javac ${JAVAFLAGS} ${CLASSPATH} DoorDaemon.java + ${JAVAC} ${JAVAFLAGS} ${CLASSPATH} DoorDaemon.java DoorDaemon.tini: DoorDaemon.class ../lib/AIC.jar java ${CLASSPATH} BuildDependency ${DEPNAME} ${DEPFILE} ${DEPPATH} -f DoorDaemon.class ${APIDBPATH} -o DoorDaemon.tini ${LIBPATH} ${NATLIB} diff --git a/EncoderRtRead/Makefile b/EncoderRtRead/Makefile index fad82b1..2dd1996 100644 --- a/EncoderRtRead/Makefile +++ b/EncoderRtRead/Makefile @@ -1,25 +1,10 @@ -CLASSPATH=-classpath /opt/tini/bin/tini.jar:/opt/tini/bin/tiniclasses.jar -APIDBPATH=-d /opt/tini/bin/tini.db -TRTAIPATH=${HOME}/src/tini/rtai -TMATHPATH=${HOME}/src/tini/tmath -LIBPATH=-PATH ${TINIRTAIPATH}/lib/rtai.jar -JAVAFLAGS=-O -target 1.1 -source 1.3 -ASMINC=-I/opt/tini/native/lib -ASMOPT=-f 1.15 -p 390 -l -ASMMACRO=/opt/tini/native/bin/Linux/macro -ASM=/opt/tini/native/bin/Linux/a390 -CC=sdcc -CFLAGS=-mTININative -S --use-accelerator -CINCLUDE=-I${TRTAIPATH}/include -I${TMATHPATH}/include -I../include -CMPFLAGS=${CFLAGS} ${CINCLUDE} - all: EncoderRtRead.tini EncoderRtRead.class: EncoderRtRead.java ../lib/AIC.jar - javac ${JAVAFLAGS} ${CLASSPATH} EncoderRtRead.java + ${JAVAC} ${JAVAFLAGS} ${CLASSPATH} EncoderRtRead.java encoderread.mpp: encoderread.a51 - ${ASMMACRO} ${ASMINC} -e- encoderread.a51 + ${ASMMACRO} -I${ASMINC} -e- encoderread.a51 encoderread.tlib: encoderread.mpp ../lib/aicio.mpp.lib cat encoderread.mpp ${TRTAIPATH}/lib/rtai.mpp.lib ../lib/aicio.mpp.lib > tmp.mpp @@ -29,7 +14,7 @@ encoderread.tlib: encoderread.mpp ../lib/aicio.mpp.lib mv tmp.lst encoderread.lst encoderread.a51: encoderread.c - ${CC} ${CMPFLAGS} encoderread.c + ${SDCC} ${SDCCCMPFLAGS} encoderread.c EncoderRtRead.tini: EncoderRtRead.class encoderread.tlib java ${CLASSPATH} TINIConvertor -n encoderread.tlib -f EncoderRtRead.class ${APIDBPATH} -o EncoderRtRead.tini diff --git a/EncoderRtTest/Makefile b/EncoderRtTest/Makefile index 303f317..798d0a4 100644 --- a/EncoderRtTest/Makefile +++ b/EncoderRtTest/Makefile @@ -1,25 +1,10 @@ -CLASSPATH=-classpath /opt/tini/bin/tini.jar:/opt/tini/bin/tiniclasses.jar -APIDBPATH=-d /opt/tini/bin/tini.db -TRTAIPATH=${HOME}/src/tini/rtai -TMATHPATH=${HOME}/src/tini/tmath -LIBPATH=-PATH ${TINIRTAIPATH}/lib/rtai.jar -JAVAFLAGS=-O -target 1.1 -source 1.3 -ASMINC=-I/opt/tini/native/lib -ASMOPT=-f 1.15 -p 390 -l -ASMMACRO=/opt/tini/native/bin/Linux/macro -ASM=/opt/tini/native/bin/Linux/a390 -CC=sdcc -CFLAGS=-mTININative -S --use-accelerator -CINCLUDE=-I${TRTAIPATH}/include -I${TMATHPATH}/include -I../include -CMPFLAGS=${CFLAGS} ${CINCLUDE} - all: EncoderRtTest.tini EncoderRtTest.class: EncoderRtTest.java ../lib/AIC.jar - javac ${JAVAFLAGS} ${CLASSPATH} EncoderRtTest.java + ${JAVAC} ${JAVAFLAGS} ${CLASSPATH} EncoderRtTest.java encodertest.mpp: encodertest.a51 - ${ASMMACRO} ${ASMINC} -e- encodertest.a51 + ${ASMMACRO} -I${ASMINC} -e- encodertest.a51 encodertest.tlib: encodertest.mpp ../lib/aicio.mpp.lib cat encodertest.mpp ${TRTAIPATH}/lib/rtai.mpp.lib ../lib/aicio.mpp.lib > tmp.mpp @@ -29,7 +14,7 @@ encodertest.tlib: encodertest.mpp ../lib/aicio.mpp.lib mv tmp.lst encodertest.lst encodertest.a51: encodertest.c - ${CC} ${CMPFLAGS} encodertest.c + ${SDCC} ${SDCCCMPFLAGS} encodertest.c EncoderRtTest.tini: EncoderRtTest.class encodertest.tlib java ${CLASSPATH} TINIConvertor -n encodertest.tlib -f EncoderRtTest.class ${APIDBPATH} -o EncoderRtTest.tini diff --git a/EncoderTest/EncoderTest.java b/EncoderTest/EncoderTest.java index bff00f9..808e0c8 100644 --- a/EncoderTest/EncoderTest.java +++ b/EncoderTest/EncoderTest.java @@ -78,8 +78,8 @@ class EncoderTest while(run) { - for(i=-(int)MV;(i <= MV) && run;i++) iter(i); - for(i=(int)MV;(i >= -MV) && run;i--) iter(i); + for(i=-(int)MV;(i <= MV) && run;i++) iter(24); + for(i=(int)MV;(i >= -MV) && run;i--) iter(-24); } aic.off(); diff --git a/EncoderTest/Makefile b/EncoderTest/Makefile index 88f1ddb..91296e5 100644 --- a/EncoderTest/Makefile +++ b/EncoderTest/Makefile @@ -1,26 +1,21 @@ -CLASSPATH=-classpath /opt/tini/bin/tini.jar:/opt/tini/bin/tiniclasses.jar:../lib/AIC.jar -APIDBPATH=-d /opt/tini/bin/tini.db -LIBPATH=-path ../lib/AIC.jar -NATLIB=-n brake.tlib -n encoder.tlib -n index.tlib -n pwm.tlib -JAVAFLAGS=-O -target 1.1 -source 1.3 TARGET=aic5 all: EncoderTest.tini EncoderClear.tini EncoderRead.tini EncoderTest.class: EncoderTest.java ../lib/AIC.jar - javac ${JAVAFLAGS} ${CLASSPATH} EncoderTest.java + ${JAVAC} ${JAVAFLAGS} ${CLASSPATH} EncoderTest.java EncoderTest.tini: EncoderTest.class ../lib/AIC.jar java ${CLASSPATH} TINIConvertor -f EncoderTest.class ${APIDBPATH} ${NATLIB} -o EncoderTest.tini ${LIBPATH} -n brake.tlib -n encoder.tlib -n index.tlib -n pwm.tlib EncoderClear.class: EncoderClear.java - javac ${JAVAFLAGS} ${CLASSPATH} EncoderClear.java + ${JAVAC} ${JAVAFLAGS} ${CLASSPATH} EncoderClear.java EncoderClear.tini: EncoderClear.class java ${CLASSPATH} TINIConvertor -f EncoderClear.class ${APIDBPATH} -o EncoderClear.tini ${LIBPATH} EncoderRead.class: EncoderRead.java - javac ${JAVAFLAGS} ${CLASSPATH} EncoderRead.java + ${JAVAC} ${JAVAFLAGS} ${CLASSPATH} EncoderRead.java EncoderRead.tini: EncoderRead.class java ${CLASSPATH} TINIConvertor -f EncoderRead.class ${APIDBPATH} -o EncoderRead.tini ${LIBPATH} @@ -29,27 +24,4 @@ clean: rm -f *.bak *~ *.class distclean: clean - rm -f *.tini *UPLOADED - -upload: EncoderTest.UPLOADED EncoderClear.UPLOADED EncoderRead.UPLOADED - -EncoderTest.UPLOADED: EncoderTest.tini - for i in ${TARGET}; do \ - ftp $$i < EncoderTest.upload; \ - echo $$i uploaded; \ - done - date > EncoderTest.UPLOADED - -EncoderClear.UPLOADED: EncoderClear.tini - for i in ${TARGET}; do \ - ftp $$i < EncoderClear.upload; \ - echo $$i uploaded; \ - done - date > EncoderClear.UPLOADED - -EncoderRead.UPLOADED: EncoderRead.tini - for i in ${TARGET}; do \ - ftp $$i < EncoderRead.upload; \ - echo $$i uploaded; \ - done - date > EncoderRead.UPLOADED \ No newline at end of file + rm -f *.tini diff --git a/IODaemon/IODaemon.java b/IODaemon/IODaemon.java index 023354f..f642ba9 100644 --- a/IODaemon/IODaemon.java +++ b/IODaemon/IODaemon.java @@ -32,7 +32,7 @@ import java.lang.*; class IODaemon extends Thread { static final int BASE=0x800000; - static final int ST=50; + static final int ST=250; static AIC aic; static Host host; diff --git a/IODaemon/Makefile b/IODaemon/Makefile index b36e314..47df9f8 100644 --- a/IODaemon/Makefile +++ b/IODaemon/Makefile @@ -1,33 +1,14 @@ -CLASSPATH=-classpath /opt/tini/bin/tini.jar:/opt/tini/bin/tiniclasses.jar:/opt/tini/bin/modules.jar:../lib/AIC.jar -APIDBPATH=-d /opt/tini/bin/tini.db -DEPPATH=-p /opt/tini/bin/modules.jar -DEPFILE=-x /opt/tini/bin/owapi_dep.txt -DEPNAME=-add CAN -LIBPATH=-path ../lib/AIC.jar -NATLIB=-n brake.tlib -n encoder.tlib -n index.tlib -n pwm.tlib -JAVAFLAGS=-O -target 1.1 -source 1.3 -TARGET= aic1 aic2 aic3 aic4 aic5 - all: IODaemon.tini IODaemon.class: IODaemon.java ../lib/AIC.jar - javac ${JAVAFLAGS} ${CLASSPATH} IODaemon.java + ${JAVAC} ${JAVAFLAGS} ${CLASSPATH} IODaemon.java IODaemon.tini: IODaemon.class ../lib/AIC.jar java ${CLASSPATH} BuildDependency ${DEPNAME} ${DEPFILE} ${DEPPATH} -f IODaemon.class ${APIDBPATH} -o IODaemon.tini ${LIBPATH} ${NATLIB} clean: - rm -f *.bak *~ *.class UPLOADED + rm -f *.bak *~ *.class distclean: clean rm -f IODaemon.tini -upload: UPLOADED - -UPLOADED: IODaemon.tini - for i in ${TARGET}; do \ - ftp $$i < upload.ftp; \ - echo $$i uploaded; \ - done - - diff --git a/IndexRtTest/Makefile b/IndexRtTest/Makefile index 46ea9c0..8cf660b 100644 --- a/IndexRtTest/Makefile +++ b/IndexRtTest/Makefile @@ -1,37 +1,20 @@ -CLASSPATH=-classpath /opt/tini/bin/tini.jar:/opt/tini/bin/tiniclasses.jar -APIDBPATH=-d /opt/tini/bin/tini.db -TINIRTAIPATH=${HOME}/src/tini/rtai -LIBPATH=-PATH ${TINIRTAIPATH}/lib/rtai.jar -JAVAFLAGS=-O -target 1.1 -source 1.3 -ASMINC=-I/opt/tini/native/lib -ASMOPT=-f 1.15 -p 390 -l -ASMMACRO=/opt/tini/native/bin/Linux/macro -ASM=/opt/tini/native/bin/Linux/a390 -CC=sdcc -CFLAGS=-mTININative -S --use-accelerator -CINCLUDE=-I${TINIRTAIPATH}/include -I../include -CMPFLAGS=${CFLAGS} ${CINCLUDE} - all: IndexRtTest.tini IndexRtTest.class: IndexRtTest.java - javac ${CLASSPATH} ${JAVAFLAGS} IndexRtTest.java + ${JAVAC} ${CLASSPATH} ${JAVAFLAGS} IndexRtTest.java indextest.mpp: indextest.a51 - ${ASMMACRO} ${ASMINC} -e- indextest.a51 + ${ASMMACRO} -I${ASMINC} -e- indextest.a51 -globals.mpp: globals.a51 - ${ASMMACRO} ${ASMINC} -e- globals.a51 - -indextest.tlib: indextest.mpp globals.mpp ../lib/aicio.mpp.lib - cat indextest.mpp globals.mpp ${TINIRTAIPATH}/lib/rtai.mpp.lib ../lib/aicio.mpp.lib > tmp.mpp +indextest.tlib: indextest.mpp ../lib/aicio.mpp.lib + cat indextest.mpp ${TRTAIPATH}/lib/rtai.mpp.lib ../lib/aicio.mpp.lib > tmp.mpp echo end >> tmp.mpp ${ASM} ${ASMOPT} tmp.mpp mv tmp.tlib indextest.tlib mv tmp.lst indextest.lst indextest.a51: indextest.c - ${CC} ${CMPFLAGS} indextest.c + ${SDCC} ${SDCCCMPFLAGS} indextest.c IndexRtTest.tini: IndexRtTest.class indextest.tlib java ${CLASSPATH} TINIConvertor -n indextest.tlib -f IndexRtTest.class ${APIDBPATH} -o IndexRtTest.tini diff --git a/IndexRtTest/indextest.c b/IndexRtTest/indextest.c index a0a2e1e..b489c9b 100644 --- a/IndexRtTest/indextest.c +++ b/IndexRtTest/indextest.c @@ -33,6 +33,14 @@ extern volatile pthread_t th; extern volatile long index; +void indextest_globals(void) _naked +{ + _asm +th: db 0,0,0,0 +index: db 0,0,0,0 + _endasm; +} + void *indextest(void *arg) { index=index_read(); diff --git a/IndexTest/Makefile b/IndexTest/Makefile index 82ee860..d2e67bc 100644 --- a/IndexTest/Makefile +++ b/IndexTest/Makefile @@ -1,13 +1,7 @@ -CLASSPATH=-classpath /opt/tini/bin/tini.jar:/opt/tini/bin/tiniclasses.jar:../lib/AIC.jar -APIDBPATH=-d /opt/tini/bin/tini.db -LIBPATH=-path ../lib/AIC.jar -JAVAFLAGS=-O -target 1.1 -source 1.3 -NATLIB=-n brake.tlib -n encoder.tlib -n index.tlib -n pwm.tlib - all: IndexTest.tini IndexTest.class: IndexTest.java ../lib/AIC.jar - javac ${JAVAFLAGS} ${CLASSPATH} IndexTest.java + ${JAVAC} ${JAVAFLAGS} ${CLASSPATH} IndexTest.java IndexTest.tini: IndexTest.class ../lib/AIC.jar java ${CLASSPATH} TINIConvertor ${NATLIB} -f IndexTest.class ${APIDBPATH} -o IndexTest.tini ${LIBPATH} diff --git a/Makefile b/Makefile index 60dcde9..0b0d1b2 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,51 @@ +export CLASSPATH=-classpath /opt/tini/bin/tini.jar:/opt/tini/bin/tiniclasses.jar:/opt/tini/bin/modules.jar:../lib/AIC.jar +export DEPPATH=-p /opt/tini/bin/modules.jar +export DEPFILE=-x /opt/tini/bin/owapi_dep.txt +export DEPNAME=-add CAN +export LIBPATH=-path ../lib/AIC.jar +export NATLIB=-n brake.tlib -n encoder.tlib -n index.tlib -n pwm.tlib +export APIDBPATH=-d /opt/tini/bin/tini.db +export PKGPATH=br/ufrgs/eletro/AIC +export JAVAFLAGS=-O -target 1.1 -source 1.3 +export JAVAC=javac + +export NATINC=/opt/tini/native/lib +export ASMINC=../include +export TINIINC=${ASMINC}/tini.inc ${ASMINC}/tinimacro.inc ${ASMINC}/ds80c390.inc ${ASMINC}/apiequ.inc +export ASMOPT=-f 1.17 -p 390 -l +export ASMMACRO=/opt/tini/native/bin/Linux/macro +export ASM=/opt/tini/native/bin/Linux/a390 + +export CFLAGS=-O2 -Wall -march=i486 +export CINCLUDE=-I. -I${HOME}/include -I/usr/realtime/include -I/usr/local/include +export CLIBS=-lpthread -lcanlib -lcutil -lconio -lncurses + +export CPPFLAGS= +export CPPINCLUDE=-I${HOME}/include/cpp -I/usr/local/include/cpp -I../include +export CPPLIBDIR=-L${HOME}/lib -L../lib -L/usr/local/lib +export CPPLIBS=-lcpputil -laic -lcontrol +export INSTPREFIX=/usr/local +export LIBINST=$(INSTPREFIX)/lib +export INCLUDEINST=$(INSTPREFIX)/include + +export INCLUDE=${CINCLUDE} ${CPPINCLUDE} +export FLAGS= ${CFLAGS} ${CPPFLAGS} -DREAL_TIME -DVERBOSE -DDEBUG +export LIBDIR=${CLIBDIR} ${CPPLIBDIR} +export LIBS=${CLIBS} ${CPPLIBS} + +export CC=gcc +export CXX=g++ +export CMPFLAGS=${FLAGS} ${INCLUDE} +export LDFLAGS=${LIBDIR} ${LIBS} + +export TRTAIPATH=${HOME}/src/tini/rtai +export TMATHPATH=${HOME}/src/tini/tmath +export SDCC=sdcc +export SDCCFLAGS=-mTININative -S --use-accelerator +export SDCCINCLUDE=-I${TRTAIPATH}/include -I${TMATHPATH}/include -I../include +export SDCCCMPFLAGS=${SDCCFLAGS} ${SDCCINCLUDE} + + PACKAGES= doc \ lib \ AICOff \ @@ -18,6 +66,7 @@ PACKAGES= doc \ PID \ StrobeTest \ DoorDaemon \ + CmdDaemon \ aicd \ braketst \ encodertst \ diff --git a/MotorReset/Makefile b/MotorReset/Makefile index 713016f..76d23c4 100644 --- a/MotorReset/Makefile +++ b/MotorReset/Makefile @@ -1,13 +1,7 @@ -CLASSPATH=-classpath /opt/tini/bin/tini.jar:/opt/tini/bin/tiniclasses.jar:../lib/AIC.jar -APIDBPATH=-d /opt/tini/bin/tini.db -LIBPATH=-path ../lib/AIC.jar -NATLIB=-n brake.tlib -n encoder.tlib -n index.tlib -n pwm.tlib -JAVAFLAGS=-O -target 1.1 -source 1.3 - all: MotorReset.tini MotorReset.class: MotorReset.java ../lib/AIC.jar - javac ${JAVAFLAGS} ${CLASSPATH} MotorReset.java + ${JAVAC} ${JAVAFLAGS} ${CLASSPATH} MotorReset.java MotorReset.tini: MotorReset.class ../lib/AIC.jar java ${CLASSPATH} TINIConvertor -f MotorReset.class ${APIDBPATH} -o MotorReset.tini ${LIBPATH} ${NATLIB} diff --git a/MotorRtTest/Makefile b/MotorRtTest/Makefile index fd287a3..e585918 100644 --- a/MotorRtTest/Makefile +++ b/MotorRtTest/Makefile @@ -1,26 +1,10 @@ -CLASSPATH=-classpath /opt/tini/bin/tini.jar:/opt/tini/bin/tiniclasses.jar -APIDBPATH=-d /opt/tini/bin/tini.db -TRTAIPATH=${HOME}/src/tini/rtai -TMATHPATH=${HOME}/src/tini/tmath -LIBPATH=-PATH ${TRTAIPATH}/lib/rtai.jar -JAVAFLAGS=-O -target 1.1 -source 1.3 - -ASMINC=-I/opt/tini/native/lib -ASMOPT=-f 1.15 -p 390 -l -ASMMACRO=/opt/tini/native/bin/Linux/macro -ASM=/opt/tini/native/bin/Linux/a390 -CC=sdcc -CFLAGS=-mTININative -S --use-accelerator -CINCLUDE=-I${TRTAIPATH}/include -I${TMATHPATH}/include -I../include -CMPFLAGS=${CFLAGS} ${CINCLUDE} - all: MotorRtTest.tini MotorRtTest.class: MotorRtTest.java ../lib/AIC.jar - javac ${JAVAFLAGS} ${CLASSPATH} MotorRtTest.java + ${JAVAC} ${JAVAFLAGS} ${CLASSPATH} MotorRtTest.java motortest.mpp: motortest.a51 - ${ASMMACRO} ${ASMINC} -e- motortest.a51 + ${ASMMACRO} -I${ASMINC} -e- motortest.a51 motortest.tlib: motortest.mpp ../lib/aicio.mpp.lib cat motortest.mpp ${TRTAIPATH}/lib/rtai.mpp.lib ../lib/aicio.mpp.lib > tmp.mpp @@ -30,7 +14,7 @@ motortest.tlib: motortest.mpp ../lib/aicio.mpp.lib mv tmp.lst motortest.lst motortest.a51: motortest.c - ${CC} ${CMPFLAGS} motortest.c + ${SDCC} ${SDCCCMPFLAGS} motortest.c MotorRtTest.tini: MotorRtTest.class motortest.tlib java ${CLASSPATH} TINIConvertor -n motortest.tlib -f MotorRtTest.class ${APIDBPATH} -o MotorRtTest.tini diff --git a/MotorRtTest/globals.a51 b/MotorRtTest/globals.a51 deleted file mode 100644 index bb77d90..0000000 --- a/MotorRtTest/globals.a51 +++ /dev/null @@ -1,30 +0,0 @@ -;****************************************************************************** -; -; Actuator Interface Card -; Motor Real time Test -; Real Time Module Global Variables -; Copyright (C) 2005 Walter Fetter Lages -; -; 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., 675 Mass Ave, Cambridge, MA 02139, USA. -; -; You can also obtain a copy of the GNU General Public License -; at . -; -;*******************************************************************************/ - - -th: db 0,0 -voltage: db 0,0,0,0 - end diff --git a/MotorTest/Makefile b/MotorTest/Makefile index ae3baad..b5bc809 100644 --- a/MotorTest/Makefile +++ b/MotorTest/Makefile @@ -1,13 +1,7 @@ -CLASSPATH=-classpath /opt/tini/bin/tini.jar:/opt/tini/bin/tiniclasses.jar:../lib/AIC.jar -APIDBPATH=-d /opt/tini/bin/tini.db -LIBPATH=-path ../lib/AIC.jar -NATLIB=-n brake.tlib -n encoder.tlib -n index.tlib -n pwm.tlib -JAVAFLAGS=-O -target 1.1 -source 1.3 - all: MotorTest.tini MotorTest.class: MotorTest.java ../lib/AIC.jar - javac ${JAVAFLAGS} ${CLASSPATH} MotorTest.java + ${JAVAC} ${JAVAFLAGS} ${CLASSPATH} MotorTest.java MotorTest.tini: MotorTest.class ../lib/AIC.jar java ${CLASSPATH} TINIConvertor -f MotorTest.class ${APIDBPATH} -o MotorTest.tini ${LIBPATH} ${NATLIB} diff --git a/MotorTest/MotorTest.java b/MotorTest/MotorTest.java index fb2b079..18f321b 100644 --- a/MotorTest/MotorTest.java +++ b/MotorTest/MotorTest.java @@ -62,12 +62,12 @@ class MotorTest aic.brake.release(); - for(i=0;(i <= 24) && run;i++) iter(i); + for(i=0;(i <= 12) && run;i++) iter(i); while(run) { - for(i=24;(i >= -24) && run;i--) iter(i); - for(i=-24;(i <= 24) && run;i++) iter(i); + for(i=12;(i >= -12) && run;i--) iter(i); + for(i=-12;(i <= 12) && run;i++) iter(i); } aic.off(); } diff --git a/PID/Makefile b/PID/Makefile index 97c4442..005aa9e 100644 --- a/PID/Makefile +++ b/PID/Makefile @@ -1,25 +1,10 @@ -CLASSPATH=-classpath /opt/tini/bin/tini.jar:/opt/tini/bin/tiniclasses.jar -APIDBPATH=-d /opt/tini/bin/tini.db -TRTAIPATH=${HOME}/src/tini/rtai -TMATHPATH=${HOME}/src/tini/tmath -LIBPATH=-PATH ${TRTAIPATH}/lib/rtai.jar -JAVAFLAGS=-O -target 1.1 -source 1.3 -ASMINC=-I/opt/tini/native/lib -ASMOPT=-f 1.15 -p 390 -l -ASMMACRO=/opt/tini/native/bin/Linux/macro -ASM=/opt/tini/native/bin/Linux/a390 -CC=sdcc -CFLAGS=-mTININative -S --use-accelerator -CINCLUDE=-I${TRTAIPATH}/include -I${TMATHPATH}/include -I../include -CMPFLAGS=${CFLAGS} ${CINCLUDE} - all: PID.tini PID.class: PID.java - javac ${CLASSPATH} ${JAVAFLAGS} PID.java + ${JAVAC} ${CLASSPATH} ${JAVAFLAGS} PID.java pid.mpp: pid.a51 - ${ASMMACRO} ${ASMINC} -e- pid.a51 + ${ASMMACRO} -I${ASMINC} -e- pid.a51 pid.tlib: pid.mpp ${TRTAIPATH}/lib/rtai.mpp.lib ../lib/aicio.mpp.lib cat pid.mpp ${TRTAIPATH}/lib/rtai.mpp.lib ../lib/aicio.mpp.lib > tmp.mpp @@ -29,7 +14,7 @@ pid.tlib: pid.mpp ${TRTAIPATH}/lib/rtai.mpp.lib ../lib/aicio.mpp.lib mv tmp.lst pid.lst pid.a51: pid.c - ${CC} ${CMPFLAGS} pid.c + ${SDCC} ${SDCCCMPFLAGS} pid.c PID.tini: PID.class pid.tlib java ${CLASSPATH} TINIConvertor -n pid.tlib -f PID.class ${APIDBPATH} -o PID.tini diff --git a/PID/globals.a51 b/PID/globals.a51 deleted file mode 100644 index bf5b08d..0000000 --- a/PID/globals.a51 +++ /dev/null @@ -1,31 +0,0 @@ -;****************************************************************************** -; -; Actuator Interface Card -; PID -; Real Time Module Global Variables -; Copyright (C) 2005 Walter Fetter Lages -; -; 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., 675 Mass Ave, Cambridge, MA 02139, USA. -; -; You can also obtain a copy of the GNU General Public License -; at . -; -;*******************************************************************************/ - - -output: db 0,0,0,0 -th: db 0,0 -reference: db 0,0,0,0 - end diff --git a/PwmRtTest/Makefile b/PwmRtTest/Makefile index 23f2cf9..fcd3fab 100644 --- a/PwmRtTest/Makefile +++ b/PwmRtTest/Makefile @@ -1,25 +1,10 @@ -CLASSPATH=-classpath /opt/tini/bin/tini.jar:/opt/tini/bin/tiniclasses.jar -APIDBPATH=-d /opt/tini/bin/tini.db -TRTAIPATH=${HOME}/src/tini/rtai -TMATHPATH=${HOME}/src/tini/tmath -LIBPATH=-PATH ${TINIRTAIPATH}/lib/rtai.jar -JAVAFLAGS=-O -target 1.1 -source 1.3 -ASMINC=-I/opt/tini/native/lib -ASMOPT=-f 1.15 -p 390 -l -ASMMACRO=/opt/tini/native/bin/Linux/macro -ASM=/opt/tini/native/bin/Linux/a390 -CC=sdcc -CFLAGS=-mTININative -S --use-accelerator -CINCLUDE=-I${TRTAIPATH}/include -I${TMATHPATH}/include -I../include -CMPFLAGS=${CFLAGS} ${CINCLUDE} - all: PwmRtTest.tini PwmRtTest.class: PwmRtTest.java ../lib/AIC.jar - javac ${JAVAFLAGS} ${CLASSPATH} PwmRtTest.java + ${JAVAC} ${JAVAFLAGS} ${CLASSPATH} PwmRtTest.java pwmtest.mpp: pwmtest.a51 - ${ASMMACRO} ${ASMINC} -e- pwmtest.a51 + ${ASMMACRO} -I${ASMINC} -e- pwmtest.a51 pwmtest.tlib: pwmtest.mpp ../lib/aicio.mpp.lib cat pwmtest.mpp ${TRTAIPATH}/lib/rtai.mpp.lib ../lib/aicio.mpp.lib > tmp.mpp @@ -29,7 +14,7 @@ pwmtest.tlib: pwmtest.mpp ../lib/aicio.mpp.lib mv tmp.lst pwmtest.lst pwmtest.a51: pwmtest.c ../include/aicio.h - ${CC} ${CMPFLAGS} pwmtest.c + ${SDCC} ${SDCCCMPFLAGS} pwmtest.c PwmRtTest.tini: PwmRtTest.class pwmtest.tlib java ${CLASSPATH} TINIConvertor -n pwmtest.tlib -f PwmRtTest.class ${APIDBPATH} -o PwmRtTest.tini diff --git a/StrobeTest/Makefile b/StrobeTest/Makefile index b58ec5e..a14e5b0 100644 --- a/StrobeTest/Makefile +++ b/StrobeTest/Makefile @@ -1,11 +1,7 @@ -CLASSPATH=-classpath /opt/tini/bin/tini.jar:/opt/tini/bin/tiniclasses.jar -APIDBPATH=-d /opt/tini/bin/tini.db -JAVAFLAGS=-O -target 1.1 -source 1.3 - all: StrobeTest.tini StrobeTest.class: StrobeTest.java - javac ${JAVAFLAGS} ${CLASSPATH} StrobeTest.java + ${JAVAC} ${JAVAFLAGS} ${CLASSPATH} StrobeTest.java StrobeTest.tini: StrobeTest.class java ${CLASSPATH} TINIConvertor -f StrobeTest.class ${APIDBPATH} -o StrobeTest.tini diff --git a/TODO b/TODO index e2b7e62..9de8f4e 100644 --- a/TODO +++ b/TODO @@ -1,8 +1,6 @@ - Reorganizar a estrutura de diretorios. -- Reunir todas as configuracoes dos Makefiles em um unico arquivo. - -- Implementar todas os metodos da classe AIC em C. +- Implementar todos os metodos da classe AIC em C. - Utilizar RCCI/RCCL? diff --git a/aicd/Makefile b/aicd/Makefile index 79dc316..eec006f 100644 --- a/aicd/Makefile +++ b/aicd/Makefile @@ -1,33 +1,10 @@ -PRJLIBDIR=../lib -PRJINCLUDE=../include -PRJFLAGS=-DREAL_TIME -DVERBOSE -DDEBUG - -CFLAGS=-O2 -Wall -march=i486 ${PRJFLAGS} -CINCLUDE=-I. -I${HOME}/include -I/usr/local/include -I/usr/realtime/include -CLIBDIR=-L${HOME}/lib -L/usr/local/lib -CLIBS=-lpthread -lcanlib - -CPPFLAGS= -CPPINCLUDE=-I${HOME}/include/cpp -I/usr/local/include/cpp -I../include -CPPLIBDIR=-L${HOME}/lib/cpp -L../lib -CPPLIBS=-laic - -INCLUDE=${CINCLUDE} ${CPPINCLUDE} -FLAGS= ${CFLAGS} ${CPPFLAGS} -LIBDIR=${CLIBDIR} ${CPPLIBDIR} -LIBS=${CPPLIBS} ${CLIBS} - -CMP= g++ -CMPFLAGS= ${FLAGS} ${INCLUDE} -LDFLAGS= ${LIBDIR} ${LIBS} - all: aicd .runinfo -aicd: aicd.cpp ${PRJINCLUDE}/aicsim.h ${PRJINCLUDE}/aichost.h ${PRJLIBDIR}/libaic.a - ${CMP} ${CMPFLAGS} -o aicd aicd.cpp ${LDFLAGS} +aicd: aicd.cpp ../include/aicsim.h ../include/aichost.h ../lib/libaic.a + ${CXX} ${CMPFLAGS} -o aicd aicd.cpp ${LDFLAGS} -${PRJLIBDIR}/libaic.a: - $(MAKE) -C ${PRJLIBDIR} +../lib/libaic.a: + $(MAKE) -C ../lib clean: rm -f *~ *.bak *.o @@ -37,6 +14,6 @@ install: distclean: clean rm -f aicd .runinfo -.runinfo: runinfo - cp runinfo .runinfo +.runinfo: + echo "aicd:lxrt:./aicd;popall:" > .runinfo diff --git a/braketst/Makefile b/braketst/Makefile index 1cef1e6..454046c 100644 --- a/braketst/Makefile +++ b/braketst/Makefile @@ -1,26 +1,7 @@ -CFLAGS=-O2 -Wall -march=i486 -CINCLUDE=-I${HOME}/include -CLIBDIR=-L${HOME}/lib -CLIBS=-lcutil -lcanlib - -CPPFLAGS= -CPPINCLUDE=-I../include -I${HOME}/include/cpp -I/usr/local/include/cpp -CPPLIBDIR=-L../lib -L${HOME}/lib/cpp -L${HOME}/lib -CPPLIBS=-laic - -INCLUDE=${CINCLUDE} ${CPPINCLUDE} -FLAGS= ${CFLAGS} ${CPPFLAGS} -DDEBUG -LIBDIR=${CLIBDIR} ${CPPLIBDIR} -LIBS=${CLIBS} ${CPPLIBS} - -CMP= g++ -CMPFLAGS= ${FLAGS} ${INCLUDE} -LDFLAGS= ${LIBDIR} ${LIBS} - all: braketst braketst: braketst.cpp ../lib/libaic.a - ${CMP} ${CMPFLAGS} -o braketst braketst.cpp ${LDFLAGS} + ${CXX} ${CMPFLAGS} -o braketst braketst.cpp ${LDFLAGS} clean: rm -f *~ *.bak *.o diff --git a/doc/Doxyfile b/doc/Doxyfile index 60d94e0..aacbd6b 100644 --- a/doc/Doxyfile +++ b/doc/Doxyfile @@ -23,7 +23,7 @@ PROJECT_NAME = "Actuator Interface Card" # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = "1.3.0" +PROJECT_NUMBER = "1.5.1" # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. @@ -428,7 +428,7 @@ INPUT = . \ # *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx *.hpp # *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm -FILE_PATTERNS = *.dox *.h *.inc *.c *.cpp *.java *.a51 +FILE_PATTERNS = *.dox *.h *.inc *.java # The RECURSIVE tag can be used to turn specify whether or not subdirectories # should be searched for input files as well. Possible values are YES and NO. diff --git a/encodertst/Makefile b/encodertst/Makefile index c433a45..e30494a 100644 --- a/encodertst/Makefile +++ b/encodertst/Makefile @@ -1,26 +1,7 @@ -CFLAGS=-O2 -Wall -march=i486 -CINCLUDE=-I${HOME}/include -CLIBDIR=-L${HOME}/lib -CLIBS=-lcanlib - -CPPFLAGS= -CPPINCLUDE=-I../include -I${HOME}/include/cpp -I/usr/local/include/cpp -CPPLIBDIR=-L../lib -L${HOME}/lib/cpp -L${HOME}/lib -CPPLIBS=-laic - -INCLUDE=${CINCLUDE} ${CPPINCLUDE} -FLAGS= ${CFLAGS} ${CPPFLAGS} -DDEBUG -LIBDIR=${CLIBDIR} ${CPPLIBDIR} -LIBS=${CLIBS} ${CPPLIBS} - -CMP= g++ -CMPFLAGS= ${FLAGS} ${INCLUDE} -LDFLAGS= ${LIBDIR} ${LIBS} - all: encodertst encodertst: encodertst.cpp ../lib/libaic.a - ${CMP} ${CMPFLAGS} -o encodertst encodertst.cpp ${LDFLAGS} + ${CXX} ${CMPFLAGS} -o encodertst encodertst.cpp ${LDFLAGS} clean: rm -f *~ *.bak *.o diff --git a/include/aiccan.h b/include/aiccan.h index eb6cbd8..0cf872f 100644 --- a/include/aiccan.h +++ b/include/aiccan.h @@ -36,7 +36,7 @@ @author Walter Fetter Lages */ -/** @defgroup aichost AIC Host Interface +/** @addtogroup aichost @{ */ diff --git a/include/aichost.h b/include/aichost.h index 6675c43..bb137d3 100644 --- a/include/aichost.h +++ b/include/aichost.h @@ -33,7 +33,7 @@ @author Walter Fetter Lages */ -/** @defgroup aicsim AIC Simulator Interface +/** @addtogroup aicsim @{ */ diff --git a/include/aichostcan.h b/include/aichostcan.h index 9085a2e..1a929c3 100644 --- a/include/aichostcan.h +++ b/include/aichostcan.h @@ -36,7 +36,7 @@ @author Walter Fetter Lages */ -/** @defgroup aicsim AIC Simulator Interface +/** @addtogroup aicsim @{ */ diff --git a/include/aichostudp.h b/include/aichostudp.h index 4b8bd86..dfca3ac 100644 --- a/include/aichostudp.h +++ b/include/aichostudp.h @@ -37,7 +37,7 @@ @author Walter Fetter Lages */ -/** @defgroup aicsim AIC Simulator Interface +/** @addtogroup aicsim @{ */ diff --git a/include/aicnet.h b/include/aicnet.h index 04f80e0..4c0c5fd 100644 --- a/include/aicnet.h +++ b/include/aicnet.h @@ -31,7 +31,7 @@ @author Walter Fetter Lages */ -/** @defgroup aichost AIC Host Interface +/** @addtogroup aichost @{ */ diff --git a/include/aicudp.h b/include/aicudp.h index f2d677a..d336c3a 100644 --- a/include/aicudp.h +++ b/include/aicudp.h @@ -36,7 +36,7 @@ @author Walter Fetter Lages */ -/** @defgroup aichost AIC Host Interface +/** @addtogroup aichost @{ */ diff --git a/indextst/Makefile b/indextst/Makefile index ed05178..9ea7349 100644 --- a/indextst/Makefile +++ b/indextst/Makefile @@ -1,26 +1,7 @@ -CFLAGS=-O2 -Wall -march=i486 -CINCLUDE=-I${HOME}/include -CLIBDIR=-L${HOME}/lib -CLIBS=-lcanlib - -CPPFLAGS= -CPPINCLUDE=-I../include -I${HOME}/include/cpp -I/usr/local/include/cpp -CPPLIBDIR=-L../lib -L${HOME}/lib/cpp -L${HOME}/lib -CPPLIBS=-laic - -INCLUDE=${CINCLUDE} ${CPPINCLUDE} -FLAGS= ${CFLAGS} ${CPPFLAGS} -DDEBUG -LIBDIR=${CLIBDIR} ${CPPLIBDIR} -LIBS=${CLIBS} ${CPPLIBS} - -CMP= g++ -CMPFLAGS= ${FLAGS} ${INCLUDE} -LDFLAGS= ${LIBDIR} ${LIBS} - all: indextst indextst: indextst.cpp ../lib/libaic.a - ${CMP} ${CMPFLAGS} -o indextst indextst.cpp ${LDFLAGS} + ${CXX} ${CMPFLAGS} -o indextst indextst.cpp ${LDFLAGS} clean: rm -f *~ *.bak *.o diff --git a/jointtst/Makefile b/jointtst/Makefile index c363fc2..1e9423f 100644 --- a/jointtst/Makefile +++ b/jointtst/Makefile @@ -1,26 +1,7 @@ -CFLAGS=-O2 -Wall -march=i486 -CINCLUDE=-I${HOME}/include -CLIBDIR=-L${HOME}/lib -CLIBS=-lcutil -lconio -lncurses -lcanlib - -CPPFLAGS= -CPPINCLUDE=-I../include -I${HOME}/include/cpp -I/usr/local/include/cpp -CPPLIBDIR=-L../lib -L${HOME}/lib/cpp -L${HOME}/lib -CPPLIBS=-lcpputil -laic - -INCLUDE=${CINCLUDE} ${CPPINCLUDE} -FLAGS= ${CFLAGS} ${CPPFLAGS} -DDEBUG -LIBDIR=${CLIBDIR} ${CPPLIBDIR} -LIBS=${CLIBS} ${CPPLIBS} - -CMP= g++ -CMPFLAGS= ${FLAGS} ${INCLUDE} -LDFLAGS= ${LIBDIR} ${LIBS} - all: jointtst jointtst: jointtst.cpp ../lib/libaic.a - ${CMP} ${CMPFLAGS} -o jointtst jointtst.cpp ${LDFLAGS} + ${CXX} ${CMPFLAGS} -o jointtst jointtst.cpp ${LDFLAGS} clean: rm -f *~ *.bak *.o diff --git a/lib/Brake.java b/lib/Brake.java index 19cefa8..a258c9e 100644 --- a/lib/Brake.java +++ b/lib/Brake.java @@ -25,7 +25,7 @@ package br.ufrgs.eletro.AIC; -/** @defgroup aichardware AIC Hardware Interface +/** @addtogroup aichardware @{ */ diff --git a/lib/CtrlRegister.java b/lib/CtrlRegister.java index c783df0..518f321 100644 --- a/lib/CtrlRegister.java +++ b/lib/CtrlRegister.java @@ -25,7 +25,7 @@ package br.ufrgs.eletro.AIC; -/** @defgroup aichardware AIC Hardware Interface +/** @addtogroup aichardware @{ */ diff --git a/lib/Encoder.java b/lib/Encoder.java index 9239946..a80695f 100644 --- a/lib/Encoder.java +++ b/lib/Encoder.java @@ -25,7 +25,7 @@ package br.ufrgs.eletro.AIC; -/** @defgroup aichardware AIC Hardware Interface +/** @addtogroup aichardware @{ */ diff --git a/lib/Host.java b/lib/Host.java index 4271e4c..789023f 100644 --- a/lib/Host.java +++ b/lib/Host.java @@ -27,7 +27,7 @@ package br.ufrgs.eletro.AIC; import java.lang.*; -/** @defgroup aichardware AIC Hardware Interface +/** @addtogroup aichardware @{ */ diff --git a/lib/HostCAN.java b/lib/HostCAN.java index 8ac453a..c7c9549 100644 --- a/lib/HostCAN.java +++ b/lib/HostCAN.java @@ -31,7 +31,7 @@ import com.dalsemi.comm.*; import com.dalsemi.system.*; import java.lang.*; -/** @defgroup aichardware AIC Hardware Interface +/** @addtogroup aichardware @{ */ diff --git a/lib/HostUDP.java b/lib/HostUDP.java index 7b01691..22e133d 100644 --- a/lib/HostUDP.java +++ b/lib/HostUDP.java @@ -31,7 +31,7 @@ import java.net.*; import java.lang.*; import java.io.*; -/** @defgroup aichardware AIC Hardware Interface +/** @addtogroup aichardware @{ */ diff --git a/lib/Index.java b/lib/Index.java index e99d3da..db01ae1 100644 --- a/lib/Index.java +++ b/lib/Index.java @@ -25,7 +25,7 @@ package br.ufrgs.eletro.AIC; -/** @defgroup aichardware AIC Hardware Interface +/** @addtogroup aichardware @{ */ diff --git a/lib/Makefile b/lib/Makefile index 5702eae..83a5cc2 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -1,69 +1,39 @@ - -CLASSPATH=-classpath /opt/tini/bin/tini.jar:/opt/tini/bin/tiniclasses.jar:/opt/tini/bin/modules.jar:. -APIDBPATH=-d /opt/tini/bin/tini.db -PKGPATH=br/ufrgs/eletro/AIC -JAVAFLAGS=-O -target 1.1 -source 1.3 - -NATINC=/opt/tini/native/lib -ASMINC=../include -TINIINC=${ASMINC}/tini.inc ${ASMINC}/tinimacro.inc ${ASMINC}/ds80c390.inc ${ASMINC}/apiequ.inc -ASMOPT=-f 1.15 -p 390 -l -ASMMACRO=/opt/tini/native/bin/Linux/macro -ASM=/opt/tini/native/bin/Linux/a390 - -CFLAGS = -O2 -Wall -march=i486 -INCLUDE = -I. -I${HOME}/include - -CPPFLAGS = -CPPINCLUDE = -I${HOME}/include/cpp -I/usr/local/include/cpp -I../include -LIB = ${HOME}/lib - -LIBINST=/usr/local/lib -INCLUDEINST=/usr/local/include - -INCLUDE=${CINCLUDE} ${CPPINCLUDE} -FLAGS= ${CFLAGS} ${CPPFLAGS} -DDEBUG -LIBDIR=${CLIBDIR} ${CPPLIBDIR} -LIBS=${CLIBS} ${CPPLIBS} - -CMP= g++ -CMPFLAGS= ${FLAGS} ${INCLUDE} -LDFLAGS= ${LIBDIR} ${LIBS} +export CLASSPATH:=${CLASSPATH}:. all: AIC.jar libaic.a aicio.mpp.lib ${PKGPATH}/PLD.class: PLD.java - javac ${JAVAFLAGS} ${CLASSPATH} -d . PLD.java + ${JAVAC} ${JAVAFLAGS} ${CLASSPATH} -d . PLD.java ${PKGPATH}/CtrlRegister.class: CtrlRegister.java - javac ${JAVAFLAGS} ${CLASSPATH} -d . CtrlRegister.java + ${JAVAC} ${JAVAFLAGS} ${CLASSPATH} -d . CtrlRegister.java ${PKGPATH}/PWM.class: PWM.java - javac ${JAVAFLAGS} ${CLASSPATH} -d . PWM.java + ${JAVAC} ${JAVAFLAGS} ${CLASSPATH} -d . PWM.java ${PKGPATH}/Motor.class: Motor.java ${PKGPATH}/PWM.class - javac ${JAVAFLAGS} ${CLASSPATH} -d . Motor.java + ${JAVAC} ${JAVAFLAGS} ${CLASSPATH} -d . Motor.java ${PKGPATH}/Encoder.class: Encoder.java - javac ${JAVAFLAGS} ${CLASSPATH} -d . Encoder.java + ${JAVAC} ${JAVAFLAGS} ${CLASSPATH} -d . Encoder.java ${PKGPATH}/Brake.class: Brake.java - javac ${JAVAFLAGS} ${CLASSPATH} -d . Brake.java + ${JAVAC} ${JAVAFLAGS} ${CLASSPATH} -d . Brake.java ${PKGPATH}/Index.class: Index.java - javac ${JAVAFLAGS} ${CLASSPATH} -d . Index.java + ${JAVAC} ${JAVAFLAGS} ${CLASSPATH} -d . Index.java ${PKGPATH}/AIC.class: AIC.java - javac ${JAVAFLAGS} ${CLASSPATH} -d . AIC.java + ${JAVAC} ${JAVAFLAGS} ${CLASSPATH} -d . AIC.java ${PKGPATH}/Host.class: Host.java - javac ${JAVAFLAGS} ${CLASSPATH} -d . Host.java + ${JAVAC} ${JAVAFLAGS} ${CLASSPATH} -d . Host.java ${PKGPATH}/HostUDP.class: HostUDP.java - javac ${JAVAFLAGS} ${CLASSPATH} -d . HostUDP.java + ${JAVAC} ${JAVAFLAGS} ${CLASSPATH} -d . HostUDP.java ${PKGPATH}/HostCAN.class: HostCAN.java - javac ${JAVAFLAGS} ${CLASSPATH} -d . HostCAN.java + ${JAVAC} ${JAVAFLAGS} ${CLASSPATH} -d . HostCAN.java ${ASMINC}/tini.inc: ${NATINC}/tini.inc ln -s ${NATINC}/tini.inc ${ASMINC}/tini.inc @@ -144,25 +114,25 @@ AIC.jar: ${PKGPATH}/PLD.class\ jar cf AIC.jar ${PKGPATH} brake.tlib index.tlib encoder.tlib pwm.tlib aic.o: aic.cpp ../include/aic.h - gcc ${CMPFLAGS} ${INCLUDE} ${CPPINCLUDE} -c aic.cpp + ${CXX} ${CMPFLAGS} ${INCLUDE} ${CPPINCLUDE} -c aic.cpp aicudp.o: aicudp.cpp ../include/aic.h ../include/aicnet.h ../include/aicudp.h - gcc ${CMPFLAGS} ${INCLUDE} ${CPPINCLUDE} -c aicudp.cpp + ${CXX} ${CMPFLAGS} ${INCLUDE} ${CPPINCLUDE} -c aicudp.cpp aiccan.o: aiccan.cpp ../include/aic.h ../include/aicnet.h ../include/aiccan.h - gcc ${CMPFLAGS} ${INCLUDE} ${CPPINCLUDE} -c aiccan.cpp + ${CXX} ${CMPFLAGS} ${INCLUDE} ${CPPINCLUDE} -c aiccan.cpp aicsim.o: aicsim.cpp ../include/aic.h ../include/aicnet.h ../include/aicsim.h - gcc ${CMPFLAGS} ${INCLUDE} ${CPPINCLUDE} -c aicsim.cpp + ${CXX} ${CMPFLAGS} ${INCLUDE} ${CPPINCLUDE} -c aicsim.cpp aichost.o: aichost.cpp ../include/aichost.h ../include/aicnet.h - gcc ${CMPFLAGS} ${INCLUDE} ${CPPINCLUDE} -c aichost.cpp + ${CXX} ${CMPFLAGS} -c aichost.cpp aichostudp.o: aichostudp.cpp ../include/aichostudp.h ../include/aicnet.h - gcc ${CMPFLAGS} ${INCLUDE} ${CPPINCLUDE} -c aichostudp.cpp + ${CXX} ${CMPFLAGS} -c aichostudp.cpp aichostcan.o: aichostcan.cpp ../include/aichostcan.h ../include/aicnet.h - gcc ${CMPFLAGS} ${INCLUDE} ${CPPINCLUDE} -c aichostcan.cpp + ${CXX} ${CMPFLAGS} -c aichostcan.cpp libaic.a: aic.o aicudp.o aiccan.o aicsim.o aichost.o aichostudp.o aichostcan.o ar -crvs libaic.a aic.o aicudp.o aiccan.o aicsim.o aichost.o aichostudp.o aichostcan.o @@ -182,10 +152,12 @@ install: clean: rm -rf *.o *~ *.bak *.class ../include/{*.bak,*~} br *.tlib *.mpp ${TINIINC} *.lst + $(MAKE) -C aicio clean $(MAKE) -C tlib clean distclean: clean rm -rf AIC.jar *.a aicio.mpp.lib + $(MAKE) -C aicio distclean $(MAKE) -C tlib distclean uninstall: diff --git a/lib/Motor.java b/lib/Motor.java index c12edd2..17843a8 100644 --- a/lib/Motor.java +++ b/lib/Motor.java @@ -25,7 +25,7 @@ package br.ufrgs.eletro.AIC; -/** @defgroup aichardware AIC Hardware Interface +/** @addtogroup aichardware @{ */ diff --git a/lib/PLD.java b/lib/PLD.java index 8553eb8..b571a2f 100644 --- a/lib/PLD.java +++ b/lib/PLD.java @@ -25,7 +25,7 @@ package br.ufrgs.eletro.AIC; -/** @defgroup aichardware AIC Hardware Interface +/** @addtogroup aichardware @{ */ diff --git a/lib/PWM.java b/lib/PWM.java index 3837e80..42018b2 100644 --- a/lib/PWM.java +++ b/lib/PWM.java @@ -25,7 +25,7 @@ package br.ufrgs.eletro.AIC; -/** @defgroup aichardware AIC Hardware Interface +/** @addtogroup aichardware @{ */ diff --git a/lib/aicio/Makefile b/lib/aicio/Makefile index 5e22640..c9c5266 100644 --- a/lib/aicio/Makefile +++ b/lib/aicio/Makefile @@ -1,36 +1,5 @@ -CLASSPATH=-classpath /opt/tini/bin/tini.jar:/opt/tini/bin/tiniclasses.jar:/opt/tini/bin/modules.jar:. -APIDBPATH=-d /opt/tini/bin/tini.db -PKGPATH=br/ufrgs/eletro/AIC -JAVAFLAGS=-O -target 1.1 -source 1.3 - -NATINC=/opt/tini/native/lib -ASMINC=../../include +ASMINC:=../${ASMINC} TINIINC=${ASMINC}/tini.inc ${ASMINC}/tinimacro.inc ${ASMINC}/ds80c390.inc ${ASMINC}/apiequ.inc -ASMOPT=-f 1.15 -p 390 -l -ASMMACRO=/opt/tini/native/bin/Linux/macro -ASM=/opt/tini/native/bin/Linux/a390 - -#CFLAGS = -O2 -Wall -march=i486 -CFLAGS=-mTININative -S --use-accelerator -#CINCLUDE = -I. -I${HOME}/include -CINCLUDE=-I${TINIRTAIPATH}/include -I../../include - -CPPFLAGS = -CPPINCLUDE = -I${HOME}/include/cpp -I/usr/local/include/cpp -I../../include -LIB = ${HOME}/lib - -LIBINST=/usr/local/lib -INCLUDEINST=/usr/local/include - -INCLUDE=${CINCLUDE} ${CPPINCLUDE} -FLAGS= ${CFLAGS} ${CPPFLAGS} -DDEBUG -LIBDIR=${CLIBDIR} ${CPPLIBDIR} -LIBS=${CLIBS} ${CPPLIBS} - -#CMP= g++ -CMP= sdcc -CMPFLAGS= ${FLAGS} ${INCLUDE} -LDFLAGS= ${LIBDIR} ${LIBS} all: aicio.mpp.lib diff --git a/lib/aicio/pwm.a51 b/lib/aicio/pwm.a51 index 7524a3c..e409a6d 100644 --- a/lib/aicio/pwm.a51 +++ b/lib/aicio/pwm.a51 @@ -250,7 +250,6 @@ pwm_parmabove: mov r3,#00h ; forces R3:R2:R1:R0=1000000 mov r0,#40h pwm_parmok: - ; ljmp pwm_countok ; debug @@ -351,6 +350,7 @@ pwm_countabove: clr c ; check if count > max_count-min_count mov r1,R3_B0 pwm_countok: + ; mov r0,#250 ; debug ; mov r1,#0 diff --git a/lib/brake.a51 b/lib/brake.a51 deleted file mode 100644 index 3f77038..0000000 --- a/lib/brake.a51 +++ /dev/null @@ -1,88 +0,0 @@ -;****************************************************************************** -; -; Actuator Interface Card -; Brake Functions -; Copyright (C) 2005 Walter Fetter Lages -; -; 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., 675 Mass Ave, Cambridge, MA 02139, USA. -; -; You can also obtain a copy of the GNU General Public License -; at . -; -;******************************************************************************* - -$include(tini.inc) -$include(ds80c390.inc) -$include(tinimacro.inc) - -$include(aicpld.inc) -$include(aicmacro.inc) - -; data saved in big-endian mode -; Brake base address -brake_base: db 0,0,0 - -; Initializes Brake -; void brake_initialize(unsigned long base); -brake_initialize: - mov r0,dpl ; parameter in b:dpx:dph:dpl - mov r1,dph ; BUG IN SDCC MANUAL! - mov r2,dpx - mov r3,b - - mov dptr,#CONTROL ; compute brake address - lcall Add_Dptr1_24 ; dptr=dptr+R2:R1:R0 - - STORE24 #brake_base ; store brake address - - clr a ; success - ret - -; Applies the electromagnetic brakes -; void brake_apply(void) -brake_apply: - LOAD24 #brake_base ; get brake address - - SET_STRETCH STRETCH - - ENTER_PCE_SPACE_AND_PUSH_STATE #0 - mov a,#BRAKEAPPLY ; apply brake - movx @dptr,a - EXIT_PCE_SPACE_AND_POP_STATE - - - RESTORE_STRETCH r0 - - clr a ; success - ret - -; Releases the electromagnetic brake -; void brake_release(void) -brake_release: - LOAD24 #brake_base ; get brake address - - SET_STRETCH STRETCH - - ENTER_PCE_SPACE_AND_PUSH_STATE #0 - mov a,#BRAKERELEASE ; release brake - movx @dptr,a - EXIT_PCE_SPACE_AND_POP_STATE - - RESTORE_STRETCH r0 - - clr a ; success - ret - - end diff --git a/lib/encoder.a51 b/lib/encoder.a51 deleted file mode 100644 index c9cc67d..0000000 --- a/lib/encoder.a51 +++ /dev/null @@ -1,159 +0,0 @@ -;****************************************************************************** -; -; Actuator Interface Card -; Encoder Native Methods -; Copyright (C) 2004 Walter Fetter Lages -; -; 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., 675 Mass Ave, Cambridge, MA 02139, USA. -; -; You can also obtain a copy of the GNU General Public License -; at . -; -;******************************************************************************* - -$include(tini.inc) -$include(ds80c390.inc) -$include(tinimacro.inc) - -$include(aicpld.inc) -$include(aicmacro.inc) - -; Native library initialization routine -; This routine must exist -; This routine must be at offset 0 -; If -f and -p options are used, a390 relocates this routine -; to another offset -; Label is meaningless and is not used by Java Sytem.LoadLibrary() -lib_init: - clr a ; success - ret - -; data saved in big-endian mode -; Encoder base address -base: db 0,0,0 - -; Initializes Encoder -; private static native void initialize(int base); -native_initialize: - clr a - - lcall Natlib_LoadPrimitive ; get parameter in R3:R2:R1:R0 - - mov dptr,#ENCODER ; compute encoder address - lcall Add_Dptr1_24 ; dptr=dptr+R2:R1:R0 - - STORE24 #base ; store encoder address - - SET_STRETCH STRETCH - - ENTER_PCE_SPACE_AND_PUSH_STATE #0 - clr a ; clear encoder - movx @dptr,a - EXIT_PCE_SPACE_AND_POP_STATE - - RESTORE_STRETCH r0 - - clr a ; sucess - ret - -; Finalizes Encoder -; public native void finalize() -native_finalize: - - ; fall-through to native_clear: - -; Clears the counter on the quadrature decoder chip -; public void clear() -native_clear: - LOAD24 #base ; get encoder address - - SET_STRETCH STRETCH - - ENTER_PCE_SPACE_AND_PUSH_STATE #0 - clr a - movx @dptr,a ; clear counter - EXIT_PCE_SPACE_AND_POP_STATE - - RESTORE_STRETCH r0 - - clr a ; success - ret - -; Gets the count on the quadrature decoder chip -; return the number of pulses (in 2-complement) since the last time -; the counter was cleared -; public static native int getCount() -native_getCount: - LOAD24 #base ; get encoder address - - SET_STRETCH STRETCH - - ENTER_PCE_SPACE_AND_PUSH_STATE #0 - movx a,@dptr ; get count high byte - mov r1,a ; return value in R3:R2:R1:R0 - - rlc a ; sign extension to 32 bits - clr a ; r1 > 0 extend with 0s - jnc posextend - cpl a ; r1 < 0 extend with 1s -posextend: mov r2,a ; return value in R3:R2:R1:R0 - mov r3,a - - inc dptr - movx a,@dptr ; get count low byte - EXIT_PCE_SPACE_AND_POP_STATE - - RESTORE_STRETCH r0 - - mov r0,a ; return value in R3:R2:R1:R0 - - clr a ; success - ret - - -; Gets the count and clearsthe counter on the quadrature decoder chip -; return the number of pulses (in 2-complement) since the last time -; the counter was cleared -; public static native int getCountAndClear() -native_getCountAndClear: - LOAD24 #base ; get encoder address - - SET_STRETCH STRETCH - - ENTER_PCE_SPACE_AND_PUSH_STATE #0 - movx a,@dptr ; get count high byte - mov r1,a ; return value in R3:R2:R1:R0 - - rlc a ; sign extension to 32 bits - clr a ; r1 > 0 extend with 0s - jnc posextend1 - cpl a ; r1 < 0 extend with 1s -posextend1: mov r2,a ; return value in R3:R2:R1:R0 - mov r3,a - - inc dptr - movx a,@dptr ; get count low byte - movx @dptr,a ; clear counter - EXIT_PCE_SPACE_AND_POP_STATE - - RESTORE_STRETCH r0 - - mov r0,a ; return value in R3:R2:R1:R0 - - clr a ; success - ret - - end - diff --git a/lib/index.a51 b/lib/index.a51 deleted file mode 100644 index bff12f8..0000000 --- a/lib/index.a51 +++ /dev/null @@ -1,77 +0,0 @@ -;****************************************************************************** -; -; Actuator Interface Card -; Index Function -; Copyright (C) 2005 Walter Fetter Lages -; -; 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., 675 Mass Ave, Cambridge, MA 02139, USA. -; -; You can also obtain a copy of the GNU General Public License -; at . -; -;******************************************************************************* - -$include(tini.inc) -$include(ds80c390.inc) -$include(tinimacro.inc) - -$include(aicpld.inc) -$include(aicmacro.inc) - -; data saved in big-endian mode -; Index base address -index_base: db 0,0,0 - -; Initializes Index -; void index_initialize(unsigned long base); -index_initialize: - mov r0,dpl ; parameter in b:dpx:dph:dpl - mov r1,dph ; BUG IN SDCC MANUAL! - mov r2,dpx - mov r3,b - - mov dptr,#CONTROL ; compute index address - lcall Add_Dptr1_24 ; dptr=dptr+R2:R1:R0 - - STORE24 #index_base ; store index address - - clr a ; success - ret - -; Reads the sync-switch -; returns the sync-switch state -; unsigned long index_read(void) -index_read: - LOAD24 #index_base ; get index address - - SET_STRETCH STRETCH - - ENTER_PCE_SPACE_AND_PUSH_STATE #0 - movx a,@dptr ; read index - EXIT_PCE_SPACE_AND_POP_STATE - - RESTORE_STRETCH r0 - - anl a,#01h - mov dpl,a ; return value in b:dpx:dph:dpl - clr a ; BUG IN SDCC MANUAL! - mov dph,a - mov dpx,a - mov b,a - - ret - - end - diff --git a/lib/pwm.a51 b/lib/pwm.a51 deleted file mode 100644 index 7370e5b..0000000 --- a/lib/pwm.a51 +++ /dev/null @@ -1,372 +0,0 @@ -;****************************************************************************** -; -; Actuator Interface Card -; PWM Functions -; Copyright (C) 2004, 2005 Walter Fetter Lages -; -; 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., 675 Mass Ave, Cambridge, MA 02139, USA. -; -; You can also obtain a copy of the GNU General Public License -; at . -; -;******************************************************************************* - -$include(tini.inc) -$include(ds80c390.inc) -$include(tinimacro.inc) - -$include(i8254.inc) -$include(aicpld.inc) -$include(aicmacro.inc) - - -; data saved in big-endian mode -; PWM base address -pwm_base: db 0,0,0 - -; PWM frequency in cycles of 10MHz -pwm_max_count: db 0,0 - -; minimal value to load in PWM -pwm_min_count: db 0,0 - -; Control Register base address -pwm_ctrl_base: db 0,0,0 - -; Sets the frequency of PWM in cycles of 10MHz -; void pwm_set_count(unsigned int count) -pwm_set_count: - mov r0,dpl ; parameter in dph:dpl - mov r1,dph ; BUG IN SDCC MANUAL! - - LOAD24 #pwm_base ; get PWM address - - mov a,#CTRL_8254 ; compute control register address - ADD_DPTR_0_A - - mov b,r0 ; save parameter LSB - - SET_STRETCH STRETCH - - ENTER_PCE_SPACE_AND_PUSH_STATE #0 - mov a,#RATE_BIN_8254 ; set timer 0 mode - movx @dptr,a - - mov a,#ONE_SHOT_BIN_8254 ; set timer 1 mode - orl a,#40h ; select timer 1 - movx @dptr,a - -; program timer 0 with count - - mov a,DPS ; point dptr to timer 0 - orl DPS,#0c0h ; avoids extern memory access - inc dptr ; actualy decrement - inc dptr ; due to DPS value - inc dptr - mov DPS,a - - mov a,b ; program timer 0 lsB - movx @dptr,a - mov r2,a ; save count lsB - - mov a,r1 ; program timer 0 msB - movx @dptr,a - - EXIT_PCE_SPACE_AND_POP_STATE - - inc DPS ; save count - mov dptr,#pwm_max_count - movx @dptr,a ; store count msB - inc dptr - mov a,r2 ; store count lsB - movx @dptr,a - inc DPS - -; program timer 1 with count/2 - -duty50: inc dptr ; point dptr to timer 1 - - mov a,r1 ; compute count/2 - clr c - rrc a - mov r1,a - mov a,b - rrc a - - ENTER_PCE_SPACE_AND_PUSH_STATE #0 - movx @dptr,a ; program timer 1 lsB - mov a,r1 ; program timer 1 msB - movx @dptr,a - EXIT_PCE_SPACE_AND_POP_STATE - - RESTORE_STRETCH r0 - - clr a ; success - ret - -; Initializes PWM -; void pwm_initialize(unsigned long base,unsigned int min_count,unsigned int count); -pwm_initialize: - clr a - lcall Natlib_LoadPrimitive ; get first parameter in R3:R2:R1:R0 - - push R0_B0 - push R1_B0 - push R2_B0 - - mov dptr,#CONTROL ; compute Control address - lcall Add_Dptr1_24 ; dptr=dptr+R2:R1:R0 - - STORE24 #pwm_ctrl_base ; store Control register address - - pop R2_B0 - pop R1_B0 - pop R0_B0 - - mov dptr,#PWM ; compute PWM address - lcall Add_Dptr1_24 ; dptr=dptr+R2:R1:R0 - - STORE24 #pwm_base ; store PWM address - - mov a,#1h - lcall Natlib_LoadPrimitive ; get second parameter in R3:R2:R1:R0 - mov dptr,#pwm_min_count ; stores it - mov a,r1 - movx @dptr,a - inc dptr - mov a,r0 - movx @dptr,a - - mov a,#2h - lcall Natlib_LoadPrimitive ; get third parameter in R3:R2:R1:R0 - - ljmp pwm_set_count ; fall over to native_setCount - - -; Finalizes PWM -; void finalize(void) -pwm_finalize: - LOAD24 #pwm_base ; get pwm address - - inc DPS ; get count msB - mov dptr,#pwm_max_count - movx a,@dptr - mov r1,a - inc dptr ; get count lsB - movx a,@dptr - mov b,a - inc DPS - - SET_STRETCH STRETCH - - ljmp duty50 ; fall over to native pwm_set_count - - -; Sets the duty-cycle of PWM -; unsigned long pwm_set_duty(unsigned long dutycycle) -pwm_set_duty: - mov r0,dpl ; parameter in b:dpx:dph:dpl - mov r1,dph ; BUG IN SDCC MANUAL! - mov r2,dpx - mov r3,b - - mov a,r3 ; ensures R3:R2:R1:R0 >= 0 - jnb ACC.7,parmpos - - clr a ; forces R3:R2:R1:R0=0 - mov r3,a - mov r2,a - mov r1,a - mov r0,a - ljmp parmok - -parmpos: cjne r3,#00,parmabove ; ensures R3:R2:R1:R0 <= 1000000 - clr c - mov a,r0 ; 1000000=0f4240h - subb a,#40h - mov a,r1 - subb a,#42h - mov a,r2 - subb a,#0fh - jc parmok - -parmabove: mov r3,#00h ; forces R3:R2:R1:R0=1000000 - mov r2,#0fh - mov r1,#42h - mov r0,#40h - -parmok: - TINIOS_ENTER_CRITICAL_SECTION - - mov MCNT1,#10h ; MST=0,MOF=0,SCB=0,CLM=1 - mov MA,r0 ; R3:R2:R1:R0 >> 4 using - mov MA,r1 ; math acelerator - mov MA,r2 - mov MA,r3 - mov MCNT0,#0a4h ;/LSHIFT=1,CSE=0,SCE=1,MAS40=4 -waitshift: mov a,MCNT1 - jb ACC.7,waitshift ; wait MST cleared - - mov a,MA ; the result is 16 bits - mov a,MA ; discard upper 16 bits - mov r1,MA - mov r0,MA - - mov MCNT1,#00h ; R1:R0 * max_count using - mov MB,r0 ; math accelarator - mov MB,r1 - mov dptr,#pwm_max_count ; load max_count in R1_B1:R0:B1 - movx a,@dptr - mov R1_B1,a - inc dptr - movx a,@dptr - mov R0_B1,a - mov MA,a - mov a,R1_B1 - mov MA,a -waitmult: mov a,MCNT1 - jb ACC.7,waitmult ; wait MST cleared - - mov r3,MA - mov r2,MA - mov r1,MA - mov r0,MA - - mov MCNT1,#00h ;R1:R0*max_count/(1000000/16) using - mov MA,r0 ; math accelarator - mov MA,r1 - mov MA,r2 - mov MA,r3 - mov MB,#24h ; 1000000/16=F424h - mov MB,#0f4h -waitdiv: mov a,MCNT1 - jb ACC.7,waitdiv ; wait MST cleared - - mov a,MA ; The result should be 16 bits - mov a,MA ; upper 16 bits discarded - mov r1,MA - mov r0,MA - - TINIOS_EXIT_CRITICAL_SECTION - - clr c ; computes count - mov a,R0_B1 - subb a,r0 - mov r0,a - mov a,R1_B1 - subb a,r1 - mov r1,a - - mov dptr,#pwm_min_count ; check if count < min_count - movx a,@dptr - mov r3,a - inc dptr - movx a,@dptr - mov r2,a - - clr c - mov a,r0 - subb a,r2 - mov a,r1 - subb a,r3 - jnc countabove - mov r0,R2_B0 - mov r1,R3_B0 - ljmp countok - - -countabove: clr c ; check if count > max_count-min_count - mov a,R0_B1 ; computes max_count - min_count - subb a,r2 - mov r2,a - mov a,R1_B1 - subb a,r3 - mov r3,a - - clr c - mov a,r0 - subb a,r2 - mov a,r1 - subb a,r3 - jc countok - mov r0,R2_B0 - mov r1,R3_B0 - -countok: LOAD24 #pwm_base ; get PWM address - - mov a,#TIMER1_8254 ; compute timer 1 address - ADD_DPTR_0_A - - mov b,r0 ; save count LSB - - SET_STRETCH STRETCH - - ENTER_PCE_SPACE_AND_PUSH_STATE #0 - mov a,b - movx @dptr,a ; program timer 1 lsB - mov a,r1 ; program timer 1 msB - movx @dptr,a - EXIT_PCE_SPACE_AND_POP_STATE - - RESTORE_STRETCH r0 ; restore original stretch value - - mov dpl,b ; return count in b:dbx:dph:dpl - mov dph,r1 - - clr a - - mov dpx,a - mov b,a - - ret - - - -; Turns the PWM on -; void pwm_on(void) -pwm_on: - LOAD24 #pwm_ctrl_base ; get control register address - - SET_STRETCH STRETCH - - ENTER_PCE_SPACE_AND_PUSH_STATE #0 - mov a,#PWMENABLE ; enable PWM - movx @dptr,a - EXIT_PCE_SPACE_AND_POP_STATE - - RESTORE_STRETCH r0 - - clr a ; success - ret - -; Turns the PWM off -; void pwm_off(void) -pwm_off: - LOAD24 #pwm_ctrl_base ; get control register address - - SET_STRETCH STRETCH - - ENTER_PCE_SPACE_AND_PUSH_STATE #0 - mov a,#PWMDISABLE ; disable PWM - movx @dptr,a - EXIT_PCE_SPACE_AND_POP_STATE - - RESTORE_STRETCH r0 - - clr a ; success - ret - - end - diff --git a/lib/tlib/Makefile b/lib/tlib/Makefile index 89fb511..aec5600 100644 --- a/lib/tlib/Makefile +++ b/lib/tlib/Makefile @@ -1,37 +1,8 @@ -CLASSPATH=-classpath /opt/tini/bin/tini.jar:/opt/tini/bin/tiniclasses.jar:/opt/tini/bin/modules.jar:. -APIDBPATH=-d /opt/tini/bin/tini.db -PKGPATH=br/ufrgs/eletro/AIC -JAVAFLAGS=-O -target 1.1 -source 1.3 - -NATINC=/opt/tini/native/lib -ASMINC=../../include -TINIINC=${ASMINC}/tini.inc ${ASMINC}/tinimacro.inc ${ASMINC}/ds80c390.inc -ASMOPT=-f 1.15 -p 390 -l -ASMMACRO=/opt/tini/native/bin/Linux/macro -ASM=/opt/tini/native/bin/Linux/a390 - -CFLAGS = -O2 -Wall -march=i486 -INCLUDE = -I. -I${HOME}/include - -CPPFLAGS = -CPPINCLUDE = -I${HOME}/include/cpp -I/usr/local/include/cpp -I../../include -LIB = ${HOME}/lib - -LIBINST=/usr/local/lib -INCLUDEINST=/usr/local/include - -INCLUDE=${CINCLUDE} ${CPPINCLUDE} -FLAGS= ${CFLAGS} ${CPPFLAGS} -DDEBUG -LIBDIR=${CLIBDIR} ${CPPLIBDIR} -LIBS=${CLIBS} ${CPPLIBS} - -CMP= g++ -CMPFLAGS= ${FLAGS} ${INCLUDE} -LDFLAGS= ${LIBDIR} ${LIBS} +ASMINC:=../${ASMINC} +TINIINC=${ASMINC}/tini.inc ${ASMINC}/tinimacro.inc ${ASMINC}/ds80c390.inc ${ASMINC}/apiequ.inc all: brake.mpp index.mpp encoder.mpp pwm.mpp - ${ASMINC}/tini.inc: ${NATINC}/tini.inc ln -s ${NATINC}/tini.inc ${ASMINC}/tini.inc @@ -40,6 +11,9 @@ ${ASMINC}/tinimacro.inc: ${NATINC}/tinimacro.inc ${ASMINC}/ds80c390.inc: ${NATINC}/ds80c390.inc ln -s ${NATINC}/ds80c390.inc ${ASMINC}/ds80c390.inc + +${ASMINC}/apiequ.inc: ${NATINC}/apiequ.inc + ln -s ${NATINC}/apiequ.inc ${ASMINC}/apiequ.inc brake.mpp: brake.a51 ${TINIINC} ${ASMMACRO} -I${ASMINC} -e- brake.a51 diff --git a/motortst/Makefile b/motortst/Makefile index 440f65e..125430a 100644 --- a/motortst/Makefile +++ b/motortst/Makefile @@ -1,26 +1,7 @@ -CFLAGS=-O2 -Wall -march=i486 -CINCLUDE=-I${HOME}/include -CLIBDIR=-L${HOME}/lib -CLIBS=-lcutil -lconio -lncurses -lcanlib - -CPPFLAGS= -CPPINCLUDE=-I../include -I${HOME}/include/cpp -I/usr/local/include/cpp -CPPLIBDIR=-L../lib -L${HOME}/lib/cpp -L${HOME}/lib -CPPLIBS=-lcpputil -laic - -INCLUDE=${CINCLUDE} ${CPPINCLUDE} -FLAGS= ${CFLAGS} ${CPPFLAGS} -DDEBUG -LIBDIR=${CLIBDIR} ${CPPLIBDIR} -LIBS=${CLIBS} ${CPPLIBS} - -CMP= g++ -CMPFLAGS= ${FLAGS} ${INCLUDE} -LDFLAGS= ${LIBDIR} ${LIBS} - all: motortst motortst: motortst.cpp ../lib/libaic.a - ${CMP} ${CMPFLAGS} -o motortst motortst.cpp ${LDFLAGS} + ${CXX} ${CMPFLAGS} -o motortst motortst.cpp ${LDFLAGS} clean: rm -f *~ *.bak *.o diff --git a/pid/Makefile b/pid/Makefile index 5992b86..6e9ce67 100644 --- a/pid/Makefile +++ b/pid/Makefile @@ -1,36 +1,10 @@ -PRJLIBDIR=../lib -PRJINCLUDE=../include -PRJFLAGS=-DVERBOSE - -CFLAGS=-O2 -Wall -march=i486 -CINCLUDE=-I. -I${HOME}/include -I/usr/local/include -I/usr/realtime/include -CLIBDIR=-L${HOME}/lib -L/usr/local/lib -CLIBS=-lcutil -lpthread -lcanlib - -CPPFLAGS= -CPPINCLUDE=-I${HOME}/include/cpp -I/usr/local/include/cpp -I../include -CPPLIBDIR=-L${HOME}/lib/cpp -L../lib -CPPLIBS=-laic -lcpputil -lcontrol - -INCLUDE=${CINCLUDE} ${CPPINCLUDE} -FLAGS= ${CFLAGS} ${CPPFLAGS} -LIBDIR=${CLIBDIR} ${CPPLIBDIR} -LIBS=${CPPLIBS} ${CLIBS} - -CMP= g++ -CMPFLAGS= ${FLAGS} ${INCLUDE} ${PRJFLAGS} -LDFLAGS= ${LIBDIR} ${LIBS} -CMPSWTCH= gnu -CMPMESSAGE= '${?*:warning:}\"${FILE}\", line ${LINE}:* at or near * \"${COLUMN=AFTER}\"' - - all: pid .runinfo -pid: pid.cpp ${PRJINCLUDE}/aic.h ${PRJLIBDIR}/libaic.a - ${CMP} ${CMPFLAGS} -o pid pid.cpp ${LDFLAGS} +pid: pid.cpp ../include/aic.h ../lib/libaic.a + ${CXX} ${CMPFLAGS} -o pid pid.cpp ${LDFLAGS} -${PRJLIBDIR}/libaic.a: - $(MAKE) -C ${PRJLIBDIR} +../lib/libaic.a: + $(MAKE) -C ../lib clean: rm -f *~ *.bak *.o @@ -40,5 +14,5 @@ install: distclean: clean rm -f pid *.dat .runinfo -.runinfo: runinfo - cp runinfo .runinfo +.runinfo: + echo "pid:lxrt:./pid;popall:" > .runinfo