From 6b46cc08ed406c9dff0ac72ed90e29fc27b7f3a2 Mon Sep 17 00:00:00 2001 From: Rafaël Carré Date: Wed, 19 May 2010 18:13:06 +0000 Subject: as3525: hide our UNCACHED_ADDR from usb_storage.c git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26178 a1c6a512-1295-4272-9138-f99709370657 --- firmware/target/arm/as3525/pcm-as3525.c | 10 +++++----- firmware/target/arm/as3525/sd-as3525.c | 2 +- firmware/target/arm/as3525/sd-as3525v2.c | 2 +- firmware/target/arm/as3525/system-target.h | 4 ++-- firmware/target/arm/as3525/usb-drv-as3525.c | 21 ++++++--------------- 5 files changed, 15 insertions(+), 24 deletions(-) diff --git a/firmware/target/arm/as3525/pcm-as3525.c b/firmware/target/arm/as3525/pcm-as3525.c index 4033a9b88d..cefca0fbe5 100644 --- a/firmware/target/arm/as3525/pcm-as3525.c +++ b/firmware/target/arm/as3525/pcm-as3525.c @@ -180,7 +180,7 @@ const void * pcm_play_dma_get_peak_buffer(int *count) void * pcm_dma_addr(void *addr) { if (addr != NULL) - addr = UNCACHED_ADDR(addr); + addr = AS3525_UNCACHED_ADDR(addr); return addr; } #endif @@ -271,7 +271,7 @@ static void rec_dma_callback(void) rec_dma_start_addr += rec_dma_transfer_size; /* the 2nd channel is silent when recording microphone on as3525v1 */ - mono2stereo(UNCACHED_ADDR((int16_t*)rec_dma_start_addr)); + mono2stereo(AS3525_UNCACHED_ADDR((int16_t*)rec_dma_start_addr)); if(!rec_dma_size) { @@ -294,7 +294,7 @@ void pcm_rec_dma_record_more(void *start, size_t size) dump_dcache_range(start, size); rec_dma_start_addr = start; #if CONFIG_CPU == AS3525 - mono_samples = UNCACHED_ADDR(start); + mono_samples = AS3525_UNCACHED_ADDR(start); #endif rec_dma_size = size; } @@ -319,7 +319,7 @@ void pcm_rec_dma_start(void *addr, size_t size) dump_dcache_range(addr, size); rec_dma_start_addr = addr; #if CONFIG_CPU == AS3525 - mono_samples = UNCACHED_ADDR(addr); + mono_samples = AS3525_UNCACHED_ADDR(addr); #endif rec_dma_size = size; @@ -359,7 +359,7 @@ void pcm_rec_dma_init(void) const void * pcm_rec_dma_get_peak_buffer(void) { pcm_rec_lock(); - int16_t *addr = UNCACHED_ADDR((int16_t *)DMAC_CH_DST_ADDR(1)); + int16_t *addr = AS3525_UNCACHED_ADDR((int16_t *)DMAC_CH_DST_ADDR(1)); mono2stereo(addr); pcm_rec_unlock(); diff --git a/firmware/target/arm/as3525/sd-as3525.c b/firmware/target/arm/as3525/sd-as3525.c index 57ad16bcb2..81dc637617 100644 --- a/firmware/target/arm/as3525/sd-as3525.c +++ b/firmware/target/arm/as3525/sd-as3525.c @@ -138,7 +138,7 @@ static volatile unsigned int transfer_error[NUM_VOLUMES]; #define UNALIGNED_NUM_SECTORS 10 static unsigned char aligned_buffer[UNALIGNED_NUM_SECTORS* SD_BLOCK_SIZE] __attribute__((aligned(32))); /* align on cache line size */ -static unsigned char *uncached_buffer = UNCACHED_ADDR(&aligned_buffer[0]); +static unsigned char *uncached_buffer = AS3525_UNCACHED_ADDR(&aligned_buffer[0]); static inline void mci_delay(void) { udelay(1000) ; } diff --git a/firmware/target/arm/as3525/sd-as3525v2.c b/firmware/target/arm/as3525/sd-as3525v2.c index b61f4dd25f..3e370850d6 100644 --- a/firmware/target/arm/as3525/sd-as3525v2.c +++ b/firmware/target/arm/as3525/sd-as3525v2.c @@ -325,7 +325,7 @@ #define UNALIGNED_NUM_SECTORS 10 static unsigned char aligned_buffer[UNALIGNED_NUM_SECTORS* SD_BLOCK_SIZE] __attribute__((aligned(32))); /* align on cache line size */ -static unsigned char *uncached_buffer = UNCACHED_ADDR(&aligned_buffer[0]); +static unsigned char *uncached_buffer = AS3525_UNCACHED_ADDR(&aligned_buffer[0]); static void init_controller(void); static int sd_wait_for_state(const int drive, unsigned int state); diff --git a/firmware/target/arm/as3525/system-target.h b/firmware/target/arm/as3525/system-target.h index 38e2028f65..11e89d9f2c 100644 --- a/firmware/target/arm/as3525/system-target.h +++ b/firmware/target/arm/as3525/system-target.h @@ -39,9 +39,9 @@ #endif #ifdef BOOTLOADER -#define UNCACHED_ADDR(a) (a) +#define AS3525_UNCACHED_ADDR(a) (a) #else -#define UNCACHED_ADDR(a) ((typeof(a)) ((uintptr_t)(a) + 0x10000000)) +#define AS3525_UNCACHED_ADDR(a) ((typeof(a)) ((uintptr_t)(a) + 0x10000000)) #endif #ifdef SANSA_C200V2 diff --git a/firmware/target/arm/as3525/usb-drv-as3525.c b/firmware/target/arm/as3525/usb-drv-as3525.c index 4c72368a83..ca1d8cbb07 100644 --- a/firmware/target/arm/as3525/usb-drv-as3525.c +++ b/firmware/target/arm/as3525/usb-drv-as3525.c @@ -386,7 +386,7 @@ static void usb_phy_resume(void) static void setup_desc_init(struct usb_dev_setup_buf *desc) { - struct usb_dev_setup_buf *uc_desc = UNCACHED_ADDR(desc); + struct usb_dev_setup_buf *uc_desc = AS3525_UNCACHED_ADDR(desc); uc_desc->status = USB_DMA_DESC_BS_HST_RDY; uc_desc->resv = 0xffffffff; @@ -397,7 +397,7 @@ static void setup_desc_init(struct usb_dev_setup_buf *desc) static void dma_desc_init(int ep, int dir) { struct usb_dev_dma_desc *desc = &dmadescs[ep][dir]; - struct usb_dev_dma_desc *uc_desc = UNCACHED_ADDR(desc); + struct usb_dev_dma_desc *uc_desc = AS3525_UNCACHED_ADDR(desc); endpoints[ep][dir].uc_desc = uc_desc; @@ -626,15 +626,6 @@ void usb_drv_cancel_all_transfers(void) restore_irq(flags); } -static void *virt_to_bus(void *addr) -{ - unsigned int x = (long)addr; - - x -= (x & 0x40000000) >> 2; /* fix uncached address */ - - return (void*)x; -} - int usb_drv_recv(int ep, void *ptr, int len) { struct usb_dev_dma_desc *uc_desc = endpoints[ep][1].uc_desc; @@ -660,7 +651,7 @@ int usb_drv_recv(int ep, void *ptr, int len) uc_desc->status |= USB_DMA_DESC_ZERO_LEN; uc_desc->data_ptr = 0; } else { - uc_desc->data_ptr = virt_to_bus(ptr); + uc_desc->data_ptr = ptr; } USB_OEP_DESC_PTR(ep) = (int)&dmadescs[ep][1]; USB_OEP_STS(ep) = USB_EP_STAT_OUT_RCVD; /* clear status */ @@ -677,7 +668,7 @@ char *make_hex(char *data, int len) { int i; if (!((int)data & 0x40000000)) - data = UNCACHED_ADDR(data); /* don't pollute the cache */ + data = AS3525_UNCACHED_ADDR(data); /* don't pollute the cache */ if (len > 512) len = 512; @@ -712,7 +703,7 @@ void ep_send(int ep, void *ptr, int len) if (len == 0) uc_desc->status |= USB_DMA_DESC_ZERO_LEN; - uc_desc->data_ptr = virt_to_bus(ptr); + uc_desc->data_ptr = ptr; USB_IEP_DESC_PTR(ep) = (int)&dmadescs[ep][0]; USB_IEP_STS(ep) = 0xffffffff; /* clear status */ @@ -785,7 +776,7 @@ static void handle_in_ep(int ep) static void handle_out_ep(int ep) { - struct usb_ctrlrequest *req = (void*)UNCACHED_ADDR(&setup_desc->data1); + struct usb_ctrlrequest *req = (void*)AS3525_UNCACHED_ADDR(&setup_desc->data1); int ep_sts = USB_OEP_STS(ep) & ~USB_OEP_STS_MASK(ep); struct usb_dev_dma_desc *uc_desc = endpoints[ep][1].uc_desc; -- cgit v1.2.3