I need help. My programming skills are almost non-existent, so I can't handle it.
The hardware part is in the BUS.I (assembler) file. I would like to add a few lines in C (PCI bios calls) to then get the PCI card address.
Right now I have a separate program (RTL8029.PRG) that starts before STING.PRG. The card seems to work fine.
How to combine this into one whole?
It is based on:
PCI Bios DevKit (library for Pure C + example code + test programs with sources)
Code: Select all
#include <portab.h> /* Portability-declarations (ULONG,...) */
#include <stdio.h> /* Standard-I/O (sprintf,...) */
#include <string.h> /* String- und memory functions */
#include <tos.h> /* OS functions (Cconws,...) */
#include <pci_bios.h> /* PCI-BIOS decl. for init interface */
#include <pci.h> /* common PCI declarations */
extern LONG pcibios_init(void);
int main(void)
{
LONG handle; /* PCI device handle */
LONG error; /* BIOS error codes */
ULONG temp, io_adr, superstack, cr_n2k; /* for temporary data */
UWORD index, flaga; /* index for searching PCI-devices */
UBYTE latency, revision, grant; /* temporary data for Latency Timer,...*/
Cconws("Initialisation of PCI-BIOS interface...");
error = pcibios_init(); /* initialisation of BIOS interface */
if (error != PCI_SUCCESSFUL) /* problems during initialisation ? */
{
switch (error)
{
case PCI_BIOS_NOT_INSTALLED:
Cconws("\r\nerror, PCI-BIOS interface not found !\r\n");
Cconws("\r\nplease use PCI_BIOS.PRG in AUTO-folder\r\n");
break;
default:
Cconws("unexpected error, Bill Gates is guilty !\r\n");
}
Cconws("\r\nPCI-BIOS interface could not be installed !\r\n");
Cconws("Press any key\r\n");
Cconin(); /* wait for key to be pressed */
return 0; /* without PCI-BIOS I will leave */
}
Cconws("OK\r\n");
/******************************************************************************/
/* the pci-bios routines should be called in supervisor-mode */
superstack = Super(0L); /* supervisor-mode */
/******************************************************************************/
Cconws("\nSearching for a Realtek 8029 ethernet card...");
handle = find_pci_device (0x802910ECL, 0);
if (handle == PCI_DEVICE_NOT_FOUND)
printf("not found\r\n\n\n");
else {
printf("and found (handle = %lx)\r\n", handle);
index = fast_read_config_word(handle, CFCS_COMMAND);
if ((index & CFCR_IOSPACE) == 0)
{
write_config_word(handle, CFCS_COMMAND, index + 1);
printf("Enable response in I/O space. \n");
}
io_adr = fast_read_config_longword(handle, CBA1) & CBA_IOMASK; /* CBA1 - 0x10 */
}
/******************************************************************************/
/* now at the end of the samples we can switch back to user-mode */
Super((void*)superstack); /* back to User-mode */
/******************************************************************************/
}
And this address (io_adr + 0xb0000000) must be inserted into BUS.I
EDIT: I'm attaching the files if anyone wants to check if it works on Hades at all

You do not have the required permissions to view the files attached to this post.