This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: HAL_DCACHE_xxx macros in mpc8xx HAL


On Wed, 2002-12-11 at 07:10, Christoph Csebits wrote:
> On Wed, Dec 11, 2002 at 06:52:43AM -0700, Gary Thomas wrote:
> > By all means, recommend any changes you'd like.  At least it
> > will give us "food for thought"
> 
> Ok, i show you what i have done for me.
> 

This seems reasonable to me, although I would prefer the style of
the macro we have:
  * The computations of "base_addr", etc, are explicit (not in the for)
  * Use names which start with "_" to lessen namespace pollution.

Can you make these [small] changes and then propose a proper patch?
Please use "diff -u" when making patches.  I normally put this into
my ~/.cvsrc:
	diff -u5 -p -N

Please send it to ecos-patches@sources.redhat.com

> current macro:
> 
> #define HAL_DCACHE_FLUSH( _base_ , _size_ )                     \
>     CYG_MACRO_START                                             \
>     cyg_uint32 __base = (cyg_uint32) (_base_);                  \
>     cyg_int32 __size = (cyg_int32) (_size_);                    \
>     while (__size > 0) {                                        \
>         asm volatile ("dcbf 0,%0;sync;" : : "r" (__base));      \
>         __base += HAL_DCACHE_LINE_SIZE;                         \
>         __size -= HAL_DCACHE_LINE_SIZE;                         \
>     }                                                           \
>     CYG_MACRO_END
> 
> 
> ok, here is are version which is align independent:
> 
> #define HAL_DCACHE_FLUSH( _base_ , _size_ )                             \
>     CYG_MACRO_START                                                     \
>     register int base_addr, end_addr;                                   \
>     for ( base_addr = (~(HAL_DCACHE_LINE_SIZE - 1)) & (int)(_base_),    \
>               end_addr = (int)(_base_) + (_size_);                      \
>           base_addr < end_addr;                                         \
>           base_addr += HAL_DCACHE_LINE_SIZE )                           \
>     {                                                                   \
>         asm volatile ("dcbf 0,%0;sync;" : : "r" (__base));              \
>     }                                                                   \
>     CYG_MACRO_END
> 
> 
> -- 
> 
> 
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> The information contained in this e-mail and its attachments is confidential 
> and may be privileged or protected from disclosure.If you are not the intended 
> recipient or have received it in error,please notify the sender and delete it 
> without delay. Any unauthorized copy, disclosure, distribution or use in any 
> way of the information contained in it or its attachments is strictly
> prohibited. Completeness of the message can not be ensured as it has been 
> transmitted over public networks.
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> 
> 
> -- 
> Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
> and search the list archive: http://sources.redhat.com/ml/ecos-discuss
-- 
------------------------------------------------------------
Gary Thomas                       |
eCosCentric, Ltd.                 |  
+1 (970) 229-1963                 |  eCos & RedBoot experts
http://www.ecoscentric.com/       |
email: <gthomas@ecoscentric.com>  |
gpg: http://www.chez-thomas.org/gary/gpg_key.asc
------------------------------------------------------------


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]