Package org.contikios.cooja.mote.memory

Examples of org.contikios.cooja.mote.memory.VarMemory


   * @see Mote
   * @see org.contikios.cooja.MoteInterfaceHandler
   */
  public ContikiMoteID(Mote mote) {
    this.mote = mote;
    this.moteMem = new VarMemory(mote.getMemory());
  }
View Full Code Here


   * @see Mote
   * @see org.contikios.cooja.MoteInterfaceHandler
   */
  public ContikiEEPROM(Mote mote) {
    this.mote = mote;
    this.moteMem = new VarMemory(mote.getMemory());
  }
View Full Code Here

   * @see Mote
   * @see org.contikios.cooja.MoteInterfaceHandler
   */
  public ContikiRS232(Mote mote) {
    this.mote = (ContikiMote) mote;
    this.moteMem = new VarMemory(mote.getMemory());
  }
View Full Code Here

  private int ipv6_addr_size = 0;
  private int ipv6_addr_list_offset = 0;

  public IPAddress(final Mote mote) {
    moteMem = new VarMemory(mote.getMemory());
    memLayout = mote.getMemory().getLayout();

    /* If the ip memory sections changed, we recalculate addresses
     * and notify our observers.*/
    memMonitor = new MemoryInterface.SegmentMonitor() {
View Full Code Here

  public static final int RIME_ADDR_LENGTH = 2;

  private SegmentMonitor memMonitor = null;

  public RimeAddress(final Mote mote) {
    moteMem = new VarMemory(mote.getMemory());
    if (hasRimeAddress()) {
      memMonitor = new SegmentMonitor() {
        @Override
        public void memoryChanged(MemoryInterface memory, SegmentMonitor.EventType type, long address) {
          if (type != SegmentMonitor.EventType.WRITE) {
View Full Code Here

  private String lastLog = null;
  private MemoryMonitor memoryMonitor = null;
 
  public MspDebugOutput(Mote mote) {
    this.mote = (MspMote) mote;
    this.mem = new VarMemory(this.mote.getMemory());

    if (!mem.variableExists(CONTIKI_POINTER)) {
      /* Disabled */
      return;
    }
View Full Code Here

    byte[] initialDataSection = new byte[dataSectionSize];
    byte[] initialBssSection = new byte[bssSectionSize];
    javaLibrary.getMemory(relDataSectionAddr, dataSectionSize, initialDataSection);
    javaLibrary.getMemory(relBssSectionAddr, bssSectionSize, initialBssSection);
    SectionMoteMemory memory = new SectionMoteMemory(addresses);
    VarMemory varMem = new VarMemory(memory);
    memory.setMemorySegment(relDataSectionAddr, initialDataSection);
    memory.setMemorySegment(relBssSectionAddr, initialBssSection);

    int contikiDataCounter, contikiBSSCounter;

    testOutput.addMessage("### Checking initial variable values: 1,0");
    contikiDataCounter = varMem.getIntValueOf("var1");
    contikiBSSCounter = varMem.getIntValueOf("uvar1");
    int javaDataCounter = 1;
    int javaBSSCounter = 0;
    if (contikiDataCounter != javaDataCounter) {
      testOutput.addMessage("### Data section mismatch (" + contikiDataCounter + " != " + javaDataCounter + ")", MessageList.ERROR);
      return false;
    }
    if (contikiBSSCounter != javaBSSCounter) {
      testOutput.addMessage("### BSS section mismatch (" + contikiBSSCounter + " != " + javaBSSCounter + ")", MessageList.ERROR);
      return false;
    }

    testOutput.addMessage("### Increasing data and BSS counters 5 times: 6,5");
    javaLibrary.tick(); javaDataCounter++; javaBSSCounter++;
    javaLibrary.tick(); javaDataCounter++; javaBSSCounter++;
    javaLibrary.tick(); javaDataCounter++; javaBSSCounter++;
    javaLibrary.tick(); javaDataCounter++; javaBSSCounter++;
    javaLibrary.tick(); javaDataCounter++; javaBSSCounter++;

    testOutput.addMessage("### Fetching memory, comparing counters");
    javaLibrary.getMemory(relDataSectionAddr, dataSectionSize, initialDataSection);
    javaLibrary.getMemory(relBssSectionAddr, bssSectionSize, initialBssSection);
    memory.setMemorySegment(relDataSectionAddr, initialDataSection);
    memory.setMemorySegment(relBssSectionAddr, initialBssSection);
    contikiDataCounter = varMem.getIntValueOf("var1");
    contikiBSSCounter = varMem.getIntValueOf("uvar1");
    if (contikiDataCounter != javaDataCounter) {
      testOutput.addMessage("### Data section mismatch (" + contikiDataCounter + " != " + javaDataCounter + ")", MessageList.ERROR);
      return false;
    }
    if (contikiBSSCounter != javaBSSCounter) {
      testOutput.addMessage("### BSS section mismatch (" + contikiBSSCounter + " != " + javaBSSCounter + ")", MessageList.ERROR);
      return false;
    }

    testOutput.addMessage("### Backup memory sections: 6,5");
    byte[] savedDataSection = new byte[dataSectionSize];
    byte[] savedBssSection = new byte[bssSectionSize];
    int backupDataCounter = contikiDataCounter;
    int backupBssCounter = contikiBSSCounter;
    javaLibrary.getMemory(relDataSectionAddr, dataSectionSize, savedDataSection);
    javaLibrary.getMemory(relBssSectionAddr, bssSectionSize, savedBssSection);

    testOutput.addMessage("### Increasing data and BSS counters 3 times: 9,8");
    javaLibrary.tick(); javaDataCounter++; javaBSSCounter++;
    javaLibrary.tick(); javaDataCounter++; javaBSSCounter++;
    javaLibrary.tick(); javaDataCounter++; javaBSSCounter++;

    testOutput.addMessage("### Fetching memory, comparing counters");
    javaLibrary.getMemory(relDataSectionAddr, dataSectionSize, initialDataSection);
    javaLibrary.getMemory(relBssSectionAddr, bssSectionSize, initialBssSection);
    memory.setMemorySegment(relDataSectionAddr, initialDataSection);
    memory.setMemorySegment(relBssSectionAddr, initialBssSection);
    contikiDataCounter = varMem.getIntValueOf("var1");
    contikiBSSCounter = varMem.getIntValueOf("uvar1");
    if (contikiDataCounter != javaDataCounter) {
      testOutput.addMessage("### Data section mismatch (" + contikiDataCounter + " != " + javaDataCounter + ")", MessageList.ERROR);
      return false;
    }
    if (contikiBSSCounter != javaBSSCounter) {
      testOutput.addMessage("### BSS section mismatch (" + contikiBSSCounter + " != " + javaBSSCounter + ")", MessageList.ERROR);
      return false;
    }

    testOutput.addMessage("### Restoring backup data section: 6,8");
    javaLibrary.setMemory(relDataSectionAddr, dataSectionSize, savedDataSection);
    javaDataCounter = backupDataCounter;

    testOutput.addMessage("### Increasing data and BSS counters 3 times: 9,11");
    javaLibrary.tick(); javaDataCounter++; javaBSSCounter++;
    javaLibrary.tick(); javaDataCounter++; javaBSSCounter++;
    javaLibrary.tick(); javaDataCounter++; javaBSSCounter++;

    testOutput.addMessage("### Fetching memory, comparing counters");
    javaLibrary.getMemory(relDataSectionAddr, dataSectionSize, initialDataSection);
    javaLibrary.getMemory(relBssSectionAddr, bssSectionSize, initialBssSection);
    memory.setMemorySegment(relDataSectionAddr, initialDataSection);
    memory.setMemorySegment(relBssSectionAddr, initialBssSection);
    contikiDataCounter = varMem.getIntValueOf("var1");
    contikiBSSCounter = varMem.getIntValueOf("uvar1");
    if (contikiDataCounter != javaDataCounter) {
      testOutput.addMessage("### Data section mismatch (" + contikiDataCounter + " != " + javaDataCounter + ")", MessageList.ERROR);
      return false;
    }
    if (contikiBSSCounter != javaBSSCounter) {
      testOutput.addMessage("### BSS section mismatch (" + contikiBSSCounter + " != " + javaBSSCounter + ")", MessageList.ERROR);
      return false;
    }

    testOutput.addMessage("### Restoring backup BSS section: 9,5");
    javaLibrary.setMemory(relBssSectionAddr, bssSectionSize, savedBssSection);
    javaBSSCounter = backupBssCounter;

    testOutput.addMessage("### Fetching memory, comparing counters");
    javaLibrary.getMemory(relDataSectionAddr, dataSectionSize, initialDataSection);
    javaLibrary.getMemory(relBssSectionAddr, bssSectionSize, initialBssSection);
    memory.setMemorySegment(relDataSectionAddr, initialDataSection);
    memory.setMemorySegment(relBssSectionAddr, initialBssSection);
    contikiDataCounter = varMem.getIntValueOf("var1");
    contikiBSSCounter = varMem.getIntValueOf("uvar1");
    if (contikiDataCounter != javaDataCounter) {
      testOutput.addMessage("### Data section mismatch (" + contikiDataCounter + " != " + javaDataCounter + ")", MessageList.ERROR);
      return false;
    }
    if (contikiBSSCounter != javaBSSCounter) {
View Full Code Here

   * @see Mote
   * @see org.contikios.cooja.MoteInterfaceHandler
   */
  public MspMoteID(Mote m) {
    this.mote = (MspMote) m;
    this.moteMem = new VarMemory(mote.getMemory());
  }
View Full Code Here

   * @param gui GUI
   */
  public VariableWatcher(Mote moteToView, Simulation simulation, Cooja gui) {
    super("Variable Watcher (" + moteToView + ")", gui);
    this.mote = moteToView;
    moteMemory = new VarMemory(moteToView.getMemory());

    JLabel label;
    integerFormat = NumberFormat.getIntegerInstance();
    JPanel mainPane = new JPanel();
    mainPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
View Full Code Here

TOP

Related Classes of org.contikios.cooja.mote.memory.VarMemory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.