Home XBIOSXBIOS OverScan-XBIOS-ErweiterungenOverScan-XBIOS-Erweiterungen SchnittstellenprogrammierungSchnittstellenprogrammierung

4.17 PCI-BIOS

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

Querverweis: PCI-BIOS Fehlercodes   Cookie _PCI   Cookie XPCI

4.17.1 bus_to_virt

Name: »Bus To Virtual« - Convert PCI bus to virtual address
 
Xbiosnummer: 340
 
Deklaration: int32_t bus_to_virt (int32_t handle, uint32_t address, uint32_t *pointer);
 
Beschreibung: 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.
 
handle Device handle
 
address PCI bus address
 
pointer Pointer to mem-struct for results
 

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.
 
Ergebnis: PCI-BIOS Fehlercodes. If successful, mem-struct is filled as follows:
 
uint32_t CPU (virtual) address
uint32_t length of contiguous mapped area
Verfügbar: PCI-BIOS
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   get_pagesize   phys_to_virt   virt_to_bus   virt_to_phys
 

4.17.1.1 Bindings für bus_to_virt

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           ; XBIOS aufrufen
lea       14(sp),sp     ; Stack korrigieren

4.17.2 fast_read_config_byte

Name: »Read configuration byte fast«
 
Xbiosnummer: 305
 
Deklaration: int8_t fast_read_config_byte (int32_t handle, uint8_t reg);
 
Beschreibung: Diese Funktion erlaubt das Lesen von Registern im Konfigurationsbereich ohne aufwendige Fehler- und Plausibilitätschecks und ist daher auch etwas schneller als ihre Schwester (daher besonders geeignet für Interrupt-Routinen und wenn man ganz genau weiß, was man tut ;-).
 
handle Geräte-Handle des gewählten PCI-Gerätes
 
reg Adresse des Konfigurationsregisters
 
Ergebnis: PCI-BIOS Fehlercode
 
Verfügbar: PCI-BIOS V2.00
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   read_config_byte   read_config_word   fast_read_config_word   read_config_longword   fast_read_config_longword
 

4.17.2.1 Bindings für fast_read_config_byte

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           ; XBIOS aufrufen
addq.l    #8,sp         ; Stack korrigieren

4.17.3 fast_read_config_longword

Name: »Read configuration longword fast«
 
Xbiosnummer: 307
 
Deklaration: int32_t fast_read_config_longword (int32_t handle, uint8_t reg);
 
Beschreibung: Diese Funktion erlaubt das Lesen von Registern im Konfigurationsbereich ohne aufwendige Fehler- und Plausibilitätschecks und ist daher auch etwas schneller als ihre Schwester (daher besonders geeignet für Interrupt-Routinen und wenn man ganz genau weiß, was man tut ;-).
 
handle Geräte-Handle des gewählten PCI-Gerätes
 
reg Adresse des Konfigurationsregisters (0,4,8,... für Langwort-Zugriffe)
 
Ergebnis: PCI-BIOS Fehlercode
 
Verfügbar: PCI-BIOS V2.00
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   read_config_byte   fast_read_config_byte   read_config_word   fast_read_config_word   read_config_longword
 

4.17.3.1 Bindings für fast_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           ; XBIOS aufrufen
addq.l    #8,sp         ; Stack korrigieren

4.17.4 fast_read_config_word

Name: »Read configuration word fast«
 
Xbiosnummer: 306
 
Deklaration: int16_t fast_read_config_word (int32_t handle, uint8_t reg);
 
Beschreibung: Diese Funktion erlaubt das Lesen von Registern im Konfigurationsbereich ohne aufwendige Fehler- und Plausibilitätschecks und ist daher auch etwas schneller als ihre Schwester (daher besonders geeignet für Interrupt-Routinen und wenn man ganz genau weiß, was man tut ;-).
 
handle Geräte-Handle des gewählten PCI-Gerätes
 
reg Adresse des Konfigurationsregisters (0,2,4,... für Wort-Zugriffe)
 
Ergebnis: PCI-BIOS Fehlercode
 
Verfügbar: PCI-BIOS V2.00
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   read_config_byte   fast_read_config_byte   read_config_word   read_config_longword   fast_read_config_longword
 

4.17.4.1 Bindings für fast_read_config_word

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           ; XBIOS aufrufen
addq.l    #8,sp         ; Stack korrigieren

4.17.5 fast_read_io_byte

Name: »Read IO Byte Fast«
 
Xbiosnummer: 331
 
Deklaration: uint8_t fast_read_io_byte (int32_t handle, uint32_t offset);
 
Beschreibung: 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.
 
handle Device handle
 
offset Address to access (in PCI IO address space)
 
Ergebnis: Read data.
 
Verfügbar: PCI-BIOS
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   read_io_byte   read_io_word   fast_read_io_word   read_io_longword   fast_read_io_longword
 

