LOGIN   :::   RECOVER PASS   :::   GET ACCOUNT    
Browse
  • Projects
  • Code (CVS)
  • Forums
  • News
  • Articles
  • Polls
  •  
    OpenCores
  • FAQ
  • CVS HowTo
  • Mission
  • Media
  • Tools
  • Advertise
  • Mirrors
  • Logos
  • Contact us
  • Job Opportunity
  •  
    Tools
  • Search
      
  • Download Cores (CVSGet)
  •  
    More
  • Wishbone
  • Perlilog
  • EDA tools
  • OpenTech CD
  •  
    Navigation: All forums > Cvs-checkins > Message List > Message Post

    Message

    Reply | Reply all
    Date Prev | Date Next | Thread Prev | Thread Next Date Index | Thread Index

    From: cvs at opencores.org<cvs@o...>
    Date: Thu Mar 27 21:50:10 CET 2008
    Subject: [cvs-checkins] MODIFIED: jop ...
    Top
    Date: 00/08/03 27:21:50

    Modified: jop/java/target/src/app/oebb Logic.java Main.java State.java
    Status.java
    Log:
    BG 2.01


    Revision Changes Path
    1.18 jop/java/target/src/app/oebb/Logic.java

    http://www.opencores.org/cvsweb.shtml/jop/java/target/src/app/oebb/Logic.java.diff?r1=1.17&r2=1.18

    (In the diff below, changes in quantity of whitespace are not shown.)

    Index: Logic.java
    ===================================================================
    RCS file: /cvsroot/martin/jop/java/target/src/app/oebb/Logic.java,v
    retrieving revision 1.17
    retrieving revision 1.18
    diff -u -b -r1.17 -r1.18
    --- Logic.java 25 Mar 2008 19:27:26 -0000 1.17
    +++ Logic.java 27 Mar 2008 20:50:10 -0000 1.18
    @@ -70,6 +70,7 @@
    private boolean alarmZielQuit;
    private boolean alarmFaehrtQuit;
    private boolean alarmRichtungQuit;
    + private boolean alarmMlrQuit;

    private int[] buf;
    // length is one display line without status character
    @@ -298,6 +299,7 @@
    alarmFaehrtQuit = false;
    alarmRichtungQuit = false;
    alarmZielQuit = false;
    + alarmMlrQuit = false;
    }

    /**
    @@ -340,7 +342,7 @@
    // direction check also in ZIEL
    //
    if (checkMelnr && !isVerschub && Logic.state!=Logic.ALARM
    - && Main.state.getPos()!=-1) {
    + && pos!=-1) {

    synchronized (Status.dirMutex) {
    if (Status.direction==Gps.DIR_UNKNOWN) {
    @@ -354,58 +356,72 @@

    if (Status.direction==Gps.DIR_FORWARD) { // going from left to rigth.
    // check direction with melnr
    - if (checkDirection && Main.state.getPos()<Main.state.start) {
    + if (checkDirection && pos<Main.state.start && !alarmRichtungQuit) {
    // FERL bleibt
    stateAfterQuit = Logic.state;
    Logic.state = Logic.ALARM;
    - alarmType = Cmd.ALARM_RICHTUNG;
    + alarmType = State.ALARM_RICHTUNG;
    + return false;
    + }
    + // check melnr in the other direction
    + if (pos<Main.state.start && Main.state.start!=0 && !alarmMlrQuit) {
    + stateAfterQuit = Logic.state;
    + Logic.state = Logic.ALARM;
    + alarmType = State.ALARM_MLR;
    return false;
    }
    // check Melderaum Ziel
    // if (Main.state.pos<Main.state.start || Main.state.pos>Main.state.end) {
    // change 13.12.2006 - Ziel only in the direction
    - if (Main.state.getPos()>Main.state.end && Main.state.end!=0 && !alarmZielQuit) {
    + if (pos>Main.state.end && Main.state.end!=0 && !alarmZielQuit) {
    stateAfterQuit = Logic.state;
    Logic.state = Logic.ALARM;
    - alarmType = Cmd.ALARM_UEBERF;
    + alarmType = State.ALARM_UEBERF;
    return false;
    }
    // check direction
    if (checkDirection && Gps.direction==Gps.DIR_BACK &&
    - !(state.type==State.TYPE_NF && Main.state.getPos()==Main.state.end)) {
    + !(state.type==State.TYPE_NF && pos==Main.state.end) &&!alarmRichtungQuit) {

    // FERL bleibt
    stateAfterQuit = Logic.state;
    Logic.state = Logic.ALARM;
    - alarmType = Cmd.ALARM_RICHTUNG;
    + alarmType = State.ALARM_RICHTUNG;
    return false;
    }
    } else { // going from right to left
    // check direction with melnr
    - if (checkDirection && Main.state.getPos()>Main.state.start) {
    + if (checkDirection && pos>Main.state.start && !alarmRichtungQuit) {
    // FERL bleibt
    stateAfterQuit = Logic.state;
    Logic.state = Logic.ALARM;
    - alarmType = Cmd.ALARM_RICHTUNG;
    + alarmType = State.ALARM_RICHTUNG;
    + return false;
    + }
    + // check melnr in the other direction + if (pos>Main.state.start && Main.state.start!=0 && !alarmMlrQuit) { + stateAfterQuit = Logic.state; + Logic.state = Logic.ALARM; + alarmType = State.ALARM_MLR; return false; } // check Melderaum // change 13.12.2006 - Ziel only in the direction // if (Main.state.pos>Main.state.start || Main.state.pos<Main.state.end) { - if (Main.state.getPos()<Main.state.end && Main.state.end!=0 && !alarmZielQuit) { + if (pos<Main.state.end && Main.state.end!=0 && !alarmZielQuit) { stateAfterQuit = Logic.state; Logic.state = Logic.ALARM; - alarmType = Cmd.ALARM_UEBERF; + alarmType = State.ALARM_UEBERF; return false; } // check direction if (checkDirection && Gps.direction==Gps.DIR_FORWARD && - !(state.type==State.TYPE_NF && Main.state.getPos()==Main.state.end)) { + !(state.type==State.TYPE_NF && pos==Main.state.end) && !alarmRichtungQuit) { stateAfterQuit = Logic.state; // FERL bleibt // stateAfterQuit = Status.ANM_OK; Logic.state = Logic.ALARM; - alarmType = Cmd.ALARM_RICHTUNG; + alarmType = State.ALARM_RICHTUNG; return false; } } @@ -417,18 +433,18 @@ Logic.state!=Logic.NOTHALT && Logic.state!=Logic.NOTHALT_OK && Logic.state!=Logic.INFO && Logic.state!=Logic.LERN && Logic.state!=Logic.ES_VERSCHUB && - checkMove && Gps.speed>Gps.MIN_SPEED) { + checkMove && Gps.speed>Gps.MIN_SPEED && !alarmFaehrtQuit) { stateAfterQuit = Logic.state; Logic.state = Logic.ALARM; - alarmType = Cmd.ALARM_FAEHRT; + alarmType = State.ALARM_FAEHRT; checkMove = false; // disable further Alarms return false; } // check Verschub - if (isVerschub && Logic.state!=Logic.ALARM) { + if (isVerschub && Logic.state!=Logic.ALARM && !alarmMlrQuit) { if (pos>end || pos<start) { Logic.state = Logic.ALARM; - alarmType = Cmd.ALARM_UEBERF; + alarmType = State.ALARM_MLR; isVerschub = false; // clear Verschub stateAfterQuit = Logic.FDL_CONN; return false; @@ -439,7 +455,7 @@ // Ziel erreicht // if (Logic.state == Logic.ERLAUBNIS && - Main.state.getPos() == Main.state.end && + pos == Main.state.end && state.type==State.TYPE_ZUG) { Logic.state = Logic.ZIEL; @@ -1002,12 +1018,14 @@ Dbg.wr("Alarm "); Dbg.intVal(alarmType); Dbg.lf(); - if (alarmType==Cmd.ALARM_UEBERF) { + if (alarmType==State.ALARM_UEBERF) { Display.write("", "ZIEL ÜBERFAHREN", ""); - } else if (alarmType==Cmd.ALARM_FAEHRT) { + } else if (alarmType==State.ALARM_FAEHRT) { Display.write("KEINE", "FAHRERLAUBNIS", ""); - } else if (alarmType==Cmd.ALARM_RICHTUNG) { + } else if (alarmType==State.ALARM_RICHTUNG) { Display.write("Falsche", "Richtung", ""); + } else if (alarmType==State.ALARM_MLR) { + Display.write("Falscher", "Melderaum", ""); } else { Display.write("Alarm", "Nummer", alarmType, ""); } @@ -1030,12 +1048,14 @@ // wait for Enter to quit Alarm if (waitEnter()) break; } - if (alarmType==Cmd.ALARM_UEBERF) { + if (alarmType==State.ALARM_UEBERF) { alarmZielQuit = true; - } else if (alarmType==Cmd.ALARM_FAEHRT) { + } else if (alarmType==State.ALARM_FAEHRT) { alarmFaehrtQuit = true; - } else if (alarmType==Cmd.ALARM_RICHTUNG) { + } else if (alarmType==State.ALARM_RICHTUNG) { alarmRichtungQuit = true; + } else if (alarmType==State.ALARM_MLR) { + alarmMlrQuit = true; } else { Display.write("Alarm", "Nummer", alarmType, ""); } 1.24 jop/java/target/src/app/oebb/Main.java http://www.opencores.org/cvsweb.shtml/jop/java/target/src/app/oebb/Main.java.diff?r1=1.23&r2=1.24 (In the diff below, changes in quantity of whitespace are not shown.) Index: Main.java =================================================================== RCS file: /cvsroot/martin/jop/java/target/src/app/oebb/Main.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -b -r1.23 -r1.24 --- Main.java 26 Mar 2008 01:37:17 -0000 1.23 +++ Main.java 27 Mar 2008 20:50:10 -0000 1.24 @@ -62,7 +62,7 @@ // SW version public static final int VER_MAJ = 2; - public static final int VER_MIN = 0; + public static final int VER_MIN = 1; private static final int STRECKE_PRIO = 1; private static final int STRECKE_PERIOD = 100000; 1.6 jop/java/target/src/app/oebb/State.java http://www.opencores.org/cvsweb.shtml/jop/java/target/src/app/oebb/State.java.diff?r1=1.5&r2=1.6 (In the diff below, changes in quantity of whitespace are not shown.) Index: State.java =================================================================== RCS file: /cvsroot/martin/jop/java/target/src/app/oebb/State.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -b -r1.5 -r1.6 --- State.java 25 Mar 2008 19:27:26 -0000 1.5 +++ State.java 27 Mar 2008 20:50:10 -0000 1.6 @@ -70,14 +70,23 @@ int destIp; - // Alarme vom BG zur Zentrale - final static int AFLAG_MLR = 0x00000001; // Melderaum ueberfahren - final static int AFLAG_RICHTUNG = 0x00000002; // Falsche Richtung - final static int AFLAG_FERL = 0x00000004; // Keine Fahrerlaubnis - final static int AFLAG_ES221 = 0x00000008; // ES221 Mode - final static int AFLAG_ANK = 0x00000010; // Ankunft - final static int AFLAG_VERL = 0x00000020; // Verlassen - final static int AFLAG_ZIEL = 0x00000040; // Ziel Erreicht + + // Alarm and flags + public static final int ALARM_UEBERF = 1; + public static final int ALARM_RICHTUNG = 2; + public static final int ALARM_FAEHRT = 3; + public static final int ALARM_ES221 = 4; + public static final int FLAG_ANK = 5; + public static final int FLAG_VERL = 6; + public static final int FLAG_ZIEL = 7; + public static final int ALARM_MLR = 8; + + private final static int AFLAG_ANK = 1<<(FLAG_ANK-1); + private final static int AFLAG_VERL = 1<<(FLAG_VERL-1); + private final static int AFLAG_ZIEL = 1<<(FLAG_ZIEL-1); + + private final static int ALARM_MSK = (1<<(ALARM_UEBERF-1)) | + (1<<(ALARM_RICHTUNG-1)) | (1<<(ALARM_FAEHRT-1)) | (1<<(ALARM_ES221-1)) | (1<<(ALARM_MLR-1)); // Meldungen von der Zentrale zum BG final static int CFLAG_ABM = 0x00000001; // Abmelden @@ -85,6 +94,12 @@ final static int CFLAG_NOT = 0x00000004; // Nothalt final static int CFLAG_ANMOK = 0x00000008; // Anmelden OK + /** + * The alarm was ack by the TFZ. Set the flags to zero when + * FDL has also acked the alarm. + */ + private boolean alarmQuit; + // local states /** @@ -316,7 +331,7 @@ } } - // Alarm flag quits + // Alarm and flag quits int alarmAck = buf[Udp.DATA+7]; synchronized (this) { if (alarmAck==alarmFlags) { @@ -329,6 +344,15 @@ alarmFlags &= ~AFLAG_VERL; ankVerl = 0; } + if ((alarmAck & AFLAG_ZIEL)!=0) { + alarmFlags &= ~AFLAG_ZIEL; + } + // Alarm has been reset by FDL and seen by ZLB + // we can reset it in the flags + if (alarmQuit) { + alarmFlags &= ~ALARM_MSK; + alarmQuit = false; + } } } @@ -457,7 +481,10 @@ } public void sendZiel() { - // TODO Auto-generated method stub + synchronized (this) { + alarmFlags |= AFLAG_ZIEL; + } + requestSend(); } @@ -475,22 +502,11 @@ * @param alarmType */ public void setAlarm(int alarmType) { - // TODO Auto-generated method stub -// if (alarmType==Cmd.ALARM_UEBERF) { -// Display.write("", "ZIEL ÜBERFAHREN", ""); -// } else if (alarmType==Cmd.ALARM_FAEHRT) { -// Display.write("KEINE", "FAHRERLAUBNIS", ""); -// } else if (alarmType==Cmd.ALARM_RICHTUNG) { -// Display.write("Falsche", "Richtung", ""); -// } else { -// Display.write("Alarm", "Nummer", alarmType, ""); -// } if (alarmType==0) { - // reset the alarm - // or better mark it as reset alarm pending - // we should not loose a alarm message due to a - // too fast quite from the TFZF + alarmQuit = true; + } else { + alarmFlags |= 1<<(alarmType-1); } requestSend(); @@ -546,7 +562,7 @@ } /** - * Got ack for ANK from ZLB so flag is reset + * Got ack for ANK from ZLB * @return */ public boolean ankuftAck() { @@ -554,7 +570,7 @@ } /** - * Got ack for VERL from ZLB so flag is reset + * Got ack for VERL from ZLB * @return */ public boolean verlassenAck() { 1.10 jop/java/target/src/app/oebb/Status.java http://www.opencores.org/cvsweb.shtml/jop/java/target/src/app/oebb/Status.java.diff?r1=1.9&r2=1.10 (In the diff below, changes in quantity of whitespace are not shown.) Index: Status.java =================================================================== RCS file: /cvsroot/martin/jop/java/target/src/app/oebb/Status.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -b -r1.9 -r1.10 --- Status.java 13 Mar 2008 17:25:19 -0000 1.9 +++ Status.java 27 Mar 2008 20:50:10 -0000 1.10 @@ -7,6 +7,8 @@ * * Changelog: * +* TODO: should be moved to Logic. +* */ public class Status {

     
    Copyright (c) 1999 OPENCORES.ORG. All rights reserved.