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

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