2.4   Socket Layer Options for the pc386 and pc486 BSPs

For the pc386 and pc486 BSPs, you have the option of including a fully functional PCMCIA interface driver that TrueFFS can use to handle its socket layer interface. You can use this PCMCIA driver instead of the PCIC driver. The PCMCIA interface driver is designed to support a wide variety of PC card devices, including flash memory card devices. It supports hot swapping and is careful to check the type of the device in the PCMCIA socket before it sends any commands to the device.1

Of course, there are situations in which you need some support for PC flash cards but could do without all the services provided by the PCMCIA driver. In such cases, you should use the simple PCIC driver with pc386sysTffs.c. The PCIC driver does not support hot swapping, nor does it check the device type before sending commands to the socket. However, the PCIC code is quite small.


*   

NOTE: It is not necessary to define INCLUDE_PCMCIA in order for TrueFFS to use the PCMCIA sockets. The PCIC driver can provide TrueFFS with an interface to that hardware. Likewise, the PCMCIA package does not require TrueFFS (unless you intend to support TrueFFS-managed flash cards in those sockets).

2.4.1   Configuring the pc386 and pc486 for TrueFFS and the PCMCIA Driver

The changes described in Changing the Makefile, and Changing sysTffs.c, apply to both the pc386 and pc486 BSPs. However, the changes you must make to config.h and syslib.c differ as described below.

Changing config.h

