• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Digital Signal Processors (DSP) » C6000 Single Core DSP » C67x Single Core DSP Forum » Cache On/Off/Configure 'C' Code API BSL
Share
C6000 Single Core DSP
  • Forums
  • Announcements
Options
  • Subscribe via RSS

Cache On/Off/Configure 'C' Code API BSL

Cache On/Off/Configure 'C' Code API BSL

This question is not answered
Chris Nielsen (formerly OctalRules)
Posted by Chris Nielsen (formerly OctalRules)
on Mar 26 2012 11:15 AM
Intellectual485 points

I needed one of the above a few weeks ago and hunted these forums and the downloads and could never find one.  It appears it is no longer part of the BSL.

I wrote one and am giving it to the community so no one else needs to reinvent the wheel.  I didn't see an attachment mechanism so I pasted the code in place below.  This blog editor mangled it pretty badly and I had to do manual patchup, so if it doesn't compile, it is likely 1-2 chars of typos.

TI, you can do better.  As you can see, this isn't much code, but it does take TIME and TESTING to get a reliable package.  This one is.  I have been using it for several weeks and have turned cahce on/off/sizes and seen the measured code execution time effects.

TI, please consider including something like this in future BSL releases.

Thanks for considering it, Chris

 

Example usage:

      CACHE_Init_L2  ( CACHE_L2MODE_DISABLED ) ; // I am using all of L2 for my fast arrays
      CACHE_Init_L1P ( CACHE_L1MODE_32KB ) ;
      CACHE_Init_L1D ( CACHE_L1MODE_32KB ) ;

 

evmc6748_cache.h: (I followed the naming convention so it even looks like it belongs in the BSL!)

#ifndef EVMC6748_CACHE_H

#define EVMC6748_CACHE_H


typedef enum {

CACHE_L2MODE_DISABLED= 0 ,

CACHE_L2MODE_32KB = 1 ,

CACHE_L2MODE_64KB = 2 ,

CACHE_L2MODE_128KB = 3 ,

CACHE_L2MODE_256KB = 4 , // this is the max available on the 6748 as of March 2012

CACHE_L2MODE_MAX = 7

} Cache_L2mode_t;

typedef enum {
CACHE_L1MODE_DISABLED= 0 ,

CACHE_L1MODE_4KB = 1 ,

CACHE_L1MODE_8KB = 2 ,

CACHE_L1MODE_16KB = 3 ,

CACHE_L1MODE_32KB = 4 , // this is the max available on the 6748 as of March 2012

CACHE_L1MODE_MAX = 7

} Cache_L1mode_t;

#define CACHE_L2CFG ( (volatile uint32_t *) 0x01840000 )

#define CACHE_L1PCFG ( (volatile uint32_t *) 0x01840020 )

#define CACHE_L1DCFG ( (volatileuint32_t *) 0x01840040 )

voidCACHE_Init_L2 ( Cache_L2mode_tL2mode ) ;

extern voidCACHE_Init_L1P ( Cache_L1mode_tL1mode ) ;
extern voidCACHE_Init_L1D (  Cache_L1mode_tL1mode ) ;

#endif

evmc6748_cache.h:

#include <evmc6748.h>

#include <evmc6748_cache.h>

extern voidCACHE_Init_L2 ( Cache_L2mode_tL2mode )

{

*CACHE_L2CFG = L2mode ;

}

extern voidCACHE_Init_L1P ( Cache_L1mode_t L1mode )

{

*CACHE_L1PCFG = L1mode ;

}

extern voidCACHE_Init_L1D ( Cache_L1mode_t L1mode )

{

*CACHE_L1DCFG = L1mode ;

}

<end of code and post>

 

DSP Cache C code software package 'C' API BSL Interface support
Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • Chris Nielsen (formerly OctalRules)
    Posted by Chris Nielsen (formerly OctalRules)
    on Mar 26 2012 11:19 AM
    Intellectual485 points

    And, this really should be able to work for almost any TI DSP, 2, 5, or 6.  You just need to check the datasheet/Tech Ref for the reg values in hex to be changed and the enum choices available for that processor, but this code is a model that should work for all.  At least I think...as Willy Wonka said, a little more testing is needed, Chris

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Brad Griffis
    Posted by Brad Griffis
    on Mar 28 2012 20:55 PM
    Guru57330 points

    Besides enabling the cache you must all set a memory attribute register (MAR) for external memory in order to allow it to be cached.  APIs similar to what you've shown as well as APIs for the MAR bits are part of our DSP/BIOS RTOS, which I strongly suggest using as it is excellent.  DSP/BIOS allows you to configure the cache either through a GUI or through run-time APIs.  More details are available here:

    http://processors.wiki.ti.com/index.php/Enabling_64x%2B_Cache

    ---------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question.
    --------------------------------------------------------------------------------------------------------- 

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use