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

  1. #ifndef filecore_H
  2. #define filecore_H
  3.  
  4. /* C header file for FileCore
  5.  * written by DefMod (Sep 16 1994) on Thu Sep 22 16:40:24 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. /**********************************
  24.  * SWI names and SWI reason codes *
  25.  **********************************/
  26. #undef  FileCore_DiscOp
  27. #define FileCore_DiscOp                         0x40540
  28. #undef  XFileCore_DiscOp
  29. #define XFileCore_DiscOp                        0x60540
  30. #undef  FileCoreDiscOp_Verify
  31. #define FileCoreDiscOp_Verify                   0x0
  32. #undef  FileCoreDiscOp_ReadSectors
  33. #define FileCoreDiscOp_ReadSectors              0x1
  34. #undef  FileCoreDiscOp_WriteSectors
  35. #define FileCoreDiscOp_WriteSectors             0x2
  36. #undef  FileCoreDiscOp_ReadTrack
  37. #define FileCoreDiscOp_ReadTrack                0x3
  38. #undef  FileCoreDiscOp_ReadId
  39. #define FileCoreDiscOp_ReadId                   0x3
  40. #undef  FileCoreDiscOp_WriteTrack
  41. #define FileCoreDiscOp_WriteTrack               0x4
  42. #undef  FileCoreDiscOp_FormatTrack
  43. #define FileCoreDiscOp_FormatTrack              0x4
  44. #undef  FileCoreDiscOp_Seek
  45. #define FileCoreDiscOp_Seek                     0x5
  46. #undef  FileCoreDiscOp_Restore
  47. #define FileCoreDiscOp_Restore                  0x6
  48. #undef  FileCoreDiscOp_StepIn
  49. #define FileCoreDiscOp_StepIn                   0x7
  50. #undef  FileCoreDiscOp_StepOut
  51. #define FileCoreDiscOp_StepOut                  0x8
  52. #undef  FileCoreDiscOp_ReadSectorsViaCache
  53. #define FileCoreDiscOp_ReadSectorsViaCache      0x9
  54. #undef  FileCoreDiscOp_Specify
  55. #define FileCoreDiscOp_Specify                  0xF
  56. #undef  FileCore_Create
  57. #define FileCore_Create                         0x40541
  58. #undef  XFileCore_Create
  59. #define XFileCore_Create                        0x60541
  60. #undef  FileCore_Drives
  61. #define FileCore_Drives                         0x40542
  62. #undef  XFileCore_Drives
  63. #define XFileCore_Drives                        0x60542
  64. #undef  FileCore_FreeSpace
  65. #define FileCore_FreeSpace                      0x40543
  66. #undef  XFileCore_FreeSpace
  67. #define XFileCore_FreeSpace                     0x60543
  68. #undef  FileCore_FloppyStructure
  69. #define FileCore_FloppyStructure                0x40544
  70. #undef  XFileCore_FloppyStructure
  71. #define XFileCore_FloppyStructure               0x60544
  72. #undef  FileCore_DescribeDisc
  73. #define FileCore_DescribeDisc                   0x40545
  74. #undef  XFileCore_DescribeDisc
  75. #define XFileCore_DescribeDisc                  0x60545
  76. #undef  FileCore_DiscardReadSectorsCache
  77. #define FileCore_DiscardReadSectorsCache        0x40546
  78. #undef  XFileCore_DiscardReadSectorsCache
  79. #define XFileCore_DiscardReadSectorsCache       0x60546
  80. #undef  FileCore_DiscFormat
  81. #define FileCore_DiscFormat                     0x40547
  82. #undef  XFileCore_DiscFormat
  83. #define XFileCore_DiscFormat                    0x60547
  84. #undef  FileCore_LayoutStructure
  85. #define FileCore_LayoutStructure                0x40548
  86. #undef  XFileCore_LayoutStructure
  87. #define XFileCore_LayoutStructure               0x60548
  88. #undef  FileCore_MiscOp
  89. #define FileCore_MiscOp                         0x40549
  90. #undef  XFileCore_MiscOp
  91. #define XFileCore_MiscOp                        0x60549
  92. #undef  FileCoreMiscOp_Mount
  93. #define FileCoreMiscOp_Mount                    0x0
  94. #undef  FileCoreMiscOp_PollChanged
  95. #define FileCoreMiscOp_PollChanged              0x1
  96. #undef  FileCoreMiscOp_LockDrive
  97. #define FileCoreMiscOp_LockDrive                0x2
  98. #undef  FileCoreMiscOp_UnlockDrive
  99. #define FileCoreMiscOp_UnlockDrive              0x3
  100. #undef  FileCoreMiscOp_PollPeriod
  101. #define FileCoreMiscOp_PollPeriod               0x4
  102. #undef  FileCoreMiscOp_EjectDisc
  103. #define FileCoreMiscOp_EjectDisc                0x5
  104. #undef  Service_IdentifyDisc
  105. #define Service_IdentifyDisc                    0x69
  106.  
  107. /************************************
  108.  * Structure and union declarations *
  109.  ************************************/
  110. typedef struct filecore_descriptor              filecore_descriptor;
  111. typedef struct filecore_disc                    filecore_disc;
  112. typedef struct filecore_format                  filecore_format;
  113. typedef struct filecore_track_format            filecore_track_format;
  114. typedef struct filecore_defect_list             filecore_defect_list;
  115.  
  116. /********************
  117.  * Type definitions *
  118.  ********************/
  119. struct filecore_descriptor
  120.    {  byte flags [3];
  121.       byte fs_no;
  122.       int title_offset;
  123.       int boot_text_offset;
  124.       int disc_op_offset;
  125.       int misc_op_offset;
  126.    };
  127.  
  128. struct filecore_disc
  129.    {  byte log2secsize;
  130.       byte secspertrack;
  131.       byte heads;
  132.       byte density;
  133.       byte idlen;
  134.       byte log2bpmb;
  135.       byte skew;
  136.       byte bootoption;
  137.       byte lowsector;
  138.       byte nzones;
  139.       short zone_spare;
  140.       int root;
  141.       int disc_size;
  142.       short disc_id;
  143.       char disc_name [10];
  144.       int disctype;
  145.       byte reserved [24];
  146.    };
  147.  
  148. typedef bits filecore_disc_address;
  149.  
  150. struct filecore_format
  151.    {  int sector_size;
  152.       int gap1_side0;
  153.       int gap1_side1;
  154.       int gap3;
  155.       byte secspertrack;
  156.       byte density;
  157.       byte options;
  158.       byte lowsector;
  159.       byte interleave;
  160.       byte side_skew;
  161.       byte track_skew;
  162.       byte sector_fill;
  163.       int track_count;
  164.       byte reserved [36];
  165.    };
  166.  
  167. struct filecore_track_format
  168.    {  int sector_size;
  169.       int gap1_side0;
  170.       int gap1_side1;
  171.       int gap3;
  172.       byte secspertrack;
  173.       byte density;
  174.       byte options;
  175.       byte sector_fill;
  176.       int track_count;
  177.       byte reserved [12];
  178.       bits sectors [UNKNOWN];
  179.    };
  180.  
  181. #define filecore_TRACK_FORMAT(N) \
  182.    struct \
  183.       {  int sector_size; \
  184.          int gap1_side0; \
  185.          int gap1_side1; \
  186.          int gap3; \
  187.          byte secspertrack; \
  188.          byte density; \
  189.          byte options; \
  190.          byte sector_fill; \
  191.          int track_count; \
  192.          byte reserved [12]; \
  193.          bits sectors [N]; \
  194.       }
  195.  
  196. #define filecore_SIZEOF_TRACK_FORMAT(N) \
  197.    (offsetof (filecore_track_format, sectors) + \
  198.          (N)*sizeof ((filecore_track_format *) NULL)->sectors)
  199.  
  200. struct filecore_defect_list
  201.    {  int defect [UNKNOWN];
  202.    };
  203.  
  204. #define filecore_DEFECT_LIST(N) \
  205.    struct \
  206.       {  int defect [N]; \
  207.       }
  208.  
  209. #define filecore_SIZEOF_DEFECT_LIST(N) \
  210.    ((N)*sizeof ((filecore_defect_list *) NULL)->defect)
  211.  
  212. /************************
  213.  * Constant definitions *
  214.  ************************/
  215. #define filecore_HARD_DISCS_NEED_FIQ            0x1u
  216. #define filecore_FLOPPIES_NEED_FIQ              0x2u
  217. #define filecore_USE_SCRATCH_FOR_TEMPORARY      0x8u
  218. #define filecore_HARD_DISCS_CAN_MOUNT           0x10u
  219. #define filecore_HARD_DISCS_CAN_POLL_CHANGE     0x20u
  220. #define filecore_FLOPPIES_CAN_EJECT             0x40u
  221. #define filecore_HARD_DISCS_CAN_EJECT           0x100u
  222. #define filecore_LOW_SECTOR_SEQUENCE_SIDES      0x40u
  223. #define filecore_LOW_SECTOR_DOUBLE_STEP         0x80u
  224. #define filecore_DISC_ADDRESS_OFFSET            0x1FFFFFFFu
  225. #define filecore_DISC_ADDRESS_DRIVE             0xE0000000u
  226. #define filecore_DISC_ADDRESS_OFFSET_SHIFT      0
  227. #define filecore_DISC_ADDRESS_DRIVE_SHIFT       29
  228. #define filecore_DISC_OP_GIVEN_ALTERNATIVE_DEFECT_LIST 0x10u
  229. #define filecore_DISC_OP_GIVEN_SECTOR_LIST      0x20u
  230. #define filecore_DISC_OP_IGNORE_ESCAPE          0x40u
  231. #define filecore_DISC_OP_IGNORE_TIMEOUT         0x80u
  232. #define filecore_DISC_OP_ALTERNATIVE_RECORD     0xFFFFFF00u
  233. #define filecore_DISC_OP_ALTERNATIVE_RECORD_SHIFT 6
  234. #define filecore_CREATE_FLOPPY_COUNT            0xFFu
  235. #define filecore_CREATE_FLOPPY_COUNT_SHIFT      0
  236. #define filecore_CREATE_HARD_DISC_COUNT         0xFF00u
  237. #define filecore_CREATE_HARD_DISC_COUNT_SHIFT   8
  238. #define filecore_CREATE_DEFAULT_DRIVE           0xFF0000u
  239. #define filecore_CREATE_DEFAULT_DRIVE_SHIFT     16
  240. #define filecore_CREATE_NO_DIR_STATE            0x40000000u
  241. #define filecore_FLOPPY_OLD_STRUCTURE           0x80u
  242. #define filecore_FLOPPY_OLD_MAP                 0x100u
  243. #define filecore_FORMATL                        128
  244. #define filecore_FORMATD                        129
  245. #define filecore_FORMATE                        130
  246. #define filecore_FORMATF                        131
  247. #define filecore_POLL_NOT_CHANGED               0x1u
  248. #define filecore_POLL_MAY_BE_CHANGED            0x2u
  249. #define filecore_POLL_CHANGED                   0x4u
  250. #define filecore_POLL_EMPTY                     0x8u
  251. #define filecore_POLL_READY                     0x10u
  252. #define filecore_POLL_FORTY_TRACK               0x20u
  253. #define filecore_POLL_EMPTY_WORKS               0x40u
  254. #define filecore_POLL_CHANGED_WORKS             0x80u
  255. #define filecore_POLL_HIGH_DENSITY              0x100u
  256. #define filecore_POLL_DENSITY_SENSE_WORKS       0x200u
  257. #define filecore_POLL_READY_WORKS               0x400u
  258.  
  259. /*************************
  260.  * Function declarations *
  261.  *************************/
  262.  
  263. #ifdef __cplusplus
  264.    extern "C" {
  265. #endif
  266.  
  267. /*************************************************************
  268.  * NOTE: The following functions provide direct access to    *
  269.  *       the SWI's noted in the function description.        *
  270.  *       Please read the relevant PRM section for more       *
  271.  *       information on their input/output parameters.       *
  272.  *************************************************************/
  273.  
  274. /* ------------------------------------------------------------------------
  275.  * Function:      filecorediscop_verify()
  276.  *
  277.  * Description:   Verifies a disc
  278.  *
  279.  * Input:         flags - value of R1 on entry
  280.  *                disc_addr - value of R2 on entry
  281.  *                size - value of R4 on entry
  282.  *                instance - value of R8 on entry
  283.  *
  284.  * Output:        next_disc_addr - value of R2 on exit
  285.  *                unverified - value of R4 on exit (X version only)
  286.  *
  287.  * Returns:       R4 (non-X version only)
  288.  *
  289.  * Other notes:   Calls SWI 0x40540 with R1 |= 0x0.
  290.  */
  291.  
  292. extern os_error *xfilecorediscop_verify (bits flags,
  293.       filecore_disc_address disc_addr,
  294.       int size,
  295.       void *instance,
  296.       filecore_disc_address *next_disc_addr,
  297.       int *unverified);
  298. extern int filecorediscop_verify (bits flags,
  299.       filecore_disc_address disc_addr,
  300.       int size,
  301.       void *instance,
  302.       filecore_disc_address *next_disc_addr);
  303.  
  304. /* ------------------------------------------------------------------------
  305.  * Function:      filecorediscop_read_sectors()
  306.  *
  307.  * Description:   Reads sectors from a disc
  308.  *
  309.  * Input:         flags - value of R1 on entry
  310.  *                disc_addr - value of R2 on entry
  311.  *                data - value of R3 on entry
  312.  *                size - value of R4 on entry
  313.  *                instance - value of R8 on entry
  314.  *
  315.  * Output:        next_disc_addr - value of R2 on exit
  316.  *                next_data - value of R3 on exit
  317.  *                unread - value of R4 on exit (X version only)
  318.  *
  319.  * Returns:       R4 (non-X version only)
  320.  *
  321.  * Other notes:   Calls SWI 0x40540 with R1 |= 0x1.
  322.  */
  323.  
  324. extern os_error *xfilecorediscop_read_sectors (bits flags,
  325.       filecore_disc_address disc_addr,
  326.       byte *data,
  327.       int size,
  328.       void *instance,
  329.       filecore_disc_address *next_disc_addr,
  330.       byte **next_data,
  331.       int *unread);
  332. extern int filecorediscop_read_sectors (bits flags,
  333.       filecore_disc_address disc_addr,
  334.       byte *data,
  335.       int size,
  336.       void *instance,
  337.       filecore_disc_address *next_disc_addr,
  338.       byte **next_data);
  339.  
  340. /* ------------------------------------------------------------------------
  341.  * Function:      filecorediscop_write_sectors()
  342.  *
  343.  * Description:   Writes sectors to a disc
  344.  *
  345.  * Input:         flags - value of R1 on entry
  346.  *                disc_addr - value of R2 on entry
  347.  *                data - value of R3 on entry
  348.  *                size - value of R4 on entry
  349.  *                instance - value of R8 on entry
  350.  *
  351.  * Output:        next_disc_addr - value of R2 on exit
  352.  *                next_data - value of R3 on exit
  353.  *                unwritten - value of R4 on exit (X version only)
  354.  *
  355.  * Returns:       R4 (non-X version only)
  356.  *
  357.  * Other notes:   Calls SWI 0x40540 with R1 |= 0x2.
  358.  */
  359.  
  360. extern os_error *xfilecorediscop_write_sectors (bits flags,
  361.       filecore_disc_address disc_addr,
  362.       byte *data,
  363.       int size,
  364.       void *instance,
  365.       filecore_disc_address *next_disc_addr,
  366.       byte **next_data,
  367.       int *unwritten);
  368. extern int filecorediscop_write_sectors (bits flags,
  369.       filecore_disc_address disc_addr,
  370.       byte *data,
  371.       int size,
  372.       void *instance,
  373.       filecore_disc_address *next_disc_addr,
  374.       byte **next_data);
  375.  
  376. /* ------------------------------------------------------------------------
  377.  * Function:      filecorediscop_read_track()
  378.  *
  379.  * Description:   Reads a track from a floppy disc
  380.  *
  381.  * Input:         flags - value of R1 on entry
  382.  *                disc_addr - value of R2 on entry
  383.  *                data - value of R3 on entry
  384.  *                instance - value of R8 on entry
  385.  *
  386.  * Other notes:   Calls SWI 0x40540 with R1 |= 0x3.
  387.  */
  388.  
  389. extern os_error *xfilecorediscop_read_track (bits flags,
  390.       filecore_disc_address disc_addr,
  391.       byte *data,
  392.       void *instance);
  393. extern void filecorediscop_read_track (bits flags,
  394.       filecore_disc_address disc_addr,
  395.       byte *data,
  396.       void *instance);
  397.  
  398. /* ------------------------------------------------------------------------
  399.  * Function:      filecorediscop_read_id()
  400.  *
  401.  * Description:   Reads a hard disc ID
  402.  *
  403.  * Input:         flags - value of R1 on entry
  404.  *                disc_addr - value of R2 on entry
  405.  *                data - value of R3 on entry
  406.  *                instance - value of R8 on entry
  407.  *
  408.  * Other notes:   Calls SWI 0x40540 with R1 |= 0x3.
  409.  */
  410.  
  411. extern os_error *xfilecorediscop_read_id (bits flags,
  412.       filecore_disc_address disc_addr,
  413.       byte *data,
  414.       void *instance);
  415. extern void filecorediscop_read_id (bits flags,
  416.       filecore_disc_address disc_addr,
  417.       byte *data,
  418.       void *instance);
  419.  
  420. /* ------------------------------------------------------------------------
  421.  * Function:      filecorediscop_write_track()
  422.  *
  423.  * Description:   Writes a track to a disc
  424.  *
  425.  * Input:         flags - value of R1 on entry
  426.  *                disc_addr - value of R2 on entry
  427.  *                data - value of R3 on entry
  428.  *                instance - value of R8 on entry
  429.  *
  430.  * Other notes:   Calls SWI 0x40540 with R1 |= 0x4.
  431.  */
  432.  
  433. extern os_error *xfilecorediscop_write_track (bits flags,
  434.       filecore_disc_address disc_addr,
  435.       byte *data,
  436.       void *instance);
  437. extern void filecorediscop_write_track (bits flags,
  438.       filecore_disc_address disc_addr,
  439.       byte *data,
  440.       void *instance);
  441.  
  442. /* ------------------------------------------------------------------------
  443.  * Function:      filecorediscop_format_track()
  444.  *
  445.  * Description:   Formats a track of a disc
  446.  *
  447.  * Input:         flags - value of R1 on entry
  448.  *                disc_addr - value of R2 on entry
  449.  *                track_format - value of R4 on entry
  450.  *                instance - value of R8 on entry
  451.  *
  452.  * Other notes:   Calls SWI 0x40540 with R1 |= 0x4, R3 = 0x0.
  453.  */
  454.  
  455. extern os_error *xfilecorediscop_format_track (bits flags,
  456.       filecore_disc_address disc_addr,
  457.       filecore_track_format *track_format,
  458.       void *instance);
  459. extern void filecorediscop_format_track (bits flags,
  460.       filecore_disc_address disc_addr,
  461.       filecore_track_format *track_format,
  462.       void *instance);
  463.  
  464. /* ------------------------------------------------------------------------
  465.  * Function:      filecorediscop_seek()
  466.  *
  467.  * Description:   Seeks to a disc location
  468.  *
  469.  * Input:         flags - value of R1 on entry
  470.  *                disc_addr - value of R2 on entry
  471.  *                instance - value of R8 on entry
  472.  *
  473.  * Other notes:   Calls SWI 0x40540 with R1 |= 0x5.
  474.  */
  475.  
  476. extern os_error *xfilecorediscop_seek (bits flags,
  477.       filecore_disc_address disc_addr,
  478.       void *instance);
  479. extern void filecorediscop_seek (bits flags,
  480.       filecore_disc_address disc_addr,
  481.       void *instance);
  482.  
  483. /* ------------------------------------------------------------------------
  484.  * Function:      filecorediscop_restore()
  485.  *
  486.  * Description:   Does a restore operation for a disc
  487.  *
  488.  * Input:         flags - value of R1 on entry
  489.  *                disc_addr - value of R2 on entry
  490.  *                instance - value of R8 on entry
  491.  *
  492.  * Other notes:   Calls SWI 0x40540 with R1 |= 0x6.
  493.  */
  494.  
  495. extern os_error *xfilecorediscop_restore (bits flags,
  496.       filecore_disc_address disc_addr,
  497.       void *instance);
  498. extern void filecorediscop_restore (bits flags,
  499.       filecore_disc_address disc_addr,
  500.       void *instance);
  501.  
  502. /* ------------------------------------------------------------------------
  503.  * Function:      filecorediscop_step_in()
  504.  *
  505.  * Description:   Steps a floppy disc in one track
  506.  *
  507.  * Input:         flags - value of R1 on entry
  508.  *                instance - value of R8 on entry
  509.  *
  510.  * Other notes:   Calls SWI 0x40540 with R1 |= 0x7.
  511.  */
  512.  
  513. extern os_error *xfilecorediscop_step_in (bits flags,
  514.       void *instance);
  515. extern void filecorediscop_step_in (bits flags,
  516.       void *instance);
  517.  
  518. /* ------------------------------------------------------------------------
  519.  * Function:      filecorediscop_step_out()
  520.  *
  521.  * Description:   Steps a floppy disc out one track
  522.  *
  523.  * Input:         flags - value of R1 on entry
  524.  *                instance - value of R8 on entry
  525.  *
  526.  * Other notes:   Calls SWI 0x40540 with R1 |= 0x8.
  527.  */
  528.  
  529. extern os_error *xfilecorediscop_step_out (bits flags,
  530.       void *instance);
  531. extern void filecorediscop_step_out (bits flags,
  532.       void *instance);
  533.  
  534. /* ------------------------------------------------------------------------
  535.  * Function:      filecorediscop_read_sectors_via_cache()
  536.  *
  537.  * Description:   Reads sectors of a disc using the RMA cache
  538.  *
  539.  * Input:         flags - value of R1 on entry
  540.  *                disc_addr - value of R2 on entry
  541.  *                data - value of R3 on entry
  542.  *                size - value of R4 on entry
  543.  *                cache_handle - value of R6 on entry
  544.  *                instance - value of R8 on entry
  545.  *
  546.  * Output:        next_disc_addr - value of R2 on exit
  547.  *                next_data - value of R3 on exit
  548.  *                unread - value of R4 on exit (X version only)
  549.  *                cache_handle_out - value of R6 on exit
  550.  *
  551.  * Returns:       R4 (non-X version only)
  552.  *
  553.  * Other notes:   Calls SWI 0x40540 with R1 |= 0x9.
  554.  */
  555.  
  556. extern os_error *xfilecorediscop_read_sectors_via_cache (bits flags,
  557.       filecore_disc_address disc_addr,
  558.       byte *data,
  559.       int size,
  560.       int cache_handle,
  561.       void *instance,
  562.       filecore_disc_address *next_disc_addr,
  563.       byte **next_data,
  564.       int *unread,
  565.       int *cache_handle_out);
  566. extern int filecorediscop_read_sectors_via_cache (bits flags,
  567.       filecore_disc_address disc_addr,
  568.       byte *data,
  569.       int size,
  570.       int cache_handle,
  571.       void *instance,
  572.       filecore_disc_address *next_disc_addr,
  573.       byte **next_data,
  574.       int *cache_handle_out);
  575.  
  576. /* ------------------------------------------------------------------------
  577.  * Function:      filecorediscop_specify()
  578.  *
  579.  * Description:   Does a specify operation on a hard disc
  580.  *
  581.  * Input:         flags - value of R1 on entry
  582.  *                disc_addr - value of R2 on entry
  583.  *                instance - value of R8 on entry
  584.  *
  585.  * Other notes:   Calls SWI 0x40540 with R1 |= 0xF.
  586.  */
  587.  
  588. extern os_error *xfilecorediscop_specify (bits flags,
  589.       filecore_disc_address disc_addr,
  590.       void *instance);
  591. extern void filecorediscop_specify (bits flags,
  592.       filecore_disc_address disc_addr,
  593.       void *instance);
  594.  
  595. /* ------------------------------------------------------------------------
  596.  * Function:      filecore_create()
  597.  *
  598.  * Description:   Creates a new instantiation of an ADFS-like filing system
  599.  *
  600.  * Input:         descriptor - value of R0 on entry
  601.  *                module_base - value of R1 on entry
  602.  *                word - value of R2 on entry
  603.  *                options - value of R3 on entry
  604.  *                dir_cache_size - value of R4 on entry
  605.  *                file_cache_buffer_count - value of R5 on entry
  606.  *                map_sizes - value of R6 on entry
  607.  *
  608.  * Output:        instance - value of R0 on exit
  609.  *                floppy_done - value of R1 on exit
  610.  *                hard_disc_done - value of R2 on exit
  611.  *                release_fiq - value of R3 on exit
  612.  *
  613.  * Other notes:   Calls SWI 0x40541.
  614.  */
  615.  
  616. extern os_error *xfilecore_create (filecore_descriptor *descriptor,
  617.       byte *module_base,
  618.       byte *word,
  619.       bits options,
  620.       int dir_cache_size,
  621.       int file_cache_buffer_count,
  622.       bits map_sizes,
  623.       void **instance,
  624.       void **floppy_done,
  625.       void **hard_disc_done,
  626.       void **release_fiq);
  627. extern void filecore_create (filecore_descriptor *descriptor,
  628.       byte *module_base,
  629.       byte *word,
  630.       bits options,
  631.       int dir_cache_size,
  632.       int file_cache_buffer_count,
  633.       bits map_sizes,
  634.       void **instance,
  635.       void **floppy_done,
  636.       void **hard_disc_done,
  637.       void **release_fiq);
  638.  
  639. /* ------------------------------------------------------------------------
  640.  * Function:      filecore_drives()
  641.  *
  642.  * Description:   Returns information on a filing system's drives
  643.  *
  644.  * Input:         instance - value of R8 on entry
  645.  *
  646.  * Output:        default_drive - value of R0 on exit
  647.  *                floppy_count - value of R1 on exit
  648.  *                hard_disc_count - value of R2 on exit
  649.  *
  650.  * Other notes:   Calls SWI 0x40542.
  651.  */
  652.  
  653. extern os_error *xfilecore_drives (void *instance,
  654.       int *default_drive,
  655.       int *floppy_count,
  656.       int *hard_disc_count);
  657. extern void filecore_drives (void *instance,
  658.       int *default_drive,
  659.       int *floppy_count,
  660.       int *hard_disc_count);
  661.  
  662. /* ------------------------------------------------------------------------
  663.  * Function:      filecore_free_space()
  664.  *
  665.  * Description:   Returns information on a disc's free space
  666.  *
  667.  * Input:         disc_name - value of R0 on entry
  668.  *                instance - value of R8 on entry
  669.  *
  670.  * Output:        free - value of R0 on exit (X version only)
  671.  *                max - value of R1 on exit
  672.  *
  673.  * Returns:       R0 (non-X version only)
  674.  *
  675.  * Other notes:   Calls SWI 0x40543.
  676.  */
  677.  
  678. extern os_error *xfilecore_free_space (char *disc_name,
  679.       void *instance,
  680.       int *free,
  681.       int *max);
  682. extern int filecore_free_space (char *disc_name,
  683.       void *instance,
  684.       int *max);
  685.  
  686. /* ------------------------------------------------------------------------
  687.  * Function:      filecore_floppy_structure()
  688.  *
  689.  * Description:   Creates a RAM image of a floppy disc map and root
  690.  *                directory entry
  691.  *
  692.  * Input:         buffer - value of R0 on entry
  693.  *                disc - value of R1 on entry
  694.  *                flags - value of R2 on entry
  695.  *                defect_list - value of R3 on entry
  696.  *
  697.  * Output:        used - value of R3 on exit
  698.  *
  699.  * Other notes:   Calls SWI 0x40544.
  700.  */
  701.  
  702. extern os_error *xfilecore_floppy_structure (byte *buffer,
  703.       filecore_disc *disc,
  704.       bits flags,
  705.       filecore_defect_list *defect_list,
  706.       int *used);
  707. extern void filecore_floppy_structure (byte *buffer,
  708.       filecore_disc *disc,
  709.       bits flags,
  710.       filecore_defect_list *defect_list,
  711.       int *used);
  712.  
  713. /* ------------------------------------------------------------------------
  714.  * Function:      filecore_describe_disc()
  715.  *
  716.  * Description:   Returns a disc record describing a disc's shape and
  717.  *                format
  718.  *
  719.  * Input:         disc_name - value of R0 on entry
  720.  *                disc - value of R1 on entry
  721.  *                instance - value of R8 on entry
  722.  *
  723.  * Other notes:   Calls SWI 0x40545.
  724.  */
  725.  
  726. extern os_error *xfilecore_describe_disc (char *disc_name,
  727.       filecore_disc *disc,
  728.       void *instance);
  729. extern void filecore_describe_disc (char *disc_name,
  730.       filecore_disc *disc,
  731.       void *instance);
  732.  
  733. /* ------------------------------------------------------------------------
  734.  * Function:      filecore_discard_read_sectors_cache()
  735.  *
  736.  * Description:   Discards the cache of read sectors created by
  737.  *                FileCoreDiscOp_ReadSectorsViaCache
  738.  *
  739.  * Input:         cache_handle - value of R6 on entry
  740.  *
  741.  * Other notes:   Calls SWI 0x40546.
  742.  */
  743.  
  744. extern os_error *xfilecore_discard_read_sectors_cache (int cache_handle);
  745. extern void filecore_discard_read_sectors_cache (int cache_handle);
  746.  
  747. /* ------------------------------------------------------------------------
  748.  * Function:      filecore_disc_format()
  749.  *
  750.  * Description:   Fills in a disc format structure with parameters for the
  751.  *                specified format
  752.  *
  753.  * Input:         buffer - value of R0 on entry
  754.  *                vet_format_swi - value of R1 on entry
  755.  *                vet_format_handle - value of R2 on entry
  756.  *                format - value of R3 on entry
  757.  *
  758.  * Other notes:   Calls SWI 0x40547.
  759.  */
  760.  
  761. extern os_error *xfilecore_disc_format (filecore_format *buffer,
  762.       int vet_format_swi,
  763.       int vet_format_handle,
  764.       int format);
  765. extern void filecore_disc_format (filecore_format *buffer,
  766.       int vet_format_swi,
  767.       int vet_format_handle,
  768.       int format);
  769.  
  770. /* ------------------------------------------------------------------------
  771.  * Function:      filecore_layout_structure()
  772.  *
  773.  * Description:   Lays out into the specified file a set of structures for
  774.  *                its format
  775.  *
  776.  * Input:         disc - value of R0 on entry
  777.  *                defect_list - value of R1 on entry
  778.  *                disc_name - value of R2 on entry
  779.  *                image_file - value of R3 on entry
  780.  *
  781.  * Other notes:   Calls SWI 0x40548.
  782.  */
  783.  
  784. extern os_error *xfilecore_layout_structure (filecore_disc *disc,
  785.       filecore_defect_list *defect_list,
  786.       char *disc_name,
  787.       os_f image_file);
  788. extern void filecore_layout_structure (filecore_disc *disc,
  789.       filecore_defect_list *defect_list,
  790.       char *disc_name,
  791.       os_f image_file);
  792.  
  793. /* ------------------------------------------------------------------------
  794.  * Function:      filecoremiscop_mount()
  795.  *
  796.  * Description:   Mounts a disc, reading in the data asked for
  797.  *
  798.  * Input:         drive_no - value of R1 on entry
  799.  *                disc_addr - value of R2 on entry
  800.  *                buffer - value of R3 on entry
  801.  *                size - value of R4 on entry
  802.  *                disc - value of R5 on entry
  803.  *                instance - value of R8 on entry
  804.  *
  805.  * Other notes:   Calls SWI 0x40549 with R0 = 0x0.
  806.  */
  807.  
  808. extern os_error *xfilecoremiscop_mount (int drive_no,
  809.       filecore_disc_address disc_addr,
  810.       byte *buffer,
  811.       int size,
  812.       filecore_disc *disc,
  813.       void *instance);
  814. extern void filecoremiscop_mount (int drive_no,
  815.       filecore_disc_address disc_addr,
  816.       byte *buffer,
  817.       int size,
  818.       filecore_disc *disc,
  819.       void *instance);
  820.  
  821. /* ------------------------------------------------------------------------
  822.  * Function:      filecoremiscop_poll_changed()
  823.  *
  824.  * Description:   Polls the sequence number for a drive
  825.  *
  826.  * Input:         drive_no - value of R1 on entry
  827.  *                sequence_no - value of R2 on entry
  828.  *                instance - value of R8 on entry
  829.  *
  830.  * Output:        sequence_no_out - value of R2 on exit
  831.  *                result - value of R3 on exit
  832.  *
  833.  * Other notes:   Calls SWI 0x40549 with R0 = 0x1.
  834.  */
  835.  
  836. extern os_error *xfilecoremiscop_poll_changed (int drive_no,
  837.       int sequence_no,
  838.       void *instance,
  839.       int *sequence_no_out,
  840.       bits *result);
  841. extern void filecoremiscop_poll_changed (int drive_no,
  842.       int sequence_no,
  843.       void *instance,
  844.       int *sequence_no_out,
  845.       bits *result);
  846.  
  847. /* ------------------------------------------------------------------------
  848.  * Function:      filecoremiscop_lock_drive()
  849.  *
  850.  * Description:   Locks a disc in a floppy drive
  851.  *
  852.  * Input:         drive_no - value of R1 on entry
  853.  *                instance - value of R8 on entry
  854.  *
  855.  * Other notes:   Calls SWI 0x40549 with R0 = 0x2.
  856.  */
  857.  
  858. extern os_error *xfilecoremiscop_lock_drive (int drive_no,
  859.       void *instance);
  860. extern void filecoremiscop_lock_drive (int drive_no,
  861.       void *instance);
  862.  
  863. /* ------------------------------------------------------------------------
  864.  * Function:      filecoremiscop_unlock_drive()
  865.  *
  866.  * Description:   Unlocks a disc in a floppy drive
  867.  *
  868.  * Input:         drive_no - value of R1 on entry
  869.  *                instance - value of R8 on entry
  870.  *
  871.  * Other notes:   Calls SWI 0x40549 with R0 = 0x3.
  872.  */
  873.  
  874. extern os_error *xfilecoremiscop_unlock_drive (int drive_no,
  875.       void *instance);
  876. extern void filecoremiscop_unlock_drive (int drive_no,
  877.       void *instance);
  878.  
  879. /* ------------------------------------------------------------------------
  880.  * Function:      filecoremiscop_poll_period()
  881.  *
  882.  * Description:   Informs FileCore of the minimum period between polling
  883.  *                for disc insertion
  884.  *
  885.  * Input:         disc_name - value of R1 on entry
  886.  *                instance - value of R8 on entry
  887.  *
  888.  * Output:        poll_period - value of R5 on exit
  889.  *                media_type - value of R6 on exit
  890.  *
  891.  * Other notes:   Calls SWI 0x40549 with R0 = 0x4.
  892.  */
  893.  
  894. extern os_error *xfilecoremiscop_poll_period (char *disc_name,
  895.       void *instance,
  896.       int *poll_period,
  897.       char **media_type);
  898. extern void filecoremiscop_poll_period (char *disc_name,
  899.       void *instance,
  900.       int *poll_period,
  901.       char **media_type);
  902.  
  903. /* ------------------------------------------------------------------------
  904.  * Function:      filecoremiscop_eject_disc()
  905.  *
  906.  * Description:   Power-ejects the disc in the specified drive
  907.  *
  908.  * Input:         drive_no - value of R1 on entry
  909.  *                instance - value of R8 on entry
  910.  *
  911.  * Other notes:   Calls SWI 0x40549 with R0 = 0x5.
  912.  */
  913.  
  914. extern os_error *xfilecoremiscop_eject_disc (int drive_no,
  915.       void *instance);
  916. extern void filecoremiscop_eject_disc (int drive_no,
  917.       void *instance);
  918.  
  919. /* ------------------------------------------------------------------------
  920.  * Function:      service_identify_disc()
  921.  *
  922.  * Description:   Identifies disc format
  923.  *
  924.  * Input:         format_name - value of R2 on entry
  925.  *                size - value of R3 on entry
  926.  *                disc - value of R5 on entry
  927.  *                cache_handle - value of R6 on entry
  928.  *                instance - value of R8 on entry
  929.  *
  930.  * Output:        unclaimed - value of R1 on exit (X version only)
  931.  *                file_type - value of R2 on exit
  932.  *                cache_handle_out - value of R6 on exit
  933.  *
  934.  * Returns:       R1 (non-X version only)
  935.  *
  936.  * Other notes:   Calls SWI 0x30 with R1 = 0x69.
  937.  */
  938.  
  939. extern os_error *xservice_identify_disc (char *format_name,
  940.       int size,
  941.       filecore_disc *disc,
  942.       int cache_handle,
  943.       void *instance,
  944.       bool *unclaimed,
  945.       bits *file_type,
  946.       int *cache_handle_out);
  947. extern bool service_identify_disc (char *format_name,
  948.       int size,
  949.       filecore_disc *disc,
  950.       int cache_handle,
  951.       void *instance,
  952.       bits *file_type,
  953.       int *cache_handle_out);
  954.  
  955. #ifdef __cplusplus
  956.    }
  957. #endif
  958.  
  959. #endif
  960.