Updated SkyFlash to be used with any M25P80 equipped mote

This commit is contained in:
nifi 2010-09-09 19:56:59 +00:00
parent 2835cdadff
commit d7c1fffd51
2 changed files with 11 additions and 10 deletions

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: SkyMote.java,v 1.18 2009/10/27 10:02:48 fros4943 Exp $ * $Id: SkyMote.java,v 1.19 2010/09/09 19:56:59 nifi Exp $
*/ */
package se.sics.cooja.mspmote; package se.sics.cooja.mspmote;
@ -36,6 +36,7 @@ import java.io.File;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import se.sics.cooja.Simulation; import se.sics.cooja.Simulation;
import se.sics.cooja.mspmote.interfaces.CoojaM25P80;
import se.sics.cooja.mspmote.interfaces.SkyCoffeeFilesystem; import se.sics.cooja.mspmote.interfaces.SkyCoffeeFilesystem;
import se.sics.mspsim.platform.sky.SkyNode; import se.sics.mspsim.platform.sky.SkyNode;
@ -59,6 +60,7 @@ public class SkyMote extends MspMote {
try { try {
skyNode = new SkyNode(); skyNode = new SkyNode();
registry = skyNode.getRegistry(); registry = skyNode.getRegistry();
skyNode.setFlash(new CoojaM25P80(skyNode.getCPU()));
prepareMote(fileELF, skyNode); prepareMote(fileELF, skyNode);
} catch (Exception e) { } catch (Exception e) {
logger.fatal("Error when creating Sky mote: ", e); logger.fatal("Error when creating Sky mote: ", e);

View file

@ -26,7 +26,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE. * SUCH DAMAGE.
* *
* $Id: SkyFlash.java,v 1.7 2010/02/05 08:44:57 fros4943 Exp $ * $Id: SkyFlash.java,v 1.8 2010/09/09 19:56:59 nifi Exp $
*/ */
package se.sics.cooja.mspmote.interfaces; package se.sics.cooja.mspmote.interfaces;
@ -41,7 +41,7 @@ import javax.swing.*;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import org.jdom.Element; import org.jdom.Element;
import se.sics.cooja.*; import se.sics.cooja.*;
import se.sics.cooja.mspmote.SkyMote; import se.sics.cooja.mspmote.MspMote;
/** /**
* @author Fredrik Osterlind * @author Fredrik Osterlind
@ -50,15 +50,14 @@ import se.sics.cooja.mspmote.SkyMote;
public class SkyFlash extends MoteInterface { public class SkyFlash extends MoteInterface {
private static Logger logger = Logger.getLogger(SkyFlash.class); private static Logger logger = Logger.getLogger(SkyFlash.class);
public int SIZE = 1024*1024; protected final CoojaM25P80 m24p80;
private SkyMote mote = null;
protected CoojaM25P80 m24p80 = null;
public SkyFlash(Mote mote) { public SkyFlash(Mote mote) {
this.mote = (SkyMote) mote; MspMote mspMote = (MspMote) mote;
this.m24p80 = new CoojaM25P80(this.mote.getCPU()); m24p80 = (CoojaM25P80) mspMote.getCPU().getChip(CoojaM25P80.class);
this.mote.skyNode.setFlash(this.m24p80); if (m24p80 == null) {
throw new IllegalStateException("Mote is not equipped with an M25P80");
}
} }
/** /**