summaryrefslogtreecommitdiff
path: root/firmware/target/sh/system-target.h
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2007-04-11 23:54:34 +0000
committerJens Arnold <amiconn@rockbox.org>2007-04-11 23:54:34 +0000
commit4c151dcb2199caafe0c1fd4d88ab66b6acdf6bd6 (patch)
tree25aedc9971878fe8db82039cca399eaec8bac4e9 /firmware/target/sh/system-target.h
parent8636e6949e802556da1588b814e454155358df90 (diff)
downloadrockbox-4c151dcb2199caafe0c1fd4d88ab66b6acdf6bd6.tar.gz
rockbox-4c151dcb2199caafe0c1fd4d88ab66b6acdf6bd6.zip
Oops, forgot to commit 2 new files...
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13115 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/sh/system-target.h')
-rw-r--r--firmware/target/sh/system-target.h110
1 files changed, 110 insertions, 0 deletions
diff --git a/firmware/target/sh/system-target.h b/firmware/target/sh/system-target.h
new file mode 100644
index 0000000000..50ada65eb6
--- /dev/null
+++ b/firmware/target/sh/system-target.h
@@ -0,0 +1,110 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2007 by Jens Arnold
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 or_b(mask, address) \
23 asm \
24 ("or.b %0,@(r0,gbr)" \
25 : \
26 : /* %0 */ I_CONSTRAINT((char)(mask)), \
27 /* %1 */ "z"(address-GBR))
28
29#define and_b(mask, address) \
30 asm \
31 ("and.b %0,@(r0,gbr)" \
32 : \
33 : /* %0 */ I_CONSTRAINT((char)(mask)), \
34 /* %1 */ "z"(address-GBR))
35
36#define xor_b(mask, address) \
37 asm \
38 ("xor.b %0,@(r0,gbr)" \
39 : \
40 : /* %0 */ I_CONSTRAINT((char)(mask)), \
41 /* %1 */ "z"(address-GBR))
42
43
44/****************************************************************************
45 * Interrupt level setting
46 * The level is left shifted 4 bits
47 ****************************************************************************/
48#define HIGHEST_IRQ_LEVEL (15<<4)
49
50static inline int set_irq_level(int level)
51{
52 int i;
53 /* Read the old level and set the new one */
54 asm volatile ("stc sr, %0" : "=r" (i));
55 asm volatile ("ldc %0, sr" : : "r" (level));
56 return i;
57}
58
59static inline uint16_t swap16(uint16_t value)
60 /*
61 result[15..8] = value[ 7..0];
62 result[ 7..0] = value[15..8];
63 */
64{
65 uint16_t result;
66 asm volatile ("swap.b\t%1,%0" : "=r"(result) : "r"(value));
67 return result;
68}
69
70static inline uint32_t SWAW32(uint32_t value)
71 /*
72 result[31..16] = value[15.. 0];
73 result[15.. 0] = value[31..16];
74 */
75{
76 uint32_t result;
77 asm volatile ("swap.w\t%1,%0" : "=r"(result) : "r"(value));
78 return result;
79}
80
81static inline uint32_t swap32(uint32_t value)
82 /*
83 result[31..24] = value[ 7.. 0];
84 result[23..16] = value[15.. 8];
85 result[15.. 8] = value[23..16];
86 result[ 7.. 0] = value[31..24];
87 */
88{
89 asm volatile ("swap.b\t%0,%0\n"
90 "swap.w\t%0,%0\n"
91 "swap.b\t%0,%0\n" : "+r"(value));
92 return value;
93}
94
95static inline uint32_t swap_odd_even32(uint32_t value)
96{
97 /*
98 result[31..24],[15.. 8] = value[23..16],[ 7.. 0]
99 result[23..16],[ 7.. 0] = value[31..24],[15.. 8]
100 */
101 asm volatile ("swap.b\t%0,%0\n"
102 "swap.w\t%0,%0\n"
103 "swap.b\t%0,%0\n"
104 "swap.w\t%0,%0\n" : "+r"(value));
105 return value;
106}
107
108#define invalidate_icache()
109
110#endif /* SYSTEM_TARGET_H */