summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2008-03-08 23:34:43 +0000
committerJens Arnold <amiconn@rockbox.org>2008-03-08 23:34:43 +0000
commitd1ed7c37b130500cc3c5b5ed4390192f623abd5d (patch)
treef1e7a9190be5c9764ad1c28b1c4318fb8201fc86
parent75c7ac80e8540be0f581c3ad4d92b748f9649618 (diff)
downloadrockbox-d1ed7c37b130500cc3c5b5ed4390192f623abd5d.tar.gz
rockbox-d1ed7c37b130500cc3c5b5ed4390192f623abd5d.zip
No need to have \n here. panicf() won't output it anyway.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16570 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/SOURCES2
-rw-r--r--apps/codecs/Makefile1
-rw-r--r--apps/codecs/SOURCES1
-rw-r--r--apps/filetypes.c1
-rw-r--r--apps/main.c4
-rw-r--r--apps/metadata.c8
-rw-r--r--apps/metadata/metadata_parsers.h1
-rw-r--r--apps/playback.c2
-rw-r--r--apps/player/bmp.c199
-rw-r--r--apps/player/bmp.h35
-rw-r--r--apps/plugins/CATEGORIES1
-rw-r--r--apps/plugins/SOURCES11
-rw-r--r--firmware/drivers/ata.c63
-rw-r--r--firmware/drivers/ata_mmc.c2
-rw-r--r--firmware/export/config-player.h2
-rw-r--r--firmware/export/id3.h1
-rw-r--r--firmware/id3.c3
-rw-r--r--firmware/target/arm/iriver/h10/lcd-h10_5gb.c114
-rw-r--r--firmware/target/arm/system-pp502x.c2
-rw-r--r--firmware/target/coldfire/memcpy-coldfire.S440
20 files changed, 779 insertions, 114 deletions
diff --git a/apps/SOURCES b/apps/SOURCES
index 0d23f42765..f3cb39fc1f 100644
--- a/apps/SOURCES
+++ b/apps/SOURCES
@@ -75,6 +75,7 @@ gui/backdrop.c
75#endif 75#endif
76 76
77#ifdef HAVE_LCD_CHARCELLS 77#ifdef HAVE_LCD_CHARCELLS
78player/bmp.c
78player/icons.c 79player/icons.c
79player/keyboard.c 80player/keyboard.c
80#endif 81#endif
@@ -129,6 +130,7 @@ metadata/mp4.c
129metadata/mpc.c 130metadata/mpc.c
130metadata/ogg.c 131metadata/ogg.c
131metadata/sid.c 132metadata/sid.c
133metadata/mod.c
132metadata/spc.c 134metadata/spc.c
133metadata/vorbis.c 135metadata/vorbis.c
134metadata/wave.c 136metadata/wave.c
diff --git a/apps/codecs/Makefile b/apps/codecs/Makefile
index 5a65341d02..7c066d284d 100644
--- a/apps/codecs/Makefile
+++ b/apps/codecs/Makefile
@@ -47,6 +47,7 @@ all: $(LINKCODEC) $(ROCKS)
47ifndef SIMVER 47ifndef SIMVER
48$(BUILDDIR)/%.a : % $(CODECDEPS) 48$(BUILDDIR)/%.a : % $(CODECDEPS)
49 49
50$(OBJDIR)/mod.elf : $(OBJDIR)/mod.o $(OBJDIR)/codec_crt0.o
50$(OBJDIR)/wav.elf : $(OBJDIR)/wav.o $(OBJDIR)/codec_crt0.o 51$(OBJDIR)/wav.elf : $(OBJDIR)/wav.o $(OBJDIR)/codec_crt0.o
51$(OBJDIR)/sid.elf : $(OBJDIR)/sid.o $(OBJDIR)/codec_crt0.o 52$(OBJDIR)/sid.elf : $(OBJDIR)/sid.o $(OBJDIR)/codec_crt0.o
52$(OBJDIR)/adx.elf : $(OBJDIR)/adx.o $(OBJDIR)/codec_crt0.o 53$(OBJDIR)/adx.elf : $(OBJDIR)/adx.o $(OBJDIR)/codec_crt0.o
diff --git a/apps/codecs/SOURCES b/apps/codecs/SOURCES
index a93cb6c0cc..3c0118c1ce 100644
--- a/apps/codecs/SOURCES
+++ b/apps/codecs/SOURCES
@@ -13,6 +13,7 @@ wma.c
13aac.c 13aac.c
14#endif 14#endif
15ape.c 15ape.c
16mod.c
16shorten.c 17shorten.c
17aiff.c 18aiff.c
18speex.c 19speex.c
diff --git a/apps/filetypes.c b/apps/filetypes.c
index 8427bc7450..7cf95553a3 100644
--- a/apps/filetypes.c
+++ b/apps/filetypes.c
@@ -69,6 +69,7 @@ const struct filetype inbuilt_filetypes[] = {
69 { "m4a", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, 69 { "m4a", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA },
70 { "m4b", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, 70 { "m4b", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA },
71 { "mp4", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, 71 { "mp4", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA },
72 { "mod", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA },
72 { "shn", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, 73 { "shn", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA },
73 { "aif", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, 74 { "aif", FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA },
74 { "aiff",FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA }, 75 { "aiff",FILE_ATTR_AUDIO, Icon_Audio, VOICE_EXT_MPA },
diff --git a/apps/main.c b/apps/main.c
index 15dd1bcef9..b60b089b74 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -144,10 +144,10 @@ static int init_dircache(bool preinit)
144 144
145 if (preinit) 145 if (preinit)
146 dircache_init(); 146 dircache_init();
147 147
148 if (!global_settings.dircache) 148 if (!global_settings.dircache)
149 return 0; 149 return 0;
150 150
151# ifdef HAVE_EEPROM_SETTINGS 151# ifdef HAVE_EEPROM_SETTINGS
152 if (firmware_settings.initialized && firmware_settings.disk_clean 152 if (firmware_settings.initialized && firmware_settings.disk_clean
153 && preinit) 153 && preinit)
diff --git a/apps/metadata.c b/apps/metadata.c
index 3abbd74c35..303fafc070 100644
--- a/apps/metadata.c
+++ b/apps/metadata.c
@@ -183,6 +183,14 @@ bool get_metadata(struct mp3entry* id3, int fd, const char* trackname)
183 183
184 break; 184 break;
185 185
186 case AFMT_MOD:
187 if (!get_mod_metadata(fd, id3))
188 {
189 return false;
190 }
191
192 break;
193
186 case AFMT_SHN: 194 case AFMT_SHN:
187 id3->vbr = true; 195 id3->vbr = true;
188 id3->filesize = filesize(fd); 196 id3->filesize = filesize(fd);
diff --git a/apps/metadata/metadata_parsers.h b/apps/metadata/metadata_parsers.h
index c3265f8a43..b34d09fe4c 100644
--- a/apps/metadata/metadata_parsers.h
+++ b/apps/metadata/metadata_parsers.h
@@ -25,6 +25,7 @@ bool get_mp4_metadata(int fd, struct mp3entry* id3);
25bool get_monkeys_metadata(int fd, struct mp3entry* id3); 25bool get_monkeys_metadata(int fd, struct mp3entry* id3);
26bool get_musepack_metadata(int fd, struct mp3entry *id3); 26bool get_musepack_metadata(int fd, struct mp3entry *id3);
27bool get_sid_metadata(int fd, struct mp3entry* id3); 27bool get_sid_metadata(int fd, struct mp3entry* id3);
28bool get_mod_metadata(int fd, struct mp3entry* id3);
28bool get_spc_metadata(int fd, struct mp3entry* id3); 29bool get_spc_metadata(int fd, struct mp3entry* id3);
29bool get_ogg_metadata(int fd, struct mp3entry* id3); 30bool get_ogg_metadata(int fd, struct mp3entry* id3);
30bool get_wave_metadata(int fd, struct mp3entry* id3); 31bool get_wave_metadata(int fd, struct mp3entry* id3);
diff --git a/apps/playback.c b/apps/playback.c
index cb9ed3e162..dbaf55fbdd 100644
--- a/apps/playback.c
+++ b/apps/playback.c
@@ -1511,7 +1511,7 @@ int audio_track_count(void)
1511} 1511}
1512 1512
1513long audio_filebufused(void) 1513long audio_filebufused(void)
1514{ 1514{
1515 return (long) buf_used(); 1515 return (long) buf_used();
1516} 1516}
1517 1517
diff --git a/apps/player/bmp.c b/apps/player/bmp.c
new file mode 100644
index 0000000000..290880c0f7
--- /dev/null
+++ b/apps/player/bmp.c
@@ -0,0 +1,199 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 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
20/*
212008-02-24 Jens Arnold: minimalistic version for charcell displays
22*/
23
24#include <stdio.h>
25#include <stdlib.h>
26#include <string.h>
27#include "inttypes.h"
28#include "debug.h"
29#include "lcd.h"
30#include "file.h"
31#include "config.h"
32#include "system.h"
33#include "bmp.h"
34#include "lcd.h"
35
36#ifdef __GNUC__
37#define STRUCT_PACKED __attribute__((packed))
38#else
39#define STRUCT_PACKED
40#pragma pack (push, 2)
41#endif
42
43/* BMP header structure */
44struct bmp_header {
45 uint16_t type; /* signature - 'BM' */
46 uint32_t size; /* file size in bytes */
47 uint16_t reserved1; /* 0 */
48 uint16_t reserved2; /* 0 */
49 uint32_t off_bits; /* offset to bitmap */
50 uint32_t struct_size; /* size of this struct (40) */
51 int32_t width; /* bmap width in pixels */
52 int32_t height; /* bmap height in pixels */
53 uint16_t planes; /* num planes - always 1 */
54 uint16_t bit_count; /* bits per pixel */
55 uint32_t compression; /* compression flag */
56 uint32_t size_image; /* image size in bytes */
57 int32_t x_pels_per_meter; /* horz resolution */
58 int32_t y_pels_per_meter; /* vert resolution */
59 uint32_t clr_used; /* 0 -> color table size */
60 uint32_t clr_important; /* important color count */
61} STRUCT_PACKED;
62
63union rgb_union {
64 struct { /* Little endian */
65 unsigned char blue;
66 unsigned char green;
67 unsigned char red;
68 unsigned char reserved;
69 };
70 uint32_t raw;
71};
72
73
74/* little endian functions */
75static inline unsigned readshort(uint16_t *value)
76{
77 unsigned char* bytes = (unsigned char*) value;
78 return (unsigned)bytes[0] | ((unsigned)bytes[1] << 8);
79}
80
81static inline uint32_t readlong(uint32_t *value)
82{
83 unsigned char* bytes = (unsigned char*) value;
84 return (uint32_t)bytes[0] | ((uint32_t)bytes[1] << 8) |
85 ((uint32_t)bytes[2] << 16) | ((uint32_t)bytes[3] << 24);
86}
87
88static inline unsigned brightness(union rgb_union color)
89{
90 return (3 * (unsigned)color.red + 6 * (unsigned)color.green
91 + (unsigned)color.blue) / 10;
92}
93
94/******************************************************************************
95 * read_bmp_file()
96 *
97 * Reads a BMP file and puts the data in rockbox format in *data.
98 *
99 *****************************************************************************/
100int read_bmp_file(const char* filename,
101 unsigned char *bitmap,
102 int maxsize)
103{
104 struct bmp_header bmph;
105 int fd, ret;
106 int width, height, depth;
107 int row, rowstart, rowstop, rowstep;
108 unsigned char invert;
109 unsigned char bmpbuf[4]; /* Buffer for one line */
110 uint32_t palette[2];
111
112 fd = open(filename, O_RDONLY);
113
114 /* Exit if file opening failed */
115 if (fd < 0)
116 {
117 DEBUGF("read_bmp_file: can't open '%s', rc: %d\n", filename, fd);
118 return fd * 10 - 1;
119 }
120
121 /* read fileheader */
122 ret = read(fd, &bmph, sizeof(struct bmp_header));
123 if (ret < 0)
124 return ret * 10 - 2;
125
126 if (ret != sizeof(struct bmp_header)) {
127 DEBUGF("read_bmp_file: can't read BMP header.");
128 return -3;
129 }
130
131 width = readlong(&bmph.width);
132 if (width > 8)
133 {
134 DEBUGF("read_bmp_file: Bitmap too wide (%d pixels, max is 8)\n", width);
135 return -4;
136 }
137
138 depth = readshort(&bmph.bit_count);
139 if (depth != 1)
140 {
141 DEBUGF("read_bmp_fd: Wrong depth (%d, must be 1)\n", depth);
142 return -5;
143 }
144
145 height = readlong(&bmph.height);
146 if (height < 0)
147 { /* Top-down BMP file */
148 height = -height;
149 rowstart = 0;
150 rowstop = height;
151 rowstep = 1;
152 }
153 else
154 { /* normal BMP */
155 rowstart = height - 1;
156 rowstop = -1;
157 rowstep = -1;
158 }
159
160 /* Check if this fits the buffer */
161 if (height > maxsize)
162 {
163 DEBUGF("read_bmp_fd: Bitmap too high for buffer: %d bytes.\n", height);
164 return -6;
165 }
166
167 if (read(fd, palette, 2 * sizeof(uint32_t))
168 != 2 * (int)sizeof(uint32_t))
169 {
170 DEBUGF("read_bmp_fd: Can't read color palette\n");
171 return -7;
172 }
173 invert = (brightness((union rgb_union)palette[1])
174 > brightness((union rgb_union)palette[0]))
175 ? 0xff : 0x00;
176
177 /* Search to the beginning of the image data */
178 lseek(fd, (off_t)readlong(&bmph.off_bits), SEEK_SET);
179 memset(bitmap, 0, height);
180
181 /* loop to read rows and put them to buffer */
182 for (row = rowstart; row != rowstop; row += rowstep)
183 {
184 /* read one row */
185 ret = read(fd, bmpbuf, 4);
186 if (ret != 4)
187 {
188 DEBUGF("read_bmp_fd: error reading image, read returned: %d "
189 "expected: 4\n", ret);
190 return -9;
191 }
192 bitmap[row] = bmpbuf[0] ^ invert;
193 }
194
195 DEBUGF("totalsize: %d\n", totalsize);
196
197 close(fd);
198 return height; /* return the used buffer size. */
199}
diff --git a/apps/player/bmp.h b/apps/player/bmp.h
new file mode 100644
index 0000000000..ddfa349d9d
--- /dev/null
+++ b/apps/player/bmp.h
@@ -0,0 +1,35 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2002 by Daniel Stenberg
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 _BMP_H_
20#define _BMP_H_
21
22/*********************************************************************
23 * read_bmp_file(), minimalistic version for charcell displays
24 *
25 * Reads a 1 bit BMP file and puts the data in a horizontal packed
26 * 1 bit-per-pixel char array. Width must be <= 8 pixels.
27 * Returns < 0 for error, or number of bytes used from the bitmap
28 * buffer, which equals bitmap height.
29 *
30 **********************************************/
31int read_bmp_file(const char* filename,
32 unsigned char *bitmap,
33 int maxsize);
34
35#endif
diff --git a/apps/plugins/CATEGORIES b/apps/plugins/CATEGORIES
index 4b267c162b..c2ad75e0c7 100644
--- a/apps/plugins/CATEGORIES
+++ b/apps/plugins/CATEGORIES
@@ -80,6 +80,7 @@ stopwatch,apps
80test_codec,viewers 80test_codec,viewers
81test_disk,apps 81test_disk,apps
82test_fps,apps 82test_fps,apps
83test_grey,apps
83test_sampr,apps 84test_sampr,apps
84test_scanrate,apps 85test_scanrate,apps
85test_viewports,apps 86test_viewports,apps
diff --git a/apps/plugins/SOURCES b/apps/plugins/SOURCES
index 4f782dc455..7b7edbf5c2 100644
--- a/apps/plugins/SOURCES
+++ b/apps/plugins/SOURCES
@@ -21,6 +21,7 @@ stats.c
21stopwatch.c 21stopwatch.c
22vbrfix.c 22vbrfix.c
23viewer.c 23viewer.c
24test_disk.c
24 25
25#ifdef OLYMPUS_MROBE_500 26#ifdef OLYMPUS_MROBE_500
26/* remove these once the plugins before it are compileable */ 27/* remove these once the plugins before it are compileable */
@@ -48,7 +49,10 @@ flipit.c
48#ifdef HAVE_LCD_BITMAP /* Not for the Player */ 49#ifdef HAVE_LCD_BITMAP /* Not for the Player */
49brickmania.c 50brickmania.c
50maze.c 51maze.c
51mazezam.c 52mazezam.c
53greyscale.c
54test_fps.c
55test_scanrate.c
52text_editor.c 56text_editor.c
53wavview.c 57wavview.c
54robotfindskitten.c 58robotfindskitten.c
@@ -59,6 +63,10 @@ jpeg.c
59mandelbrot.c 63mandelbrot.c
60plasma.c 64plasma.c
61 65
66#if LCD_DEPTH < 4
67test_grey.c
68#endif
69
62blackjack.c 70blackjack.c
63bounce.c 71bounce.c
64bubbles.c 72bubbles.c
@@ -118,6 +126,7 @@ nim.c
118 126
119#if CONFIG_CODEC == SWCODEC /* software codec platforms */ 127#if CONFIG_CODEC == SWCODEC /* software codec platforms */
120mp3_encoder.c 128mp3_encoder.c
129test_codec.c
121wav2wv.c 130wav2wv.c
122#else /* hardware codec platforms */ 131#else /* hardware codec platforms */
123#ifndef HAVE_MMC /* not for Ondio, has no remote control pin */ 132#ifndef HAVE_MMC /* not for Ondio, has no remote control pin */
diff --git a/firmware/drivers/ata.c b/firmware/drivers/ata.c
index 549a7bf920..db8bdf92a0 100644
--- a/firmware/drivers/ata.c
+++ b/firmware/drivers/ata.c
@@ -89,6 +89,7 @@ static bool initialized = false;
89static long last_user_activity = -1; 89static long last_user_activity = -1;
90long last_disk_activity = -1; 90long last_disk_activity = -1;
91 91
92static unsigned long total_sectors;
92static int multisectors; /* number of supported multisectors */ 93static int multisectors; /* number of supported multisectors */
93static unsigned short identify_info[SECTOR_SIZE/2]; 94static unsigned short identify_info[SECTOR_SIZE/2];
94 95
@@ -284,6 +285,11 @@ int ata_read_sectors(IF_MV2(int drive,)
284 mutex_lock(&ata_mtx); 285 mutex_lock(&ata_mtx);
285#endif 286#endif
286 287
288 if (start + incount > total_sectors) {
289 ret = -1;
290 goto error;
291 }
292
287 last_disk_activity = current_tick; 293 last_disk_activity = current_tick;
288 spinup_start = current_tick; 294 spinup_start = current_tick;
289 295
@@ -293,16 +299,14 @@ int ata_read_sectors(IF_MV2(int drive,)
293 spinup = true; 299 spinup = true;
294 if (poweroff) { 300 if (poweroff) {
295 if (ata_power_on()) { 301 if (ata_power_on()) {
296 mutex_unlock(&ata_mtx); 302 ret = -2;
297 ata_led(false); 303 goto error;
298 return -1;
299 } 304 }
300 } 305 }
301 else { 306 else {
302 if (perform_soft_reset()) { 307 if (perform_soft_reset()) {
303 mutex_unlock(&ata_mtx); 308 ret = -2;
304 ata_led(false); 309 goto error;
305 return -1;
306 } 310 }
307 } 311 }
308 } 312 }
@@ -312,9 +316,8 @@ int ata_read_sectors(IF_MV2(int drive,)
312 SET_REG(ATA_SELECT, ata_device); 316 SET_REG(ATA_SELECT, ata_device);
313 if (!wait_for_rdy()) 317 if (!wait_for_rdy())
314 { 318 {
315 mutex_unlock(&ata_mtx); 319 ret = -3;
316 ata_led(false); 320 goto error;
317 return -2;
318 } 321 }
319 322
320 retry: 323 retry:
@@ -371,7 +374,7 @@ int ata_read_sectors(IF_MV2(int drive,)
371 We choose alternative 2. 374 We choose alternative 2.
372 */ 375 */
373 perform_soft_reset(); 376 perform_soft_reset();
374 ret = -4; 377 ret = -5;
375 goto retry; 378 goto retry;
376 } 379 }
377 380
@@ -403,7 +406,7 @@ int ata_read_sectors(IF_MV2(int drive,)
403 */ 406 */
404 if ( status & (STATUS_BSY | STATUS_ERR | STATUS_DF) ) { 407 if ( status & (STATUS_BSY | STATUS_ERR | STATUS_DF) ) {
405 perform_soft_reset(); 408 perform_soft_reset();
406 ret = -5; 409 ret = -6;
407 goto retry; 410 goto retry;
408 } 411 }
409 412
@@ -415,13 +418,14 @@ int ata_read_sectors(IF_MV2(int drive,)
415 418
416 if(!ret && !wait_for_end_of_transfer()) { 419 if(!ret && !wait_for_end_of_transfer()) {
417 perform_soft_reset(); 420 perform_soft_reset();
418 ret = -3; 421 ret = -4;
419 goto retry; 422 goto retry;
420 } 423 }
421 break; 424 break;
422 } 425 }
423 ata_led(false);
424 426
427 error:
428 ata_led(false);
425#ifndef MAX_PHYS_SECTOR_SIZE 429#ifndef MAX_PHYS_SECTOR_SIZE
426 mutex_unlock(&ata_mtx); 430 mutex_unlock(&ata_mtx);
427#endif 431#endif
@@ -489,6 +493,9 @@ int ata_write_sectors(IF_MV2(int drive,)
489 mutex_lock(&ata_mtx); 493 mutex_lock(&ata_mtx);
490#endif 494#endif
491 495
496 if (start + count > total_sectors)
497 panicf("Writing past end of disk");
498
492 last_disk_activity = current_tick; 499 last_disk_activity = current_tick;
493 spinup_start = current_tick; 500 spinup_start = current_tick;
494 501
@@ -498,16 +505,14 @@ int ata_write_sectors(IF_MV2(int drive,)
498 spinup = true; 505 spinup = true;
499 if (poweroff) { 506 if (poweroff) {
500 if (ata_power_on()) { 507 if (ata_power_on()) {
501 mutex_unlock(&ata_mtx); 508 ret = -1;
502 ata_led(false); 509 goto error;
503 return -1;
504 } 510 }
505 } 511 }
506 else { 512 else {
507 if (perform_soft_reset()) { 513 if (perform_soft_reset()) {
508 mutex_unlock(&ata_mtx); 514 ret = -1;
509 ata_led(false); 515 goto error;
510 return -1;
511 } 516 }
512 } 517 }
513 } 518 }
@@ -515,9 +520,8 @@ int ata_write_sectors(IF_MV2(int drive,)
515 SET_REG(ATA_SELECT, ata_device); 520 SET_REG(ATA_SELECT, ata_device);
516 if (!wait_for_rdy()) 521 if (!wait_for_rdy())
517 { 522 {
518 mutex_unlock(&ata_mtx); 523 ret = -2;
519 ata_led(false); 524 goto error;
520 return -2;
521 } 525 }
522 526
523#ifdef HAVE_LBA48 527#ifdef HAVE_LBA48
@@ -575,8 +579,8 @@ int ata_write_sectors(IF_MV2(int drive,)
575 ret = -4; 579 ret = -4;
576 } 580 }
577 581
582 error:
578 ata_led(false); 583 ata_led(false);
579
580#ifndef MAX_PHYS_SECTOR_SIZE 584#ifndef MAX_PHYS_SECTOR_SIZE
581 mutex_unlock(&ata_mtx); 585 mutex_unlock(&ata_mtx);
582#endif 586#endif
@@ -1240,11 +1244,16 @@ int ata_init(void)
1240 phys_sector_mult * SECTOR_SIZE); 1244 phys_sector_mult * SECTOR_SIZE);
1241#endif 1245#endif
1242 1246
1247 total_sectors = identify_info[60] | (identify_info[60] << 16);
1248
1243#ifdef HAVE_LBA48 1249#ifdef HAVE_LBA48
1244 if (identify_info[83] & 0x0400 /* 48 bit address support */ 1250 if (identify_info[83] & 0x0400 /* 48 bit address support */
1245 && identify_info[60] == 0xFFFF /* and disk size >= 128 GiB */ 1251 && total_sectors == 0x0FFFFFFF) /* and disk size >= 128 GiB */
1246 && identify_info[61] == 0x0FFF) /* (needs BigLBA addressing) */ 1252 { /* (needs BigLBA addressing) */
1247 { 1253 if (identify_info[102] || identify_info[103])
1254 panicf("Unsupported disk size, >= 2^32 sectors");
1255
1256 total_sectors = identify_info[100] | (identify_info[101] << 16);
1248 lba48 = true; /* use BigLBA */ 1257 lba48 = true; /* use BigLBA */
1249 } 1258 }
1250#endif 1259#endif
diff --git a/firmware/drivers/ata_mmc.c b/firmware/drivers/ata_mmc.c
index fdd091248f..e0a2b17500 100644
--- a/firmware/drivers/ata_mmc.c
+++ b/firmware/drivers/ata_mmc.c
@@ -814,7 +814,7 @@ int ata_write_sectors(IF_MV2(int drive,)
814 } 814 }
815 815
816 if (c_end_addr > card->size) 816 if (c_end_addr > card->size)
817 panicf("Writing past end of card\n"); 817 panicf("Writing past end of card");
818 818
819 blocksize = card->blocksize; 819 blocksize = card->blocksize;
820 offset = c_addr & (blocksize - 1); 820 offset = c_addr & (blocksize - 1);
diff --git a/firmware/export/config-player.h b/firmware/export/config-player.h
index b9e3035951..c69fe8cfcb 100644
--- a/firmware/export/config-player.h
+++ b/firmware/export/config-player.h
@@ -46,7 +46,7 @@
46 46
47/* Uncomment this if you want to enable ATA power-off control. 47/* Uncomment this if you want to enable ATA power-off control.
48 * Attention, some players crash when ATA power-off is enabled! */ 48 * Attention, some players crash when ATA power-off is enabled! */
49//#define HAVE_ATA_POWER_OFF 49#define HAVE_ATA_POWER_OFF
50 50
51/* Define this if you control ata power player style 51/* Define this if you control ata power player style
52 (with PB4, new player only) */ 52 (with PB4, new player only) */
diff --git a/firmware/export/id3.h b/firmware/export/id3.h
index bb3b6a6fe5..267f1b4afa 100644
--- a/firmware/export/id3.h
+++ b/firmware/export/id3.h
@@ -49,6 +49,7 @@ enum
49 AFMT_WAVPACK, /* WavPack */ 49 AFMT_WAVPACK, /* WavPack */
50 AFMT_ALAC, /* Apple Lossless Audio Codec */ 50 AFMT_ALAC, /* Apple Lossless Audio Codec */
51 AFMT_AAC, /* Advanced Audio Coding (AAC) in M4A container */ 51 AFMT_AAC, /* Advanced Audio Coding (AAC) in M4A container */
52 AFMT_MOD, /* MOD File Format */
52 AFMT_SHN, /* Shorten */ 53 AFMT_SHN, /* Shorten */
53 AFMT_SID, /* SID File Format */ 54 AFMT_SID, /* SID File Format */
54 AFMT_ADX, /* ADX File Format */ 55 AFMT_ADX, /* ADX File Format */
diff --git a/firmware/id3.c b/firmware/id3.c
index f594528910..87b4ce9d31 100644
--- a/firmware/id3.c
+++ b/firmware/id3.c
@@ -90,6 +90,9 @@ const struct afmt_entry audio_formats[AFMT_NUM_CODECS] =
90 [AFMT_AAC] = 90 [AFMT_AAC] =
91 AFMT_ENTRY("AAC", "aac", NULL, "mp4\0" ), 91 AFMT_ENTRY("AAC", "aac", NULL, "mp4\0" ),
92 /* Shorten */ 92 /* Shorten */
93 [AFMT_MOD] =
94 AFMT_ENTRY("MOD", "mod", NULL, "mod\0" ),
95 /* Shorten */
93 [AFMT_SHN] = 96 [AFMT_SHN] =
94 AFMT_ENTRY("SHN", "shorten", NULL, "shn\0" ), 97 AFMT_ENTRY("SHN", "shorten", NULL, "shn\0" ),
95 /* SID File Format */ 98 /* SID File Format */
diff --git a/firmware/target/arm/iriver/h10/lcd-h10_5gb.c b/firmware/target/arm/iriver/h10/lcd-h10_5gb.c
index 8972fd1e9c..680d2c47a5 100644
--- a/firmware/target/arm/iriver/h10/lcd-h10_5gb.c
+++ b/firmware/target/arm/iriver/h10/lcd-h10_5gb.c
@@ -108,6 +108,7 @@ void lcd_init_device(void)
108{ 108{
109 CLCD_CLOCK_SRC |= 0xc0000000; /* Set LCD interface clock to PLL */ 109 CLCD_CLOCK_SRC |= 0xc0000000; /* Set LCD interface clock to PLL */
110 /* H10 LCD is initialised by the bootloader */ 110 /* H10 LCD is initialised by the bootloader */
111 lcd_write_reg(R_ENTRY_MODE, 0x1030); /* BGR =1, ID1 = 1, ID0 = 1 */
111} 112}
112 113
113/*** update functions ***/ 114/*** update functions ***/
@@ -289,88 +290,51 @@ void lcd_yuv_blit(unsigned char * const src[3],
289 290
290 291
291/* Update a fraction of the display. */ 292/* Update a fraction of the display. */
292void lcd_update_rect(int x0, int y0, int width, int height) 293void lcd_update_rect(int x, int y, int width, int height)
293{ 294{
294 int x1, y1; 295 const fb_data *addr;
295 int newx,newwidth; 296 int bytes_to_write;
296 unsigned long *addr; 297
298 if (x + width >= LCD_WIDTH)
299 width = LCD_WIDTH - x;
300 if (y + height >= LCD_HEIGHT)
301 height = LCD_HEIGHT - y;
302
303 if ((width <= 0) || (height <= 0))
304 return; /* Nothing left to do. 0 would hang the transfer. */
305
306 /* Ensure x and width are both even, so we can read
307 * 32-bit aligned data from the framebuffer */
308 width = (width + (x & 1) + 1) & ~1;
309 x &= ~1;
310
311 lcd_write_reg(R_VERT_RAM_ADDR_POS, (LCD_HEIGHT-1) << 8);
312 lcd_write_reg(R_HORIZ_RAM_ADDR_POS, ((x + width - 1) << 8) | x);
313 lcd_write_reg(R_RAM_ADDR_SET, (y << 8) | x);
297 314
298 /* Ensure x and width are both even - so we can read 32-bit aligned
299 data from lcd_framebuffer */
300 newx=x0&~1;
301 newwidth=width&~1;
302 if (newx+newwidth < x0+width) { newwidth+=2; }
303 x0=newx; width=newwidth;
304
305 /* calculate the drawing region */
306 y1 = (y0 + height) - 1; /* max vert */
307 x1 = (x0 + width) - 1; /* max horiz */
308
309
310 /* swap max horiz < start horiz */
311 if (y1 < y0) {
312 int t;
313 t = y0;
314 y0 = y1;
315 y1 = t;
316 }
317
318 /* swap max vert < start vert */
319 if (x1 < x0) {
320 int t;
321 t = x0;
322 x0 = x1;
323 x1 = t;
324 }
325
326 /* max horiz << 8 | start horiz */
327 lcd_write_reg(R_HORIZ_RAM_ADDR_POS, (x1 << 8) | x0);
328
329 /* max vert << 8 | start vert */
330 lcd_write_reg(R_VERT_RAM_ADDR_POS, (y1 << 8) | y0);
331
332 /* start vert << 8 | start horiz */
333 lcd_write_reg(R_RAM_ADDR_SET, (y0 << 8) | x0);
334
335 /* start drawing */
336 lcd_send_cmd(R_WRITE_DATA_2_GRAM); 315 lcd_send_cmd(R_WRITE_DATA_2_GRAM);
337 316
338 addr = (unsigned long*)&lcd_framebuffer[y0][x0]; 317 addr = &lcd_framebuffer[y][x];
339 318 bytes_to_write = width * height * sizeof(fb_data);
340 while (height > 0) { 319 /* must be <= 0x10000, but that's guaranteed on H10. */
341 int c, r;
342 int h, pixels_to_write;
343
344 pixels_to_write = (width * height) * 2;
345 h = height;
346
347 /* calculate how much we can do in one go */
348 if (pixels_to_write > 0x10000) {
349 h = (0x10000/2) / width;
350 pixels_to_write = (width * h) * 2;
351 }
352
353 LCD2_BLOCK_CTRL = 0x10000080;
354 LCD2_BLOCK_CONFIG = 0xc0010000 | (pixels_to_write - 1);
355 LCD2_BLOCK_CTRL = 0x34000000;
356 320
357 /* for each row */ 321 LCD2_BLOCK_CTRL = 0x10000080;
358 for (r = 0; r < h; r++) { 322 LCD2_BLOCK_CONFIG = 0xc0010000 | (bytes_to_write - 1);
359 /* for each column */ 323 LCD2_BLOCK_CTRL = 0x34000000;
360 for (c = 0; c < width; c += 2) { 324
361 while (!(LCD2_BLOCK_CTRL & LCD2_BLOCK_TXOK)); 325 do
362 326 {
363 /* output 2 pixels */ 327 int w = width >> 1;
364 LCD2_BLOCK_DATA = *addr++; 328 do
365 } 329 {
366 addr += (LCD_WIDTH - width)/2; 330 while (!(LCD2_BLOCK_CTRL & LCD2_BLOCK_TXOK));
331 LCD2_BLOCK_DATA = *(unsigned long*)addr; /* output 2 pixels */
332 addr += 2;
367 } 333 }
368 334 while (--w > 0);
369 while (!(LCD2_BLOCK_CTRL & LCD2_BLOCK_READY)); 335 addr += LCD_WIDTH - width;
370 LCD2_BLOCK_CONFIG = 0;
371
372 height -= h;
373 } 336 }
337 while (--height > 0);
374} 338}
375 339
376/* Update the display. 340/* Update the display.
diff --git a/firmware/target/arm/system-pp502x.c b/firmware/target/arm/system-pp502x.c
index 27d11aa815..a5ed7b2999 100644
--- a/firmware/target/arm/system-pp502x.c
+++ b/firmware/target/arm/system-pp502x.c
@@ -365,7 +365,7 @@ void system_init(void)
365#elif defined (IPOD_MINI) 365#elif defined (IPOD_MINI)
366 /* to be done */ 366 /* to be done */
367#elif defined (IPOD_MINI2G) 367#elif defined (IPOD_MINI2G)
368 /* to be done */ 368 /* to be done */
369#elif defined (MROBE_100) 369#elif defined (MROBE_100)
370 /* to be done */ 370 /* to be done */
371#elif defined (ELIO_TPJ1022) 371#elif defined (ELIO_TPJ1022)
diff --git a/firmware/target/coldfire/memcpy-coldfire.S b/firmware/target/coldfire/memcpy-coldfire.S
index 523e1f5ed9..dd1a8a66da 100644
--- a/firmware/target/coldfire/memcpy-coldfire.S
+++ b/firmware/target/coldfire/memcpy-coldfire.S
@@ -38,8 +38,8 @@
38 * %d0 - destination address (like ANSI version) 38 * %d0 - destination address (like ANSI version)
39 * 39 *
40 * register usage: 40 * register usage:
41 * %a0 - current source address 41 * %a1 - current source address
42 * %a1 - current dest address 42 * %a0 - current dest address
43 * %a2 - source end address (in line-copy loops) 43 * %a2 - source end address (in line-copy loops)
44 * %d0 - data / scratch 44 * %d0 - data / scratch
45 * %d1 - source end address (byte and longword copy) / data / scratch 45 * %d1 - source end address (byte and longword copy) / data / scratch
@@ -52,11 +52,439 @@
52 * if FULLSPEED is undefined. 52 * if FULLSPEED is undefined.
53 */ 53 */
54memcpy: 54memcpy:
55 move.l (4,%sp),%a1 /* Destination */ 55 move.l (4, %sp), %a1 /* Destination */
56 move.l (8,%sp),%a0 /* Source */ 56 move.l (8, %sp), %a0 /* Source */
57 move.l (12,%sp),%d1 /* Length */ 57 move.l (12, %sp), %d1 /* Length */
58 58
59__memcpy_fwd_entry: 59__memcpy_fwd_entry:
60
61#if 1 /* CODE TEST */
62
63 cmp.l #5, %d1
64 bhs.b .min5
65
66 move.l %a1, %d0
67 jmp.l (2, %pc, %d1.l*4)
68.bytes_grid:
69 rts /* 0 */
70 nop
71.bytes_1:
72 move.b (%a0)+, (%a1)+ /* 1 */
73 rts
74 move.w (%a0)+, (%a1)+ /* 2 */
75 rts
76 move.w (%a0)+, (%a1)+ /* 3 */
77 bra.s .bytes_1
78 move.l (%a0)+, (%a1)+ /* 4 */
79 rts
80
81.min5:
82 move.l %a0, %d0
83 and.l #3, %d0
84 jmp.l (2, %pc, %d0.l*2)
85 bra.s .byte1_off0
86 bra.s .byte1_off1
87 bra.s .byte1_off2
88 /* last table entry coincides with target */
89
90.byte1_off3:
91 move.b (%a0)+, (%a1)+
92 subq.l #1, %d1
93 bra.s .byte1_off0
94
95.byte1_off1:
96 move.b (%a0)+, (%a1)+
97 subq.l #1, %d1
98.byte1_off2:
99 move.w (%a0)+, (%a1)+
100 subq.l #2, %d1
101.byte1_off0:
102
103 move.l %d1, %d0
104 cmp.l #16, %d0
105 bhs.b .min16
106
107.longs:
108 lsr.l #2, %d0 /* in longwords */
109 neg.l %d0
110 jmp.l (8, %pc, %d0.l*2)
111
112 move.l (%a0)+, (%a1)+
113 move.l (%a0)+, (%a1)+
114 move.l (%a0)+, (%a1)+
115 move.l (4, %sp), %d0
116 and.l #3, %d1
117 jmp.l (.bytes_grid - 2 - ., %pc, %d1.l*4)
118
119.min16:
120#if 0
121 lea.l (-44, %sp), %sp
122 movem.l %d2-%d7/%a2-%a6, (%sp)
123
124
125.main_do12_start:
126 lea.l (main_do12_loop - ., %pc), %a5
127 movem.l (%a0), %d6-%d7/%a2-%a3
128 bra.b .main_do12_headstore
129
130.main_do8_start:
131 lea.l (main_do8_loop - ., %pc), %a5
132 movem.l (%a0), %d5-%d7/%a2
133 bra.b .main_do8_headstore
134
135.main_do4_start:
136 lea.l (main_do4_loop - ., %pc), %a5
137 movem.l (%a0), %d4-%d7
138/* .main_do4_headstore: */
139 move.l %d4, (%a1)+
140.main_do8_headstore:
141 move.l %d5, (%a1)+
142.main_do12_headstore:
143 move.l %d6, (%a1)+
144 bra.b .main_bo0_check
145
146.main_do12_loop:
147 move.l %d7, %d3
148 move.l %a2, %d4
149 move.l %a3, %d5
150 movem.l (%a0), %d6-%d7/%a2-%a3
151 bra.b .main_bo0_store
152.main_do8_loop:
153 move.l %d7, %d3
154 move.l %a2, %d4
155 movem.l (%a0), %d5-%d7/%a2
156 bra.b .main_bo0_store
157.main_do4_loop:
158 move.l %d7, %d3
159 movem.l (%a0), %d4-%d7
160 bra.b .main_bo0_store
161.main_do0_loop:
162 movem.l (%a0), %d3-%d6
163.main_bo0_store:
164 lea.l (16, %a0), %a1
165 movem.l %d3-%d6, (%a1)
166 lea.l (16, %a1), %a1
167.main_do0_start:
168.main_bo0_check:
169 sub.l #16, %d1
170 blo.b .main_bo0_tail
171 jmp (%a5)
172
173.main_bo0_tail:
174
175
176
177.main_do13_start:
178 lea.l (main_do13_loop - ., %pc), %a5
179 movem.l (%a0), %d7/%a2-%a4
180 move.l %d7, %d0
181 lsr.l #8, %d0
182 swap %d0
183 move.b %d0, (%a1)+
184 swap %d0
185 move.w %d0, (%a1)+
186 bra.b .main_bo1_check
187
188.main_do9_start:
189 lea.l (main_do9_loop - ., %pc), %a5
190 movem.l (%a0), %d6-%d7/%a2-%a3
191 move.l %d6, %d0
192 lsr.l #8, %d0
193 swap %d0
194 move.b %d0, (%a1)+
195 swap %d0
196 move.w %d0, (%a1)+
197 bra.b .main_do9_headstore
198
199.main_do5_start:
200 lea.l (main_do5_loop - ., %pc), %a5
201 movem.l (%a0), %d5-%d7/%a2
202 move.l %d5, %d0
203 lsr.l #8, %d0
204 swap %d0
205 move.b %d0, (%a1)+
206 swap %d0
207 move.w %d0, (%a1)+
208 bra.b .main_do5_headstore
209
210.main_do1_start:
211 lea.l (main_do1_loop - ., %pc), %a5
212 movem.l (%a0), %d4-%d7
213 move.l %d4, %d0
214 lsr.l #8, %d0
215 swap %d0
216 move.b %d0, (%a1)+
217 swap %d0
218 move.w %d0, (%a1)+
219/* .main_do1_headstore: */
220 lsl.l %d2, %d4
221 move.l %d5, %d0
222 lsr.l #8, %d0
223 or.l %d0, %d4
224 move.l %d4, (%a1)+
225.main_do5_headstore:
226 lsl.l %d2, %d5
227 move.l %d6, %d0
228 lsr.l #8, %d0
229 or.l %d0, %d5
230 move.l %d5, (%a1)+
231.main_do9_headstore:
232 lsl.l %d2, %d6
233 move.l %d7, %d0
234 lsr.l #8, %d0
235 or.l %d0, %d6
236 move.l %d6, (%a1)+
237 bra.b .main_bo1_check
238
239.main_do13_loop:
240 move.l %d7, %d3
241 move.l %a2, %d4
242 move.l %a3, %d5
243 move.l %a4, %d6
244 movem.l (%a0), %d7/%a2-%a4
245 bra.b .main_bo1_store
246.main_do9_loop:
247 move.l %d7, %d3
248 move.l %a2, %d4
249 move.l %a3, %d5
250 movem.l (%a0), %d6-%d7/%a2-%a3
251 bra.b .main_bo1_store
252.main_do5_loop:
253 move.l %d7, %d3
254 move.l %a2, %d4
255 movem.l (%a0), %d5-%d7/%a2
256 bra.b .main_bo1_store
257.main_do1_loop:
258 move.l %d7, %d3
259 movem.l (%a0), %d4-%d7
260.main_bo1_store:
261 lea.l (16, %a0), %a1
262 lsl.l %d2, %d3
263 move.l %d4, %d0
264 lsr.l #8, %d0
265 or.l %d0, %d3
266 lsl.l %d2, %d4
267 move.l %d5, %d0
268 lsr.l #8, %d0
269 or.l %d0, %d4
270 lsl.l %d2, %d5
271 move.l %d6, %d0
272 lsr.l #8, %d0
273 or.l %d0, %d5
274 lsl.l %d2, %d6
275 move.l %d7, %d0
276 lsr.l #8, %d0
277 or.l %d0, %d6
278 movem.l %d3-%d6,(%a1)
279 lea.l (16, %a1), %a1
280.main_bo1_check:
281 sub.l #16, %d1
282 blo.b .main_bo1_tail
283 jmp (%a5)
284
285
286.main_do14_start:
287 lea.l (main_do14_loop - ., %pc), %a5
288 movem.l (%a0), %d7/%a2-%a4
289 swap %d7
290 move.w %d7, (%a1)+
291 bra.b .main_bo2_check
292
293.main_do10_start:
294 lea.l (main_do10_loop - ., %pc), %a5
295 movem.l (%a0), %d6-%d7/%a2-%a3
296 swap %d6
297 move.w %d6, (%a1)+
298 bra.b .main_do10_headstore
299
300.main_do6_start:
301 lea.l (main_do6_loop - ., %pc), %a5
302 movem.l (%a0), %d5-%d7/%a2
303 swap %d5
304 move.w %d5, (%a1)+
305 bra.b .main_do6_headstore
306
307.main_do2_start:
308 lea.l (main_do2_loop - ., %pc), %a5
309 movem.l (%a0), %d4-%d7
310 swap %d4
311 move.w %d4, (%a1)+
312/* .main_do2_headstore: */
313 swap %d5
314 move.w %d5, %d4
315 move.l %d4, (%a1)+
316.main_do6_headstore:
317 swap %d6
318 move.w %d6, %d5
319 move.l %d5, (%a1)+
320.main_do10_headstore:
321 swap %d7
322 move.w %d7, %d6
323 move.l %d6, (%a1)+
324 bra.b .main_bo2_check
325
326.main_do14_loop:
327 move.l %d7, %d3
328 move.l %a2, %d4
329 move.l %a3, %d5
330 move.l %a4, %d6
331 movem.l (%a0), %d7/%a2-%a4
332 bra.b .main_bo1_store
333.main_do10_loop:
334 move.l %d7, %d3
335 move.l %a2, %d4
336 move.l %a3, %d5
337 movem.l (%a0), %d6-%d7/%a2-%a3
338 bra.b .main_bo1_store
339.main_do6_loop:
340 move.l %d7, %d3
341 move.l %a2, %d4
342 movem.l (%a0), %d5-%d7/%a2
343 bra.b .main_bo1_store
344.main_do2_loop:
345 move.l %d7, %d3
346 movem.l (%a0), %d4-%d7
347.main_bo2_store:
348 lea.l (16, %a0), %a1
349 swap %d4
350 move.w %d4,%d3
351 swap %d5
352 move.w %d5,%d4
353 swap %d6
354 move.w %d6,%d5
355 swap %d7
356 move.w %d7,%d6
357 movem.l %d3-%d6,(%a1)
358 lea.l (16, %a1), %a1
359.main_bo2_check
360 sub.l #16, %d1
361 blo.b .main_bo2_tail
362 jmp (%a5)
363
364
365.main_do15_start:
366 lea.l (main_do15_loop - ., %pc), %a5
367 movem.l (%a0), %d7/%a2-%a4
368 move.l %d7, %d0
369 lsr.l %d2, %d0
370 move.b %d0, (%a1)+
371 bra.b .main_bo3_check
372
373.main_do11_start:
374 lea.l (main_do11_loop - ., %pc), %a5
375 movem.l (%a0), %d6-%d7/%a2-%a3
376 move.l %d6, %d0
377 lsr.l %d2, %d0
378 move.b %d0, (%a1)+
379 bra.b .main_do11_headstore
380
381.main_do7_start:
382 lea.l (main_do7_loop - ., %pc), %a5
383 movem.l (%a0), %d5-%d7/%a2
384 move.l %d5, %d0
385 lsr.l %d2, %d0
386 move.b %d0, (%a1)+
387 bra.b .main_do7_headstore
388
389.main_do3_start:
390 lea.l (main_do3_loop - ., %pc), %a5
391 movem.l (%a0), %d4-%d7
392 move.l %d4, %d0
393 lsr.l %d2, %d0
394 move.b %d0, (%a1)+
395/* .main_do3_headstore: */
396 lsl.l #8, %d4
397 move.l %d5, %d0
398 lsr.l %d2, %d0
399 or.l %d0, %d4
400 move.l %d4, (%a1)+
401.main_do7_headstore:
402 lsl.l #8, %d5
403 move.l %d6, %d0
404 lsr.l %d2, %d0
405 or.l %d0, %d5
406 move.l %d5, (%a1)+
407.main_do11_headstore:
408 lsl.l #8, %d6
409 move.l %d7, %d0
410 lsr.l %d2, %d0
411 or.l %d0, %d6
412 move.l %d6, (%a1)+
413 bra.b .main_bo3_check
414
415.main_do15_loop:
416 move.l %d7, %d3
417 move.l %a2, %d4
418 move.l %a3, %d5
419 move.l %a4, %d6
420 movem.l (%a0), %d7/%a2-%a4
421 bra.b .main_bo1_store
422.main_do11_loop:
423 move.l %d7, %d3
424 move.l %a2, %d4
425 move.l %a3, %d5
426 movem.l (%a0), %d6-%d7/%a2-%a3
427 bra.b .main_bo1_store
428.main_do7_loop:
429 move.l %d7, %d3
430 move.l %a2, %d4
431 movem.l (%a0), %d5-%d7/%a2
432 bra.b .main_bo1_store
433.main_do3_loop:
434 move.l %d7, %d3
435 movem.l (%a0), %d4-%d7
436.main_bo3_store:
437 lea.l (16, %a0), %a1
438 lsl.l #8, %d3
439 move.l %d4, %d0
440 lsr.l %d2, %d0
441 or.l %d0, %d3
442 lsl.l #8, %d4
443 move.l %d5, %d0
444 lsr.l %d2, %d0
445 or.l %d0, %d4
446 lsl.l #8, %d5
447 move.l %d6, %d0
448 lsr.l %d2, %d0
449 or.l %d0, %d5
450 lsl.l #8, %d6
451 move.l %d7, %d0
452 lsr.l %d2, %d0
453 or.l %d0, %d6
454 movem.l %d3-%d6,(%a1)
455 lea.l (16, %a1), %a1
456.main_bo3_check:
457 sub.l #16, %d1
458 blo.b .main_bo3_tail
459 jmp (%a5)
460
461
462
463 movem.l (%sp), %d2-%d7/%a2-%a6
464 lea.l (44, %sp), %sp
465#else
466 lea.l (-16, %sp), %sp
467 movem.l %d2-%d5, (%sp)
468 sub.l #16, %d1
469
470.main_loop:
471 movem.l (%a0), %d2-%d5
472 lea.l (16, %a0), %a0
473 movem.l %d2-%d5, (%a1)
474 lea.l (16, %a1), %a1
475 sub.l #16, %d1
476 bhs.b .main_loop
477
478 add.l #16, %d1
479 movem.l (%sp), %d2-%d5
480 lea.l (16, %sp), %sp
481#endif
482
483 move.l %d1, %d0
484 bra.s .longs
485
486#else /* CODE TEST */
487
60 add.l %a0,%d1 /* %d1 = source end */ 488 add.l %a0,%d1 /* %d1 = source end */
61 489
62 move.l %a0,%d0 490 move.l %a0,%d0
@@ -675,6 +1103,8 @@ __memcpy_fwd_entry:
675.bytes2_end: 1103.bytes2_end:
676 move.l (4,%sp),%d0 /* return destination */ 1104 move.l (4,%sp),%d0 /* return destination */
677 rts 1105 rts
1106
1107#endif /* CODE TEST */
678 1108
679.end: 1109.end:
680 .size memcpy,.end-memcpy 1110 .size memcpy,.end-memcpy