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