head	1.1;
access;
symbols
	bg2_23:1.1
	bg2_22:1.1
	bg2_21:1.1
	bg2_20:1.1
	bg2_16:1.1
	bg2_15:1.1
	bg2_12:1.1
	bg2_07:1.1
	isorc2008_submission:1.1;
locks; strict;
comment	@# @;


1.1
date	2007.11.25.16.32.54;	author peter.hilber;	state Exp;
branches;
next	;
commitid	11b94749a3ad4567;


desc
@@


1.1
log
@*** empty log message ***
@
text
@package yaffs2;

import yaffs2.port.yaffsfs_C;
import yaffs2.port.yaffsfs_H;
import yaffs2.utils.EmulationUtils;
import yaffs2.utils.Utils;

public class SimpleTest {

	protected static final String mountPoint = "/";

	/**
	 * @@param args
	 */
	public static void main(String[] args) {
		yaffs2.utils.Globals.startUp(
				new yaffs2.platform.jop.yaffscfg2k(),
				new yaffs2.platform.jop.PortConfiguration(),
				null);

		yaffs2.utils.Globals.configuration.yaffs_StartUp();

		yaffsfs_C.yaffs_mount(Utils.StringToByteArray(mountPoint), 0);

		int handle = yaffsfs_C.yaffs_open(Utils.StringToByteArray(mountPoint + "/a"), 0, 
				yaffsfs_H.O_RDWR | yaffsfs_H.O_CREAT | yaffsfs_H.O_TRUNC, 
				yaffsfs_H.S_IREAD | yaffsfs_H.S_IWRITE);

		byte[] buf = { '1', '2', '3', '4', 0};

		yaffsfs_C.yaffs_write(handle, buf, 0, buf.length);

		yaffsfs_C.yaffs_lseek(handle, 0, yaffsfs_H.SEEK_SET);

//		yaffsfs_C.yaffs_close(handle);
//
//		handle = yaffsfs_C.yaffs_open(Utils.StringToByteArray(mountPoint + "/a"), 0, 
//				yaffsfs_H.O_RDONLY, 
//				yaffsfs_H.S_IREAD);

		byte[] rbuf = new byte[buf.length];

		yaffsfs_C.yaffs_read(handle, rbuf, 0, rbuf.length);

		System.out.println("Read: " + EmulationUtils.byteArrayToString(rbuf, 0));

		yaffsfs_C.yaffs_close(handle);
		yaffsfs_C.yaffs_unmount(Utils.StringToByteArray(mountPoint), 0);
	}

}
@
