diff options
Diffstat (limited to 'firmware/target/arm')
-rw-r--r-- | firmware/target/arm/gigabeat/meg-fx/system-meg-fx.h (renamed from firmware/target/arm/gigabeat/meg-fx/system-target.h) | 1 | ||||
-rw-r--r-- | firmware/target/arm/sandisk/sansa-e200/lcd-e200.c | 14 | ||||
-rw-r--r-- | firmware/target/arm/system-pp.h | 49 | ||||
-rw-r--r-- | firmware/target/arm/system-target.h | 155 |
4 files changed, 207 insertions, 12 deletions
diff --git a/firmware/target/arm/gigabeat/meg-fx/system-target.h b/firmware/target/arm/gigabeat/meg-fx/system-meg-fx.h index e5d15d643e..7d598af360 100644 --- a/firmware/target/arm/gigabeat/meg-fx/system-target.h +++ b/firmware/target/arm/gigabeat/meg-fx/system-meg-fx.h | |||
@@ -19,6 +19,7 @@ | |||
19 | 19 | ||
20 | #include "mmu-meg-fx.h" | 20 | #include "mmu-meg-fx.h" |
21 | 21 | ||
22 | #define HAVE_INVALIDATE_ICACHE | ||
22 | static inline void invalidate_icache(void) | 23 | static inline void invalidate_icache(void) |
23 | { | 24 | { |
24 | clean_dcache(); | 25 | clean_dcache(); |
diff --git a/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c b/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c index 3e8246b367..93d79633b1 100644 --- a/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c +++ b/firmware/target/arm/sandisk/sansa-e200/lcd-e200.c | |||
@@ -112,16 +112,6 @@ static inline void lcd_write_reg(unsigned int reg, unsigned int data) | |||
112 | lcd_send_msg(0x72, data); | 112 | lcd_send_msg(0x72, data); |
113 | } | 113 | } |
114 | 114 | ||
115 | static inline void cache_flush(void) | ||
116 | { | ||
117 | #ifndef BOOTLOADER | ||
118 | outl(inl(0xf000f044) | 0x2, 0xf000f044); | ||
119 | while ((CACHE_CTL & 0x8000) != 0) | ||
120 | { | ||
121 | } | ||
122 | #endif | ||
123 | } | ||
124 | |||
125 | /* The LCD controller gets passed the address of the framebuffer, but can only | 115 | /* The LCD controller gets passed the address of the framebuffer, but can only |
126 | use the physical, not the remapped, address. This is a quick and dirty way | 116 | use the physical, not the remapped, address. This is a quick and dirty way |
127 | of correcting it */ | 117 | of correcting it */ |
@@ -271,7 +261,7 @@ inline void lcd_update_rect(int x, int y, int width, int height) | |||
271 | memcpy(((char*)&lcd_driver_framebuffer)+(y * sizeof(fb_data) * LCD_WIDTH), | 261 | memcpy(((char*)&lcd_driver_framebuffer)+(y * sizeof(fb_data) * LCD_WIDTH), |
272 | ((char *)&lcd_framebuffer)+(y * sizeof(fb_data) * LCD_WIDTH), | 262 | ((char *)&lcd_framebuffer)+(y * sizeof(fb_data) * LCD_WIDTH), |
273 | ((height * sizeof(fb_data) * LCD_WIDTH))); | 263 | ((height * sizeof(fb_data) * LCD_WIDTH))); |
274 | cache_flush(); | 264 | flush_icache(); |
275 | 265 | ||
276 | /* Restart DMA */ | 266 | /* Restart DMA */ |
277 | LCD_REG_6 |= 1; | 267 | LCD_REG_6 |= 1; |
@@ -287,7 +277,7 @@ inline void lcd_update(void) | |||
287 | 277 | ||
288 | /* Copy the Rockbox framebuffer to the second framebuffer */ | 278 | /* Copy the Rockbox framebuffer to the second framebuffer */ |
289 | memcpy(lcd_driver_framebuffer, lcd_framebuffer, sizeof(fb_data) * LCD_WIDTH * LCD_HEIGHT); | 279 | memcpy(lcd_driver_framebuffer, lcd_framebuffer, sizeof(fb_data) * LCD_WIDTH * LCD_HEIGHT); |
290 | cache_flush(); | 280 | flush_icache(); |
291 | 281 | ||
292 | /* Restart DMA */ | 282 | /* Restart DMA */ |
293 | LCD_REG_6 |= 1; | 283 | LCD_REG_6 |= 1; |
diff --git a/firmware/target/arm/system-pp.h b/firmware/target/arm/system-pp.h new file mode 100644 index 0000000000..05fd8b6edf --- /dev/null +++ b/firmware/target/arm/system-pp.h | |||
@@ -0,0 +1,49 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Alan Korr | ||
11 | * Copyright (C) 2007 by Michael Sevakis | ||
12 | * | ||
13 | * All files in this archive are subject to the GNU General Public License. | ||
14 | * See the file COPYING in the source tree root for full license agreement. | ||
15 | * | ||
16 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
17 | * KIND, either express or implied. | ||
18 | * | ||
19 | ****************************************************************************/ | ||
20 | |||
21 | #define inl(a) (*(volatile unsigned long *) (a)) | ||
22 | #define outl(a,b) (*(volatile unsigned long *) (b) = (a)) | ||
23 | #define inb(a) (*(volatile unsigned char *) (a)) | ||
24 | #define outb(a,b) (*(volatile unsigned char *) (b) = (a)) | ||
25 | #define inw(a) (*(volatile unsigned short *) (a)) | ||
26 | #define outw(a,b) (*(volatile unsigned short *) (b) = (a)) | ||
27 | extern unsigned int ipod_hw_rev; | ||
28 | |||
29 | static inline void udelay(unsigned usecs) | ||
30 | { | ||
31 | unsigned stop = USEC_TIMER + usecs; | ||
32 | while (TIME_BEFORE(USEC_TIMER, stop)); | ||
33 | } | ||
34 | |||
35 | unsigned int current_core(void); | ||
36 | |||
37 | #define HAVE_INVALIDATE_ICACHE | ||
38 | static inline void invalidate_icache(void) | ||
39 | { | ||
40 | outl(inl(0xf000f044) | 0x6, 0xf000f044); | ||
41 | while ((CACHE_CTL & 0x8000) != 0); | ||
42 | } | ||
43 | |||
44 | #define HAVE_FLUSH_ICACHE | ||
45 | static inline void flush_icache(void) | ||
46 | { | ||
47 | outl(inl(0xf000f044) | 0x2, 0xf000f044); | ||
48 | while ((CACHE_CTL & 0x8000) != 0); | ||
49 | } | ||
diff --git a/firmware/target/arm/system-target.h b/firmware/target/arm/system-target.h new file mode 100644 index 0000000000..ceb8be2079 --- /dev/null +++ b/firmware/target/arm/system-target.h | |||
@@ -0,0 +1,155 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2002 by Alan Korr | ||
11 | * | ||
12 | * All files in this archive are subject to the GNU General Public License. | ||
13 | * See the file COPYING in the source tree root for full license agreement. | ||
14 | * | ||
15 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
16 | * KIND, either express or implied. | ||
17 | * | ||
18 | ****************************************************************************/ | ||
19 | #ifndef SYSTEM_TARGET_H | ||
20 | #define SYSTEM_TARGET_H | ||
21 | |||
22 | #define nop \ | ||
23 | asm volatile ("nop") | ||
24 | |||
25 | /* This gets too complicated otherwise with all the ARM variation and would | ||
26 | have conflicts with another system-target.h elsewhere so include a | ||
27 | subheader from here. */ | ||
28 | |||
29 | #ifdef CPU_PP | ||
30 | #include "system-pp.h" | ||
31 | #elif CONFIG_CPU == S3C2440 | ||
32 | #include "system-meg-fx.h" | ||
33 | #endif | ||
34 | |||
35 | /* TODO: Implement set_irq_level and check CPU frequencies */ | ||
36 | |||
37 | #if CONFIG_CPU == S3C2440 | ||
38 | |||
39 | #define CPUFREQ_DEFAULT 98784000 | ||
40 | #define CPUFREQ_NORMAL 98784000 | ||
41 | #define CPUFREQ_MAX 296352000 | ||
42 | |||
43 | #elif CONFIG_CPU == PNX0101 | ||
44 | |||
45 | #define CPUFREQ_DEFAULT 12000000 | ||
46 | #define CPUFREQ_NORMAL 48000000 | ||
47 | #define CPUFREQ_MAX 60000000 | ||
48 | |||
49 | #else | ||
50 | |||
51 | #define CPUFREQ_DEFAULT_MULT 8 | ||
52 | #define CPUFREQ_DEFAULT 24000000 | ||
53 | #define CPUFREQ_NORMAL_MULT 10 | ||
54 | #define CPUFREQ_NORMAL 30000000 | ||
55 | #define CPUFREQ_MAX_MULT 25 | ||
56 | #define CPUFREQ_MAX 75000000 | ||
57 | |||
58 | #endif | ||
59 | |||
60 | static inline uint16_t swap16(uint16_t value) | ||
61 | /* | ||
62 | result[15..8] = value[ 7..0]; | ||
63 | result[ 7..0] = value[15..8]; | ||
64 | */ | ||
65 | { | ||
66 | return (value >> 8) | (value << 8); | ||
67 | } | ||
68 | |||
69 | static inline uint32_t swap32(uint32_t value) | ||
70 | /* | ||
71 | result[31..24] = value[ 7.. 0]; | ||
72 | result[23..16] = value[15.. 8]; | ||
73 | result[15.. 8] = value[23..16]; | ||
74 | result[ 7.. 0] = value[31..24]; | ||
75 | */ | ||
76 | { | ||
77 | uint32_t tmp; | ||
78 | |||
79 | asm volatile ( | ||
80 | "eor %1, %0, %0, ror #16 \n\t" | ||
81 | "bic %1, %1, #0xff0000 \n\t" | ||
82 | "mov %0, %0, ror #8 \n\t" | ||
83 | "eor %0, %0, %1, lsr #8 \n\t" | ||
84 | : "+r" (value), "=r" (tmp) | ||
85 | ); | ||
86 | return value; | ||
87 | } | ||
88 | |||
89 | static inline uint32_t swap_odd_even32(uint32_t value) | ||
90 | { | ||
91 | /* | ||
92 | result[31..24],[15.. 8] = value[23..16],[ 7.. 0] | ||
93 | result[23..16],[ 7.. 0] = value[31..24],[15.. 8] | ||
94 | */ | ||
95 | uint32_t tmp; | ||
96 | |||
97 | asm volatile ( /* ABCD */ | ||
98 | "bic %1, %0, #0x00ff00 \n\t" /* AB.D */ | ||
99 | "bic %0, %0, #0xff0000 \n\t" /* A.CD */ | ||
100 | "mov %0, %0, lsr #8 \n\t" /* .A.C */ | ||
101 | "orr %0, %0, %1, lsl #8 \n\t" /* B.D.|.A.C */ | ||
102 | : "+r" (value), "=r" (tmp) /* BADC */ | ||
103 | ); | ||
104 | return value; | ||
105 | } | ||
106 | |||
107 | #define HIGHEST_IRQ_LEVEL (1) | ||
108 | |||
109 | static inline int set_irq_level(int level) | ||
110 | { | ||
111 | unsigned long cpsr; | ||
112 | /* Read the old level and set the new one */ | ||
113 | asm volatile ("mrs %0,cpsr" : "=r" (cpsr)); | ||
114 | asm volatile ("msr cpsr_c,%0" | ||
115 | : : "r" ((cpsr & ~0x80) | (level << 7))); | ||
116 | return (cpsr >> 7) & 1; | ||
117 | } | ||
118 | |||
119 | static inline void set_fiq_handler(void(*fiq_handler)(void)) | ||
120 | { | ||
121 | /* Install the FIQ handler */ | ||
122 | *((unsigned int*)(15*4)) = (unsigned int)fiq_handler; | ||
123 | } | ||
124 | |||
125 | static inline void enable_fiq(void) | ||
126 | { | ||
127 | /* Clear FIQ disable bit */ | ||
128 | asm volatile ( | ||
129 | "mrs r0, cpsr \n"\ | ||
130 | "bic r0, r0, #0x40 \n"\ | ||
131 | "msr cpsr_c, r0 " | ||
132 | : : : "r0" | ||
133 | ); | ||
134 | } | ||
135 | |||
136 | static inline void disable_fiq(void) | ||
137 | { | ||
138 | /* Set FIQ disable bit */ | ||
139 | asm volatile ( | ||
140 | "mrs r0, cpsr \n"\ | ||
141 | "orr r0, r0, #0x40 \n"\ | ||
142 | "msr cpsr_c, r0 " | ||
143 | : : : "r0" | ||
144 | ); | ||
145 | } | ||
146 | |||
147 | #if CONFIG_CPU == PNX0101 | ||
148 | typedef void (*interrupt_handler_t)(void); | ||
149 | |||
150 | void irq_set_int_handler(int n, interrupt_handler_t handler); | ||
151 | void irq_enable_int(int n); | ||
152 | void irq_disable_int(int n); | ||
153 | #endif | ||
154 | |||
155 | #endif /* SYSTEM_TARGET_H */ | ||