diff options
author | Jens Arnold <amiconn@rockbox.org> | 2007-08-01 18:57:48 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2007-08-01 18:57:48 +0000 |
commit | 39357e9235aba8527aab5edf6aaf5cbfe2891eb0 (patch) | |
tree | 589248b9959c06699162ad4eed5e6ee1c27f48a4 | |
parent | 291c9f8a4e6416c25bf2221d2af722eb523a36f6 (diff) | |
download | rockbox-39357e9235aba8527aab5edf6aaf5cbfe2891eb0.tar.gz rockbox-39357e9235aba8527aab5edf6aaf5cbfe2891eb0.zip |
Atomic mutexes on SH1.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14121 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/export/thread.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/firmware/export/thread.h b/firmware/export/thread.h index 81c7c2374f..2915d23207 100644 --- a/firmware/export/thread.h +++ b/firmware/export/thread.h | |||
@@ -169,6 +169,20 @@ struct core_entry { | |||
169 | ); \ | 169 | ); \ |
170 | old; \ | 170 | old; \ |
171 | }) | 171 | }) |
172 | #elif CONFIG_CPU == SH7034 | ||
173 | #define test_and_set(x_, v_) \ | ||
174 | ({ \ | ||
175 | uint32_t old; \ | ||
176 | asm volatile ( \ | ||
177 | "tas.b @%[x] \r\n" \ | ||
178 | "mov #-1, %[old] \r\n" \ | ||
179 | "negc %[old], %[old] \r\n" \ | ||
180 | : [old]"=r"(old) \ | ||
181 | : [v]"M"((uint32_t)v_), /* Value of v_ must be 1 */ \ | ||
182 | [x]"r"((uint8_t *)x_) \ | ||
183 | ); \ | ||
184 | old; \ | ||
185 | }) | ||
172 | #else | 186 | #else |
173 | /* default for no asm version */ | 187 | /* default for no asm version */ |
174 | #define test_and_set(x_, v_) \ | 188 | #define test_and_set(x_, v_) \ |