diff options
Diffstat (limited to 'firmware/target/arm/s5l8700')
-rw-r--r-- | firmware/target/arm/s5l8700/ata-nand-s5l8700.c | 94 | ||||
-rw-r--r-- | firmware/target/arm/s5l8700/boot.lds | 54 | ||||
-rw-r--r-- | firmware/target/arm/s5l8700/crt0.S | 117 | ||||
-rw-r--r-- | firmware/target/arm/s5l8700/meizu-m6sl/adc-target.h | 33 | ||||
-rw-r--r-- | firmware/target/arm/s5l8700/meizu-m6sl/backlight-target.h | 27 | ||||
-rw-r--r-- | firmware/target/arm/s5l8700/meizu-m6sl/button-target.h | 52 | ||||
-rw-r--r-- | firmware/target/arm/s5l8700/meizu-m6sl/lcd-m6sl.c | 133 | ||||
-rw-r--r-- | firmware/target/arm/s5l8700/system-s5l8700.c | 168 | ||||
-rw-r--r-- | firmware/target/arm/s5l8700/system-target.h | 35 |
9 files changed, 713 insertions, 0 deletions
diff --git a/firmware/target/arm/s5l8700/ata-nand-s5l8700.c b/firmware/target/arm/s5l8700/ata-nand-s5l8700.c new file mode 100644 index 0000000000..dd0ae7a950 --- /dev/null +++ b/firmware/target/arm/s5l8700/ata-nand-s5l8700.c | |||
@@ -0,0 +1,94 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2007 Dave Chapman | ||
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 | #include "ata.h" | ||
20 | #include "ata-target.h" | ||
21 | #include "ata_idle_notify.h" | ||
22 | #include "system.h" | ||
23 | #include <string.h> | ||
24 | #include "thread.h" | ||
25 | #include "led.h" | ||
26 | #include "disk.h" | ||
27 | #include "panic.h" | ||
28 | #include "usb.h" | ||
29 | |||
30 | /* for compatibility */ | ||
31 | int ata_spinup_time = 0; | ||
32 | |||
33 | long last_disk_activity = -1; | ||
34 | |||
35 | /** static, private data **/ | ||
36 | static bool initialized = false; | ||
37 | |||
38 | static long next_yield = 0; | ||
39 | #define MIN_YIELD_PERIOD 2000 | ||
40 | |||
41 | /* API Functions */ | ||
42 | |||
43 | void ata_led(bool onoff) | ||
44 | { | ||
45 | led(onoff); | ||
46 | } | ||
47 | |||
48 | int ata_read_sectors(IF_MV2(int drive,) unsigned long start, int incount, | ||
49 | void* inbuf) | ||
50 | { | ||
51 | |||
52 | } | ||
53 | |||
54 | int ata_write_sectors(IF_MV2(int drive,) unsigned long start, int count, | ||
55 | const void* outbuf) | ||
56 | { | ||
57 | } | ||
58 | |||
59 | void ata_spindown(int seconds) | ||
60 | { | ||
61 | (void)seconds; | ||
62 | } | ||
63 | |||
64 | bool ata_disk_is_active(void) | ||
65 | { | ||
66 | return 0; | ||
67 | } | ||
68 | |||
69 | void ata_sleep(void) | ||
70 | { | ||
71 | } | ||
72 | |||
73 | void ata_spin(void) | ||
74 | { | ||
75 | } | ||
76 | |||
77 | /* Hardware reset protocol as specified in chapter 9.1, ATA spec draft v5 */ | ||
78 | int ata_hard_reset(void) | ||
79 | { | ||
80 | return 0; | ||
81 | } | ||
82 | |||
83 | int ata_soft_reset(void) | ||
84 | { | ||
85 | return 0; | ||
86 | } | ||
87 | |||
88 | void ata_enable(bool on) | ||
89 | { | ||
90 | } | ||
91 | |||
92 | int ata_init(void) | ||
93 | { | ||
94 | } | ||
diff --git a/firmware/target/arm/s5l8700/boot.lds b/firmware/target/arm/s5l8700/boot.lds new file mode 100644 index 0000000000..757abaa11a --- /dev/null +++ b/firmware/target/arm/s5l8700/boot.lds | |||
@@ -0,0 +1,54 @@ | |||
1 | #include "config.h" | ||
2 | |||
3 | ENTRY(start) | ||
4 | OUTPUT_FORMAT(elf32-littlearm) | ||
5 | OUTPUT_ARCH(arm) | ||
6 | STARTUP(target/arm/s5l8700/crt0.o) | ||
7 | |||
8 | /* DRAMORIG is in fact 0x8000000 but remapped to 0x0 */ | ||
9 | #define DRAMORIG 0x0 | ||
10 | #define DRAMSIZE 16M | ||
11 | # | ||
12 | #define IRAMORIG 0x22000000 | ||
13 | #define IRAMSIZE 256K | ||
14 | |||
15 | /* This is not available in all versions of the S5L8700 */ | ||
16 | #define FLASHORIG 0x24000000 | ||
17 | #define FLASHSIZE 1M | ||
18 | |||
19 | SECTIONS | ||
20 | { | ||
21 | . = IRAMORIG; | ||
22 | |||
23 | .text : { | ||
24 | *(.init.text) | ||
25 | *(.text*) | ||
26 | } | ||
27 | |||
28 | .data : { | ||
29 | *(.icode) | ||
30 | *(.irodata) | ||
31 | *(.idata) | ||
32 | *(.data*) | ||
33 | *(.ncdata*); | ||
34 | _dataend = . ; | ||
35 | } | ||
36 | |||
37 | .stack : | ||
38 | { | ||
39 | *(.stack) | ||
40 | _stackbegin = .; | ||
41 | stackbegin = .; | ||
42 | . += 0x2000; | ||
43 | _stackend = .; | ||
44 | stackend = .; | ||
45 | } | ||
46 | |||
47 | .bss : { | ||
48 | _edata = .; | ||
49 | *(.bss*); | ||
50 | *(.ibss); | ||
51 | *(.ncbss*); | ||
52 | _end = .; | ||
53 | } | ||
54 | } | ||
diff --git a/firmware/target/arm/s5l8700/crt0.S b/firmware/target/arm/s5l8700/crt0.S new file mode 100644 index 0000000000..3ecabdeaef --- /dev/null +++ b/firmware/target/arm/s5l8700/crt0.S | |||
@@ -0,0 +1,117 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Marcoen Hirschberg | ||
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 | #include "config.h" | ||
20 | #include "cpu.h" | ||
21 | |||
22 | .section .init.text,"ax",%progbits | ||
23 | |||
24 | .global start | ||
25 | start: | ||
26 | /* Exception vectors */ | ||
27 | b newstart | ||
28 | b undef_instr_handler | ||
29 | b software_int_handler | ||
30 | b prefetch_abort_handler | ||
31 | b data_abort_handler | ||
32 | b reserved_handler | ||
33 | b irq_handler | ||
34 | b fiq_handler | ||
35 | .word 0x43554644 /* DFUC */ | ||
36 | |||
37 | newstart: | ||
38 | #if 0 | ||
39 | msr cpsr_c, #0xd3 /* enter supervisor mode, disable IRQ/FIQ */ | ||
40 | |||
41 | /* Initialise bss section to zero */ | ||
42 | ldr r2, =_edata | ||
43 | ldr r3, =_end | ||
44 | mov r4, #0 | ||
45 | 1: | ||
46 | cmp r3, r2 | ||
47 | strhi r4, [r2], #4 | ||
48 | bhi 1b | ||
49 | |||
50 | /* Set up some stack and munge it with 0xdeadbeef */ | ||
51 | ldr sp, =stackend | ||
52 | ldr r2, =stackbegin | ||
53 | ldr r3, =0xdeadbeef | ||
54 | 1: | ||
55 | cmp sp, r2 | ||
56 | strhi r3, [r2], #4 | ||
57 | bhi 1b | ||
58 | |||
59 | /* Set up stack for IRQ mode */ | ||
60 | msr cpsr_c, #0xd2 | ||
61 | ldr sp, =irq_stack | ||
62 | |||
63 | /* Set up stack for FIQ mode */ | ||
64 | msr cpsr_c, #0xd1 | ||
65 | ldr sp, =fiq_stack | ||
66 | |||
67 | /* Let abort and undefined modes use IRQ stack */ | ||
68 | msr cpsr_c, #0xd7 | ||
69 | ldr sp, =irq_stack | ||
70 | msr cpsr_c, #0xdb | ||
71 | ldr sp, =irq_stack | ||
72 | |||
73 | /* Switch back to supervisor mode */ | ||
74 | msr cpsr_c, #0xd3 | ||
75 | #endif | ||
76 | bl main | ||
77 | |||
78 | |||
79 | .text | ||
80 | /* .global UIE*/ | ||
81 | |||
82 | /* All illegal exceptions call into UIE with exception address as first | ||
83 | * parameter. This is calculated differently depending on which exception | ||
84 | * we're in. Second parameter is exception number, used for a string lookup | ||
85 | * in UIE. */ | ||
86 | undef_instr_handler: | ||
87 | mov r0, lr | ||
88 | mov r1, #0 | ||
89 | b UIE | ||
90 | |||
91 | /* We run supervisor mode most of the time, and should never see a software | ||
92 | * exception being thrown. Perhaps make it illegal and call UIE? */ | ||
93 | software_int_handler: | ||
94 | reserved_handler: | ||
95 | movs pc, lr | ||
96 | |||
97 | prefetch_abort_handler: | ||
98 | sub r0, lr, #4 | ||
99 | mov r1, #1 | ||
100 | b UIE | ||
101 | |||
102 | data_abort_handler: | ||
103 | sub r0, lr, #8 | ||
104 | mov r1, #2 | ||
105 | b UIE | ||
106 | |||
107 | /* 256 words of IRQ stack */ | ||
108 | .space 256*4 | ||
109 | irq_stack: | ||
110 | |||
111 | /* 256 words of FIQ stack */ | ||
112 | .space 256*4 | ||
113 | fiq_stack: | ||
114 | |||
115 | end: | ||
116 | /*.word 0xA5A5A5A5 | ||
117 | .word 0x5A5A5A5A*/ | ||
diff --git a/firmware/target/arm/s5l8700/meizu-m6sl/adc-target.h b/firmware/target/arm/s5l8700/meizu-m6sl/adc-target.h new file mode 100644 index 0000000000..c0a069ac0c --- /dev/null +++ b/firmware/target/arm/s5l8700/meizu-m6sl/adc-target.h | |||
@@ -0,0 +1,33 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Barry Wardell | ||
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 _ADC_TARGET_H_ | ||
20 | #define _ADC_TARGET_H_ | ||
21 | |||
22 | /* only two channels used by the Gigabeat */ | ||
23 | #define NUM_ADC_CHANNELS 1 | ||
24 | |||
25 | #define ADC_UNKNOWN_1 0 | ||
26 | #define ADC_UNKNOWN_2 1 | ||
27 | #define ADC_BATTERY 2 | ||
28 | #define ADC_UNKNOWN_4 3 | ||
29 | |||
30 | #define ADC_UNREG_POWER ADC_BATTERY /* For compatibility */ | ||
31 | #define ADC_READ_ERROR 0xFFFF | ||
32 | |||
33 | #endif | ||
diff --git a/firmware/target/arm/s5l8700/meizu-m6sl/backlight-target.h b/firmware/target/arm/s5l8700/meizu-m6sl/backlight-target.h new file mode 100644 index 0000000000..1dc334cffa --- /dev/null +++ b/firmware/target/arm/s5l8700/meizu-m6sl/backlight-target.h | |||
@@ -0,0 +1,27 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2008 by Marcoen Hirschberg | ||
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 BACKLIGHT_TARGET_H | ||
20 | #define BACKLIGHT_TARGET_H | ||
21 | |||
22 | bool _backlight_init(void); | ||
23 | void _backlight_on(void); | ||
24 | void _backlight_off(void); | ||
25 | void _backlight_set_brightness(int brightness); | ||
26 | |||
27 | #endif | ||
diff --git a/firmware/target/arm/s5l8700/meizu-m6sl/button-target.h b/firmware/target/arm/s5l8700/meizu-m6sl/button-target.h new file mode 100644 index 0000000000..7d0d7a1c4d --- /dev/null +++ b/firmware/target/arm/s5l8700/meizu-m6sl/button-target.h | |||
@@ -0,0 +1,52 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2006 by Linus Nielsen Feltzing | ||
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 _BUTTON_TARGET_H_ | ||
20 | #define _BUTTON_TARGET_H_ | ||
21 | |||
22 | #include <stdbool.h> | ||
23 | #include "config.h" | ||
24 | |||
25 | #define HAS_BUTTON_HOLD | ||
26 | |||
27 | bool button_hold(void); | ||
28 | void button_init_device(void); | ||
29 | int button_read_device(void); | ||
30 | |||
31 | /* Toshiba Gigabeat specific button codes */ | ||
32 | |||
33 | #define BUTTON_LEFT 0x00000001 | ||
34 | #define BUTTON_RIGHT 0x00000002 | ||
35 | #define BUTTON_UP 0x00000004 | ||
36 | #define BUTTON_DOWN 0x00000008 | ||
37 | |||
38 | #define BUTTON_SELECT 0x00000010 | ||
39 | |||
40 | #define BUTTON_MENU 0x00000020 | ||
41 | #define BUTTON_PLAY 0x00000040 | ||
42 | |||
43 | |||
44 | #define BUTTON_MAIN (BUTTON_MENU|BUTTON_LEFT|BUTTON_RIGHT\ | ||
45 | |BUTTON_UP|BUTTON_DOWN|BUTTON_SELECT|BUTTON_PLAY) | ||
46 | |||
47 | #define BUTTON_REMOTE 0 | ||
48 | |||
49 | #define POWEROFF_BUTTON BUTTON_PLAY | ||
50 | #define POWEROFF_COUNT 10 | ||
51 | |||
52 | #endif /* _BUTTON_TARGET_H_ */ | ||
diff --git a/firmware/target/arm/s5l8700/meizu-m6sl/lcd-m6sl.c b/firmware/target/arm/s5l8700/meizu-m6sl/lcd-m6sl.c new file mode 100644 index 0000000000..8e5a4f472a --- /dev/null +++ b/firmware/target/arm/s5l8700/meizu-m6sl/lcd-m6sl.c | |||
@@ -0,0 +1,133 @@ | |||
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 | #include "config.h" | ||
20 | |||
21 | #include "hwcompat.h" | ||
22 | #include "kernel.h" | ||
23 | #include "lcd.h" | ||
24 | #include "system.h" | ||
25 | #include "cpu.h" | ||
26 | |||
27 | /*** definitions ***/ | ||
28 | |||
29 | |||
30 | /** globals **/ | ||
31 | |||
32 | static int xoffset; /* needed for flip */ | ||
33 | |||
34 | /*** hardware configuration ***/ | ||
35 | |||
36 | int lcd_default_contrast(void) | ||
37 | { | ||
38 | return 0x1f; | ||
39 | } | ||
40 | |||
41 | void lcd_set_contrast(int val) | ||
42 | { | ||
43 | } | ||
44 | |||
45 | void lcd_set_invert_display(bool yesno) | ||
46 | { | ||
47 | } | ||
48 | |||
49 | /* turn the display upside down (call lcd_update() afterwards) */ | ||
50 | void lcd_set_flip(bool yesno) | ||
51 | { | ||
52 | /* TODO: flip mode isn't working. The commands in the else part of | ||
53 | this function are how the original firmware inits the LCD */ | ||
54 | |||
55 | if (yesno) | ||
56 | { | ||
57 | xoffset = 132 - LCD_WIDTH; /* 132 colums minus the 128 we have */ | ||
58 | } | ||
59 | else | ||
60 | { | ||
61 | xoffset = 0; | ||
62 | } | ||
63 | } | ||
64 | |||
65 | |||
66 | /* LCD init */ | ||
67 | void lcd_init_device(void) | ||
68 | { | ||
69 | } | ||
70 | |||
71 | /*** Update functions ***/ | ||
72 | |||
73 | /* Performance function that works with an external buffer | ||
74 | note that by and bheight are in 8-pixel units! */ | ||
75 | void lcd_blit_mono(const unsigned char *data, int x, int by, int width, | ||
76 | int bheight, int stride) | ||
77 | { | ||
78 | /* Copy display bitmap to hardware */ | ||
79 | while (bheight--) | ||
80 | { | ||
81 | } | ||
82 | } | ||
83 | |||
84 | |||
85 | /* Performance function that works with an external buffer | ||
86 | note that by and bheight are in 8-pixel units! */ | ||
87 | void lcd_blit_grey_phase_blit(unsigned char *values, unsigned char *phases, | ||
88 | int x, int by, int width, int bheight, int stride) | ||
89 | { | ||
90 | (void)values; | ||
91 | (void)phases; | ||
92 | (void)x; | ||
93 | (void)by; | ||
94 | (void)width; | ||
95 | (void)bheight; | ||
96 | (void)stride; | ||
97 | } | ||
98 | |||
99 | /* Update the display. | ||
100 | This must be called after all other LCD functions that change the display. */ | ||
101 | void lcd_update(void) ICODE_ATTR; | ||
102 | void lcd_update(void) | ||
103 | { | ||
104 | int y; | ||
105 | |||
106 | /* Copy display bitmap to hardware */ | ||
107 | for (y = 0; y < LCD_FBHEIGHT; y++) | ||
108 | { | ||
109 | } | ||
110 | } | ||
111 | |||
112 | /* Update a fraction of the display. */ | ||
113 | void lcd_update_rect(int, int, int, int) ICODE_ATTR; | ||
114 | void lcd_update_rect(int x, int y, int width, int height) | ||
115 | { | ||
116 | int ymax; | ||
117 | |||
118 | /* The Y coordinates have to work on even 8 pixel rows */ | ||
119 | ymax = (y + height-1) >> 3; | ||
120 | y >>= 3; | ||
121 | |||
122 | if(x + width > LCD_WIDTH) | ||
123 | width = LCD_WIDTH - x; | ||
124 | if (width <= 0) | ||
125 | return; /* nothing left to do, 0 is harmful to lcd_write_data() */ | ||
126 | if(ymax >= LCD_FBHEIGHT) | ||
127 | ymax = LCD_FBHEIGHT-1; | ||
128 | |||
129 | /* Copy specified rectange bitmap to hardware */ | ||
130 | for (; y <= ymax; y++) | ||
131 | { | ||
132 | } | ||
133 | } | ||
diff --git a/firmware/target/arm/s5l8700/system-s5l8700.c b/firmware/target/arm/s5l8700/system-s5l8700.c new file mode 100644 index 0000000000..2d87cc8c9a --- /dev/null +++ b/firmware/target/arm/s5l8700/system-s5l8700.c | |||
@@ -0,0 +1,168 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2007 by Rob Purchase | ||
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 | |||
20 | #include "kernel.h" | ||
21 | #include "system.h" | ||
22 | #include "panic.h" | ||
23 | |||
24 | #define default_interrupt(name) \ | ||
25 | extern __attribute__((weak,alias("UIRQ"))) void name (void) | ||
26 | |||
27 | void irq_handler(void) __attribute__((interrupt ("IRQ"), naked)); | ||
28 | void fiq_handler(void) __attribute__((interrupt ("FIQ"), naked)); | ||
29 | |||
30 | default_interrupt(EXT0); | ||
31 | default_interrupt(EXT1); | ||
32 | default_interrupt(EXT2); | ||
33 | default_interrupt(EINT_VBUS); | ||
34 | default_interrupt(EINTG); | ||
35 | default_interrupt(INT_TIMERA); | ||
36 | default_interrupt(INT_WDT); | ||
37 | default_interrupt(INT_TIMERB); | ||
38 | default_interrupt(INT_TIMERC); | ||
39 | default_interrupt(INT_TIMERD); | ||
40 | default_interrupt(INT_DMA); | ||
41 | default_interrupt(INT_ALARM_RTC); | ||
42 | default_interrupt(INT_PRI_RTC); | ||
43 | default_interrupt(RESERVED1); | ||
44 | default_interrupt(INT_UART); | ||
45 | default_interrupt(INT_USB_HOST); | ||
46 | default_interrupt(INT_USB_FUNC); | ||
47 | default_interrupt(INT_LCDC_0); | ||
48 | default_interrupt(INT_LCDC_1); | ||
49 | default_interrupt(INT_ECC); | ||
50 | default_interrupt(INT_CALM); | ||
51 | default_interrupt(INT_ATA); | ||
52 | default_interrupt(INT_UART0); | ||
53 | default_interrupt(INT_SPDIF_OUT); | ||
54 | default_interrupt(INT_SDCI); | ||
55 | default_interrupt(INT_LCD); | ||
56 | default_interrupt(INT_SPI); | ||
57 | default_interrupt(INT_IIC); | ||
58 | default_interrupt(RESERVED2); | ||
59 | default_interrupt(INT_MSTICK); | ||
60 | default_interrupt(INT_ADC_WAKEUP); | ||
61 | default_interrupt(INT_ADC); | ||
62 | |||
63 | |||
64 | |||
65 | static void (* const irqvector[])(void) = | ||
66 | { | ||
67 | EXT0,EXT1,EXT2,EINT_VBUS,EINTG,INT_TIMERA,INT_WDT,INT_TIMERB, | ||
68 | INT_TIMERC,INT_TIMERD,INT_DMA,INT_ALARM_RTC,INT_PRI_RTC,RESERVED1,INT_UART,INT_USB_HOST, | ||
69 | INT_USB_FUNC,INT_LCDC_0,INT_LCDC_1,INT_ECC,INT_CALM,INT_ATA,INT_UART0,INT_SPDIF_OUT, | ||
70 | INT_SDCI,INT_LCD,INT_SPI,INT_IIC,RESERVED2,INT_MSTICK,INT_ADC_WAKEUP,INT_ADC | ||
71 | }; | ||
72 | |||
73 | static const char * const irqname[] = | ||
74 | { | ||
75 | "EXT0","EXT1","EXT2","EINT_VBUS","EINTG","INT_TIMERA","INT_WDT","INT_TIMERB", | ||
76 | "INT_TIMERC","INT_TIMERD","INT_DMA","INT_ALARM_RTC","INT_PRI_RTC","Reserved","INT_UART","INT_USB_HOST", | ||
77 | "INT_USB_FUNC","INT_LCDC_0","INT_LCDC_1","INT_ECC","INT_CALM","INT_ATA","INT_UART0","INT_SPDIF_OUT", | ||
78 | "INT_SDCI","INT_LCD","INT_SPI","INT_IIC","Reserved","INT_MSTICK","INT_ADC_WAKEUP","INT_ADC" | ||
79 | }; | ||
80 | |||
81 | static void UIRQ(void) | ||
82 | { | ||
83 | unsigned int offset = INTOFFSET; | ||
84 | panicf("Unhandled IRQ %02X: %s", offset, irqname[offset]); | ||
85 | } | ||
86 | |||
87 | void irq_handler(void) | ||
88 | { | ||
89 | /* | ||
90 | * Based on: linux/arch/arm/kernel/entry-armv.S and system-meg-fx.c | ||
91 | */ | ||
92 | |||
93 | asm volatile( "stmfd sp!, {r0-r7, ip, lr} \n" /* Store context */ | ||
94 | "sub sp, sp, #8 \n"); /* Reserve stack */ | ||
95 | |||
96 | int irq_no = INTOFFSET; /* Read clears the corresponding IRQ status */ | ||
97 | |||
98 | if ((irq_no & (1<<31)) == 0) /* Ensure invalid flag is not set */ | ||
99 | { | ||
100 | irqvector[irq_no](); | ||
101 | } | ||
102 | |||
103 | asm volatile( "add sp, sp, #8 \n" /* Cleanup stack */ | ||
104 | "ldmfd sp!, {r0-r7, ip, lr} \n" /* Restore context */ | ||
105 | "subs pc, lr, #4 \n"); /* Return from IRQ */ | ||
106 | } | ||
107 | |||
108 | void fiq_handler(void) | ||
109 | { | ||
110 | asm volatile ( | ||
111 | "subs pc, lr, #4 \r\n" | ||
112 | ); | ||
113 | } | ||
114 | |||
115 | |||
116 | static void gpio_init(void) | ||
117 | { | ||
118 | } | ||
119 | |||
120 | static void clock_init(void) | ||
121 | { | ||
122 | } | ||
123 | |||
124 | |||
125 | void system_init(void) | ||
126 | { | ||
127 | } | ||
128 | |||
129 | void system_reboot(void) | ||
130 | { | ||
131 | } | ||
132 | |||
133 | int system_memory_guard(int newmode) | ||
134 | { | ||
135 | (void)newmode; | ||
136 | return 0; | ||
137 | } | ||
138 | |||
139 | #ifdef HAVE_ADJUSTABLE_CPU_FREQ | ||
140 | |||
141 | void set_cpu_frequency(long frequency) | ||
142 | { | ||
143 | if (cpu_frequency == frequency) | ||
144 | return; | ||
145 | |||
146 | /* CPU/COP frequencies can be scaled between Fbus (min) and Fsys (max). | ||
147 | Fbus should not be set below ~32Mhz with LCD enabled or the display | ||
148 | will be garbled. */ | ||
149 | if (frequency == CPUFREQ_MAX) | ||
150 | { | ||
151 | } | ||
152 | else if (frequency == CPUFREQ_NORMAL) | ||
153 | { | ||
154 | } | ||
155 | else | ||
156 | { | ||
157 | } | ||
158 | |||
159 | asm volatile ( | ||
160 | "nop \n\t" | ||
161 | "nop \n\t" | ||
162 | "nop \n\t" | ||
163 | ); | ||
164 | |||
165 | cpu_frequency = frequency; | ||
166 | } | ||
167 | |||
168 | #endif | ||
diff --git a/firmware/target/arm/s5l8700/system-target.h b/firmware/target/arm/s5l8700/system-target.h new file mode 100644 index 0000000000..158bc44190 --- /dev/null +++ b/firmware/target/arm/s5l8700/system-target.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2007 by Dave Chapman | ||
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 | #include "system-arm.h" | ||
23 | |||
24 | #define CPUFREQ_DEFAULT 32000000 | ||
25 | #define CPUFREQ_NORMAL 48000000 | ||
26 | #define CPUFREQ_MAX 192000000 | ||
27 | |||
28 | #define inl(a) (*(volatile unsigned long *) (a)) | ||
29 | #define outl(a,b) (*(volatile unsigned long *) (b) = (a)) | ||
30 | #define inb(a) (*(volatile unsigned char *) (a)) | ||
31 | #define outb(a,b) (*(volatile unsigned char *) (b) = (a)) | ||
32 | #define inw(a) (*(volatile unsigned short *) (a)) | ||
33 | #define outw(a,b) (*(volatile unsigned short *) (b) = (a)) | ||
34 | |||
35 | #endif /* SYSTEM_TARGET_H */ | ||