www.beck-ipc.com

@CHIP-RTOS - External Disk Interface


    IPC@CHIP® Documentation Index

External Disk Drive

Here is the low-level software-interrupt-based API for an external disk B: and D: drive.   This interface allows you to add an external B: or D: drive.   This drive must be block (sector) oriented.   Each sector should be 512 bytes long.   The application must provide a software interrupt 0xB1 function for drive B: or 0xB2 for drive D: to read and write these sectors on this drive.

On SC1x systems, the maximum disk size is about 2 Gigabytes.   (This limitation is due to the FAT16 disk format used on SC1x systems.)   SC1x systems support only drive B:

The SC1x3/SC2x systems support FAT32 format. The maximum disk size on SC1x3/SC2x systems is about 8 Terabytes.   The maximum file size is 2**32 bytes minus one cluster (=32 kbyte), which is about 4 Gigabyte.   SC1x3/SC2x systems support drive B: and drive D:.  

Interrupt 0xB0 Services

Service is selected by index in AH register.
  • 0x01:_Install External Disk B:
  • 0x02:_Deinstall External Disk B:
  • 0x03:_Install a notification callback function
  • 0x04:_Uninstall the notification callback function
  • 0x05:_Install External Disk D:
  • 0x06:_Deinstall External Disk D:


  • Interrupt 0xB0 service 0x01:     Install External Disk B:

    This function will logically install a B: drive.
    Prior to this call the application must provide a disk read/write function installed at interrupt 0xB1.   This installed handler function should expect:

      AX       1 for write, 0 for read.
      BX,DX    Sector number (BX is MSH of unsigned long)
      CX       Number of sectors to read/write
      ES:DI    Segment:Offset of memory area to read/write

    The handler should return 0 in AX if OK.

    Parameters

    AH
    0x01

    BX,DX
    An unsigned long with the total number of sectors.   BX holds high word.

    Return Value

    AX is 0 if OK.

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.00V1.00V1.00V0.90V1.00

    Top of list
    Index page
    Interrupt 0xB0 service 0x02:     Deinstall External Disk B:

    Used to deinstall drive B: which was installed before with function 0x01 (above).

    Parameters

    AH
    0x02

    Return Value

    AX =0 success
    AX !=0 failed (may be drive was not installed?)

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.00V1.00V1.00V0.90V1.00

    Top of list
    Index page
    Interrupt 0xB0 service 0x03:     Install a notification callback function

    The external drives B: and D: may be hot-plugable. This means that the drive medium might be removed or inserted while your application is running. In some cases it may be important for you to be notified if a medium is removed or inserted, for example if one of your tasks has set its working directory to the external drive. By default @CHIP-RTOS will reset the working directory of all tasks that previously had their working directory on a drive that has been removed to A:\. However this might not be appropriate. So a reaction on the removal of a hot-pluggable medium might be to set a new valid working directory.
    To be notified of insertion and removal events, install an EXTDISK callback function.

    A maximum of 12 EXTDISK callback functions can be installed.

    The following events may be passed along with the callback function's event parameter:
    EXTDISK_EVENT_INSTALL_B = 0x01
      Drive B: has been installed

    EXTDISK_EVENT_REMOVE_B = 0x02
      Drive B: has been uninstalled

    EXTDISK_EVENT_INSTALL_D = 0x03
      Drive D: has been installed

    EXTDISK_EVENT_REMOVE_D = 0x04
      Drive D: has been uninstalled

    Parameters

    AH
    0x03

    ES:DI
    Pointer to the callback function of the type EXTDISK_CALLBACK

    EXTDISK_CALLBACK is defined as follows:
      typedef void (far * EXTDISK_CALLBACK)(unsigned int event);

    Return Value

    AX =0 success
    AX !=0 failed

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.20V1.20V1.20V1.07V1.00

    Top of list
    Index page
    Interrupt 0xB0 service 0x04:     Uninstall the notification callback function

    Uninstall the notification callback function

    Parameters

    AH
    0x04

    ES:DI
    Pointer to the callback function of the type EXTDISK_CALLBACK (see Install a notification callback function for details)

    Return Value

    AX =0 success
    AX !=0 failed

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      V1.20V1.20V1.20V1.05V1.00

    Top of list
    Index page
    Interrupt 0xB0 service 0x05:     Install External Disk D:

    This function will logically install a D: drive.
    Prior to this call the application must provide a disk read/write function installed at interrupt 0xB2.   This installed handler function should expect:

      AX       1 for write, 0 for read.
      BX,DX    Sector number (BX is MSH of unsigned long)
      CX       Number of sectors to read/write
      ES:DI    Segment:Offset of memory area to read/write

    The handler should return 0 in AX if OK.

    Parameters

    AH
    0x05

    BX,DX
    An unsigned long with the total number of sectors.   BX holds high word.

    Return Value

    AX is 0 if OK.

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      n/an/an/aV1.07V1.00

    Top of list
    Index page
    Interrupt 0xB0 service 0x06:     Deinstall External Disk D:

    Used to deinstall drive D: which was installed before with function 0x05 (above).

    Parameters

    AH
    0x06

    Return Value

    AX =0 success
    AX !=0 failed (may be drive was not installed?)

    Supported since or modified in @CHIP-RTOS version

      SC12SC13SC11SC1x3SC2x
      n/an/an/aV1.07V1.00

    Top of list
    Index page


    End of document