home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / code / oslib / h / adfs next >
Encoding:
Text File  |  1994-09-07  |  27.1 KB  |  867 lines

  1. #ifndef adfs_H
  2. #define adfs_H
  3.  
  4. /* C header file for ADFS
  5.  * written by DefMod (Sep  7 1994) on Wed Sep  7 21:25:59 1994
  6.  * Copyright © Acorn Computers Ltd, 1994
  7.  */
  8.  
  9. /*************************************************************************
  10.  * This source file was written by Acorn Computers Limited. It is part   *
  11.  * of the OSLib library for writing applications for RISC OS. It may be  *
  12.  * used freely in the creation of programs for RISC OS.                  *
  13.  *************************************************************************/
  14.  
  15. #ifndef types_H
  16.    #include "types.h"
  17. #endif
  18.  
  19. #ifndef os_H
  20.    #include "os.h"
  21. #endif
  22.  
  23. #ifndef filecore_H
  24.    #include "filecore.h"
  25. #endif
  26.  
  27. /**********************************
  28.  * SWI names and SWI reason codes *
  29.  **********************************/
  30. #undef  ADFS_DiscOp
  31. #define ADFS_DiscOp                             0x40240
  32. #undef  XADFS_DiscOp
  33. #define XADFS_DiscOp                            0x60240
  34. #undef  ADFSDiscOp_Verify
  35. #define ADFSDiscOp_Verify                       0x0
  36. #undef  ADFSDiscOp_ReadSectors
  37. #define ADFSDiscOp_ReadSectors                  0x1
  38. #undef  ADFSDiscOp_WriteSectors
  39. #define ADFSDiscOp_WriteSectors                 0x2
  40. #undef  ADFSDiscOp_ReadTrack
  41. #define ADFSDiscOp_ReadTrack                    0x3
  42. #undef  ADFSDiscOp_ReadId
  43. #define ADFSDiscOp_ReadId                       0x3
  44. #undef  ADFSDiscOp_WriteTrack
  45. #define ADFSDiscOp_WriteTrack                   0x4
  46. #undef  ADFSDiscOp_FormatTrack
  47. #define ADFSDiscOp_FormatTrack                  0x4
  48. #undef  ADFSDiscOp_Seek
  49. #define ADFSDiscOp_Seek                         0x5
  50. #undef  ADFSDiscOp_Restore
  51. #define ADFSDiscOp_Restore                      0x6
  52. #undef  ADFSDiscOp_StepIn
  53. #define ADFSDiscOp_StepIn                       0x7
  54. #undef  ADFSDiscOp_StepOut
  55. #define ADFSDiscOp_StepOut                      0x8
  56. #undef  ADFSDiscOp_ReadSectorsViaCache
  57. #define ADFSDiscOp_ReadSectorsViaCache          0x9
  58. #undef  ADFSDiscOp_Specify
  59. #define ADFSDiscOp_Specify                      0xF
  60. #undef  ADFS_HDC
  61. #define ADFS_HDC                                0x40241
  62. #undef  XADFS_HDC
  63. #define XADFS_HDC                               0x60241
  64. #undef  ADFS_Drives
  65. #define ADFS_Drives                             0x40242
  66. #undef  XADFS_Drives
  67. #define XADFS_Drives                            0x60242
  68. #undef  ADFS_FreeSpace
  69. #define ADFS_FreeSpace                          0x40243
  70. #undef  XADFS_FreeSpace
  71. #define XADFS_FreeSpace                         0x60243
  72. #undef  ADFS_Retries
  73. #define ADFS_Retries                            0x40244
  74. #undef  XADFS_Retries
  75. #define XADFS_Retries                           0x60244
  76. #undef  ADFS_DescribeDisc
  77. #define ADFS_DescribeDisc                       0x40245
  78. #undef  XADFS_DescribeDisc
  79. #define XADFS_DescribeDisc                      0x60245
  80. #undef  ADFS_VetFormat
  81. #define ADFS_VetFormat                          0x40246
  82. #undef  XADFS_VetFormat
  83. #define XADFS_VetFormat                         0x60246
  84. #undef  ADFS_FlpProcessDCB
  85. #define ADFS_FlpProcessDCB                      0x40247
  86. #undef  XADFS_FlpProcessDCB
  87. #define XADFS_FlpProcessDCB                     0x60247
  88. #undef  ADFS_ControllerType
  89. #define ADFS_ControllerType                     0x40248
  90. #undef  XADFS_ControllerType
  91. #define XADFS_ControllerType                    0x60248
  92. #undef  ADFS_PowerControl
  93. #define ADFS_PowerControl                       0x40249
  94. #undef  XADFS_PowerControl
  95. #define XADFS_PowerControl                      0x60249
  96. #undef  ADFSPowerControl_ReadSpin
  97. #define ADFSPowerControl_ReadSpin               0x0
  98. #undef  ADFSPowerControl_SetAutospindown
  99. #define ADFSPowerControl_SetAutospindown        0x1
  100. #undef  ADFSPowerControl_SetSpin
  101. #define ADFSPowerControl_SetSpin                0x2
  102. #undef  ADFS_SetIDEController
  103. #define ADFS_SetIDEController                   0x4024A
  104. #undef  XADFS_SetIDEController
  105. #define XADFS_SetIDEController                  0x6024A
  106. #undef  ADFS_IDEUserOp
  107. #define ADFS_IDEUserOp                          0x4024B
  108. #undef  XADFS_IDEUserOp
  109. #define XADFS_IDEUserOp                         0x6024B
  110. #undef  ADFS_MiscOp
  111. #define ADFS_MiscOp                             0x4024C
  112. #undef  XADFS_MiscOp
  113. #define XADFS_MiscOp                            0x6024C
  114. #undef  ADFSMiscOp_Mount
  115. #define ADFSMiscOp_Mount                        0x0
  116. #undef  ADFSMiscOp_PollChanged
  117. #define ADFSMiscOp_PollChanged                  0x1
  118. #undef  ADFSMiscOp_LockDrive
  119. #define ADFSMiscOp_LockDrive                    0x2
  120. #undef  ADFSMiscOp_UnlockDrive
  121. #define ADFSMiscOp_UnlockDrive                  0x3
  122. #undef  ADFSMiscOp_PollPeriod
  123. #define ADFSMiscOp_PollPeriod                   0x4
  124. #undef  ADFSMiscOp_EjectDisc
  125. #define ADFSMiscOp_EjectDisc                    0x5
  126. #undef  ADFS_ECCSAndRetries
  127. #define ADFS_ECCSAndRetries                     0x40250
  128. #undef  XADFS_ECCSAndRetries
  129. #define XADFS_ECCSAndRetries                    0x60250
  130. #undef  Service_IdentifyFormat
  131. #define Service_IdentifyFormat                  0x6B
  132. #undef  Service_DisplayFormatHelp
  133. #define Service_DisplayFormatHelp               0x6C
  134.  
  135. /************************
  136.  * Constant definitions *
  137.  ************************/
  138. #define adfs_CONTROLLER_DISC_NOT_PRESENT        0
  139. #define adfs_CONTROLLER1772                     1
  140. #define adfs_CONTROLLER71X                      2
  141. #define adfs_CONTROLLER_ST506                   3
  142. #define adfs_CONTROLLER_IDE                     4
  143.  
  144. /*************************
  145.  * Function declarations *
  146.  *************************/
  147.  
  148. #ifdef __cplusplus
  149.    extern "C" {
  150. #endif
  151.  
  152. /*************************************************************
  153.  * NOTE: The following functions provide direct access to    *
  154.  *       the SWI's noted in the function description.        *
  155.  *       Please read the relevant PRM section for more       *
  156.  *       information on their input/output parameters.       *
  157.  *************************************************************/
  158.  
  159. /* ------------------------------------------------------------------------
  160.  * Function:      adfsdiscop_verify()
  161.  *
  162.  * Description:   Verifies a disc
  163.  *
  164.  * Input:         flags - value of R1 on entry
  165.  *                disc_addr - value of R2 on entry
  166.  *                size - value of R4 on entry
  167.  *
  168.  * Output:        next_disc_addr - value of R2 on exit
  169.  *                unverified - value of R4 on exit (X version only)
  170.  *
  171.  * Returns:       R4 (non-X version only)
  172.  *
  173.  * Other notes:   Calls SWI 0x40240 with R1 |= 0x0.
  174.  */
  175.  
  176. extern os_error *xadfsdiscop_verify (bits flags,
  177.       filecore_disc_address disc_addr,
  178.       int size,
  179.       filecore_disc_address *next_disc_addr,
  180.       int *unverified);
  181. extern int adfsdiscop_verify (bits flags,
  182.       filecore_disc_address disc_addr,
  183.       int size,
  184.       filecore_disc_address *next_disc_addr);
  185.  
  186. /* ------------------------------------------------------------------------
  187.  * Function:      adfsdiscop_read_sectors()
  188.  *
  189.  * Description:   Reads sectors from a disc
  190.  *
  191.  * Input:         flags - value of R1 on entry
  192.  *                disc_addr - value of R2 on entry
  193.  *                data - value of R3 on entry
  194.  *                size - value of R4 on entry
  195.  *
  196.  * Output:        next_disc_addr - value of R2 on exit
  197.  *                next_data - value of R3 on exit
  198.  *                unread - value of R4 on exit (X version only)
  199.  *
  200.  * Returns:       R4 (non-X version only)
  201.  *
  202.  * Other notes:   Calls SWI 0x40240 with R1 |= 0x1.
  203.  */
  204.  
  205. extern os_error *xadfsdiscop_read_sectors (bits flags,
  206.       filecore_disc_address disc_addr,
  207.       byte *data,
  208.       int size,
  209.       filecore_disc_address *next_disc_addr,
  210.       byte **next_data,
  211.       int *unread);
  212. extern int adfsdiscop_read_sectors (bits flags,
  213.       filecore_disc_address disc_addr,
  214.       byte *data,
  215.       int size,
  216.       filecore_disc_address *next_disc_addr,
  217.       byte **next_data);
  218.  
  219. /* ------------------------------------------------------------------------
  220.  * Function:      adfsdiscop_write_sectors()
  221.  *
  222.  * Description:   Writes sectors to a disc
  223.  *
  224.  * Input:         flags - value of R1 on entry
  225.  *                disc_addr - value of R2 on entry
  226.  *                data - value of R3 on entry
  227.  *                size - value of R4 on entry
  228.  *
  229.  * Output:        next_disc_addr - value of R2 on exit
  230.  *                next_data - value of R3 on exit
  231.  *                unwritten - value of R4 on exit (X version only)
  232.  *
  233.  * Returns:       R4 (non-X version only)
  234.  *
  235.  * Other notes:   Calls SWI 0x40240 with R1 |= 0x2.
  236.  */
  237.  
  238. extern os_error *xadfsdiscop_write_sectors (bits flags,
  239.       filecore_disc_address disc_addr,
  240.       byte *data,
  241.       int size,
  242.       filecore_disc_address *next_disc_addr,
  243.       byte **next_data,
  244.       int *unwritten);
  245. extern int adfsdiscop_write_sectors (bits flags,
  246.       filecore_disc_address disc_addr,
  247.       byte *data,
  248.       int size,
  249.       filecore_disc_address *next_disc_addr,
  250.       byte **next_data);
  251.  
  252. /* ------------------------------------------------------------------------
  253.  * Function:      adfsdiscop_read_track()
  254.  *
  255.  * Description:   Reads a track from a floppy disc
  256.  *
  257.  * Input:         flags - value of R1 on entry
  258.  *                disc_addr - value of R2 on entry
  259.  *                data - value of R3 on entry
  260.  *
  261.  * Other notes:   Calls SWI 0x40240 with R1 |= 0x3.
  262.  */
  263.  
  264. extern os_error *xadfsdiscop_read_track (bits flags,
  265.       filecore_disc_address disc_addr,
  266.       byte *data);
  267. extern void adfsdiscop_read_track (bits flags,
  268.       filecore_disc_address disc_addr,
  269.       byte *data);
  270.  
  271. /* ------------------------------------------------------------------------
  272.  * Function:      adfsdiscop_read_id()
  273.  *
  274.  * Description:   Reads a hard disc ID
  275.  *
  276.  * Input:         flags - value of R1 on entry
  277.  *                disc_addr - value of R2 on entry
  278.  *                data - value of R3 on entry
  279.  *
  280.  * Other notes:   Calls SWI 0x40240 with R1 |= 0x3.
  281.  */
  282.  
  283. extern os_error *xadfsdiscop_read_id (bits flags,
  284.       filecore_disc_address disc_addr,
  285.       byte *data);
  286. extern void adfsdiscop_read_id (bits flags,
  287.       filecore_disc_address disc_addr,
  288.       byte *data);
  289.  
  290. /* ------------------------------------------------------------------------
  291.  * Function:      adfsdiscop_write_track()
  292.  *
  293.  * Description:   Writes a track to a disc
  294.  *
  295.  * Input:         flags - value of R1 on entry
  296.  *                disc_addr - value of R2 on entry
  297.  *                data - value of R3 on entry
  298.  *
  299.  * Other notes:   Calls SWI 0x40240 with R1 |= 0x4.
  300.  */
  301.  
  302. extern os_error *xadfsdiscop_write_track (bits flags,
  303.       filecore_disc_address disc_addr,
  304.       byte *data);
  305. extern void adfsdiscop_write_track (bits flags,
  306.       filecore_disc_address disc_addr,
  307.       byte *data);
  308.  
  309. /* ------------------------------------------------------------------------
  310.  * Function:      adfsdiscop_format_track()
  311.  *
  312.  * Description:   Formats a track of a disc
  313.  *
  314.  * Input:         flags - value of R1 on entry
  315.  *                disc_addr - value of R2 on entry
  316.  *                format - value of R4 on entry
  317.  *
  318.  * Other notes:   Calls SWI 0x40240 with R1 |= 0x4, R3 = 0x0.
  319.  */
  320.  
  321. extern os_error *xadfsdiscop_format_track (bits flags,
  322.       filecore_disc_address disc_addr,
  323.       filecore_format *format);
  324. extern void adfsdiscop_format_track (bits flags,
  325.       filecore_disc_address disc_addr,
  326.       filecore_format *format);
  327.  
  328. /* ------------------------------------------------------------------------
  329.  * Function:      adfsdiscop_seek()
  330.  *
  331.  * Description:   Seeks to a disc location
  332.  *
  333.  * Input:         flags - value of R1 on entry
  334.  *                disc_addr - value of R2 on entry
  335.  *
  336.  * Other notes:   Calls SWI 0x40240 with R1 |= 0x5.
  337.  */
  338.  
  339. extern os_error *xadfsdiscop_seek (bits flags,
  340.       filecore_disc_address disc_addr);
  341. extern void adfsdiscop_seek (bits flags,
  342.       filecore_disc_address disc_addr);
  343.  
  344. /* ------------------------------------------------------------------------
  345.  * Function:      adfsdiscop_restore()
  346.  *
  347.  * Description:   Does a restore operation for a disc
  348.  *
  349.  * Input:         flags - value of R1 on entry
  350.  *                disc_addr - value of R2 on entry
  351.  *
  352.  * Other notes:   Calls SWI 0x40240 with R1 |= 0x6.
  353.  */
  354.  
  355. extern os_error *xadfsdiscop_restore (bits flags,
  356.       filecore_disc_address disc_addr);
  357. extern void adfsdiscop_restore (bits flags,
  358.       filecore_disc_address disc_addr);
  359.  
  360. /* ------------------------------------------------------------------------
  361.  * Function:      adfsdiscop_step_in()
  362.  *
  363.  * Description:   Steps a floppy disc in one track
  364.  *
  365.  * Input:         flags - value of R1 on entry
  366.  *
  367.  * Other notes:   Calls SWI 0x40240 with R1 |= 0x7.
  368.  */
  369.  
  370. extern os_error *xadfsdiscop_step_in (bits flags);
  371. extern void adfsdiscop_step_in (bits flags);
  372.  
  373. /* ------------------------------------------------------------------------
  374.  * Function:      adfsdiscop_step_out()
  375.  *
  376.  * Description:   Steps a floppy disc out one track
  377.  *
  378.  * Input:         flags - value of R1 on entry
  379.  *
  380.  * Other notes:   Calls SWI 0x40240 with R1 |= 0x8.
  381.  */
  382.  
  383. extern os_error *xadfsdiscop_step_out (bits flags);
  384. extern void adfsdiscop_step_out (bits flags);
  385.  
  386. /* ------------------------------------------------------------------------
  387.  * Function:      adfsdiscop_read_sectors_via_cache()
  388.  *
  389.  * Description:   Reads sectors of a disc using the RMA cache
  390.  *
  391.  * Input:         flags - value of R1 on entry
  392.  *                disc_addr - value of R2 on entry
  393.  *                data - value of R3 on entry
  394.  *                size - value of R4 on entry
  395.  *                cache_handle - value of R6 on entry
  396.  *
  397.  * Output:        next_disc_addr - value of R2 on exit
  398.  *                next_data - value of R3 on exit
  399.  *                unread - value of R4 on exit (X version only)
  400.  *                cache_handle - value of R6 on exit
  401.  *
  402.  * Returns:       R4 (non-X version only)
  403.  *
  404.  * Other notes:   Calls SWI 0x40240 with R1 |= 0x9.
  405.  */
  406.  
  407. extern os_error *xadfsdiscop_read_sectors_via_cache (bits flags,
  408.       filecore_disc_address disc_addr,
  409.       byte *data,
  410.       int size,
  411.       int cache_handle,
  412.       filecore_disc_address *next_disc_addr,
  413.       byte **next_data,
  414.       int *unread,
  415.       int *cache_handle);
  416. extern int adfsdiscop_read_sectors_via_cache (bits flags,
  417.       filecore_disc_address disc_addr,
  418.       byte *data,
  419.       int size,
  420.       int cache_handle,
  421.       filecore_disc_address *next_disc_addr,
  422.       byte **next_data,
  423.       int *cache_handle);
  424.  
  425. /* ------------------------------------------------------------------------
  426.  * Function:      adfsdiscop_specify()
  427.  *
  428.  * Description:   Does a specify operation on a hard disc
  429.  *
  430.  * Input:         flags - value of R1 on entry
  431.  *                disc_addr - value of R2 on entry
  432.  *
  433.  * Other notes:   Calls SWI 0x40240 with R1 |= 0xF.
  434.  */
  435.  
  436. extern os_error *xadfsdiscop_specify (bits flags,
  437.       filecore_disc_address disc_addr);
  438. extern void adfsdiscop_specify (bits flags,
  439.       filecore_disc_address disc_addr);
  440.  
  441. /* ------------------------------------------------------------------------
  442.  * Function:      adfs_hdc()
  443.  *
  444.  * Description:   Sets the address of an alternative ST506 hard disc
  445.  *                controller
  446.  *
  447.  * Input:         controller - value of R2 on entry
  448.  *                poll_location - value of R3 on entry
  449.  *                poll_bits - value of R4 on entry
  450.  *                enable_location - value of R5 on entry
  451.  *                enable_bits - value of R6 on entry
  452.  *
  453.  * Other notes:   Calls SWI 0x40241.
  454.  */
  455.  
  456. extern os_error *xadfs_hdc (byte *controller,
  457.       int *poll_location,
  458.       bits poll_bits,
  459.       byte *enable_location,
  460.       bits enable_bits);
  461. extern void adfs_hdc (byte *controller,
  462.       int *poll_location,
  463.       bits poll_bits,
  464.       byte *enable_location,
  465.       bits enable_bits);
  466.  
  467. /* ------------------------------------------------------------------------
  468.  * Function:      adfs_drives()
  469.  *
  470.  * Description:   Returns information on ADFS' drives
  471.  *
  472.  * Output:        default_drive - value of R0 on exit
  473.  *                floppy_count - value of R1 on exit
  474.  *                hard_disc_count - value of R2 on exit
  475.  *
  476.  * Other notes:   Calls SWI 0x40242.
  477.  */
  478.  
  479. extern os_error *xadfs_drives (int *default_drive,
  480.       int *floppy_count,
  481.       int *hard_disc_count);
  482. extern void adfs_drives (int *default_drive,
  483.       int *floppy_count,
  484.       int *hard_disc_count);
  485.  
  486. /* ------------------------------------------------------------------------
  487.  * Function:      adfs_free_space()
  488.  *
  489.  * Description:   Returns information on a disc's free space
  490.  *
  491.  * Input:         disc_name - value of R0 on entry
  492.  *
  493.  * Output:        free - value of R0 on exit (X version only)
  494.  *                max - value of R1 on exit
  495.  *
  496.  * Returns:       R0 (non-X version only)
  497.  *
  498.  * Other notes:   Calls SWI 0x40243.
  499.  */
  500.  
  501. extern os_error *xadfs_free_space (char *disc_name,
  502.       int *free,
  503.       int *max);
  504. extern int adfs_free_space (char *disc_name,
  505.       int *max);
  506.  
  507. /* ------------------------------------------------------------------------
  508.  * Function:      adfs_retries()
  509.  *
  510.  * Description:   Sets the number of retries used for various operations
  511.  *
  512.  * Input:         mask - value of R0 on entry
  513.  *                value - value of R1 on entry
  514.  *
  515.  * Output:        old_value - value of R2 on exit (X version only)
  516.  *                new_value - value of R3 on exit
  517.  *
  518.  * Returns:       R2 (non-X version only)
  519.  *
  520.  * Other notes:   Calls SWI 0x40244.
  521.  */
  522.  
  523. extern os_error *xadfs_retries (bits mask,
  524.       bits value,
  525.       bits *old_value,
  526.       bits *new_value);
  527. extern bits adfs_retries (bits mask,
  528.       bits value,
  529.       bits *new_value);
  530.  
  531. /* ------------------------------------------------------------------------
  532.  * Function:      adfs_describe_disc()
  533.  *
  534.  * Description:   Returns a disc record describing a disc's shape and
  535.  *                format
  536.  *
  537.  * Input:         disc_name - value of R0 on entry
  538.  *                disc - value of R1 on entry
  539.  *
  540.  * Other notes:   Calls SWI 0x40245.
  541.  */
  542.  
  543. extern os_error *xadfs_describe_disc (char *disc_name,
  544.       filecore_disc *disc);
  545. extern void adfs_describe_disc (char *disc_name,
  546.       filecore_disc *disc);
  547.  
  548. /* ------------------------------------------------------------------------
  549.  * Function:      adfs_vet_format()
  550.  *
  551.  * Description:   Vets a format for achievability with the available
  552.  *                hardware
  553.  *
  554.  * Input:         format - value of R0 on entry
  555.  *                drive_no - value of R1 on entry
  556.  *
  557.  * Other notes:   Calls SWI 0x40246.
  558.  */
  559.  
  560. extern os_error *xadfs_vet_format (filecore_format *format,
  561.       int drive_no);
  562. extern void adfs_vet_format (filecore_format *format,
  563.       int drive_no);
  564.  
  565. /* ------------------------------------------------------------------------
  566.  * Function:      adfs_controller_type()
  567.  *
  568.  * Description:   Returns the controller type of a driver
  569.  *
  570.  * Input:         drive_no - value of R0 on entry
  571.  *
  572.  * Output:        controller - value of R0 on exit (X version only)
  573.  *
  574.  * Returns:       R0 (non-X version only)
  575.  *
  576.  * Other notes:   Calls SWI 0x40248.
  577.  */
  578.  
  579. extern os_error *xadfs_controller_type (int drive_no,
  580.       int *controller);
  581. extern int adfs_controller_type (int drive_no);
  582.  
  583. /* ------------------------------------------------------------------------
  584.  * Function:      adfspowercontrol_read_spin()
  585.  *
  586.  * Description:   Reads the spin status of a drive
  587.  *
  588.  * Input:         drive_no - value of R1 on entry
  589.  *
  590.  * Output:        spinning - value of R2 on exit (X version only)
  591.  *
  592.  * Returns:       R2 (non-X version only)
  593.  *
  594.  * Other notes:   Calls SWI 0x40249 with R0 = 0x0.
  595.  */
  596.  
  597. extern os_error *xadfspowercontrol_read_spin (int drive_no,
  598.       bool *spinning);
  599. extern bool adfspowercontrol_read_spin (int drive_no);
  600.  
  601. /* ------------------------------------------------------------------------
  602.  * Function:      adfspowercontrol_set_autospindown()
  603.  *
  604.  * Description:   Sets the autospindown characteristic of a drive
  605.  *
  606.  * Input:         drive_no - value of R1 on entry
  607.  *                spindown_time - value of R2 on entry
  608.  *
  609.  * Output:        old_spindown_time - value of R3 on exit (X version only)
  610.  *
  611.  * Returns:       R3 (non-X version only)
  612.  *
  613.  * Other notes:   Calls SWI 0x40249 with R0 = 0x1.
  614.  */
  615.  
  616. extern os_error *xadfspowercontrol_set_autospindown (int drive_no,
  617.       int spindown_time,
  618.       int *old_spindown_time);
  619. extern int adfspowercontrol_set_autospindown (int drive_no,
  620.       int spindown_time);
  621.  
  622. /* ------------------------------------------------------------------------
  623.  * Function:      adfspowercontrol_set_spin()
  624.  *
  625.  * Description:   Controls drive spin directly without affecting
  626.  *                autospindown
  627.  *
  628.  * Input:         drive_no - value of R1 on entry
  629.  *                spinning - value of R2 on entry
  630.  *
  631.  * Other notes:   Calls SWI 0x40249 with R0 = 0x2.
  632.  */
  633.  
  634. extern os_error *xadfspowercontrol_set_spin (int drive_no,
  635.       bool spinning);
  636. extern void adfspowercontrol_set_spin (int drive_no,
  637.       bool spinning);
  638.  
  639. /* ------------------------------------------------------------------------
  640.  * Function:      adfs_set_ide_controller()
  641.  *
  642.  * Description:   Gives the IDE driver the details of an alternative
  643.  *                controller
  644.  *
  645.  * Input:         controller - value of R2 on entry
  646.  *                status_location - value of R3 on entry
  647.  *                status_bits - value of R4 on entry
  648.  *                irq_location - value of R5 on entry
  649.  *                irq_bits - value of R6 on entry
  650.  *                read_code - value of R7 on entry
  651.  *                write_code - value of R8 on entry
  652.  *
  653.  * Other notes:   Calls SWI 0x4024A.
  654.  */
  655.  
  656. extern os_error *xadfs_set_ide_controller (byte *controller,
  657.       int *status_location,
  658.       bits status_bits,
  659.       int *irq_location,
  660.       bits irq_bits,
  661.       void *read_code,
  662.       void *write_code);
  663. extern void adfs_set_ide_controller (byte *controller,
  664.       int *status_location,
  665.       bits status_bits,
  666.       int *irq_location,
  667.       bits irq_bits,
  668.       void *read_code,
  669.       void *write_code);
  670.  
  671. /* ------------------------------------------------------------------------
  672.  * Function:      adfs_ide_user_op()
  673.  *
  674.  * Description:   Direct user interface for low-level IDE commands
  675.  *
  676.  * Input:         op - value of R0 on entry
  677.  *                commands - value of R2 on entry
  678.  *                buffer - value of R3 on entry
  679.  *                size - value of R4 on entry
  680.  *                timeout - value of R5 on entry
  681.  *
  682.  * Output:        status - value of R0 on exit
  683.  *                untransferred - value of R4 on exit (X version only)
  684.  *
  685.  * Returns:       R4 (non-X version only)
  686.  *
  687.  * Other notes:   Calls SWI 0x4024B.
  688.  */
  689.  
  690. extern os_error *xadfs_ide_user_op (bits op,
  691.       byte *commands,
  692.       byte *buffer,
  693.       int size,
  694.       int timeout,
  695.       int *status,
  696.       int *untransferred);
  697. extern int adfs_ide_user_op (bits op,
  698.       byte *commands,
  699.       byte *buffer,
  700.       int size,
  701.       int timeout,
  702.       int *status);
  703.  
  704. /* ------------------------------------------------------------------------
  705.  * Function:      adfsmiscop_mount()
  706.  *
  707.  * Description:   Mounts a disc, reading in the data asked for
  708.  *
  709.  * Input:         drive_no - value of R1 on entry
  710.  *                disc_addr - value of R2 on entry
  711.  *                buffer - value of R3 on entry
  712.  *                size - value of R4 on entry
  713.  *                disc - value of R5 on entry
  714.  *
  715.  * Other notes:   Calls SWI 0x4024C with R0 = 0x0.
  716.  */
  717.  
  718. extern os_error *xadfsmiscop_mount (int drive_no,
  719.       filecore_disc_address disc_addr,
  720.       byte *buffer,
  721.       int size,
  722.       filecore_disc *disc);
  723. extern void adfsmiscop_mount (int drive_no,
  724.       filecore_disc_address disc_addr,
  725.       byte *buffer,
  726.       int size,
  727.       filecore_disc *disc);
  728.  
  729. /* ------------------------------------------------------------------------
  730.  * Function:      adfsmiscop_poll_changed()
  731.  *
  732.  * Description:   Polls the sequence number for a drive
  733.  *
  734.  * Input:         drive_no - value of R1 on entry
  735.  *                sequence_no - value of R2 on entry
  736.  *
  737.  * Output:        sequence_no_out - value of R2 on exit
  738.  *                result - value of R3 on exit
  739.  *
  740.  * Other notes:   Calls SWI 0x4024C with R0 = 0x1.
  741.  */
  742.  
  743. extern os_error *xadfsmiscop_poll_changed (int drive_no,
  744.       int sequence_no,
  745.       int *sequence_no_out,
  746.       bits *result);
  747. extern void adfsmiscop_poll_changed (int drive_no,
  748.       int sequence_no,
  749.       int *sequence_no_out,
  750.       bits *result);
  751.  
  752. /* ------------------------------------------------------------------------
  753.  * Function:      adfsmiscop_lock_drive()
  754.  *
  755.  * Description:   Locks a disc in a floppy drive
  756.  *
  757.  * Input:         drive_no - value of R1 on entry
  758.  *
  759.  * Other notes:   Calls SWI 0x4024C with R0 = 0x2.
  760.  */
  761.  
  762. extern os_error *xadfsmiscop_lock_drive (int drive_no);
  763. extern void adfsmiscop_lock_drive (int drive_no);
  764.  
  765. /* ------------------------------------------------------------------------
  766.  * Function:      adfsmiscop_unlock_drive()
  767.  *
  768.  * Description:   Unlocks a disc in a floppy drive
  769.  *
  770.  * Input:         drive_no - value of R1 on entry
  771.  *
  772.  * Other notes:   Calls SWI 0x4024C with R0 = 0x3.
  773.  */
  774.  
  775. extern os_error *xadfsmiscop_unlock_drive (int drive_no);
  776. extern void adfsmiscop_unlock_drive (int drive_no);
  777.  
  778. /* ------------------------------------------------------------------------
  779.  * Function:      adfsmiscop_poll_period()
  780.  *
  781.  * Description:   Informs FileCore of the minimum period between polling
  782.  *                for disc insertion
  783.  *
  784.  * Input:         disc_name - value of R1 on entry
  785.  *
  786.  * Output:        poll_period - value of R5 on exit
  787.  *                media_type - value of R6 on exit
  788.  *
  789.  * Other notes:   Calls SWI 0x4024C with R0 = 0x4.
  790.  */
  791.  
  792. extern os_error *xadfsmiscop_poll_period (char *disc_name,
  793.       int *poll_period,
  794.       char **media_type);
  795. extern void adfsmiscop_poll_period (char *disc_name,
  796.       int *poll_period,
  797.       char **media_type);
  798.  
  799. /* ------------------------------------------------------------------------
  800.  * Function:      adfsmiscop_eject_disc()
  801.  *
  802.  * Description:   Power-ejects the disc in the specified drive
  803.  *
  804.  * Input:         drive_no - value of R1 on entry
  805.  *
  806.  * Other notes:   Calls SWI 0x4024C with R0 = 0x5.
  807.  */
  808.  
  809. extern os_error *xadfsmiscop_eject_disc (int drive_no);
  810. extern void adfsmiscop_eject_disc (int drive_no);
  811.  
  812. /* ------------------------------------------------------------------------
  813.  * Function:      service_identify_format()
  814.  *
  815.  * Description:   Identify disc format name
  816.  *
  817.  * Input:         format - value of R0 on entry
  818.  *
  819.  * Output:        command - value of R0 on exit
  820.  *                unclaimed - value of R1 on exit (X version only)
  821.  *                disc_format_swi - value of R2 on exit
  822.  *                disc_format_handle - value of R3 on exit
  823.  *                layout_structure_swi - value of R4 on exit
  824.  *                layout_structure_handle - value of R5 on exit
  825.  *
  826.  * Returns:       R1 (non-X version only)
  827.  *
  828.  * Other notes:   Calls SWI 0x30 with R1 = 0x6B.
  829.  */
  830.  
  831. extern os_error *xservice_identify_format (char *format,
  832.       char **command,
  833.       bool *unclaimed,
  834.       int *disc_format_swi,
  835.       int *disc_format_handle,
  836.       int *layout_structure_swi,
  837.       int *layout_structure_handle);
  838. extern bool service_identify_format (char *format,
  839.       char **command,
  840.       int *disc_format_swi,
  841.       int *disc_format_handle,
  842.       int *layout_structure_swi,
  843.       int *layout_structure_handle);
  844.  
  845. /* ------------------------------------------------------------------------
  846.  * Function:      service_display_format_help()
  847.  *
  848.  * Description:   Display list of available formats
  849.  *
  850.  * Output:        error - value of R0 on exit
  851.  *                unclaimed - value of R1 on exit (X version only)
  852.  *
  853.  * Returns:       R1 (non-X version only)
  854.  *
  855.  * Other notes:   Calls SWI 0x30 with R0 = 0x0, R1 = 0x6C.
  856.  */
  857.  
  858. extern os_error *xservice_display_format_help (os_error **error,
  859.       bool *unclaimed);
  860. extern bool service_display_format_help (os_error **error);
  861.  
  862. #ifdef __cplusplus
  863.    }
  864. #endif
  865.  
  866. #endif
  867.