4.17.5.1 Bindings für fast_read_io_byte

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           ; XBIOS aufrufen
lea       10(sp),sp     ; Stack korrigieren

4.17.6 fast_read_io_longword

Name: »Read IO Longword Fast«
 
Xbiosnummer: 333
 
Deklaration: uint32_t read_io_longword (int32_t handle, uint32_t offset);
 
Beschreibung: 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.
 
handle Device handle
 
offset Address to access (in PCI IO address space)
 
Ergebnis: Read value.
 
Verfügbar: PCI-BIOS
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   read_io_byte   fast_read_io_byte   read_io_word   fast_read_io_word   read_io_longword
 

4.17.6.1 Bindings für fast_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           ; XBIOS aufrufen
lea       10(sp),sp     ; Stack korrigieren

4.17.7 fast_read_io_word

Name: »Read IO Word Fast«
 
Xbiosnummer: 332
 
Deklaration: uint16_t read_io_word (int32_t handle, uint32_t offset);
 
Beschreibung: 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.
 
handle Device handle
 
offset Address to access (in PCI IO address space)
 
Ergebnis: Read value.
 
Verfügbar: PCI-BIOS
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   read_io_byte   fast_read_io_byte   read_io_word   read_io_longword   fast_read_io_longword
 

4.17.7.1 Bindings für fast_read_io_word

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           ; XBIOS aufrufen
lea       10(sp),sp     ; Stack korrigieren

4.17.8 fast_read_mem_byte

Name: »Read memory byte fast«
 
Xbiosnummer: 322
 
Deklaration: uint8_t fast_read_mem_byte (int32_t handle, uint32_t offset);
 
Beschreibung: 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.
 
handle Device handle
 
offset Address to access (in PCI memory address space)
 
Ergebnis: Read data.
 
Verfügbar: PCI-BIOS
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   read_mem_byte   read_mem_word   fast_read_mem_word   read_mem_longword   fast_read_mem_longword
 

4.17.8.1 Bindings für fast_read_mem_byte

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           ; XBIOS aufrufen
lea       10(sp),sp     ; Stack korrigieren

4.17.9 fast_read_mem_longword

Name: »Read memory longword fast«
 
Xbiosnummer: 324
 
Deklaration: uint32_t read_mem_longword (int32_t handle, uint32_t offset);
 
Beschreibung: 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.
 
handle Device handle
 
offset Address to access (in PCI memory address space)
 
Ergebnis: Read value.
 
Verfügbar: PCI-BIOS
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   read_mem_byte   fast_read_mem_byte   read_mem_word   fast_read_mem_word   read_mem_longword
 

4.17.9.1 Bindings für fast_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           ; XBIOS aufrufen
lea       10(sp),sp     ; Stack korrigieren

4.17.10 fast_read_mem_word

Name: »Read memory word fast«
 
Xbiosnummer: 323
 
Deklaration: uint16_t read_mem_word (int32_t handle, uint32_t offset);
 
Beschreibung: 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.
 
handle Device handle
 
offset Address to access (in PCI memory address space)
 
Ergebnis: Read value.
 
Verfügbar: PCI-BIOS
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   read_mem_byte   fast_read_mem_byte   read_mem_word   read_mem_longword   fast_read_mem_longword
 

4.17.10.1 Bindings für fast_read_mem_word

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           ; XBIOS aufrufen
lea       10(sp),sp     ; Stack korrigieren

4.17.11 find_pci_classcode

Name: »find_pci_classcode« - Liefert ein Devicehandle für ein Gerät einer bestimmten Geräteklasse.
 
Xbiosnummer: 301
 
Deklaration: int32_t find_pci_classcode( int32_t classcode, int16_t index );
 
Beschreibung: Die Funktion liefert ein Devicehandle für ein Gerät, das dem angegebenen Gerät entspricht.
 
Der Treiber kann diese Funktion mehrmals für eine Geräte ID aufrufen und den index = 0,1,2,... für jeden Aufruf hochzählen, bis die Funktion PCI_DEVICE_NOT_FOUND liefert.
 
   
 
classcode Class code in Bits 23..0

 
Bit 23 ..16 Base class (0 - $FF)
Bit 15 .. 8 Sub class (0 - $FF)
Bit 7 .. 0 Programming Interface (0 - $FF)
 
Maske in Bits 26..24
Bit 26: (0: base class testen, 1: ignorieren)
Bit 25: (0: sub class testen, 1: ignorieren)
Bit 24: (0: Progr. Interface testen, 1: ignorieren)
 
index Kartenindex (0 - Anzahl Karten mit diesen IDs)
 
Ergebnis: Devicehandle für das Gerät oder PCI_DEVICE_NOT_FOUND.
 
Verfügbar: PCI-BIOS V2.00
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   find_pci_device
 

