This commit is defining new include/cache.h file, which defines macro needed for cache aligned buffers. ALLOC_CACHE_ALIGN_BUFFER shall be used in functions, which are using stack allocated buffers for DMA transfers.
Signed-off-by: Lukasz Majewski <l.majew...@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.p...@samsung.com> CC: Albert ARIBAUD <albert.u.b...@aribaud.net> --- include/cache.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 42 insertions(+), 0 deletions(-) create mode 100644 include/cache.h diff --git a/include/cache.h b/include/cache.h new file mode 100644 index 0000000..d06a0ac --- /dev/null +++ b/include/cache.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2011 Samsung Electronics + * Ćukasz Majewski <l.majew...@samsung.com> + * + * Configuation settings for the SAMSUNG Universal (s5pc100) board. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#ifndef __GENERIC_CACHE_H_ +#define __GENERIC_CACHE_H_ + +#if defined(CONFIG_SYS_CACHELINE_SIZE) && !defined(CONFIG_SYS_DCACHE_OFF) +#define ALIGN_ADDR(addr) ((void *)(((unsigned long) addr + \ + CONFIG_SYS_CACHELINE_SIZE - 1) \ + & ~(CONFIG_SYS_CACHELINE_SIZE - 1))) + +#define ALLOC_CACHE_ALIGN_BUFFER(type, name, size) \ + char *__##name[size + CONFIG_SYS_CACHELINE_SIZE]; \ + type *name = ALIGN_ADDR(__##name); +#else +#define ALLOC_CACHE_ALIGN_BUFFER(type, name, size) \ + type name[size]; +#endif + +#endif /* __GENERIC_CACHE_H_ */ -- 1.7.2.3 _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot