home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / programming / oslib / oslib_1 / OSLib / Computer / h / scsifs < prev    next >
Encoding:
Text File  |  1995-06-27  |  12.9 KB  |  423 lines

  1. #ifndef scsifs_H
  2. #define scsifs_H
  3.  
  4. /* C header file for SCSIFS
  5.  * written by DefMod (Jun 20 1995) on Tue Jun 27 16:35:52 1995
  6.  * Jonathan Coxhead, Acorn Computers Ltd
  7.  */
  8.  
  9. #ifndef types_H
  10. #include "types.h"
  11. #endif
  12.  
  13. #ifndef os_H
  14. #include "os.h"
  15. #endif
  16.  
  17. #ifndef filecore_H
  18. #include "filecore.h"
  19. #endif
  20.  
  21. /**********************************
  22.  * SWI names and SWI reason codes *
  23.  **********************************/
  24. #undef  SCSIFS_DiscOp
  25. #define SCSIFS_DiscOp                           0x40980
  26. #undef  XSCSIFS_DiscOp
  27. #define XSCSIFS_DiscOp                          0x60980
  28. #undef  SCSIFSDiscOp_Verify
  29. #define SCSIFSDiscOp_Verify                     0x0
  30. #undef  SCSIFSDiscOp_ReadSectors
  31. #define SCSIFSDiscOp_ReadSectors                0x1
  32. #undef  SCSIFSDiscOp_WriteSectors
  33. #define SCSIFSDiscOp_WriteSectors               0x2
  34. #undef  SCSIFSDiscOp_ReadTrack
  35. #define SCSIFSDiscOp_ReadTrack                  0x3
  36. #undef  SCSIFSDiscOp_ReadId
  37. #define SCSIFSDiscOp_ReadId                     0x3
  38. #undef  SCSIFSDiscOp_WriteTrack
  39. #define SCSIFSDiscOp_WriteTrack                 0x4
  40. #undef  SCSIFSDiscOp_FormatTrack
  41. #define SCSIFSDiscOp_FormatTrack                0x4
  42. #undef  SCSIFSDiscOp_Seek
  43. #define SCSIFSDiscOp_Seek                       0x5
  44. #undef  SCSIFSDiscOp_Restore
  45. #define SCSIFSDiscOp_Restore                    0x6
  46. #undef  SCSIFSDiscOp_ReadSectorsViaCache
  47. #define SCSIFSDiscOp_ReadSectorsViaCache        0x9
  48. #undef  SCSIFSDiscOp_Specify
  49. #define SCSIFSDiscOp_Specify                    0xF
  50. #undef  SCSIFS_Drives
  51. #define SCSIFS_Drives                           0x40982
  52. #undef  XSCSIFS_Drives
  53. #define XSCSIFS_Drives                          0x60982
  54. #undef  SCSIFS_FreeSpace
  55. #define SCSIFS_FreeSpace                        0x40983
  56. #undef  XSCSIFS_FreeSpace
  57. #define XSCSIFS_FreeSpace                       0x60983
  58. #undef  SCSIFS_DescribeDisc
  59. #define SCSIFS_DescribeDisc                     0x40985
  60. #undef  XSCSIFS_DescribeDisc
  61. #define XSCSIFS_DescribeDisc                    0x60985
  62. #undef  SCSIFS_TestReady
  63. #define SCSIFS_TestReady                        0x40986
  64. #undef  XSCSIFS_TestReady
  65. #define XSCSIFS_TestReady                       0x60986
  66.  
  67. /********************
  68.  * Type definitions *
  69.  ********************/
  70. typedef int scsifs_drive_status;
  71.  
  72. /************************
  73.  * Constant definitions *
  74.  ************************/
  75. #define scsifs_DRIVE_ABSENT                     ((scsifs_drive_status) 0x0u)
  76. #define scsifs_DRIVE_UNREADY                    ((scsifs_drive_status) 0x1u)
  77. #define scsifs_DRIVE_READY                      ((scsifs_drive_status) 0x2u)
  78.  
  79. /*************************
  80.  * Function declarations *
  81.  *************************/
  82.  
  83. #ifdef __cplusplus
  84.    extern "C" {
  85. #endif
  86.  
  87. /* ------------------------------------------------------------------------
  88.  * Function:      scsifsdiscop_verify()
  89.  *
  90.  * Description:   Verifies a disc
  91.  *
  92.  * Input:         flags - value of R1 on entry
  93.  *                disc_addr - value of R2 on entry
  94.  *                size - value of R4 on entry
  95.  *
  96.  * Output:        next_disc_addr - value of R2 on exit
  97.  *                unverified - value of R4 on exit (X version only)
  98.  *
  99.  * Returns:       R4 (non-X version only)
  100.  *
  101.  * Other notes:   Calls SWI 0x40980 with R1 |= 0x0.
  102.  */
  103.  
  104. extern os_error *xscsifsdiscop_verify (bits flags,
  105.       filecore_disc_address disc_addr,
  106.       int size,
  107.       filecore_disc_address *next_disc_addr,
  108.       int *unverified);
  109. extern int scsifsdiscop_verify (bits flags,
  110.       filecore_disc_address disc_addr,
  111.       int size,
  112.       filecore_disc_address *next_disc_addr);
  113.  
  114. /* ------------------------------------------------------------------------
  115.  * Function:      scsifsdiscop_read_sectors()
  116.  *
  117.  * Description:   Reads sectors from a disc
  118.  *
  119.  * Input:         flags - value of R1 on entry
  120.  *                disc_addr - value of R2 on entry
  121.  *                data - value of R3 on entry
  122.  *                size - value of R4 on entry
  123.  *
  124.  * Output:        next_disc_addr - value of R2 on exit
  125.  *                next_data - value of R3 on exit
  126.  *                unread - value of R4 on exit (X version only)
  127.  *
  128.  * Returns:       R4 (non-X version only)
  129.  *
  130.  * Other notes:   Calls SWI 0x40980 with R1 |= 0x1.
  131.  */
  132.  
  133. extern os_error *xscsifsdiscop_read_sectors (bits flags,
  134.       filecore_disc_address disc_addr,
  135.       byte *data,
  136.       int size,
  137.       filecore_disc_address *next_disc_addr,
  138.       byte **next_data,
  139.       int *unread);
  140. extern int scsifsdiscop_read_sectors (bits flags,
  141.       filecore_disc_address disc_addr,
  142.       byte *data,
  143.       int size,
  144.       filecore_disc_address *next_disc_addr,
  145.       byte **next_data);
  146.  
  147. /* ------------------------------------------------------------------------
  148.  * Function:      scsifsdiscop_write_sectors()
  149.  *
  150.  * Description:   Writes sectors to a disc
  151.  *
  152.  * Input:         flags - value of R1 on entry
  153.  *                disc_addr - value of R2 on entry
  154.  *                data - value of R3 on entry
  155.  *                size - value of R4 on entry
  156.  *
  157.  * Output:        next_disc_addr - value of R2 on exit
  158.  *                next_data - value of R3 on exit
  159.  *                unwritten - value of R4 on exit (X version only)
  160.  *
  161.  * Returns:       R4 (non-X version only)
  162.  *
  163.  * Other notes:   Calls SWI 0x40980 with R1 |= 0x2.
  164.  */
  165.  
  166. extern os_error *xscsifsdiscop_write_sectors (bits flags,
  167.       filecore_disc_address disc_addr,
  168.       byte const *data,
  169.       int size,
  170.       filecore_disc_address *next_disc_addr,
  171.       byte **next_data,
  172.       int *unwritten);
  173. extern int scsifsdiscop_write_sectors (bits flags,
  174.       filecore_disc_address disc_addr,
  175.       byte const *data,
  176.       int size,
  177.       filecore_disc_address *next_disc_addr,
  178.       byte **next_data);
  179.  
  180. /* ------------------------------------------------------------------------
  181.  * Function:      scsifsdiscop_read_track()
  182.  *
  183.  * Description:   Reads a track from a floppy disc
  184.  *
  185.  * Input:         flags - value of R1 on entry
  186.  *                disc_addr - value of R2 on entry
  187.  *                data - value of R3 on entry
  188.  *
  189.  * Other notes:   Calls SWI 0x40980 with R1 |= 0x3.
  190.  */
  191.  
  192. extern os_error *xscsifsdiscop_read_track (bits flags,
  193.       filecore_disc_address disc_addr,
  194.       byte *data);
  195. extern void scsifsdiscop_read_track (bits flags,
  196.       filecore_disc_address disc_addr,
  197.       byte *data);
  198.  
  199. /* ------------------------------------------------------------------------
  200.  * Function:      scsifsdiscop_read_id()
  201.  *
  202.  * Description:   Reads a hard disc ID
  203.  *
  204.  * Input:         flags - value of R1 on entry
  205.  *                disc_addr - value of R2 on entry
  206.  *                data - value of R3 on entry
  207.  *
  208.  * Other notes:   Calls SWI 0x40980 with R1 |= 0x3.
  209.  */
  210.  
  211. extern os_error *xscsifsdiscop_read_id (bits flags,
  212.       filecore_disc_address disc_addr,
  213.       byte *data);
  214. extern void scsifsdiscop_read_id (bits flags,
  215.       filecore_disc_address disc_addr,
  216.       byte *data);
  217.  
  218. /* ------------------------------------------------------------------------
  219.  * Function:      scsifsdiscop_write_track()
  220.  *
  221.  * Description:   Writes a track to a disc
  222.  *
  223.  * Input:         flags - value of R1 on entry
  224.  *                disc_addr - value of R2 on entry
  225.  *                data - value of R3 on entry
  226.  *
  227.  * Other notes:   Calls SWI 0x40980 with R1 |= 0x4.
  228.  */
  229.  
  230. extern os_error *xscsifsdiscop_write_track (bits flags,
  231.       filecore_disc_address disc_addr,
  232.       byte const *data);
  233. extern void scsifsdiscop_write_track (bits flags,
  234.       filecore_disc_address disc_addr,
  235.       byte const *data);
  236.  
  237. /* ------------------------------------------------------------------------
  238.  * Function:      scsifsdiscop_format_track()
  239.  *
  240.  * Description:   Formats a track of a disc
  241.  *
  242.  * Input:         flags - value of R1 on entry
  243.  *                disc_addr - value of R2 on entry
  244.  *                format - value of R4 on entry
  245.  *
  246.  * Other notes:   Calls SWI 0x40980 with R1 |= 0x4, R3 = 0x0.
  247.  */
  248.  
  249. extern os_error *xscsifsdiscop_format_track (bits flags,
  250.       filecore_disc_address disc_addr,
  251.       filecore_track_format const *format);
  252. extern void scsifsdiscop_format_track (bits flags,
  253.       filecore_disc_address disc_addr,
  254.       filecore_track_format const *format);
  255.  
  256. /* ------------------------------------------------------------------------
  257.  * Function:      scsifsdiscop_seek()
  258.  *
  259.  * Description:   Seeks to a disc location
  260.  *
  261.  * Input:         flags - value of R1 on entry
  262.  *                disc_addr - value of R2 on entry
  263.  *
  264.  * Other notes:   Calls SWI 0x40980 with R1 |= 0x5.
  265.  */
  266.  
  267. extern os_error *xscsifsdiscop_seek (bits flags,
  268.       filecore_disc_address disc_addr);
  269. extern void scsifsdiscop_seek (bits flags,
  270.       filecore_disc_address disc_addr);
  271.  
  272. /* ------------------------------------------------------------------------
  273.  * Function:      scsifsdiscop_restore()
  274.  *
  275.  * Description:   Does a restore operation for a disc
  276.  *
  277.  * Input:         flags - value of R1 on entry
  278.  *                disc_addr - value of R2 on entry
  279.  *
  280.  * Other notes:   Calls SWI 0x40980 with R1 |= 0x6.
  281.  */
  282.  
  283. extern os_error *xscsifsdiscop_restore (bits flags,
  284.       filecore_disc_address disc_addr);
  285. extern void scsifsdiscop_restore (bits flags,
  286.       filecore_disc_address disc_addr);
  287.  
  288. /* ------------------------------------------------------------------------
  289.  * Function:      scsifsdiscop_read_sectors_via_cache()
  290.  *
  291.  * Description:   Reads sectors of a disc using the RMA cache
  292.  *
  293.  * Input:         flags - value of R1 on entry
  294.  *                disc_addr - value of R2 on entry
  295.  *                data - value of R3 on entry
  296.  *                size - value of R4 on entry
  297.  *                cache_handle - value of R6 on entry
  298.  *
  299.  * Output:        next_disc_addr - value of R2 on exit
  300.  *                next_data - value of R3 on exit
  301.  *                unread - value of R4 on exit (X version only)
  302.  *                cache_handle - value of R6 on exit
  303.  *
  304.  * Returns:       R4 (non-X version only)
  305.  *
  306.  * Other notes:   Calls SWI 0x40980 with R1 |= 0x9.
  307.  */
  308.  
  309. extern os_error *xscsifsdiscop_read_sectors_via_cache (bits flags,
  310.       filecore_disc_address disc_addr,
  311.       byte *data,
  312.       int size,
  313.       int cache_handle,
  314.       filecore_disc_address *next_disc_addr,
  315.       byte **next_data,
  316.       int *unread,
  317.       int *cache_handle);
  318. extern int scsifsdiscop_read_sectors_via_cache (bits flags,
  319.       filecore_disc_address disc_addr,
  320.       byte *data,
  321.       int size,
  322.       int cache_handle,
  323.       filecore_disc_address *next_disc_addr,
  324.       byte **next_data,
  325.       int *cache_handle);
  326.  
  327. /* ------------------------------------------------------------------------
  328.  * Function:      scsifsdiscop_specify()
  329.  *
  330.  * Description:   Does a specify operation on a hard disc
  331.  *
  332.  * Input:         flags - value of R1 on entry
  333.  *                disc_addr - value of R2 on entry
  334.  *
  335.  * Other notes:   Calls SWI 0x40980 with R1 |= 0xF.
  336.  */
  337.  
  338. extern os_error *xscsifsdiscop_specify (bits flags,
  339.       filecore_disc_address disc_addr);
  340. extern void scsifsdiscop_specify (bits flags,
  341.       filecore_disc_address disc_addr);
  342.  
  343. /* ------------------------------------------------------------------------
  344.  * Function:      scsifs_drives()
  345.  *
  346.  * Description:   Returns information on SCSIFS' drives
  347.  *
  348.  * Output:        default_drive - value of R0 on exit
  349.  *                floppy_count - value of R1 on exit
  350.  *                hard_disc_count - value of R2 on exit
  351.  *
  352.  * Other notes:   Calls SWI 0x40982.
  353.  */
  354.  
  355. extern os_error *xscsifs_drives (int *default_drive,
  356.       int *floppy_count,
  357.       int *hard_disc_count);
  358. extern void scsifs_drives (int *default_drive,
  359.       int *floppy_count,
  360.       int *hard_disc_count);
  361.  
  362. /* ------------------------------------------------------------------------
  363.  * Function:      scsifs_free_space()
  364.  *
  365.  * Description:   Returns information on a disc's free space
  366.  *
  367.  * Input:         disc_name - value of R0 on entry
  368.  *
  369.  * Output:        free - value of R0 on exit (X version only)
  370.  *                max - value of R1 on exit
  371.  *
  372.  * Returns:       R0 (non-X version only)
  373.  *
  374.  * Other notes:   Calls SWI 0x40983.
  375.  */
  376.  
  377. extern os_error *xscsifs_free_space (char const *disc_name,
  378.       int *free,
  379.       int *max);
  380. extern int scsifs_free_space (char const *disc_name,
  381.       int *max);
  382.  
  383. /* ------------------------------------------------------------------------
  384.  * Function:      scsifs_describe_disc()
  385.  *
  386.  * Description:   Returns a disc record describing a disc's shape and
  387.  *                format
  388.  *
  389.  * Input:         disc_name - value of R0 on entry
  390.  *                disc - value of R1 on entry
  391.  *
  392.  * Other notes:   Calls SWI 0x40985.
  393.  */
  394.  
  395. extern os_error *xscsifs_describe_disc (char const *disc_name,
  396.       filecore_disc *disc);
  397. __swi (0x40985) void scsifs_describe_disc (char const *disc_name,
  398.       filecore_disc *disc);
  399.  
  400. /* ------------------------------------------------------------------------
  401.  * Function:      scsifs_test_ready()
  402.  *
  403.  * Description:   Tests whether a drive is ready
  404.  *
  405.  * Input:         drive_no - value of R1 on entry
  406.  *
  407.  * Output:        status - value of R0 on exit (X version only)
  408.  *
  409.  * Returns:       R0 (non-X version only)
  410.  *
  411.  * Other notes:   Calls SWI 0x40986.
  412.  */
  413.  
  414. extern os_error *xscsifs_test_ready (int drive_no,
  415.       scsifs_drive_status *status);
  416. extern scsifs_drive_status scsifs_test_ready (int drive_no);
  417.  
  418. #ifdef __cplusplus
  419.    }
  420. #endif
  421.  
  422. #endif
  423.