did some beautifying on the code
This commit is contained in:
138
BaS_gcc.files
138
BaS_gcc.files
@@ -185,10 +185,6 @@ usb/usb_kbd.c
|
||||
tos/jtagwait/sources/bas_printf.c
|
||||
tos/jtagwait/sources/bas_string.c
|
||||
tos/vmem_test/Makefile
|
||||
tos/vmem_test/sources/bas_printf.c
|
||||
tos/vmem_test/sources/bas_string.c
|
||||
tos/vmem_test/sources/printf_helper.S
|
||||
tos/vmem_test/sources/vmem_test.c
|
||||
sys/startcf.S
|
||||
sys/exceptions.S
|
||||
util/bas_printf.c
|
||||
@@ -525,11 +521,6 @@ tos/vmem_test/include/MCF5475_USB.h
|
||||
tos/vmem_test/include/MCF5475_XLB.h
|
||||
tos/vmem_test/m5475/mshort/vmem_test.prg
|
||||
tos/vmem_test/m5475/vmem_test.prg
|
||||
tos/vmem_test/sources/bas_printf.c
|
||||
tos/vmem_test/sources/bas_string.c
|
||||
tos/vmem_test/sources/printf_helper.S
|
||||
tos/vmem_test/sources/vmem_test.c
|
||||
tos/vmem_test/depend
|
||||
tos/vmem_test/Makefile
|
||||
tos/vmem_test/mapfile
|
||||
tos/vmem_test/vmem_test.config
|
||||
@@ -612,3 +603,132 @@ tos/pci_test/include/pci.h
|
||||
memory_map.txt
|
||||
pci/pci_errata.c
|
||||
include/pci_errata.h
|
||||
tos/bascook/sources/bascook.c
|
||||
tos/bascook/Makefile
|
||||
tos/fpga_test/include/bas_printf.h
|
||||
tos/fpga_test/include/bas_string.h
|
||||
tos/fpga_test/include/driver_vec.h
|
||||
tos/fpga_test/include/MCF5475.h
|
||||
tos/fpga_test/include/MCF5475_CLOCK.h
|
||||
tos/fpga_test/include/MCF5475_CTM.h
|
||||
tos/fpga_test/include/MCF5475_DMA.h
|
||||
tos/fpga_test/include/MCF5475_DSPI.h
|
||||
tos/fpga_test/include/MCF5475_EPORT.h
|
||||
tos/fpga_test/include/MCF5475_FBCS.h
|
||||
tos/fpga_test/include/MCF5475_FEC.h
|
||||
tos/fpga_test/include/MCF5475_GPIO.h
|
||||
tos/fpga_test/include/MCF5475_GPT.h
|
||||
tos/fpga_test/include/MCF5475_I2C.h
|
||||
tos/fpga_test/include/MCF5475_INTC.h
|
||||
tos/fpga_test/include/MCF5475_MMU.h
|
||||
tos/fpga_test/include/MCF5475_PAD.h
|
||||
tos/fpga_test/include/MCF5475_PCI.h
|
||||
tos/fpga_test/include/MCF5475_PCIARB.h
|
||||
tos/fpga_test/include/MCF5475_PSC.h
|
||||
tos/fpga_test/include/MCF5475_SDRAMC.h
|
||||
tos/fpga_test/include/MCF5475_SEC.h
|
||||
tos/fpga_test/include/MCF5475_SIU.h
|
||||
tos/fpga_test/include/MCF5475_SLT.h
|
||||
tos/fpga_test/include/MCF5475_SRAM.h
|
||||
tos/fpga_test/include/MCF5475_USB.h
|
||||
tos/fpga_test/include/MCF5475_XLB.h
|
||||
tos/fpga_test/sources/bas_printf.c
|
||||
tos/fpga_test/sources/bas_string.c
|
||||
tos/fpga_test/sources/printf_helper.S
|
||||
tos/fpga_test/Makefile
|
||||
tos/jtagwait/include/bas_printf.h
|
||||
tos/jtagwait/include/bas_string.h
|
||||
tos/jtagwait/include/driver_vec.h
|
||||
tos/jtagwait/include/MCF5475.h
|
||||
tos/jtagwait/include/MCF5475_CLOCK.h
|
||||
tos/jtagwait/include/MCF5475_CTM.h
|
||||
tos/jtagwait/include/MCF5475_DMA.h
|
||||
tos/jtagwait/include/MCF5475_DSPI.h
|
||||
tos/jtagwait/include/MCF5475_EPORT.h
|
||||
tos/jtagwait/include/MCF5475_FBCS.h
|
||||
tos/jtagwait/include/MCF5475_FEC.h
|
||||
tos/jtagwait/include/MCF5475_GPIO.h
|
||||
tos/jtagwait/include/MCF5475_GPT.h
|
||||
tos/jtagwait/include/MCF5475_I2C.h
|
||||
tos/jtagwait/include/MCF5475_INTC.h
|
||||
tos/jtagwait/include/MCF5475_MMU.h
|
||||
tos/jtagwait/include/MCF5475_PAD.h
|
||||
tos/jtagwait/include/MCF5475_PCI.h
|
||||
tos/jtagwait/include/MCF5475_PCIARB.h
|
||||
tos/jtagwait/include/MCF5475_PSC.h
|
||||
tos/jtagwait/include/MCF5475_SDRAMC.h
|
||||
tos/jtagwait/include/MCF5475_SEC.h
|
||||
tos/jtagwait/include/MCF5475_SIU.h
|
||||
tos/jtagwait/include/MCF5475_SLT.h
|
||||
tos/jtagwait/include/MCF5475_SRAM.h
|
||||
tos/jtagwait/include/MCF5475_USB.h
|
||||
tos/jtagwait/include/MCF5475_XLB.h
|
||||
tos/jtagwait/sources/bas_printf.c
|
||||
tos/jtagwait/sources/bas_string.c
|
||||
tos/jtagwait/sources/jtagwait.c
|
||||
tos/jtagwait/sources/printf_helper.S
|
||||
tos/jtagwait/Makefile
|
||||
tos/pci_test/include/bas_printf.h
|
||||
tos/pci_test/include/bas_string.h
|
||||
tos/pci_test/include/driver_vec.h
|
||||
tos/pci_test/include/MCF5475.h
|
||||
tos/pci_test/include/MCF5475_CLOCK.h
|
||||
tos/pci_test/include/MCF5475_CTM.h
|
||||
tos/pci_test/include/MCF5475_DMA.h
|
||||
tos/pci_test/include/MCF5475_DSPI.h
|
||||
tos/pci_test/include/MCF5475_EPORT.h
|
||||
tos/pci_test/include/MCF5475_FBCS.h
|
||||
tos/pci_test/include/MCF5475_FEC.h
|
||||
tos/pci_test/include/MCF5475_GPIO.h
|
||||
tos/pci_test/include/MCF5475_GPT.h
|
||||
tos/pci_test/include/MCF5475_I2C.h
|
||||
tos/pci_test/include/MCF5475_INTC.h
|
||||
tos/pci_test/include/MCF5475_MMU.h
|
||||
tos/pci_test/include/MCF5475_PAD.h
|
||||
tos/pci_test/include/MCF5475_PCI.h
|
||||
tos/pci_test/include/MCF5475_PCIARB.h
|
||||
tos/pci_test/include/MCF5475_PSC.h
|
||||
tos/pci_test/include/MCF5475_SDRAMC.h
|
||||
tos/pci_test/include/MCF5475_SEC.h
|
||||
tos/pci_test/include/MCF5475_SIU.h
|
||||
tos/pci_test/include/MCF5475_SLT.h
|
||||
tos/pci_test/include/MCF5475_SRAM.h
|
||||
tos/pci_test/include/MCF5475_USB.h
|
||||
tos/pci_test/include/MCF5475_XLB.h
|
||||
tos/pci_test/include/pci.h
|
||||
tos/pci_test/sources/bas_printf.c
|
||||
tos/pci_test/sources/bas_string.c
|
||||
tos/pci_test/sources/pci_test.c
|
||||
tos/pci_test/sources/printf_helper.S
|
||||
tos/pci_test/Makefile
|
||||
tos/vmem_test/include/bas_printf.h
|
||||
tos/vmem_test/include/bas_string.h
|
||||
tos/vmem_test/include/driver_vec.h
|
||||
tos/vmem_test/include/MCF5475.h
|
||||
tos/vmem_test/include/MCF5475_CLOCK.h
|
||||
tos/vmem_test/include/MCF5475_CTM.h
|
||||
tos/vmem_test/include/MCF5475_DMA.h
|
||||
tos/vmem_test/include/MCF5475_DSPI.h
|
||||
tos/vmem_test/include/MCF5475_EPORT.h
|
||||
tos/vmem_test/include/MCF5475_FBCS.h
|
||||
tos/vmem_test/include/MCF5475_FEC.h
|
||||
tos/vmem_test/include/MCF5475_GPIO.h
|
||||
tos/vmem_test/include/MCF5475_GPT.h
|
||||
tos/vmem_test/include/MCF5475_I2C.h
|
||||
tos/vmem_test/include/MCF5475_INTC.h
|
||||
tos/vmem_test/include/MCF5475_MMU.h
|
||||
tos/vmem_test/include/MCF5475_PAD.h
|
||||
tos/vmem_test/include/MCF5475_PCI.h
|
||||
tos/vmem_test/include/MCF5475_PCIARB.h
|
||||
tos/vmem_test/include/MCF5475_PSC.h
|
||||
tos/vmem_test/include/MCF5475_SDRAMC.h
|
||||
tos/vmem_test/include/MCF5475_SEC.h
|
||||
tos/vmem_test/include/MCF5475_SIU.h
|
||||
tos/vmem_test/include/MCF5475_SLT.h
|
||||
tos/vmem_test/include/MCF5475_SRAM.h
|
||||
tos/vmem_test/include/MCF5475_USB.h
|
||||
tos/vmem_test/include/MCF5475_XLB.h
|
||||
tos/vmem_test/sources/fpga_test.c
|
||||
tos/vmem_test/Makefile
|
||||
tos/Makefile
|
||||
tos/fpga_test/sources/fpga_test.c
|
||||
|
||||
@@ -44,3 +44,6 @@ 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 */
|
||||
|
||||
21
pci/pci.c
21
pci/pci.c
@@ -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