home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / code / oslib / h / ramfs < prev    next >
Encoding:
Text File  |  1994-09-22  |  13.4 KB  |  432 lines

  1. #ifndef ramfs_H
  2. #define ramfs_H
  3.  
  4. /* C header file for RamFS
  5.  * written by DefMod (Sep 16 1994) on Thu Sep 22 16:37:40 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  RamFS_DiscOp
  31. #define RamFS_DiscOp                            0x40780
  32. #undef  XRamFS_DiscOp
  33. #define XRamFS_DiscOp                           0x60780
  34. #undef  RamFSDiscOp_Verify
  35. #define RamFSDiscOp_Verify                      0x0
  36. #undef  RamFSDiscOp_ReadSectors
  37. #define RamFSDiscOp_ReadSectors                 0x1
  38. #undef  RamFSDiscOp_WriteSectors
  39. #define RamFSDiscOp_WriteSectors                0x2
  40. #undef  RamFSDiscOp_ReadTrack
  41. #define RamFSDiscOp_ReadTrack                   0x3
  42. #undef  RamFSDiscOp_ReadId
  43. #define RamFSDiscOp_ReadId                      0x3
  44. #undef  RamFSDiscOp_WriteTrack
  45. #define RamFSDiscOp_WriteTrack                  0x4
  46. #undef  RamFSDiscOp_FormatTrack
  47. #define RamFSDiscOp_FormatTrack                 0x4
  48. #undef  RamFSDiscOp_Seek
  49. #define RamFSDiscOp_Seek                        0x5
  50. #undef  RamFSDiscOp_Restore
  51. #define RamFSDiscOp_Restore                     0x6
  52. #undef  RamFSDiscOp_StepIn
  53. #define RamFSDiscOp_StepIn                      0x7
  54. #undef  RamFSDiscOp_StepOut
  55. #define RamFSDiscOp_StepOut                     0x8
  56. #undef  RamFSDiscOp_ReadSectorsViaCache
  57. #define RamFSDiscOp_ReadSectorsViaCache         0x9
  58. #undef  RamFSDiscOp_Specify
  59. #define RamFSDiscOp_Specify                     0xF
  60. #undef  RamFS_Drives
  61. #define RamFS_Drives                            0x40782
  62. #undef  XRamFS_Drives
  63. #define XRamFS_Drives                           0x60782
  64. #undef  RamFS_FreeSpace
  65. #define RamFS_FreeSpace                         0x40783
  66. #undef  XRamFS_FreeSpace
  67. #define XRamFS_FreeSpace                        0x60783
  68. #undef  RamFS_DescribeDisc
  69. #define RamFS_DescribeDisc                      0x40785
  70. #undef  XRamFS_DescribeDisc
  71. #define XRamFS_DescribeDisc                     0x60785
  72.  
  73. /*************************
  74.  * Function declarations *
  75.  *************************/
  76.  
  77. #ifdef __cplusplus
  78.    extern "C" {
  79. #endif
  80.  
  81. /*************************************************************
  82.  * NOTE: The following functions provide direct access to    *
  83.  *       the SWI's noted in the function description.        *
  84.  *       Please read the relevant PRM section for more       *
  85.  *       information on their input/output parameters.       *
  86.  *************************************************************/
  87.  
  88. /* ------------------------------------------------------------------------
  89.  * Function:      ramfsdiscop_verify()
  90.  *
  91.  * Description:   Verifies a disc
  92.  *
  93.  * Input:         flags - value of R1 on entry
  94.  *                disc_addr - value of R2 on entry
  95.  *                size - value of R4 on entry
  96.  *
  97.  * Output:        next_disc_addr - value of R2 on exit
  98.  *                unverified - value of R4 on exit (X version only)
  99.  *
  100.  * Returns:       R4 (non-X version only)
  101.  *
  102.  * Other notes:   Calls SWI 0x40780 with R1 |= 0x0.
  103.  */
  104.  
  105. extern os_error *xramfsdiscop_verify (bits flags,
  106.       filecore_disc_address disc_addr,
  107.       int size,
  108.       filecore_disc_address *next_disc_addr,
  109.       int *unverified);
  110. extern int ramfsdiscop_verify (bits flags,
  111.       filecore_disc_address disc_addr,
  112.       int size,
  113.       filecore_disc_address *next_disc_addr);
  114.  
  115. /* ------------------------------------------------------------------------
  116.  * Function:      ramfsdiscop_read_sectors()
  117.  *
  118.  * Description:   Reads sectors from a disc
  119.  *
  120.  * Input:         flags - value of R1 on entry
  121.  *                disc_addr - value of R2 on entry
  122.  *                data - value of R3 on entry
  123.  *                size - value of R4 on entry
  124.  *
  125.  * Output:        next_disc_addr - value of R2 on exit
  126.  *                next_data - value of R3 on exit
  127.  *                unread - value of R4 on exit (X version only)
  128.  *
  129.  * Returns:       R4 (non-X version only)
  130.  *
  131.  * Other notes:   Calls SWI 0x40780 with R1 |= 0x1.
  132.  */
  133.  
  134. extern os_error *xramfsdiscop_read_sectors (bits flags,
  135.       filecore_disc_address disc_addr,
  136.       byte *data,
  137.       int size,
  138.       filecore_disc_address *next_disc_addr,
  139.       byte **next_data,
  140.       int *unread);
  141. extern int ramfsdiscop_read_sectors (bits flags,
  142.       filecore_disc_address disc_addr,
  143.       byte *data,
  144.       int size,
  145.       filecore_disc_address *next_disc_addr,
  146.       byte **next_data);
  147.  
  148. /* ------------------------------------------------------------------------
  149.  * Function:      ramfsdiscop_write_sectors()
  150.  *
  151.  * Description:   Writes sectors to a disc
  152.  *
  153.  * Input:         flags - value of R1 on entry
  154.  *                disc_addr - value of R2 on entry
  155.  *                data - value of R3 on entry
  156.  *                size - value of R4 on entry
  157.  *
  158.  * Output:        next_disc_addr - value of R2 on exit
  159.  *                next_data - value of R3 on exit
  160.  *                unwritten - value of R4 on exit (X version only)
  161.  *
  162.  * Returns:       R4 (non-X version only)
  163.  *
  164.  * Other notes:   Calls SWI 0x40780 with R1 |= 0x2.
  165.  */
  166.  
  167. extern os_error *xramfsdiscop_write_sectors (bits flags,
  168.       filecore_disc_address disc_addr,
  169.       byte *data,
  170.       int size,
  171.       filecore_disc_address *next_disc_addr,
  172.       byte **next_data,
  173.       int *unwritten);
  174. extern int ramfsdiscop_write_sectors (bits flags,
  175.       filecore_disc_address disc_addr,
  176.       byte *data,
  177.       int size,
  178.       filecore_disc_address *next_disc_addr,
  179.       byte **next_data);
  180.  
  181. /* ------------------------------------------------------------------------
  182.  * Function:      ramfsdiscop_read_track()
  183.  *
  184.  * Description:   Reads a track from a floppy disc
  185.  *
  186.  * Input:         flags - value of R1 on entry
  187.  *                disc_addr - value of R2 on entry
  188.  *                data - value of R3 on entry
  189.  *
  190.  * Other notes:   Calls SWI 0x40780 with R1 |= 0x3.
  191.  */
  192.  
  193. extern os_error *xramfsdiscop_read_track (bits flags,
  194.       filecore_disc_address disc_addr,
  195.       byte *data);
  196. extern void ramfsdiscop_read_track (bits flags,
  197.       filecore_disc_address disc_addr,
  198.       byte *data);
  199.  
  200. /* ------------------------------------------------------------------------
  201.  * Function:      ramfsdiscop_read_id()
  202.  *
  203.  * Description:   Reads a hard disc ID
  204.  *
  205.  * Input:         flags - value of R1 on entry
  206.  *                disc_addr - value of R2 on entry
  207.  *                data - value of R3 on entry
  208.  *
  209.  * Other notes:   Calls SWI 0x40780 with R1 |= 0x3.
  210.  */
  211.  
  212. extern os_error *xramfsdiscop_read_id (bits flags,
  213.       filecore_disc_address disc_addr,
  214.       byte *data);
  215. extern void ramfsdiscop_read_id (bits flags,
  216.       filecore_disc_address disc_addr,
  217.       byte *data);
  218.  
  219. /* ------------------------------------------------------------------------
  220.  * Function:      ramfsdiscop_write_track()
  221.  *
  222.  * Description:   Writes a track 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.  *
  228.  * Other notes:   Calls SWI 0x40780 with R1 |= 0x4.
  229.  */
  230.  
  231. extern os_error *xramfsdiscop_write_track (bits flags,
  232.       filecore_disc_address disc_addr,
  233.       byte *data);
  234. extern void ramfsdiscop_write_track (bits flags,
  235.       filecore_disc_address disc_addr,
  236.       byte *data);
  237.  
  238. /* ------------------------------------------------------------------------
  239.  * Function:      ramfsdiscop_format_track()
  240.  *
  241.  * Description:   Formats a track of a disc
  242.  *
  243.  * Input:         flags - value of R1 on entry
  244.  *                disc_addr - value of R2 on entry
  245.  *                track_format - value of R4 on entry
  246.  *
  247.  * Other notes:   Calls SWI 0x40780 with R1 |= 0x4, R3 = 0x0.
  248.  */
  249.  
  250. extern os_error *xramfsdiscop_format_track (bits flags,
  251.       filecore_disc_address disc_addr,
  252.       filecore_track_format *track_format);
  253. extern void ramfsdiscop_format_track (bits flags,
  254.       filecore_disc_address disc_addr,
  255.       filecore_track_format *track_format);
  256.  
  257. /* ------------------------------------------------------------------------
  258.  * Function:      ramfsdiscop_seek()
  259.  *
  260.  * Description:   Seeks to a disc location
  261.  *
  262.  * Input:         flags - value of R1 on entry
  263.  *                disc_addr - value of R2 on entry
  264.  *
  265.  * Other notes:   Calls SWI 0x40780 with R1 |= 0x5.
  266.  */
  267.  
  268. extern os_error *xramfsdiscop_seek (bits flags,
  269.       filecore_disc_address disc_addr);
  270. extern void ramfsdiscop_seek (bits flags,
  271.       filecore_disc_address disc_addr);
  272.  
  273. /* ------------------------------------------------------------------------
  274.  * Function:      ramfsdiscop_restore()
  275.  *
  276.  * Description:   Does a restore operation for a disc
  277.  *
  278.  * Input:         flags - value of R1 on entry
  279.  *                disc_addr - value of R2 on entry
  280.  *
  281.  * Other notes:   Calls SWI 0x40780 with R1 |= 0x6.
  282.  */
  283.  
  284. extern os_error *xramfsdiscop_restore (bits flags,
  285.       filecore_disc_address disc_addr);
  286. extern void ramfsdiscop_restore (bits flags,
  287.       filecore_disc_address disc_addr);
  288.  
  289. /* ------------------------------------------------------------------------
  290.  * Function:      ramfsdiscop_step_in()
  291.  *
  292.  * Description:   Steps a floppy disc in one track
  293.  *
  294.  * Input:         flags - value of R1 on entry
  295.  *
  296.  * Other notes:   Calls SWI 0x40780 with R1 |= 0x7.
  297.  */
  298.  
  299. extern os_error *xramfsdiscop_step_in (bits flags);
  300. extern void ramfsdiscop_step_in (bits flags);
  301.  
  302. /* ------------------------------------------------------------------------
  303.  * Function:      ramfsdiscop_step_out()
  304.  *
  305.  * Description:   Steps a floppy disc out one track
  306.  *
  307.  * Input:         flags - value of R1 on entry
  308.  *
  309.  * Other notes:   Calls SWI 0x40780 with R1 |= 0x8.
  310.  */
  311.  
  312. extern os_error *xramfsdiscop_step_out (bits flags);
  313. extern void ramfsdiscop_step_out (bits flags);
  314.  
  315. /* ------------------------------------------------------------------------
  316.  * Function:      ramfsdiscop_read_sectors_via_cache()
  317.  *
  318.  * Description:   Reads sectors of a disc using the RMA cache
  319.  *
  320.  * Input:         flags - value of R1 on entry
  321.  *                disc_addr - value of R2 on entry
  322.  *                data - value of R3 on entry
  323.  *                size - value of R4 on entry
  324.  *                cache_handle - value of R6 on entry
  325.  *
  326.  * Output:        next_disc_addr - value of R2 on exit
  327.  *                next_data - value of R3 on exit
  328.  *                unread - value of R4 on exit (X version only)
  329.  *                cache_handle_out - value of R6 on exit
  330.  *
  331.  * Returns:       R4 (non-X version only)
  332.  *
  333.  * Other notes:   Calls SWI 0x40780 with R1 |= 0x9.
  334.  */
  335.  
  336. extern os_error *xramfsdiscop_read_sectors_via_cache (bits flags,
  337.       filecore_disc_address disc_addr,
  338.       byte *data,
  339.       int size,
  340.       int cache_handle,
  341.       filecore_disc_address *next_disc_addr,
  342.       byte **next_data,
  343.       int *unread,
  344.       int *cache_handle_out);
  345. extern int ramfsdiscop_read_sectors_via_cache (bits flags,
  346.       filecore_disc_address disc_addr,
  347.       byte *data,
  348.       int size,
  349.       int cache_handle,
  350.       filecore_disc_address *next_disc_addr,
  351.       byte **next_data,
  352.       int *cache_handle_out);
  353.  
  354. /* ------------------------------------------------------------------------
  355.  * Function:      ramfsdiscop_specify()
  356.  *
  357.  * Description:   Does a specify operation on a hard disc
  358.  *
  359.  * Input:         flags - value of R1 on entry
  360.  *                disc_addr - value of R2 on entry
  361.  *
  362.  * Other notes:   Calls SWI 0x40780 with R1 |= 0xF.
  363.  */
  364.  
  365. extern os_error *xramfsdiscop_specify (bits flags,
  366.       filecore_disc_address disc_addr);
  367. extern void ramfsdiscop_specify (bits flags,
  368.       filecore_disc_address disc_addr);
  369.  
  370. /* ------------------------------------------------------------------------
  371.  * Function:      ramfs_drives()
  372.  *
  373.  * Description:   Returns information on RamFS' drives
  374.  *
  375.  * Output:        default_drive - value of R0 on exit
  376.  *                floppy_count - value of R1 on exit
  377.  *                hard_disc_count - value of R2 on exit
  378.  *
  379.  * Other notes:   Calls SWI 0x40782.
  380.  */
  381.  
  382. extern os_error *xramfs_drives (int *default_drive,
  383.       int *floppy_count,
  384.       int *hard_disc_count);
  385. extern void ramfs_drives (int *default_drive,
  386.       int *floppy_count,
  387.       int *hard_disc_count);
  388.  
  389. /* ------------------------------------------------------------------------
  390.  * Function:      ramfs_free_space()
  391.  *
  392.  * Description:   Returns information on a disc's free space
  393.  *
  394.  * Input:         disc_name - value of R0 on entry
  395.  *
  396.  * Output:        free - value of R0 on exit (X version only)
  397.  *                max - value of R1 on exit
  398.  *
  399.  * Returns:       R0 (non-X version only)
  400.  *
  401.  * Other notes:   Calls SWI 0x40783.
  402.  */
  403.  
  404. extern os_error *xramfs_free_space (char *disc_name,
  405.       int *free,
  406.       int *max);
  407. extern int ramfs_free_space (char *disc_name,
  408.       int *max);
  409.  
  410. /* ------------------------------------------------------------------------
  411.  * Function:      ramfs_describe_disc()
  412.  *
  413.  * Description:   Returns a disc record describing a disc's shape and
  414.  *                format
  415.  *
  416.  * Input:         disc_name - value of R0 on entry
  417.  *                disc - value of R1 on entry
  418.  *
  419.  * Other notes:   Calls SWI 0x40785.
  420.  */
  421.  
  422. extern os_error *xramfs_describe_disc (char *disc_name,
  423.       filecore_disc *disc);
  424. extern void ramfs_describe_disc (char *disc_name,
  425.       filecore_disc *disc);
  426.  
  427. #ifdef __cplusplus
  428.    }
  429. #endif
  430.  
  431. #endif
  432.