• bus_to_virt | Convert PCI bus to virtual address |
• fast_read_config_byte | Read configuration byte fast |
• fast_read_config_longword | Read configuration longword fast |
• fast_read_config_word | Read configuration word fast |
• fast_read_io_byte | Read IO byte fast |
• fast_read_io_longword | Read IO longword fast |
• fast_read_io_word | Read IO word fast |
• fast_read_mem_byte | Read memory byte fast |
• fast_read_mem_longword | Read memory longword fast |
• fast_read_mem_word | Read memory word fast |
• find_pci_classcode | Find PCI class code |
• find_pci_device | Find PCI device |
• get_card_used | Get card used flag |
• get_machine_id | Get machine ID |
• get_pagesize | Get pagesize |
• get_resource | Get resource Data |
• get_routing | Get interrupt routing options |
• hook_interrupt | Hook interrupt vector |
• phys_to_virt | Convert physical CPU to virtual address |
• read_config_byte | Read configuration byte |
• read_config_longword | Read configuration longword |
• read_config_word | Read configuration word |
• read_io_byte | Read IO byte |
• read_io_longword | Read IO longword |
• read_io_word | Read IO word |
• read_mem_byte | Read memory byte |
• read_mem_longword | Read memory longword |
• read_mem_word | Read memory word |
• set_card_used | Set card used flag |
• set_interrupt | Set hardware interrupt |
• special_cycle | Generates special cycle |
• unhook_interrupt | Unhook interrupt vector |
• virt_to_bus | Convert virtual to PCI bus address |
• virt_to_phys | Convert virtual to physical CPU address |
• write_config_byte | Write configuration byte |
• write_config_longword | Write configuration longword |
• write_config_word | Write configuration word |
• write_io_byte | Write IO byte |
• write_io_longword | Write IO longword |
• write_io_word | Write IO word |
• write_mem_byte | Write memory byte |
• write_mem_longword | Write memory longword |
• write_mem_word | Write memory word |
See also: PCI-BIOS Error codes Cookie _PCI Cookie XPCI
Name: | »Bus to virtual« - Convert PCI bus to virtual address
| ||||||
Opcode: | 340
| ||||||
Syntax: | int32_t bus_to_virt (int32_t handle, uint32_t address, uint32_t
*pointer);
| ||||||
Description: | This function converts from PCI bus addresses to virtual
addresses (as the CPU uses them). This is necessary since the memory
may be mapped non-linear by the PMMU even when not using virtual
memory (it is on the MILAN).
It is required that a resource (ie. a region of memory or IO space on a PCI card) is mapped contiguously, so that a simple offset can be used when copying to/from memory on a PCI card. This function might be limited to TOS or TOS-like operating systems. If an operating system uses a different memory layout, it may need to provide its own functions which drivers can use. When using this function, the driver does not need to care about DMA offsets at all.
Note: This function is the reverse of virt_to_bus. It might be slow, so the driver should avoid using it if it can determine the address by other means. | ||||||
Return value: | PCI-BIOS Error codes. If successful, mem-struct is filled as follows:
| ||||||
Availability: | PCI-BIOS
| ||||||
Group: | PCI-BIOS
| ||||||
See also: | Binding get_pagesize phys_to_virt virt_to_bus
virt_to_phys
|
C: | #include <tos.h>
int32_t bus_to_virt (int32_t handle, uint32_t address, uint32_t *pointer); |
Assembler: |
pea pointer ; Offset 10 move.l address,-(sp) ; Offset 6 move.l handle,-(sp) ; Offset 2 move.w #340,-(sp) ; Offset 0 trap #14 ; Call XBIOS lea 14(sp),sp ; Correct stack |
Name: | »Read configuration byte fast«
| ||||
Opcode: | 305
| ||||
Syntax: | int8_t fast_read_config_byte (int32_t handle, uint8_t reg);
| ||||
Description: | This function reads data from the PCI configuration space of a
given card. It does only minimal error checking and is meant to be
used only when access to configuration space is needed in interrupt
handlers.
| ||||
Return value: |
| ||||
Availability: | PCI-BIOS 2.0
| ||||
Group: | PCI-BIOS
| ||||
See also: | Binding read_config_byte read_config_word
fast_read_config_word read_config_longword
fast_read_config_longword
|
C: | #include <tos.h>
int8_t fast_read_config_byte (int32_t handle, uint8_t reg); |
Assembler: |
move.w reg,-(sp) ; Offset 6 move.l handle,-(sp) ; Offset 2 move.w #305,-(sp) ; Offset 0 trap #14 ; Call XBIOS addq.l #8,sp ; Correct stack |
Name: | »Read configuration longword fast«
| ||||
Opcode: | 307
| ||||
Syntax: | int32_t fast_read_config_longword (int32_t handle, uint8_t
reg);
| ||||
Description: | This function reads data from the PCI configuration space of a
given card. It does only minimal error checking and is meant to be
used only when access to configuration space is needed in interrupt
handlers.
| ||||
Return value: |
| ||||
Availability: | PCI-BIOS
| ||||
Group: | PCI-BIOS
| ||||
See also: | Binding read_config_byte fast_read_config_byte
read_config_word fast_read_config_word read_config_longword
|
C: | #include <tos.h>
int32_t fast_read_config_longword (int32_t handle, uint8_t reg); |
Assembler: |
move.w reg,-(sp) ; Offset 6 move.l handle,-(sp) ; Offset 2 move.w #307,-(sp) ; Offset 0 trap #14 ; Call XBIOS addq.l #8,sp ; Correct stack |
Name: | »Read configuration word fast«
| ||||
Opcode: | 306
| ||||
Syntax: | int16_t fast_read_config_word (int32_t handle, uint8_t reg);
| ||||
Description: | This function reads data from the PCI configuration space of a
given card. It does only minimal error checking and is meant to be
used only when access to configuration space is needed in interrupt
handlers.
| ||||
Return value: |
| ||||
Availability: | PCI-BIOS
| ||||
Group: | PCI-BIOS
| ||||
See also: | Binding read_config_byte fast_read_config_byte
read_config_word read_config_longword fast_read_config_longword
|
C: | #include <tos.h>
int16_t fast_read_config_word (int32_t handle, uint8_t reg); |
Assembler: |
move.w reg,-(sp) ; Offset 6 move.l handle,-(sp) ; Offset 2 move.w #306,-(sp) ; Offset 0 trap #14 ; Call XBIOS addq.l #8,sp ; Correct stack |
Name: | »Read IO byte fast«
| ||||
Opcode: | 331
| ||||
Syntax: | uint8_t fast_read_io_byte (int32_t handle, uint32_t offset);
| ||||
Description: | This function is alternative for the normal IO read function.
It returns the read value in D0 and returns no error code, which makes
it easier to use in C.
| ||||
Return value: | Read data.
| ||||
Availability: | PCI-BIOS
| ||||
Group: | PCI-BIOS
| ||||
See also: | Binding read_io_byte read_io_word fast_read_io_word
read_io_longword fast_read_io_longword
|
C: | #include <tos.h>
uint8_t fast_read_io_byte (int32_t handle, uint32_t offset); |
Assembler: |
move.l offset,-(sp) ; Offset 6 move.l handle,-(sp) ; Offset 2 move.w #331,-(sp) ; Offset 0 trap #14 ; Call XBIOS lea 10(sp),sp ; Correct stack |
Name: | »Read IO longword fast«
| ||||
Opcode: | 333
| ||||
Syntax: | uint32_t fast_read_io_longword (int32_t handle, uint32_t
offset);
| ||||
Description: | This function is alternative for the normal IO read function.
It returns the read value in D0 and returns no error code, which makes
it easier to use in C.
| ||||
Return value: | Read data.
| ||||
Availability: | PCI-BIOS
| ||||
Group: | PCI-BIOS
| ||||
See also: | Binding read_io_byte fast_read_io_byte read_io_word
fast_read_io_word read_io_longword
|
C: | #include <tos.h>
uint32_t fast_read_io_longword (int32_t handle, uint32_t offset); |
Assembler: |
move.l offset,-(sp) ; Offset 6 move.l handle,-(sp) ; Offset 2 move.w #333,-(sp) ; Offset 0 trap #14 ; Call XBIOS lea 10(sp),sp ; Correct stack |
Name: | »Read IO word fast«
| ||||
Opcode: | 332
| ||||
Syntax: | uint16_t fast_read_io_word (int32_t handle, uint32_t offset);
| ||||
Description: | This function is alternative for the normal IO read function.
It returns the read value in D0 and returns no error code, which makes
it easier to use in C.
| ||||
Return value: | Read data.
| ||||
Availability: | PCI-BIOS
| ||||
Group: | PCI-BIOS
| ||||
See also: | Binding read_io_byte fast_read_io_byte read_io_word
read_io_longword fast_read_io_longword
|
C: | #include <tos.h>
uint16_t fast_read_io_word (int32_t handle, uint32_t offset); |
Assembler: |
move.l offset,-(sp) ; Offset 6 move.l handle,-(sp) ; Offset 2 move.w #332,-(sp) ; Offset 0 trap #14 ; Call XBIOS lea 10(sp),sp ; Correct stack |
Name: | »Read memory byte fast«
| ||||
Opcode: | 322
| ||||
Syntax: | uint8_t fast_read_mem_byte (int32_t handle, uint32_t offset);
| ||||
Description: | This function is alternative for the normal memory read
function. It returns the read value in D0 and returns no error code,
which makes it easier to use in C.
| ||||
Return value: | Read data.
| ||||
Availability: | PCI-BIOS
| ||||
Group: | PCI-BIOS
| ||||
See also: | Binding read_mem_byte read_mem_word fast_read_mem_word
read_mem_longword fast_read_mem_longword
|
C: | #include <tos.h>
uint8_t fast_read_mem_byte (int32_t handle, uint32_t offset); |
Assembler: |
move.l offset,-(sp) ; Offset 6 move.l handle,-(sp) ; Offset 2 move.w #322,-(sp) ; Offset 0 trap #14 ; Call XBIOS lea 10(sp),sp ; Correct stack |
Name: | »Read memory longword fast«
| ||||
Opcode: | 324
| ||||
Syntax: | uint32_t fast_read_mem_longword (int32_t handle, uint32_t
offset);
| ||||
Description: | This function is alternative for the normal memory read
function. It returns the read value in D0 and returns no error code,
which makes it easier to use in C.
| ||||
Return value: | Read data.
| ||||
Availability: | PCI-BIOS
| ||||
Group: | PCI-BIOS
| ||||
See also: | Binding read_mem_byte fast_read_mem_byte read_mem_word
fast_read_mem_word read_mem_longword
|
C: | #include <tos.h>
uint32_t fast_read_mem_longword (int32_t handle, uint32_t offset); |
Assembler: |
move.l offset,-(sp) ; Offset 6 move.l handle,-(sp) ; Offset 2 move.w #324,-(sp) ; Offset 0 trap #14 ; Call XBIOS lea 10(sp),sp ; Correct stack |
Name: | »Read memory word fast«
| ||||
Opcode: | 323
| ||||
Syntax: | uint16_t fast_read_mem_word (int32_t handle, uint32_t offset);
| ||||
Description: | This function is alternative for the normal memory read
function. It returns the read value in D0 and returns no error code,
which makes it easier to use in C.
| ||||
Return value: | Read data.
| ||||
Availability: | PCI-BIOS
| ||||
Group: | PCI-BIOS
| ||||
See also: | Binding read_mem_byte fast_read_mem_byte read_mem_word
read_mem_longword fast_read_mem_longword
|
C: | #include <tos.h>
uint16_t fast_read_mem_word (int32_t handle, uint32_t offset); |
Assembler: |
move.l offset,-(sp) ; Offset 6 move.l handle,-(sp) ; Offset 2 move.w #323,-(sp) ; Offset 0 trap #14 ; Call XBIOS lea 10(sp),sp ; Correct stack |
Name: | »find_pci_classcode« - Returns a device handle for a device
that matches the given class code.
| ||||||
Opcode: | 301
| ||||||
Syntax: | int32_t find_pci_classcode( int32_t classcode, int16_t index );
| ||||||
Description: | This functions returns a device handle for a device that
matches the given class code.
A driver can query multiple devices with the same class code by starting with index = 0,1,2,... and calling this function until PCI_DEVICE_NOT_FOUND is returned.
| ||||||
Return value: | Device handle for a device or PCI_DEVICE_NOT_FOUND.
| ||||||
Availability: | PCI-BIOS V2.00
| ||||||
Group: | PCI-BIOS
| ||||||
See also: | Binding find_pci_device
|
C: | #include <tos.h>
int32_t find_pci_classcode( int32_t classcode, int16_t index ); |
Assembler: |
move.w index,-(sp) ; Offset 6 move.l classcode,-(sp) ; Offset 2 move.w #301,-(sp) ; Offset 0 trap #14 ; Call XBIOS addq.l #8,sp ; Correct stack |
Name: | »find_pci_device« - Returns a device handle for a device that
matches the given device and vendor ID.
| ||||||
Opcode: | 300
| ||||||
Syntax: | int32_t find_pci_device( int32_t id, int16_t index);
| ||||||
Description: | This functions returns a device handle for a device that
matches the given device and vendor ID. A driver can query multiple
devices with the same device and vendor ID by starting with index =
0,1,2,... and calling this function until PCI_DEVICE_NOT_FOUND is
returned.
As a special case, Vendor ID $FFFF can be used to query all cards found in the system, the specified Device ID is ignored in that case.
| ||||||
Return value: | Device handle for a device or PCI_DEVICE_NOT_FOUND.
| ||||||
Availability: | PCI-BIOS V2.00
| ||||||
Group: | PCI-BIOS
| ||||||
See also: | Binding find_pci_classcode
|
C: | #include <tos.h>
int32_t find_pci_device( int32_t id, int16_t index); |
Assembler: |
move.w index,-(sp) ; Offset 6 move.l id,-(sp) ; Offset 2 move.w #300,-(sp) ; Offset 0 trap #14 ; Call XBIOS addq.l #8,sp ; Correct stack |
Name: | »Get card used flag«
| ||||||||||
Opcode: | 317
| ||||||||||
Syntax: | int32_t get_card_used (int32_t handle, uint32_t *address);
| ||||||||||
Description: | This function is used to manage which card is in use by which
driver. A driver can provide a means by which a call-back function can
be called from another driver to deactivate this driver. This is
necessary for the first driver to unhook from interrupt chains etc.,
before the new driver can take over.
The returned status is either 0 (the card is free), 1 (the card is in use), 2 (the card is in use, but the driver can be uninstalled) or 3 (the card is in use, but can be taken over without further actions). Case 3 means that the driver which brought the card to this state may not hook into interrupt chains or other system resources which need to be unhooked when another driver takes over the card. If the return code is 2, the call-back function entry of the driver is returned in the memory pointer to by address.
Call-back handlers: Call-back functions are invoked by calling the call-back entry point, they return with RTS. Call-back functions may only modify those registers which are used to pass arguments or results. Call-back functions must be called in supervisor mode with at least 1024 bytes stack available. The call-back function number is passed in D0.L. If the driver supports call-back functions, the following functions are mandatory:
| ||||||||||
Return value: | PCI-BIOS Error codes
| ||||||||||
Availability: | PCI-BIOS
| ||||||||||
Group: | PCI-BIOS
| ||||||||||
See also: | Binding set_card_used
|
C: | #include <tos.h>
int32_t get_card_used (int32_t handle, uint32_t *address); |
Assembler: |
pea address ; Offset 6 move.l handle,-(sp) ; Offset 2 move.w #317,-(sp) ; Offset 0 trap #14 ; Call XBIOS lea 10(sp),sp ; Correct stack |
Name: | »Get Machine ID«
| ||||||||
Opcode: | 337
| ||||||||
Syntax: | int32_t get_machine_id ( void );
| ||||||||
Description: | This function can be used to get a unique machine ID for the
computer the driver is running on.
| ||||||||
Return value: | Machine ID, or 0 (no ID available), PCI-BIOS error-codes
Positive, non-zero values are machine IDs. They contain a manufacturer code in bit 24..31 and a unique serial number which is set by the manufacturer during production in bit 0..23. The following manufacturer codes are defined:
| ||||||||
Availability: | PCI-BIOS
| ||||||||
Group: | PCI-BIOS
| ||||||||
See also: | Binding
|
C: | #include <tos.h>
int32_t get_machine_id ( void ); |
Assembler: |
move.w #337,-(sp) ; Offset 0 trap #14 ; Call XBIOS addq.l #2,sp ; Correct stack |
Name: | »Get Pagesize«
|
Opcode: | 338
|
Syntax: | int32_t get_pagesize ( void );
|
Description: | This function can be used to get the active pagesize.
|
Return value: | Active pagesize, or 0 (paging is not active), PCI-BIOS
error-codes
|
Availability: | PCI-BIOS
|
Group: | PCI-BIOS
|
See also: | Binding
|
C: | #include <tos.h>
int32_t get_pagesize ( void ); |
Assembler: |
move.w #338,-(sp) ; Offset 0 trap #14 ; Call XBIOS addq.l #2,sp ; Correct stack |
Name: | »Get Resource Data«
| ||
Opcode: | 316
| ||
Syntax: | int32_t get_resource ( int32_t handle );
| ||
Description: |
| ||
Return value: | Pointer to array of resource descriptors or PCI-BIOS
error-codes.
| ||
Availability: | PCI-BIOS
| ||
Group: | PCI-BIOS
| ||
See also: | Binding
|
C: | #include <tos.h>
int32_t get_resource ( int32_t handle ); |
Assembler: |
move.l handle,-(sp) ; Offset 2 move.w #316,-(sp) ; Offset 0 trap #14 ; Call XBIOS addq.l #6,sp ; Correct stack |
Name: | »Get Interrupt Routing Options«
|
Opcode: | 314
|
Syntax: | int32_t get_routing ( int32_t handle );
|
Description: | To be defined. Not for use by device drivers.
|
Return value: | PCI-BIOS error-codes
|
Availability: | PCI-BIOS
|
Group: | PCI-BIOS
|
See also: | Binding
|
C: | #include <tos.h>
int32_t get_routing ( int32_t handle ); |
Assembler: |
move.l handle,-(sp) ; Offset 2 move.w #314,-(sp) ; Offset 0 trap #14 ; Call XBIOS addq.l #6,sp ; Correct stack |
Name: | »Hook Interrupt Vector«
| ||||||
Opcode: | 311
| ||||||
Syntax: | int32_t hook_interrupt (int32_t handle, uint32_t *routine,
uint32_t *parameter);
| ||||||
Description: | This function hooks the driver into the interrupt chain to
which a specific interrupt on the given card is routed. The interrupt
is enabled on the system level, however, it is the drivers
responsibility to enable the interrupt on the card as needed.
The driver should first hook into the interrupt chain, and then enable the interrupt on the card, in order not to cause spurious interrupts.
| ||||||
Return value: | PCI-BIOS Error codes
| ||||||
Availability: | PCI-BIOS
| ||||||
Group: | PCI-BIOS
| ||||||
See also: | Binding unhook_interrupt
|
C: | #include <tos.h>
int32_t hook_interrupt (int32_t handle, uint32_t *routine, uint32_t *parameter); |
Assembler: |
move.l parameter,-(sp) ; Offset 10 move.l routine,-(sp) ; Offset 6 move.l handle,-(sp) ; Offset 2 move.w #311,-(sp) ; Offset 0 trap #14 ; Call XBIOS lea 14(sp),sp ; Correct stack |
Name: | »Physical to virtual« - Convert physical CPU to virtual
address
| ||||
Opcode: | 342
| ||||
Syntax: | int32_t phys_to_virt (uint32_t address, uint32_t *pointer);
| ||||
Description: | This function converts from physical CPU addresses to virtual
addresses. This is necessary since the memory may be mapped non-linear
by the PMMU even when not using virtual memory (it is on the MILAN).
It does not depend on a special device, thus it does not get a device handle. This function might be limited to TOS or TOS-like operating systems. If an operating system uses a different memory layout, it may need to provide its own functions which drivers can use. When using this function, the driver does not need to care about DMA offsets at all.
Note: This function is the reverse of virt_to_phys. It might be slow, so the driver should avoid using it if it can determine the address by other means. | ||||
Return value: | PCI-BIOS Error codes. If successful, mem-struct is filled as follows:
| ||||
Availability: | PCI-BIOS
| ||||
Group: | PCI-BIOS
| ||||
See also: | Binding bus_to_virt get_pagesize virt_to_bus
virt_to_phys
|
C: | #include <tos.h>
int32_t phys_to_virt (uint32_t address, uint32_t *pointer); |
Assembler: |
pea pointer ; Offset 6 move.l address,-(sp) ; Offset 2 move.w #342,-(sp) ; Offset 0 trap #14 ; Call XBIOS lea 10(sp),sp ; Correct stack |
Name: | »Read configuration byte«
| ||||||
Opcode: | 302
| ||||||
Syntax: | int32_t read_config_byte (int32_t handle, uint8_t reg, uint8_t
*address);
| ||||||
Description: | This function read data from the PCI configuration space of a
given card.
| ||||||
Return value: | PCI-BIOS Error codes
| ||||||
Availability: | PCI-BIOS
| ||||||
Group: | PCI-BIOS
| ||||||
See also: | Binding fast_read_config_byte read_config_word
fast_read_config_word read_config_longword
fast_read_config_longword
|
C: | #include <tos.h>
int32_t fast_read_config_byte (int32_t handle, uint8_t reg, uint8_t *address); |
Assembler: |
pea address ; Offset 8 move.w reg,-(sp) ; Offset 6 move.l handle,-(sp) ; Offset 2 move.w #302,-(sp) ; Offset 0 trap #14 ; Call XBIOS lea 12(sp),sp ; Correct stack |
Name: | »Read configuration longword«
| ||||||
Opcode: | 304
| ||||||
Syntax: | int32_t read_config_longword (int32_t handle, uint8_t reg,
uint32_t *address);
| ||||||
Description: | This function read data from the PCI configuration space of a
given card.
| ||||||
Return value: | PCI-BIOS Error codes
| ||||||
Availability: | PCI-BIOS
| ||||||
Group: | PCI-BIOS
| ||||||
See also: | Binding read_config_byte fast_read_config_byte
read_config_word fast_read_config_word fast_read_config_longword
|
C: | #include <tos.h>
int32_t read_config_longword (int32_t handle, uint8_t reg, uint32_t *address); |
Assembler: |
pea address ; Offset 8 move.w reg,-(sp) ; Offset 6 move.l handle,-(sp) ; Offset 2 move.w #304,-(sp) ; Offset 0 trap #14 ; Call XBIOS lea 12(sp),sp ; Correct stack |
Name: | »Read configuration word«
| ||||||
Opcode: | 303
| ||||||
Syntax: | int32_t read_config_word (int32_t handle, uint8_t reg, uint16_t
*address);
| ||||||
Description: | This function read data from the PCI configuration space of a
given card.
| ||||||
Return value: | PCI-BIOS Error codes
| ||||||
Availability: | PCI-BIOS
| ||||||
Group: | PCI-BIOS
| ||||||
See also: | Binding read_config_byte fast_read_config_byte
fast_read_config_word read_config_longword
fast_read_config_longword
|
C: | #include <tos.h>
int32_t read_config_word (int32_t handle, uint8_t reg, uint16_t *address); |
Assembler: |
pea address ; Offset 8 move.w reg,-(sp) ; Offset 6 move.l handle,-(sp) ; Offset 2 move.w #303,-(sp) ; Offset 0 trap #14 ; Call XBIOS lea 12(sp),sp ; Correct stack |
Name: | »Read IO byte«
| ||||||
Opcode: | 328
| ||||||
Syntax: | int32_t read_io_byte (int32_t handle, uint32_t offset, uint8_t
*address);
| ||||||
Description: | This function reads 8-bit values from a IO region.
| ||||||
Return value: | PCI-BIOS Error codes
| ||||||
Availability: | PCI-BIOS
| ||||||
Group: | PCI-BIOS
| ||||||
See also: | Binding fast_read_io_byte read_io_word fast_read_io_word
read_io_longword fast_read_io_longword
|
C: | #include <tos.h>
int32_t read_io_byte (int32_t handle, uint32_t offset, uint8_t *address); |
Assembler: |
pea address ; Offset 10 move.l offset,-(sp) ; Offset 6 move.l handle,-(sp) ; Offset 2 move.w #328,-(sp) ; Offset 0 trap #14 ; Call XBIOS lea 14(sp),sp ; Correct stack |
Name: | »Read IO longword«
| ||||||
Opcode: | 330
| ||||||
Syntax: | int32_t read_io_longword (int32_t handle, uint32_t offset,
uint32_t *address);
| ||||||
Description: | This function reads 32-bit values from a IO region and take
care of the byte ordering - ie. the data and address are converted as
if Motorola byte ordering was in use.
| ||||||
Return value: | PCI-BIOS Error codes.
| ||||||
Availability: | PCI-BIOS
| ||||||
Group: | PCI-BIOS
| ||||||
See also: | Binding read_io_byte fast_read_io_byte read_io_word
fast_read_io_word fast_read_io_longword
|
C: | #include <tos.h>
int32_t read_io_longword (int32_t handle, uint32_t offset, uint32_t *address); |
Assembler: |
pea address ; Offset 10 move.l offset,-(sp) ; Offset 6 move.l handle,-(sp) ; Offset 2 move.w #330,-(sp) ; Offset 0 trap #14 ; Call XBIOS lea 14(sp),sp ; Correct stack |
Name: | »Read IO word«
| ||||||
Opcode: | 329
| ||||||
Syntax: | int32_t read_io_word (int32_t handle, uint32_t offset, uint16_t
*address);
| ||||||
Description: | This function reads 16-bit values from a IO region and take
care of the byte ordering - ie. the data and address are converted as
if Motorola byte ordering was in use.
| ||||||
Return value: | PCI-BIOS Error codes.
| ||||||
Availability: | PCI-BIOS
| ||||||
Group: | PCI-BIOS
| ||||||
See also: | Binding read_io_byte fast_read_io_byte fast_read_io_word
read_io_longword fast_read_io_longword
|
C: | #include <tos.h>
int32_t read_io_word (int32_t handle, uint32_t offset, uint16_t *address); |
Assembler: |
pea address ; Offset 10 move.l offset,-(sp) ; Offset 6 move.l handle,-(sp) ; Offset 2 move.w #329,-(sp) ; Offset 0 trap #14 ; Call XBIOS lea 14(sp),sp ; Correct stack |
Name: | »Read memory byte«
| ||||||
Opcode: | 319
| ||||||
Syntax: | int32_t read_mem_byte (int32_t handle, uint32_t offset, uint8_t
*address);
| ||||||
Description: | This function reads 8-bit values from a memory region. A driver
can use this function for access to registers and small buffers. For
larger amounts of data, the driver can choose to use his own copy
routines.
| ||||||
Return value: | PCI-BIOS Error codes. If successful, read data at buffer pointed to by
address.
| ||||||
Availability: | PCI-BIOS
| ||||||
Group: | PCI-BIOS
| ||||||
See also: | Binding fast_read_mem_byte read_mem_word
fast_read_mem_word read_mem_longword fast_read_mem_longword
|
C: | #include <tos.h>
int32_t read_mem_byte (int32_t handle, uint32_t offset, uint8_t *address); |
Assembler: |
pea address ; Offset 10 move.l offset,-(sp) ; Offset 6 move.l handle,-(sp) ; Offset 2 move.w #319,-(sp) ; Offset 0 trap #14 ; Call XBIOS lea 14(sp),sp ; Correct stack |
Name: | »Read memory longword«
| ||||||
Opcode: | 321
| ||||||
Syntax: | int32_t read_mem_longword (int32_t handle, uint32_t offset,
uint32_t *address);
| ||||||
Description: | This function reads 32-bit values from a memory region and take
care of the byte ordering - ie. the data and address are converted as
if Motorola byte ordering was in use. A driver can use this function
for access to registers and small buffers. For larger amounts of data,
the driver can choose to use his own copy routines, provided it knows
the byte order in use.
| ||||||
Return value: | PCI-BIOS Error codes. If successful, read data at buffer pointed to by
address.
| ||||||
Availability: | PCI-BIOS
| ||||||
Group: | PCI-BIOS
| ||||||
See also: | Binding read_mem_byte fast_read_mem_byte read_mem_word
fast_read_mem_word fast_read_mem_longword
|
C: | #include <tos.h>
int32_t read_mem_longword (int32_t handle, uint32_t offset, uint32_t *address); |
Assembler: |
pea address ; Offset 10 move.l offset,-(sp) ; Offset 6 move.l handle,-(sp) ; Offset 2 move.w #321,-(sp) ; Offset 0 trap #14 ; Call XBIOS lea 14(sp),sp ; Correct stack |
Name: | »Read memory word«
| ||||||
Opcode: | 320
| ||||||
Syntax: | int32_t read_mem_word (int32_t handle, uint32_t offset,
uint16_t *address);
| ||||||
Description: | This function reads 16-bit values from a memory region and take
care of the byte ordering - ie. the data and address are converted as
if Motorola byte ordering was in use. A driver can use this function
for access to registers and small buffers. For larger amounts of data,
the driver can choose to use his own copy routines, provided it knows
the byte order in use.
| ||||||
Return value: | PCI-BIOS Error codes. If successful, read data at buffer pointed to by
address.
| ||||||
Availability: | PCI-BIOS
| ||||||
Group: | PCI-BIOS
| ||||||
See also: | Binding read_mem_byte fast_read_mem_byte
fast_read_mem_word read_mem_longword fast_read_mem_longword
|
C: | #include <tos.h>
int32_t read_mem_word (int32_t handle, uint32_t offset, uint16_t *address); |
Assembler: |
pea address ; Offset 10 move.l offset,-(sp) ; Offset 6 move.l handle,-(sp) ; Offset 2 move.w #320,-(sp) ; Offset 0 trap #14 ; Call XBIOS lea 14(sp),sp ; Correct stack |
Name: | »Set card used flag«
| ||||||||||
Opcode: | 318
| ||||||||||
Syntax: | int32_t set_card_used (int32_t handle, uint32_t *callback);
| ||||||||||
Description: | This function is used to manage which card is in use by which
driver. A driver can provide a means by which a call-back function can
be called from another driver to deactivate this driver. This is
necessary for the first driver to unhook from interrupt chains etc.,
before the new driver can take over.
If the call-back entry is 0L, 1L or 3L, the card status is set to that value. Only a driver which 'owns' the card may use this. If any other value is passed, it is assumed to be a pointer to the drivers call back entry point, and the card status is set to 2 (in use, can be uninstalled).
Call-back handlers: Call-back functions are invoked by calling the call-back entry point, they return with RTS. Call-back functions may only modify those registers which are used to pass arguments or results. Call-back functions must be called in supervisor mode with at least 1024 bytes stack available. The call-back function number is passed in D0.L. If the driver supports call-back functions, the following functions are mandatory:
| ||||||||||
Return value: | PCI-BIOS Error codes
| ||||||||||
Availability: | PCI-BIOS
| ||||||||||
Group: | PCI-BIOS
| ||||||||||
See also: | Binding get_card_used
|
C: | #include <tos.h>
int32_t set_card_used (int32_t handle, uint32_t *callback); |
Assembler: |
pea callback ; Offset 6 move.l handle,-(sp) ; Offset 2 move.w #318,-(sp) ; Offset 0 trap #14 ; Call XBIOS lea 10(sp),sp ; Correct stack |
Name: | »Set Hardware Interrupt«
|
Opcode: | 315
|
Syntax: | int32_t set_interrupt ( int32_t handle );
|
Description: | To be defined. Not for use by device drivers.
|
Return value: | PCI-BIOS Error codes
|
Availability: | PCI-BIOS
|
Group: | PCI-BIOS
|
See also: | Binding
|
C: | #include <tos.h>
int32_t set_interrupt ( int32_t handle ); |
Assembler: |
move.l handle,-(sp) ; Offset 2 move.w #315,-(sp) ; Offset 0 trap #14 ; Call XBIOS addq.l #6,sp ; Correct stack |
Name: | »Generates special cycle«
| ||||
Opcode: | 313
| ||||
Syntax: | int32_t special_cycle ( unit8_t bus, uint32_t data );
| ||||
Description: | This function generates a special cycle on the PCI bus.
| ||||
Return value: | PCI-BIOS Error codes
| ||||
Availability: | PCI-BIOS
| ||||
Group: | PCI-BIOS
| ||||
See also: | Binding
|
C: | #include <tos.h>
int32_t special_cycle ( unit8_t bus, uint32_t data ); |
Assembler: |
move.l data,-(sp) ; Offset 4 move.w bus,-(sp) ; Offset 2 move.w #313,-(sp) ; Offset 0 trap #14 ; Call XBIOS addq.l #8,sp ; Correct stack |
Name: | » «
| ||
Opcode: | 312
| ||
Syntax: | int32_t unhook_interrupt (int32_t handle);
| ||
Description: | This function removes the driver from the interrupt chain to
which a specific interrupt on the given card is routed. The driver
must turn off interrupt generation on the card before calling this
function.
| ||
Return value: | PCI-BIOS Error codes
| ||
Availability: | PCI-BIOS
| ||
Group: | PCI-BIOS
| ||
See also: | Binding hook_interrupt
|
C: | #include <tos.h>
int32_t unhook_interrupt (int32_t handle); |
Assembler: |
move.l handle,-(sp) ; Offset 2 move.w #312,-(sp) ; Offset 0 trap #14 ; Call XBIOS addq.l #6,sp ; Correct stack |
Name: | »Virtual to bus« - Convert virtual to PCI bus address
| ||||||
Opcode: | 339
| ||||||
Syntax: | int32_t virt_to_bus (int32_t handle, uint32_t address, uint32_t
*pointer);
| ||||||
Description: | This function converts from virtual addresses (as the CPU uses
them) to PCI bus addresses. This is necessary since the memory may be
mapped non-linear by the PMMU even when not using virtual memory (it
is on the MILAN).
It is required that a resource (ie. a region of memory or IO space on a PCI card) is mapped contiguously, so that a simple offset can be used when copying to/from memory on a PCI card. This function might be limited to TOS or TOS-like operating systems. If an operating system uses a different memory layout, it may need to provide its own functions which drivers can use. When using this function, the driver does not need to care about DMA offsets at all.
| ||||||
Return value: | PCI-BIOS Error codes. If successful, mem-struct is filled as follows:
| ||||||
Availability: | PCI-BIOS
| ||||||
Group: | PCI-BIOS
| ||||||
See also: | Binding bus_to_virt get_pagesize phys_to_virt
virt_to_phys
|
C: | #include <tos.h>
int32_t virt_to_bus (int32_t handle, uint32_t address, uint32_t *pointer); |
Assembler: |
pea pointer ; Offset 10 move.l address,-(sp) ; Offset 6 move.l handle,-(sp) ; Offset 2 move.w #339,-(sp) ; Offset 0 trap #14 ; Call XBIOS lea 14(sp),sp ; Correct stack |
Name: | »Virtual to physical« - Convert virtual to physical CPU
address
| ||||
Opcode: | 341
| ||||
Syntax: | int32_t virt_to_phys (uint32_t address, uint32_t *pointer);
| ||||
Description: | This function converts from virtual addresses to physical CPU
addresses. This is necessary since the memory may be mapped non-linear
by the PMMU even when not using virtual memory (it is on the MILAN).
It does not depend on a special device, thus it does not get a device handle. This function might be limited to TOS or TOS-like operating systems. If an operating system uses a different memory layout, it may need to provide its own functions which drivers can use. When using this function, the driver does not need to care about DMA offsets at all.
| ||||
Return value: | PCI-BIOS Error codes. If successful, mem-struct is filled as follows:
| ||||
Availability: | PCI-BIOS
| ||||
Group: | PCI-BIOS
| ||||
See also: | Binding bus_to_virt get_pagesize phys_to_virt
virt_to_bus
|
C: | #include <tos.h>
int32_t virt_to_phys (uint32_t address, uint32_t *pointer); |
Assembler: |
pea pointer ; Offset 6 move.l address,-(sp) ; Offset 2 move.w #341,-(sp) ; Offset 0 trap #14 ; Call XBIOS lea 10(sp),sp ; Correct stack |
Name: | »Write configuration byte«
| ||||||
Opcode: | 308
| ||||||
Syntax: | int32_t write_config_byte (int32_t handle, uint8_t reg, uint8_t
val);
| ||||||
Description: | This function writes data to the PCI configuration space of a
given card.
The data is in little endian format, as described in the PCI specification.
| ||||||
Return value: |
| ||||||
Availability: | PCI-BIOS
| ||||||
Group: | PCI-BIOS
| ||||||
See also: | Binding write_config_word write_config_longword
read_config_byte read_config_word read_config_longword
|
C: | #include <tos.h>
int32_t write_config_byte (int32_t handle, uint8_t reg, uint8_t val); |
Assembler: |
move.w val,-(sp) ; Offset 8 move.w reg,-(sp) ; Offset 6 move.l handle,-(sp) ; Offset 2 move.w #308,-(sp) ; Offset 0 trap #14 ; Call XBIOS lea 10(sp),sp ; Correct stack |
Name: | »Write configuration longword«
| ||||||
Opcode: | 310
| ||||||
Syntax: | int32_t write_config_longword (int32_t handle, uint8_t reg,
uint32_t val);
| ||||||
Description: | This function writes data to the PCI configuration space of a
given card.
The data is in little endian format, as described in the PCI specification.
| ||||||
Return value: |
| ||||||
Availability: | PCI-BIOS
| ||||||
Group: | PCI-BIOS
| ||||||
See also: | Binding write_config_byte write_config_word
read_config_byte read_config_word read_config_longword
|
C: | #include <tos.h>
int32_t write_config_longword (int32_t handle, uint8_t reg, uint32_t val); |
Assembler: |
move.l val,-(sp) ; Offset 8 move.w reg,-(sp) ; Offset 6 move.l handle,-(sp) ; Offset 2 move.w #310,-(sp) ; Offset 0 trap #14 ; Call XBIOS lea 12(sp),sp ; Stack korrigieren |
Name: | »Write configuration word«
| ||||||
Opcode: | 309
| ||||||
Syntax: | int32_t write_config_word (int32_t handle, uint8_t reg,
uint16_t val);
| ||||||
Description: | This function writes data to the PCI configuration space of a
given card.
The data is in little endian format, as described in the PCI specification.
| ||||||
Return value: |
| ||||||
Availability: | PCI-BIOS
| ||||||
Group: | PCI-BIOS
| ||||||
See also: | Binding write_config_byte write_config_longword
read_config_byte read_config_word read_config_longword
|
C: | #include <tos.h>
int32_t write_config_word (int32_t handle, uint8_t reg, uint16_t val); |
Assembler: |
move.w val,-(sp) ; Offset 8 move.w reg,-(sp) ; Offset 6 move.l handle,-(sp) ; Offset 2 move.w #309,-(sp) ; Offset 0 trap #14 ; Call XBIOS lea 10(sp),sp ; Correct stack |
Name: | »Write IO byte«
| ||||||
Opcode: | 334
| ||||||
Syntax: | int32_t write_io_byte (int32_t handle, uint32_t offset, uint8_t
val);
| ||||||
Description: | This function writes 8-bit values to a IO region.
| ||||||
Return value: | PCI-BIOS Error codes
| ||||||
Availability: | PCI-BIOS
| ||||||
Group: | PCI-BIOS
| ||||||
See also: | Binding write_io_word write_io_longword read_io_byte
read_io_word read_io_longword
|
C: | #include <tos.h>
int32_t write_io_byte (int32_t handle, uint32_t offset, uint8_t val); |
Assembler: |
move.w val,-(sp) ; Offset 10 move.l offset,-(sp) ; Offset 6 move.l handle,-(sp) ; Offset 2 move.w #334,-(sp) ; Offset 0 trap #14 ; Call XBIOS lea 12(sp),sp ; Correct stack |
Name: | »Write IO longword«
| ||||||
Opcode: | 336
| ||||||
Syntax: | int32_t write_io_longword (int32_t handle, uint32_t offset,
uint32_t val);
| ||||||
Description: | This function writes 32-bit values to a IO region and take care
of the byte ordering - ie. the data and address are converted as if
Motorola byte ordering was in use.
| ||||||
Return value: | PCI-BIOS Error codes
| ||||||
Availability: | PCI-BIOS
| ||||||
Group: | PCI-BIOS
| ||||||
See also: | Binding write_io_byte write_io_word read_io_byte
read_io_word read_io_longword
|
C: | #include <tos.h>
int32_t write_io_longword (int32_t handle, uint32_t offset, uint32_t val); |
Assembler: |
move.l val,-(sp) ; Offset 10 move.l offset,-(sp) ; Offset 6 move.l handle,-(sp) ; Offset 2 move.w #336,-(sp) ; Offset 0 trap #14 ; Call XBIOS lea 14(sp),sp ; Correct stack |
Name: | »Write IO word«
| ||||||
Opcode: | 335
| ||||||
Syntax: | int32_t write_io_word (int32_t handle, uint32_t offset,
uint16_t val);
| ||||||
Description: | This function writes 16-bit values to a IO region and take care
of the byte ordering - ie. the data and address are converted as if
Motorola byte ordering was in use.
| ||||||
Return value: | PCI-BIOS Error codes
| ||||||
Availability: | PCI-BIOS
| ||||||
Group: | PCI-BIOS
| ||||||
See also: | Binding write_io_byte write_io_longword read_io_byte
read_io_word read_io_longword
|
C: | #include <tos.h>
int32_t write_io_word (int32_t handle, uint32_t offset, uint16_t val); |
Assembler: |
move.w val,-(sp) ; Offset 10 move.l offset,-(sp) ; Offset 6 move.l handle,-(sp) ; Offset 2 move.w #335,-(sp) ; Offset 0 trap #14 ; Call XBIOS lea 12(sp),sp ; Correct stack |
Name: | »Write memory byte«
| ||||||
Opcode: | 325
| ||||||
Syntax: | int32_t write_mem_byte (int32_t handle, uint32_t offset,
uint8_t val);
| ||||||
Description: | This function writes 8-bit values to a memory region. A driver
can use this function for access to registers and small buffers. For
larger amounts of data, the driver can choose to use his own copy
routines.
| ||||||
Return value: | PCI-BIOS Error codes
| ||||||
Availability: | PCI-BIOS
| ||||||
Group: | PCI-BIOS
| ||||||
See also: | Binding write_mem_word write_mem_longword read_mem_byte
read_mem_word read_mem_longword
|
C: | #include <tos.h>
int32_t write_mem_byte (int32_t handle, uint32_t offset, uint8_t val); |
Assembler: |
move.w val,-(sp) ; Offset 10 move.l offset,-(sp) ; Offset 6 move.l handle,-(sp) ; Offset 2 move.w #325,-(sp) ; Offset 0 trap #14 ; Call XBIOS lea 12(sp),sp ; Correct stack |
Name: | »Write memory longword«
| ||||||
Opcode: | 327
| ||||||
Syntax: | int32_t write_mem_longword (int32_t handle, uint32_t offset,
uint32_t val);
| ||||||
Description: | This function writes 32-bit values to a memory region and take
care of the byte ordering - ie. the data and address are converted as
if Motorola byte ordering was in use. A driver can use this function
for access to registers and small buffers. For larger amounts of data,
the driver can choose to use his own copy routines, provided it knows
the byte order in use.
| ||||||
Return value: | PCI-BIOS Error codes
| ||||||
Availability: | PCI-BIOS
| ||||||
Group: | PCI-BIOS
| ||||||
See also: | Binding write_mem_byte write_mem_word read_mem_byte
read_mem_word read_mem_longword
|
C: | #include <tos.h>
int32_t write_mem_longword (int32_t handle, uint32_t offset, uint32_t val); |
Assembler: |
move.l val,-(sp) ; Offset 10 move.l offset,-(sp) ; Offset 6 move.l handle,-(sp) ; Offset 2 move.w #327,-(sp) ; Offset 0 trap #14 ; Call XBIOS lea 14(sp),sp ; Correct stack |
Name: | »Write memory word«
| ||||||
Opcode: | 326
| ||||||
Syntax: | int32_t write_mem_word (int32_t handle, uint32_t offset,
uint16_t val);
| ||||||
Description: | This function writes 16-bit values to a memory region and take
care of the byte ordering - ie. the data and address are converted as
if Motorola byte ordering was in use. A driver can use this function
for access to registers and small buffers. For larger amounts of data,
the driver can choose to use his own copy routines, provided it knows
the byte order in use.
| ||||||
Return value: | PCI-BIOS Error codes
| ||||||
Availability: | PCI-BIOS
| ||||||
Group: | PCI-BIOS
| ||||||
See also: | Binding write_mem_byte write_mem_longword read_mem_byte
read_mem_word read_mem_longword
|
C: | #include <tos.h>
int32_t write_mem_word (int32_t handle, uint32_t offset, uint16_t val); |
Assembler: |
move.w val,-(sp) ; Offset 10 move.l offset,-(sp) ; Offset 6 move.l handle,-(sp) ; Offset 2 move.w #326,-(sp) ; Offset 0 trap #14 ; Call XBIOS lea 12(sp),sp ; Correct stack |
The following error codes can be returned by the PCI BIOS functions:
0x00000000 | PCI_SUCCESSFUL |
0xFFFFFFFE | PCI_FUNC_NOT_SUPPORTED |
0xFFFFFFFD | PCI_BAD_VENDOR_ID |
0xFFFFFFFC | PCI_DEVICE_NOT_FOUND |
0xFFFFFFFB | PCI_BAD_REGISTER_NUMBER |
0xFFFFFFFA | PCI_SET_FAILED |
0xFFFFFFF9 | PCI_BUFFER_TOO_SMALL |
0xFFFFFFF8 | PCI_GENERAL_ERROR |
0xFFFFFFF7 | PCI_BAD_HANDLE |
The following error codes are not returned by PCI BIOS functions directly, but are reserved for use by a library which uses these routines.
0xFFFFF001 | PCI_BIOS_NOT_INSTALLED |
0xFFFFF000 | PCI_BIOS_WRONG_VERSION |