did some beautifying on the code
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,46 +1,49 @@
|
||||
include
|
||||
tos/jtagwait/include
|
||||
tos/pci_test/include
|
||||
/usr/m68k-atari-mint/include
|
||||
/opt/cross-mint/m68k-atari-mint/include
|
||||
/opt/gygwin/opt/cross-mint/m68k-atari-mint/include
|
||||
dma
|
||||
m54455
|
||||
sys
|
||||
pci
|
||||
tos/pci_test
|
||||
tos/jtagwait/m5475/mshort
|
||||
m5484lite
|
||||
tos/pci_test/include
|
||||
tos/bascook
|
||||
tos/vmem_test/m5475/mshort
|
||||
i2c
|
||||
fs
|
||||
tos/vmem_test/m5475
|
||||
tos/pci_test/m5475
|
||||
spi
|
||||
if
|
||||
tos/jtagwait/m5475
|
||||
util
|
||||
kbd
|
||||
flash_scripts
|
||||
video
|
||||
usb
|
||||
exe
|
||||
tos/vmem_test/sources
|
||||
tos
|
||||
nutil
|
||||
tos/jtagwait/sources
|
||||
x86emu
|
||||
flash
|
||||
tos/vmem_test/include
|
||||
tos/bascook/sources
|
||||
tos/pci_test/m5475/mshort
|
||||
.
|
||||
radeon
|
||||
net
|
||||
xhdi
|
||||
tos/vmem_test
|
||||
tos/pci_test/sources
|
||||
firebee
|
||||
tos/jtagwait
|
||||
include
|
||||
tos/jtagwait/include
|
||||
tos/pci_test/include
|
||||
/usr/m68k-atari-mint/include
|
||||
/opt/cross-mint/m68k-atari-mint/include
|
||||
/opt/gygwin/opt/cross-mint/m68k-atari-mint/include
|
||||
dma
|
||||
m54455
|
||||
sys
|
||||
pci
|
||||
tos/pci_test
|
||||
tos/jtagwait/m5475/mshort
|
||||
m5484lite
|
||||
tos/pci_test/include
|
||||
tos/bascook
|
||||
tos/vmem_test/m5475/mshort
|
||||
i2c
|
||||
fs
|
||||
tos/vmem_test/m5475
|
||||
tos/pci_test/m5475
|
||||
spi
|
||||
if
|
||||
tos/jtagwait/m5475
|
||||
util
|
||||
kbd
|
||||
flash_scripts
|
||||
video
|
||||
usb
|
||||
exe
|
||||
tos/vmem_test/sources
|
||||
tos
|
||||
nutil
|
||||
tos/jtagwait/sources
|
||||
x86emu
|
||||
flash
|
||||
tos/vmem_test/include
|
||||
tos/bascook/sources
|
||||
tos/pci_test/m5475/mshort
|
||||
.
|
||||
radeon
|
||||
net
|
||||
xhdi
|
||||
tos/vmem_test
|
||||
tos/pci_test/sources
|
||||
firebee
|
||||
tos/jtagwait
|
||||
tos/fpga_test/include
|
||||
tos/fpga_test
|
||||
tos/fpga_test/sources
|
||||
|
||||
@@ -195,7 +195,7 @@ typedef struct /* structure of address conversion */
|
||||
|
||||
/* register 0x08 macros */
|
||||
#define PCI_CLASS_CODE(i) ((swpl((i)) & 0xff000000) >> 24)
|
||||
#define PCI_SUBCLASS(i) ((swpl((i)) & 0xffff0000) >> 16)
|
||||
#define PCI_SUBCLASS(i) ((swpl((i)) & 0x00ff0000) >> 16)
|
||||
#define PCI_PROG_IF(i) ((swpl((i)) & 0x0000ff00) >> 8)
|
||||
#define PCI_REVISION_ID(i) ((swpl((i)) & 0x000000ff))
|
||||
|
||||
|
||||
@@ -61,13 +61,13 @@ static inline uint32_t swpl(uint32_t l)
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"lea %[input],a0\n\t" \
|
||||
"mvz.b 3(a0),%[output]\n\t" \
|
||||
"lsl.l #8,%[output]\n\t" \
|
||||
"move.b 2(a0),%[output]\n\t" \
|
||||
"lsl.l #8,%[output]\n\t" \
|
||||
"move.b 1(a0),%[output]\n\t" \
|
||||
"lsl.l #8,%[output]\n\t" \
|
||||
"move.b (a0),%[output]\n\t" \
|
||||
"mvz.b 3(a0),%[output]\n\t" \
|
||||
"lsl.l #8,%[output]\n\t" \
|
||||
"move.b 2(a0),%[output]\n\t" \
|
||||
"lsl.l #8,%[output]\n\t" \
|
||||
"move.b 1(a0),%[output]\n\t" \
|
||||
"lsl.l #8,%[output]\n\t" \
|
||||
"move.b (a0),%[output]\n\t" \
|
||||
: [output] "=d" (result) /* output */
|
||||
: [input] "o" (l) /* input */
|
||||
: "cc", "a0", "memory" /* clobbered */
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
#include "interrupts.h"
|
||||
#include "wait.h"
|
||||
|
||||
//#define DEBUG_PCI
|
||||
#define DEBUG_PCI
|
||||
#ifdef DEBUG_PCI
|
||||
#define dbg(format, arg...) do { xprintf("DEBUG: %s(): " format, __FUNCTION__, ##arg); } while (0)
|
||||
#else
|
||||
@@ -541,9 +541,9 @@ int32_t pci_find_classcode(uint32_t classcode, int index)
|
||||
value = pci_read_config_longword(handle, PCICCR);
|
||||
|
||||
dbg("classcode to search for=%x\r\n", classcode);
|
||||
dbg("PCI_CLASSCODE found=%x\r\n", PCI_CLASS_CODE(value));
|
||||
dbg("PCI_SUBCLASS found=%x\r\n", PCI_SUBCLASS(value));
|
||||
dbg("PCI_PROG_IF found=%x\r\n", PCI_PROG_IF(value));
|
||||
dbg("PCI_CLASSCODE found=%02x\r\n", PCI_CLASS_CODE(value));
|
||||
dbg("PCI_SUBCLASS found=%02x\r\n", PCI_SUBCLASS(value));
|
||||
dbg("PCI_PROG_IF found=%02x\r\n", PCI_PROG_IF(value));
|
||||
|
||||
if ((classcode & (1 << 26) ? ((PCI_CLASS_CODE(value) == (classcode & 0xff))) : true) &&
|
||||
(classcode & (1 << 25) ? ((PCI_SUBCLASS(value) == ((classcode & 0xff00) >> 8))) : true) &&
|
||||
@@ -551,6 +551,7 @@ int32_t pci_find_classcode(uint32_t classcode, int index)
|
||||
{
|
||||
if (n == index)
|
||||
{
|
||||
dbg("found device at handle %d\r\n", handle);
|
||||
return handle;
|
||||
}
|
||||
n++;
|
||||
@@ -574,12 +575,13 @@ int32_t pci_find_classcode(uint32_t classcode, int index)
|
||||
{
|
||||
value = pci_read_config_longword(handle, PCICCR);
|
||||
|
||||
if ((classcode & (1 << 26) ? ((PCI_CLASS_CODE(value) == (classcode & 0xff))) : true) &&
|
||||
(classcode & (1 << 25) ? ((PCI_SUBCLASS(value) == ((classcode & 0xff00) >> 8))) : true) &&
|
||||
(classcode & (1 << 24) ? ((PCI_PROG_IF(value) == ((classcode & 0xff0000) >> 16))) : true))
|
||||
if ((classcode & PCI_FIND_BASE_CLASS ? ((PCI_CLASS_CODE(value) == (classcode & 0xff))) : true) &&
|
||||
(classcode & PCI_FIND_SUB_CLASS ? ((PCI_SUBCLASS(value) == ((classcode & 0xff00) >> 8))) : true) &&
|
||||
(classcode & PCI_FIND_PROG_IF ? ((PCI_PROG_IF(value) == ((classcode & 0xff0000) >> 16))) : true))
|
||||
{
|
||||
if (n == index)
|
||||
{
|
||||
dbg("found device with handle %d\n", handle);
|
||||
return handle;
|
||||
}
|
||||
n++;
|
||||
@@ -1023,14 +1025,15 @@ void pci_scan(void)
|
||||
|
||||
value = pci_read_config_longword(handle, PCIIDR);
|
||||
|
||||
xprintf(" %02x | %02x | %02x |%04x|%04x|%04x| %s (0x%02x)\r\n",
|
||||
xprintf(" %02x | %02x | %02x |%04x|%04x|%04x| %s (0x%02x, 0x%04x)\r\n",
|
||||
PCI_BUS_FROM_HANDLE(handle),
|
||||
PCI_DEVICE_FROM_HANDLE(handle),
|
||||
PCI_FUNCTION_FROM_HANDLE(handle),
|
||||
PCI_VENDOR_ID(value), PCI_DEVICE_ID(value),
|
||||
handle,
|
||||
device_class(pci_read_config_byte(handle, PCICCR)),
|
||||
pci_read_config_byte(handle, PCICCR));
|
||||
pci_read_config_byte(handle, PCICCR),
|
||||
pci_read_config_word(handle, PCICCR));
|
||||
|
||||
/* save handle to index value so that we'll be able to later find our resources */
|
||||
handles[index] = handle;
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
#error "unknown machine!"x
|
||||
#endif /* MACHINE_FIREBEE */
|
||||
|
||||
#define DBG_MMU
|
||||
//#define DBG_MMU
|
||||
#ifdef DBG_MMU
|
||||
#define dbg(format, arg...) do { xprintf("DEBUG (%s()): " format, __FUNCTION__, ##arg);} while(0)
|
||||
#else
|
||||
|
||||
@@ -580,11 +580,11 @@ void init_usb(void)
|
||||
|
||||
do
|
||||
{
|
||||
handle = pci_find_classcode(PCI_CLASS_SERIAL_USB | (1 << 25) | (1 << 26), index++);
|
||||
handle = pci_find_classcode(PCI_CLASS_SERIAL_USB | PCI_FIND_BASE_CLASS | PCI_FIND_SUB_CLASS, index++);
|
||||
if (handle > 0)
|
||||
{
|
||||
long id;
|
||||
long class;
|
||||
long pci_class;
|
||||
|
||||
xprintf("serial USB found at bus=0x%x, dev=0x%x, fnc=0x%x (0x%x)\r\n",
|
||||
PCI_BUS_FROM_HANDLE(handle),
|
||||
@@ -592,9 +592,9 @@ void init_usb(void)
|
||||
PCI_FUNCTION_FROM_HANDLE(handle),
|
||||
handle);
|
||||
id = pci_read_config_longword(handle, PCIIDR);
|
||||
class = pci_read_config_longword(handle, PCIREV);
|
||||
pci_class = pci_read_config_longword(handle, PCIREV);
|
||||
|
||||
if (PCI_SUBCLASS(class) == PCI_CLASS_SERIAL_USB_EHCI)
|
||||
if (PCI_SUBCLASS(pci_class) == PCI_CLASS_SERIAL_USB_EHCI)
|
||||
{
|
||||
board = ehci_usb_pci_table;
|
||||
while (board->vendor)
|
||||
@@ -609,7 +609,7 @@ void init_usb(void)
|
||||
board++;
|
||||
}
|
||||
}
|
||||
if (PCI_SUBCLASS(class) == PCI_CLASS_SERIAL_USB_OHCI)
|
||||
if (PCI_SUBCLASS(pci_class) == PCI_CLASS_SERIAL_USB_OHCI)
|
||||
{
|
||||
board = ohci_usb_pci_table;
|
||||
while (board->vendor)
|
||||
|
||||
@@ -26,14 +26,18 @@ int i;
|
||||
|
||||
void do_tests(void)
|
||||
{
|
||||
long *test_address = (long *) 0xf0000000;
|
||||
volatile unsigned long *t1 = (volatile unsigned long *) 0xf0000000;
|
||||
volatile unsigned short *t2 = (volatile unsigned short *) 0xf0000004;
|
||||
volatile unsigned short *t3 = (volatile unsigned short *) 0xf0000006;
|
||||
long value = 0;
|
||||
|
||||
while (1)
|
||||
{
|
||||
|
||||
*test_address = value;
|
||||
xprintf("value written = %ld, value read = %ld\r\n", value, *test_address);
|
||||
*t1 = value;
|
||||
*t2 = (short) value;
|
||||
*t3 = (short) (value >> 16);
|
||||
xprintf("W: 0x%lx R: 0x%lx W: 0x%04x R: 0x%04x W: 0x%04x R: 0x%04x\r\n", value, *t1,
|
||||
(unsigned short) value, *t2, (unsigned short)(value >> 16), *t3);
|
||||
value++;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user