diff --git a/BaS_gcc/BaS_gcc.config b/BaS_gcc/BaS_gcc.config index 2fafefa..9569c01 100644 --- a/BaS_gcc/BaS_gcc.config +++ b/BaS_gcc/BaS_gcc.config @@ -1,3 +1,3 @@ // ADD PREDEFINED MACROS HERE! -//#define MACHINE_FIREBEE -#define MACHINE_M5484LITE +#define MACHINE_FIREBEE +// #define MACHINE_M5484LITE diff --git a/BaS_gcc/include/m54455.h b/BaS_gcc/include/m54455.h index da18d6d..513c174 100644 --- a/BaS_gcc/include/m54455.h +++ b/BaS_gcc/include/m54455.h @@ -33,8 +33,8 @@ #define BOOTFLASH_SIZE 0x800000 #define BOOTFLASH_BAM (BOOTFLASH_SIZE - 1) -#define SDRAM_START 0x00000000 /* start at address 0 */ -#define SDRAM_SIZE 0x8000000 +#define SDRAM_START 0x40000000 /* start at address 40000000 */ +#define SDRAM_SIZE 0x10000000 /* 256 MB */ #ifdef COMPILE_RAM #define TARGET_ADDRESS (SDRAM_START + SDRAM_SIZE - 0x200000) diff --git a/BaS_gcc/include/ohci.h b/BaS_gcc/include/ohci.h index 0f7d68b..b0141c8 100644 --- a/BaS_gcc/include/ohci.h +++ b/BaS_gcc/include/ohci.h @@ -80,7 +80,7 @@ struct ed uint32_t hwHeadP; uint32_t hwNextED; - struct ed *ed_prev; + volatile struct ed *ed_prev; uint8_t int_period; uint8_t int_branch; uint8_t int_load; @@ -91,7 +91,7 @@ struct ed struct ed *ed_rm_list; struct usb_device *usb_dev; - void *purb; + volatile void *purb; uint32_t unused[2]; } __attribute__((aligned(16))); typedef struct ed ed_t; @@ -145,8 +145,8 @@ struct td uint16_t hwPSW[MAXPSW]; uint8_t unused; uint8_t index; - struct ed *ed; - struct td *next_dl_td; + volatile struct ed *ed; + volatile struct td *next_dl_td; struct usb_device *usb_dev; int transfer_len; uint32_t data; @@ -166,7 +166,7 @@ typedef struct td td_t; #define NUM_INTS 32 /* part of the OHCI standard */ struct ohci_hcca { - uint32_t int_table[NUM_INTS]; /* Interrupt ED table */ + volatile uint32_t int_table[NUM_INTS]; /* Interrupt ED table */ #if defined(CONFIG_MPC5200) uint16_t pad1; /* set to 0 on each frame_no change */ uint16_t frame_no; /* current frame number */ @@ -372,7 +372,7 @@ struct virt_root_hub #define N_URB_TD 48 typedef struct { - ed_t *ed; + volatile ed_t *ed; uint16_t length; /* number of tds associated with this request */ uint16_t td_cnt; /* number of tds already serviced */ struct usb_device *dev; @@ -411,8 +411,8 @@ typedef struct ohci /* ---- end of common part ---- */ int big_endian; /* PCI BIOS */ int controller; - struct ohci_hcca *hcca_unaligned; - struct ohci_hcca *hcca; /* hcca */ + volatile struct ohci_hcca *hcca_unaligned; + volatile struct ohci_hcca *hcca; /* hcca */ td_t *td_unaligned; struct ohci_device *ohci_dev_unaligned; /* this allocates EDs for all possible endpoints */ @@ -420,7 +420,7 @@ typedef struct ohci int irq_enabled; int stat_irq; - int irq; + volatile int irq; int disabled; /* e.g. got a UE, we're hung */ int sleeping; #define OHCI_FLAGS_NEC 0x80000000 @@ -428,15 +428,15 @@ typedef struct ohci uint32_t offset; uint32_t dma_offset; - struct ohci_regs *regs; /* OHCI controller's memory */ + volatile struct ohci_regs *regs; /* OHCI controller's memory */ - int ohci_int_load[32]; /* load of the 32 Interrupt Chains (for load balancing)*/ - ed_t *ed_rm_list[2]; /* lists of all endpoints to be removed */ - ed_t *ed_bulktail; /* last endpoint of bulk list */ - ed_t *ed_controltail; /* last endpoint of control list */ + int ohci_int_load[32]; /* load of the 32 Interrupt Chains (for load balancing)*/ + volatile ed_t *ed_rm_list[2]; /* lists of all endpoints to be removed */ + volatile ed_t *ed_bulktail; /* last endpoint of bulk list */ + volatile ed_t *ed_controltail; /* last endpoint of control list */ int intrstatus; - uint32_t hc_control; /* copy of the hc control reg */ - uint32_t ndp; /* copy NDP from roothub_a */ + uint32_t hc_control; /* copy of the hc control reg */ + uint32_t ndp; /* copy NDP from roothub_a */ struct virt_root_hub rh; const char *slot_name; @@ -447,9 +447,9 @@ typedef struct ohci /* hcd */ /* endpoint */ -static int ep_link(ohci_t * ohci, ed_t * ed); -static int ep_unlink(ohci_t * ohci, ed_t * ed); -static ed_t * ep_add_ed(ohci_t * ohci, struct usb_device * usb_dev, uint32_t pipe, int interval, int load); +static int ep_link(volatile ohci_t * ohci, volatile ed_t *ed); +static int ep_unlink(volatile ohci_t * ohci, volatile ed_t *ed); +static ed_t * ep_add_ed(volatile ohci_t * ohci, struct usb_device * usb_dev, uint32_t pipe, int interval, int load); /* we need more TDs than EDs */ diff --git a/BaS_gcc/include/usb_defs.h b/BaS_gcc/include/usb_defs.h index 8032e57..bdeb9e5 100644 --- a/BaS_gcc/include/usb_defs.h +++ b/BaS_gcc/include/usb_defs.h @@ -26,6 +26,7 @@ #ifndef _USB_DEFS_H_ #define _USB_DEFS_H_ +#define CONFIG_USB_INTERRUPT_POLLING /* USB constants */ /* Device and/or Interface Class codes */ diff --git a/BaS_gcc/pci/ehci-hcd.c b/BaS_gcc/pci/ehci-hcd.c index 09ff5ba..9be487a 100644 --- a/BaS_gcc/pci/ehci-hcd.c +++ b/BaS_gcc/pci/ehci-hcd.c @@ -30,6 +30,7 @@ #include "ehci.h" #include "pci.h" +// #define DEBUG #include "debug.h" static char ehci_inited; diff --git a/BaS_gcc/pci/ohci-hcd.c b/BaS_gcc/pci/ohci-hcd.c index 5c6d3f6..3f635b2 100644 --- a/BaS_gcc/pci/ohci-hcd.c +++ b/BaS_gcc/pci/ohci-hcd.c @@ -49,7 +49,7 @@ #include "pci.h" #include "interrupts.h" -// // #define DEBUG +// #define DEBUG #include "debug.h" #undef OHCI_USE_NPS /* force NoPowerSwitching mode */ @@ -87,7 +87,7 @@ static inline uint32_t readl(volatile uint32_t *addr) /* * byteswap value and write it to address */ -static inline void writel(uint32_t value, uint32_t *address) +static inline void writel(uint32_t value, volatile uint32_t *address) { // dbg("writing %08x to %08x\r\n", value, address); * (volatile uint32_t *) address = swpl(value); @@ -156,16 +156,16 @@ struct pci_device_id ohci_usb_pci_table[] = static ohci_t gohci[10]; int ohci_inited; -static inline uint32_t roothub_a(ohci_t *ohci) { return readl(&ohci->regs->roothub.a); } -static inline uint32_t roothub_b(ohci_t *ohci) { return readl(&ohci->regs->roothub.b); } -static inline uint32_t roothub_status(ohci_t *ohci) { return readl(&ohci->regs->roothub.status); } -static inline uint32_t roothub_portstatus(ohci_t *ohci, int i) { return readl(&ohci->regs->roothub.portstatus[i]); } +static inline uint32_t roothub_a(volatile ohci_t *ohci) { return readl(&ohci->regs->roothub.a); } +static inline uint32_t roothub_b(volatile ohci_t *ohci) { return readl(&ohci->regs->roothub.b); } +static inline uint32_t roothub_status(volatile ohci_t *ohci) { return readl(&ohci->regs->roothub.status); } +static inline uint32_t roothub_portstatus(volatile ohci_t *ohci, int i) { return readl(&ohci->regs->roothub.portstatus[i]); } /* forward declaration */ -static int hc_interrupt(ohci_t *ohci); -static void td_submit_job(ohci_t *ohci, struct usb_device *dev, uint32_t pipe, +static int hc_interrupt(volatile ohci_t *ohci); +static void td_submit_job(volatile ohci_t *ohci, struct usb_device *dev, uint32_t pipe, void *buffer, int transfer_len, struct devrequest *setup, - urb_priv_t *urb, int interval); + volatile urb_priv_t *urb, int interval); static struct td *ptd; @@ -196,7 +196,7 @@ static struct td *td_alloc(struct usb_device *usb_dev) /* free HCD-private data associated with this URB */ -static void urb_free_priv(urb_priv_t *urb) +static void urb_free_priv(volatile urb_priv_t *urb) { int i; struct td *td; @@ -463,10 +463,10 @@ static void ohci_dump(ohci_t *ohci, int verbose) /* get a transfer request */ -static int sohci_submit_job(ohci_t *ohci, urb_priv_t *urb, struct devrequest *setup) +static int sohci_submit_job(volatile ohci_t *ohci, volatile urb_priv_t *urb, struct devrequest *setup) { - ed_t *ed; - urb_priv_t *purb_priv = urb; + volatile ed_t *ed; + volatile urb_priv_t *purb_priv = urb; int i; int size = 0; struct usb_device *dev = urb->dev; @@ -564,9 +564,9 @@ static int sohci_submit_job(ohci_t *ohci, urb_priv_t *urb, struct devrequest *se return 0; } -static inline int sohci_return_job(ohci_t *ohci, urb_priv_t *urb) +static inline int sohci_return_job(volatile ohci_t *ohci, volatile urb_priv_t *urb) { - struct ohci_regs *regs = ohci->regs; + volatile struct ohci_regs *regs = ohci->regs; switch (usb_pipetype(urb->pipe)) { @@ -620,7 +620,7 @@ static int sohci_get_current_frame_number(ohci_t *ohci, struct usb_device *usb_d * sets the interval to interval = 2^integer (ld (interval)) */ -static int ep_int_balance(ohci_t *ohci, int interval, int load) +static int ep_int_balance(volatile ohci_t *ohci, int interval, int load) { int i; int branch = 0; @@ -676,7 +676,7 @@ static int ep_rev(int num_bits, int word) /* link an ed into one of the HC chains */ -static int ep_link(ohci_t *ohci, ed_t *edi) +static int ep_link(volatile ohci_t *ohci, volatile ed_t *edi) { volatile ed_t *ed = edi; int int_branch; @@ -684,7 +684,7 @@ static int ep_link(ohci_t *ohci, ed_t *edi) int inter; int interval; int load; - uint32_t *ed_p; + volatile uint32_t *ed_p; ed->state = ED_OPER; ed->int_interval = 0; @@ -731,7 +731,7 @@ static int ep_link(ohci_t *ohci, ed_t *edi) { inter = 1; for (ed_p = &(ohci->hcca->int_table[ep_rev(5, i) + int_branch]); - (*ed_p != 0) && (((ed_t *)ed_p)->int_interval >= interval); + (*ed_p != 0) && (((volatile ed_t *)ed_p)->int_interval >= interval); ed_p = &(((ed_t *)ed_p)->hwNextED)) inter = ep_rev(6, ((ed_t *)ed_p)->int_interval); ed->hwNextED = *ed_p; @@ -745,11 +745,11 @@ static int ep_link(ohci_t *ohci, ed_t *edi) /*-------------------------------------------------------------------------*/ /* scan the periodic table to find and unlink this ED */ -static void periodic_unlink(struct ohci *ohci, volatile struct ed *ed, unsigned index, unsigned period) +static void periodic_unlink(volatile struct ohci *ohci, volatile struct ed *ed, unsigned index, unsigned period) { for ( ;index < NUM_INTS; index += period) { - uint32_t *ed_p = &ohci->hcca->int_table[index]; + volatile uint32_t *ed_p = &ohci->hcca->int_table[index]; /* ED might have been unlinked through another path */ while (*ed_p != 0) @@ -771,7 +771,7 @@ static void periodic_unlink(struct ohci *ohci, volatile struct ed *ed, unsigned * so the HC can eventually finish the processing of the unlinked ed */ -static int ep_unlink(ohci_t *ohci, ed_t *edi) +static int ep_unlink(volatile ohci_t *ohci, volatile ed_t *edi) { volatile ed_t *ed = edi; int i; @@ -837,7 +837,7 @@ static int ep_unlink(ohci_t *ohci, ed_t *edi) * info fields are setted anyway even though most of them should not * change */ -static ed_t *ep_add_ed(ohci_t *ohci, struct usb_device *usb_dev, uint32_t pipe, int interval, int load) +static ed_t *ep_add_ed(volatile ohci_t *ohci, struct usb_device *usb_dev, uint32_t pipe, int interval, int load) { td_t *td; ed_t *ed_ret; @@ -884,8 +884,8 @@ static ed_t *ep_add_ed(ohci_t *ohci, struct usb_device *usb_dev, uint32_t pipe, /* enqueue next TD for this URB (OHCI spec 5.2.8.2) */ -static void td_fill(ohci_t *ohci, unsigned int info, void *data, int len, - struct usb_device *dev, int index, urb_priv_t *urb_priv) +static void td_fill(volatile ohci_t *ohci, unsigned int info, void *data, int len, + struct usb_device *dev, int index, volatile urb_priv_t *urb_priv) { volatile td_t *td; volatile td_t *td_pt; @@ -953,9 +953,9 @@ static void td_fill(ohci_t *ohci, unsigned int info, void *data, int len, /* prepare all TDs of a transfer */ -static void td_submit_job(ohci_t *ohci, struct usb_device *dev, uint32_t pipe, +static void td_submit_job(volatile ohci_t *ohci, struct usb_device *dev, uint32_t pipe, void *buffer, int transfer_len, struct devrequest *setup, - urb_priv_t *urb, int interval) + volatile urb_priv_t *urb, int interval) { int data_len = transfer_len; void *data; @@ -1028,12 +1028,12 @@ static void td_submit_job(ohci_t *ohci, struct usb_device *dev, uint32_t pipe, /* calculate the transfer length and update the urb */ -static void dl_transfer_length(ohci_t *ohci, td_t *td) +static void dl_transfer_length(volatile ohci_t *ohci, volatile td_t *td) { uint32_t tdBE; uint32_t tdCBP; - urb_priv_t *lurb_priv = td->ed->purb; + volatile urb_priv_t *lurb_priv = td->ed->purb; tdBE = swpl(td->hwBE); tdCBP = swpl(td->hwCBP); @@ -1056,11 +1056,11 @@ static void dl_transfer_length(ohci_t *ohci, td_t *td) } /*-------------------------------------------------------------------------*/ -static void check_status(ohci_t *ohci, td_t *td_list) +static void check_status(volatile ohci_t *ohci, td_t *td_list) { - urb_priv_t *lurb_priv = td_list->ed->purb; + volatile urb_priv_t *lurb_priv = td_list->ed->purb; int urb_len = lurb_priv->length; - uint32_t *phwHeadP = &td_list->ed->hwHeadP; + volatile uint32_t *phwHeadP = &td_list->ed->hwHeadP; int cc = TD_CC_GET(swpl(td_list->hwINFO)); if (cc) @@ -1086,7 +1086,7 @@ static void check_status(ohci_t *ohci, td_t *td_list) * replies to the request have to be on a FIFO basis so * we reverse the reversed done-list */ -static td_t *dl_reverse_done_list(ohci_t *ohci) +static td_t *dl_reverse_done_list(volatile ohci_t *ohci) { uint32_t td_list_hc; td_t *td_rev = NULL; @@ -1117,7 +1117,7 @@ static td_t *dl_reverse_done_list(ohci_t *ohci) /*-------------------------------------------------------------------------*/ -static void finish_urb(ohci_t *ohci, urb_priv_t *urb, int status) +static void finish_urb(volatile ohci_t *ohci, volatile urb_priv_t *urb, int status) { if ((status & (ED_OPER | ED_UNLINK)) && (urb->state != URB_DEL)) { @@ -1135,12 +1135,12 @@ static void finish_urb(ohci_t *ohci, urb_priv_t *urb, int status) * HC no longer sees the TD and it has not appeared on the donelist (after * two frames). This bug has been observed on ZF Micro systems. */ -static int takeback_td(ohci_t *ohci, td_t *td_list) +static int takeback_td(volatile ohci_t *ohci, volatile td_t *td_list) { - ed_t *ed; + volatile ed_t *ed; int cc; int stat = 0; - urb_priv_t *lurb_priv; + volatile urb_priv_t *lurb_priv; uint32_t tdINFO; uint32_t edHeadP; uint32_t edTailP; @@ -1200,14 +1200,14 @@ static int takeback_td(ohci_t *ohci, td_t *td_list) return stat; } -static int dl_done_list(ohci_t *ohci) +static int dl_done_list(volatile ohci_t *ohci) { int stat = 0; - td_t *td_list = dl_reverse_done_list(ohci); + volatile td_t *td_list = dl_reverse_done_list(ohci); while (td_list) { - td_t *td_next = td_list->next_dl_td; + volatile td_t *td_next = td_list->next_dl_td; stat = takeback_td(ohci, td_list); td_list = td_next; @@ -1362,7 +1362,7 @@ int rh_check_port_status(ohci_t *controller) return res; } -static int ohci_submit_rh_msg(ohci_t *ohci, struct usb_device *dev, uint32_t pipe, +static int ohci_submit_rh_msg(volatile ohci_t *ohci, struct usb_device *dev, uint32_t pipe, void *buffer, int transfer_len, struct devrequest *cmd) { void *data = buffer; @@ -1601,13 +1601,13 @@ static int ohci_submit_rh_msg(ohci_t *ohci, struct usb_device *dev, uint32_t pip * common code for handling submit messages - used for all but root hub accesses. */ -static int submit_common_msg(ohci_t *ohci, struct usb_device *dev, uint32_t pipe, void *buffer, +static int submit_common_msg(volatile ohci_t *ohci, struct usb_device *dev, uint32_t pipe, void *buffer, int transfer_len, struct devrequest *setup, int interval) { int stat = 0; int maxsize = usb_maxpacket(dev, pipe); int timeout; - urb_priv_t *urb = driver_mem_alloc(sizeof(urb_priv_t)); + volatile urb_priv_t *urb = driver_mem_alloc(sizeof(urb_priv_t)); if (urb == NULL) { @@ -1615,7 +1615,7 @@ static int submit_common_msg(ohci_t *ohci, struct usb_device *dev, uint32_t pipe return -1; } - memset(urb, 0, sizeof(urb_priv_t)); + memset((void *) urb, 0, sizeof(urb_priv_t)); urb->dev = dev; urb->pipe = pipe; @@ -1627,7 +1627,7 @@ static int submit_common_msg(ohci_t *ohci, struct usb_device *dev, uint32_t pipe if (ohci->devgone == dev) { dev->status = USB_ST_CRC_ERR; - dbg("device is gone...\r\n"); + err("device is gone...\r\n"); return 0; } #ifdef DEBUG_OHCI @@ -1636,7 +1636,7 @@ static int submit_common_msg(ohci_t *ohci, struct usb_device *dev, uint32_t pipe #else if (ohci->irq) { - wait_ms(10); + wait_us(10); } #endif @@ -1653,7 +1653,7 @@ static int submit_common_msg(ohci_t *ohci, struct usb_device *dev, uint32_t pipe } #if 0 - wait_ms(10); + wait_us(10); /* ohci_dump_status(ohci); */ #endif @@ -1670,7 +1670,7 @@ static int submit_common_msg(ohci_t *ohci, struct usb_device *dev, uint32_t pipe timeout = 1000; } - /* wait_ms for it to complete */ + /* wait for it to complete */ while (ohci->irq) { /* check whether the controller is done */ @@ -1684,9 +1684,10 @@ static int submit_common_msg(ohci_t *ohci, struct usb_device *dev, uint32_t pipe else #endif stat = hc_interrupt(ohci); + if (stat < 0) { - dbg("USB CRC error\r\n"); + err("USB CRC error\r\n"); stat = USB_ST_CRC_ERR; break; } @@ -1710,19 +1711,19 @@ static int submit_common_msg(ohci_t *ohci, struct usb_device *dev, uint32_t pipe if (--timeout) { wait_ms(10); - if (!urb->finished) - xprintf("*\r\n"); +// if (!urb->finished) +// xprintf("*\r\n"); } else { - err("OHCI usb-%s-%c CTL:TIMEOUT", ohci->slot_name, (char) ohci->controller + '0'); + err("OHCI usb-%s-%c CTL:TIMEOUT\r\n", ohci->slot_name, (char) ohci->controller + '0'); dbg("submit_common_msg: TO status %x\r\n", stat); urb->finished = 1; stat = USB_ST_CRC_ERR; break; } } - dbg("\n"); + dev->status = stat; dev->act_len = transfer_len; #ifdef DEBUG_OHCI @@ -1746,7 +1747,7 @@ int ohci_submit_bulk_msg(struct usb_device *dev, uint32_t pipe, void *buffer, in int ohci_submit_control_msg(struct usb_device *dev, uint32_t pipe, void *buffer, int transfer_len, struct devrequest *setup) { - ohci_t *ohci = (ohci_t *)dev->priv_hcd; + volatile ohci_t *ohci = (ohci_t *) dev->priv_hcd; int maxsize = usb_maxpacket(dev, pipe); dbg("submit_control_msg dev 0x%p ohci 0x%p\r\n", dev, ohci); @@ -1756,7 +1757,7 @@ int ohci_submit_control_msg(struct usb_device *dev, uint32_t pipe, void *buffer, #else if (ohci->irq) { - wait_ms(10); + wait_us(10); } #endif @@ -1769,7 +1770,7 @@ int ohci_submit_control_msg(struct usb_device *dev, uint32_t pipe, void *buffer, if (((pipe >> 8) & 0x7f) == ohci->rh.devnum) { ohci->rh.dev = dev; - + dbg("redirect\r\n"); /* root hub - redirect */ return ohci_submit_rh_msg(ohci, dev, pipe, buffer, transfer_len, setup); } @@ -1788,7 +1789,7 @@ int ohci_submit_int_msg(struct usb_device *dev, uint32_t pipe, void *buffer, int /* reset the HC and BUS */ -static int hc_reset(ohci_t *ohci) +static int hc_reset(volatile ohci_t *ohci) { int timeout = 30; int smm_timeout = 50; /* 0,5 sec */ @@ -1838,7 +1839,7 @@ static int hc_reset(ohci_t *ohci) err("USB RootHub reset timed out!\r\n"); break; } - wait_ms(1); + wait_us(1); } } } @@ -1925,7 +1926,7 @@ static int hc_reset(ohci_t *ohci) * connect the virtual root hub */ -static int hc_start(ohci_t *ohci) +static int hc_start(volatile ohci_t *ohci) { uint32_t mask; unsigned int fminterval; @@ -1994,9 +1995,9 @@ static int hc_start(ohci_t *ohci) /* * an interrupt happens */ -static int hc_interrupt(ohci_t *ohci) +static int hc_interrupt(volatile ohci_t *ohci) { - struct ohci_regs *regs = ohci->regs; + volatile struct ohci_regs *regs = ohci->regs; int ints; int stat = -1; @@ -2008,7 +2009,7 @@ static int hc_interrupt(ohci_t *ohci) else { ints = readl(®s->intrstatus); - if (ints == ~ 0UL) + if (ints == ~0UL) { ohci->disabled++; err("OHCI usb-%s-%c device removed!\r\n", ohci->slot_name, (char) ohci->controller + '0'); @@ -2040,8 +2041,6 @@ static int hc_interrupt(ohci_t *ohci) { unsigned short status = pci_read_config_word(ohci->handle, PCISR); - (void) status; - err("OHCI Unrecoverable Error, controller usb-%s-%c disabled\r\n(SR:0x%04X%s%s%s%s%s%s)", ohci->slot_name, (char) ohci->controller + '0', status & 0xFFFF, status & 0x8000 ? ", Parity error" : "", @@ -2143,7 +2142,7 @@ void ohci_usb_enable_interrupt(int enable) /* De-allocate all resources.. */ -static void hc_release_ohci(ohci_t *ohci) +static void hc_release_ohci(volatile ohci_t *ohci) { dbg("USB HC release OHCI usb-%s-%c", ohci->slot_name, (char) ohci->controller + '0'); if (!ohci->disabled) @@ -2152,7 +2151,7 @@ static void hc_release_ohci(ohci_t *ohci) } } -static void hc_free_buffers(ohci_t *ohci) +static void hc_free_buffers(volatile ohci_t *ohci) { if (ohci->td_unaligned != NULL) { @@ -2177,12 +2176,12 @@ static void hc_free_buffers(ohci_t *ohci) int ohci_usb_lowlevel_init(int32_t handle, const struct pci_device_id *ent, void **priv) { uint32_t usb_base_addr = 0xFFFFFFFF; - ohci_t *ohci = &gohci[pci_handle2index(handle)]; + volatile ohci_t *ohci = &gohci[pci_handle2index(handle)]; struct pci_rd *pci_rsc_desc = pci_get_resource(handle); /* USB OHCI */ if (handle && (ent != NULL)) { - memset(ohci, 0, sizeof(ohci_t)); + memset((void *) ohci, 0, sizeof(ohci_t)); ohci->handle = handle; ohci->ent = ent; } @@ -2191,7 +2190,7 @@ int ohci_usb_lowlevel_init(int32_t handle, const struct pci_device_id *ent, void return -1; } - err("ohci %p, handle = 0x%x, fctn = 0x%x\r\n", ohci, handle, PCI_FUNCTION_FROM_HANDLE(handle)); + inf("ohci %p, handle = 0x%x, fctn = 0x%x\r\n", ohci, handle, PCI_FUNCTION_FROM_HANDLE(handle)); ohci->controller = PCI_FUNCTION_FROM_HANDLE(ohci->handle); @@ -2208,8 +2207,9 @@ int ohci_usb_lowlevel_init(int32_t handle, const struct pci_device_id *ent, void /* align the storage */ ohci->hcca = (struct ohci_hcca *) (((uint32_t) ohci->hcca_unaligned + 255) & ~255); - memset(ohci->hcca, 0, sizeof(struct ohci_hcca)); - err("aligned ghcca %p\r\n", ohci->hcca); + memset((void *) ohci->hcca, 0, sizeof(struct ohci_hcca)); + inf("aligned ghcca %p\r\n", ohci->hcca); + ohci->ohci_dev_unaligned = driver_mem_alloc(sizeof(struct ohci_device) + 8); if (ohci->ohci_dev_unaligned == NULL) { @@ -2220,7 +2220,7 @@ int ohci_usb_lowlevel_init(int32_t handle, const struct pci_device_id *ent, void } ohci->ohci_dev = (struct ohci_device *) (((uint32_t) ohci->ohci_dev_unaligned + 7) & ~7); memset(ohci->ohci_dev, 0, sizeof(struct ohci_device)); - err("aligned EDs %p\r\n", ohci->ohci_dev); + dbg("aligned EDs %p\r\n", ohci->ohci_dev); ohci->td_unaligned = driver_mem_alloc(sizeof(struct td) * (NUM_TD + 1)); if (ohci->td_unaligned == NULL) @@ -2246,10 +2246,9 @@ int ohci_usb_lowlevel_init(int32_t handle, const struct pci_device_id *ent, void unsigned short flags; do { - dbg("\r\nPCI USB descriptors (at %p): flags 0x%04x start 0x%08lx \r\n offset 0x%08lx dmaoffset 0x%08lx length 0x%08lx\r\n", - pci_rsc_desc, - pci_rsc_desc->flags, - pci_rsc_desc->start, + dbg("PCI USB descriptors (at %p): flags 0x%04x start 0x%08lx\r\n", + pci_rsc_desc, pci_rsc_desc->flags, pci_rsc_desc->start); + dbg("offset 0x%08lx dmaoffset 0x%08lx length 0x%08lx\r\n", pci_rsc_desc->offset, pci_rsc_desc->dmaoffset, pci_rsc_desc->length); @@ -2276,8 +2275,7 @@ int ohci_usb_lowlevel_init(int32_t handle, const struct pci_device_id *ent, void } flags = pci_rsc_desc->flags; pci_rsc_desc = (struct pci_rd *) ((uint32_t) pci_rsc_desc->next + (uint32_t) pci_rsc_desc); - } - while (!(flags & FLG_LAST)); + } while (!(flags & FLG_LAST)); } else { @@ -2343,7 +2341,7 @@ int ohci_usb_lowlevel_init(int32_t handle, const struct pci_device_id *ent, void #ifdef DEBUG_OHCI ohci_dump(ohci, 1); #endif - pci_hook_interrupt(handle, (pci_interrupt_handler) handle_usb_interrupt, ohci); + pci_hook_interrupt(handle, (pci_interrupt_handler) handle_usb_interrupt, (void *) ohci); if (priv != NULL) { *priv = (void *) ohci; diff --git a/BaS_gcc/pci/pci.c b/BaS_gcc/pci/pci.c index 1a970c5..3cf57d4 100644 --- a/BaS_gcc/pci/pci.c +++ b/BaS_gcc/pci/pci.c @@ -974,7 +974,7 @@ static void pci_bridge_config(uint16_t bus, uint16_t device, uint16_t function) pci_write_config_longword(handle, PCIBISTR, MCF_PCI_PCICR1_CACHELINESIZE(8) | MCF_PCI_PCICR1_LATTIMER(0x20)); - pci_write_config_longword(handle, PCIBAR0, swpl(0x40000000)); + pci_write_config_longword(handle, PCIBAR0, swpl(0x80000000)); pci_write_config_longword(handle, PCIBAR1, 0x0); pci_write_config_word(handle, PCI_LANESWAP_W(PCICR), swpw( (1 << 1) /* memory space */ diff --git a/BaS_gcc/sys/BaS.c b/BaS_gcc/sys/BaS.c index 37a1c59..55101da 100644 --- a/BaS_gcc/sys/BaS.c +++ b/BaS_gcc/sys/BaS.c @@ -511,7 +511,7 @@ void BaS(void) video_init(); /* initialize USB devices */ - init_usb(); + // init_usb(); set_ipl(7); /* disable interrupts */ diff --git a/BaS_gcc/sys/sysinit.c b/BaS_gcc/sys/sysinit.c index f89d49d..3409ab6 100644 --- a/BaS_gcc/sys/sysinit.c +++ b/BaS_gcc/sys/sysinit.c @@ -441,7 +441,7 @@ static void init_fbcs() * i.e. it can burst on an 8 bit port up to 4 burst cycles or two on a 16 bit port. * Enabling burst on a 32 bit port has no effect (unfortunately). */ - MCF_FBCS4_CSAR = MCF_FBCS_CSAR_BA(0x40000000); /* video ram area, FB_CS3 not used, decoded on FPGA */ + MCF_FBCS4_CSAR = MCF_FBCS_CSAR_BA(0x40000000); /* video ram area, FB_CS4 not used, decoded on FPGA */ MCF_FBCS4_CSCR = MCF_FBCS_CSCR_PS_32 /* 32 bit port */ | MCF_FBCS_CSCR_WS(32) /* 0 wait states */ | MCF_FBCS_CSCR_AA /* /TA auto acknowledge */ @@ -588,6 +588,11 @@ void init_usb(void) int usb_found = 0; int index = 0; + /* + * disabled for now + */ + return; + inf("USB controller initialization:\r\n"); do diff --git a/BaS_gcc/tos/fpga_test/sources/fpga_test.c b/BaS_gcc/tos/fpga_test/sources/fpga_test.c index 25e514d..39cd2c8 100644 --- a/BaS_gcc/tos/fpga_test/sources/fpga_test.c +++ b/BaS_gcc/tos/fpga_test/sources/fpga_test.c @@ -19,10 +19,117 @@ #define SYSCLK 132000 long bas_start = 0xe0000000; -extern volatile uint32_t _VRAM[]; -volatile int32_t time, start, end; -int i; +volatile uint16_t *FB_CS1 = (volatile uint16_t *) 0xfff00000; /* "classic" ATARI I/O registers */ +volatile uint32_t *FB_CS2 = (volatile uint32_t *) 0xf0000000; /* FireBee 32 bit I/O registers */ +volatile uint16_t *FB_CS3 = (volatile uint16_t *) 0xf8000000; /* FireBee SRAM */ +volatile uint32_t *FB_CS4 = (volatile uint32_t *) 0x40000000; /* FireBee SD RAM */ + +bool verify_longaddr(volatile uint32_t * const addr, uint32_t value) +{ + *addr = value; + + if (value != *addr) + return false; + + return true; +} + +bool verify_long(volatile uint32_t * const addr, uint32_t low_value, uint32_t high_value) +{ + uint32_t i; + + for (i = low_value; i <= high_value; i++) + if (verify_longaddr(addr, i) == false) + return false; + + return true; +} + +void firebee_io_test(void) +{ + volatile uint32_t *ACP_VCTR = &FB_CS2[0x100]; /* 0xf000400 */ + volatile uint32_t *CCR = &FB_CS2[0x101]; /* 0xf000401 - FireBee mode border color */ + volatile uint32_t *ATARI_HH = &FB_CS2[0x104]; /* 0xf000410 */ + volatile uint32_t *ATARI_VH = &FB_CS2[0x105]; /* 0xf000414 */ + volatile uint32_t *ATARI_HL = &FB_CS2[0x106]; /* 0xf000418 */ + volatile uint32_t *ATARI_VL = &FB_CS2[0x107]; /* 0xf00041c */ + + volatile uint32_t *VIDEO_PLL_CONFIG = &FB_CS2[0x180]; /* 0xf000600 */ + volatile uint32_t *VIDEO_PLL_RECONFIG = &FB_CS2[0x200]; /* 0xf000800 */ + + verify_long(ACP_VCTR, 0, 0x7fffffff); + verify_long(CCR, 0, 0x7fffffff); + verify_long(ATARI_HH, 0, 0xffffffff); + verify_long(ATARI_VH, 0, 0xffffffff); + verify_long(ATARI_HL, 0, 0xffffffff); + verify_long(ATARI_VL, 0, 0xffffffff); + + verify_long(VIDEO_PLL_CONFIG, 0, 0xffffffff); + verify_long(VIDEO_PLL_RECONFIG, 0, 0xffffffff); +} + +bool verify_wordaddr(volatile uint16_t * const addr, uint16_t value) +{ + *addr = value; + + if (value != *addr) + return false; + + return true; +} + +bool verify_word(volatile uint16_t * const addr, uint16_t low_value, uint16_t high_value) +{ + int16_t i; + + for (i = low_value; i <= high_value; i++) + if (verify_wordaddr(addr, i) == false) + return false; + + return true; +} + +void atari_io_test(void) +{ + volatile uint16_t *SYS_CTR = &FB_CS1[0x7c003]; /* 0xffff8006 */ + volatile uint16_t *VDL_LOF = &FB_CS1[0x7c107]; /* 0xffff820e */ + volatile uint16_t *VDL_LWD = &FB_CS1[0x7c108]; /* 0xffff8210 */ + volatile uint16_t *VDL_HHT = &FB_CS1[0x7c141]; /* 0xffff8282 */ + volatile uint16_t *VDL_HBB = &FB_CS1[0x7c142]; /* 0xffff8284 */ + volatile uint16_t *VDL_HBE = &FB_CS1[0x7c143]; /* 0xffff8286 */ + volatile uint16_t *VDL_HDB = &FB_CS1[0x7c144]; /* 0xffff8288 */ + volatile uint16_t *VDL_HDE = &FB_CS1[0x7c145]; /* 0xffff828a */ + volatile uint16_t *VDL_HSS = &FB_CS1[0x7c146]; /* 0xffff828c */ + + volatile uint16_t *VDL_VFT = &FB_CS1[0x7c151]; /* 0xffff82a2 */ + volatile uint16_t *VDL_VBB = &FB_CS1[0x7c152]; /* 0xffff82a4 */ + volatile uint16_t *VDL_VBE = &FB_CS1[0x7c153]; /* 0xffff82a6 */ + volatile uint16_t *VDL_VDB = &FB_CS1[0x7c154]; /* 0xffff82a8 */ + volatile uint16_t *VDL_VDE = &FB_CS1[0x7c155]; /* 0xffff82aa */ + volatile uint16_t *VDL_VSS = &FB_CS1[0x7c156]; /* 0xffff82ac */ + volatile uint16_t *VDL_VCT = &FB_CS1[0x7c160]; /* 0xffff82c0 */ + volatile uint16_t *VDL_VMD = &FB_CS1[0x7c161]; /* 0xffff82c2 */ + + verify_word(SYS_CTR, 0, 0x7fff); + verify_word(VDL_LOF, 0, 0x7fff); + verify_word(VDL_LWD, 0, 0x7fff); + verify_word(VDL_HHT, 0, 0x7fff); + verify_word(VDL_HBB, 0, 0x7fff); + verify_word(VDL_HBE, 0, 0x7fff); + verify_word(VDL_HDB, 0, 0x7fff); + verify_word(VDL_HDE, 0, 0x7fff); + verify_word(VDL_HSS, 0, 0x7fff); + + verify_word(VDL_VFT, 0, 0x7fff); + verify_word(VDL_VBB, 0, 0x7fff); + verify_word(VDL_VBE, 0, 0x7fff); + verify_word(VDL_VDB, 0, 0x7fff); + verify_word(VDL_VDE, 0, 0x7fff); + verify_word(VDL_VSS, 0, 0x7fff); + verify_word(VDL_VCT, 0, 0x7fff); + verify_word(VDL_VMD, 0, 0x7fff); +} void do_tests(void) { diff --git a/BaS_gcc/usb/usb.c b/BaS_gcc/usb/usb.c index fce1923..c947bc4 100644 --- a/BaS_gcc/usb/usb.c +++ b/BaS_gcc/usb/usb.c @@ -54,7 +54,7 @@ #include "usb.h" #include "usb_hub.h" -#define DEBUG +// #define DEBUG #include "debug.h" struct hci @@ -156,7 +156,7 @@ int usb_init(int32_t handle, const struct pci_device_id *ent) case PCI_CLASS_SERIAL_USB_OHCI: dbg("initialize ohci host controller interface\r\n"); - //res = ohci_usb_lowlevel_init(handle, ent, (void *) &priv); + res = ohci_usb_lowlevel_init(handle, ent, (void *) &priv); break; case PCI_CLASS_SERIAL_USB_EHCI: @@ -322,7 +322,7 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe, { /* request for a asynch control pipe is not allowed */ - dbg("request for an async control pipe is not allowed\r\n"); + err("request for an async control pipe is not allowed\r\n"); return -1; } @@ -333,9 +333,9 @@ int usb_control_msg(struct usb_device *dev, unsigned int pipe, setup_packet->index = swpw(index); setup_packet->length = swpw(size); - dbg("usb_control_msg: request: 0x%X, requesttype: 0x%X, value 0x%X index 0x%X length 0x%X\r\n", request, requesttype, value, index, size); + dbg("request: 0x%X, requesttype: 0x%X, value 0x%X index 0x%X length 0x%X\r\n", request, requesttype, value, index, size); - switch(priv->ent->class) + switch (priv->ent->class) { case PCI_CLASS_SERIAL_USB_OHCI: dev->status = USB_ST_NOT_PROC; /* not yet processed */ @@ -631,6 +631,7 @@ int usb_get_descriptor(struct usb_device *dev, unsigned char type, unsigned char { int res; + dbg("dev=%d type=%d, index=%d\r\n", dev->devnum, type, index); res = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), USB_REQ_GET_DESCRIPTOR, USB_DIR_IN, (type << 8) + index, 0, buf, size, USB_CNTL_TIMEOUT); return res; @@ -695,6 +696,8 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate) struct usb_interface_descriptor *if_face = NULL; int ret, i; + dbg("set interface number=%d (alternate=%d)\r\n", interface, alternate); + for (i = 0; i < dev->config.bNumInterfaces; i++) { if (dev->config.if_desc[i].bInterfaceNumber == interface) @@ -763,6 +766,8 @@ int usb_set_configuration(struct usb_device *dev, int configuration) */ int usb_set_protocol(struct usb_device *dev, int ifnum, int protocol) { + dbg("set protocol %d on interface %d\r\n", protocol, ifnum); + return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), USB_REQ_SET_PROTOCOL, USB_TYPE_CLASS | USB_RECIP_INTERFACE, protocol, ifnum, NULL, 0, USB_CNTL_TIMEOUT); @@ -773,6 +778,8 @@ int usb_set_protocol(struct usb_device *dev, int ifnum, int protocol) */ int usb_set_idle(struct usb_device *dev, int ifnum, int duration, int report_id) { + dbg("set if %d idle for %d (report id %d)\r\n", ifnum, duration, report_id); + return usb_control_msg(dev, usb_sndctrlpipe(dev, 0), USB_REQ_SET_IDLE, USB_TYPE_CLASS | USB_RECIP_INTERFACE, (duration << 8) | report_id, ifnum, NULL, 0, USB_CNTL_TIMEOUT); @@ -784,6 +791,8 @@ int usb_set_idle(struct usb_device *dev, int ifnum, int duration, int report_id) int usb_get_report(struct usb_device *dev, int ifnum, unsigned char type, unsigned char id, void *buf, int size) { + dbg("get report on if %d, type %d, id %d\r\n", ifnum, type, id); + return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), USB_REQ_GET_REPORT, USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE, (type << 8) + id, ifnum, buf, size, USB_CNTL_TIMEOUT); @@ -795,6 +804,8 @@ int usb_get_report(struct usb_device *dev, int ifnum, unsigned char type, int usb_get_class_descriptor(struct usb_device *dev, int ifnum, unsigned char type, unsigned char id, void *buf, int size) { + dbg("get class descriptor of if %d, type %d, id %d\r\n", ifnum, type, id); + return usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), USB_REQ_GET_DESCRIPTOR, USB_RECIP_INTERFACE | USB_DIR_IN, (type << 8) + id, ifnum, buf, size, USB_CNTL_TIMEOUT); @@ -895,7 +906,7 @@ static int usb_string_sub(struct usb_device *dev, unsigned int langid, unsigned int usb_string(struct usb_device *dev, int index, char *buf, size_t size) { unsigned char *tbuf; - int err; + int error; unsigned int u, idx; if (size <= 0 || !buf || !index) @@ -915,16 +926,16 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size) /* get langid for strings if it's not yet known */ if (!dev->have_langid) { - err = usb_string_sub(dev, 0, 0, tbuf); - if (err < 0) + error = usb_string_sub(dev, 0, 0, tbuf); + if (error < 0) { - dbg("error getting string descriptor 0 (error=%lx)\r\n", dev->status); + err("error getting string descriptor 0 (error=%lx)\r\n", dev->status); driver_mem_free(tbuf); return -1; } else if (tbuf[0] < 4) { - dbg("string descriptor 0 too short\r\n"); + err("string descriptor 0 too short\r\n"); driver_mem_free(tbuf); return -1; } @@ -936,15 +947,16 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size) dbg("USB device number %d default language ID 0x%x\r\n", dev->devnum, dev->string_langid); } } - err = usb_string_sub(dev, dev->string_langid, index, tbuf); - if (err < 0) + error = usb_string_sub(dev, dev->string_langid, index, tbuf); + if (error < 0) { + err("failed to get lang id\r\n"); driver_mem_free(tbuf); - return err; + return error; } size--; /* leave room for trailing NULL char in output buffer */ - for (idx = 0, u = 2; u < err; u += 2) + for (idx = 0, u = 2; u < error; u += 2) { if (idx >= size) { @@ -960,9 +972,9 @@ int usb_string(struct usb_device *dev, int index, char *buf, size_t size) } } buf[idx] = 0; - err = idx; + error = idx; driver_mem_free(tbuf); - return err; + return error; } /* @@ -1078,12 +1090,10 @@ struct usb_device *usb_alloc_new_device(int bus, void *priv) int usb_new_device(struct usb_device *dev) { int addr; - int err; + int error; int tmp; unsigned char *tmpbuf; - dbg("\r\n"); - #ifndef CONFIG_LEGACY_USB_INIT_SEQ struct usb_device_descriptor *desc; int port = -1; @@ -1093,7 +1103,7 @@ int usb_new_device(struct usb_device *dev) if (dev == NULL) { - dbg("called with NULL device\r\n"); + err("called with NULL device\r\n"); return 1; } @@ -1104,7 +1114,7 @@ int usb_new_device(struct usb_device *dev) tmpbuf = (unsigned char *) driver_mem_alloc(USB_BUFSIZ); if (tmpbuf == NULL) { - dbg("malloc failure\r\n"); + err("malloc failure\r\n"); return 1; } @@ -1121,10 +1131,10 @@ int usb_new_device(struct usb_device *dev) dev->maxpacketsize = PACKET_SIZE_8; dev->epmaxpacketin[0] = 8; dev->epmaxpacketout[0] = 8; - err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, &dev->descriptor, 8); + error = usb_get_descriptor(dev, USB_DT_DEVICE, 0, &dev->descriptor, 8); if (err < 8) { - dbg("\r\nUSB device not responding, giving up (status=%lX)\r\n", dev->status); + err("\r\nUSB device not responding, giving up (status=%lX)\r\n", dev->status); driver_mem_free(tmpbuf); return 1; } @@ -1151,11 +1161,11 @@ int usb_new_device(struct usb_device *dev) dev->maxpacketsize = PACKET_SIZE_64; dev->epmaxpacketin[0] = 64; dev->epmaxpacketout[0] = 64; - err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, desc, 64); + error = usb_get_descriptor(dev, USB_DT_DEVICE, 0, desc, 64); - if (err < 0) + if (error < 0) { - dbg("usb_new_device: usb_get_descriptor() failed\r\n"); + err("usb_new_device: usb_get_descriptor() failed\r\n"); driver_mem_free(tmpbuf); return 1; } @@ -1177,17 +1187,17 @@ int usb_new_device(struct usb_device *dev) if (port < 0) { - dbg("usb_new_device: cannot locate device's port.\r\n"); + err("usb_new_device: cannot locate device's port.\r\n"); driver_mem_free(tmpbuf); return 1; } /* reset the port for the second time */ - err = hub_port_reset(dev->parent, port, &portstatus); - if (err < 0) + error = hub_port_reset(dev->parent, port, &portstatus); + if (error < 0) { - dbg("\r\nCouldn't reset port %d\r\n", port); + err("\r\nCouldn't reset port %d\r\n", port); driver_mem_free(tmpbuf); return 1; @@ -1206,28 +1216,28 @@ int usb_new_device(struct usb_device *dev) } dev->devnum = addr; - err = usb_set_address(dev); /* set address */ + error = usb_set_address(dev); /* set address */ - if (err < 0) + if (error < 0) { - dbg("\r\nUSB device not accepting new address (error=%lX)\r\n", dev->status); + err("\r\nUSB device not accepting new address (error=%lX)\r\n", dev->status); driver_mem_free(tmpbuf); return 1; } - wait(10); /* Let the SET_ADDRESS settle */ + wait_us(10); /* Let the SET_ADDRESS settle */ tmp = sizeof(dev->descriptor); - err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, &dev->descriptor, sizeof(dev->descriptor)); - if (err < tmp) + error = usb_get_descriptor(dev, USB_DT_DEVICE, 0, &dev->descriptor, sizeof(dev->descriptor)); + if (error < tmp) { - if (err < 0) + if (error < 0) { - dbg("unable to get device descriptor (error=%d)\r\n", err); + err("unable to get device descriptor (error=%d)\r\n", error); } else { - dbg("USB device descriptor short read (expected %i, got %i)\r\n", tmp, err); + err("USB device descriptor short read (expected %i, got %i)\r\n", tmp, error); } driver_mem_free(tmpbuf); @@ -1253,9 +1263,10 @@ int usb_new_device(struct usb_device *dev) { dbg("failed to set default configuration len %d, status %lX\r\n", dev->act_len, dev->status); driver_mem_free(tmpbuf); + return -1; } - dbg("new device strings: Mfr=%d, Product=%d, SerialNumber=%d\r\n", + dbg("new device strings: Manufacturer=%d, Product=%d, SerialNumber=%d\r\n", dev->descriptor.iManufacturer, dev->descriptor.iProduct, dev->descriptor.iSerialNumber); @@ -1275,9 +1286,9 @@ int usb_new_device(struct usb_device *dev) { usb_string(dev, dev->descriptor.iSerialNumber, dev->serial, sizeof(dev->serial)); } - dbg("Manufacturer %s\r\n", dev->mf); - dbg("Product %s\r\n", dev->prod); - dbg("SerialNumber %s\r\n", dev->serial); + inf("Manufacturer %s\r\n", dev->mf); + inf("Product %s\r\n", dev->prod); + inf("SerialNumber %s\r\n", dev->serial); /* now probe if the device is a hub */ usb_hub_probe(dev, 0); diff --git a/BaS_gcc/usb/usb_kbd.c b/BaS_gcc/usb/usb_kbd.c index 8853337..56fc2f3 100644 --- a/BaS_gcc/usb/usb_kbd.c +++ b/BaS_gcc/usb/usb_kbd.c @@ -27,13 +27,8 @@ #include "usb.h" -//// #define DEBUG_USBKBD -#ifdef DEBUG_USBKBD -#define dbg(format, arg...) do { xprintf("DEBUG: %s(): " format, __FUNCTION__, ##arg); } while (0) -#else -#define dbg(format, arg...) do { ; } while (0) -#endif /* DEBUG_USBKBD */ -#define err(format, arg...) do { xprintf("ERROR: %s(): " format, __FUNCTION__, ##arg); } while (0) +// #define DEBUG +#include "debug.h" #ifdef USE_COUNTRYCODE static int usb_kbd_get_hid_desc(struct usb_device *dev); @@ -541,7 +536,7 @@ int usb_kbd_register(struct usb_device *dev) { if(!kbd_installed && (dev->devnum != -1) && (usb_kbd_probe(dev, 0) == 1)) { /* Ok, we found a keyboard */ - //dbg("USB KBD found (iorec: 0x%x, USB: %d, devnum: %d)\r\n", iorec, dev->usbnum, dev->devnum); + dbg("USB KBD found (USB: %d, devnum: %d)\r\n", dev->usbnum, dev->devnum); num_lock = caps_lock = scroll_lock = old_modifier = 0; flags.s = 0; kbd_installed = 1; @@ -809,7 +804,7 @@ static int usb_kbd_translate(unsigned char scancode, unsigned char modifier, int flags.b.left_shift_host = 0; } #ifdef CONFIG_USB_INTERRUPT_POLLING - level = asm_set_ipl(7); /* mask interrupts for use call_ikbdvec() */ + level = set_ipl(7); /* mask interrupts for use call_ikbdvec() */ #endif if(pressed && (flags.b.force_alt_shift)) { @@ -841,7 +836,7 @@ static int usb_kbd_translate(unsigned char scancode, unsigned char modifier, int usb_kbd_send_code(0x38); /* ALT */ } } - if((keycode !=0) && (keycode <= MAX_VALUE_ATARI)) + if ((keycode !=0) && (keycode <= MAX_VALUE_ATARI)) usb_kbd_send_code(pressed ? keycode : keycode | 0x80); if(!pressed && (flags.b.force_alt_shift)) { @@ -874,9 +869,9 @@ static int usb_kbd_translate(unsigned char scancode, unsigned char modifier, int } } #ifdef CONFIG_USB_INTERRUPT_POLLING - asm_set_ipl(level); + set_ipl(level); #endif - if(pressed == 1) + if (pressed == 1) { if(scancode == NUM_LOCK) { diff --git a/BaS_gcc/video/video.c b/BaS_gcc/video/video.c index a166a70..f730677 100644 --- a/BaS_gcc/video/video.c +++ b/BaS_gcc/video/video.c @@ -283,10 +283,10 @@ static struct radeonfb_info rfb = static struct fb_var_screeninfo default_fb = { - .xres = 1280, - .yres = 1024, - .xres_virtual = 1280, - .yres_virtual = 1024 * 2, /* ensure we have accel offscreen space */ + .xres = 640, + .yres = 480, + .xres_virtual = 640, + .yres_virtual = 480 * 2, /* ensure we have accel offscreen space */ .bits_per_pixel = 8, .grayscale = 0, .red = { .length = 8 }, @@ -295,13 +295,13 @@ static struct fb_var_screeninfo default_fb = .activate = FB_ACTIVATE_NOW, .height = -1, .width = -1, - .pixclock = 7407, - .left_margin = 256, - .right_margin = 32, - .upper_margin = 34, - .lower_margin = 3, - .hsync_len = 144, - .vsync_len = 3, + .pixclock = 39721, + .left_margin = 40, + .right_margin = 24, + .upper_margin = 32, + .lower_margin = 11, + .hsync_len = 96, + .vsync_len = 2, .vmode = FB_VMODE_NONINTERLACED, .activate = FB_ACTIVATE_ALL | FB_ACTIVATE_FORCE | FB_ACTIVATE_NOW };