4.17.11.1 Bindings für find_pci_classcode

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               ; XBIOS aufrufen
addq.l    #8,sp             ; Stack korrigieren

4.17.12 find_pci_device

Name: »find_pci_device« - Liefert ein Devicehandle für ein Gerät, das dem angegebenen Gerät und der Hersteller ID entspricht.
 
Xbiosnummer: 300
 
Deklaration: int32_t find_pci_device( int32_t id, int16_t index);
 
Beschreibung: Die Funktion liefert ein Devicehandle für ein Gerät, das dem angegebenen Gerät und der Hersteller ID entspricht. Der Treiber kann diese Funktion mehrmals für eine Geräte und Hersteller ID aufrufen und den index = 0,1,2,... für jeden Aufruf hochzählen, bis die Funktion PCI_DEVICE_NOT_FOUND liefert.
 
Als Spezialfall kann die Hersteller ID $FFFF benutzt weren, um alle Geräte abzufragen. Die Geräte ID wird in diesem Fall ignoriert.
 
   
 
id Geräte ID in Bits 31..16 (0 - $FFFF)
Hersteller ID in Bits 15..0 (0 - $FFFE)
 
index Kartenindex (0 - Anzahl Karten mit diesen IDs)
 
Ergebnis: Devicehandle für das Gerät oder PCI_DEVICE_NOT_FOUND.
 
Verfügbar: PCI-BIOS V2.00
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   find_pci_classcode
 

4.17.12.1 Bindings für find_pci_device

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          ; XBIOS aufrufen
addq.l    #8,sp        ; Stack korrigieren

4.17.13 get_card_used

Name: »Get card used flag«
 
Xbiosnummer: 317
 
Deklaration: int32_t get_card_used (int32_t handle, uint32_t *address);
 
Beschreibung: 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.
 
handle Device handle
 
address Pointer to longword where call-back address is stored
 

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:
 
