home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / a / armedit / Docs / HPC < prev    next >
Encoding:
Text File  |  1997-02-21  |  19.1 KB  |  735 lines

  1. File        : HPC
  2. Date        : 21-Feb-97
  3. Author      : © A.Thoukydides, 1995, 1996, 1997
  4. Description : High-level Procedure Call (HPC) services implemented by the
  5.               ARMEdit module.
  6.  
  7.  
  8. INTRODUCTION
  9.  
  10. The ARMEdit module provides a number of HPC services. To allow development to
  11. start before HPC is included in the PC front-end software, and to support
  12. earlier releases of the front-end software, a simplified interface via I/O
  13. ports is also supported.
  14.  
  15. All of the services in this document use the HPC service identifier &105
  16. which has been allocated by Aleph One.
  17.  
  18.  
  19. I/O PORT ACCESS
  20.  
  21. The following I/O port assignments are currently used:
  22.  
  23.     &2E0    PORT_STATUS Word read
  24.     &2E0    PORT_CMD    Word write
  25.     &2E2    PORT_DATA   Byte or word read/write
  26.  
  27. The following sequence of operations should occur to perform an HPC call:
  28.  
  29.     Read PORT_STATUS. The possible return codes are:
  30.     
  31.         &454D   System is available and ready.
  32.  
  33.         &4D45   System is currently busy processing another HPC call, and
  34.                 cannot currently be used for another call.
  35.  
  36.         Any other code indicates that the service is not available.
  37.  
  38.     Write &0000 to PORT_CMD to start transfer of data.
  39.  
  40.     Write the HPC packet data to PORT_DATA as either bytes or words.
  41.  
  42.     Write &0001 to PORT_CMD to perform the HPC call.
  43.     
  44.     Write &0002 to PORT_CMD to start reading the reply.
  45.     
  46.     Read the HPC reply packet from PORT_DATA as either bytes or words.
  47.     
  48.     Write &0003 to PORT_CMD to reset the HPC system.
  49.  
  50. The port based HPC packets have the same 16384 byte limit that proper HPC
  51. packets have.
  52.  
  53. Note that only HPC services provided by the ARMEdit module can be called
  54. using this I/O port system; other services can only be called via the normal
  55. HPC system. However, the HPC identifier is still checked.
  56.  
  57.  
  58. HPC CALLS
  59.  
  60. For details of making HPC calls directly (which is potentially much more
  61. efficient) contact Aleph One, as the information is covered by a Non
  62. Disclosure Agreement.
  63.  
  64.  
  65. RETURN CODES
  66.  
  67. All of the HPC calls place a 4 byte return code at the start of the return
  68. block. The generic values are
  69.  
  70.     &0000   The operation was successful.
  71.  
  72.     &0001   The operation failed. The exact meaning of this depends upon the
  73.             reason code, but in general it indicates that the rest of the
  74.             return block is invalid.
  75.     
  76.     &FFFF   Service or reason code is unknown.
  77.  
  78. See the individual reason codes for details of any other codes returned, and
  79. any contents of the remainder of the return block.
  80.  
  81.  
  82. HPC_ARMEDIT_SWI
  83.  
  84.     Calls a specified RISC OS SWI by number. The SWI is always called with
  85.     the X (error returning) bit set.
  86.     
  87.     Data sent:
  88.     
  89.         Offset  Size    Description
  90.         
  91.         0       2       HPC service ID.
  92.         2       2       Reason code = &0000.
  93.         4       4       SWI number.
  94.         8       40      Values for registers R0 to R9 on entry to the SWI.
  95.     
  96.     Data returned:
  97.     
  98.         Offset  Size    Description
  99.         
  100.         0       4       Return code.
  101.         4       256     RISC OS style error block returned by SWI if the
  102.                         return code is &0001.
  103.         260     40      Values of registers R0 to R9 on exit from the SWI if
  104.                         the return code is &0000.
  105.  
  106.  
  107. HPC_ARMEDIT_READ
  108.  
  109.     Read ARM memory.
  110.     
  111.     Data sent:
  112.     
  113.         Offset  Size    Description
  114.         
  115.         0       2       HPC service ID.
  116.         2       2       Reason code = &0001.
  117.         4       4       Start address of memory to read.
  118.         8       4       Number of bytes to read. (n <= 16380)
  119.  
  120.     Data returned:
  121.     
  122.         Offset  Size    Description
  123.         
  124.         0       4       Return code.
  125.         4       n       The contents of the specified memory.
  126.  
  127.  
  128. HPC_ARMEDIT_WRITE
  129.  
  130.     Write ARM memory.
  131.     
  132.     Data sent:
  133.     
  134.         Offset  Size    Description
  135.         
  136.         0       2       HPC service ID.
  137.         2       2       Reason code = &0002.
  138.         4       4       Start address of memory to read.
  139.         8       4       Number of bytes to write. (n <= 16372)
  140.         12      n       The data to write.
  141.  
  142.     Data returned:
  143.     
  144.         Offset  Size    Description
  145.         
  146.         0       4       Return code.
  147.  
  148.  
  149. HPC_ARMEDIT_ALLOC
  150.  
  151.     Claim a block of ARM memory. This is automatically released when the PC
  152.     is shutdown or reset, but it is better to free it when no longer required
  153.     using HPC_ARMEDIT_FREE.
  154.         
  155.     Data sent:
  156.     
  157.         Offset  Size    Description
  158.         
  159.         0       2       HPC service ID.
  160.         2       2       Reason code = &0003.
  161.         4       4       Amount of memory to claim.
  162.  
  163.     Data returned:
  164.     
  165.         Offset  Size    Description
  166.         
  167.         0       4       Return code.
  168.         4       4       Address of the block of memory allocated.
  169.  
  170.  
  171. HPC_ARMEDIT_FREE
  172.  
  173.     Release a block of ARM memory previously claimed using HPC_ARMEDIT_ALLOC.
  174.         
  175.     Data sent:
  176.     
  177.         Offset  Size    Description
  178.         
  179.         0       2       HPC service ID.
  180.         2       2       Reason code = &0004.
  181.         4       4       The address of the block of memory.
  182.  
  183.     Data returned:
  184.     
  185.         Offset  Size    Description
  186.         
  187.         0       4       Return code.
  188.  
  189.  
  190. HPC_ARMEDIT_EXTTYPE
  191.  
  192.     Convert a DOS extension into a RISC OS filetype.
  193.         
  194.     Data sent:
  195.     
  196.         Offset  Size    Description
  197.         
  198.         0       2       HPC service ID.
  199.         2       2       Reason code = &0005.
  200.         4       4       The extension in upper case padded with 0 bytes to
  201.                         four characters.
  202.  
  203.     Data returned:
  204.     
  205.         Offset  Size    Description
  206.         
  207.         0       4       Return code.
  208.         4       4       The RISC OS filetype.
  209.  
  210.  
  211. HPC_ARMEDIT_TYPEEXT
  212.  
  213.     Convert a RISC OS filetype into a DOS extension.
  214.         
  215.     Data sent:
  216.     
  217.         Offset  Size    Description
  218.         
  219.         0       2       HPC service ID.
  220.         2       2       Reason code = &0006.
  221.         4       4       The RISC OS filetype.
  222.  
  223.     Data returned:
  224.     
  225.         Offset  Size    Description
  226.         
  227.         0       4       Return code.
  228.         4       4       The extension in upper case padded with 0 bytes to
  229.                         four characters.
  230.  
  231.  
  232. HPC_ARMEDIT_FOPEN
  233.  
  234.     Open a RISC OS file. This is automatically closed when the PC is shutdown
  235.     or reset, but it is better to close it when no longer required using
  236.     HPC_ARMEDIT_CLOSE. A file opened using this call should not be closed
  237.     using RISC OS routines directly.
  238.         
  239.     Data sent:
  240.     
  241.         Offset  Size    Description
  242.         
  243.         0       2       HPC service ID.
  244.         2       2       Reason code = &0007.
  245.         4       4       -1 to open existing file, or initial size of file to
  246.                         create a new one.
  247.         8       4       Non-zero to automatically delete the file when closed.
  248.         12      n       Name of file to open.
  249.  
  250.     Data returned:
  251.     
  252.         Offset  Size    Description
  253.         
  254.         0       4       Return code.
  255.         4       4       RISC OS file handle.
  256.  
  257.  
  258. HPC_ARMEDIT_FCLOSE
  259.  
  260.     Close a RISC OS file previously opened using HPC_ARMEDIT_OPEN. The file
  261.     is deleted if specified when the file was opened.
  262.         
  263.     Data sent:
  264.     
  265.         Offset  Size    Description
  266.         
  267.         0       2       HPC service ID.
  268.         2       2       Reason code = &0008.
  269.         4       4       RISC OS file handle.
  270.  
  271.     Data returned:
  272.     
  273.         Offset  Size    Description
  274.         
  275.         0       4       Return code.
  276.  
  277.  
  278. HPC_ARMEDIT_FREAD
  279.  
  280.     Read from a RISC OS file.
  281.         
  282.     Data sent:
  283.     
  284.         Offset  Size    Description
  285.         
  286.         0       2       HPC service ID.
  287.         2       2       Reason code = &0009.
  288.         4       4       RISC OS file handle.
  289.         8       4       Sequential file pointer for start of block, or -1 for
  290.                         current position.
  291.         12      4       Number of bytes to read.
  292.  
  293.     Data returned:
  294.     
  295.         Offset  Size    Description
  296.         
  297.         0       4       Return code.
  298.         4       4       Number of bytes read.
  299.         8       n       The data read from the file.
  300.  
  301.  
  302. HPC_ARMEDIT_FWRITE
  303.  
  304.     Write to a RISC OS file.
  305.         
  306.     Data sent:
  307.     
  308.         Offset  Size    Description
  309.         
  310.         0       2       HPC service ID.
  311.         2       2       Reason code = &000A.
  312.         4       4       RISC OS file handle.
  313.         8       4       Sequential file pointer for start of block, or -1 for
  314.                         current position.
  315.         12      4       Number of bytes to write.
  316.         16      n       The data to write to the file.
  317.  
  318.     Data returned:
  319.     
  320.         Offset  Size    Description
  321.         
  322.         0       4       Return code.
  323.  
  324.  
  325. HPC_ARMEDIT_TALK_START
  326.  
  327.     Register a new client task. Note that a client ID of 0 is assumed.
  328.     It does not make sense being able to request notification of reset or
  329.     shutdown.
  330.     
  331.     Data sent:
  332.     
  333.         Offset  Size    Description
  334.         
  335.         0       2       HPC service ID.
  336.         2       2       Reason code = &000B.
  337.  
  338.     Data returned:
  339.     
  340.         Offset  Size    Description
  341.         
  342.         0       4       Return code.
  343.         4       4       A unique client handle.
  344.  
  345.  
  346. HPC_ARMEDIT_TALK_END
  347.  
  348.     Deregister a client task.
  349.     
  350.     Data sent:
  351.     
  352.         Offset  Size    Description
  353.         
  354.         0       2       HPC service ID.
  355.         2       2       Reason code = &000C.
  356.         4       4       The previously assigned handle for this client task.
  357.     
  358.     Data returned:
  359.     
  360.         Offset  Size    Description
  361.         
  362.         0       4       Return code.
  363.         
  364.  
  365. HPC_ARMEDIT_TALK_TX
  366.  
  367.     Send a message to another client task.
  368.     
  369.     Data sent:
  370.     
  371.         Offset  Size    Description
  372.         
  373.         0       2       HPC service ID.
  374.         2       2       Reason code = &000D.
  375.         4       4       Client handle for this task.
  376.         8       4       Either the ID or client handle for the recipient.
  377.         12      1024    The message to send.
  378.     
  379.     Data returned:
  380.     
  381.         Offset  Size    Description
  382.         
  383.         0       4       Return code.
  384.  
  385.         
  386. HPC_ARMEDIT_TALK_RX
  387.  
  388.     Check for any waiting messages for this client task. The return code is
  389.     failure if there is no message waiting. There is no acknowledge call
  390.     since all messages to PC software should be addressed to a particular
  391.     handle.
  392.     
  393.     Data sent:
  394.     
  395.         Offset  Size    Description
  396.         
  397.         0       2       HPC service ID.
  398.         2       2       Reason code = &000E.
  399.         4       4       Client handle for this task.
  400.     
  401.     Data returned:
  402.     
  403.         Offset  Size    Description
  404.         
  405.         0       4       Return code.
  406.         4       4       Source ID.
  407.         8       4       Source client handle.
  408.         12      1024    The waiting message.
  409.  
  410.  
  411. HPC_ARMEDIT_DEVICE_INITIALISE
  412.  
  413.     Called during initialisation of device driver to obtain a start-up
  414.     banner message and choose the number of devices.
  415.     
  416.     Data sent:
  417.     
  418.         Offset  Size    Description
  419.         
  420.         0       2       HPC service ID.
  421.         2       2       Reason code = &000F.
  422.         4       1       Drive number for first unit of this driver.
  423.         5       256     Text after equals sign on CONFIG.SYS line that loaded
  424.                         this driver.
  425.  
  426.     Data returned:
  427.     
  428.         Offset  Size    Description
  429.         
  430.         0       4       Return code.
  431.         4       4       Number of devices supported.
  432.         8       256     Text of message terminated by a "$" character.
  433.  
  434.  
  435. HPC_ARMEDIT_DEVICE_BPB
  436.  
  437.     Construct a BIOS Parameter Block (BPB) for a device driver. This also
  438.     informs ARMEdit that the disc contents could be changed.
  439.     
  440.     Data sent:
  441.     
  442.         Offset  Size    Description
  443.         
  444.         0       2       HPC service ID.
  445.         2       2       Reason code = &0010.
  446.         4       1       Unit code (drive number), or -1 for initialisation.
  447.     
  448.     Data returned:
  449.     
  450.         Offset  Size    Description
  451.         
  452.         0       4       Return code.
  453.         4       13      The BIOS parameter block.
  454.  
  455.  
  456. HPC_ARMEDIT_DEVICE_CHANGED
  457.  
  458.     Perform a media check for a device driver.
  459.     
  460.     Data sent:
  461.     
  462.         Offset  Size    Description
  463.         
  464.         0       2       HPC service ID.
  465.         2       2       Reason code = &0011.
  466.         4       1       Unit code (drive number).
  467.     
  468.     Data returned:
  469.     
  470.         Offset  Size    Description
  471.         
  472.         0       4       Return code.
  473.         4       4       The media change code:
  474.                             -1  Disc has been changed.
  475.                             0   Don't know if disc has been changed.
  476.                             1   Disc has not been changed.
  477.  
  478.  
  479. HPC_ARMEDIT_DEVICE_READ
  480.     
  481.     Read an emulated disc sector for a device driver.
  482.     
  483.     Data sent:
  484.     
  485.         Offset  Size    Description
  486.         
  487.         0       2       HPC service ID.
  488.         2       2       Reason code = &0012.
  489.         4       1       Unit code (drive number).
  490.         5       2       Sector number.
  491.     
  492.     Data returned:
  493.     
  494.         Offset  Size    Description
  495.         
  496.         0       4       Return code.
  497.         4       n       The data read from the sector.
  498.  
  499.  
  500. HPC_ARMEDIT_DEVICE_WRITE
  501.     
  502.     Write an emulated disc sector for a device driver.
  503.     
  504.     Data sent:
  505.     
  506.         Offset  Size    Description
  507.         
  508.         0       2       HPC service ID.
  509.         2       2       Reason code = &0013.
  510.         4       1       Unit code (drive number).
  511.         5       2       Sector number.
  512.         7       1       Dummy data to pad to word boundary.
  513.         8       n       The data to write to the sector.
  514.     
  515.     Data returned:
  516.     
  517.         Offset  Size    Description
  518.  
  519.         0       4       Return code.
  520.  
  521.  
  522. HPC_ARMEDIT_DATE_TO_DOS
  523.  
  524.     Convert a time and date from the standard RISC OS 5 bytes format to the
  525.     4 byte DOS equivalent.
  526.     
  527.     Data sent:
  528.     
  529.         Offset  Size    Description
  530.         
  531.         0       2       HPC service ID.
  532.         2       2       Reason code = &0014.
  533.         4       5       Centiseconds since 00:00:00 on January 1 1900.
  534.     
  535.     Data returned:
  536.     
  537.         Offset  Size    Description
  538.         
  539.         0       4       Return code.
  540.         4       4       2 byte time (hhhhhmmmmmmsssss).
  541.         8       4       2 byte date (yyyyyyymmmmddddd).
  542.     
  543.  
  544. HPC_ARMEDIT_DATE_TO_RISCOS
  545.  
  546.     Convert a time and date from the standard DOS 4 byte format to the 5 byte
  547.     RISC OS equivalent.
  548.     
  549.     Data sent:
  550.     
  551.         Offset  Size    Description
  552.         
  553.         0       2       HPC service ID.
  554.         2       2       Reason code = &0015.
  555.         4       2       2 byte time (hhhhhmmmmmmsssss).
  556.         6       2       2 byte date (yyyyyyymmmmddddd).
  557.     
  558.     Data returned:
  559.     
  560.         Offset  Size    Description
  561.         
  562.         0       4       Return code.
  563.         4       5       Centiseconds since 00:00:00 on January 1 1900.
  564.  
  565.  
  566. HPC_ARMEDIT_OSCLI_START
  567.  
  568.     Start executing a specified *command. The input and output from the
  569.     command are redirected.
  570.     
  571.     Data sent:
  572.     
  573.         Offset  Size    Description
  574.         
  575.         0       2       HPC service ID.
  576.         2       2       Reason code = &0016.
  577.         4       256     The command to execute.
  578.  
  579.     Data returned:
  580.     
  581.         Offset  Size    Description
  582.         
  583.         0       4       Return code.
  584.         4       4       Handle for this command.
  585.  
  586.  
  587. HPC_ARMEDIT_OSCLI_POLL
  588.  
  589.     Continue execution of a *command. This should only include input data if
  590.     requested by the previous HPC_ARMEDIT_OSCLI_POLL reply, otherwise
  591.     characters may get lost.
  592.     
  593.     Data sent:
  594.     
  595.         Offset  Size    Description
  596.         
  597.         0       2       HPC service ID.
  598.         2       2       Reason code = &0017.
  599.         4       4       Command handle.
  600.         8       4       Number of bytes to input.
  601.         12      256     Up to 256 bytes of input.
  602.  
  603.     Data returned:
  604.     
  605.         Offset  Size    Description
  606.         
  607.         0       4       Return code.
  608.         4       4       Status:
  609.                             0   Active.
  610.                             1   Command has finished.
  611.                             2   Waiting for input.
  612.         8       4       Number of bytes to output.
  613.         12      256     Up to 256 bytes of output.
  614.  
  615.  
  616. HPC_ARMEDIT_OSCLI_END
  617.  
  618.     Terminate execution of a *command.
  619.     
  620.     Data sent:
  621.     
  622.         Offset  Size    Description
  623.         
  624.         0       2       HPC service ID.
  625.         2       2       Reason code = &0018.
  626.         4       4       Command handle.
  627.  
  628.     Data returned:
  629.     
  630.         Offset  Size    Description
  631.         
  632.         0       4       Return code.
  633.         4       256     RISC OS style error block returned by SWI if the
  634.                         return code is &0001.
  635.         
  636.  
  637. HPC_ARMEDIT_TALK_REPLY
  638.  
  639.     Reply to a message from another client task. This is like
  640.     HPC_ARMEDIT_TALK_TX, except that the message is stored in the destination
  641.     task's buffer.
  642.     
  643.     Data sent:
  644.     
  645.         Offset  Size    Description
  646.         
  647.         0       2       HPC service ID.
  648.         2       2       Reason code = &0019.
  649.         4       4       Client handle for this task.
  650.         8       4       The client handle for the recipient.
  651.         12      1024    The message to send.
  652.     
  653.     Data returned:
  654.     
  655.         Offset  Size    Description
  656.         
  657.         0       4       Return code.
  658.  
  659.  
  660. HPC_ARMEDIT_FASTER
  661.  
  662.     Prevent multitasking to speed up operations. This should be called to
  663.     reenable normal operation after the operation is completed. A sensible
  664.     way to use this is with a value of 100 (for 1 second), called on a
  665.     regular basis during the operation.
  666.     
  667.     Data sent:
  668.     
  669.         Offset  Size    Description
  670.         
  671.         0       2       HPC service ID.
  672.         2       2       Reason code = &001A.
  673.         4       4       Centiseconds to disable multitasking for, or 0 to
  674.                         restore normal operation.
  675.         
  676.     Data returned:
  677.     
  678.         Offset  Size    Description
  679.         
  680.         0       4       Return code.
  681.  
  682.  
  683. HPC_ARMEDIT_TEMPORARY
  684.  
  685.     Produce a unique filename for a temporary RISC OS file.
  686.     
  687.     Data sent:
  688.     
  689.         Offset  Size    Description
  690.         
  691.         0       2       HPC service ID.
  692.         2       2       Reason code = &001B.
  693.         
  694.     Data returned:
  695.     
  696.         Offset  Size    Description
  697.         
  698.         0       4       Return code.
  699.         4       256     Suggested canonicalised filename.
  700.  
  701.  
  702. THINGS TO DO
  703.  
  704. The following are changes that may be made to the HPC services sometime in
  705. the future.
  706.  
  707.     None at the moment!
  708.  
  709.  
  710. VERSION HISTORY
  711.  
  712. 0.00 (12-Nov-95)    Original development version.
  713.  
  714. 0.01 (14-Nov-95)    No changes to HPC.
  715.  
  716. 0.02 (15-Nov-95)    No changes to HPC.
  717.  
  718. 0.03 (17-Nov-95)    Uses correct HPC service identifier.
  719.  
  720. 0.04 (21-Nov-95)    Slightly more experimental device driver support.
  721.                     Real HPC system implemented.
  722.  
  723. 0.07 (28-Dec-95)    Added message passing protocol.
  724.  
  725. 1.00 (15-Dec-95)    First official release version.
  726.  
  727. 1.01 (11-Mar-96)    Version number updated to match the module.
  728.  
  729. 1.02 (27-May-96)    Implemented device driver calls.
  730.                     Added commands to convert between date and time formats.
  731.                     Included SWI for use by Acorn's software PC emulator.
  732.  
  733. 1.03 (21-Feb-97)    Added ability to reply to messages.
  734.                     Included ability to speed up operations when multitasking.
  735.                     Temporary RISC OS filenames can now be generated.