summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Diedrich <ranma+coreboot@tdiedrich.de>2010-06-18 05:07:00 +0000
committerTobias Diedrich <ranma+coreboot@tdiedrich.de>2010-06-18 05:07:00 +0000
commit8260a79689892854abfdd493592ba04387c2f4b8 (patch)
treecc6b1417a53d8099115579814c335ae80d9242d4
parentfe47966f0e06c14fa0b82325c1eee029a0be827a (diff)
Avoid ifdefs
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26908 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/arm/as3525/usb-drv-as3525.c26
-rw-r--r--firmware/target/arm/as3525/usb-drv-as3525.h6
2 files changed, 16 insertions, 16 deletions
diff --git a/firmware/target/arm/as3525/usb-drv-as3525.c b/firmware/target/arm/as3525/usb-drv-as3525.c
index a5a3689403..e90bc04aee 100644
--- a/firmware/target/arm/as3525/usb-drv-as3525.c
+++ b/firmware/target/arm/as3525/usb-drv-as3525.c
@@ -395,10 +395,10 @@ int usb_drv_recv(int ep, void *ptr, int len)
endpoints[ep][1].len = len;
endpoints[ep][1].rc = -1;
-#ifndef BOOTLOADER
/* remove data buffer from cache */
- invalidate_dcache();
-#endif
+ if (!is_bootloader()) /* bootloader is running uncached */
+ invalidate_dcache();
+
/* DMA setup */
uc_desc->status = USB_DMA_DESC_BS_HST_RDY |
USB_DMA_DESC_LAST |
@@ -447,10 +447,9 @@ void ep_send(int ep, void *ptr, int len)
endpoints[ep][0].len = len;
endpoints[ep][0].rc = -1;
-#ifndef BOOTLOADER
/* Make sure data is committed to memory */
- clean_dcache();
-#endif
+ if (!is_bootloader()) /* bootloader is running uncached */
+ clean_dcache();
logf("xx%s\n", make_hex(ptr, len));
@@ -549,21 +548,16 @@ static void handle_out_ep(int ep)
if (ep_sts & USB_EP_STAT_OUT_RCVD) {
int dma_sts = uc_desc->status;
int dma_len = dma_sts & 0xffff;
-#ifdef LOGF_ENABLE
- int dma_frm = (dma_sts >> 16) & 0x7ff;
- int dma_mst = dma_sts & 0xf8000000;
-#endif
if (!(dma_sts & USB_DMA_DESC_ZERO_LEN)) {
- logf("EP%d OUT token, st:%08x len:%d frm:%x data=%s epstate=%d\n", ep,
- dma_mst, dma_len, dma_frm, make_hex(uc_desc->data_ptr, dma_len),
- endpoints[ep][1].state);
-#ifndef BOOTLOADER
+ logf("EP%d OUT token, st:%08x len:%d frm:%x data=%s epstate=%d\n",
+ ep, dma_sts & 0xf8000000, dma_len, (dma_sts >> 16) & 0x7ff,
+ make_hex(uc_desc->data_ptr, dma_len), endpoints[ep][1].state);
/*
* If parts of the just dmaed range are in cache, dump them now.
*/
- dump_dcache_range(uc_desc->data_ptr, dma_len);
-#endif
+ if (!is_bootloader()) /* bootloader is running uncached */
+ dump_dcache_range(uc_desc->data_ptr, dma_len);
} else{
logf("EP%d OUT token, st:%08x frm:%x (no data)\n", ep,
dma_mst, dma_frm);
diff --git a/firmware/target/arm/as3525/usb-drv-as3525.h b/firmware/target/arm/as3525/usb-drv-as3525.h
index 3a434170d7..f579638cfb 100644
--- a/firmware/target/arm/as3525/usb-drv-as3525.h
+++ b/firmware/target/arm/as3525/usb-drv-as3525.h
@@ -23,6 +23,12 @@
#include "as3525.h"
+#ifdef BOOTLOADER
+#define is_bootloader() 1
+#else
+#define is_bootloader() 0
+#endif /* BOOTLOADER */
+
#define USB_NUM_EPS 4
typedef struct {