Call-back Description
Get Driver ID (0) call_back0:
Input: D0.L = call-back function number, ie. 0
Output: D0.L = driver ID (same as the driver's XBRA ID)
Try to remove driver (1) call_back1:
Input: D0.L = call-back function number, ie. 1
Output: D0.L = result code: 0=success (card is free), 1=can't uninstall
Ergebnis: PCI-BIOS Fehlercodes
 
Verfügbar: PCI-BIOS
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   set_card_used
 

4.17.13.1 Bindings für get_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           ; XBIOS aufrufen
lea       10(sp),sp     ; Stack korrigieren

4.17.14 get_machine_id

Name: »Get Machine ID«
 
Xbiosnummer: 337
 
Deklaration: int32_t get_machine_id ( void );
 
Beschreibung: This function can be used to get a unique machine ID for the computer the driver is running on.
 
Ergebnis: Machine ID oder 0 (keine ID verfügbar) oder PCI-BIOS Fehlercodes
 
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:
 

0 Medusa/Hades
1 Milan
2 PAK/Panther 2
3 ARAnyM
Verfügbar: PCI-BIOS V2.00
 
Gruppe: PCI-BIOS
 
Querverweis: Binding
 

4.17.14.1 Bindings für get_machine_id

C: #include <tos.h>
 
int32_t get_machine_id ( void );
 
Assembler:
 
move.w    #337,-(sp)    ; Offset 0
trap      #14           ; XBIOS aufrufen
addq.l    #2,sp         ; Stack korrigieren

4.17.15 get_pagesize

Name: »Get Pagesize«
 
Xbiosnummer: 338
 
Deklaration: int32_t get_pagesize ( void );
 
Beschreibung: This function can be used to get the active pagesize.
 
Ergebnis: Active pagesize, or 0 (paging is not active), PCI-BIOS error-codes
 
Verfügbar: PCI-BIOS V2.00
 
Gruppe: PCI-BIOS
 
Querverweis: Binding
 

4.17.15.1 Bindings für get_pagesize

C: #include <tos.h>
 
int32_t get_pagesize ( void );
 
Assembler:
 
move.w    #338,-(sp)    ; Offset 0
trap      #14           ; XBIOS aufrufen
addq.l    #2,sp         ; Stack korrigieren

4.17.16 get_resource

Name: »Get Resource Data«
 
Xbiosnummer: 316
 
Deklaration: int32_t get_resource ( int32_t handle );
 
Beschreibung: Liefert sämtliche Infos zu den Resourcen einer PCI-Karte (bzw. eines PCI-Gerätes im Fall von Multifunktionskarten). Die zurückgelieferten Infos dürfen von den Geräte-Treibern keinesfalls verändert werden. Der Geräte-Treiber kann an Hand der angebotenen Informationen (Byte ordering usw.) die Karte dann direkt ansprechen. Eine weitere Möglichkeit ist die Verwendung der BIOS-Routinen read_mem_..., write_mem_..., read_io_... und write_io_..., wobei man sich dann um keinerlei Nebenbedingungen selbst kümmern muß.
Die Routine liefert einen Zeiger auf den ersten Resource Deskriptor des gewünschten PCI-Gerätes. Der Geräte-Treiber kann dann die weiteren Deskriptoren über einen Offset (Länge eines Deskriptors) erreichen. Der letzte Deskriptor des Geräts ist wiederrum speziell markiert. Die Reihenfolge der Despriptoren entspricht derer der Basisadreßregister im PCI-Konfigurationsbereich. Ein PCI-Gerät kann auch mehrere Resourcen des gleichen Typs anfordern/verwenden.
 
handle Geräte-Handle des gewählten PCI-Gerätes
 
Ergebnis: positiv - Zeiger auf Resourcen-Informationen (erster Deskriptor)
negativ - PCI-BIOS Fehlercodes
 
Verfügbar: PCI-BIOS V2.00
 
Gruppe: PCI-BIOS
 
Querverweis: Binding
 

4.17.16.1 Bindings für get_resource

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           ; XBIOS aufrufen
addq.l    #6,sp         ; Stack korrigieren

4.17.17 get_routing

Name: »Get Interrupt Routing Options«
 
Xbiosnummer: 314
 
Deklaration: int32_t get_routing ( int32_t handle );
 
Beschreibung: To be defined. Not for use by device drivers.
 
Ergebnis: PCI-BIOS Fehlercodes
 
Verfügbar: PCI-BIOS V2.00
 
Gruppe: PCI-BIOS
 
Querverweis: Binding
 

4.17.17.1 Bindings für get_routing

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           ; XBIOS aufrufen
addq.l    #6,sp         ; Stack korrigieren

4.17.18 hook_interrupt

Name: »Hook Interrupt Vector«
 
Xbiosnummer: 311
 
Deklaration: int32_t hook_interrupt (int32_t handle, uint32_t *routine, uint32_t *parameter);
 
Beschreibung: 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.
 
handle Geräte-Handle des gewählten PCI-Gerätes
 
routine Zeiger auf den Interrupt-Handler des Treibers
 
parameter Zeiger auf Parameter für Interrupt-Handler, dies ist ein vom Treiber frei zu wählender Wert, der bei jedem Aufruf des Handlers vom BIOS mitübergeben wird.
 
Dadurch könnteein einziger Interrupt-Handler auch mehrere baugleiche PCI-Geräte bedienen.
 
Ergebnis: PCI-BIOS Fehlercodes
 
Verfügbar: PCI-BIOS V2.00
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   unhook_interrupt
 

4.17.18.1 Bindings für hook_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             ; XBIOS aufrufen
lea       14(sp),sp       ; Stack korrigieren

4.17.19 phys_to_virt

Name: »Physical To Virtual« - Convert physical CPU to virtual address
 
Xbiosnummer: 342
 
Deklaration: int32_t phys_to_virt (uint32_t address, uint32_t *pointer);
 
Beschreibung: 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.
 
address Physical CPU address
 
pointer Pointer to mem-struct for results
 

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.
 
Ergebnis: PCI-BIOS Fehlercodes. If successful, mem-struct is filled as follows:
 
uint32_t CPU (virtual) address
uint32_t length of contiguous mapped area
Verfügbar: PCI-BIOS
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   bus_to_virt   get_pagesize   virt_to_bus   virt_to_phys
 

4.17.19.1 Bindings für phys_to_virt

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           ; XBIOS aufrufen
lea       10(sp),sp     ; Stack korrigieren

4.17.20 read_config_byte

Name: »Read configuration byte«
 
Xbiosnummer: 302
 
Deklaration: int32_t read_config_byte (int32_t handle, uint8_t reg, uint8_t *address);
 
Beschreibung: Dies Funktion erlaubt den Lesezugriffe auf die Konfigurationsregister eines PCI-Gerätes, dessen Geräte-Handle zuvor mittels find_pci_device oder find_pci_classcode ermittelt wurde.
 
handle Geräte-Handle des gewählten PCI-Gerätes
 
reg Adresse des Konfigurationsregisters
 
address Zeiger auf Ergebnisvariable
 
Ergebnis: PCI-BIOS Fehlercodes
 
Verfügbar: PCI-BIOS V2.00
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   fast_read_config_byte   read_config_word   fast_read_config_word   read_config_longword   fast_read_config_longword
 

4.17.20.1 Bindings für read_config_byte

C: #include <tos.h>
 
int32_t 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           ; XBIOS aufrufen
lea       12(sp),sp     ; Stack korrigieren

4.17.21 read_config_longword

Name: »Read configuration longword«
 
Xbiosnummer: 304
 
Deklaration: int32_t read_config_longword (int32_t handle, uint8_t reg, uint32_t *address);
 
Beschreibung: Dies Funktion erlaubt den Lesezugriffe auf die Konfigurationsregister eines PCI-Gerätes, dessen Geräte-Handle zuvor mittels find_pci_device oder find_pci_classcode ermittelt wurde.
 
handle Geräte-Handle des gewählten PCI-Gerätes
 
reg Adresse des Konfigurationsregisters (0,4,8,... für Langwort-Zugriffe)
 
address Zeiger auf Ergebnisvariable
 
Ergebnis: PCI-BIOS Fehlercodes
 
Verfügbar: PCI-BIOS V2.00
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   read_config_byte   fast_read_config_byte   read_config_word   fast_read_config_word   fast_read_config_longword
 

4.17.21.1 Bindings für 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           ; XBIOS aufrufen
lea       12(sp),sp     ; Stack korrigieren

4.17.22 read_config_word

Name: »Read configuration word«
 
Xbiosnummer: 303
 
Deklaration: int32_t read_config_word (int32_t handle, uint8_t reg, uint16_t *address);
 
Beschreibung: Dies Funktion erlaubt den Lesezugriffe auf die Konfigurationsregister eines PCI-Gerätes, dessen Geräte-Handle zuvor mittels find_pci_device oder find_pci_classcode ermittelt wurde.
 
handle Geräte-Handle des gewählten PCI-Gerätes
 
reg Adresse des Konfigurationsregisters
 
address Zeiger auf Ergebnisvariable
 
Ergebnis: PCI-BIOS Fehlercodes
 
Verfügbar: PCI-BIOS V2.00
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   read_config_byte   fast_read_config_byte   fast_read_config_word   read_config_longword   fast_read_config_longword
 

4.17.22.1 Bindings für read_config_word

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           ; XBIOS aufrufen
lea       12(sp),sp     ; Stack korrigieren

4.17.23 read_io_byte

Name: »Read IO Byte«
 
Xbiosnummer: 328
 
Deklaration: int32_t read_io_byte (int32_t handle, uint32_t offset, uint8_t *address);
 
Beschreibung: This function reads 8-bit values from a IO region.
 
handle Device handle
 
offset Address to access (in PCI IO address space)
 
address Pointer to data in memory
 
Ergebnis: PCI-BIOS Fehlercodes
 
Verfügbar: PCI-BIOS
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   fast_read_io_byte   read_io_word   fast_read_io_word   read_io_longword   fast_read_io_longword
 

4.17.23.1 Bindings für read_io_byte

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           ; XBIOS aufrufen
lea       14(sp),sp     ; Stack korrigieren

4.17.24 read_io_longword

Name: »Read IO Longword«
 
Xbiosnummer: 330
 
Deklaration: int32_t read_io_longword (int32_t handle, uint32_t offset, uint32_t *address);
 
Beschreibung: 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.
 
handle Device handle
 
offset Address to access (in PCI IO address space)
 
address Pointer to data in memory
 
Ergebnis: PCI-BIOS Fehlercodes.
 
Verfügbar: PCI-BIOS
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   read_io_byte   fast_read_io_byte   read_io_word   fast_read_io_word   fast_read_io_longword
 

4.17.24.1 Bindings für 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           ; XBIOS aufrufen
lea       14(sp),sp     ; Stack korrigieren

4.17.25 read_io_word

Name: »Read IO Word«
 
Xbiosnummer: 329
 
Deklaration: int32_t read_io_word (int32_t handle, uint32_t offset, uint16_t *address);
 
Beschreibung: 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.
 
handle Device handle
 
offset Address to access (in PCI IO address space)
 
address Pointer to data in memory
 
Ergebnis: PCI-BIOS Fehlercodes.
 
Verfügbar: PCI-BIOS
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   read_io_byte   fast_read_io_byte   fast_read_io_word   read_io_longword   fast_read_io_longword
 

4.17.25.1 Bindings für read_io_word

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           ; XBIOS aufrufen
lea       14(sp),sp     ; Stack korrigieren

4.17.26 read_mem_byte

Name: »Read memory byte«
 
Xbiosnummer: 319
 
Deklaration: int32_t read_mem_byte (int32_t handle, uint32_t offset, uint8_t *address);
 
Beschreibung: 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.
 
handle Device handle
 
offset Address to access (in PCI memory address space)
 
address Pointer to data in memory
 
Ergebnis: PCI-BIOS Fehlercodes. If successful, read data at buffer pointed to by address.
 
Verfügbar: PCI-BIOS
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   fast_read_mem_byte   read_mem_word   fast_read_mem_word   read_mem_longword   fast_read_mem_longword
 

4.17.26.1 Bindings für read_mem_byte

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           ; XBIOS aufrufen
lea       14(sp),sp     ; Stack korrigieren

4.17.27 read_mem_longword

Name: »Read memory longword«
 
Xbiosnummer: 321
 
Deklaration: int32_t read_mem_longword (int32_t handle, uint32_t offset, uint32_t *address);
 
Beschreibung: 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.
 
handle Device handle
 
offset Address to access (in PCI memory address space)
 
address Pointer to data in memory
 
Ergebnis: PCI-BIOS Fehlercodes. If successful, read data at buffer pointed to by address.
 
Verfügbar: PCI-BIOS
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   read_mem_byte   fast_read_mem_byte   read_mem_word   fast_read_mem_word   fast_read_mem_longword
 

4.17.27.1 Bindings für 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           ; XBIOS aufrufen
lea       14(sp),sp     ; Stack korrigieren

4.17.28 read_mem_word

Name: »Read memory word«
 
Xbiosnummer: 320
 
Deklaration: int32_t read_mem_word (int32_t handle, uint32_t offset, uint16_t *address);
 
Beschreibung: 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.
 
handle Device handle
 
offset Address to access (in PCI memory address space)
 
address Pointer to data in memory
 
Ergebnis: PCI-BIOS Fehlercodes. If successful, read data at buffer pointed to by address.
 
Verfügbar: PCI-BIOS
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   read_mem_byte   fast_read_mem_byte   fast_read_mem_word   read_mem_longword   fast_read_mem_longword
 

4.17.28.1 Bindings für read_mem_word

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           ; XBIOS aufrufen
lea       14(sp),sp     ; Stack korrigieren

4.17.29 set_card_used

Name: »Set card used flag«
 
Xbiosnummer: 318
 
Deklaration: int32_t set_card_used (int32_t handle, uint32_t *callback);
 
Beschreibung: 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).
 