If you want to use the simple PCIC driver, follow the instructions in Changing config.h. To use the PCMCIA driver you will need to modify config.h as described below.

  • Including TrueFFS Support with the PCMCIA Driver
  • The PCMCIA interface driver is a product offering distinct from TrueFFS for Tornado. To include it in VxWorks, you must define INCLUDE_PCMCIA in your config.h file. Because this PCMCIA interface driver must support TrueFFS for Tornado, you must also add INCLUDE_TFFS to the list of devices that PCMCIA includes. Thus, in addition to defining INCLUDE_PCMCIA, your config.h make sure that your config.h also defines the following:

    #ifdef  INCLUDE_PCMCIA 
    #define INCLUDE_TFFS            /* include TFFS driver */ 
    #define INCLUDE_ATA             /* include ATA driver */ 
    #define INCLUDE_SRAM            /* include SRAM driver */ 
    #ifdef  INCLUDE_NETWORK 
    #define INCLUDE_ELT             /* include 3COM EtherLink III driver */ 
    #endif  /* INCLUDE_NETWORK */ 
    #endif  /* INCLUDE_PCMCIA */
  • Avoiding Address Conflicts with the DiskOnChip 2000
  • If you are using the M-System DiskOnChip 2000 product, you might run in to address conflicts with the PCMCIA product. To resolve conflict, redefine the CIS macros as follows:

    #ifdef INCLUDE_TFFS 
    #undef CIS_MEM_START 
    #undef CIS_MEM_STOP 
    #undef CIS_REG_START 
    #undef CIS_REG_STOP 
    #define CIS_MEM_START   0xc8000 /* mapping addr for CIS tuple */ 
    #define CIS_MEM_STOP    0xcbfff 
    #define CIS_REG_START   0xcc000 /* mapping addr for config reg */ 
    #define CIS_REG_STOP    0xccfff 
    #endif /* INCLUDE_TFFS */
    Changing syslib.c

    If your C: drive is a DiskOnChip 2000 device, and, if you boot from it instead of floppy disk, set the sysWarmType global variable to 3. This specifies a warm start from the DiskOnChip 2000 device. To enable rebooting from the TrueFFS flash device, you must change sysLib.c as follows:

  • Define sysWarmTffsDrive
  • After the declaration of the sysWarmAtaDrive variable, add the following:

    int sysWarmTffsDrive = SYS_WARM_TFFS_DRIVE; /* TFFS drive 0 (DOC) */
  • Changes to sysToMonitor( )
  • In the function sysToMonitor( ), find the clause that defines the reboot process for the reboot device ATA. After the #endif statement for INCLUDE_ATA, add the following:

    #ifdef  INCLUDE_TFFS 
        if (sysWarmType == 3) 
            { 
            IMPORT int dosFsDrvNum; 
     
             tffsDrv ();                            /* initialize TFFS */ 
            if (dosFsDrvNum == ERROR) 
                dosFsInit (NUM_DOSFS_FILES);        /* initialize DOS-FS */ 
     
            if (usrTffsConfig (sysWarmTffsDrive, FALSE, "/vxboot/") == ERROR) 
                { 
                printErr ("usrTffsConfig failed.\n"); 
                return (ERROR); 
                } 
            } 
    #endif  /* INCLUDE_TFFS */

    Search for the lines:

    #if (defined (INCLUDE_FD) || defined (INCLUDE_ATA)) 
        if ((sysWarmType == 1) || (sysWarmType == 2))

    Replace them with the following:

    #if (defined(INCLUDE_FD) || defined(INCLUDE_ATA) ||defined(INCLUDE_TFFS)) 
        if ((sysWarmType == 1) || (sysWarmType == 2) || (sysWarmType == 3))

    Search for the line:

    #endif  /* defined (INCLUDE_FD) || defined (INCLUDE_ATA) */

    Replace it with the following:

    #endif  /* (INCLUDE_FD) || (INCLUDE_ATA) || (INCLUDE_TFFS) */

    2.4.2   x86 with DiskOnChip 2000 and Two PCMCIA Slots Using INCLUDE_PCMCIA

    The following instructions show you how to setup and instantiate three TrueFFS devices (a DiskOnChip 2000 and two flash cards in the PCMCIA sockets) for a target using the pc386 or pc486 BSP. All three devices are dedicated entirely to TrueFFS and so each is formatted using tffsDevFormat( ). Notice also that the instructions do not include setting INCLUDE_TFFS or INCLUDE_DOS. That is because defining INCLUDE_PCMCIA implicitly sets those defines for you. 2

    1. Edit config.h as described in Changing config.h.

    1. Edit sysLib.c as described in Changing syslib.c.

    1. Change the Makefile as specified in Changing the Makefile.

    1. Remake VxWorks.

    1. Reboot the target.

    1. Insert a flash card in each PCMCIA socket.

    1. At the target shell prompt, enter the following commands:

    -> tffsDevFormat 0,0 
    -> tffsDevFormat 1,0 
    -> tffsDevFormat 2,0 
    -> usrTffsConfig 0,0,"/DOC/" 
    -> usrTffsConfig 1,1,"/PCMCIA1/" 
    -> usrTffsConfig 2,1,"/PCMCIA2/"

    Adding Boot Code to the DiskOnChip 2000

    The DiskOnChip 2000 uses BIOS extensions to make itself appear to the BIOS as a hard disk. This section outlines the procedures you must follow to make sure that the DiskOnChip 2000 device correctly presents itself to the BIOS as a hard disk. VxWorks can then use the DiskOnChip 2000 as a boot device (just as if it were a floppy driver or a conventional hard disk).

    Preparation

    1. Build your VxWorks boot image (usually bootrom_uncmp).

    1. Boot DOS on your target.

    1. Run dformat on the DiskOnChip 2000 flash device.

    The dformat utility is an M-Systems tool that you should have received with your DiskOnChip 2000 flash device. Running the dformat utility clears the flash medium.

    1. Using the /s switch, run the DOS format utility on the flash device. This guarantees that the flash medium has system tracks on it. The VxWorks boot strap installer assumes that you have done this and proceeds to modify the contents of the boot sector.

    Installing the VxWorks Boot Code

    You may install the VxWorks boot code using either DOS or the commands available from a VxWorks target shell.

    Installing from DOS

    To use this method, you must be able to connect a floppy drive to your target. You must also be able to boot DOS on the target.

    1. Make a bootable floppy disk to which you must then copy the following files:

    • From host\x86-win32\bin:
    mkboot.bat
    vxcopy.exe
    vxsys.exe

    • From target\config\pc386 or target\config\pc486:
    bootrom_uncmp

    • From the your DOS distribution:
    chkdsk.exe

    1. Put the floppy in the drive connected to your target.

    1. Boot the target from the floppy.

    1. Run mkboot from the floppy:

    mkboot flash_disk_drive_letter: bootrom_uncmp 
    For more information on mkboot, see the mkboot reference entry.3

    The 8.3 version of bootrom_uncmp usually lists as bootro~1. It causes no problems for mkboot if you specify bootrom_uncmp as bootro~1.

    1. Remove floppy and reboot the target. The target should now boot VxWorks from the DiskOnChip 2000.

    Installing from VxWorks

    To use this method, you need an Ethernet connection to your target. After installing TrueFFS for Tornado and building VxWorks with TrueFFS included, reboot your target.

    1. Build mkboot.o in the BSP directory.

    1. Open a target shell and enter the following commands:

    -> ld < path_to_target_BSP_directory/mkboot.o  
    -> mkbootTffs 0,0,"path_to_target_BSP_directory/bootro~1"
    The first zero in the mkbootTffs command shown above is the drive number. The second zero indicates that the flash device is not removable (that is, not a PC flash card).

    X-86 Pitfalls--CMOS Setup

    1. Shadowing must be turned off for the memory region in which DiskOnChip 2000 or any other flash device is located.

    1. Caching must be turned off (disabled) in the flash disk region.

    In some BIOSs, you can specifically disable caching in the following regions: A0000 to F0000.

    1. Some BIOSs handle caching in a way that is incompatible with TrueFFS. For these BIOSs, you must disable the external (L2) cache. You can leave the internal cache enabled.

    1. Some PnP BIOSs do not load the DiskOnChip 2000 BIOS extension correctly. There is no way to test for this except to plug a DiskOnChip 2000 into the x86 board. The issue is being addressed with the BIOS venders. There is a special debug version of TFFS BIOS for testing the system. You can get this version from M-Systems.


    1:  Support for "hot swapping" means registering a function to handle the interrupt generated when the user removes a device from the PCMCIA socket.

    2:  The DiskOnChip 2000 is a "disk on chip" device supplied by M-Systems.

    3:  There are two versions of mkboot; one that runs on DOS, and one that runs on VxWorks. The purpose of mkboot is to install the VxWorks boot code on the boot disk. Both versions expect that the system tracks have been installed from DOS's format utility using the /s switch. For more information, see the x86 release notes.