**************************************************************************** * * * DiskOnChip(R) TrueFFS(R) driver for Windows 2000, Windows XP * * and Windows XP Embedded * * Version 5.1.4 from June 24, 2003 * * Based on TrueFFS SDK version 5.1.4 * * * * Copyright M-Systems (c) 1997-2003 * * * **************************************************************************** * * * This software should be used for DiskOnChip(R) devices only. * * * **************************************************************************** Content: 1. Introduction 2. Installing the DiskOnChip TrueFFS driver in Windows 2000/XP 2.1 Disabling old TrueFFS driver. 2.2 Installing DiskOnChip as additional drive. 3. Installing the DiskOnChip TrueFFS driver in Windows XP Embedded 3.1 Importing The latest TrueFFS driver into XPE environment. 3.2 Creating a Windows XPE image with the new DiskOnChip driver. 4. Installing the DiskOnChip as a boot device in Windows XP Embedded 4.1 Preparing DiskOnChip using FAT file system to boot XPE. 4.2 Preparing DiskOnChip using NTFS file system to boot XPE. 4.3 using NTFS compression. 4.4 Booting XPE from DiskOnChip device. 5. Troubleshooting 5.1 DiskOnChip driver is working properly, but there is no drive letter for DiskOnChip. 6. IOCTL Functionality of the DiskOnChip Driver. 6.1 Implementation example of IOCTL Functionality (IOCTL_TFFS_GET_INFO ). 7. Known limitations 8. Contact information 1. Introduction. ================ Version 5.1.4 of the the DiskOnChip TrueFFS driver for Windows XP supports all M-Systems DiskOnChip family of products, including: - Mobile DiskOnChip Plus (16Mbytes-64MBytes) - DiskOnChip Millennium Plus (16Mbytes-32MBytes) - DiskOnChip Millennium 8MB, Both DIP and TSOP packages. - DiskOnChip DIMM2000 - DiskOnChip 2000 DIP (up to 1Gbytes) TrueFFS provides block device functionality (disk emulation) to the file system, and includes advanced algorithms for flash management including wear leveling and bad block handling. The Windows 2000/XP/XPE version of TrueFFS is provided as a SYS file and includes header files that provide access to DiskOnChip extended functionality, such as data protection (where applicable), defragmentation, deep power down mode and many others. 2. Installing the DiskOnChip TrueFFS driver on Windows 2000 / XP ================================================================ If you already have a working DiskOnChip in your system, you should first disable an old TrueFFS driver in the Device Manager in order for the new driver to take over. If you don't have a DiskOnChip in your system, skip to section 2.2. NOTES: A. You must be logged on as an administrator or a member of the Administrators group in order to complete this procedure. If your computer is connected to a network, network policy settings may also prevent you from completing this procedure. B. The following permissions and privileges are required in order to install a driver. Administrators are granted these permissions: - The Load\Unload Drivers privilege. - The permissions needed to copy files to the system32\drivers directory. - The permissions needed to write settings to the registry. - Being logged on to your computer with these privileges may make your computer's security vulnerable. 2.1 Disabling old TrueFFS driver. --------------------------------- 2.1.1 Click with the right mouse button on the "My Computer" and choose "Manage". 2.1.2 In the "Computer Management" window locate "Device Manager" item and choose it. 2.1.3 On the right panel of the window locate "PCMCIA and Flash Memory Devices" and open it. 2.1.4 You should see now one or more lines named "M-Systems DiskOnChip 2000" or "M-Systems DiskOnChip". On every line click with the right mouse button and choose "DISABLE" from the menu. 2.1.5 You should see now all DiskOnChip devices disabled (marked with a cross sign). Again click on every line of the DiskOnChip device with the right mouse button, but now choose "UNINSTALL" from the menu. The corresponding line should disappear. 2.2 Installing DiskOnChip as additional drive. ---------------------------------------------- 2.2.1 Insert DiskOnChip into your target platform (with the help of a DiskOnChip evaluation board EVB or a special DIP 32 socket). 2.2.2 Turn on your computer and wait till the OS finish loading. 2.2.3 Unzip the TrueFFS installation package into a new folder. 2.2.4 From the Desktop, open "My Computer". 2.2.5 Open the folder with TrueFFS installation files. 2.2.6 Right click on the file TFFS.INF. A menu will be opened. 2.2.7 In the menu choose "Install". 2.2.8 After Windows finishes copying the driver you will be asked to reboot your computer. After rebooting, the DiskOnChip will appear as another drive in your system. 2.2.9 Depending on your Windows configuration you may be required to confirm that you want to install "M-Systems DiskOnChip" in a "Found New Hardware Wizard" dialog. On the first screen of the "Found New Hardware Wizard" make sure the "Install the software automatically (recommended)" option is selected and click "Next". On the second screen click "Finish". In some cases you may get a message saying that your device may not work properly until you reboot. You may accept the suggestion to reboot or you may deny it - DiskOnChip will work properly anyway. 3. Creating an updated image in XPE environment ============================================== To install the DiskOnChip TrueFFS driver on Windows XP Embedded (XPE), you have to first include the driver in the OS image you create. If DiskOnChip is the sole disk in the system, you should copy this image to the DiskOnChip, which was first formatted using M-Systems DFORMAT utility, and later formatted using the Microsoft BootPrep.exe utility. To accomplish this, perform the following steps: 3.1 Importing The latest TrueFFS driver into XPE enviorment: ------------------------------------------------------------ 3.1.1 Windows XPE includes the 'M-Systems DiskOnChip 2000’ component which only supports the M-Systems DiskOnChip 2000 and DiskOnChip Millennium. It is recommended to update this component with the "M-Systems DiskOnChip" component from the TrueFFS installation package. Unzip the TrueFFS installation package into a new folder directory. 3.1.2 Open the Component Database Manager (located at Microsoft Windows Embedded Studio). 3.1.3 Choose 'Database Import' and import the TFFSXPE.SLD file. 3.2 Creating a Windows XPE image with the new DiskOnChip driver. ---------------------------------------------------------------- 3.2.1 Run Microsoft "Target Designer" and start a new configuration file (file_name.slx) 3.2.2 Add the DiskOnChip component from: Hardware|devices|PCMCIA and Flash memory devices|M-Systems DiskOnChip 3.2.3 Verify you have selected a file system (FAT or NTFS): Software|system|file system| 3.2.4 After you have concluded selecting all required components, Press F7 to build your Windows XPE image file. 4. Installing the DiskOnChip as a boot device on Windows XP Embedded ======================================================================== 4.1 Preparing DiskOnChip using FAT file system to boot XPE. ----------------------------------------------------------- 4.1.1 Run DFORMAT utility on the DiskOnChip. (DFORMAT /WIN:d000 /s:doc514.exb /y) 4.1.2 Run BootPrep Utility on the DiskOnChip NOTE: In order to get BOOTPREP.EXE on your machine, you need to run a full install of the embedded product and select the option to install this tool under 'custom' setup. This should install the utility to \Program Files\Windows Embedded\utilities. 4.1.3 Load XP environment where DiskOnChip is another drive in the system, and copy all prepared image files to the DiskOnChip. NOTE: The following files must reside in the root directory for Windows XPE to boot: NTLDR BOOT.INI WERUNTIME.INI. 4.1.4 Shut Down your computer, and de-attach all other Hard-Disks on your target system, and turn on your computer, XPE will now boot from DiskOnChip. 4.2 Preparing DiskOnChip using NTFS file system to boot XPE. ------------------------------------------------------------ 4.2.1 Perform Steps 4.1.1 and 4.1.2 4.2.2 Before copying the Image files to the DiskOnChip, format the DiskOnChip with NTFS format type. to do so: 4.2.2.1 Open Explorer, go to DiskOnChip drive and press right button on the mouse, then choose "Format" from the menu. 4.2.2.2 Choose NTFS in "File System", Do NOT enable compression, press "Start". Press "Close" when formatting is finished. 4.2.3 Copy all image files to DiskOnChip. NOTE: The following files must reside in the root directory for Windows XPE to boot: NTLDR BOOT.INI WERUNTIME.INI. 4.3 using NTFS compression -------------------------- This section assumes that 4.2 was already performed. 4.3.1 Go to the DiskOnChip drive and "Compress" all the folders by Right-clicking on each folder and choosing "Properties | Compress | OK" from the menu. Note: Do NOT compress files in the root directory! You will be given another screen with exclamation mark warning that this action compresses all files but does not compress sub folders. Check "Also compress sub folders" and click "Ok". 4.4 Booting XPE from the DiskOnChip device ------------------------------------------ This section assumes that you already prepared your DiskOnChip in section 4.1 or 4.2 4.4.1 DiskOnChip is ready to boot Windows XPE. If you want to boot it in the system you just used, you need to disable your hard disk drive in the BIOS Setup or to disconnect it thus turning DiskOnChip to the boot device instead of your hard disk. 4.4.2 If there are more than one boot device in the system: 4.4.2.1 Configure the DiskOnChip firmware (BIOS driver) to be the first disk in the system. This is performed using the DiskOnChip DFORMAT utility for DOS: DFORMAT /WIN:d000 /S:DOC514.EXB /FIRST /NOFORMAT More information on DFORMAT can be found in the DiskOnChip DOS utilities user manual or by using the "/?" flag. (it is recommended to use a DiskOnChip evaluation board (ISA or PCI) for this purpose). Important: You MUST reboot your machine after DFORMAT is applied. 4.4.2.2 Another alternative is to enter the BIOS setup and set the device as first. This alternative is relevant if the BIOS supports "BIOS Boot Specification Version 1.01". 5. Troubleshooting ================== 5.1 DiskOnChip driver is working properly, but there is no drive letter for DiskOnChip. --------------------------------------------------------------------------------------- 5.1.1 Right Click on "My Computer" and choose "Manage" 5.1.2 Click on "Storage->Disk Management" icon. 5.1.3 Locate the DiskOnChip Volume. if the DiskOnChip appear with DriveLetter: 5.1.3.1 Change the assigned drive letter and apply. otherwise 5.1.3.2 Choose "Add Drive Letter" by Right Click, and Apply changes. 5.1.4 if there is still no drive letter, reboot to apply recent changes. (if you don't see the DiskOnChip volume in the disk management view, try to reboot and start again, or try to do the installation once again) 6. IOCTL Functionality of DiskOnChip Driver =========================================== The basic function of TrueFFS is to enable regular file systems to access the DiskOnChip as if it were a block device (disk). To do this, TrueFFS provides a standard block-device interface, with the capability of reading and writing logical sectors to and from the DiskOnChip. This capability, along with advanced Flash management features (transparent to the OS and file system) are enough to enable file-systems and operating systems to manage the DiskOnChip as a standard storage device. In addition to the standard storage device functionality, the TrueFFS driver provides access to extended functionality, not part of standard file systems API. The driver implements the interface of the extended functionality by exporting a list of extended functions (through IOCTLs). Every extended function is represented by a code defined as enumerated type defined in flioctl.h. note: see implementation example of IOCTL Functionality of DiskOnChip at the end of this section. For more details about extended functionality please refer to the Developers Guide "Extended Functions of DiskOnChip Driver Based on TrueFFS version 5.1.x" Notes: A. In the developers guide all the data structures and constants are defined and explained. Since the driver is using bufferization any input/output buffer that contains a pointer member was converted to fixed allocated array. B. It is highly recommended to flush all OS buffers to DiskOnChip media before issuing any IOCTL call. To do this link your program's object files with commode.obj file supplied by Microsoft and call _flushall() function before DeviceIoControl call. 6.1 Implementation example of IOCTL Functionality (IOCTL_TFFS_GET_INFO ) ------------------------------------------------------------------------ int main(int argc, char *argv[]) { HANDLE drvDev; CHAR drvName[TFFS_DRV_NAME]; // Choose Device by first argument if( isalpha(*argv[ARG_START]) && (*(argv[ARG_START]+1) == ':') ) sprintf(drvName,"\\\\.\\%c:",*argv[ARG_START]); else if( isdigit(*argv[ARG_START]) ) sprintf(drvName,"\\\\.\\PHYSICALDRIVE%c",*argv[ARG_START]); else { return( 1 ); } // Get Device Handle drvDev = CreateFile( (LPCTSTR)drvName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL ); if( drvDev == INVALID_HANDLE_VALUE ) { printf("Device %s Handle - Fail, Error = %ld\n",drvName,GetLastError()); return( 2 ); } else printf("Device %s Handle - Ok\n",drvName); printf("GetInfo.."); ioctlCall(drvDev,IOCTL_TFFS_GET_INFO,NULL); CloseHandle(drvDev); drvDev = NULL; return( 0 ); } void ioctlCall(HANDLE Dev, DWORD ioCtlCode, ... ) { va_list param; BOOL status; DWORD inBufferSize, outBufferSize; DWORD retLength; // returned amount of data LPVOID lpInBuffer = NULL, lpOutBuffer = NULL; va_start(param,ioCtlCode); // init parameter variable //IOCTL_TFFS_GET_INFO inBufferSize = 0; outBufferSize = sizeof(flDiskInfoOutput); lpOutBuffer = (LPVOID)malloc(outBufferSize); va_end(param); // end parameter variable // flush OS buffers to disk (commode.obj file should be linked to the program) _flushall(); // ioctl call status = DeviceIoControl(Dev, ioCtlCode, lpInBuffer, inBufferSize, lpOutBuffer, outBufferSize, &retLength, NULL); if( status == 0 ) { printf("Fail\n"); if( lpInBuffer != NULL ) free(lpInBuffer); if( lpOutBuffer != NULL ) free(lpOutBuffer); return; } printf("Ok\n"); // show returned data printf("Logical Sectors: %x\n", ((flDiskInfoOutput *)lpOutBuffer)->info.logicalSectors); printf("Boot Area Size: %x Kbytes\n", ((flDiskInfoOutput *)lpOutBuffer)->info.bootAreaSize / KBYTE); printf("Base Address: %lx\n", ((flDiskInfoOutput *)lpOutBuffer)->info.baseAddress); printf("Flash Type: %x\n", ((flDiskInfoOutput *)lpOutBuffer)->info.flashType); printf("Physical Size: %x Mbytes\n", ((flDiskInfoOutput *)lpOutBuffer)->info.physicalSize / MBYTE); printf("Physical Unit Size: %d Kbytes\n", ((flDiskInfoOutput *)lpOutBuffer)->info.physicalUnitSize / KBYTE); printf("DOC Type: %d\n", ((flDiskInfoOutput *)lpOutBuffer)->info.DOCType); printf("Life Time (1-10): %d\n", ((flDiskInfoOutput *)lpOutBuffer)->info.lifeTime); printf("Driver version: %s\n", ((flDiskInfoOutput *)lpOutBuffer)->info.driverVer); printf("TrueFFS version: %s\n", ((flDiskInfoOutput *)lpOutBuffer)->info.TrueFFSVer); printf("Cyl/Head/Sec = %x/%x/%x\n", ((flDiskInfoOutput *)lpOutBuffer)->info.cylinders, ((flDiskInfoOutput *)lpOutBuffer)->info.heads, ((flDiskInfoOutput *)lpOutBuffer)->info.sectors); if( lpInBuffer != NULL ) free(lpInBuffer); if( lpOutBuffer != NULL ) free(lpOutBuffer); } 7. Known limitations ===================== 7.1 When formatting an 8MB BDTL partition, use the native file systems high level format and not the TrueFFS built in FAT formatter. otherwise the DiskOnChip will not be mounted as a disk drive in your OS. 7.2 If write protection is activated (as a result of ioctl call) then writing to a write protected partition will show a fail message only after the data is flushed from the system cache. (which means that there may be delay between the write call and the execution, as a result of the buffering in the Windows Operating System) 7.3 Do not use the password "00000000" (ASCII 0) on Protected partitions. 8. Contact information ======================= Please visit our website for the latest driver versions and updated information. Internet: http://www.m-sys.com E-mail: info@m-sys.com USA: M-Systems Inc. 8371 Central Ave, Suite A Newark CA 94560 USA Phone: +1-510-494-2090 Fax: +1-510-494-5545 Taiwan: M-System Asia Ltd. Room B, 13F, No. 133, Sec. 3 Min Sheng East Road Taipei, Taiwan R.O.C. Phone: +886-2-8770-6226 Fax: +886-2-8770-6295 Japan: M-Systems Japan Inc. Asahi Seimei Gotanda Bldg., 3F 5-25-16 Higashi-Gotanda Shinagawa-ku Tokyo, 141-0022 Phone: +81-3-5423-8101 Fax: +81-3-5423-8102 China: M-Systems China Ltd. 25A International Business Commercial Bldg. Nanhu Rd., Lou Hu District Shenzhen, China 518001 Phone: +86-755-2519-4732 Fax: +86-755-2519-4729 Europe/Israel: M-Systems Ltd. Central Park 2000 7 Atir Yeda St. Kfar Saba 44425, Israel Tel: 972-9-764-5000 Fax: 972-3-548-8666