The Datasheet Archive - 100 Million Datasheets from 7500 Manufacturers.    


Datasheet Search Engine   
 
Part # or Description: • 5V RS232 Driver • 2SC5066* • "Real Time Clock" • "USB connector" • "blue led" 5mm • 10 watt zener diode • 2N3055* motorola
 
Search Tip: Try entering the part number only. Include a wildcard (eg. lm317* or 1n4148*)

 

 

2002 APPLICATION NOTE Adding External File System TINI


Datasheet Thumbnail

  

Download PDF



Top Searches for this datasheet



Maxim Notes MICROCONTROLLERS Keywords: TINI, Tiny Internet Interfaces, external file system, mountable file system
2002
APPLICATION NOTE
Adding External File System TINI
Abstract: This application note describes techniques used external file system TINI®. providing method accessing other file systems, TINI users will longer limited type amount information they process. Since TINI also uses operating heap, using remote file system allows more used running applications. Source code example mountable file system given that uses built-in TCP/IP capabilities TINI access files remote server. Step-by-step instructions given compile this example.
Introduction
standard file system embedded system usually small size. storage space Tiny Internet Interfaces (TINI®) platform exception. TINI's file system resides on-board limited size this RAM. Because this constraint, important provide alternatives data storage. This application note describes technique adding external file system. providing method accessing other file systems, TINI users longer limited type amount information they process. Since TINI also uses operating heap, using remote file system allows more used running applications. Once file system been mounted, there appears difference between file that resides local file system that external. interactions with files occur through standard java.io classes com.dalsemi.fs. DSFile class.
System Overview
There three steps implementing external file system. First, com.dalsemi.fs.FileSystemDriver interface must implemented. This class native library, rely server running elsewhere (like example included this application note), number other options. Second, class classes) must made available process that uses external file system. This done placing copy class TINI's classpath building directly into application that will file system. Finally, file system needs mounted. This done either calling com.dalsemi.fs.DSFile.mount() method from inside application using mount command slush. com.dalsemi.fs.FileSystemDriver interface been written that variety systems implemented. developer freedom handle files manner that appropriate design. Possibilities include Network File System (NFS), file system where files written read from server, disk drive connected TINI. This example uses custom design that uses TINI's on-board TCP/IP network stack access files from remote server. Figure shows system's configuration. TINI's file system holds reference file system driver. Whenever remote file accessed, appropriate method driver called. driver then communicates with remote host over network process request.
Figure System Block Diagram.
TINI Software
NetworkFileSystemDriver class that implements com.dalsemi.fs.FileSystemDriver interface. driver's init method called automatically whenever file system mounted. This gives driver opportunity perform initialization that might necessary. Some examples include resetting initializing hardware, allocating buffers, establishing network connections. this example, init() method attempts establish socket connection with remote server specified parameters. Upon successful connection, server sends port number that driver must send file system commands. This allows original port remain open additional connections. DataInputStream null; DataOutputStream null; Socket null; public void init(String[] args) throws Exception //args[0] address file system server. //args[1] port connect port Integer.parseInt(args[1]); newPort Socket(args[0], port); //Once connected server will send back port connect //to. This original server port will remain available //for additional connections. newPort in.readInt(); finally if(in null) {in.close();} if(sck null) {sck.close();} //Open socket input output streams. //We'll wrap them Data streams convenience. Socket(args[0], newPort); unmount() method driver called when file system unmounted. driver should this method release resources using (e.g., buffers, network connections, ports, etc.). example presented here, driver attempts notify server about disconnect. driver then closes connection with server. public void unmount()
//Send command byte. //This will notify server close end. out.writeByte(CLOSE); finally //We don't care what server does, still need close end. in.close(); out.close(); sck.close(); catch(IOException remaining methods class file system operations (e.g., open, close, read, write, etc.). Each follows flow chart shown Figure These methods were kept simple possible order most workload onto server. example implementation file system operations (File.exists()) given below. //out DataOutputStream command socket between client host. //in DataInputStream command socket between client host. //EXISTS byte that server understands "does file exist" command. public boolean exists(String fileName) //Send command byte necessary arguments. out.writeByte(EXISTS); writeString(fileName); //Get result. return in.readBoolean(); catch(Exception return false;
Figure Block Diagram.
Server Software
NetworkFileSystemHost class acts file system server that resides remote host. This server multithreaded handle multiple simultaneous connections. When server starts, creates server socket that waits incoming connections.
//Create socket accept incoming connections. ServerSocket ServerSocket(3453); System.out.println("Server running. Waiting connections."); Socket ss.accept(); When connection requested, server responds with port number which client should connect creates thread that listens given port commands from client. //Open server socket send port number client. //We want keep original free more connections. DataOutputStream ServerSocket ServerSocket(0); //Start thread handle connection. thread will //be responsible file system operations. SessionThread(ss2).start(); out.flush(); thread continues handling commands until receives disconnect command. listing below shows server
handles this command. server's counterpart exists() function TINI software also shown. //out DataOutputStream command socket between client host. //in DataInputStream command socket between client host. boolean closed false; while(!closed) byte command in.readByte(); switch(command) case DISCONNECT: //Close communication socket requested. in.close(); out.close(); sck.close(); //Clean open files held this thread. closeOpenFiles(openRand); closeOpenFiles(openRead); closeOpenFiles(openWrite); //Set state closed. This will stop main //loop run() method allow thread //terminate. closed true; break; case EXISTS: //Get parameters this operation. String fName readString(); //Send result. File File(parent, fName); out.writeBoolean(f.exists()); break; //Handle other commands here.
Figure illustrates entire program flow server.
Figure File System Server.
Running Example
example, complete following steps:
Install TINIOS 1.10. Include mount unmount commands slush. this, first extract source commands from OptionalSlushCommandsSrc.jar file compile them. Then class files into /tiniext/com/dalsemi/ slush/command directory TINI. following commands slush prompt: addc mount addc unmount Compile source files included with this example using following commands: javac -bootclasspath \bin\tiniclasses.jar NetworkFileSystemDriver.java
javac NetworkFileSystemHost.java where <TINI1.10> TINI 1.10 installation directory. NetworkFileSystemDriver.class file into /tiniext directory TINI. Start file system server with following command: java NetworkFileSystemHost <startDir> where <startDir> directory that visible from TINI file system. slush, mount file system with following command: mount NetworkFileSystemDriver <host 3453 where <host address system where server running.
There will directory root TINI's file system called "mnt." This directory shows files that available from remote server. These files accessed just like files that reside TINI's internal file system available processes created slush.
Associated Files
Files associated with AN709 available download.
Conclusion
using built- TCP/IP capabilities TINI, standard file system extended without much overhead TINI system. This frees applications developed TINI from constraints internal file system. More also made available since data files, files, etc., stored remotely.
Appendix
following documentation com.dalsemi.fs.FileSystemDriver interface.
com.dalsemi.fs Interface FileSystemDriver
public interface FileSystemDriver This interface used implement external file systems. Anyone wishing extend TINI's file system must first implement this interface. class then passed com.dalsemi.fs.DSFile.mount() method creation. Nearly every method this interface takes either file name file descriptor. File names will Strings that include name mount point itself. example, have mount point named "mnt", mounted file system there directory called test, TINI would access file that directory using String "/mnt/test/ myfile." name would then passed driver "test/myfile." When accessing mount point itself ("/mnt"), represented empty string (""). Methods that file descriptor file descriptor returned openReadingFD, openWritingFD, openRandomFD methods. What contained file descriptor developer. Many methods also parameter. This person trying perform operation. that have high assumed have administrator privileges. Method Summary boolean boolean boolean Void available(Object number bytes that read without blocking. canExec(String fileName, byte uid) Determines given file executable. canRead(String fileName, byte uid) Determines given file readable. canWrite(String fileName, byte uid) Determines given file writable. close(Object Closes file descriptor's stream releases system resources used.
boolean boolean byte[] long long void boolean boolean long long string[] boolean object object object boolean Void Void void void long void void void
delete(String fileName, byte uid) Removes specified file from mounted file system. exists(String fileName) Determines given file exists mounted file system. getContents(String fileName, byte uid)>br> Gets complete contents file mounted file system. getLength(Object Gets length file represented file descriptor. getOffset(Object Gets current offset into file. getOtherPermissions(String fileName) Gets other (non-owner) permissions given file. getUser(String fileName) Gets owner file. getUserPermissions(String fileName) Gets user/owner permissions given file. init(String[] args) This method will called first time mounted file system accessed. isDirectory(String fileName) Determines given name represents directory. isFile(String fileName) Determines given name represents file directory. lastModified(String fileName) Indicates time file last modified. length(String fileName) Gets length file. list(String fileName, byte uid) Retrieves listing files directory specified. mkdir(String fileName, byte uid) Creates directory mounted file system. openRandomFD(String fileName, byte uid) Opens given file random access. openReadingFD(String fileName, byte uid) Opens given file reading. openWritingFD(String fileName, boolean append, byte uid) Opens given file writing. readBytes(Object byte[] data, start, length) Reads from file represented file descriptor. rename(String srcname, String destname, byte uid) Changes name file. seek(Object long Moves file pointer given location, measured bytes from beginning file. setOtherPermissions(String fileName, perms, byte uid) Changes other (non-owner) permissions given file. setUser(String fileName, byte newUID, byte uid) Sets owner given file. setUserPermissions(String fileName, perms, byte uid) Changes user/owner permissions given file. skipBytes(Object long Skips next bytes data from stream. touch(String fileName, byte uid) Updates last modified time given file current time. unmount() Allows driver chance clean release resources used when mount point removed. writeBytes(Object byte[] data, start, length) Writes given data file represented file descriptor.
Method Detail
init
public void init(String[] args) throws Exception This method will called first time mounted file system accessed. Parameters: args arguments needed initialize file system. Throws: Exception
exists
public boolean exists(String fileName) Determines given file exists mounted file system. This method should match behavior java.io.File.exists(). Parameters: fileName file. Returns: true file exists.
canWrite
public booleancanWrite(String fileName, byte uid) Determines given file writable. file does exists, driver should determine created return accordingly. This method should match behavior java.io.File.canWrite(). Parameters: fileName file. user that trying access file. Returns: true file written this user.
canRead
public boolean canRead(String fileName,byte uid) Determines given file readable. This method should match behavior java.io.File.canRead(). Parameters: fileName file. user that trying access file. Returns: true file read this user.
canExec
public boolean canExec(String fileName, byte uid) Determines given file executable. This method should match behavior Parameters: fileName file. user that trying access file. Returns: true file executed this user.
isFile
public boolean isFile(String fileName) Determines given name represents file directory. This method should match behavior java.io.File.isFile(). Parameters: fileName file. Returns: true fileName represents file.
isDirectory
public boolean isDirectory(String fileName) Determines given name represents directory. This method should match behavior java.io.File.isDirectory(). Parameters: fileName file. Returns: true fileName represents directory.
LastModified
public long lastModified(String fileName) Indicates time file last modified. This method should match behavior java.io.File.lastModified(). Parameters: fileName file. Returns: modification time file.
length
public long length(String fileName) Gets length file. This method should match behavior java.io.File.length(). Parameters: fileName file. Returns: length file.
mkdir
public boolean mkdir(String fileName, byte uid) Creates directory mounted file system. This method should match behavior java.io.File.mkdir(). Parameters: fileName name directory create. user that trying create directory. Returns: true directory created.
rename
public boolean rename(String srcname, String destname, byte uid) Changes name file. This method should match behavior java.io.File.renameTo(File dest).
Parameters: srcname name file changed. destname name file. user that trying rename file. Returns: true file renamed.
list
public String[] list(String fileName, byte uid) Retrieves listing files directory specified. This method should match behavior java.io.File.list(). Parameters: fileName directory listing from. user trying retreive list. Returns: list files, null fileName doesn't represent directory.
delete
public boolean delete(String fileName, byte uid) Removes specified file from mounted file system. This method should match behavior java.io.File.delete(). Parameters: fileName File delete. user trying delete file. Returns: true file removed.
touch
public void touch(String fileName, byte uid) throws IOException Updates last modified time given file current time. This method should match behavior com.dalsemi.fs.DSFile.touch(). Parameters: fileName file touch. user trying update file. Throws: IOException
setUserPermissions
public void setUserPermissions(String fileName, perms, byte uid) throws IOException Changes user/owner permissions given file. This method should match behavior perms). Parameters: fileName file. perms permissions. user that trying change file. Throws: IOException
setOtherPermissions
public void setOtherPermissions(String fileName, perms, byte uid) throws IOException Changes other (non-owner) permissions given file. This method should match behavior perms). Parameters: fileName file. perms permissions. user that trying change file.
setUser
public void setUser(String fileName, byte newUID, byte uid) throws IOException Sets owner given file. This method should match behavior uid). Parameters: fileName file.newUID owner. user that trying change file. Throws: IOException
getUserPermissions
public getUserPermissions(String fileName) throws FileNotFoundException Gets user/owner permissions given file. This method should match behavior Parameters: fileName file. Returns: user permissions. Throws: FileNotFoundException
getOtherPermissions
public getOtherPermissions(String fileName) throws FileNotFoundException Gets other (non-owner) permissions given file. This method should match behavior Parameters: fileName file. Returns: other permissions. Throws: FileNotFoundException
getUser
public getUser(String fileName) throws FileNotFoundException Gets owner file. This method should match behavior Parameters: fileName file.
Returns: file's owner. Throws: FileNotFoundException
openWritingFD
public Object ,b>openWritingFD(String fileName, boolean append, byte uid) throws IOException Opens given file writing. file descriptor that returned will used identify file other driver calls. file descriptor length should hold information driver needs identify associated file stream's state. This method should match behavior java.io.FileOutputStream(String name, boolean append). Parameters: fileName name file open. append true file exists, file should opened file pointer file. false file exists, contents file should erased file's length user trying open file. Returns: file descriptor. Throws: IOException
openReadingFD
public Object openReadingFD(String fileName, byte uid) throws FileNotFoundException Opens given file reading. file descriptor that returned will used identify file other driver calls. file descriptor length should hold information driver needs identify associated file stream's state. This method should match behavior java.io.FileInputStream(String name). Parameters: fileName name file open. user trying open file. Returns: file descriptor. Throws: FileNotFoundException
openRandomFD
public Object openRandomFD(String fileName, byte uid) throws IOException Opens given file random access. file descriptor that returned will used identify file other driver calls. file descriptor length should hold information driver needs identify associated file stream's state. This method should match behavior java.io.RandomAccessFile(String name, String mode). Parameters: fileName name file open. user trying open file. Returns: file descriptor. Throws: IOException
writeBytes
public void writeBytes(Object byte[] data, start,int length) throws IOException Writes given data file represented file descriptor. This method should match behavior java.io.
OutputStream.write(byte[] off, len). Parameters: file descriptor identifying file write data data write. start start offset data. length number bytes write. Throws: IOException
readBytes
public readBytes(Object byte[] data, start, length) throws IOException Reads from file represented file descriptor. This method should match behavior java.io.InputStream.read (byte[] off, len). Parameters: file descriptor identifying file read from. data buffer store data that read. start start offset buffer. length number bytes read. Returns: number bytes read. Throws: IOException
seek
public void seek(Object long throws IOException Moves file pointer given location, measured bytes from beginning file. This method should match behavior pos). Parameters: file descriptor identifying file. position file pointer. Throws: IOException
skipBytes
public long skipBytes(Object long throws IOException Skips next bytes data from stream. This method should match behavior java.io.InputStream.skip(long file descriptor represents FileInputStream should match behavior file descriptor represents RandomAccessFile. Parameters: file descriptor identifying file. number bytes skip. Returns: actual number bytes skipped. Throws: IOException
getOffset
public long getOffset(Object throws IOException Gets current offset into file. This method should match behavior java.io.
Parameters: file descriptor identifying file. Returns: current position file pointer. Throws: IOException
getLength
public long getLength(Object throws IOException Gets length file represented file descriptor. This method should match behavior java.io. RandomAccessFile.length(). Parameters: file descriptor identifying file. Returns: length file. Throws: IOException
available
public available(Object throws IOException number bytes that read without blocking. This method should match behavior java.io.FileInputStream. available(). Parameters: file descriptor identifying file. Returns: number bytes available.
close
public void close(Object throws IOException Closes file descriptor's stream releases system resources used. This method should match behavior java.io. FileInputStream.close(), depending type file descriptor passed Parameters: file descriptor identifying file. Throws: IOException
unmount
public void unmount() Allows driver chance clean release resources used when mount point removed.
getContents
public byte[] getContents(String fileName, byte uid) throws IOException Gets complete contents file mounted file system. This method will called when system attempts
execute file located mounted file system. Parameters: fileName file retreive. user trying execute file. Returns: contents file. Throws: IOException
Application Note 709: http://www.maxim-ic.com/an709 More Information technical questions support: http://www.maxim-ic.com/support samples: http://www.maxim-ic.com/samples Other questions comments: http://www.maxim-ic.com/contact Related Parts DS80C390: DS80C400: QuickView Full (PDF) Data Sheet Free Samples QuickView Full (PDF) Data Sheet Free Samples
DSTINIm400: QuickView Full (PDF) Data Sheet DSTINIs400: QuickView Full (PDF) Data Sheet
AN709, 709, APP709, Appnote709, Appnote Copyright Maxim Integrated Products Additional legal notices: http://www.maxim-ic.com/legal

Other recent searches


REJ10J0023-0100Z - REJ10J0023-0100Z   REJ10J0023-0100Z Datasheet
NJG1512HD3 - NJG1512HD3   NJG1512HD3 Datasheet
MAU200 - MAU200   MAU200 Datasheet
BFR90 - BFR90   BFR90 Datasheet
BRF90G - BRF90G   BRF90G Datasheet
B5124 - B5124   B5124 Datasheet

 

Privacy Policy | Disclaimer
© 2012 Datasheet Archive