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

  1. #ifndef econet_H
  2. #define econet_H
  3.  
  4. /* C header file for Econet
  5.  * written by DefMod (Sep 16 1994) on Thu Sep 22 16:40:38 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  Econet_CreateReceive
  27. #define Econet_CreateReceive                    0x40000
  28. #undef  XEconet_CreateReceive
  29. #define XEconet_CreateReceive                   0x60000
  30. #undef  Econet_ExamineReceive
  31. #define Econet_ExamineReceive                   0x40001
  32. #undef  XEconet_ExamineReceive
  33. #define XEconet_ExamineReceive                  0x60001
  34. #undef  Econet_ReadReceive
  35. #define Econet_ReadReceive                      0x40002
  36. #undef  XEconet_ReadReceive
  37. #define XEconet_ReadReceive                     0x60002
  38. #undef  Econet_AbandonReceive
  39. #define Econet_AbandonReceive                   0x40003
  40. #undef  XEconet_AbandonReceive
  41. #define XEconet_AbandonReceive                  0x60003
  42. #undef  Econet_WaitForReception
  43. #define Econet_WaitForReception                 0x40004
  44. #undef  XEconet_WaitForReception
  45. #define XEconet_WaitForReception                0x60004
  46. #undef  Econet_EnumerateReceive
  47. #define Econet_EnumerateReceive                 0x40005
  48. #undef  XEconet_EnumerateReceive
  49. #define XEconet_EnumerateReceive                0x60005
  50. #undef  Econet_StartTransmit
  51. #define Econet_StartTransmit                    0x40006
  52. #undef  XEconet_StartTransmit
  53. #define XEconet_StartTransmit                   0x60006
  54. #undef  Econet_PollTransmit
  55. #define Econet_PollTransmit                     0x40007
  56. #undef  XEconet_PollTransmit
  57. #define XEconet_PollTransmit                    0x60007
  58. #undef  Econet_AbandonTransmit
  59. #define Econet_AbandonTransmit                  0x40008
  60. #undef  XEconet_AbandonTransmit
  61. #define XEconet_AbandonTransmit                 0x60008
  62. #undef  Econet_DoTransmit
  63. #define Econet_DoTransmit                       0x40009
  64. #undef  XEconet_DoTransmit
  65. #define XEconet_DoTransmit                      0x60009
  66. #undef  Econet_ReadLocalStationAndNet
  67. #define Econet_ReadLocalStationAndNet           0x4000A
  68. #undef  XEconet_ReadLocalStationAndNet
  69. #define XEconet_ReadLocalStationAndNet          0x6000A
  70. #undef  Econet_ConvertStatusToString
  71. #define Econet_ConvertStatusToString            0x4000B
  72. #undef  XEconet_ConvertStatusToString
  73. #define XEconet_ConvertStatusToString           0x6000B
  74. #undef  Econet_ConvertStatusToError
  75. #define Econet_ConvertStatusToError             0x4000C
  76. #undef  XEconet_ConvertStatusToError
  77. #define XEconet_ConvertStatusToError            0x6000C
  78. #undef  Econet_ReadProtection
  79. #define Econet_ReadProtection                   0x4000D
  80. #undef  XEconet_ReadProtection
  81. #define XEconet_ReadProtection                  0x6000D
  82. #undef  Econet_SetProtection
  83. #define Econet_SetProtection                    0x4000E
  84. #undef  XEconet_SetProtection
  85. #define XEconet_SetProtection                   0x6000E
  86. #undef  Econet_ReadStationNumber
  87. #define Econet_ReadStationNumber                0x4000F
  88. #undef  XEconet_ReadStationNumber
  89. #define XEconet_ReadStationNumber               0x6000F
  90. #undef  Econet_PrintBanner
  91. #define Econet_PrintBanner                      0x40010
  92. #undef  XEconet_PrintBanner
  93. #define XEconet_PrintBanner                     0x60010
  94. #undef  Econet_ReadTransportType
  95. #define Econet_ReadTransportType                0x40011
  96. #undef  XEconet_ReadTransportType
  97. #define XEconet_ReadTransportType               0x60011
  98. #undef  Econet_ReleasePort
  99. #define Econet_ReleasePort                      0x40012
  100. #undef  XEconet_ReleasePort
  101. #define XEconet_ReleasePort                     0x60012
  102. #undef  Econet_AllocatePort
  103. #define Econet_AllocatePort                     0x40013
  104. #undef  XEconet_AllocatePort
  105. #define XEconet_AllocatePort                    0x60013
  106. #undef  Econet_DeAllocatePort
  107. #define Econet_DeAllocatePort                   0x40014
  108. #undef  XEconet_DeAllocatePort
  109. #define XEconet_DeAllocatePort                  0x60014
  110. #undef  Econet_ClaimPort
  111. #define Econet_ClaimPort                        0x40015
  112. #undef  XEconet_ClaimPort
  113. #define XEconet_ClaimPort                       0x60015
  114. #undef  Econet_StartImmediate
  115. #define Econet_StartImmediate                   0x40016
  116. #undef  XEconet_StartImmediate
  117. #define XEconet_StartImmediate                  0x60016
  118. #undef  Econet_DoImmediate
  119. #define Econet_DoImmediate                      0x40017
  120. #undef  XEconet_DoImmediate
  121. #define XEconet_DoImmediate                     0x60017
  122. #undef  Econet_AbandonAndReadReceive
  123. #define Econet_AbandonAndReadReceive            0x40018
  124. #undef  XEconet_AbandonAndReadReceive
  125. #define XEconet_AbandonAndReadReceive           0x60018
  126. #undef  Econet_Version
  127. #define Econet_Version                          0x40019
  128. #undef  XEconet_Version
  129. #define XEconet_Version                         0x60019
  130. #undef  Econet_NetworkState
  131. #define Econet_NetworkState                     0x4001A
  132. #undef  XEconet_NetworkState
  133. #define XEconet_NetworkState                    0x6001A
  134. #undef  Econet_PacketSize
  135. #define Econet_PacketSize                       0x4001B
  136. #undef  XEconet_PacketSize
  137. #define XEconet_PacketSize                      0x6001B
  138. #undef  Econet_ReadTransportName
  139. #define Econet_ReadTransportName                0x4001C
  140. #undef  XEconet_ReadTransportName
  141. #define XEconet_ReadTransportName               0x6001C
  142. #undef  Econet_InetRxDirect
  143. #define Econet_InetRxDirect                     0x4001D
  144. #undef  XEconet_InetRxDirect
  145. #define XEconet_InetRxDirect                    0x6001D
  146. #undef  Econet_EnumerateMap
  147. #define Econet_EnumerateMap                     0x4001E
  148. #undef  XEconet_EnumerateMap
  149. #define XEconet_EnumerateMap                    0x6001E
  150. #undef  Econet_EnumerateTransmit
  151. #define Econet_EnumerateTransmit                0x4001F
  152. #undef  XEconet_EnumerateTransmit
  153. #define XEconet_EnumerateTransmit               0x6001F
  154. #undef  Econet_HardwareAddresses
  155. #define Econet_HardwareAddresses                0x40020
  156. #undef  XEconet_HardwareAddresses
  157. #define XEconet_HardwareAddresses               0x60020
  158. #undef  EconetV
  159. #define EconetV                                 0x21
  160. #undef  Service_ReallocatePorts
  161. #define Service_ReallocatePorts                 0x48
  162. #undef  Service_EconetDying
  163. #define Service_EconetDying                     0x56
  164. #undef  Service_ProtocolDying
  165. #define Service_ProtocolDying                   0x83
  166. #undef  Service_FindNetworkDriver
  167. #define Service_FindNetworkDriver               0x84
  168. #undef  Service_NetworkDriverStatus
  169. #define Service_NetworkDriverStatus             0x8B
  170. #undef  Event_EconetUserRPC
  171. #define Event_EconetUserRPC                     0x8
  172. #undef  Event_EconetRx
  173. #define Event_EconetRx                          0xE
  174. #undef  Event_EconetTx
  175. #define Event_EconetTx                          0xF
  176. #undef  Event_EconetOSProc
  177. #define Event_EconetOSProc                      0x10
  178.  
  179. /************************************
  180.  * Structure and union declarations *
  181.  ************************************/
  182. typedef struct econet_rx_cb_                    *econet_rx_cb;
  183. typedef struct econet_tx_cb_                    *econet_tx_cb;
  184.  
  185. /************************
  186.  * Constant definitions *
  187.  ************************/
  188. #define econet_STATUS_TRANSMITTED               0
  189. #define econet_STATUS_LINE_JAMMED               1
  190. #define econet_STATUS_NET_ERROR                 2
  191. #define econet_STATUS_NOT_LISTENING             3
  192. #define econet_STATUS_NO_CLOCK                  4
  193. #define econet_STATUS_TX_READY                  5
  194. #define econet_STATUS_TRANSMITTING              6
  195. #define econet_STATUS_RX_READY                  7
  196. #define econet_STATUS_RECEIVING                 8
  197. #define econet_STATUS_RECEIVED                  9
  198. #define econet_STATUS_NO_REPLY                  10
  199. #define econet_STATUS_ESCAPE                    11
  200. #define econet_STATUS_NOT_PRESENT               12
  201. #define error_ECONET_TX_READY                   0x300u
  202. #define error_ECONET_TRANSMITTING               0x301u
  203. #define error_ECONET_RX_READY                   0x302u
  204. #define error_ECONET_RECEIVING                  0x303u
  205. #define error_ECONET_RECEIVED                   0x304u
  206. #define error_ECONET_TRANSMITTED                0x305u
  207. #define error_ECONET_BAD_STATION                0x306u
  208. #define error_ECONET_BAD_NETWORK                0x307u
  209. #define error_ECONET_UNABLE_TO_DEFAULT          0x308u
  210. #define error_ECONET_BAD_PORT                   0x309u
  211. #define error_ECONET_BAD_CONTROL                0x30Au
  212. #define error_ECONET_BAD_BUFFER                 0x30Bu
  213. #define error_ECONET_BAD_SIZE                   0x30Cu
  214. #define error_ECONET_BAD_MASK                   0x30Du
  215. #define error_ECONET_BAD_COUNT                  0x30Eu
  216. #define error_ECONET_BAD_DELAY                  0x30Fu
  217. #define error_ECONET_BAD_STATUS                 0x310u
  218. #define error_ECONET_NO_HARDWARE                0x311u
  219. #define error_ECONET_NO_ECONET                  0x312u
  220. #define error_ECONET_NO_MORE_DOMAINS            0x313u
  221. #define error_ECONET_BAD_DOMAIN                 0x314u
  222. #define error_ECONET_UN_REGISTERED_DOMAIN       0x315u
  223. #define error_ECONET_PORT_NOT_ALLOCATED         0x316u
  224. #define error_ECONET_PORT_ALLOCATED             0x317u
  225. #define error_ECONET_NO_MORE_PORTS              0x318u
  226. #define econet_IMMEDIATE_PEEK                   1
  227. #define econet_IMMEDIATE_POKE                   2
  228. #define econet_IMMEDIATE_JSR                    3
  229. #define econet_IMMEDIATE_USER_PROCEDURE_CALL    4
  230. #define econet_IMMEDIATE_OS_PROCEDURE_CALL      5
  231. #define econet_IMMEDIATE_HALT                   6
  232. #define econet_IMMEDIATE_CONTINUE               7
  233. #define econet_IMMEDIATE_MACHINE_PEEK           8
  234. #define econet_IMMEDIATE_GET_REGISTERS          9
  235. #define econet_OS_CHAR_FROM_NOTIFY              0
  236. #define econet_OS_INITIALISE_REMOTE             1
  237. #define econet_OS_GET_VIEW_PARAMETERS           2
  238. #define econet_OS_CAUSE_FATAL_ERROR             3
  239. #define econet_OS_CHAR_FROM_REMOTE              4
  240. #define econet_PROTECTION_PEEK                  0x1u
  241. #define econet_PROTECTION_POKE                  0x2u
  242. #define econet_PROTECTION_JSR                   0x4u
  243. #define econet_PROTECTION_USER_PROCEDURE_CALL   0x8u
  244. #define econet_PROTECTION_OS_PROCEDURE_CALL     0x10u
  245. #define econet_PROTECTION_HALT                  0x20u
  246. #define econet_PROTECTION_CONTINUE              0x40u
  247. #define econet_PROTECTION_MACHINE_PEEK          0x80u
  248. #define econet_PROTECTION_GET_REGISTERS         0x100u
  249. #define econet_PROTECTION_WRITE_CMOS            0x80000000u
  250. #define econet_TRANSPORT_NOT_KNOWN              0
  251. #define econet_TRANSPORT_INTERNET               1
  252. #define econet_TRANSPORT_ECONET                 2
  253. #define econet_TRANSPORT_NEXUS                  3
  254. #define econet_STATE_OK                         0
  255. #define econet_STATE_NO_CLOCK                   1
  256. #define econet_NET_FS_START_LOAD                16
  257. #define econet_NET_FS_PART_LOAD                 17
  258. #define econet_NET_FS_FINISH_LOAD               18
  259. #define econet_NET_FS_START_SAVE                32
  260. #define econet_NET_FS_PART_SAVE                 33
  261. #define econet_NET_FS_FINISH_SAVE               34
  262. #define econet_NET_FS_START_CREATE              48
  263. #define econet_NET_FS_PART_CREATE               49
  264. #define econet_NET_FS_FINISH_CREATE             50
  265. #define econet_NET_FS_START_GET_BYTES           64
  266. #define econet_NET_FS_PART_GET_BYTES            65
  267. #define econet_NET_FS_FINISH_GET_BYTES          66
  268. #define econet_NET_FS_START_PUT_BYTES           80
  269. #define econet_NET_FS_PART_PUT_BYTES            81
  270. #define econet_NET_FS_FINISH_PUT_BYTES          82
  271. #define econet_NET_FS_START_WAIT                96
  272. #define econet_NET_FS_FINISH_WAIT               98
  273. #define econet_NET_FS_START_BROADCAST_LOAD      112
  274. #define econet_NET_FS_PART_BROADCAST_LOAD       113
  275. #define econet_NET_FS_FINISH_BROADCAST_LOAD     114
  276. #define econet_NET_FS_START_BROADCAST_SAVE      128
  277. #define econet_NET_FS_PART_BROADCAST_SAVE       129
  278. #define econet_NET_FS_FINISH_BROADCAST_SAVE     130
  279. #define econet_ECONET_START_TRANSMISSION        192
  280. #define econet_ECONET_FINISH_TRANSMISSION       194
  281. #define econet_ECONET_START_RECEPTION           208
  282. #define econet_ECONET_FINISH_RECEPTION          210
  283.  
  284. /*************************
  285.  * Function declarations *
  286.  *************************/
  287.  
  288. #ifdef __cplusplus
  289.    extern "C" {
  290. #endif
  291.  
  292. /*************************************************************
  293.  * NOTE: The following functions provide direct access to    *
  294.  *       the SWI's noted in the function description.        *
  295.  *       Please read the relevant PRM section for more       *
  296.  *       information on their input/output parameters.       *
  297.  *************************************************************/
  298.  
  299. /* ------------------------------------------------------------------------
  300.  * Function:      econet_create_receive()
  301.  *
  302.  * Description:   Creates a receive control block
  303.  *
  304.  * Input:         port - value of R0 on entry
  305.  *                station - value of R1 on entry
  306.  *                net - value of R2 on entry
  307.  *                buffer - value of R3 on entry
  308.  *                size - value of R4 on entry
  309.  *
  310.  * Output:        rx_cb - value of R0 on exit (X version only)
  311.  *                nonlocal - value of R2 on exit
  312.  *
  313.  * Returns:       R0 (non-X version only)
  314.  *
  315.  * Other notes:   Calls SWI 0x40000.
  316.  */
  317.  
  318. extern os_error *xeconet_create_receive (byte port,
  319.       byte station,
  320.       byte net,
  321.       byte *buffer,
  322.       int size,
  323.       econet_rx_cb *rx_cb,
  324.       bool *nonlocal);
  325. extern econet_rx_cb econet_create_receive (byte port,
  326.       byte station,
  327.       byte net,
  328.       byte *buffer,
  329.       int size,
  330.       bool *nonlocal);
  331.  
  332. /* ------------------------------------------------------------------------
  333.  * Function:      econet_examine_receive()
  334.  *
  335.  * Description:   Reads the status of a receive control block
  336.  *
  337.  * Input:         rx_cb - value of R0 on entry
  338.  *
  339.  * Output:        status - value of R0 on exit (X version only)
  340.  *
  341.  * Returns:       R0 (non-X version only)
  342.  *
  343.  * Other notes:   Calls SWI 0x40001.
  344.  */
  345.  
  346. extern os_error *xeconet_examine_receive (econet_rx_cb rx_cb,
  347.       int *status);
  348. extern int econet_examine_receive (econet_rx_cb rx_cb);
  349.  
  350. /* ------------------------------------------------------------------------
  351.  * Function:      econet_read_receive()
  352.  *
  353.  * Description:   Reads information about a reception, including the size
  354.  *                of data
  355.  *
  356.  * Input:         rx_cb - value of R0 on entry
  357.  *
  358.  * Output:        status - value of R0 on exit (X version only)
  359.  *                flag - value of R1 on exit
  360.  *                port - value of R2 on exit
  361.  *                station - value of R3 on exit
  362.  *                net - value of R4 on exit
  363.  *                buffer - value of R5 on exit
  364.  *                size - value of R6 on exit
  365.  *
  366.  * Returns:       R0 (non-X version only)
  367.  *
  368.  * Other notes:   Calls SWI 0x40002.
  369.  */
  370.  
  371. extern os_error *xeconet_read_receive (econet_rx_cb rx_cb,
  372.       int *status,
  373.       byte *flag,
  374.       byte *port,
  375.       byte *station,
  376.       byte *net,
  377.       byte **buffer,
  378.       int *size);
  379. extern int econet_read_receive (econet_rx_cb rx_cb,
  380.       byte *flag,
  381.       byte *port,
  382.       byte *station,
  383.       byte *net,
  384.       byte **buffer,
  385.       int *size);
  386.  
  387. /* ------------------------------------------------------------------------
  388.  * Function:      econet_abandon_receive()
  389.  *
  390.  * Description:   Abandons a receive control block
  391.  *
  392.  * Input:         rx_cb - value of R0 on entry
  393.  *
  394.  * Output:        status - value of R0 on exit (X version only)
  395.  *
  396.  * Returns:       R0 (non-X version only)
  397.  *
  398.  * Other notes:   Calls SWI 0x40003.
  399.  */
  400.  
  401. extern os_error *xeconet_abandon_receive (econet_rx_cb rx_cb,
  402.       int *status);
  403. extern int econet_abandon_receive (econet_rx_cb rx_cb);
  404.  
  405. /* ------------------------------------------------------------------------
  406.  * Function:      econet_wait_for_reception()
  407.  *
  408.  * Description:   Polls a receive control block, reads its status, and
  409.  *                abandons it
  410.  *
  411.  * Input:         rx_cb - value of R0 on entry
  412.  *                delay - value of R1 on entry
  413.  *                abort_on_escape - value of R2 on entry
  414.  *
  415.  * Output:        status - value of R0 on exit (X version only)
  416.  *                flag - value of R1 on exit
  417.  *                port - value of R2 on exit
  418.  *                station - value of R3 on exit
  419.  *                net - value of R4 on exit
  420.  *                buffer - value of R5 on exit
  421.  *                size - value of R6 on exit
  422.  *
  423.  * Returns:       R0 (non-X version only)
  424.  *
  425.  * Other notes:   Calls SWI 0x40004.
  426.  */
  427.  
  428. extern os_error *xeconet_wait_for_reception (econet_rx_cb rx_cb,
  429.       int delay,
  430.       bool abort_on_escape,
  431.       int *status,
  432.       byte *flag,
  433.       byte *port,
  434.       byte *station,
  435.       byte *net,
  436.       byte **buffer,
  437.       int *size);
  438. extern int econet_wait_for_reception (econet_rx_cb rx_cb,
  439.       int delay,
  440.       bool abort_on_escape,
  441.       byte *flag,
  442.       byte *port,
  443.       byte *station,
  444.       byte *net,
  445.       byte **buffer,
  446.       int *size);
  447.  
  448. /* ------------------------------------------------------------------------
  449.  * Function:      econet_enumerate_receive()
  450.  *
  451.  * Description:   Returns the handles of open receive control blocks
  452.  *
  453.  * Input:         rx_cb_no - value of R0 on entry
  454.  *
  455.  * Output:        rx_cb - value of R0 on exit (X version only)
  456.  *
  457.  * Returns:       R0 (non-X version only)
  458.  *
  459.  * Other notes:   Calls SWI 0x40005.
  460.  */
  461.  
  462. extern os_error *xeconet_enumerate_receive (int rx_cb_no,
  463.       econet_rx_cb *rx_cb);
  464. extern econet_rx_cb econet_enumerate_receive (int rx_cb_no);
  465.  
  466. /* ------------------------------------------------------------------------
  467.  * Function:      econet_start_transmit()
  468.  *
  469.  * Description:   Creates a transmit control block and starts a
  470.  *                transmission
  471.  *
  472.  * Input:         flags - value of R0 on entry
  473.  *                port - value of R1 on entry
  474.  *                station - value of R2 on entry
  475.  *                net - value of R3 on entry
  476.  *                buffer - value of R4 on entry
  477.  *                size - value of R5 on entry
  478.  *                count - value of R6 on entry
  479.  *                delay - value of R7 on entry
  480.  *
  481.  * Output:        tx_cb - value of R0 on exit (X version only)
  482.  *                nonlocal - value of R4 on exit
  483.  *
  484.  * Returns:       R0 (non-X version only)
  485.  *
  486.  * Other notes:   Calls SWI 0x40006.
  487.  */
  488.  
  489. extern os_error *xeconet_start_transmit (byte flags,
  490.       byte port,
  491.       byte station,
  492.       byte net,
  493.       byte *buffer,
  494.       int size,
  495.       int count,
  496.       int delay,
  497.       econet_tx_cb *tx_cb,
  498.       bool *nonlocal);
  499. extern econet_tx_cb econet_start_transmit (byte flags,
  500.       byte port,
  501.       byte station,
  502.       byte net,
  503.       byte *buffer,
  504.       int size,
  505.       int count,
  506.       int delay,
  507.       bool *nonlocal);
  508.  
  509. /* ------------------------------------------------------------------------
  510.  * Function:      econet_poll_transmit()
  511.  *
  512.  * Description:   Reads the status of a transmit control block
  513.  *
  514.  * Input:         tx_cb - value of R0 on entry
  515.  *
  516.  * Output:        status - value of R0 on exit (X version only)
  517.  *
  518.  * Returns:       R0 (non-X version only)
  519.  *
  520.  * Other notes:   Calls SWI 0x40007.
  521.  */
  522.  
  523. extern os_error *xeconet_poll_transmit (econet_tx_cb tx_cb,
  524.       int *status);
  525. extern int econet_poll_transmit (econet_tx_cb tx_cb);
  526.  
  527. /* ------------------------------------------------------------------------
  528.  * Function:      econet_abandon_transmit()
  529.  *
  530.  * Description:   Abandons a transmit control block
  531.  *
  532.  * Input:         tx_cb - value of R0 on entry
  533.  *
  534.  * Output:        status - value of R0 on exit (X version only)
  535.  *
  536.  * Returns:       R0 (non-X version only)
  537.  *
  538.  * Other notes:   Calls SWI 0x40008.
  539.  */
  540.  
  541. extern os_error *xeconet_abandon_transmit (econet_tx_cb tx_cb,
  542.       int *status);
  543. extern int econet_abandon_transmit (econet_tx_cb tx_cb);
  544.  
  545. /* ------------------------------------------------------------------------
  546.  * Function:      econet_do_transmit()
  547.  *
  548.  * Description:   Creates a transmit control block, polls it, reads its
  549.  *                status, and abandons it
  550.  *
  551.  * Input:         flags - value of R0 on entry
  552.  *                port - value of R1 on entry
  553.  *                station - value of R2 on entry
  554.  *                net - value of R3 on entry
  555.  *                buffer - value of R4 on entry
  556.  *                size - value of R5 on entry
  557.  *                count - value of R6 on entry
  558.  *                delay - value of R7 on entry
  559.  *
  560.  * Output:        status - value of R0 on exit (X version only)
  561.  *                nonlocal - value of R4 on exit
  562.  *
  563.  * Returns:       R0 (non-X version only)
  564.  *
  565.  * Other notes:   Calls SWI 0x40009.
  566.  */
  567.  
  568. extern os_error *xeconet_do_transmit (byte flags,
  569.       byte port,
  570.       byte station,
  571.       byte net,
  572.       byte *buffer,
  573.       int size,
  574.       int count,
  575.       int delay,
  576.       int *status,
  577.       bool *nonlocal);
  578. extern int econet_do_transmit (byte flags,
  579.       byte port,
  580.       byte station,
  581.       byte net,
  582.       byte *buffer,
  583.       int size,
  584.       int count,
  585.       int delay,
  586.       bool *nonlocal);
  587.  
  588. /* ------------------------------------------------------------------------
  589.  * Function:      econet_read_local_station_and_net()
  590.  *
  591.  * Description:   Returns a computer's station number and net number
  592.  *
  593.  * Output:        station - value of R0 on exit
  594.  *                net - value of R1 on exit
  595.  *
  596.  * Other notes:   Calls SWI 0x4000A.
  597.  */
  598.  
  599. extern os_error *xeconet_read_local_station_and_net (byte *station,
  600.       byte *net);
  601. extern void econet_read_local_station_and_net (byte *station,
  602.       byte *net);
  603.  
  604. /* ------------------------------------------------------------------------
  605.  * Function:      econet_convert_status_to_string()
  606.  *
  607.  * Description:   Converts a status to a string
  608.  *
  609.  * Input:         status - value of R0 on entry
  610.  *                buffer - value of R1 on entry
  611.  *                size - value of R2 on entry
  612.  *                station - value of R3 on entry
  613.  *                net - value of R4 on entry
  614.  *
  615.  * Output:        end - value of R1 on exit
  616.  *
  617.  * Other notes:   Calls SWI 0x4000B.
  618.  */
  619.  
  620. extern os_error *xeconet_convert_status_to_string (int status,
  621.       char *buffer,
  622.       int size,
  623.       byte station,
  624.       byte net,
  625.       char **end);
  626. extern void econet_convert_status_to_string (int status,
  627.       char *buffer,
  628.       int size,
  629.       byte station,
  630.       byte net,
  631.       char **end);
  632.  
  633. /* ------------------------------------------------------------------------
  634.  * Function:      econet_convert_status_to_error()
  635.  *
  636.  * Description:   Converts a status to a string, and then generates an
  637.  *                error
  638.  *
  639.  * Input:         status - value of R0 on entry
  640.  *                buffer - value of R1 on entry
  641.  *                size - value of R2 on entry
  642.  *                station - value of R3 on entry
  643.  *                net - value of R4 on entry
  644.  *
  645.  * Other notes:   Calls SWI 0x4000C.
  646.  */
  647.  
  648. extern os_error *xeconet_convert_status_to_error (int status,
  649.       os_error *buffer,
  650.       int size,
  651.       byte station,
  652.       byte net);
  653. extern void econet_convert_status_to_error (int status,
  654.       os_error *buffer,
  655.       int size,
  656.       byte station,
  657.       byte net);
  658.  
  659. /* ------------------------------------------------------------------------
  660.  * Function:      econet_read_protection()
  661.  *
  662.  * Description:   Reads the current protection word for immediate
  663.  *                operations
  664.  *
  665.  * Output:        protection - value of R0 on exit (X version only)
  666.  *
  667.  * Returns:       R0 (non-X version only)
  668.  *
  669.  * Other notes:   Calls SWI 0x4000D.
  670.  */
  671.  
  672. extern os_error *xeconet_read_protection (bits *protection);
  673. extern bits econet_read_protection (void);
  674.  
  675. /* ------------------------------------------------------------------------
  676.  * Function:      econet_set_protection()
  677.  *
  678.  * Description:   Sets or reads the protection word for immediate
  679.  *                operations
  680.  *
  681.  * Input:         eor_mask - value of R0 on entry
  682.  *                and_mask - value of R1 on entry
  683.  *
  684.  * Output:        old_protection - value of R0 on exit (X version only)
  685.  *
  686.  * Returns:       R0 (non-X version only)
  687.  *
  688.  * Other notes:   Calls SWI 0x4000E.
  689.  */
  690.  
  691. extern os_error *xeconet_set_protection (bits eor_mask,
  692.       bits and_mask,
  693.       bits *old_protection);
  694. extern bits econet_set_protection (bits eor_mask,
  695.       bits and_mask);
  696.  
  697. /* ------------------------------------------------------------------------
  698.  * Function:      econet_read_station_number()
  699.  *
  700.  * Description:   Extracts a station and/or net number from a specified
  701.  *                string
  702.  *
  703.  * Input:         s - value of R1 on entry
  704.  *
  705.  * Output:        end - value of R1 on exit
  706.  *                station - value of R2 on exit
  707.  *                net - value of R3 on exit
  708.  *
  709.  * Other notes:   Calls SWI 0x4000F.
  710.  */
  711.  
  712. extern os_error *xeconet_read_station_number (char *s,
  713.       char **end,
  714.       int *station,
  715.       int *net);
  716. extern void econet_read_station_number (char *s,
  717.       char **end,
  718.       int *station,
  719.       int *net);
  720.  
  721. /* ------------------------------------------------------------------------
  722.  * Function:      econet_print_banner()
  723.  *
  724.  * Description:   Prints an Econet message followed by a new line
  725.  *
  726.  * Other notes:   Calls SWI 0x40010.
  727.  */
  728.  
  729. extern os_error *xeconet_print_banner (void);
  730. extern void econet_print_banner (void);
  731.  
  732. /* ------------------------------------------------------------------------
  733.  * Function:      econet_read_transport_type()
  734.  *
  735.  * Description:   Returns the underlying transport type to a given station
  736.  *
  737.  * Input:         station - value of R0 on entry
  738.  *                net - value of R1 on entry
  739.  *
  740.  * Output:        transport_type - value of R2 on exit (X version only)
  741.  *
  742.  * Returns:       R2 (non-X version only)
  743.  *
  744.  * Other notes:   Calls SWI 0x40011 with R2 = 0x2.
  745.  */
  746.  
  747. extern os_error *xeconet_read_transport_type (byte station,
  748.       byte net,
  749.       int *transport_type);
  750. extern int econet_read_transport_type (byte station,
  751.       byte net);
  752.  
  753. /* ------------------------------------------------------------------------
  754.  * Function:      econet_release_port()
  755.  *
  756.  * Description:   Releases a port number that was previously claimed
  757.  *
  758.  * Input:         port - value of R0 on entry
  759.  *
  760.  * Other notes:   Calls SWI 0x40012.
  761.  */
  762.  
  763. extern os_error *xeconet_release_port (byte port);
  764. extern void econet_release_port (byte port);
  765.  
  766. /* ------------------------------------------------------------------------
  767.  * Function:      econet_allocate_port()
  768.  *
  769.  * Description:   Allocates a unique port number
  770.  *
  771.  * Output:        port - value of R0 on exit (X version only)
  772.  *
  773.  * Returns:       R0 (non-X version only)
  774.  *
  775.  * Other notes:   Calls SWI 0x40013.
  776.  */
  777.  
  778. extern os_error *xeconet_allocate_port (byte *port);
  779. extern byte econet_allocate_port (void);
  780.  
  781. /* ------------------------------------------------------------------------
  782.  * Function:      econet_de_allocate_port()
  783.  *
  784.  * Description:   Deallocates a port number that was previously allocated
  785.  *
  786.  * Input:         port - value of R0 on entry
  787.  *
  788.  * Other notes:   Calls SWI 0x40014.
  789.  */
  790.  
  791. extern os_error *xeconet_de_allocate_port (byte port);
  792. extern void econet_de_allocate_port (byte port);
  793.  
  794. /* ------------------------------------------------------------------------
  795.  * Function:      econet_claim_port()
  796.  *
  797.  * Description:   Claims a specific port number
  798.  *
  799.  * Input:         port - value of R0 on entry
  800.  *
  801.  * Other notes:   Calls SWI 0x40015.
  802.  */
  803.  
  804. extern os_error *xeconet_claim_port (byte port);
  805. extern void econet_claim_port (byte port);
  806.  
  807. /* ------------------------------------------------------------------------
  808.  * Function:      econet_start_immediate()
  809.  *
  810.  * Description:   Creates a transmit control block and starts an immediate
  811.  *                operation
  812.  *
  813.  * Input:         op_type - value of R0 on entry
  814.  *                procedure - value of R1 on entry
  815.  *                station - value of R2 on entry
  816.  *                net - value of R3 on entry
  817.  *                buffer - value of R4 on entry
  818.  *                size - value of R5 on entry
  819.  *                count - value of R6 on entry
  820.  *                delay - value of R7 on entry
  821.  *
  822.  * Output:        tx_cb - value of R0 on exit (X version only)
  823.  *                nonlocal - value of R4 on exit
  824.  *
  825.  * Returns:       R0 (non-X version only)
  826.  *
  827.  * Other notes:   Calls SWI 0x40016.
  828.  */
  829.  
  830. extern os_error *xeconet_start_immediate (int op_type,
  831.       int procedure,
  832.       byte station,
  833.       byte net,
  834.       byte *buffer,
  835.       int size,
  836.       int count,
  837.       int delay,
  838.       econet_tx_cb *tx_cb,
  839.       bool *nonlocal);
  840. extern econet_tx_cb econet_start_immediate (int op_type,
  841.       int procedure,
  842.       byte station,
  843.       byte net,
  844.       byte *buffer,
  845.       int size,
  846.       int count,
  847.       int delay,
  848.       bool *nonlocal);
  849.  
  850. /* ------------------------------------------------------------------------
  851.  * Function:      econet_do_immediate()
  852.  *
  853.  * Description:   Creates a transmit control block for an immediate
  854.  *                operation, polls it, reads its status, and abandons it
  855.  *
  856.  * Input:         op_type - value of R0 on entry
  857.  *                procedure - value of R1 on entry
  858.  *                station - value of R2 on entry
  859.  *                net - value of R3 on entry
  860.  *                buffer - value of R4 on entry
  861.  *                size - value of R5 on entry
  862.  *                count - value of R6 on entry
  863.  *                delay - value of R7 on entry
  864.  *
  865.  * Output:        status - value of R0 on exit (X version only)
  866.  *                nonlocal - value of R4 on exit
  867.  *
  868.  * Returns:       R0 (non-X version only)
  869.  *
  870.  * Other notes:   Calls SWI 0x40017.
  871.  */
  872.  
  873. extern os_error *xeconet_do_immediate (int op_type,
  874.       int procedure,
  875.       byte station,
  876.       byte net,
  877.       byte *buffer,
  878.       int size,
  879.       int count,
  880.       int delay,
  881.       int *status,
  882.       bool *nonlocal);
  883. extern int econet_do_immediate (int op_type,
  884.       int procedure,
  885.       byte station,
  886.       byte net,
  887.       byte *buffer,
  888.       int size,
  889.       int count,
  890.       int delay,
  891.       bool *nonlocal);
  892.  
  893. /* ------------------------------------------------------------------------
  894.  * Function:      econet_abandon_and_read_receive()
  895.  *
  896.  * Description:   Abandons a reception and returns information about it,
  897.  *                including the size of data
  898.  *
  899.  * Input:         rx_cb - value of R0 on entry
  900.  *
  901.  * Output:        status - value of R0 on exit (X version only)
  902.  *                flag - value of R1 on exit
  903.  *                port - value of R2 on exit
  904.  *                station - value of R3 on exit
  905.  *                net - value of R4 on exit
  906.  *                buffer - value of R5 on exit
  907.  *                size - value of R6 on exit
  908.  *
  909.  * Returns:       R0 (non-X version only)
  910.  *
  911.  * Other notes:   Calls SWI 0x40018.
  912.  */
  913.  
  914. extern os_error *xeconet_abandon_and_read_receive (econet_rx_cb rx_cb,
  915.       int *status,
  916.       byte *flag,
  917.       byte *port,
  918.       byte *station,
  919.       byte *net,
  920.       byte **buffer,
  921.       int *size);
  922. extern int econet_abandon_and_read_receive (econet_rx_cb rx_cb,
  923.       byte *flag,
  924.       byte *port,
  925.       byte *station,
  926.       byte *net,
  927.       byte **buffer,
  928.       int *size);
  929.  
  930. /* ------------------------------------------------------------------------
  931.  * Function:      econet_version()
  932.  *
  933.  * Description:   Returns the version of software for the underlying
  934.  *                transport to a given station
  935.  *
  936.  * Input:         station - value of R0 on entry
  937.  *                net - value of R1 on entry
  938.  *
  939.  * Output:        version - value of R2 on exit (X version only)
  940.  *
  941.  * Returns:       R2 (non-X version only)
  942.  *
  943.  * Other notes:   Calls SWI 0x40019.
  944.  */
  945.  
  946. extern os_error *xeconet_version (byte station,
  947.       byte net,
  948.       int *version);
  949. extern int econet_version (byte station,
  950.       byte net);
  951.  
  952. /* ------------------------------------------------------------------------
  953.  * Function:      econet_network_state()
  954.  *
  955.  * Description:   Returns the state of the underlying transport to a given
  956.  *                station
  957.  *
  958.  * Input:         station - value of R0 on entry
  959.  *                net - value of R1 on entry
  960.  *
  961.  * Output:        state - value of R2 on exit (X version only)
  962.  *
  963.  * Returns:       R2 (non-X version only)
  964.  *
  965.  * Other notes:   Calls SWI 0x4001A.
  966.  */
  967.  
  968. extern os_error *xeconet_network_state (byte station,
  969.       byte net,
  970.       int *state);
  971. extern int econet_network_state (byte station,
  972.       byte net);
  973.  
  974. /* ------------------------------------------------------------------------
  975.  * Function:      econet_packet_size()
  976.  *
  977.  * Description:   Returns the maximum packet size recommended on the
  978.  *                underlying transport to a given station
  979.  *
  980.  * Input:         station - value of R0 on entry
  981.  *                net - value of R1 on entry
  982.  *
  983.  * Output:        packet_limit - value of R2 on exit (X version only)
  984.  *
  985.  * Returns:       R2 (non-X version only)
  986.  *
  987.  * Other notes:   Calls SWI 0x4001B.
  988.  */
  989.  
  990. extern os_error *xeconet_packet_size (byte station,
  991.       byte net,
  992.       int *packet_limit);
  993. extern int econet_packet_size (byte station,
  994.       byte net);
  995.  
  996. /* ------------------------------------------------------------------------
  997.  * Function:      econet_read_transport_name()
  998.  *
  999.  * Description:   Returns the name of the underlying transport to a given
  1000.  *                station
  1001.  *
  1002.  * Input:         station - value of R0 on entry
  1003.  *                net - value of R1 on entry
  1004.  *
  1005.  * Output:        transport_name - value of R2 on exit (X version only)
  1006.  *
  1007.  * Returns:       R2 (non-X version only)
  1008.  *
  1009.  * Other notes:   Calls SWI 0x4001C.
  1010.  */
  1011.  
  1012. extern os_error *xeconet_read_transport_name (byte station,
  1013.       byte net,
  1014.       char **transport_name);
  1015. extern char *econet_read_transport_name (byte station,
  1016.       byte net);
  1017.  
  1018. /* ------------------------------------------------------------------------
  1019.  * Function:      econet_enumerate_map()
  1020.  *
  1021.  * Description:   Enumerates subnetwork addresses within an AUN site
  1022.  *                network
  1023.  *
  1024.  * Input:         flags - value of R0 on entry
  1025.  *                context - value of R4 on entry
  1026.  *
  1027.  * Output:        net - value of R1 on exit
  1028.  *                net_name - value of R2 on exit
  1029.  *                ip_subnetwork_address - value of R3 on exit
  1030.  *                context_out - value of R4 on exit (X version only)
  1031.  *
  1032.  * Returns:       R4 (non-X version only)
  1033.  *
  1034.  * Other notes:   Calls SWI 0x4001E.
  1035.  */
  1036.  
  1037. extern os_error *xeconet_enumerate_map (bits flags,
  1038.       int context,
  1039.       byte *net,
  1040.       char **net_name,
  1041.       int *ip_subnetwork_address,
  1042.       int *context_out);
  1043. extern int econet_enumerate_map (bits flags,
  1044.       int context,
  1045.       byte *net,
  1046.       char **net_name,
  1047.       int *ip_subnetwork_address);
  1048.  
  1049. /* ------------------------------------------------------------------------
  1050.  * Function:      econet_enumerate_transmit()
  1051.  *
  1052.  * Description:   Returns the handles of open transmit blocks
  1053.  *
  1054.  * Input:         tx_cb_no - value of R0 on entry
  1055.  *
  1056.  * Output:        tx_cb - value of R0 on exit (X version only)
  1057.  *
  1058.  * Returns:       R0 (non-X version only)
  1059.  *
  1060.  * Other notes:   Calls SWI 0x4001F.
  1061.  */
  1062.  
  1063. extern os_error *xeconet_enumerate_transmit (int tx_cb_no,
  1064.       econet_tx_cb *tx_cb);
  1065. extern econet_tx_cb econet_enumerate_transmit (int tx_cb_no);
  1066.  
  1067. /* ------------------------------------------------------------------------
  1068.  * Function:      econet_hardware_addresses()
  1069.  *
  1070.  * Description:   Returns the address of the Econet hardware and interrupt
  1071.  *                control registers
  1072.  *
  1073.  * Output:        hardware_address - value of R0 on exit
  1074.  *                register_address - value of R1 on exit
  1075.  *                register_mask - value of R2 on exit
  1076.  *
  1077.  * Other notes:   Calls SWI 0x40020.
  1078.  */
  1079.  
  1080. extern os_error *xeconet_hardware_addresses (byte **hardware_address,
  1081.       byte **register_address,
  1082.       bits *register_mask);
  1083. extern void econet_hardware_addresses (byte **hardware_address,
  1084.       byte **register_address,
  1085.       bits *register_mask);
  1086.  
  1087. /* ------------------------------------------------------------------------
  1088.  * Function:      econetv()
  1089.  *
  1090.  * Description:   Econet module vector
  1091.  *
  1092.  * Input:         action - value of R0 on entry
  1093.  *                count - value of R1 on entry
  1094.  *
  1095.  * Other notes:   Calls SWI 0x34 with R9 = 0x21.
  1096.  */
  1097.  
  1098. extern os_error *xeconetv (int action,
  1099.       int count);
  1100. extern void econetv (int action,
  1101.       int count);
  1102.  
  1103. /* ------------------------------------------------------------------------
  1104.  * Function:      service_reallocate_ports()
  1105.  *
  1106.  * Description:   Econet restarting
  1107.  *
  1108.  * Other notes:   Calls SWI 0x30 with R1 = 0x48.
  1109.  */
  1110.  
  1111. extern os_error *xservice_reallocate_ports (void);
  1112. extern void service_reallocate_ports (void);
  1113.  
  1114. /* ------------------------------------------------------------------------
  1115.  * Function:      service_econet_dying()
  1116.  *
  1117.  * Description:   Econet is about to leave
  1118.  *
  1119.  * Other notes:   Calls SWI 0x30 with R1 = 0x56.
  1120.  */
  1121.  
  1122. extern os_error *xservice_econet_dying (void);
  1123. extern void service_econet_dying (void);
  1124.  
  1125. /* ------------------------------------------------------------------------
  1126.  * Function:      service_protocol_dying()
  1127.  *
  1128.  * Description:   Part of the AUN driver control interface
  1129.  *
  1130.  * Other notes:   Calls SWI 0x30 with R1 = 0x83.
  1131.  */
  1132.  
  1133. extern os_error *xservice_protocol_dying (void);
  1134. extern void service_protocol_dying (void);
  1135.  
  1136. /* ------------------------------------------------------------------------
  1137.  * Function:      service_find_network_driver()
  1138.  *
  1139.  * Description:   Part of the AUN driver control interface
  1140.  *
  1141.  * Other notes:   Calls SWI 0x30 with R1 = 0x84.
  1142.  */
  1143.  
  1144. extern os_error *xservice_find_network_driver (void);
  1145. extern void service_find_network_driver (void);
  1146.  
  1147. /* ------------------------------------------------------------------------
  1148.  * Function:      service_network_driver_status()
  1149.  *
  1150.  * Description:   Part of the AUN driver control interface
  1151.  *
  1152.  * Other notes:   Calls SWI 0x30 with R1 = 0x8B.
  1153.  */
  1154.  
  1155. extern os_error *xservice_network_driver_status (void);
  1156. extern void service_network_driver_status (void);
  1157.  
  1158. /* ------------------------------------------------------------------------
  1159.  * Function:      event_econet_user_rpc()
  1160.  *
  1161.  * Description:   Econet user remote procedure event
  1162.  *
  1163.  * Input:         args - value of R1 on entry
  1164.  *                rpc - value of R2 on entry
  1165.  *                station - value of R3 on entry
  1166.  *                net - value of R4 on entry
  1167.  *
  1168.  * Other notes:   Calls SWI 0x22 with R0 = 0x8.
  1169.  */
  1170.  
  1171. extern os_error *xevent_econet_user_rpc (byte *args,
  1172.       int rpc,
  1173.       byte station,
  1174.       byte net);
  1175. extern void event_econet_user_rpc (byte *args,
  1176.       int rpc,
  1177.       byte station,
  1178.       byte net);
  1179.  
  1180. /* ------------------------------------------------------------------------
  1181.  * Function:      event_econet_rx()
  1182.  *
  1183.  * Description:   Econet receive event
  1184.  *
  1185.  * Input:         rx_cb - value of R1 on entry
  1186.  *                status - value of R2 on entry
  1187.  *
  1188.  * Other notes:   Calls SWI 0x22 with R0 = 0xE.
  1189.  */
  1190.  
  1191. extern os_error *xevent_econet_rx (econet_rx_cb rx_cb,
  1192.       int status);
  1193. extern void event_econet_rx (econet_rx_cb rx_cb,
  1194.       int status);
  1195.  
  1196. /* ------------------------------------------------------------------------
  1197.  * Function:      event_econet_tx()
  1198.  *
  1199.  * Description:   Econet transmit event
  1200.  *
  1201.  * Input:         tx_cb - value of R1 on entry
  1202.  *                status - value of R2 on entry
  1203.  *
  1204.  * Other notes:   Calls SWI 0x22 with R0 = 0xF.
  1205.  */
  1206.  
  1207. extern os_error *xevent_econet_tx (econet_tx_cb tx_cb,
  1208.       int status);
  1209. extern void event_econet_tx (econet_tx_cb tx_cb,
  1210.       int status);
  1211.  
  1212. /* ------------------------------------------------------------------------
  1213.  * Function:      event_econet_os_proc()
  1214.  *
  1215.  * Description:   Econet OS remote procedure event
  1216.  *
  1217.  * Input:         args - value of R1 on entry
  1218.  *                rpc - value of R2 on entry
  1219.  *                station - value of R3 on entry
  1220.  *                net - value of R4 on entry
  1221.  *
  1222.  * Other notes:   Calls SWI 0x22 with R0 = 0x10.
  1223.  */
  1224.  
  1225. extern os_error *xevent_econet_os_proc (byte *args,
  1226.       int rpc,
  1227.       byte station,
  1228.       byte net);
  1229. extern void event_econet_os_proc (byte *args,
  1230.       int rpc,
  1231.       byte station,
  1232.       byte net);
  1233.  
  1234. #ifdef __cplusplus
  1235.    }
  1236. #endif
  1237.  
  1238. #endif
  1239.