handle Device handle
 
callback Address of call-back entry (not pointer to address!) or 0L, 1L or 3L
 

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:
 
Call-back Description
Get Driver ID (0) call_back0:
Input: D0.L = call-back function number, ie. 0
Output: D0.L = driver ID (same as the driver's XBRA ID)
Try to remove driver (1) call_back1:
Input: D0.L = call-back function number, ie. 1
Output: D0.L = result code: 0=success (card is free), 1=can't uninstall
Ergebnis: PCI-BIOS Fehlercodes
 
Verfügbar: PCI-BIOS
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   get_card_used
 

4.17.29.1 Bindings für set_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           ; XBIOS aufrufen
lea       10(sp),sp     ; Stack korrigieren

4.17.30 set_interrupt

Name: »Set Hardware Interrupt«
 
Xbiosnummer: 315
 
Deklaration: int32_t set_interrupt ( int32_t handle );
 
Beschreibung: To be defined. Not for use by device drivers.
 
Ergebnis: PCI-BIOS Fehlercodes
 
Verfügbar: PCI-BIOS V2.00
 
Gruppe: PCI-BIOS
 
Querverweis: Binding
 

4.17.30.1 Bindings für set_interrupt

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           ; XBIOS aufrufen
addq.l    #6,sp         ; Stack korrigieren

4.17.31 special_cycle

Name: »Generates special cycle«
 
Xbiosnummer: 313
 
Deklaration: int32_t special_cycle ( unit8_t bus, uint32_t data );
 
Beschreibung: This function generates a special cycle on the PCI bus.
 
handle Bus number
 
data Cspecial cycle data
 
Ergebnis: PCI-BIOS Fehlercodes
 
Verfügbar: PCI-BIOS V2.00
 
Gruppe: PCI-BIOS
 
Querverweis: Binding
 

4.17.31.1 Bindings für special_cycle

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           ; XBIOS aufrufen
addq.l    #8,sp         ; Stack korrigieren

4.17.32 unhook_interrupt

Name: » «
 
Xbiosnummer: 312
 
Deklaration: int32_t unhook_interrupt (int32_t handle);
 
Beschreibung: Mit dieser Routine kann man einen mittels hook_interrupt angemeldeten Interrupt-Handler wieder entfernen. Der Treiber muß allerdings beachten, daß die Interrupts auf dem PCI-Gerät schon vor dem Aufruf dieser BIOS-Funktion deaktiviert werden müssen, da es sonst zu spurious interrupts kommen kann.
 
handle Geräte-Handle des gewählten PCI-Gerätes
 
Ergebnis: PCI-BIOS Fehlercodes
 
Verfügbar: PCI-BIOS V2.00
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   hook_interrupt
 

4.17.32.1 Bindings für unhook_interrupt

C: #include <tos.h>
 
int32_t unhook_interrupt (int32_t handle);
 
Assembler:
 
move.l    handle,-(sp)  ; Offset 2
move.w    #305,-(sp)    ; Offset 0
trap      #14           ; XBIOS aufrufen
addq.l    #6,sp         ; Stack korrigieren

4.17.33 virt_to_bus

Name: »Virtual To Bus« - Convert virtual to PCI bus address
 
Xbiosnummer: 339
 
Deklaration: int32_t virt_to_bus (int32_t handle, uint32_t address, uint32_t *pointer);
 
Beschreibung: 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.
 
handle Device handle
 
address Address in virtual CPU space
 
pointer Pointer to mem-struct for results
 
Ergebnis: PCI-BIOS Fehlercodes. If successful, mem-struct is filled as follows:
 
uint32_t PCI bus address
uint32_t length of contiguous mapped area, 0 if no DMA is possible at this address
Verfügbar: PCI-BIOS
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   bus_to_virt   get_pagesize   phys_to_virt   virt_to_phys
 

4.17.33.1 Bindings für virt_to_bus

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           ; XBIOS aufrufen
lea       14(sp),sp     ; Stack korrigieren

4.17.34 virt_to_phys

Name: »Virtual To Physical« - Convert virtual to physical CPU address
 
Xbiosnummer: 341
 
Deklaration: int32_t virt_to_phys (uint32_t address, uint32_t *pointer);
 
Beschreibung: 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.
 
address Address in virtual CPU space
 
pointer Pointer to mem-struct for results
 
Ergebnis: PCI-BIOS Fehlercodes. If successful, mem-struct is filled as follows:
 
uint32_t physical CPU address
uint32_t length of contiguous mapped area, 0 if not mapped
Verfügbar: PCI-BIOS
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   bus_to_virt   get_pagesize   phys_to_virt   virt_to_bus
 

4.17.34.1 Bindings für virt_to_phys

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           ; XBIOS aufrufen
lea       10(sp),sp     ; Stack korrigieren

4.17.35 write_config_byte

Name: <Write Configuration Byte>
 
Xbiosnummer: 308
 
Deklaration: int32_t write_config_byte (int32_t handle, uint8_t reg, uint8_t val);
 
Beschreibung: Dies Routine dient zum Schreiben von Konfigurationsregistern eines PCI-Gerätes.
 
handle Geräte-Handle des gewählten PCI-Gerätes
 
reg Adresse des Konfigurationsregisters (0,1,2,... für Byte-Zugriffe)
 
val zu schreibender Registerwert
 
Ergebnis: PCI-BIOS Fehlercodes
 
Verfügbar: PCI-BIOS V2.00
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   write_config_word   write_config_longword   read_config_byte   read_config_word   read_config_longword
 

4.17.35.1 Bindings für write_config_byte

C: #include <tos.h>
 
int32_t write_config_byte (int32_t handle, uint8_t reg, uint8_t val);
 
Assembler:
 
move.w    val,-(sp)     ; Offset 7
move.w    reg,-(sp)     ; Offset 6
move.l    handle,-(sp)  ; Offset 2
move.w    #308,-(sp)    ; Offset 0
trap      #14           ; XBIOS aufrufen
lea       10(sp),sp     ; Stack korrigieren

4.17.36 write_config_longword

Name: »Write configuration longword«
 
Xbiosnummer: 310
 
Deklaration: int32_t write_config_longword (int32_t handle, uint8_t reg, uint32_t val);
 
Beschreibung: Dies Routine dient zum Schreiben von Konfigurationsregistern eines PCI-Gerätes.
 
handle Geräte-Handle des gewählten PCI-Gerätes
 
reg Adresse des Konfigurationsregisters (0,4,8,... für Langwort-Zugriffe)
 
val zu schreibender Registerwert
 
Ergebnis: PCI-BIOS Fehlercodes
 
Verfügbar: PCI-BIOS V2.00
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   write_config_byte   write_config_word   read_config_byte   read_config_word   read_config_longword
 

4.17.36.1 Bindings für write_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           ; XBIOS aufrufen
lea       12(sp),sp     ; Stack korrigieren

4.17.37 write_config_word

Name: »Write configuration word«
 
Xbiosnummer: 309
 
Deklaration: int32_t write_config_word (int32_t handle, uint8_t reg, uint16_t val);
 
Beschreibung: Dies Routine dient zum Schreiben von Konfigurationsregistern eines PCI-Gerätes.
 
handle Geräte-Handle des gewählten PCI-Gerätes
 
reg Adresse des Konfigurationsregisters (0,2,4,... für Wort-Zugriffe)
 
val zu schreibender Registerwert
 
Ergebnis: PCI-BIOS Fehlercodes
 
Verfügbar: PCI-BIOS V2.00
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   write_config_byte   write_config_longword   read_config_byte   read_config_word   read_config_longword
 

4.17.37.1 Bindings für write_config_word

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           ; XBIOS aufrufen
lea       10(sp),sp     ; Correct stack

4.17.38 write_io_byte

Name: »Write IO Byte«
 
Xbiosnummer: 334
 
Deklaration: int32_t write_io_byte (int32_t handle, uint32_t offset, uint8_t val);
 
Beschreibung: This function writes 8-bit values to a IO region.
 
handle Device handle
 
offset Address to access (in PCI IO address space)
 
val Data to write (8 bits)
 
Ergebnis: PCI-BIOS Fehlercodes
 
Verfügbar: PCI-BIOS
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   write_io_word   write_io_longword   read_io_byte   read_io_word   read_io_longword
 

4.17.38.1 Bindings für write_io_byte

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           ; XBIOS aufrufen
lea       12(sp),sp     ; Stack korrigieren

4.17.39 write_io_longword

Name: »Write IO Longword«
 
Xbiosnummer: 336
 
Deklaration: int32_t write_io_longword (int32_t handle, uint32_t offset, uint32_t val);
 
Beschreibung: 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.
 
handle Device handle
 
offset Address to access (in PCI IO address space)
 
val Data to write (32 bits)
 
Ergebnis: PCI-BIOS Fehlercodes
 
Verfügbar: PCI-BIOS
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   write_io_byte   write_io_word   read_io_byte   read_io_word   read_io_longword
 

4.17.39.1 Bindings für write_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           ; XBIOS aufrufen
lea       14(sp),sp     ; Stack korrigieren

4.17.40 write_io_word

Name: »Write IO Word«
 
Xbiosnummer: 335
 
Deklaration: int32_t write_io_word (int32_t handle, uint32_t offset, uint16_t val);
 
Beschreibung: 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.
 
handle Device handle
 
offset Address to access (in PCI IO address space)
 
val Data to write (16 bits)
 
Ergebnis: PCI-BIOS Fehlercodes
 
Verfügbar: PCI-BIOS
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   write_io_byte   write_io_longword   read_io_byte   read_io_word   read_io_longword
 

4.17.40.1 Bindings für write_io_word

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           ; XBIOS aufrufen
lea       12(sp),sp     ; Stack korrigieren

4.17.41 write_mem_byte

Name: »Write Memory Byte«
 
Xbiosnummer: 325
 
Deklaration: int32_t write_mem_byte (int32_t handle, uint32_t offset, uint8_t val);
 
Beschreibung: 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.
 
handle Device handle
 
offset Address to access (in PCI memory address space)
 
val Data to write (8 bits)
 
Ergebnis: PCI-BIOS Fehlercodes
 
Verfügbar: PCI-BIOS
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   write_mem_word   write_mem_longword   read_mem_byte   read_mem_word   read_mem_longword
 

4.17.41.1 Bindings für write_mem_byte

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           ; XBIOS aufrufen
lea       12(sp),sp     ; Stack korrigieren

4.17.42 write_mem_longword

Name: »Write Memory Longword«
 
Xbiosnummer: 327
 
Deklaration: int32_t write_mem_longword (int32_t handle, uint32_t offset, uint32_t val);
 
Beschreibung: 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.
 
handle Device handle
 
offset Address to access (in PCI memory address space)
 
val Data to write (32 bits)
 
Ergebnis: PCI-BIOS Fehlercodes
 
Verfügbar: PCI-BIOS
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   write_mem_byte   write_mem_word   read_mem_byte   read_mem_word   read_mem_longword
 

4.17.42.1 Bindings für write_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           ; XBIOS aufrufen
lea       14(sp),sp     ; Stack korrigieren

4.17.43 write_mem_word

Name: »Write Memory Word«
 
Xbiosnummer: 326
 
Deklaration: int32_t write_mem_word (int32_t handle, uint32_t offset, uint16_t val);
 
Beschreibung: 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.
 
handle Device handle
 
offset Address to access (in PCI memory address space)
 
val Data to write (16 bits)
 
Ergebnis: PCI-BIOS Fehlercodes
 
Verfügbar: PCI-BIOS
 
Gruppe: PCI-BIOS
 
Querverweis: Binding   write_mem_byte   write_mem_longword   read_mem_byte   read_mem_word   read_mem_longword
 

4.17.43.1 Bindings für write_mem_word

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           ; XBIOS aufrufen
lea       12(sp),sp     ; Stack korrigieren

4.17.44 PCI-BIOS Fehlercodes

Die folgende Fehlercodes können im Fehlerfall von den BIOS-Routinen zurückgeliefert werden.

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

Die folgenden beiden Fehlercodes werden zwar nicht von den BIOS-Routinen selbst verwendet, sind aber für eine PCI-Library reserviert.

0xFFFFF001 PCI_BIOS_NOT_INSTALLED
0xFFFFF000 PCI_BIOS_WRONG_VERSION

Home XBIOSXBIOS OverScan-XBIOS-ErweiterungenOverScan-XBIOS-Erweiterungen SchnittstellenprogrammierungSchnittstellenprogrammierung