home *** CD-ROM | disk | FTP | other *** search
- #ifndef podule_H
- #define podule_H
-
- /* C header file for Podule
- * written by DefMod (Sep 7 1994) on Wed Sep 7 21:19:41 1994
- * Copyright © Acorn Computers Ltd, 1994
- */
-
- /*************************************************************************
- * This source file was written by Acorn Computers Limited. It is part *
- * of the OSLib library for writing applications for RISC OS. It may be *
- * used freely in the creation of programs for RISC OS. *
- *************************************************************************/
-
- #ifndef types_H
- #include "types.h"
- #endif
-
- #ifndef os_H
- #include "os.h"
- #endif
-
- /**********************************
- * SWI names and SWI reason codes *
- **********************************/
- #undef Podule_ReadID
- #define Podule_ReadID 0x40280
- #undef XPodule_ReadID
- #define XPodule_ReadID 0x60280
- #undef Podule_ReadHeader
- #define Podule_ReadHeader 0x40281
- #undef XPodule_ReadHeader
- #define XPodule_ReadHeader 0x60281
- #undef Podule_EnumerateChunks
- #define Podule_EnumerateChunks 0x40282
- #undef XPodule_EnumerateChunks
- #define XPodule_EnumerateChunks 0x60282
- #undef Podule_ReadChunk
- #define Podule_ReadChunk 0x40283
- #undef XPodule_ReadChunk
- #define XPodule_ReadChunk 0x60283
- #undef Podule_ReadBytes
- #define Podule_ReadBytes 0x40284
- #undef XPodule_ReadBytes
- #define XPodule_ReadBytes 0x60284
- #undef Podule_WriteBytes
- #define Podule_WriteBytes 0x40285
- #undef XPodule_WriteBytes
- #define XPodule_WriteBytes 0x60285
- #undef Podule_CallLoader
- #define Podule_CallLoader 0x40286
- #undef XPodule_CallLoader
- #define XPodule_CallLoader 0x60286
- #undef Podule_RawRead
- #define Podule_RawRead 0x40287
- #undef XPodule_RawRead
- #define XPodule_RawRead 0x60287
- #undef Podule_RawWrite
- #define Podule_RawWrite 0x40288
- #undef XPodule_RawWrite
- #define XPodule_RawWrite 0x60288
- #undef Podule_HardwareAddress
- #define Podule_HardwareAddress 0x40289
- #undef XPodule_HardwareAddress
- #define XPodule_HardwareAddress 0x60289
- #undef Podule_EnumerateChunksWithInfo
- #define Podule_EnumerateChunksWithInfo 0x4028A
- #undef XPodule_EnumerateChunksWithInfo
- #define XPodule_EnumerateChunksWithInfo 0x6028A
- #undef Podule_HardwareAddresses
- #define Podule_HardwareAddresses 0x4028B
- #undef XPodule_HardwareAddresses
- #define XPodule_HardwareAddresses 0x6028B
- #undef Podule_ReturnNumber
- #define Podule_ReturnNumber 0x4028C
- #undef XPodule_ReturnNumber
- #define XPodule_ReturnNumber 0x6028C
- #undef Podule_ReadInfo
- #define Podule_ReadInfo 0x4028D
- #undef XPodule_ReadInfo
- #define XPodule_ReadInfo 0x6028D
- #undef Podule_SetSpeed
- #define Podule_SetSpeed 0x4028E
- #undef XPodule_SetSpeed
- #define XPodule_SetSpeed 0x6028E
- #undef Service_PreReset
- #define Service_PreReset 0x45
- #undef Service_ADFSPodule
- #define Service_ADFSPodule 0x10800
- #undef Service_ADFSPoduleIDE
- #define Service_ADFSPoduleIDE 0x10801
- #undef Service_ADFSPoduleIDEDying
- #define Service_ADFSPoduleIDEDying 0x10802
-
- /************************************
- * Structure and union declarations *
- ************************************/
- typedef struct podule_header podule_header;
-
- /********************
- * Type definitions *
- ********************/
- struct podule_header
- { byte b [16];
- };
-
- /************************
- * Constant definitions *
- ************************/
- #define podule_SECTION_SYSTEM_ROM (-1)
- #define podule_SECTION_EXPANSION_CARD0 0
- #define podule_SECTION_EXPANSION_CARD1 1
- #define podule_SECTION_EXPANSION_CARD2 2
- #define podule_SECTION_EXPANSION_CARD3 3
- #define podule_SECTION_EXTENSION_ROM1 (-2)
- #define error_PODULE_BAD_POD 0x500u
- #define error_PODULE_BAD_SPEED 0x501u
- #define error_PODULE_NO_POD 0x502u
- #define error_PODULE_NOT_EXT 0x503u
- #define error_PODULE_NOT_ACRN 0x504u
- #define error_PODULE_NO_LDR 0x505u
- #define error_PODULE_IN_LDR 0x506u
- #define error_PODULE_BAD_CHNK 0x507u
- #define error_PODULE_BAD_DEVICE_NUMBER 0x508u
- #define error_PODULE_BAD_DEVICE_TYPE 0x509u
- #define error_PODULE_RAM_CONFIG_SYNTAX 0x50Au
- #define error_PODULE_WRONG_PODULE_TYPE 0x50Bu
- #define error_PODULE_ROM_BOARD_SYNTAX 0x50Cu
- #define error_PODULE_BAD_READ 0x50Du
- #define error_PODULE_BD_SPEED 0x50Eu
- #define error_PODULE_NOT_EASI 0x50Fu
- #define error_PODULE_SPEED_NO 0x510u
- #define error_PODULE_EC_NO_SPD 0x511u
- #define error_PODULE_EC_NO_NET 0x512u
- #define error_PODULE_NDALLAS 0x513u
- #define error_PODULE_NOT_WRITABLE 0x580u
- #define error_PODULE_ADDRESS_RANGE 0x581u
- #define error_PODULE_DEVICE_NOT_WRITABLE 0x582u
- #define error_PODULE_PODULE_READ_ONLY 0x583u
- #define error_PODULE_ADDRESS_TOO_BIG 0x584u
-
- /*************************
- * Function declarations *
- *************************/
-
- #ifdef __cplusplus
- extern "C" {
- #endif
-
- /*************************************************************
- * NOTE: The following functions provide direct access to *
- * the SWI's noted in the function description. *
- * Please read the relevant PRM section for more *
- * information on their input/output parameters. *
- *************************************************************/
-
- /* ------------------------------------------------------------------------
- * Function: podule_read_id()
- *
- * Description: Reads an expansion card or extension ROM's identity byte
- *
- * Input: section - value of R3 on entry
- *
- * Output: ec_id - value of R0 on exit (X version only)
- *
- * Returns: R0 (non-X version only)
- *
- * Other notes: Calls SWI 0x40280.
- */
-
- extern os_error *xpodule_read_id (int section,
- int *ec_id);
- extern int podule_read_id (int section);
-
- /* ------------------------------------------------------------------------
- * Function: podule_read_header()
- *
- * Description: Reads an expansion card or extension ROM's header
- *
- * Input: header - value of R2 on entry
- * section - value of R3 on entry
- *
- * Other notes: Calls SWI 0x40281.
- */
-
- extern os_error *xpodule_read_header (podule_header *header,
- int section);
- extern void podule_read_header (podule_header *header,
- int section);
-
- /* ------------------------------------------------------------------------
- * Function: podule_enumerate_chunks()
- *
- * Description: Reads information about a chunk from the chunk directory
- *
- * Input: context - value of R0 on entry
- * section - value of R3 on entry
- *
- * Output: context_out - value of R0 on exit (X version only)
- * size - value of R1 on exit
- * os_id - value of R2 on exit
- * module_name - value of R4 on exit
- *
- * Returns: R0 (non-X version only)
- *
- * Other notes: Calls SWI 0x40282.
- */
-
- extern os_error *xpodule_enumerate_chunks (int context,
- int section,
- int *context_out,
- int *size,
- byte *os_id,
- char **module_name);
- extern int podule_enumerate_chunks (int context,
- int section,
- int *size,
- byte *os_id,
- char **module_name);
-
- /* ------------------------------------------------------------------------
- * Function: podule_read_chunk()
- *
- * Description: Reads a chunk from an expansion card or extension ROM
- *
- * Input: chunk_no - value of R0 on entry
- * buffer - value of R2 on entry
- * section - value of R3 on entry
- *
- * Other notes: Calls SWI 0x40283.
- */
-
- extern os_error *xpodule_read_chunk (int chunk_no,
- byte *buffer,
- int section);
- extern void podule_read_chunk (int chunk_no,
- byte *buffer,
- int section);
-
- /* ------------------------------------------------------------------------
- * Function: podule_read_bytes()
- *
- * Description: Reads bytes from within an expansion card's code space
- *
- * Input: start_offset - value of R0 on entry
- * size - value of R1 on entry
- * buffer - value of R2 on entry
- * slot_no - value of R3 on entry
- *
- * Other notes: Calls SWI 0x40284.
- */
-
- extern os_error *xpodule_read_bytes (int start_offset,
- int size,
- byte *buffer,
- int slot_no);
- extern void podule_read_bytes (int start_offset,
- int size,
- byte *buffer,
- int slot_no);
-
- /* ------------------------------------------------------------------------
- * Function: podule_write_bytes()
- *
- * Description: Writes bytes to within an expansion card's code space
- *
- * Input: start_offset - value of R0 on entry
- * size - value of R1 on entry
- * buffer - value of R2 on entry
- * slot_no - value of R3 on entry
- *
- * Other notes: Calls SWI 0x40285.
- */
-
- extern os_error *xpodule_write_bytes (int start_offset,
- int size,
- byte *buffer,
- int slot_no);
- extern void podule_write_bytes (int start_offset,
- int size,
- byte *buffer,
- int slot_no);
-
- /* ------------------------------------------------------------------------
- * Function: podule_call_loader()
- *
- * Description: Calls an expansion card's loader
- *
- * Input: arg0 - value of R0 on entry
- * arg1 - value of R1 on entry
- * arg2 - value of R2 on entry
- * slot_no - value of R3 on entry
- *
- * Output: arg0_out - value of R0 on exit
- * arg1_out - value of R1 on exit
- * arg2_out - value of R2 on exit
- *
- * Other notes: Calls SWI 0x40286.
- */
-
- extern os_error *xpodule_call_loader (int arg0,
- int arg1,
- int arg2,
- int slot_no,
- int *arg0_out,
- int *arg1_out,
- int *arg2_out);
- extern void podule_call_loader (int arg0,
- int arg1,
- int arg2,
- int slot_no,
- int *arg0_out,
- int *arg1_out,
- int *arg2_out);
-
- /* ------------------------------------------------------------------------
- * Function: podule_raw_read()
- *
- * Description: Reads bytes directly within an expansion card or
- * extension ROM's address space
- *
- * Input: start_offset - value of R0 on entry
- * size - value of R1 on entry
- * buffer - value of R2 on entry
- * slot_no - value of R3 on entry
- *
- * Other notes: Calls SWI 0x40287.
- */
-
- extern os_error *xpodule_raw_read (int start_offset,
- int size,
- byte *buffer,
- int slot_no);
- extern void podule_raw_read (int start_offset,
- int size,
- byte *buffer,
- int slot_no);
-
- /* ------------------------------------------------------------------------
- * Function: podule_raw_write()
- *
- * Description: Writes bytes directly within an expansion card's
- * workspace
- *
- * Input: start_offset - value of R0 on entry
- * size - value of R1 on entry
- * buffer - value of R2 on entry
- * slot_no - value of R3 on entry
- *
- * Other notes: Calls SWI 0x40288.
- */
-
- extern os_error *xpodule_raw_write (int start_offset,
- int size,
- byte *buffer,
- int slot_no);
- extern void podule_raw_write (int start_offset,
- int size,
- byte *buffer,
- int slot_no);
-
- /* ------------------------------------------------------------------------
- * Function: podule_hardware_address()
- *
- * Description: Returns an expansion card or extension ROM's base
- * address, and the address of an expansion card's CMOS RAM
- * (prefer Podule_ReadInfo)
- *
- * Input: section - value of R3 on entry
- *
- * Output: combined_addr - value of R3 on exit (X version only)
- *
- * Returns: R3 (non-X version only)
- *
- * Other notes: Calls SWI 0x40289.
- */
-
- extern os_error *xpodule_hardware_address (int section,
- int **combined_addr);
- extern int *podule_hardware_address (int section);
-
- /* ------------------------------------------------------------------------
- * Function: podule_enumerate_chunks_with_info()
- *
- * Description: Reads information about a chunk from the chunk directory
- *
- * Input: context - value of R0 on entry
- * section - value of R3 on entry
- *
- * Output: context_out - value of R0 on exit (X version only)
- * size - value of R1 on exit
- * os_id - value of R2 on exit
- * module_name - value of R4 on exit
- * help_text - value of R5 on exit
- * module_base - value of R6 on exit
- *
- * Returns: R0 (non-X version only)
- *
- * Other notes: Calls SWI 0x4028A with R6 = 0x1.
- */
-
- extern os_error *xpodule_enumerate_chunks_with_info (int context,
- int section,
- int *context_out,
- int *size,
- byte *os_id,
- char **module_name,
- char **help_text,
- int **module_base);
- extern int podule_enumerate_chunks_with_info (int context,
- int section,
- int *size,
- byte *os_id,
- char **module_name,
- char **help_text,
- int **module_base);
-
- /* ------------------------------------------------------------------------
- * Function: podule_hardware_addresses()
- *
- * Description: Returns an expansion card or extension ROM's base
- * address, and the address of an expansion card's CMOS RAM
- *
- * Input: section - value of R3 on entry
- *
- * Output: base_addr - value of R0 on exit
- * combined_addr - value of R1 on exit
- *
- * Other notes: Calls SWI 0x4028B.
- */
-
- extern os_error *xpodule_hardware_addresses (int section,
- int **base_addr,
- int **combined_addr);
- extern void podule_hardware_addresses (int section,
- int **base_addr,
- int **combined_addr);
-
- /* ------------------------------------------------------------------------
- * Function: podule_return_number()
- *
- * Description: Returns the number of expansion card and extension ROM's
- *
- * Output: expansion_card_count - value of R0 on exit
- * extension_rom_count - value of R1 on exit
- *
- * Other notes: Calls SWI 0x4028C.
- */
-
- extern os_error *xpodule_return_number (int *expansion_card_count,
- int *extension_rom_count);
- extern void podule_return_number (int *expansion_card_count,
- int *extension_rom_count);
-
- /* ------------------------------------------------------------------------
- * Function: podule_read_info()
- *
- * Description: Returns a selection of data specific to a given expansion
- * card
- *
- * Input: mask - value of R0 on entry
- * buffer - value of R1 on entry
- * size - value of R2 on entry
- * section - value of R3 on entry
- *
- * Output: used - value of R2 on exit
- *
- * Other notes: Calls SWI 0x4028D.
- */
-
- extern os_error *xpodule_read_info (bits mask,
- byte *buffer,
- int size,
- int section,
- int *used);
- extern void podule_read_info (bits mask,
- byte *buffer,
- int size,
- int section,
- int *used);
-
- /* ------------------------------------------------------------------------
- * Function: podule_set_speed()
- *
- * Description: Changes the speed of access to expansion card hardware
- *
- * Input: speed - value of R0 on entry
- * section - value of R3 on entry
- *
- * Output: old_speed - value of R0 on exit
- *
- * Other notes: Calls SWI 0x4028E.
- */
-
- extern os_error *xpodule_set_speed (int speed,
- int section,
- int *old_speed);
- extern void podule_set_speed (int speed,
- int section,
- int *old_speed);
-
- /* ------------------------------------------------------------------------
- * Function: service_pre_reset()
- *
- * Description: Pre-reset
- *
- * Other notes: Calls SWI 0x30 with R1 = 0x45.
- */
-
- extern os_error *xservice_pre_reset (void);
- extern void service_pre_reset (void);
-
- /* ------------------------------------------------------------------------
- * Function: service_adfs_podule()
- *
- * Description: Issued by ADFS to locate an ST506 expansion card
- *
- * Input: controller - value of R2 on entry
- * status_location - value of R3 on entry
- * status_bits - value of R4 on entry
- * irq_location - value of R5 on entry
- * irq_bits - value of R6 on entry
- *
- * Output: unclaimed - value of R1 on exit (X version only)
- * controller_out - value of R2 on exit
- * status_location_out - value of R3 on exit
- * status_bits_out - value of R4 on exit
- * irq_location_out - value of R5 on exit
- * irq_bits_out - value of R6 on exit
- *
- * Returns: R1 (non-X version only)
- *
- * Other notes: Calls SWI 0x30 with R1 = 0x10800.
- */
-
- extern os_error *xservice_adfs_podule (byte *controller,
- int *status_location,
- bits status_bits,
- int *irq_location,
- bits irq_bits,
- bool *unclaimed,
- byte **controller_out,
- int **status_location_out,
- bits *status_bits_out,
- int **irq_location_out,
- bits *irq_bits_out);
- extern bool service_adfs_podule (byte *controller,
- int *status_location,
- bits status_bits,
- int *irq_location,
- bits irq_bits,
- byte **controller_out,
- int **status_location_out,
- bits *status_bits_out,
- int **irq_location_out,
- bits *irq_bits_out);
-
- /* ------------------------------------------------------------------------
- * Function: service_adfs_podule_ide()
- *
- * Description: Issued by ADFS to locate an IDE expansion card
- *
- * Input: controller - value of R2 on entry
- * status_location - value of R3 on entry
- * status_bits - value of R4 on entry
- * irq_location - value of R5 on entry
- * irq_bits - value of R6 on entry
- * read_code - value of R7 on entry
- * write_code - value of R8 on entry
- *
- * Output: unclaimed - value of R1 on exit (X version only)
- * controller_out - value of R2 on exit
- * status_location_out - value of R3 on exit
- * status_bits_out - value of R4 on exit
- * irq_location_out - value of R5 on exit
- * irq_bits_out - value of R6 on exit
- * read_code_out - value of R7 on exit
- * write_code_out - value of R8 on exit
- *
- * Returns: R1 (non-X version only)
- *
- * Other notes: Calls SWI 0x30 with R1 = 0x10801.
- */
-
- extern os_error *xservice_adfs_podule_ide (byte *controller,
- int *status_location,
- bits status_bits,
- int *irq_location,
- bits irq_bits,
- void *read_code,
- void *write_code,
- bool *unclaimed,
- byte **controller_out,
- int **status_location_out,
- bits *status_bits_out,
- int **irq_location_out,
- bits *irq_bits_out,
- void **read_code_out,
- void **write_code_out);
- extern bool service_adfs_podule_ide (byte *controller,
- int *status_location,
- bits status_bits,
- int *irq_location,
- bits irq_bits,
- void *read_code,
- void *write_code,
- byte **controller_out,
- int **status_location_out,
- bits *status_bits_out,
- int **irq_location_out,
- bits *irq_bits_out,
- void **read_code_out,
- void **write_code_out);
-
- /* ------------------------------------------------------------------------
- * Function: service_adfs_podule_ide_dying()
- *
- * Description: IDE expansion card dying
- *
- * Other notes: Calls SWI 0x30 with R1 = 0x10802.
- */
-
- extern os_error *xservice_adfs_podule_ide_dying (void);
- extern void service_adfs_podule_ide_dying (void);
-
- #ifdef __cplusplus
- }
- #endif
-
- #endif
-