|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlejos.pc.comm.NXTSamba
public class NXTSamba
Implements a sub-set of the Atmel SAM-BA download protocol. Only those functions required for program download to the NXT flash are currently implemented.
Field Summary | |
---|---|
static int |
FLASH_BASE
The NXT has 256KB Flash starting at 0x100000, divided into 256byte pages. |
static int |
FLASH_MAX
|
static int |
PAGE_SIZE
|
Constructor Summary | |
---|---|
NXTSamba()
|
Method Summary | |
---|---|
void |
close()
Close the device. |
java.io.InputStream |
createInputStream(int addr,
int len)
|
java.lang.String |
getVersion()
returns the SAM-BA version string for the current device. |
void |
jump(int addr)
Start execution of code at the specified address. |
boolean |
open(NXTInfo nxt)
Open the specified USB device and check that it is in SAM-BA mode. |
void |
readBytes(int addr,
byte[] data,
int off,
int len)
Read a 32 bit word from the specified address. |
int |
readHalfword(int addr)
Read a 16 bit halfword from the specified address. |
int |
readOctet(int addr)
Read a 8 bit octet from the specified address. |
void |
readPage(int page,
byte[] data,
int offset)
Read a single page from flash memory. |
void |
readPages(int first,
byte[] data,
int start,
int len)
Read a series of pages from flash memory. |
int |
readWord(int addr)
Read a 32 bit word from the specified address. |
void |
reboot()
|
NXTInfo[] |
search()
Locate all NXT devices that are running in SAM-BA mode. |
void |
unlockAllPages()
Turn off the lock bits for all of flash memory. |
void |
writeBytes(int addr,
byte[] data)
Write a series of bytes to the device. |
void |
writeHalfword(int addr,
int val)
Write a 16 bit halfword to the specified address. |
void |
writeOctet(int addr,
int val)
Write a 8 bit octet to the specified address. |
void |
writePage(int page,
byte[] data,
int offset)
Write a single page to flash memory. |
void |
writePage(int page,
byte[] data,
int offset,
int len)
Write a single page to flash memory. |
void |
writePages(int first,
byte[] data,
int start,
int len)
Write a series of pages to flash memory. |
void |
writeWord(int addr,
int val)
Write a 32 bit word to the specified address. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int FLASH_BASE
public static final int FLASH_MAX
public static final int PAGE_SIZE
Constructor Detail |
---|
public NXTSamba()
Method Detail |
---|
public NXTInfo[] search() throws NXTCommException
NXTCommException
public void writeOctet(int addr, int val) throws java.io.IOException
addr
- val
-
java.io.IOException
public void writeHalfword(int addr, int val) throws java.io.IOException
addr
- val
-
java.io.IOException
public void writeWord(int addr, int val) throws java.io.IOException
addr
- val
-
java.io.IOException
public int readOctet(int addr) throws java.io.IOException
addr
-
java.io.IOException
public int readHalfword(int addr) throws java.io.IOException
addr
-
java.io.IOException
public int readWord(int addr) throws java.io.IOException
addr
-
java.io.IOException
public java.io.InputStream createInputStream(int addr, int len) throws java.io.IOException
java.io.IOException
public void readBytes(int addr, byte[] data, int off, int len) throws java.io.IOException
addr
- data
- the return dataoff
- the offsetlen
- the length
java.io.IOException
public void writeBytes(int addr, byte[] data) throws java.io.IOException
addr
- data
-
java.io.IOException
public void jump(int addr) throws java.io.IOException
addr
-
java.io.IOException
public void reboot() throws java.io.IOException
java.io.IOException
public void unlockAllPages() throws java.io.IOException
java.io.IOException
public void writePage(int page, byte[] data, int offset) throws java.io.IOException
page
- data
- offset
-
java.io.IOException
public void writePage(int page, byte[] data, int offset, int len) throws java.io.IOException
page
- data
- offset
- len
-
java.io.IOException
public void writePages(int first, byte[] data, int start, int len) throws java.io.IOException
first
- data
- start
- len
-
java.io.IOException
public void readPage(int page, byte[] data, int offset) throws java.io.IOException
page
- data
- offset
-
java.io.IOException
public void readPages(int first, byte[] data, int start, int len) throws java.io.IOException
first
- data
- start
- len
-
java.io.IOException
public boolean open(NXTInfo nxt) throws java.io.IOException
nxt
- Device to open.
java.io.IOException
public void close()
public java.lang.String getVersion() throws java.io.IOException
java.io.IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |