diff options
author | Andrew Mahone <andrew.mahone@gmail.com> | 2009-01-13 13:48:26 +0000 |
---|---|---|
committer | Andrew Mahone <andrew.mahone@gmail.com> | 2009-01-13 13:48:26 +0000 |
commit | 2fbf09752d385af861279af195d68f920859202d (patch) | |
tree | 98bf09ebc24217d122b61c2a079337b793c35d9b /firmware/export/system.h | |
parent | c0d9084d6a5182460da0472a4e88d6d078adb86e (diff) | |
download | rockbox-2fbf09752d385af861279af195d68f920859202d.tar.gz rockbox-2fbf09752d385af861279af195d68f920859202d.zip |
remove align_buffer from firmare/general.c, replacing with ALIGN_BUFFER macro, and replace all uses of it (only resize.c in core, and pictureflow and mpegplayer plugins), remove it from plugin_api,
and remove wrapper for it from plugin.h
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19758 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export/system.h')
-rw-r--r-- | firmware/export/system.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/firmware/export/system.h b/firmware/export/system.h index 8ebd30ac4e..cc2a08db2e 100644 --- a/firmware/export/system.h +++ b/firmware/export/system.h | |||
@@ -110,6 +110,17 @@ int get_cpu_boost_counter(void); | |||
110 | #define ALIGN_DOWN(n, a) ((n)/(a)*(a)) | 110 | #define ALIGN_DOWN(n, a) ((n)/(a)*(a)) |
111 | #define ALIGN_UP(n, a) ALIGN_DOWN((n)+((a)-1),a) | 111 | #define ALIGN_UP(n, a) ALIGN_DOWN((n)+((a)-1),a) |
112 | 112 | ||
113 | /* align start and end of buffer to nearest integer multiple of a */ | ||
114 | #define ALIGN_BUFFER(ptr,len,align) \ | ||
115 | {\ | ||
116 | uintptr_t tmp_ptr1 = (uintptr_t)ptr; \ | ||
117 | uintptr_t tmp_ptr2 = tmp_ptr1 + len;\ | ||
118 | tmp_ptr1 = ALIGN_UP(tmp_ptr1,align); \ | ||
119 | tmp_ptr2 = ALIGN_DOWN(tmp_ptr2,align); \ | ||
120 | len = tmp_ptr2 - tmp_ptr1; \ | ||
121 | ptr = (typeof(ptr))tmp_ptr1; \ | ||
122 | } | ||
123 | |||
113 | /* live endianness conversion */ | 124 | /* live endianness conversion */ |
114 | #ifdef ROCKBOX_LITTLE_ENDIAN | 125 | #ifdef ROCKBOX_LITTLE_ENDIAN |
115 | #define letoh16(x) (x) | 126 | #define letoh16(x) (x) |
@@ -275,7 +286,7 @@ static inline uint32_t swap_odd_even32(uint32_t value) | |||
275 | __attribute__((aligned(CACHEALIGN_UP(x)))) | 286 | __attribute__((aligned(CACHEALIGN_UP(x)))) |
276 | /* Aligns a buffer pointer and size to proper boundaries */ | 287 | /* Aligns a buffer pointer and size to proper boundaries */ |
277 | #define CACHEALIGN_BUFFER(start, size) \ | 288 | #define CACHEALIGN_BUFFER(start, size) \ |
278 | ({ align_buffer(PUN_PTR(void **, (start)), (size), CACHEALIGN_SIZE); }) | 289 | ALIGN_BUFFER((start), (size), CACHEALIGN_SIZE) |
279 | 290 | ||
280 | #else /* ndef PROC_NEEDS_CACHEALIGN */ | 291 | #else /* ndef PROC_NEEDS_CACHEALIGN */ |
281 | 292 | ||
@@ -286,8 +297,7 @@ static inline uint32_t swap_odd_even32(uint32_t value) | |||
286 | #define CACHEALIGN_UP(x) (x) | 297 | #define CACHEALIGN_UP(x) (x) |
287 | #define CACHEALIGN_DOWN(x) (x) | 298 | #define CACHEALIGN_DOWN(x) (x) |
288 | /* Make no adjustments */ | 299 | /* Make no adjustments */ |
289 | #define CACHEALIGN_BUFFER(start, size) \ | 300 | #define CACHEALIGN_BUFFER(start, size) |
290 | ({ (void)(start); (size); }) | ||
291 | 301 | ||
292 | #endif /* PROC_NEEDS_CACHEALIGN */ | 302 | #endif /* PROC_NEEDS_CACHEALIGN */ |
293 | 303 | ||