From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mike Frysinger Date: Wed, 24 Aug 2011 12:16:55 -0400 Subject: [U-Boot] [PATCH] mmc:dcache: Cache line size aligned internal MMC buffers In-Reply-To: References: <1313745913-28672-1-git-send-email-l.majewski@samsung.com> <201108231732.39791.vapier@gentoo.org> Message-ID: <201108241216.57413.vapier@gentoo.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Tuesday, August 23, 2011 17:48:50 Anton Staaf wrote: > I wasn't going to say it. :) How about something like this, which is > very similar to what you had Mike, but doesn't define the array in the > macro. It's a bit clearer what is going on, but also requires a bit > more work at each use. > > #define DCACHE_RESIZE(size) ((size) + get_dcache_line_size() - 1) > #define DCACHE_ALIGN(buffer) ((buffer) + get_dcache_line_size() - 1) & > ~(get_dcache_line_size() - 1) > > char buffer[DCACHE_RESIZE(100)]; as long as people always use a byte-sized type (i.e. char), this should work. obviously using "u32 buffer[...]" will be bad. > It would be awesome if the idea below worked, but it can't because the > array is popped when the ({...}) scope is exited I believe. yes, i believe you are correct. -mike -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 836 bytes Desc: This is a digitally signed message part. Url : http://lists.denx.de/pipermail/u-boot/attachments/20110824/a5eba50c/attachment.pgp