summaryrefslogtreecommitdiff
path: root/apps/plugins/fractals
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/fractals')
-rw-r--r--apps/plugins/fractals/cpu_sh7043.h96
-rw-r--r--apps/plugins/fractals/fractal.h28
-rw-r--r--apps/plugins/fractals/mandelbrot_set.h9
3 files changed, 3 insertions, 130 deletions
diff --git a/apps/plugins/fractals/cpu_sh7043.h b/apps/plugins/fractals/cpu_sh7043.h
deleted file mode 100644
index 0d773432a8..0000000000
--- a/apps/plugins/fractals/cpu_sh7043.h
+++ /dev/null
@@ -1,96 +0,0 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2009 Tomer Shalev
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#ifndef _CPU_SH7043_H
23#define _CPU_SH7043_H
24
25inline static short muls16_asr10(short a, short b)
26{
27 short r;
28 asm (
29 "muls %[a],%[b] \n"
30 "sts macl,%[r] \n"
31 "shlr8 %[r] \n"
32 "shlr2 %[r] \n"
33 : /* outputs */
34 [r]"=r"(r)
35 : /* inputs */
36 [a]"r"(a),
37 [b]"r"(b)
38 );
39 return r;
40}
41
42inline static long muls32_asr26(long a, long b)
43{
44 long r, t1, t2, t3;
45 asm (
46 /* Signed 32bit * 32bit -> 64bit multiplication.
47 Notation: xxab * xxcd, where each letter represents 16 bits.
48 xx is the 64 bit sign extension. */
49 "swap.w %[a],%[t1] \n" /* t1 = ba */
50 "mulu %[t1],%[b] \n" /* a * d */
51 "swap.w %[b],%[t3] \n" /* t3 = dc */
52 "sts macl,%[t2] \n" /* t2 = a * d */
53 "mulu %[t1],%[t3] \n" /* a * c */
54 "sts macl,%[r] \n" /* hi = a * c */
55 "mulu %[a],%[t3] \n" /* b * c */
56 "clrt \n"
57 "sts macl,%[t3] \n" /* t3 = b * c */
58 "addc %[t2],%[t3] \n" /* t3 += t2, carry -> t2 */
59 "movt %[t2] \n"
60 "mulu %[a],%[b] \n" /* b * d */
61 "mov %[t3],%[t1] \n" /* t1t3 = t2t3 << 16 */
62 "xtrct %[t2],%[t1] \n"
63 "shll16 %[t3] \n"
64 "sts macl,%[t2] \n" /* lo = b * d */
65 "clrt \n" /* hi.lo += t1t3 */
66 "addc %[t3],%[t2] \n"
67 "addc %[t1],%[r] \n"
68 "cmp/pz %[a] \n" /* ab >= 0 ? */
69 "bt 1f \n"
70 "sub %[b],%[r] \n" /* no: hi -= cd (sign extension of ab is -1) */
71 "1: \n"
72 "cmp/pz %[b] \n" /* cd >= 0 ? */
73 "bt 2f \n"
74 "sub %[a],%[r] \n" /* no: hi -= ab (sign extension of cd is -1) */
75 "2: \n"
76 /* Shift right by 26 and return low 32 bits */
77 "shll2 %[r] \n" /* hi <<= 6 */
78 "shll2 %[r] \n"
79 "shll2 %[r] \n"
80 "shlr16 %[t2] \n" /* (unsigned)lo >>= 26 */
81 "shlr8 %[t2] \n"
82 "shlr2 %[t2] \n"
83 "or %[t2],%[r] \n" /* combine result */
84 : /* outputs */
85 [r] "=&r"(r),
86 [t1]"=&r"(t1),
87 [t2]"=&r"(t2),
88 [t3]"=&r"(t3)
89 : /* inputs */
90 [a] "r" (a),
91 [b] "r" (b)
92 );
93 return r;
94}
95
96#endif
diff --git a/apps/plugins/fractals/fractal.h b/apps/plugins/fractals/fractal.h
index c7a822c2c6..92a0b87c48 100644
--- a/apps/plugins/fractals/fractal.h
+++ b/apps/plugins/fractals/fractal.h
@@ -22,33 +22,7 @@
22#define _FRACTAL_H 22#define _FRACTAL_H
23 23
24/* variable button definitions */ 24/* variable button definitions */
25#if CONFIG_KEYPAD == RECORDER_PAD 25#if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
26#define FRACTAL_QUIT BUTTON_OFF
27#define FRACTAL_UP BUTTON_UP
28#define FRACTAL_DOWN BUTTON_DOWN
29#define FRACTAL_LEFT BUTTON_LEFT
30#define FRACTAL_RIGHT BUTTON_RIGHT
31#define FRACTAL_ZOOM_IN BUTTON_PLAY
32#define FRACTAL_ZOOM_OUT BUTTON_ON
33#define FRACTAL_PRECISION_INC BUTTON_F2
34#define FRACTAL_PRECISION_DEC BUTTON_F1
35#define FRACTAL_RESET BUTTON_F3
36
37#elif CONFIG_KEYPAD == ONDIO_PAD
38#define FRACTAL_QUIT BUTTON_OFF
39#define FRACTAL_UP BUTTON_UP
40#define FRACTAL_DOWN BUTTON_DOWN
41#define FRACTAL_LEFT BUTTON_LEFT
42#define FRACTAL_RIGHT BUTTON_RIGHT
43#define FRACTAL_ZOOM_IN_PRE BUTTON_MENU
44#define FRACTAL_ZOOM_IN (BUTTON_MENU | BUTTON_REL)
45#define FRACTAL_ZOOM_IN2 (BUTTON_MENU | BUTTON_UP)
46#define FRACTAL_ZOOM_OUT (BUTTON_MENU | BUTTON_DOWN)
47#define FRACTAL_PRECISION_INC (BUTTON_MENU | BUTTON_RIGHT)
48#define FRACTAL_PRECISION_DEC (BUTTON_MENU | BUTTON_LEFT)
49#define FRACTAL_RESET (BUTTON_MENU | BUTTON_OFF)
50
51#elif (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
52 (CONFIG_KEYPAD == IRIVER_H300_PAD) 26 (CONFIG_KEYPAD == IRIVER_H300_PAD)
53#define FRACTAL_QUIT BUTTON_OFF 27#define FRACTAL_QUIT BUTTON_OFF
54#define FRACTAL_UP BUTTON_UP 28#define FRACTAL_UP BUTTON_UP
diff --git a/apps/plugins/fractals/mandelbrot_set.h b/apps/plugins/fractals/mandelbrot_set.h
index 4eeb68461b..2814d24e58 100644
--- a/apps/plugins/fractals/mandelbrot_set.h
+++ b/apps/plugins/fractals/mandelbrot_set.h
@@ -24,18 +24,13 @@
24#include "fractal_sets.h" 24#include "fractal_sets.h"
25 25
26/* CPU stuff */ 26/* CPU stuff */
27#if CONFIG_CPU == SH7034 27#if defined CPU_COLDFIRE
28#include "cpu_sh7043.h"
29#elif defined CPU_COLDFIRE
30#include "cpu_coldfire.h" 28#include "cpu_coldfire.h"
31#elif defined CPU_ARM 29#elif defined CPU_ARM
32#include "cpu_arm.h" 30#include "cpu_arm.h"
33#endif 31#endif
34 32
35#if CONFIG_CPU == SH7034 33#if defined CPU_COLDFIRE
36#define MULS16_ASR10(a, b) muls16_asr10(a, b)
37#define MULS32_ASR26(a, b) muls32_asr26(a, b)
38#elif defined CPU_COLDFIRE
39/* Needs the EMAC initialised to fractional mode w/o rounding and saturation */ 34/* Needs the EMAC initialised to fractional mode w/o rounding and saturation */
40#define MULS32_INIT() coldfire_set_macsr(EMAC_FRACTIONAL) 35#define MULS32_INIT() coldfire_set_macsr(EMAC_FRACTIONAL)
41#define MULS16_ASR10(a, b) muls16_asr10(a, b) 36#define MULS16_ASR10(a, b) muls16_asr10(a, b)