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, 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.

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


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