-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
-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
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;
-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
-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}
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
+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.
--- /dev/null
+/******************************************************************************
+
+ Actuator Interface Card
+ Command Daemon
+ Copyright (C) 2005 Walter Fetter Lages <w.fetter@ieee.org>
+
+ 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 <http://www.gnu.org/licenses>.
+
+*******************************************************************************/
+
+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 <w.fetter@ieee.org>.\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();
+ }
+ }
+}
--- /dev/null
+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
+
+
-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}
-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
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
-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
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
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();
-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}
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
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;
-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
-
-
-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
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();
-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}
+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 \
PID \
StrobeTest \
DoorDaemon \
+ CmdDaemon \
aicd \
braketst \
encodertst \
-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}
-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
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
+++ /dev/null
-;******************************************************************************
-;
-; Actuator Interface Card
-; Motor Real time Test
-; Real Time Module Global Variables
-; Copyright (C) 2005 Walter Fetter Lages <w.fetter@ieee.org>
-;
-; 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 <http://www.gnu.org/licenses>.
-;
-;*******************************************************************************/
-
-
-th: db 0,0
-voltage: db 0,0,0,0
- end
-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}
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();
}
-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
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
+++ /dev/null
-;******************************************************************************
-;
-; Actuator Interface Card
-; PID
-; Real Time Module Global Variables
-; Copyright (C) 2005 Walter Fetter Lages <w.fetter@ieee.org>
-;
-; 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 <http://www.gnu.org/licenses>.
-;
-;*******************************************************************************/
-
-
-output: db 0,0,0,0
-th: db 0,0
-reference: db 0,0,0,0
- end
-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
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
-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
- 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?
-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
distclean: clean
rm -f aicd .runinfo
-.runinfo: runinfo
- cp runinfo .runinfo
+.runinfo:
+ echo "aicd:lxrt:./aicd;popall:" > .runinfo
-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
# 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.
# *.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.
-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
@author Walter Fetter Lages <w.fetter@ieee.org>
*/
-/** @defgroup aichost AIC Host Interface
+/** @addtogroup aichost
@{
*/
@author Walter Fetter Lages <w.fetter@ieee.org>
*/
-/** @defgroup aicsim AIC Simulator Interface
+/** @addtogroup aicsim
@{
*/
@author Walter Fetter Lages <w.fetter@ieee.org>
*/
-/** @defgroup aicsim AIC Simulator Interface
+/** @addtogroup aicsim
@{
*/
@author Walter Fetter Lages <w.fetter@ieee.org>
*/
-/** @defgroup aicsim AIC Simulator Interface
+/** @addtogroup aicsim
@{
*/
@author Walter Fetter Lages <w.fetter@ieee.org>
*/
-/** @defgroup aichost AIC Host Interface
+/** @addtogroup aichost
@{
*/
@author Walter Fetter Lages <w.fetter@ieee.org>
*/
-/** @defgroup aichost AIC Host Interface
+/** @addtogroup aichost
@{
*/
-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
-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
package br.ufrgs.eletro.AIC;
-/** @defgroup aichardware AIC Hardware Interface
+/** @addtogroup aichardware
@{
*/
package br.ufrgs.eletro.AIC;
-/** @defgroup aichardware AIC Hardware Interface
+/** @addtogroup aichardware
@{
*/
package br.ufrgs.eletro.AIC;
-/** @defgroup aichardware AIC Hardware Interface
+/** @addtogroup aichardware
@{
*/
import java.lang.*;
-/** @defgroup aichardware AIC Hardware Interface
+/** @addtogroup aichardware
@{
*/
import com.dalsemi.system.*;
import java.lang.*;
-/** @defgroup aichardware AIC Hardware Interface
+/** @addtogroup aichardware
@{
*/
import java.lang.*;
import java.io.*;
-/** @defgroup aichardware AIC Hardware Interface
+/** @addtogroup aichardware
@{
*/
package br.ufrgs.eletro.AIC;
-/** @defgroup aichardware AIC Hardware Interface
+/** @addtogroup aichardware
@{
*/
-
-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
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
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:
package br.ufrgs.eletro.AIC;
-/** @defgroup aichardware AIC Hardware Interface
+/** @addtogroup aichardware
@{
*/
package br.ufrgs.eletro.AIC;
-/** @defgroup aichardware AIC Hardware Interface
+/** @addtogroup aichardware
@{
*/
package br.ufrgs.eletro.AIC;
-/** @defgroup aichardware AIC Hardware Interface
+/** @addtogroup aichardware
@{
*/
-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
mov r0,#40h
pwm_parmok:
-
; ljmp pwm_countok ; debug
mov r1,R3_B0
pwm_countok:
+
; mov r0,#250 ; debug
; mov r1,#0
+++ /dev/null
-;******************************************************************************
-;
-; Actuator Interface Card
-; Brake Functions
-; Copyright (C) 2005 Walter Fetter Lages <w.fetter@ieee.org>
-;
-; 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 <http://www.gnu.org/licenses>.
-;
-;*******************************************************************************
-
-$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
+++ /dev/null
-;******************************************************************************
-;
-; Actuator Interface Card
-; Encoder Native Methods
-; Copyright (C) 2004 Walter Fetter Lages <w.fetter@ieee.org>
-;
-; 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 <http://www.gnu.org/licenses>.
-;
-;*******************************************************************************
-
-$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
-
+++ /dev/null
-;******************************************************************************
-;
-; Actuator Interface Card
-; Index Function
-; Copyright (C) 2005 Walter Fetter Lages <w.fetter@ieee.org>
-;
-; 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 <http://www.gnu.org/licenses>.
-;
-;*******************************************************************************
-
-$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
-
+++ /dev/null
-;******************************************************************************
-;
-; Actuator Interface Card
-; PWM Functions
-; Copyright (C) 2004, 2005 Walter Fetter Lages <w.fetter@ieee.org>
-;
-; 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 <http://www.gnu.org/licenses>.
-;
-;*******************************************************************************
-
-$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
-
-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
${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
-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
-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
distclean: clean
rm -f pid *.dat .runinfo
-.runinfo: runinfo
- cp runinfo .runinfo
+.runinfo:
+ echo "pid:lxrt:./pid;popall:" > .runinfo