123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583 |
- /**
- * @file csl_cacheAux.h
- *
- * @brief
- * This is the CACHE Auxilary Header File which exposes the various
- * CSL Functional Layer API's to configure the CACHE Module.
- *
- * \par
- * ============================================================================
- * @n (C) Copyright 2002, 2003, 2004, 2005, 2008, 2009, 2016 Texas Instruments, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of Texas Instruments Incorporated nor the names of
- * its contributors may be used to endorse or promote products derived
- * from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- */
- #ifndef CSL_CACHEAUX_H
- #define CSL_CACHEAUX_H
- #ifdef __cplusplus
- extern "C" {
- #endif
- #include <ti/csl/csl_cache.h>
- #if !(defined (SOC_OMAPL137) || defined(SOC_OMAPL138))
- #include <ti/csl/csl_xmcAux.h>
- #endif
- /** @addtogroup CSL_CACHE_FUNCTION
- @{ */
- static inline void CACHE_AsmNop (void);/* for misra warnings*/
- static inline void CACHE_AsmNop (void)
- {
- asm (" nop 4");
- asm (" nop 4");
- asm (" nop 4");
- asm (" nop 4");
- }
- /** ============================================================================
- * @n@b CACHE_setMemRegionWritethrough
- *
- * @b Description
- * @n This function sets write through mode for a specific memory region.
- *
- * @b Arguments
- @verbatim
- mar Memory region for which cache is to be set to writethrough mode.
- arg TRUE to set to write through mode, otherwise to wribeback mode.
- @endverbatim
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n None
- *
- * <b> Post Condition </b>
- * @n Memory region is now set to writethrough mode.
- *
- * @b Writes
- * @n CGEM_MAR0_WTE=1, when arg == TRUE, zero otherwise
- *
- * @b Example
- * @verbatim
- CACHE_setMemRegionWritethrough (20, TRUE);
- @endverbatim
- * =============================================================================
- */
- /*for Misra warnings */
- static inline void CACHE_setMemRegionWritethrough (Uint8 mar, Bool arg);/* for misra warnings*/
- static inline void CACHE_setMemRegionWritethrough (Uint8 mar, Bool arg)
- {
- uint32_t temp = 0;
- CSL_FINS(temp, CGEM_MAR0_WTE, (uint32_t)1U);
-
- if (arg == (Bool)TRUE)
- {
- hCache->MAR[mar] |= temp;
- }
- else
- {
- hCache->MAR[mar] &= ~temp;
- }
- }
- /** ============================================================================
- * @n@b CACHE_getMemRegionWritethrough
- *
- * @b Description
- * @n This function gets write through mode for a specific memory region.
- *
- * @b Arguments
- @verbatim
- mar Memory region for which WTE bit information to be read.
- wte Address of WTE value
- @endverbatim
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n None
- *
- * <b> Post Condition </b>
- * @n WTE bit value reflecting the write through mode is returned.
- *
- * @b Writes
- * @n None
- *
- * @b Example
- * @verbatim
- CACHE_getMemRegionWritethrough (20, &wte);
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_getMemRegionWritethrough (Uint8 mar, Uint8 *wte);/* for misra warnings*/
- static inline void CACHE_getMemRegionWritethrough (Uint8 mar, Uint8 *wte)
- {
- Uint32 value = hCache->MAR[mar];
- *wte = (Uint8)CSL_FEXT (value, CGEM_MAR0_WTE);
- }
- /** ============================================================================
- * @n@b CACHE_enableCaching
- *
- * @b Description
- * @n This function enables caching for a specific memory region.
- *
- * @b Arguments
- @verbatim
- mar Memory region for which cache is to be enabled.
- @endverbatim
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n None
- *
- * <b> Post Condition </b>
- * @n Memory region is now cacheable.
- *
- * @b Writes
- * @n CGEM_MAR0_PC=1
- *
- * @b Example
- * @verbatim
- CACHE_enableCaching (20);
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_enableCaching (Uint8 mar);/* for misra warnings*/
- static inline void CACHE_enableCaching (Uint8 mar)
- {
- CSL_FINS(hCache->MAR[mar], CGEM_MAR0_PC, (uint32_t)1U);
- }
- /** ============================================================================
- * @n@b CACHE_disableCaching
- *
- * @b Description
- * @n This function disables caching for a specific memory region.
- *
- * @b Arguments
- @verbatim
- mar Memory region for which cache is to be disabled.
- @endverbatim
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n None
- *
- * <b> Post Condition </b>
- * @n Memory region is now *not* cacheable.
- *
- * @b Writes
- * @n CGEM_MAR0_PC=0
- *
- * @b Example
- * @verbatim
- CACHE_disableCaching (20);
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_disableCaching (Uint8 mar);/* for misra warnings*/
- static inline void CACHE_disableCaching (Uint8 mar)
- {
- CSL_FINS(hCache->MAR[mar], CGEM_MAR0_PC, (uint32_t)0);
- }
- /** ============================================================================
- * @n@b CACHE_getMemRegionInfo
- *
- * @b Description
- * @n This function is used to get memory region information.
- *
- * @b Arguments
- @verbatim
- mar Memory region for which the information is required.
- pcx Is address cacheable in external cache (MSMC)
- pfx Is address prefetchable
- @endverbatim
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n None
- *
- * <b> Post Condition </b>
- * @n None
- *
- * @b Reads
- * @n CGEM_MAR0_PCX, CGEM_MAR0_PFX
- *
- * @b Example
- * @verbatim
-
- Uint8 pcx;
- Uint8 pfx;
- // Get the memory region information for 20
- CACHE_getMemRegionInfo (20, &pcx, &pfx);
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_getMemRegionInfo (Uint8 mar, Uint8* pcx, Uint8* pfx);/* for misra warnings*/
- static inline void CACHE_getMemRegionInfo (Uint8 mar, Uint8* pcx, Uint8* pfx)
- {
- Uint32 value = hCache->MAR[mar];
- *pcx = (Uint8)CSL_FEXT (value, CGEM_MAR0_PCX);
- *pfx = (Uint8)CSL_FEXT (value, CGEM_MAR0_PFX);
- }
- /** ============================================================================
- * @n@b CACHE_setMemRegionInfo
- *
- * @b Description
- * @n This function is used to set memory region information.
- *
- * @b Arguments
- @verbatim
- mar Memory region for which the information is required.
- pcx Is address cacheable in external cache (MSMC)
- pfx Is address prefetchable
- @endverbatim
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n None
- *
- * <b> Post Condition </b>
- * @n None
- *
- * @b Writes
- * @n CGEM_MAR0_PCX, CGEM_MAR0_PFX
- *
- * @b Example
- * @verbatim
-
- Uint8 pcx;
- Uint8 pfx;
- // Get the memory region information for 20
- CACHE_getMemRegionInfo (20, &pcx, &pfx);
- ...
- // Ensure Memory Region 20 is not prefetchable.
- CACHE_setMemRegionInfo(20, pcx, 0);
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_setMemRegionInfo (Uint8 mar, Uint8 pcx, Uint8 pfx);/* for misra warnings*/
- static inline void CACHE_setMemRegionInfo (Uint8 mar, Uint8 pcx, Uint8 pfx)
- {
- CSL_FINS (hCache->MAR[mar], CGEM_MAR0_PCX, (Uint32)pcx);
- CSL_FINS (hCache->MAR[mar], CGEM_MAR0_PFX, (Uint32)pfx);
- }
- /** ============================================================================
- * @n@b CACHE_setL1DSize
- *
- * @b Description
- * @n This function is used to set the L1 Data Cache Size.
- *
- * @b Arguments
- @verbatim
- newSize Cache Size to be configured.
- @endverbatim
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n None
- *
- * <b> Post Condition </b>
- * @n None
- *
- * @b Writes
- * @n CGEM_L1DCFG_L1DMODE
- *
- * @b Example
- * @verbatim
-
- CACHE_setL1DSize(1); // Configure 4K Cache Size
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_setL1DSize (CACHE_L1Size newSize);/* for misra warnings*/
- static inline CACHE_L1Size CACHE_getL1DSize (void);/* for misra warnings*/
- static inline void CACHE_setL1DSize (CACHE_L1Size newSize)
- {
- CSL_FINS (hCache->L1DCFG, CGEM_L1DCFG_L1DMODE, newSize);
- /* Read back L1DCFG. This stalls the DSP until the mode change completes */
- CACHE_getL1DSize();
- }
- /** ============================================================================
- * @n@b CACHE_getL1DSize
- *
- * @b Description
- * @n This function is used to get the L1 Data Cache Size.
- *
- * @b Arguments
- * @n None
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n None
- *
- * <b> Post Condition </b>
- * @n None
- *
- * @b Reads
- * @n CGEM_L1DCFG_L1DMODE
- *
- * @b Example
- * @verbatim
- CACHE_L1Size cacheSize;
-
- cacheSize = CACHE_getL1DSize();
- @endverbatim
- * =============================================================================
- */
- static inline CACHE_L1Size CACHE_getL1DSize (void)
- {
- return (CACHE_L1Size)CSL_FEXT (hCache->L1DCFG, CGEM_L1DCFG_L1DMODE);
- }
- /** ============================================================================
- * @n@b CACHE_freezeL1D
- *
- * @b Description
- * @n This function is used to freeze the L1D cache.
- *
- * @b Arguments
- * @n None
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n None
- *
- * <b> Post Condition </b>
- * @n None
- *
- * @b Writes
- * @n CGEM_L1DCC_OPER=1
- *
- * @b Example
- * @verbatim
-
- CACHE_freezeL1D();
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_freezeL1D(void);/* for misra warnings*/
- static inline void CACHE_freezeL1D(void)
- {
- /* Set the Freeze Mode Enabled bit. */
- CSL_FINS (hCache->L1DCC, CGEM_L1DCC_OPER, (uint32_t)1U);
- }
- /** ============================================================================
- * @n@b CACHE_unfreezeL1D
- *
- * @b Description
- * @n This function is used to unfreeze the L1D cache.
- *
- * @b Arguments
- * @n None
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n None
- *
- * <b> Post Condition </b>
- * @n None
- *
- * @b Writes
- * @n CGEM_L1DCC_OPER=0
- *
- * @b Example
- * @verbatim
-
- CACHE_unfreezeL1D();
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_unfreezeL1D(void);/* for misra warnings*/
- static inline void CACHE_unfreezeL1D(void)
- {
- /* Reset the Freeze Mode Enabled bit. */
- CSL_FINS (hCache->L1DCC, CGEM_L1DCC_OPER, (uint32_t)0);
- }
- /** ============================================================================
- * @n@b CACHE_getPrevL1DMode
- *
- * @b Description
- * @n This function is used get the previous operating state of the L1D cache
- *
- * @b Arguments
- * @n None
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n None
- *
- * <b> Post Condition </b>
- * @n None
- *
- * @b Reads
- * @n CGEM_L1DCC_POPER
- *
- * @b Example
- * @verbatim
- Uint32 prev;
-
- prev = CACHE_getPrevL1DMode();
- @endverbatim
- * =============================================================================
- */
- static inline Uint32 CACHE_getPrevL1DMode(void);/* for misra warnings*/
- static inline Uint32 CACHE_getPrevL1DMode(void)
- {
- return CSL_FEXT (hCache->L1DCC, CGEM_L1DCC_POPER);
- }
- /** ============================================================================
- * @n@b CACHE_invAllL1dWait
- *
- * @b Description
- * @n This function is used to wait for the L1D global invalidate operation
- * to complete. This API should be used only if the CACHE_invAllL1d was called
- * with the CACHE_NOWAIT argument.
- *
- * @b Arguments
- * @n None
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n @a CACHE_invAllL1d(wait=CACHE_NOWAIT) must be called.
- *
- * <b> Post Condition </b>
- * @n None
- *
- * @b Reads
- * @n CGEM_L1DINV_I=0
- *
- * @b Example
- * @verbatim
-
- CACHE_invAllL1d(CACHE_NOWAIT); // Invalidate the L1D cache
- ...
- CACHE_invAllL1dWait(); // Wait for the invalidate operation to complete.
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_invAllL1dWait (void);/* for misra warnings*/
- static inline void CACHE_invAllL1dWait (void)
- {
- /* Wait for the Invalidate operation to complete. */
- while (CSL_FEXT(hCache->L1DINV, CGEM_L1DINV_I) == (Uint32)1U) {}
- }
- /** ============================================================================
- * @n@b CACHE_invAllL1d
- *
- * @b Description
- * @n This function is used to globally invalidate the L1D cache.
- *
- * @b Arguments
- @verbatim
- wait Indicates if the call should block or not.
- @endverbatim
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n None
- *
- * <b> Post Condition </b>
- * @n The L1D Cache is being invalidated.
- *
- * @b Writes
- * @n CGEM_L1DINV_I=1
- *
- * @b Example
- * @verbatim
-
- CACHE_invAllL1d(CACHE_WAIT); // Invalidate the L1D cache
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_invAllL1d (CACHE_Wait wait);/* for misra warnings*/
- static inline void CACHE_invAllL1d (CACHE_Wait wait)
- {
- uint32_t gie, advisory6;
- if ( (wait == CACHE_WAIT ) ||
- (wait == CACHE_FENCE_WAIT) )
- {
- advisory6 = (uint32_t)1U;
- }
- else
- {
- advisory6 = 0;
- }
-
- if ( advisory6 )
- {
- /* disable the interrupts */
- gie = _disable_interrupts ();
- #if !(defined (SOC_OMAPL137) || defined(SOC_OMAPL138))
- CSL_XMC_invalidatePrefetchBuffer();
- #endif
- }
-
- /* Invalidate the Cache Line. */
- CSL_FINS (hCache->L1DINV, CGEM_L1DINV_I, (uint32_t)1U);
-
- /* Determine if we need to wait for the operation to complete. */
- if (wait)
- {
- CACHE_invAllL1dWait();
- }
-
- if (advisory6)
- {
- CACHE_AsmNop();
- _restore_interrupts (gie);
- }
- }
- /** ============================================================================
- * @n@b CACHE_wbAllL1dWait
- *
- * @b Description
- * @n This function is used to wait for the L1D writeback operation
- * to complete. This API should be used only if the CACHE_wbAllL1d was called
- * with the CACHE_NOWAIT argument.
- *
- * @b Arguments
- * @n None
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n @a CACHE_wbAllL1d(wait=CACHE_NOWAIT) must be called.
- *
- * <b> Post Condition </b>
- * @n The L1D Dirty lines are written back
- *
- * @b Reads
- * @n CGEM_L1DWB_C=0
- *
- * @b Example
- * @verbatim
-
- CACHE_wbAllL1d(CACHE_NOWAIT); // Writeback the L1D cache
- ...
- CACHE_wbAllL1dWait(); // Wait for the writeback operation to complete.
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_wbAllL1dWait (void);/* for misra warnings*/
- static inline void CACHE_wbAllL1dWait (void)
- {
- /* Wait for the Writeback operation to complete. */
- while (CSL_FEXT(hCache->L1DWB, CGEM_L1DWB_C) == (uint32_t)1U) {}
- }
- /** ============================================================================
- * @n@b CACHE_wbAllL1d
- *
- * @b Description
- * @n This function is used to writeback the dirty lines of the L1D Cache
- *
- * @b Arguments
- @verbatim
- wait Indicates if the call should block or not.
- @endverbatim
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n None
- *
- * <b> Post Condition </b>
- * @n The dirty lines of the L1D Cache are being written back
- *
- * @b Writes
- * @n CGEM_L1DWB_C=1
- *
- * @b Example
- * @verbatim
-
- CACHE_wbAllL1d(CACHE_WAIT); // Writeback the Dirty Lines of the L1D cache
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_wbAllL1d (CACHE_Wait wait);/* for misra warnings*/
- static inline void CACHE_wbAllL1d (CACHE_Wait wait)
- {
- uint32_t gie, advisory6;
-
- if ( (wait == CACHE_WAIT ) ||
- (wait == CACHE_FENCE_WAIT) )
- {
- advisory6 = (uint32_t)1U;
- }
- else
- {
- advisory6 = 0;
- }
-
- if ( advisory6 )
- {
- /* disable the interrupts */
- gie = _disable_interrupts ();
- }
- /* Writeback the Cache Line. */
- CSL_FINS (hCache->L1DWB, CGEM_L1DWB_C, (uint32_t)1U);
-
- /* Determine if we need to wait for the operation to complete. */
- if (wait)
- {
- CACHE_wbAllL1dWait();
- }
- if (advisory6)
- {
- CACHE_AsmNop();
- _restore_interrupts (gie);
- }
- }
- /** ============================================================================
- * @n@b CACHE_wbInvAllL1dWait
- *
- * @b Description
- * @n This function is used to wait for the L1D writeback invalidate operation
- * to complete. This API should be used only if the CACHE_wbInvAllL1d was called
- * with the CACHE_NOWAIT argument.
- *
- * @b Arguments
- * @n None
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n @a CACHE_wbInvAllL1d(wait=CACHE_NOWAIT) must be called.
- *
- * <b> Post Condition </b>
- * @n The L1D Dirty lines are written back
- *
- * @b Reads
- * @n CGEM_L1DWBINV_C=0
- *
- * @b Example
- * @verbatim
-
- CACHE_wbInvAllL1d(CACHE_NOWAIT); // Invalidate/Writeback the L1D cache
- ...
- CACHE_wbInvAllL1dWait(); // Wait for the Invalidate/Writeback operation to complete.
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_wbInvAllL1dWait (void);/* for misra warnings*/
- static inline void CACHE_wbInvAllL1dWait (void)
- {
- /* Wait for the Invalidate Writeback operation to complete. */
- while (CSL_FEXT(hCache->L1DWBINV, CGEM_L1DWBINV_C) == (uint32_t)1U) {}
- }
- /** ============================================================================
- * @n@b CACHE_wbInvAllL1d
- *
- * @b Description
- * @n This function is used to invalidate and writeback the dirty lines of the
- * L1D Cache
- *
- * @b Arguments
- @verbatim
- wait Indicates if the call should block or not.
- @endverbatim
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n None
- *
- * <b> Post Condition </b>
- * @n Invalidates and Writebacks the dirty lines of the L1D Cache
- *
- * @b Writes
- * @n CGEM_L1DWBINV_C=1
- *
- * @b Example
- * @verbatim
-
- CACHE_wbInvAllL1d(CACHE_WAIT);
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_wbInvAllL1d (CACHE_Wait wait);/* for misra warnings*/
- static inline void CACHE_wbInvAllL1d (CACHE_Wait wait)
- {
- uint32_t gie, advisory6;
-
- if ( (wait == CACHE_WAIT ) ||
- (wait == CACHE_FENCE_WAIT) )
- {
- advisory6 = (uint32_t)1U;
- }
- else
- {
- advisory6 = 0;
- }
-
- if ( advisory6 )
- {
- /* disable the interrupts */
- gie = _disable_interrupts ();
- #if !(defined (SOC_OMAPL137) || defined(SOC_OMAPL138))
- CSL_XMC_invalidatePrefetchBuffer();
- #endif
- }
-
- /* Invalidate and writeback the cache line. */
- CSL_FINS (hCache->L1DWBINV, CGEM_L1DWBINV_C, (uint32_t)1U);
-
- /* Determine if we need to wait for the operation to complete. */
- if (wait)
- {
- CACHE_wbInvAllL1dWait();
- }
- if (advisory6)
- {
- CACHE_AsmNop();
- _restore_interrupts (gie);
- }
- }
- /** ============================================================================
- * @n@b CACHE_invL1dWait
- *
- * @b Description
- * @n This function is used to wait for the L1D invalidate block operation to
- * complete. This API should be used only if the CACHE_invL1d was called
- * with the CACHE_NOWAIT argument.
- *
- * @b Arguments
- * @n None
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n @a CACHE_invL1d(wait=CACHE_NOWAIT) must be called.
- *
- * <b> Post Condition </b>
- * @n The L1D Block Cache is invalidated.
- *
- * @b Reads
- * @n CGEM_L1DIWC_WC=0
- *
- * @b Example
- * @verbatim
-
- CACHE_invL1d((void *)ptr_buffer, 128, CACHE_NOWAIT);
- ...
- CACHE_invL1dWait(); // Wait for the Invalidate/Writeback operation to complete.
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_invL1dWait (void);/* for misra warnings*/
- static inline void CACHE_invL1dWait (void)
- {
- /* Wait for the Invalidate operation to complete. */
- while (CSL_FEXT(hCache->L1DIWC, CGEM_L1DIWC_WC) != 0) {}
- }
- /** ============================================================================
- * @n@b CACHE_invL1d
- *
- * @b Description
- * @n This function is used to invalidate a block in the L1D Cache. Although
- * the block size can be specified in the number of bytes, the cache
- * controller operates on whole cache lines. To prevent unintended behavior
- * "blockPtr" should be aligned on the cache line size and "byteCnt" should
- * be a multiple of the cache line size.
- *
- * @b Arguments
- @verbatim
- blockPtr Address of the block which is to be invalidated
- byteCnt Size of the block to be invalidated.
- wait Indicates if the call should block or not.
- @endverbatim
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n None
- *
- * <b> Post Condition </b>
- * @n The contents of the blockPtr are being invalidated
- *
- * @b Writes
- * @n CGEM_L1DIBAR_ADDR,CGEM_L1DIWC_WC
- *
- * @b Example
- * @verbatim
-
- Uint8* ptr_buffer;
-
- // Invalidate 128 bytes of the buffer.
- CACHE_invL1d((void *)ptr_buffer, 128, CACHE_WAIT);
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_invL1d
- (
- const void* blockPtr,
- Uint32 byteCnt,
- CACHE_Wait wait
- ); /*for misra warnings*/
- static inline void CACHE_invL1d
- (
- const void* blockPtr,
- Uint32 byteCnt,
- CACHE_Wait wait
- )
- {
- uint32_t gie, advisory6;
-
- if ( (wait == CACHE_WAIT ) ||
- (wait == CACHE_FENCE_WAIT) )
- {
- advisory6 = (uint32_t)1U;
- }
- else
- {
- advisory6 = 0;
- }
-
- if ( advisory6 )
- {
- /* disable the interrupts */
- gie = _disable_interrupts ();
- #if !(defined (SOC_OMAPL137) || defined(SOC_OMAPL138))
- CSL_XMC_invalidatePrefetchBuffer();
- #endif
- }
- /* Setup the block address and length */
- hCache->L1DIBAR = CSL_FMK(CGEM_L1DIBAR_ADDR, (Uint32)blockPtr);
- hCache->L1DIWC = CSL_FMK(CGEM_L1DIWC_WC, (Uint32)((byteCnt+((uint32_t)3U))>>2));
- /* Determine if we need to wait for the operation to complete. */
- if ( (wait == CACHE_WAIT) ||
- (wait == CACHE_ONLY_WAIT) )
- {
- CACHE_invL1dWait();
- }
- else
- {
- #if !(defined (SOC_OMAPL137) || defined(SOC_OMAPL138))
- if ( (wait == CACHE_FENCE_WAIT) ||
- (wait == CACHE_FENCE_ONLY_WAIT ) )
- {
- _mfence();
- /* Add another mfence to address single mfence issue
- * Under very particular circumstances, MFENCE may allow
- * the transaction after the MFENCE to proceed before
- * the preceding STORE completes */
- _mfence();
- }
- #endif
- }
- if (advisory6)
- {
- CACHE_AsmNop();
- _restore_interrupts (gie);
- }
- }
- /** ============================================================================
- * @n@b CACHE_wbL1dWait
- *
- * @b Description
- * @n This function is used to wait for the L1D writeback block operation to
- * complete. This API should be used only if the CACHE_wbL1d was called
- * with the CACHE_NOWAIT argument.
- *
- * @b Arguments
- * @n None
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n @a CACHE_wbL1d(wait=CACHE_NOWAIT) must be called.
- *
- * <b> Post Condition </b>
- * @n The dirty lines of the L1D Block Cache have been written back.
- *
- * @b Reads
- * @n CGEM_L1DWWC_WC=0
- *
- * @b Example
- * @verbatim
-
- CACHE_wbL1d((void *)ptr_buffer, 128, CACHE_NOWAIT);
- ...
- CACHE_wbL1dWait(); // Wait for the writeback operation to complete.
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_wbL1dWait (void);/* for misra warnings*/
- static inline void CACHE_wbL1dWait (void)
- {
- /* Wait for the Writeback operation to complete. */
- while (CSL_FEXT(hCache->L1DWWC, CGEM_L1DWWC_WC) != 0) {}
- }
- /** ============================================================================
- * @n@b CACHE_wbL1d
- *
- * @b Description
- * @n This function is used to writeback the dirty lines of the block address.
- * Although the block size can be specified in the number of bytes, the cache
- * controller operates on whole cache lines. To prevent unintended behavior
- * "blockPtr" should be aligned on the cache line size and "byteCnt" should
- * be a multiple of the cache line size.
- *
- * @b Arguments
- @verbatim
- blockPtr Address of the block which is to be written back
- byteCnt Size of the block to be written back.
- wait Indicates if the call should block or not.
- @endverbatim
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n None
- *
- * <b> Post Condition </b>
- * @n The contents of the blockPtr are being written back
- *
- * @b Writes
- * @n CGEM_L1DWBAR_ADDR,CGEM_L1DWWC_WC
- *
- * @b Example
- * @verbatim
-
- Uint8* ptr_buffer;
-
- // Writeback 128 bytes of the buffer.
- CACHE_wbL1d((void *)ptr_buffer, 128, CACHE_WAIT);
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_wbL1d
- (
- const void* blockPtr,
- Uint32 byteCnt,
- CACHE_Wait wait
- ); /*for misra warnings*/
- static inline void CACHE_wbL1d
- (
- const void* blockPtr,
- Uint32 byteCnt,
- CACHE_Wait wait
- )
- {
- uint32_t gie, advisory6;
-
- if ( (wait == CACHE_WAIT ) ||
- (wait == CACHE_FENCE_WAIT) )
- {
- advisory6 = (uint32_t)1U;
- }
- else
- {
- advisory6 = 0;
- }
-
- if ( advisory6 )
- {
- /* disable the interrupts */
- gie = _disable_interrupts ();
- }
- /* Setup the block address and length */
- hCache->L1DWBAR = CSL_FMK (CGEM_L1DWBAR_ADDR, (Uint32)blockPtr);
- hCache->L1DWWC = CSL_FMK (CGEM_L1DWWC_WC, (Uint32)((byteCnt+((uint32_t)3U))>>2));
- /* Determine if we need to wait for the operation to complete. */
- if ( (wait == CACHE_WAIT) ||
- (wait == CACHE_ONLY_WAIT ) )
- {
- CACHE_wbL1dWait();
- }
- else
- {
- #if !(defined (SOC_OMAPL137) || defined(SOC_OMAPL138))
- if ( (wait == CACHE_FENCE_WAIT) ||
- (wait == CACHE_FENCE_ONLY_WAIT) )
- {
- _mfence();
- /* Add another mfence to address single mfence issue
- * Under very particular circumstances, MFENCE may allow
- * the transaction after the MFENCE to proceed before
- * the preceding STORE completes */
- _mfence();
- }
- #endif
- }
- if (advisory6)
- {
- CACHE_AsmNop();
- _restore_interrupts (gie);
- }
- }
- /** ============================================================================
- * @n@b CACHE_wbInvL1dWait
- *
- * @b Description
- * @n This function is used to wait for the L1D invalidate/writeback block
- * operation to complete. This API should be used only if the CACHE_wbInvL1d
- * was called with the CACHE_NOWAIT argument.
- *
- * @b Arguments
- * @n None
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n @a CACHE_wbInvL1d(wait=CACHE_NOWAIT) must be called.
- *
- * <b> Post Condition </b>
- * @n The dirty lines of the L1D Block Cache have been written back and the cache
- * contents pointed to by the block address are also invalidated.
- *
- * @b Reads
- * @n CGEM_L1DWIWC_WC=0
- *
- * @b Example
- * @verbatim
-
- CACHE_wbInvL1d((void *)ptr_buffer, 128, CACHE_NOWAIT);
- ...
- CACHE_wbInvL1dWait(); // Wait for the operation to complete.
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_wbInvL1dWait (void);/* for misra warnings*/
- static inline void CACHE_wbInvL1dWait (void)
- {
- /* Wait for the Block Writeback/Invalidate operation to complete. */
- while (CSL_FEXT(hCache->L1DWIWC, CGEM_L1DWIWC_WC) != 0) {}
- }
- /** ============================================================================
- * @n@b CACHE_wbInvL1d
- *
- * @b Description
- * @n This function is used to invalidate and writeback the dirty lines
- * of the block address. Although the block size can be specified in
- * the number of bytes, the cache controller operates on whole cache lines.
- * To prevent unintended behavior "blockPtr" should be aligned on the
- * cache line size and "byteCnt" should be a multiple of the cache line size.
- *
- * @b Arguments
- @verbatim
- blockPtr Address of the block which is to be invalidated/written back
- byteCnt Size of the block to be invalidated/written back.
- wait Indicates if the call should block or not.
- @endverbatim
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n None
- *
- * <b> Post Condition </b>
- * @n The contents of the blockPtr are being invalidated and the dirty lines are
- * written back
- *
- * @b Writes
- * @n CGEM_L1DWIBAR_ADDR,CGEM_L1DWIWC_WC
- *
- * @b Example
- * @verbatim
-
- Uint8* ptr_buffer;
-
- // Writeback/Invalidate 128 bytes of the buffer.
- CACHE_wbInvL1d((void *)ptr_buffer, 128, CACHE_WAIT);
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_wbInvL1d
- (
- const void* blockPtr,
- Uint32 byteCnt,
- CACHE_Wait wait
- ); /*for misra warnings*/
- static inline void CACHE_wbInvL1d
- (
- const void* blockPtr,
- Uint32 byteCnt,
- CACHE_Wait wait
- )
- {
- uint32_t gie, advisory6;
-
- if ( (wait == CACHE_WAIT ) ||
- (wait == CACHE_FENCE_WAIT) )
- {
- advisory6 = (uint32_t)1U;
- }
- else
- {
- advisory6 = 0;
- }
-
- if ( advisory6 )
- {
- /* disable the interrupts */
- gie = _disable_interrupts ();
- #if !(defined (SOC_OMAPL137) || defined(SOC_OMAPL138))
- CSL_XMC_invalidatePrefetchBuffer();
- #endif
- }
- /* Setup the block address and length */
- hCache->L1DWIBAR = CSL_FMK(CGEM_L1DWIBAR_ADDR, (Uint32)blockPtr);
- hCache->L1DWIWC = CSL_FMK(CGEM_L1DWIWC_WC, (Uint32)((byteCnt+((uint32_t)3U))>>2));
-
- /* Determine if we need to wait for the operation to complete. */
- if ( (wait == CACHE_WAIT) ||
- (wait == CACHE_ONLY_WAIT) )
- {
- CACHE_wbInvL1dWait();
- }
- else
- {
- #if !(defined (SOC_OMAPL137) || defined(SOC_OMAPL138))
- if ( (wait == CACHE_FENCE_WAIT) ||
- (wait == CACHE_FENCE_ONLY_WAIT) )
- {
- _mfence();
- /* Add another mfence to address single mfence issue
- * Under very particular circumstances, MFENCE may allow
- * the transaction after the MFENCE to proceed before
- * the preceding STORE completes */
- _mfence();
- }
- #endif
- }
- if (advisory6)
- {
- CACHE_AsmNop();
- _restore_interrupts (gie);
- }
- }
- /** ============================================================================
- * @n@b CACHE_setL1PSize
- *
- * @b Description
- * @n This function is used to set the L1P Cache Size.
- *
- * @b Arguments
- @verbatim
- newSize Cache Size to be configured.
- @endverbatim
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n None
- *
- * <b> Post Condition </b>
- * @n None
- *
- * @b Writes
- * @n CGEM_L1PCFG_L1PMODE
- *
- * @b Example
- * @verbatim
-
- CACHE_setL1PSize(1); // Configure 4K Cache Size
- @endverbatim
- * =============================================================================
- */
- /* for misra warnings*/
- static inline void CACHE_setL1PSize (CACHE_L1Size newSize);
- static inline CACHE_L1Size CACHE_getL1PSize (void);
- static inline void CACHE_setL1PSize (CACHE_L1Size newSize)
- {
- CSL_FINS (hCache->L1PCFG, CGEM_L1PCFG_L1PMODE, newSize);
- /* Read back L1PCFG. This stalls the DSP until the mode change completes */
- CACHE_getL1PSize();
- }
- /** ============================================================================
- * @n@b CACHE_getL1PSize
- *
- * @b Description
- * @n This function is used to get the L1P Cache Size.
- *
- * @b Arguments
- * @n None
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n None
- *
- * <b> Post Condition </b>
- * @n None
- *
- * @b Reads
- * @n CGEM_L1PCFG_L1PMODE
- *
- * @b Example
- * @verbatim
- CACHE_L1Size cacheSize;
-
- cacheSize = CACHE_getL1PSize();
- @endverbatim
- * =============================================================================
- */
- static inline CACHE_L1Size CACHE_getL1PSize (void)
- {
- return (CACHE_L1Size)CSL_FEXT (hCache->L1PCFG, CGEM_L1PCFG_L1PMODE);
- }
- /** ============================================================================
- * @n@b CACHE_freezeL1P
- *
- * @b Description
- * @n This function is used to freeze the L1P cache.
- *
- * @b Arguments
- * @n None
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n None
- *
- * <b> Post Condition </b>
- * @n None
- *
- * @b Writes
- * @n CGEM_L1PCC_OPER=1
- *
- * @b Example
- * @verbatim
-
- CACHE_freezeL1P();
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_freezeL1P(void);/* for misra warnings*/
- static inline void CACHE_freezeL1P(void)
- {
- /* Set the Freeze Mode Enabled bit. */
- CSL_FINS (hCache->L1PCC, CGEM_L1PCC_OPER, (uint32_t)1U);
- }
- /** ============================================================================
- * @n@b CACHE_unfreezeL1P
- *
- * @b Description
- * @n This function is used to unfreeze the L1D cache.
- *
- * @b Arguments
- * @n None
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n None
- *
- * <b> Post Condition </b>
- * @n None
- *
- * @b Writes
- * @n CGEM_L1PCC_OPER=0
- *
- * @b Example
- * @verbatim
-
- CACHE_unfreezeL1D();
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_unfreezeL1P(void);/* for misra warnings*/
- static inline void CACHE_unfreezeL1P(void)
- {
- /* Reset the Freeze Mode Enabled bit. */
- CSL_FINS (hCache->L1PCC, CGEM_L1PCC_OPER, (uint32_t)0);
- }
- /** ============================================================================
- * @n@b CACHE_getPrevL1PMode
- *
- * @b Description
- * @n This function is used get the previous operating state of the L1P cache
- *
- * @b Arguments
- * @n None
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n None
- *
- * <b> Post Condition </b>
- * @n None
- *
- * @b Reads
- * @n CGEM_L1PCC_POPER
- *
- * @b Example
- * @verbatim
- Uint32 prev;
-
- prev = CACHE_getPrevL1PMode();
- @endverbatim
- * =============================================================================
- */
- static inline Uint32 CACHE_getPrevL1PMode(void);/* for misra warnings*/
- static inline Uint32 CACHE_getPrevL1PMode(void)
- {
- return CSL_FEXT (hCache->L1PCC, CGEM_L1PCC_POPER);
- }
- /** ============================================================================
- * @n@b CACHE_invL1pWait
- *
- * @b Description
- * @n This function is used to wait for the L1D invalidate block operation to
- * complete. This API should be used only if the CACHE_invL1p was called
- * with the CACHE_NOWAIT argument.
- *
- * @b Arguments
- * @n None
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n @a CACHE_invL1p(wait=CACHE_NOWAIT) must be called.
- *
- * <b> Post Condition </b>
- * @n The L1D Block Cache is invalidated.
- *
- * @b Reads
- * @n CGEM_L1PIWC_WC=0
- *
- * @b Example
- * @verbatim
-
- CACHE_invL1p((void *)&foo, 128, CACHE_NOWAIT);
- ...
- CACHE_invL1pWait(); // Wait for the Invalidate operation to complete.
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_invL1pWait (void);/* for misra warnings*/
- static inline void CACHE_invL1pWait (void)
- {
- /* Wait for the Invalidate operation to complete. */
- while (CSL_FEXT(hCache->L1PIWC, CGEM_L1PIWC_WC) != 0) {}
- }
- /** ============================================================================
- * @n@b CACHE_invL1p
- *
- * @b Description
- * @n This function is used to invalidate the L1P Cache pointed by the block
- * address. Although the block size can be specified in the number of bytes,
- * the cache controller operates on whole cache lines. To prevent unintended
- * behavior "blockPtr" should be aligned on the cache line size and "byteCnt"
- * should be a multiple of the cache line size.
- *
- * @b Arguments
- @verbatim
- blockPtr Address of the block which is to be invalidated
- byteCnt Size of the block to be invalidated.
- wait Indicates if the call should block or not.
- @endverbatim
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n None
- *
- * <b> Post Condition </b>
- * @n The contents of the blockPtr are being invalidated
- *
- * @b Writes
- * @n CGEM_L1PIBAR_ADDR,CGEM_L1PIWC_WC
- *
- * @b Example
- * @verbatim
-
- // Invalidate the 128 bytes of the function 'foo'
- CACHE_invL1p((void *)&foo, 128, CACHE_WAIT);
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_invL1p
- (
- const void* blockPtr,
- Uint32 byteCnt,
- CACHE_Wait wait
- ); /*for misra warnings*/
- static inline void CACHE_invL1p
- (
- const void* blockPtr,
- Uint32 byteCnt,
- CACHE_Wait wait
- )
- {
- /* Setup the block address and length which is to be invalidated */
- hCache->L1PIBAR = CSL_FMK(CGEM_L1PIBAR_ADDR, (Uint32)blockPtr);
- hCache->L1PIWC = CSL_FMK(CGEM_L1PIWC_WC, (Uint32)((byteCnt+((uint32_t)3U))>>2));
- /* Determine if we need to wait for the operation to complete. */
- if (wait == CACHE_WAIT)
- {
- CACHE_invL1pWait();
- }
- else
- {
- #if !(defined (SOC_OMAPL137) || defined(SOC_OMAPL138))
- if (wait == CACHE_FENCE_WAIT)
- {
- _mfence();
- /* Add another mfence to address single mfence issue
- * Under very particular circumstances, MFENCE may allow
- * the transaction after the MFENCE to proceed before
- * the preceding STORE completes */
- _mfence();
- }
- #endif
- }
- }
- /** ============================================================================
- * @n@b CACHE_invAllL1pWait
- *
- * @b Description
- * @n This function is used to wait for the L1P invalidate operation to complete.
- * This API should be used only if the CACHE_invAllL1p was called with the
- * CACHE_NOWAIT argument.
- *
- * @b Arguments
- * @n None
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n @a CACHE_invAllL1p(wait=CACHE_NOWAIT) must be called.
- *
- * <b> Post Condition </b>
- * @n The L1P Cache is invalidated.
- *
- * @b Reads
- * @n CGEM_L1PINV_I=0
- *
- * @b Example
- * @verbatim
-
- CACHE_invAllL1p(CACHE_NOWAIT);
- ...
- CACHE_invAllL1pWait(); // Wait for the Invalidate operation to complete.
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_invAllL1pWait (void);/* for misra warnings*/
- static inline void CACHE_invAllL1pWait (void)
- {
- /* Wait for the Invalidate operation to complete. */
- while (CSL_FEXT(hCache->L1PINV, CGEM_L1PINV_I) == (uint32_t)1U) {}
- }
- /** ============================================================================
- * @n@b CACHE_invAllL1p
- *
- * @b Description
- * @n This function is used to invalidate the entire L1P Cache
- *
- * @b Arguments
- @verbatim
- wait Indicates if the call should block or not.
- @endverbatim
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n None
- *
- * <b> Post Condition </b>
- * @n The entire L1P cache is being invalidated.
- *
- * @b Writes
- * @n CGEM_L1PINV_I=1
- *
- * @b Example
- * @verbatim
-
- CACHE_invAllL1p(CACHE_WAIT);
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_invAllL1p (CACHE_Wait wait);/* for misra warnings*/
- static inline void CACHE_invAllL1p (CACHE_Wait wait)
- {
- /* Invalidate the L1P Cache. */
- CSL_FINS (hCache->L1PINV, CGEM_L1PINV_I, (uint32_t)1U);
- /* Determine if we need to wait for the operation to complete. */
- if (wait)
- {
- CACHE_invAllL1pWait();
- }
- }
- /** ============================================================================
- * @n@b CACHE_setL2Size
- *
- * @b Description
- * @n This function is used to set the new size of the L2 Cache.
- *
- * @b Arguments
- @verbatim
- newSize New Size of the L2 Cache to be set.
- @endverbatim
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n None
- *
- * <b> Post Condition </b>
- * @n The L2 Cache is configured to use the new size.
- *
- * @b Writes
- * @n CGEM_L2CFG_L2MODE
- *
- * @b Example
- * @verbatim
-
- CACHE_setL2Size(CACHE_32KCACHE); // Use 32K L2 Cache.
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_setL2Size (CACHE_L2Size newSize);/* for misra warnings*/
- static inline CACHE_L2Size CACHE_getL2Size (void);/* for misra warnings*/
- static inline void CACHE_setL2Size (CACHE_L2Size newSize)
- {
- /* Set the new L2 cache size. */
- CSL_FINS (hCache->L2CFG, CGEM_L2CFG_L2MODE, newSize);
- /* Read back L2CFG. This stalls the DSP until the mode change completes */
- CACHE_getL2Size();
- }
- /** ============================================================================
- * @n@b CACHE_getL2Size
- *
- * @b Description
- * @n This function is used to get the L2 cache size.
- *
- * @b Arguments
- * @n None
- *
- * <b> Return Value </b>
- * @n CACHE_L2Size
- *
- * <b> Pre Condition </b>
- * @n None
- *
- * <b> Post Condition </b>
- * @n None
- *
- * @b Reads
- * @n CGEM_L2CFG_L2MODE
- *
- * @b Example
- * @verbatim
- CACHE_L2Size size;
-
- size = CACHE_getL2Size();
- @endverbatim
- * =============================================================================
- */
- static inline CACHE_L2Size CACHE_getL2Size (void)
- {
- return (CACHE_L2Size) CSL_FEXT (hCache->L2CFG, CGEM_L2CFG_L2MODE);
- }
- /** ============================================================================
- * @n@b CACHE_freezeL2
- *
- * @b Description
- * @n This function is used to freeze the L2 Cache
- *
- * @b Arguments
- * @n None
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n None
- *
- * <b> Post Condition </b>
- * @n The L2 Cache is frozen.
- *
- * @b Example
- * @verbatim
-
- CACHE_freezeL2();
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_freezeL2 (void);/* for misra warnings*/
- static inline void CACHE_freezeL2 (void)
- {
- /* The RL File does not define the L2CC bit so we used the RAW macro to
- * configure the corresponding bit. */
- CSL_FINSR(hCache->L2CFG, (uint32_t)3U, (uint32_t)3U, (uint32_t)1U);
- }
- /** ============================================================================
- * @n@b CACHE_unfreezeL2
- *
- * @b Description
- * @n This function is used to unfreeze the L2 Cache
- *
- * @b Arguments
- * @n None
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n None
- *
- * <b> Post Condition </b>
- * @n The L2 Cache is unfrozen
- *
- * @b Example
- * @verbatim
-
- CACHE_unfreezeL2();
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_unfreezeL2 (void);/* for misra warnings*/
- static inline void CACHE_unfreezeL2 (void)
- {
- /* The RL File does not define the L2CC bit so we used the RAW macro to
- * configure the corresponding bit. */
- CSL_FINSR(hCache->L2CFG, (uint32_t)3U, (uint32_t)3U, (uint32_t)0);
- }
- /** ============================================================================
- * @n@b CACHE_wbL2Wait
- *
- * @b Description
- * @n This function is used to wait for the L2 writeback block operation to
- * complete. This API should be used only if the CACHE_wbL2 was called
- * with the CACHE_NOWAIT argument.
- *
- * @b Arguments
- * @n None
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n @a CACHE_wbL2(wait=CACHE_NOWAIT) must be called.
- *
- * <b> Post Condition </b>
- * @n The dirty lines of the L1D Block Cache have been written back.
- *
- * @b Reads
- * @n CGEM_L2WWC_WC=0
- *
- * @b Example
- * @verbatim
-
- CACHE_wbL2((void *)ptr_buffer, 128, CACHE_NOWAIT);
- ...
- CACHE_wbL2Wait(); // Wait for the writeback operation to complete.
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_wbL2Wait (void);/* for misra warnings*/
- static inline void CACHE_wbL2Wait (void)
- {
- /* Wait for the Writeback operation to complete. */
- while (CSL_FEXT(hCache->L2WWC, CGEM_L2WWC_WC) != 0) {}
- }
- /** ============================================================================
- * @n@b CACHE_wbL2
- *
- * @b Description
- * @n This function is used to writeback the contents of the L2 Cache. Although
- * the block size can be specified in the number of bytes, the cache
- * controller operates on whole cache lines. To prevent unintended behavior
- * "blockPtr" should be aligned on the cache line size and "byteCnt"
- * should be a multiple of the cache line size.
- *
- * @b Arguments
- @verbatim
- blockPtr Address of the block which is to be written back
- byteCnt Size of the block to be written block.
- wait Indicates if the call should block or not.
- @endverbatim
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n None
- *
- * <b> Post Condition </b>
- * @n The dirty lines of the L2 Cache are being written back.
- *
- * @b Writes
- * @n CGEM_L2WBAR_ADDR,CGEM_L2WWC_WC
- *
- * @b Example
- * @verbatim
- Uint8* ptr_buffer;
-
- // Writeback the contents of the buffer.
- CACHE_wbL2(ptr_buffer, 100, CACHE_WAIT);
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_wbL2
- (
- const void* blockPtr,
- Uint32 byteCnt,
- CACHE_Wait wait
- ); /*for misra warnings*/
- static inline void CACHE_wbL2
- (
- const void* blockPtr,
- Uint32 byteCnt,
- CACHE_Wait wait
- )
- {
- uint32_t gie, advisory6;
-
- if ( (wait == CACHE_WAIT ) ||
- (wait == CACHE_FENCE_WAIT) )
- {
- advisory6 = (uint32_t)1U;
- }
- else
- {
- advisory6 = 0;
- }
- if ( advisory6 )
- {
- /* disable the interrupts */
- gie = _disable_interrupts ();
- }
- /* Setup the block address and length */
- hCache->L2WBAR = CSL_FMK (CGEM_L2WBAR_ADDR, (Uint32)blockPtr);
- hCache->L2WWC = CSL_FMK (CGEM_L2WWC_WC, (Uint32)((byteCnt+((uint32_t)3))>>2));
- /* Determine if we need to wait for the operation to complete. */
- if ( (wait == CACHE_WAIT) ||
- (wait == CACHE_ONLY_WAIT) )
- {
- CACHE_wbL2Wait();
- }
- else
- {
- #if !(defined (SOC_OMAPL137) || defined(SOC_OMAPL138))
- if ( (wait == CACHE_FENCE_WAIT) ||
- (wait == CACHE_FENCE_ONLY_WAIT) )
- {
- _mfence();
- /* Add another mfence to address single mfence issue
- * Under very particular circumstances, MFENCE may allow
- * the transaction after the MFENCE to proceed before
- * the preceding STORE completes */
- _mfence();
- }
- #endif
- }
- if (advisory6)
- {
- CACHE_AsmNop();
- _restore_interrupts (gie);
- }
- }
- /** ============================================================================
- * @n@b CACHE_invL2Wait
- *
- * @b Description
- * @n This function is used to wait for the L2 invalidate block operation to
- * complete. This API should be used only if the CACHE_invL2 was called
- * with the CACHE_NOWAIT argument.
- *
- * @b Arguments
- * @n None
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n @a CACHE_invL2(wait=CACHE_NOWAIT) must be called.
- *
- * <b> Post Condition </b>
- * @n Invalidate the contents of the L2 Cache.
- *
- * @b Reads
- * @n CGEM_L2IWC_WC=0
- *
- * @b Example
- * @verbatim
-
- CACHE_invL2((void *)ptr_buffer, 128, CACHE_NOWAIT);
- ...
- CACHE_invL2Wait(); // Wait for the Invalidate operation to complete.
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_invL2Wait (void);/* for misra warnings*/
- static inline void CACHE_invL2Wait (void)
- {
- /* Wait for the Invalidate operation to complete. */
- while (CSL_FEXT(hCache->L2IWC, CGEM_L2IWC_WC) != 0) {}
- }
- /** ============================================================================
- * @n@b CACHE_invL2
- *
- * @b Description
- * @n This function is used to invalidate the contents of the L2 Cache.
- * Although the block size can be specified in the number of bytes,
- * the cache controller operates on whole cache lines. To prevent unintended
- * behavior "blockPtr" should be aligned on the cache line size and "byteCnt"
- * should be a multiple of the cache line size.
- *
- * @b Arguments
- @verbatim
- blockPtr Address of the block which is to be invalidated
- byteCnt Size of the block to be invalidated.
- wait Indicates if the call should block or not.
- @endverbatim
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n None
- *
- * <b> Post Condition </b>
- * @n The contents of the L2 Cache are being invalidated.
- *
- * @b Writes
- * @n CGEM_L2IBAR_ADDR,CGEM_L2IWC_WC
- *
- * @b Example
- * @verbatim
- Uint8* ptr_buffer;
-
- // Invalidate the contents of the buffer.
- CACHE_invL2(ptr_buffer, 100, CACHE_WAIT);
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_invL2
- (
- const void* blockPtr,
- Uint32 byteCnt,
- CACHE_Wait wait
- ); /*for misra warnings*/
- static inline void CACHE_invL2
- (
- const void* blockPtr,
- Uint32 byteCnt,
- CACHE_Wait wait
- )
- {
- uint32_t gie, advisory6;
-
- if ( (wait == CACHE_WAIT ) ||
- (wait == CACHE_FENCE_WAIT) )
- {
- advisory6 = (uint32_t)1U;
- }
- else
- {
- advisory6 = 0;
- }
-
- if ( advisory6 )
- {
- /* disable the interrupts */
- gie = _disable_interrupts ();
- #if !(defined (SOC_OMAPL137) || defined(SOC_OMAPL138))
- CSL_XMC_invalidatePrefetchBuffer();
- #endif
- }
- /* Setup the block address and length */
- hCache->L2IBAR = CSL_FMK (CGEM_L2IBAR_ADDR, (Uint32)blockPtr);
- hCache->L2IWC = CSL_FMK (CGEM_L2IWC_WC, (Uint32)((byteCnt+((uint32_t)3U))>>2));
- /* Determine if we need to wait for the operation to complete. */
- if ( (wait == CACHE_WAIT) ||
- (wait == CACHE_ONLY_WAIT) )
- {
- CACHE_invL2Wait();
- }
- else
- {
- #if !(defined (SOC_OMAPL137) || defined(SOC_OMAPL138))
- if ((wait == CACHE_FENCE_WAIT) ||
- (wait == CACHE_FENCE_ONLY_WAIT))
- {
- _mfence();
- /* Add another mfence to address single mfence issue
- * Under very particular circumstances, MFENCE may allow
- * the transaction after the MFENCE to proceed before
- * the preceding STORE completes */
- _mfence();
- }
- #endif
- }
- if (advisory6)
- {
- CACHE_AsmNop();
- _restore_interrupts (gie);
- }
- }
- /** ============================================================================
- * @n@b CACHE_wbInvL2Wait
- *
- * @b Description
- * @n This function is used to wait for the L2 Writeback & invalidate block
- * operation to complete. This API should be used only if the CACHE_wbInvL2
- * was called with the CACHE_NOWAIT argument.
- *
- * @b Arguments
- * @n None
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n @a CACHE_wbInvL2(wait=CACHE_NOWAIT) must be called.
- *
- * <b> Post Condition </b>
- * @n Invalidate the contents of the L2 Cache.
- *
- * @b Reads
- * @n CGEM_L2WIWC_WC=0
- *
- * @b Example
- * @verbatim
-
- CACHE_wbInvL2((void *)ptr_buffer, 128, CACHE_NOWAIT);
- ...
- CACHE_wbInvL2Wait(); // Wait for the Writeback-Invalidate operation to complete.
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_wbInvL2Wait (void);/* for misra warnings*/
- static inline void CACHE_wbInvL2Wait (void)
- {
- /* Wait for the Writeback & Invalidate operation to complete. */
- while (CSL_FEXT(hCache->L2WIWC, CGEM_L2WIWC_WC) != 0) {}
- }
- /** ============================================================================
- * @n@b CACHE_wbInvL2
- *
- * @b Description
- * @n This function is used to write back and invalidate the contents of the L2 Cache.
- * Although the block size can be specified in the number of bytes,
- * the cache controller operates on whole cache lines. To prevent unintended
- * behavior "blockPtr" should be aligned on the cache line size and "byteCnt"
- * should be a multiple of the cache line size.
- *
- * @b Arguments
- @verbatim
- blockPtr Address of the block which is to be written back & invalidated
- byteCnt Size of the block to be written back & invalidated.
- wait Indicates if the call should block or not.
- @endverbatim
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n None
- *
- * <b> Post Condition </b>
- * @n The contents of the L2 Cache are being written back & invalidated.
- *
- * @b Writes
- * @n CGEM_L2WIBAR_ADDR,CGEM_L2WIWC_WC
- *
- * @b Example
- * @verbatim
- Uint8* ptr_buffer;
-
- // Invalidate the contents of the buffer.
- CACHE_wbInvL2(ptr_buffer, 100, CACHE_WAIT);
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_wbInvL2 (
- const void* blockPtr,
- Uint32 byteCnt,
- CACHE_Wait wait
- ); /* for misra warnings */
- static inline void CACHE_wbInvL2 (
- const void* blockPtr,
- Uint32 byteCnt,
- CACHE_Wait wait
- )
- {
- uint32_t gie, advisory6;
-
- if ( (wait == CACHE_WAIT ) ||
- (wait == CACHE_FENCE_WAIT) )
- {
- advisory6 = (uint32_t)1U;
- }
- else
- {
- advisory6 = 0;
- }
-
- if ( advisory6 )
- {
- /* disable the interrupts */
- gie = _disable_interrupts ();
- #if !(defined (SOC_OMAPL137) || defined(SOC_OMAPL138))
- CSL_XMC_invalidatePrefetchBuffer();
- #endif
- }
- /* Setup the block address and length */
- hCache->L2WIBAR = CSL_FMK(CGEM_L2WIBAR_ADDR, (Uint32)blockPtr);
- hCache->L2WIWC = CSL_FMK(CGEM_L2WIWC_WC, (Uint32)((byteCnt+((uint32_t)3U))>>2));
-
- /* Determine if we need to wait for the operation to complete. */
- if ( (wait == CACHE_WAIT) ||
- (wait == CACHE_ONLY_WAIT) )
- {
- CACHE_wbInvL2Wait();
- }
- else
- {
- #if !(defined (SOC_OMAPL137) || defined(SOC_OMAPL138))
- if ( (wait == CACHE_FENCE_WAIT) ||
- (wait == CACHE_FENCE_ONLY_WAIT) )
- {
- _mfence();
- /* Add another mfence to address single mfence issue
- * Under very particular circumstances, MFENCE may allow
- * the transaction after the MFENCE to proceed before
- * the preceding STORE completes */
- _mfence();
- }
- #endif
- }
- if (advisory6)
- {
- CACHE_AsmNop();
- _restore_interrupts (gie);
- }
- }
- /** ============================================================================
- * @n@b CACHE_wbAllL2Wait
- *
- * @b Description
- * @n This function is used to wait for the L2 Writeback & invalidate operation
- * to complete. This API should be used only if the CACHE_wbAllL2 was called
- * with the CACHE_NOWAIT argument.
- *
- * @b Arguments
- * @n None
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n @a CACHE_wbAllL2(wait=CACHE_NOWAIT) must be called.
- *
- * <b> Post Condition </b>
- * @n The contents of the L2 Cache have been written back
- *
- * @b Reads
- * @n CGEM_L2WB_C=0
- *
- * @b Example
- * @verbatim
-
- // Writeback the contents of the L2 Cache.
- CACHE_wbAllL2(CACHE_NOWAIT);
-
- // Wait for the operation to complete.
- CACHE_wbAllL2Wait();
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_wbAllL2Wait (void);/* for misra warnings*/
- static inline void CACHE_wbAllL2Wait (void)
- {
- /* Wait for the writeback operation to complete. */
- while (CSL_FEXT(hCache->L2WB, CGEM_L2WB_C) == (uint32_t)1U) {}
- }
- /** ============================================================================
- * @n@b CACHE_wbAllL2
- *
- * @b Description
- * @n This function is used to write back all the contents of the L2 Cache.
- *
- * @b Arguments
- @verbatim
- wait Indicates if the call should block or not.
- @endverbatim
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n None
- *
- * <b> Post Condition </b>
- * @n The contents of the L2 Cache are being written back.
- *
- * @b Writes
- * @n CGEM_L2WB_C=1
- *
- * @b Example
- * @verbatim
-
- // Writeback the contents of the L2 Cache.
- CACHE_wbAllL2(CACHE_WAIT);
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_wbAllL2 (CACHE_Wait wait);/* for misra warnings*/
- static inline void CACHE_wbAllL2 (CACHE_Wait wait)
- {
- uint32_t gie, advisory6;
-
- if ( (wait == CACHE_WAIT ) ||
- (wait == CACHE_FENCE_WAIT) )
- {
- advisory6 = (uint32_t)1U;
- }
- else
- {
- advisory6 = 0;
- }
-
- if ( advisory6 )
- {
- /* disable the interrupts */
- gie = _disable_interrupts ();
- }
- CSL_FINS (hCache->L2WB, CGEM_L2WB_C, (uint32_t)1U);
-
- /* Determine if we need to wait for the operation to complete. */
- if (wait)
- {
- CACHE_wbAllL2Wait();
- }
- if (advisory6)
- {
- CACHE_AsmNop();
- _restore_interrupts (gie);
- }
- }
- /** ============================================================================
- * @n@b CACHE_invAllL2Wait
- *
- * @b Description
- * @n This function is used to wait for the L2 Invalidate operation to complete.
- * This API should be used only if the CACHE_invAllL2 was called with the
- * CACHE_NOWAIT argument.
- *
- * @b Arguments
- * @n None
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n @a CACHE_invAllL2(wait=CACHE_NOWAIT) must be called.
- *
- * <b> Post Condition </b>
- * @n The contents of the L2 Cache have been invalidated
- *
- * @b Reads
- * @n CGEM_L2INV_I=0
- *
- * @b Example
- * @verbatim
-
- // Invalidate the contents of the L2 Cache.
- CACHE_invAllL2(CACHE_NOWAIT);
-
- // Wait for the operation to complete.
- CACHE_invAllL2Wait();
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_invAllL2Wait (void);/* for misra warnings*/
- static inline void CACHE_invAllL2Wait (void)
- {
- /* Wait for the invalidate operation to complete. */
- while (CSL_FEXT(hCache->L2INV, CGEM_L2INV_I) == (uint32_t)1U) {}
- }
- /** ============================================================================
- * @n@b CACHE_invAllL2
- *
- * @b Description
- * @n This function is used to invalidate all the contents of the L2 Cache.
- *
- * @b Arguments
- @verbatim
- wait Indicates if the call should block or not.
- @endverbatim
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n None
- *
- * <b> Post Condition </b>
- * @n The contents of the L2 Cache are being invalidated.
- *
- * @b Writes
- * @n CGEM_L2INV_I=1
- *
- * @b Example
- * @verbatim
-
- // Invalidate the contents of the L2 Cache.
- CACHE_invAllL2(CACHE_WAIT);
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_invAllL2 (CACHE_Wait wait);/* for misra warnings*/
- static inline void CACHE_invAllL2 (CACHE_Wait wait)
- {
- uint32_t gie, advisory6;
-
- if ( (wait == CACHE_WAIT ) ||
- (wait == CACHE_FENCE_WAIT) )
- {
- advisory6 = (uint32_t)1U;
- }
- else
- {
- advisory6 = 0;
- }
-
- if ( advisory6 )
- {
- /* disable the interrupts */
- gie = _disable_interrupts ();
- #if !(defined (SOC_OMAPL137) || defined(SOC_OMAPL138))
- CSL_XMC_invalidatePrefetchBuffer();
- #endif
- }
- CSL_FINS (hCache->L2INV, CGEM_L2INV_I, (uint32_t)1U);
-
- /* Determine if we need to wait for the operation to complete. */
- if (wait)
- {
- CACHE_invAllL2Wait();
- }
- if (advisory6)
- {
- CACHE_AsmNop();
- _restore_interrupts (gie);
- }
- }
- /** ============================================================================
- * @n@b CACHE_wbInvAllL2Wait
- *
- * @b Description
- * @n This function is used to wait for the L2 Writeback and Invalidate
- * operation to complete. This API should be used only if the CACHE_wbInvAllL2 was
- * called with the CACHE_NOWAIT argument.
- *
- * @b Arguments
- * @n None
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n @a CACHE_wbInvAllL2(wait=CACHE_NOWAIT) must be called.
- *
- * <b> Post Condition </b>
- * @n The contents of the L2 Cache have been invalidated and written back
- *
- * @b Reads
- * @n CGEM_L2WBINV_C=0
- *
- * @b Example
- * @verbatim
-
- // Writeback & Invalidate the contents of the L2 Cache.
- CACHE_wbInvAllL2(CACHE_NOWAIT);
-
- // Wait for the operation to complete.
- CACHE_wbInvAllL2Wait();
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_wbInvAllL2Wait (void);/* for misra warnings*/
- static inline void CACHE_wbInvAllL2Wait (void)
- {
- /* Wait for the writeback-invalidate operation to complete. */
- while (CSL_FEXT(hCache->L2WBINV, CGEM_L2WBINV_C) == (uint32_t)1U) {}
- }
- /** ============================================================================
- * @n@b CACHE_wbInvAllL2
- *
- * @b Description
- * @n This function is used to writeback and invalidate all the contents of the L2 Cache.
- *
- * @b Arguments
- @verbatim
- wait Indicates if the call should block or not.
- @endverbatim
- *
- * <b> Return Value </b>
- * @n None
- *
- * <b> Pre Condition </b>
- * @n None
- *
- * <b> Post Condition </b>
- * @n The contents of the L2 Cache are being written back & invalidated.
- *
- * @b Writes
- * @n CGEM_L2WBINV_C=1
- *
- * @b Example
- * @verbatim
-
- // Invalidate the contents of the L2 Cache.
- CACHE_wbInvAllL2(CACHE_WAIT);
- @endverbatim
- * =============================================================================
- */
- static inline void CACHE_wbInvAllL2 (CACHE_Wait wait);/* for misra warnings*/
- static inline void CACHE_wbInvAllL2 (CACHE_Wait wait)
- {
- uint32_t gie, advisory6;
-
- if ( (wait == CACHE_WAIT ) ||
- (wait == CACHE_FENCE_WAIT) )
- {
- advisory6 = (uint32_t)1U;
- }
- else
- {
- advisory6 = 0;
- }
- if ( advisory6 )
- {
- /* disable the interrupts */
- gie = _disable_interrupts ();
- #if !(defined (SOC_OMAPL137) || defined(SOC_OMAPL138))
- CSL_XMC_invalidatePrefetchBuffer();
- #endif
- }
- CSL_FINS (hCache->L2WBINV, CGEM_L2WBINV_C, (uint32_t)1U);
-
- /* Determine if we need to wait for the operation to complete. */
- if (wait)
- {
- CACHE_wbInvAllL2Wait();
- }
- if (advisory6)
- {
- CACHE_AsmNop();
- _restore_interrupts (gie);
- }
- }
- /**
- @}
- */
- #ifdef __cplusplus
- }
- #endif
- #endif /*CSL_CACHEAUX_H*/
|