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

  1. #ifndef podule_H
  2. #define podule_H
  3.  
  4. /* C header file for Podule
  5.  * written by DefMod (Sep  7 1994) on Wed Sep  7 21:19:41 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  Podule_ReadID
  27. #define Podule_ReadID                           0x40280
  28. #undef  XPodule_ReadID
  29. #define XPodule_ReadID                          0x60280
  30. #undef  Podule_ReadHeader
  31. #define Podule_ReadHeader                       0x40281
  32. #undef  XPodule_ReadHeader
  33. #define XPodule_ReadHeader                      0x60281
  34. #undef  Podule_EnumerateChunks
  35. #define Podule_EnumerateChunks                  0x40282
  36. #undef  XPodule_EnumerateChunks
  37. #define XPodule_EnumerateChunks                 0x60282
  38. #undef  Podule_ReadChunk
  39. #define Podule_ReadChunk                        0x40283
  40. #undef  XPodule_ReadChunk
  41. #define XPodule_ReadChunk                       0x60283
  42. #undef  Podule_ReadBytes
  43. #define Podule_ReadBytes                        0x40284
  44. #undef  XPodule_ReadBytes
  45. #define XPodule_ReadBytes                       0x60284
  46. #undef  Podule_WriteBytes
  47. #define Podule_WriteBytes                       0x40285
  48. #undef  XPodule_WriteBytes
  49. #define XPodule_WriteBytes                      0x60285
  50. #undef  Podule_CallLoader
  51. #define Podule_CallLoader                       0x40286
  52. #undef  XPodule_CallLoader
  53. #define XPodule_CallLoader                      0x60286
  54. #undef  Podule_RawRead
  55. #define Podule_RawRead                          0x40287
  56. #undef  XPodule_RawRead
  57. #define XPodule_RawRead                         0x60287
  58. #undef  Podule_RawWrite
  59. #define Podule_RawWrite                         0x40288
  60. #undef  XPodule_RawWrite
  61. #define XPodule_RawWrite                        0x60288
  62. #undef  Podule_HardwareAddress
  63. #define Podule_HardwareAddress                  0x40289
  64. #undef  XPodule_HardwareAddress
  65. #define XPodule_HardwareAddress                 0x60289
  66. #undef  Podule_EnumerateChunksWithInfo
  67. #define Podule_EnumerateChunksWithInfo          0x4028A
  68. #undef  XPodule_EnumerateChunksWithInfo
  69. #define XPodule_EnumerateChunksWithInfo         0x6028A
  70. #undef  Podule_HardwareAddresses
  71. #define Podule_HardwareAddresses                0x4028B
  72. #undef  XPodule_HardwareAddresses
  73. #define XPodule_HardwareAddresses               0x6028B
  74. #undef  Podule_ReturnNumber
  75. #define Podule_ReturnNumber                     0x4028C
  76. #undef  XPodule_ReturnNumber
  77. #define XPodule_ReturnNumber                    0x6028C
  78. #undef  Podule_ReadInfo
  79. #define Podule_ReadInfo                         0x4028D
  80. #undef  XPodule_ReadInfo
  81. #define XPodule_ReadInfo                        0x6028D
  82. #undef  Podule_SetSpeed
  83. #define Podule_SetSpeed                         0x4028E
  84. #undef  XPodule_SetSpeed
  85. #define XPodule_SetSpeed                        0x6028E
  86. #undef  Service_PreReset
  87. #define Service_PreReset                        0x45
  88. #undef  Service_ADFSPodule
  89. #define Service_ADFSPodule                      0x10800
  90. #undef  Service_ADFSPoduleIDE
  91. #define Service_ADFSPoduleIDE                   0x10801
  92. #undef  Service_ADFSPoduleIDEDying
  93. #define Service_ADFSPoduleIDEDying              0x10802
  94.  
  95. /************************************
  96.  * Structure and union declarations *
  97.  ************************************/
  98. typedef struct podule_header                    podule_header;
  99.  
  100. /********************
  101.  * Type definitions *
  102.  ********************/
  103. struct podule_header
  104.    {  byte b [16];
  105.    };
  106.  
  107. /************************
  108.  * Constant definitions *
  109.  ************************/
  110. #define podule_SECTION_SYSTEM_ROM               (-1)
  111. #define podule_SECTION_EXPANSION_CARD0          0
  112. #define podule_SECTION_EXPANSION_CARD1          1
  113. #define podule_SECTION_EXPANSION_CARD2          2
  114. #define podule_SECTION_EXPANSION_CARD3          3
  115. #define podule_SECTION_EXTENSION_ROM1           (-2)
  116. #define error_PODULE_BAD_POD                    0x500u
  117. #define error_PODULE_BAD_SPEED                  0x501u
  118. #define error_PODULE_NO_POD                     0x502u
  119. #define error_PODULE_NOT_EXT                    0x503u
  120. #define error_PODULE_NOT_ACRN                   0x504u
  121. #define error_PODULE_NO_LDR                     0x505u
  122. #define error_PODULE_IN_LDR                     0x506u
  123. #define error_PODULE_BAD_CHNK                   0x507u
  124. #define error_PODULE_BAD_DEVICE_NUMBER          0x508u
  125. #define error_PODULE_BAD_DEVICE_TYPE            0x509u
  126. #define error_PODULE_RAM_CONFIG_SYNTAX          0x50Au
  127. #define error_PODULE_WRONG_PODULE_TYPE          0x50Bu
  128. #define error_PODULE_ROM_BOARD_SYNTAX           0x50Cu
  129. #define error_PODULE_BAD_READ                   0x50Du
  130. #define error_PODULE_BD_SPEED                   0x50Eu
  131. #define error_PODULE_NOT_EASI                   0x50Fu
  132. #define error_PODULE_SPEED_NO                   0x510u
  133. #define error_PODULE_EC_NO_SPD                  0x511u
  134. #define error_PODULE_EC_NO_NET                  0x512u
  135. #define error_PODULE_NDALLAS                    0x513u
  136. #define error_PODULE_NOT_WRITABLE               0x580u
  137. #define error_PODULE_ADDRESS_RANGE              0x581u
  138. #define error_PODULE_DEVICE_NOT_WRITABLE        0x582u
  139. #define error_PODULE_PODULE_READ_ONLY           0x583u
  140. #define error_PODULE_ADDRESS_TOO_BIG            0x584u
  141.  
  142. /*************************
  143.  * Function declarations *
  144.  *************************/
  145.  
  146. #ifdef __cplusplus
  147.    extern "C" {
  148. #endif
  149.  
  150. /*************************************************************
  151.  * NOTE: The following functions provide direct access to    *
  152.  *       the SWI's noted in the function description.        *
  153.  *       Please read the relevant PRM section for more       *
  154.  *       information on their input/output parameters.       *
  155.  *************************************************************/
  156.  
  157. /* ------------------------------------------------------------------------
  158.  * Function:      podule_read_id()
  159.  *
  160.  * Description:   Reads an expansion card or extension ROM's identity byte
  161.  *
  162.  * Input:         section - value of R3 on entry
  163.  *
  164.  * Output:        ec_id - value of R0 on exit (X version only)
  165.  *
  166.  * Returns:       R0 (non-X version only)
  167.  *
  168.  * Other notes:   Calls SWI 0x40280.
  169.  */
  170.  
  171. extern os_error *xpodule_read_id (int section,
  172.       int *ec_id);
  173. extern int podule_read_id (int section);
  174.  
  175. /* ------------------------------------------------------------------------
  176.  * Function:      podule_read_header()
  177.  *
  178.  * Description:   Reads an expansion card or extension ROM's header
  179.  *
  180.  * Input:         header - value of R2 on entry
  181.  *                section - value of R3 on entry
  182.  *
  183.  * Other notes:   Calls SWI 0x40281.
  184.  */
  185.  
  186. extern os_error *xpodule_read_header (podule_header *header,
  187.       int section);
  188. extern void podule_read_header (podule_header *header,
  189.       int section);
  190.  
  191. /* ------------------------------------------------------------------------
  192.  * Function:      podule_enumerate_chunks()
  193.  *
  194.  * Description:   Reads information about a chunk from the chunk directory
  195.  *
  196.  * Input:         context - value of R0 on entry
  197.  *                section - value of R3 on entry
  198.  *
  199.  * Output:        context_out - value of R0 on exit (X version only)
  200.  *                size - value of R1 on exit
  201.  *                os_id - value of R2 on exit
  202.  *                module_name - value of R4 on exit
  203.  *
  204.  * Returns:       R0 (non-X version only)
  205.  *
  206.  * Other notes:   Calls SWI 0x40282.
  207.  */
  208.  
  209. extern os_error *xpodule_enumerate_chunks (int context,
  210.       int section,
  211.       int *context_out,
  212.       int *size,
  213.       byte *os_id,
  214.       char **module_name);
  215. extern int podule_enumerate_chunks (int context,
  216.       int section,
  217.       int *size,
  218.       byte *os_id,
  219.       char **module_name);
  220.  
  221. /* ------------------------------------------------------------------------
  222.  * Function:      podule_read_chunk()
  223.  *
  224.  * Description:   Reads a chunk from an expansion card or extension ROM
  225.  *
  226.  * Input:         chunk_no - value of R0 on entry
  227.  *                buffer - value of R2 on entry
  228.  *                section - value of R3 on entry
  229.  *
  230.  * Other notes:   Calls SWI 0x40283.
  231.  */
  232.  
  233. extern os_error *xpodule_read_chunk (int chunk_no,
  234.       byte *buffer,
  235.       int section);
  236. extern void podule_read_chunk (int chunk_no,
  237.       byte *buffer,
  238.       int section);
  239.  
  240. /* ------------------------------------------------------------------------
  241.  * Function:      podule_read_bytes()
  242.  *
  243.  * Description:   Reads bytes from within an expansion card's code space
  244.  *
  245.  * Input:         start_offset - value of R0 on entry
  246.  *                size - value of R1 on entry
  247.  *                buffer - value of R2 on entry
  248.  *                slot_no - value of R3 on entry
  249.  *
  250.  * Other notes:   Calls SWI 0x40284.
  251.  */
  252.  
  253. extern os_error *xpodule_read_bytes (int start_offset,
  254.       int size,
  255.       byte *buffer,
  256.       int slot_no);
  257. extern void podule_read_bytes (int start_offset,
  258.       int size,
  259.       byte *buffer,
  260.       int slot_no);
  261.  
  262. /* ------------------------------------------------------------------------
  263.  * Function:      podule_write_bytes()
  264.  *
  265.  * Description:   Writes bytes to within an expansion card's code space
  266.  *
  267.  * Input:         start_offset - value of R0 on entry
  268.  *                size - value of R1 on entry
  269.  *                buffer - value of R2 on entry
  270.  *                slot_no - value of R3 on entry
  271.  *
  272.  * Other notes:   Calls SWI 0x40285.
  273.  */
  274.  
  275. extern os_error *xpodule_write_bytes (int start_offset,
  276.       int size,
  277.       byte *buffer,
  278.       int slot_no);
  279. extern void podule_write_bytes (int start_offset,
  280.       int size,
  281.       byte *buffer,
  282.       int slot_no);
  283.  
  284. /* ------------------------------------------------------------------------
  285.  * Function:      podule_call_loader()
  286.  *
  287.  * Description:   Calls an expansion card's loader
  288.  *
  289.  * Input:         arg0 - value of R0 on entry
  290.  *                arg1 - value of R1 on entry
  291.  *                arg2 - value of R2 on entry
  292.  *                slot_no - value of R3 on entry
  293.  *
  294.  * Output:        arg0_out - value of R0 on exit
  295.  *                arg1_out - value of R1 on exit
  296.  *                arg2_out - value of R2 on exit
  297.  *
  298.  * Other notes:   Calls SWI 0x40286.
  299.  */
  300.  
  301. extern os_error *xpodule_call_loader (int arg0,
  302.       int arg1,
  303.       int arg2,
  304.       int slot_no,
  305.       int *arg0_out,
  306.       int *arg1_out,
  307.       int *arg2_out);
  308. extern void podule_call_loader (int arg0,
  309.       int arg1,
  310.       int arg2,
  311.       int slot_no,
  312.       int *arg0_out,
  313.       int *arg1_out,
  314.       int *arg2_out);
  315.  
  316. /* ------------------------------------------------------------------------
  317.  * Function:      podule_raw_read()
  318.  *
  319.  * Description:   Reads bytes directly within an expansion card or
  320.  *                extension ROM's address space
  321.  *
  322.  * Input:         start_offset - value of R0 on entry
  323.  *                size - value of R1 on entry
  324.  *                buffer - value of R2 on entry
  325.  *                slot_no - value of R3 on entry
  326.  *
  327.  * Other notes:   Calls SWI 0x40287.
  328.  */
  329.  
  330. extern os_error *xpodule_raw_read (int start_offset,
  331.       int size,
  332.       byte *buffer,
  333.       int slot_no);
  334. extern void podule_raw_read (int start_offset,
  335.       int size,
  336.       byte *buffer,
  337.       int slot_no);
  338.  
  339. /* ------------------------------------------------------------------------
  340.  * Function:      podule_raw_write()
  341.  *
  342.  * Description:   Writes bytes directly within an expansion card's
  343.  *                workspace
  344.  *
  345.  * Input:         start_offset - value of R0 on entry
  346.  *                size - value of R1 on entry
  347.  *                buffer - value of R2 on entry
  348.  *                slot_no - value of R3 on entry
  349.  *
  350.  * Other notes:   Calls SWI 0x40288.
  351.  */
  352.  
  353. extern os_error *xpodule_raw_write (int start_offset,
  354.       int size,
  355.       byte *buffer,
  356.       int slot_no);
  357. extern void podule_raw_write (int start_offset,
  358.       int size,
  359.       byte *buffer,
  360.       int slot_no);
  361.  
  362. /* ------------------------------------------------------------------------
  363.  * Function:      podule_hardware_address()
  364.  *
  365.  * Description:   Returns an expansion card or extension ROM's base
  366.  *                address, and the address of an expansion card's CMOS RAM
  367.  *                (prefer Podule_ReadInfo)
  368.  *
  369.  * Input:         section - value of R3 on entry
  370.  *
  371.  * Output:        combined_addr - value of R3 on exit (X version only)
  372.  *
  373.  * Returns:       R3 (non-X version only)
  374.  *
  375.  * Other notes:   Calls SWI 0x40289.
  376.  */
  377.  
  378. extern os_error *xpodule_hardware_address (int section,
  379.       int **combined_addr);
  380. extern int *podule_hardware_address (int section);
  381.  
  382. /* ------------------------------------------------------------------------
  383.  * Function:      podule_enumerate_chunks_with_info()
  384.  *
  385.  * Description:   Reads information about a chunk from the chunk directory
  386.  *
  387.  * Input:         context - value of R0 on entry
  388.  *                section - value of R3 on entry
  389.  *
  390.  * Output:        context_out - value of R0 on exit (X version only)
  391.  *                size - value of R1 on exit
  392.  *                os_id - value of R2 on exit
  393.  *                module_name - value of R4 on exit
  394.  *                help_text - value of R5 on exit
  395.  *                module_base - value of R6 on exit
  396.  *
  397.  * Returns:       R0 (non-X version only)
  398.  *
  399.  * Other notes:   Calls SWI 0x4028A with R6 = 0x1.
  400.  */
  401.  
  402. extern os_error *xpodule_enumerate_chunks_with_info (int context,
  403.       int section,
  404.       int *context_out,
  405.       int *size,
  406.       byte *os_id,
  407.       char **module_name,
  408.       char **help_text,
  409.       int **module_base);
  410. extern int podule_enumerate_chunks_with_info (int context,
  411.       int section,
  412.       int *size,
  413.       byte *os_id,
  414.       char **module_name,
  415.       char **help_text,
  416.       int **module_base);
  417.  
  418. /* ------------------------------------------------------------------------
  419.  * Function:      podule_hardware_addresses()
  420.  *
  421.  * Description:   Returns an expansion card or extension ROM's base
  422.  *                address, and the address of an expansion card's CMOS RAM
  423.  *
  424.  * Input:         section - value of R3 on entry
  425.  *
  426.  * Output:        base_addr - value of R0 on exit
  427.  *                combined_addr - value of R1 on exit
  428.  *
  429.  * Other notes:   Calls SWI 0x4028B.
  430.  */
  431.  
  432. extern os_error *xpodule_hardware_addresses (int section,
  433.       int **base_addr,
  434.       int **combined_addr);
  435. extern void podule_hardware_addresses (int section,
  436.       int **base_addr,
  437.       int **combined_addr);
  438.  
  439. /* ------------------------------------------------------------------------
  440.  * Function:      podule_return_number()
  441.  *
  442.  * Description:   Returns the number of expansion card and extension ROM's
  443.  *
  444.  * Output:        expansion_card_count - value of R0 on exit
  445.  *                extension_rom_count - value of R1 on exit
  446.  *
  447.  * Other notes:   Calls SWI 0x4028C.
  448.  */
  449.  
  450. extern os_error *xpodule_return_number (int *expansion_card_count,
  451.       int *extension_rom_count);
  452. extern void podule_return_number (int *expansion_card_count,
  453.       int *extension_rom_count);
  454.  
  455. /* ------------------------------------------------------------------------
  456.  * Function:      podule_read_info()
  457.  *
  458.  * Description:   Returns a selection of data specific to a given expansion
  459.  *                card
  460.  *
  461.  * Input:         mask - value of R0 on entry
  462.  *                buffer - value of R1 on entry
  463.  *                size - value of R2 on entry
  464.  *                section - value of R3 on entry
  465.  *
  466.  * Output:        used - value of R2 on exit
  467.  *
  468.  * Other notes:   Calls SWI 0x4028D.
  469.  */
  470.  
  471. extern os_error *xpodule_read_info (bits mask,
  472.       byte *buffer,
  473.       int size,
  474.       int section,
  475.       int *used);
  476. extern void podule_read_info (bits mask,
  477.       byte *buffer,
  478.       int size,
  479.       int section,
  480.       int *used);
  481.  
  482. /* ------------------------------------------------------------------------
  483.  * Function:      podule_set_speed()
  484.  *
  485.  * Description:   Changes the speed of access to expansion card hardware
  486.  *
  487.  * Input:         speed - value of R0 on entry
  488.  *                section - value of R3 on entry
  489.  *
  490.  * Output:        old_speed - value of R0 on exit
  491.  *
  492.  * Other notes:   Calls SWI 0x4028E.
  493.  */
  494.  
  495. extern os_error *xpodule_set_speed (int speed,
  496.       int section,
  497.       int *old_speed);
  498. extern void podule_set_speed (int speed,
  499.       int section,
  500.       int *old_speed);
  501.  
  502. /* ------------------------------------------------------------------------
  503.  * Function:      service_pre_reset()
  504.  *
  505.  * Description:   Pre-reset
  506.  *
  507.  * Other notes:   Calls SWI 0x30 with R1 = 0x45.
  508.  */
  509.  
  510. extern os_error *xservice_pre_reset (void);
  511. extern void service_pre_reset (void);
  512.  
  513. /* ------------------------------------------------------------------------
  514.  * Function:      service_adfs_podule()
  515.  *
  516.  * Description:   Issued by ADFS to locate an ST506 expansion card
  517.  *
  518.  * Input:         controller - value of R2 on entry
  519.  *                status_location - value of R3 on entry
  520.  *                status_bits - value of R4 on entry
  521.  *                irq_location - value of R5 on entry
  522.  *                irq_bits - value of R6 on entry
  523.  *
  524.  * Output:        unclaimed - value of R1 on exit (X version only)
  525.  *                controller_out - value of R2 on exit
  526.  *                status_location_out - value of R3 on exit
  527.  *                status_bits_out - value of R4 on exit
  528.  *                irq_location_out - value of R5 on exit
  529.  *                irq_bits_out - value of R6 on exit
  530.  *
  531.  * Returns:       R1 (non-X version only)
  532.  *
  533.  * Other notes:   Calls SWI 0x30 with R1 = 0x10800.
  534.  */
  535.  
  536. extern os_error *xservice_adfs_podule (byte *controller,
  537.       int *status_location,
  538.       bits status_bits,
  539.       int *irq_location,
  540.       bits irq_bits,
  541.       bool *unclaimed,
  542.       byte **controller_out,
  543.       int **status_location_out,
  544.       bits *status_bits_out,
  545.       int **irq_location_out,
  546.       bits *irq_bits_out);
  547. extern bool service_adfs_podule (byte *controller,
  548.       int *status_location,
  549.       bits status_bits,
  550.       int *irq_location,
  551.       bits irq_bits,
  552.       byte **controller_out,
  553.       int **status_location_out,
  554.       bits *status_bits_out,
  555.       int **irq_location_out,
  556.       bits *irq_bits_out);
  557.  
  558. /* ------------------------------------------------------------------------
  559.  * Function:      service_adfs_podule_ide()
  560.  *
  561.  * Description:   Issued by ADFS to locate an IDE expansion card
  562.  *
  563.  * Input:         controller - value of R2 on entry
  564.  *                status_location - value of R3 on entry
  565.  *                status_bits - value of R4 on entry
  566.  *                irq_location - value of R5 on entry
  567.  *                irq_bits - value of R6 on entry
  568.  *                read_code - value of R7 on entry
  569.  *                write_code - value of R8 on entry
  570.  *
  571.  * Output:        unclaimed - value of R1 on exit (X version only)
  572.  *                controller_out - value of R2 on exit
  573.  *                status_location_out - value of R3 on exit
  574.  *                status_bits_out - value of R4 on exit
  575.  *                irq_location_out - value of R5 on exit
  576.  *                irq_bits_out - value of R6 on exit
  577.  *                read_code_out - value of R7 on exit
  578.  *                write_code_out - value of R8 on exit
  579.  *
  580.  * Returns:       R1 (non-X version only)
  581.  *
  582.  * Other notes:   Calls SWI 0x30 with R1 = 0x10801.
  583.  */
  584.  
  585. extern os_error *xservice_adfs_podule_ide (byte *controller,
  586.       int *status_location,
  587.       bits status_bits,
  588.       int *irq_location,
  589.       bits irq_bits,
  590.       void *read_code,
  591.       void *write_code,
  592.       bool *unclaimed,
  593.       byte **controller_out,
  594.       int **status_location_out,
  595.       bits *status_bits_out,
  596.       int **irq_location_out,
  597.       bits *irq_bits_out,
  598.       void **read_code_out,
  599.       void **write_code_out);
  600. extern bool service_adfs_podule_ide (byte *controller,
  601.       int *status_location,
  602.       bits status_bits,
  603.       int *irq_location,
  604.       bits irq_bits,
  605.       void *read_code,
  606.       void *write_code,
  607.       byte **controller_out,
  608.       int **status_location_out,
  609.       bits *status_bits_out,
  610.       int **irq_location_out,
  611.       bits *irq_bits_out,
  612.       void **read_code_out,
  613.       void **write_code_out);
  614.  
  615. /* ------------------------------------------------------------------------
  616.  * Function:      service_adfs_podule_ide_dying()
  617.  *
  618.  * Description:   IDE expansion card dying
  619.  *
  620.  * Other notes:   Calls SWI 0x30 with R1 = 0x10802.
  621.  */
  622.  
  623. extern os_error *xservice_adfs_podule_ide_dying (void);
  624. extern void service_adfs_podule_ide_dying (void);
  625.  
  626. #ifdef __cplusplus
  627.    }
  628. #endif
  629.  
  630. #endif
  631.