www.beck-ipc.com

@CHIP-RTOS - External Disk Driver API


    IPC@CHIP® Documentation Index

External Disk Driver API

The @CHIP-RTOS-x86 file system accesses the external disk drives by invoking a software interrupt.   Interrupt 0xB1 applies to B: drive and interrupt 0xB2 applies to external D: drive.   The parameters are passed in the CPU registers specified below.   Refer to the Beck example drivers for details on how this communication through CPU registers can be easily managed.

Required Services

The drivers for the external disk drives must support the following sector read/write commands for use by the @CHIP-RTOS-x86 file system.

Sector Read (AX = 0)

    Input Parameters:

      AX    =0, Sector read command code.

      BX:DX    Sector number (BX is MSH of unsigned long, DX is LSH)

      CX    Number of sectors to read

      ES:DI    Segment:Offset far pointer to the buffer to be filled by driver with data read out of the disk.


    Return Values:

      AX    =0 for success or -1 for failure

Sector Write (AX = 1)

    Input Parameters:

      AX    =1, Sector write command code.

      BX:DX    Sector number, where BX is MSH of unsigned long, DX is LSH.

      CX    Number of sectors to write.

      ES:DI    Segment:Offset far pointer to the buffer containing the data to be written to the disk.


    Return Values:

      AX    =0 for success or -1 for failure.

Extended Services for SD Cards

When formatting an SD card on an external drive, the @CHIP-RTOS-x86 needs to know the absolute sector number of the drive partition's sector 0.   Otherwise the cards performance can suffer when the drive's clusters end up misaligned with the SD card's flash memory pages.   (This cluster alignment can be checked using the CHKDSK command, provided that a driver is available that provides this API extension.)   This optional API returns the required information from the device driver to the @CHIP-RTOS-x86 .

Read Out Drive's Partition Offset (AX = 2)

    Input Parameters:

      AX    =2, Read out partition offset command code.

      CX    =0, Used to detect if this optional service is present.


    Return Values:

      DX:AX    32 bit logical block number of first sector in this drive's partition.   DX holds the MSH and AX carries the LSH of the 32 bits.

      CX    Set to 0x5555 for a signature which tells the @CHIP-RTOS-x86 that this service was available for this drive.  


Reserved Service Numbers (AX = 3 through 0x40)

If for any reason ther user want to supplement the services offered by disk drivers, it is recommended to avoid using AX service selectors 3 through 0x40.   These are reserved for future use by the @CHIP-RTOS-x86 driver API.

Services for FDISK program (AX = 0x80, ...)

Some additional services are commonly provided by by the example Beck disk drivers for use by the FDISK tool.   The @CHIP-RTOS-x86 does not use these services.   Please refer to the source code for these example programs for the specifics concerning these additional driver API.




End of document