]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - processor-sdk/performance-audio-sr.git/blob - psdk_cust/pdk_k2g_1_0_1_0_eng/packages/ti/csl/csl_cacheAux.h
PASDK-258:Update PDK eng to 1.0.1.1. Using build number to differentiate PDK eng...
[processor-sdk/performance-audio-sr.git] / psdk_cust / pdk_k2g_1_0_1_0_eng / packages / ti / csl / csl_cacheAux.h
1 /**
2  *   @file  csl_cacheAux.h
3  *
4  *   @brief   
5  *      This is the CACHE Auxilary Header File which exposes the various
6  *      CSL Functional Layer API's to configure the CACHE Module.
7  *
8  *  \par
9  *  ============================================================================
10  *  @n   (C) Copyright 2002, 2003, 2004, 2005, 2008, 2009, Texas Instruments, Inc.
11  * 
12  *  Redistribution and use in source and binary forms, with or without 
13  *  modification, are permitted provided that the following conditions 
14  *  are met:
15  *
16  *    Redistributions of source code must retain the above copyright 
17  *    notice, this list of conditions and the following disclaimer.
18  *
19  *    Redistributions in binary form must reproduce the above copyright
20  *    notice, this list of conditions and the following disclaimer in the 
21  *    documentation and/or other materials provided with the   
22  *    distribution.
23  *
24  *    Neither the name of Texas Instruments Incorporated nor the names of
25  *    its contributors may be used to endorse or promote products derived
26  *    from this software without specific prior written permission.
27  *
28  *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
29  *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
30  *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
31  *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
32  *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
33  *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
34  *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
35  *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
36  *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
37  *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
38  *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39  *
40 */
42 #ifndef _CSL_CACHEAUX_H_
43 #define _CSL_CACHEAUX_H_
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
49 #include <ti/csl/csl_cache.h>
50 #include <ti/csl/csl_xmcAux.h>
52 /** @addtogroup CSL_CACHE_FUNCTION
53  @{ */
55 /** ============================================================================
56  *   @n@b CACHE_setMemRegionWritethrough
57  *
58  *   @b Description
59  *   @n This function sets write through mode for a specific memory region. 
60  *
61  *   @b Arguments
62      @verbatim
63           mar      Memory region for which cache is to be set to writethrough mode.
64           arg      TRUE to set to write through mode, otherwise to wribeback mode.
65      @endverbatim
66  *
67  *   <b> Return Value </b>
68  *   @n  None
69  *
70  *   <b> Pre Condition </b>
71  *   @n  None
72  *
73  *   <b> Post Condition </b>
74  *   @n Memory region is now set to writethrough mode.
75  *
76  *   @b Writes
77  *   @n CGEM_MAR0_WTE=1, when arg == TRUE, zero otherwise
78  *
79  *   @b Example
80  *   @verbatim
81         CACHE_setMemRegionWritethrough (20, TRUE);
83      @endverbatim
84  * =============================================================================
85  */
86 static inline void CACHE_setMemRegionWritethrough  (Uint8 mar, Bool arg)
87 {
88     uint32_t   temp = 0;
89         CSL_FINS(temp, CGEM_MAR0_WTE, 1);       
90         
91         if (arg == TRUE)
92                 hCache->MAR[mar] |= temp;
93         else
94                 hCache->MAR[mar] &= ~temp;
95 }
97 /** ============================================================================
98  *   @n@b CACHE_getMemRegionWritethrough
99  *
100  *   @b Description
101  *   @n This function gets write through mode for a specific memory region. 
102  *
103  *   @b Arguments
104      @verbatim
105           mar      Memory region for which WTE bit information to be read.
106           wte      Address of WTE value 
107      @endverbatim
108  *
109  *   <b> Return Value </b>
110  *   @n  None
111  *
112  *   <b> Pre Condition </b>
113  *   @n  None
114  *
115  *   <b> Post Condition </b>
116  *   @n WTE bit value reflecting the write through mode is returned.
117  *
118  *   @b Writes
119  *   @n None
120  *
121  *   @b Example
122  *   @verbatim
123        CACHE_getMemRegionWritethrough (20, &wte);
125      @endverbatim
126  * =============================================================================
127  */
128 static inline void CACHE_getMemRegionWritethrough  (Uint8 mar, Uint8 *wte)
130     Uint32 value = hCache->MAR[mar];
132     *wte = CSL_FEXT (value, CGEM_MAR0_WTE);
136 /** ============================================================================
137  *   @n@b CACHE_enableCaching
138  *
139  *   @b Description
140  *   @n This function enables caching for a specific memory region. 
141  *
142  *   @b Arguments
143      @verbatim
144           mar      Memory region for which cache is to be enabled.
145      @endverbatim
146  *
147  *   <b> Return Value </b>
148  *   @n  None
149  *
150  *   <b> Pre Condition </b>
151  *   @n  None
152  *
153  *   <b> Post Condition </b>
154  *   @n Memory region is now cacheable.
155  *
156  *   @b Writes
157  *   @n CGEM_MAR0_PC=1
158  *
159  *   @b Example
160  *   @verbatim
161         CACHE_enableCaching (20);
163      @endverbatim
164  * =============================================================================
165  */
166 static inline void CACHE_enableCaching  (Uint8 mar)
168     CSL_FINS(hCache->MAR[mar], CGEM_MAR0_PC, 1);
171 /** ============================================================================
172  *   @n@b CACHE_disableCaching
173  *
174  *   @b Description
175  *   @n This function disables caching for a specific memory region. 
176  *
177  *   @b Arguments
178      @verbatim
179           mar      Memory region for which cache is to be disabled.
180      @endverbatim
181  *
182  *   <b> Return Value </b>
183  *   @n  None
184  *
185  *   <b> Pre Condition </b>
186  *   @n  None
187  *
188  *   <b> Post Condition </b>
189  *   @n Memory region is now *not* cacheable.
190  *
191  *   @b Writes
192  *   @n CGEM_MAR0_PC=0
193  *
194  *   @b Example
195  *   @verbatim
196         CACHE_disableCaching (20);
198      @endverbatim
199  * =============================================================================
200  */
201 static inline void CACHE_disableCaching (Uint8 mar)
203     CSL_FINS(hCache->MAR[mar], CGEM_MAR0_PC, 0);
206 /** ============================================================================
207  *   @n@b CACHE_getMemRegionInfo
208  *
209  *   @b Description
210  *   @n This function is used to get memory region information.
211  *
212  *   @b Arguments
213      @verbatim
214           mar      Memory region for which the information is required.
215           pcx      Is address cacheable in external cache (MSMC)
216           pfx      Is address prefetchable 
217      @endverbatim
218  *
219  *   <b> Return Value </b>
220  *   @n  None
221  *
222  *   <b> Pre Condition </b>
223  *   @n  None
224  *
225  *   <b> Post Condition </b>
226  *   @n None
227  *
228  *   @b Reads
229  *   @n CGEM_MAR0_PCX, CGEM_MAR0_PFX
230  *
231  *   @b Example
232  *   @verbatim
233         
234         Uint8 pcx;
235         Uint8 pfx;
237         // Get the memory region information for 20
238         CACHE_getMemRegionInfo (20, &pcx, &pfx);
240      @endverbatim
241  * =============================================================================
242  */
243 static inline void CACHE_getMemRegionInfo (Uint8 mar, Uint8* pcx, Uint8* pfx)
245     Uint32 value = hCache->MAR[mar];
247     *pcx = CSL_FEXT (value, CGEM_MAR0_PCX);
248     *pfx = CSL_FEXT (value, CGEM_MAR0_PFX);
251 /** ============================================================================
252  *   @n@b CACHE_setMemRegionInfo
253  *
254  *   @b Description
255  *   @n This function is used to set memory region information.
256  *
257  *   @b Arguments
258      @verbatim
259           mar      Memory region for which the information is required.
260           pcx      Is address cacheable in external cache (MSMC)
261           pfx      Is address prefetchable 
262      @endverbatim
263  *
264  *   <b> Return Value </b>
265  *   @n  None
266  *
267  *   <b> Pre Condition </b>
268  *   @n  None
269  *
270  *   <b> Post Condition </b>
271  *   @n None
272  *
273  *   @b Writes
274  *   @n CGEM_MAR0_PCX, CGEM_MAR0_PFX
275  *
276  *   @b Example
277  *   @verbatim
278         
279         Uint8 pcx;
280         Uint8 pfx;
282         // Get the memory region information for 20
283         CACHE_getMemRegionInfo (20, &pcx, &pfx);
284         ...
285         // Ensure Memory Region 20 is not prefetchable.
286         CACHE_setMemRegionInfo(20, pcx, 0);
287      @endverbatim
288  * =============================================================================
289  */
290 static inline void CACHE_setMemRegionInfo (Uint8 mar, Uint8 pcx, Uint8 pfx)
292     CSL_FINS (hCache->MAR[mar], CGEM_MAR0_PCX, pcx);
293     CSL_FINS (hCache->MAR[mar], CGEM_MAR0_PFX, pfx);
296 /** ============================================================================
297  *   @n@b CACHE_setL1DSize
298  *
299  *   @b Description
300  *   @n This function is used to set the L1 Data Cache Size.  
301  *
302  *   @b Arguments
303       @verbatim
304           newSize      Cache Size to be configured.
305      @endverbatim 
306  *
307  *   <b> Return Value </b>  
308  *   @n  None
309  *
310  *   <b> Pre Condition </b>
311  *   @n  None
312  *
313  *   <b> Post Condition </b>
314  *   @n  None
315  *
316  *   @b Writes
317  *   @n CGEM_L1DCFG_L1DMODE
318  *
319  *   @b Example
320  *   @verbatim
321         
322         CACHE_setL1DSize(1); // Configure 4K Cache Size
324      @endverbatim
325  * =============================================================================
326  */
327 static inline void CACHE_setL1DSize (CACHE_L1Size newSize)
329     CSL_FINS (hCache->L1DCFG, CGEM_L1DCFG_L1DMODE, newSize);
332 /** ============================================================================
333  *   @n@b CACHE_getL1DSize
334  *
335  *   @b Description
336  *   @n This function is used to get the L1 Data Cache Size.  
337  *
338  *   @b Arguments
339  *   @n None
340  * 
341  *   <b> Return Value </b>  
342  *   @n  None
343  *
344  *   <b> Pre Condition </b>
345  *   @n  None
346  *
347  *   <b> Post Condition </b>
348  *   @n  None
349  *
350  *   @b Reads
351  *   @n CGEM_L1DCFG_L1DMODE
352  *
353  *   @b Example
354  *   @verbatim
355         CACHE_L1Size cacheSize;
356         
357         cacheSize = CACHE_getL1DSize();
359      @endverbatim
360  * =============================================================================
361  */
362 static inline CACHE_L1Size CACHE_getL1DSize (void)
364     return (CACHE_L1Size)CSL_FEXT (hCache->L1DCFG, CGEM_L1DCFG_L1DMODE);
367 /** ============================================================================
368  *   @n@b CACHE_freezeL1D
369  *
370  *   @b Description
371  *   @n This function is used to freeze the L1D cache.  
372  *
373  *   @b Arguments
374  *   @n None
375  *
376  *   <b> Return Value </b>  
377  *   @n  None
378  *
379  *   <b> Pre Condition </b>
380  *   @n  None
381  *
382  *   <b> Post Condition </b>
383  *   @n  None
384  *
385  *   @b Writes
386  *   @n CGEM_L1DCC_OPER=1
387  *
388  *   @b Example
389  *   @verbatim
390         
391         CACHE_freezeL1D();
393      @endverbatim
394  * =============================================================================
395  */
396 static inline void CACHE_freezeL1D(void)
398     /* Set the Freeze Mode Enabled bit. */
399     CSL_FINS (hCache->L1DCC, CGEM_L1DCC_OPER, 1);
402 /** ============================================================================
403  *   @n@b CACHE_unfreezeL1D
404  *
405  *   @b Description
406  *   @n This function is used to unfreeze the L1D cache.  
407  *
408  *   @b Arguments
409  *   @n None
410  *
411  *   <b> Return Value </b>  
412  *   @n  None
413  *
414  *   <b> Pre Condition </b>
415  *   @n  None
416  *
417  *   <b> Post Condition </b>
418  *   @n  None
419  *
420  *   @b Writes
421  *   @n CGEM_L1DCC_OPER=0
422  *
423  *   @b Example
424  *   @verbatim
425         
426         CACHE_unfreezeL1D();
428      @endverbatim
429  * =============================================================================
430  */
431 static inline void CACHE_unfreezeL1D(void)
433     /* Reset the Freeze Mode Enabled bit. */
434     CSL_FINS (hCache->L1DCC, CGEM_L1DCC_OPER, 0);
437 /** ============================================================================
438  *   @n@b CACHE_getPrevL1DMode
439  *
440  *   @b Description
441  *   @n This function is used get the previous operating state of the L1D cache 
442  *
443  *   @b Arguments
444  *   @n None
445  *
446  *   <b> Return Value </b>  
447  *   @n  None
448  *
449  *   <b> Pre Condition </b>
450  *   @n  None
451  *
452  *   <b> Post Condition </b>
453  *   @n  None
454  *
455  *   @b Reads
456  *   @n CGEM_L1DCC_POPER
457  *
458  *   @b Example
459  *   @verbatim
460         Uint32 prev;
461         
462         prev = CACHE_getPrevL1DMode();
464      @endverbatim
465  * =============================================================================
466  */
467 static inline Uint32 CACHE_getPrevL1DMode(void)
469     return CSL_FEXT (hCache->L1DCC, CGEM_L1DCC_POPER);    
472 /** ============================================================================
473  *   @n@b CACHE_invAllL1dWait
474  *
475  *   @b Description
476  *   @n This function is used to wait for the L1D global invalidate operation
477  *      to complete. This API should be used only if the CACHE_invAllL1d was called
478  *      with the CACHE_NOWAIT argument. 
479  *
480  *   @b Arguments
481  *   @n None
482  *
483  *   <b> Return Value </b>  
484  *   @n  None
485  *
486  *   <b> Pre Condition </b>
487  *   @n  @a CACHE_invAllL1d(wait=CACHE_NOWAIT) must be called.
488  *
489  *   <b> Post Condition </b>
490  *   @n  None
491  *
492  *   @b Reads
493  *   @n CGEM_L1DINV_I=0
494  *
495  *   @b Example
496  *   @verbatim
497                 
498         CACHE_invAllL1d(CACHE_NOWAIT); // Invalidate the L1D cache
499         ...        
500         CACHE_invAllL1dWait();        // Wait for the invalidate operation to complete.
502      @endverbatim
503  * =============================================================================
504  */
505 static inline void CACHE_invAllL1dWait (void)
507     /* Wait for the Invalidate operation to complete. */
508     while (CSL_FEXT(hCache->L1DINV, CGEM_L1DINV_I) == 1);
511 /** ============================================================================
512  *   @n@b CACHE_invAllL1d
513  *
514  *   @b Description
515  *   @n This function is used to globally invalidate the L1D cache.  
516  *
517  *   @b Arguments
518       @verbatim
519           wait          Indicates if the call should block or not.
520      @endverbatim 
521  *
522  *   <b> Return Value </b>  
523  *   @n  None
524  *
525  *   <b> Pre Condition </b>
526  *   @n  None
527  *
528  *   <b> Post Condition </b>
529  *   @n  The L1D Cache is being invalidated. 
530  *
531  *   @b Writes
532  *   @n CGEM_L1DINV_I=1
533  *
534  *   @b Example
535  *   @verbatim
536         
537         CACHE_invAllL1d(CACHE_WAIT); // Invalidate the L1D cache 
539      @endverbatim
540  * =============================================================================
541  */
542 static inline void CACHE_invAllL1d (CACHE_Wait wait)
544    uint32_t gie, advisory6;
546    if ( (wait == CACHE_WAIT ) ||
547             (wait == CACHE_FENCE_WAIT) )
548       advisory6 = 1;
549    else
550       advisory6 = 0;
551    
552    if ( advisory6 ) 
553    {
554      /* disable the interrupts */
555          gie = _disable_interrupts ();
556      CSL_XMC_invalidatePrefetchBuffer();
557    }
558         
559    /* Invalidate the Cache Line. */
560    CSL_FINS (hCache->L1DINV, CGEM_L1DINV_I, 1); 
561     
562    /* Determine if we need to wait for the operation to complete. */
563    if (wait)
564      CACHE_invAllL1dWait();
566    if (advisory6) 
567    {
568      asm   (" nop      4");
569      asm   (" nop      4");
570      asm   (" nop      4");
571      asm   (" nop      4");
572      _restore_interrupts (gie); 
573    }    
576 /** ============================================================================
577  *   @n@b CACHE_wbAllL1dWait
578  *
579  *   @b Description
580  *   @n This function is used to wait for the L1D writeback operation
581  *      to complete. This API should be used only if the CACHE_wbAllL1d was called
582  *      with the CACHE_NOWAIT argument. 
583  *
584  *   @b Arguments
585  *   @n None
586  *
587  *   <b> Return Value </b>  
588  *   @n  None
589  *
590  *   <b> Pre Condition </b>
591  *   @n  @a CACHE_wbAllL1d(wait=CACHE_NOWAIT) must be called.
592  *
593  *   <b> Post Condition </b>
594  *   @n  The L1D Dirty lines are written back
595  *
596  *   @b Reads
597  *   @n CGEM_L1DWB_C=0
598  *
599  *   @b Example
600  *   @verbatim
601                 
602         CACHE_wbAllL1d(CACHE_NOWAIT); // Writeback the L1D cache
603         ...        
604         CACHE_wbAllL1dWait();        // Wait for the writeback operation to complete.
606      @endverbatim
607  * =============================================================================
608  */
609 static inline void CACHE_wbAllL1dWait (void)
611     /* Wait for the Writeback operation to complete. */
612     while (CSL_FEXT(hCache->L1DWB, CGEM_L1DWB_C) == 1);
615 /** ============================================================================
616  *   @n@b CACHE_wbAllL1d
617  *
618  *   @b Description
619  *   @n This function is used to writeback the dirty lines of the L1D Cache  
620  *
621  *   @b Arguments
622       @verbatim
623           wait          Indicates if the call should block or not.
624      @endverbatim 
625  *
626  *   <b> Return Value </b>  
627  *   @n  None
628  *
629  *   <b> Pre Condition </b>
630  *   @n  None
631  *
632  *   <b> Post Condition </b>
633  *   @n  The dirty lines of the L1D Cache are being written back 
634  *
635  *   @b Writes
636  *   @n CGEM_L1DWB_C=1
637  *
638  *   @b Example
639  *   @verbatim
640         
641         CACHE_wbAllL1d(CACHE_WAIT); // Writeback the Dirty Lines of the L1D cache 
643      @endverbatim
644  * =============================================================================
645  */
646 static inline void CACHE_wbAllL1d (CACHE_Wait wait)
648         uint32_t gie, advisory6;
649         
650         if ( (wait == CACHE_WAIT ) ||
651                  (wait == CACHE_FENCE_WAIT) )
652            advisory6 = 1;
653         else
654            advisory6 = 0;
655         
656         if ( advisory6 ) 
657         {
658                 /* disable the interrupts */
659                 gie = _disable_interrupts ();
660         }
662         /* Writeback the Cache Line. */
663     CSL_FINS (hCache->L1DWB, CGEM_L1DWB_C, 1); 
664     
665     /* Determine if we need to wait for the operation to complete. */
666     if (wait)
667         CACHE_wbAllL1dWait();
669     if (advisory6) 
670     {
671        asm   (" nop      4");
672        asm   (" nop      4");
673        asm   (" nop      4");
674        asm   (" nop      4");
675        _restore_interrupts (gie);       
676     }   
679 /** ============================================================================
680  *   @n@b CACHE_wbInvAllL1dWait
681  *
682  *   @b Description
683  *   @n This function is used to wait for the L1D writeback invalidate operation
684  *      to complete. This API should be used only if the CACHE_wbInvAllL1d was called
685  *      with the CACHE_NOWAIT argument. 
686  *
687  *   @b Arguments
688  *   @n None
689  *
690  *   <b> Return Value </b>  
691  *   @n  None
692  *
693  *   <b> Pre Condition </b>
694  *   @n  @a CACHE_wbInvAllL1d(wait=CACHE_NOWAIT) must be called.
695  *
696  *   <b> Post Condition </b>
697  *   @n  The L1D Dirty lines are written back
698  *
699  *   @b Reads
700  *   @n CGEM_L1DWBINV_C=0
701  *
702  *   @b Example
703  *   @verbatim
704                 
705         CACHE_wbInvAllL1d(CACHE_NOWAIT); // Invalidate/Writeback the L1D cache
706         ...        
707         CACHE_wbInvAllL1dWait();        // Wait for the Invalidate/Writeback operation to complete.
709      @endverbatim
710  * =============================================================================
711  */
712 static inline void CACHE_wbInvAllL1dWait (void)
714     /* Wait for the Invalidate Writeback operation to complete. */
715     while (CSL_FEXT(hCache->L1DWBINV, CGEM_L1DWBINV_C) == 1);
718 /** ============================================================================
719  *   @n@b CACHE_wbInvAllL1d
720  *
721  *   @b Description
722  *   @n This function is used to invalidate and writeback the dirty lines of the 
723  *      L1D Cache  
724  *
725  *   @b Arguments
726       @verbatim
727           wait          Indicates if the call should block or not.
728      @endverbatim 
729  *
730  *   <b> Return Value </b>  
731  *   @n  None
732  *
733  *   <b> Pre Condition </b>
734  *   @n  None
735  *
736  *   <b> Post Condition </b>
737  *   @n  Invalidates and Writebacks the dirty lines of the L1D Cache 
738  *
739  *   @b Writes
740  *   @n CGEM_L1DWBINV_C=1
741  *
742  *   @b Example
743  *   @verbatim
744         
745         CACHE_wbInvAllL1d(CACHE_WAIT); 
747      @endverbatim
748  * =============================================================================
749  */
750 static inline void  CACHE_wbInvAllL1d (CACHE_Wait wait)
752         uint32_t gie, advisory6;
753         
754         if ( (wait == CACHE_WAIT ) ||
755                  (wait == CACHE_FENCE_WAIT) )
756                  advisory6 = 1;
757         else
758                  advisory6 = 0;
759         
760         if ( advisory6 ) 
761         {
762                 /* disable the interrupts */
763                 gie = _disable_interrupts ();
764                 CSL_XMC_invalidatePrefetchBuffer();
765         }
766         
767     /* Invalidate and writeback the cache line. */
768     CSL_FINS (hCache->L1DWBINV, CGEM_L1DWBINV_C, 1); 
769     
770     /* Determine if we need to wait for the operation to complete. */
771     if (wait)
772         CACHE_wbInvAllL1dWait();     
774     if (advisory6) 
775     {
776         asm   (" nop      4");
777         asm   (" nop      4");
778         asm   (" nop      4");
779         asm   (" nop      4");
780         _restore_interrupts (gie);      
781     }   
784 /** ============================================================================
785  *   @n@b CACHE_invL1dWait
786  *
787  *   @b Description
788  *   @n This function is used to wait for the L1D invalidate block operation to 
789  *      complete. This API should be used only if the CACHE_invL1d was called 
790  *      with the CACHE_NOWAIT argument. 
791  *
792  *   @b Arguments
793  *   @n None
794  *
795  *   <b> Return Value </b>  
796  *   @n  None
797  *
798  *   <b> Pre Condition </b>
799  *   @n  @a CACHE_invL1d(wait=CACHE_NOWAIT) must be called.
800  *
801  *   <b> Post Condition </b>
802  *   @n  The L1D Block Cache is invalidated. 
803  *
804  *   @b Reads
805  *   @n CGEM_L1DIWC_WC=0
806  *
807  *   @b Example
808  *   @verbatim
809                 
810         CACHE_invL1d((void *)ptr_buffer, 128, CACHE_NOWAIT);
811         ...        
812         CACHE_invL1dWait();        // Wait for the Invalidate/Writeback operation to complete.
814      @endverbatim
815  * =============================================================================
816  */
817 static inline void CACHE_invL1dWait (void)
819     /* Wait for the Invalidate operation to complete. */
820     while (CSL_FEXT(hCache->L1DIWC, CGEM_L1DIWC_WC) != 0);
823 /** ============================================================================
824  *   @n@b CACHE_invL1d
825  *
826  *   @b Description
827  *   @n This function is used to invalidate a block in the L1D Cache. Although
828  *      the block size can be specified in the number of bytes, the cache
829  *      controller operates on whole cache lines. To prevent unintended behavior
830  *      "blockPtr" should be aligned on the cache line size and "byteCnt" should
831  *      be a multiple of the cache line size.
832  *
833  *   @b Arguments
834       @verbatim
835           blockPtr      Address of the block which is to be invalidated
836           byteCnt       Size of the block to be invalidated.
837           wait          Indicates if the call should block or not.
838      @endverbatim 
839  *
840  *   <b> Return Value </b>  
841  *   @n  None
842  *
843  *   <b> Pre Condition </b>
844  *   @n  None
845  *
846  *   <b> Post Condition </b>
847  *   @n  The contents of the blockPtr are being invalidated  
848  *
849  *   @b Writes
850  *   @n CGEM_L1DIBAR_ADDR,CGEM_L1DIWC_WC
851  *
852  *   @b Example
853  *   @verbatim
854         
855         Uint8* ptr_buffer;
856                 
857         // Invalidate 128 bytes of the buffer.
858         CACHE_invL1d((void *)ptr_buffer, 128, CACHE_WAIT); 
860      @endverbatim
861  * =============================================================================
862  */
863 static inline void CACHE_invL1d 
865     void*       blockPtr,
866     Uint32      byteCnt,
867     CACHE_Wait  wait
870         uint32_t gie, advisory6;
871         
872         if ( (wait == CACHE_WAIT ) ||
873                  (wait == CACHE_FENCE_WAIT) )
874                  advisory6 = 1;
875         else
876                  advisory6 = 0;
877         
878         if ( advisory6 ) 
879         {
880                 /* disable the interrupts */
881                 gie = _disable_interrupts ();
882                 CSL_XMC_invalidatePrefetchBuffer();
883         }
885     /* Setup the block address and length */
886     hCache->L1DIBAR = CSL_FMK(CGEM_L1DIBAR_ADDR, (Uint32)blockPtr);
887     hCache->L1DIWC  = CSL_FMK(CGEM_L1DIWC_WC,    (Uint32)((byteCnt+3)>>2));
889     /* Determine if we need to wait for the operation to complete. */
890     if ( (wait == CACHE_WAIT) ||
891                  (wait == CACHE_ONLY_WAIT) )
892         CACHE_invL1dWait();
893     else if ( (wait == CACHE_FENCE_WAIT) ||
894                       (wait == CACHE_FENCE_ONLY_WAIT ) )
895         _mfence();
897    if (advisory6) 
898    {
899         asm   (" nop      4");
900         asm   (" nop      4");
901         asm   (" nop      4");
902         asm   (" nop      4");
903         _restore_interrupts (gie);      
904    }    
907 /** ============================================================================
908  *   @n@b CACHE_wbL1dWait
909  *
910  *   @b Description
911  *   @n This function is used to wait for the L1D writeback block operation to 
912  *      complete. This API should be used only if the CACHE_wbL1d was called 
913  *      with the CACHE_NOWAIT argument. 
914  *
915  *   @b Arguments
916  *   @n None
917  *
918  *   <b> Return Value </b>  
919  *   @n  None
920  *
921  *   <b> Pre Condition </b>
922  *   @n  @a CACHE_wbL1d(wait=CACHE_NOWAIT) must be called.
923  *
924  *   <b> Post Condition </b>
925  *   @n  The dirty lines of the L1D Block Cache have been written back. 
926  *
927  *   @b Reads
928  *   @n CGEM_L1DWWC_WC=0
929  *
930  *   @b Example
931  *   @verbatim
932                 
933         CACHE_wbL1d((void *)ptr_buffer, 128, CACHE_NOWAIT);
934         ...        
935         CACHE_wbL1dWait();        // Wait for the writeback operation to complete.
937      @endverbatim
938  * =============================================================================
939  */
940 static inline void CACHE_wbL1dWait (void)
942     /* Wait for the Writeback operation to complete. */
943     while (CSL_FEXT(hCache->L1DWWC, CGEM_L1DWWC_WC) != 0);    
946 /** ============================================================================
947  *   @n@b CACHE_wbL1d
948  *
949  *   @b Description
950  *   @n This function is used to writeback the dirty lines of the block address.
951  *      Although the block size can be specified in the number of bytes, the cache
952  *      controller operates on whole cache lines. To prevent unintended behavior
953  *      "blockPtr" should be aligned on the cache line size and "byteCnt" should
954  *      be a multiple of the cache line size.
955  *
956  *   @b Arguments
957       @verbatim
958           blockPtr      Address of the block which is to be written back
959           byteCnt       Size of the block to be written back.
960           wait          Indicates if the call should block or not.
961      @endverbatim 
962  *
963  *   <b> Return Value </b>  
964  *   @n  None
965  *
966  *   <b> Pre Condition </b>
967  *   @n  None
968  *
969  *   <b> Post Condition </b>
970  *   @n  The contents of the blockPtr are being written back  
971  *
972  *   @b Writes
973  *   @n CGEM_L1DWBAR_ADDR,CGEM_L1DWWC_WC
974  *
975  *   @b Example
976  *   @verbatim
977         
978         Uint8* ptr_buffer;
979                 
980         // Writeback 128 bytes of the buffer.
981         CACHE_wbL1d((void *)ptr_buffer, 128, CACHE_WAIT); 
983      @endverbatim
984  * =============================================================================
985  */
986 static inline void CACHE_wbL1d 
988     void*       blockPtr,
989     Uint32      byteCnt,
990     CACHE_Wait  wait
993         uint32_t gie, advisory6;
994         
995         if ( (wait == CACHE_WAIT ) ||
996                  (wait == CACHE_FENCE_WAIT) )
997                  advisory6 = 1;
998         else
999                  advisory6 = 0;
1000         
1001         if ( advisory6 ) 
1002         {
1003                 /* disable the interrupts */
1004                 gie = _disable_interrupts ();
1005         }
1007     /* Setup the block address and length */
1008     hCache->L1DWBAR = CSL_FMK (CGEM_L1DWBAR_ADDR, (Uint32)blockPtr);
1009     hCache->L1DWWC  = CSL_FMK (CGEM_L1DWWC_WC,    (Uint32)((byteCnt+3)>>2));
1011     /* Determine if we need to wait for the operation to complete. */
1012     if ( (wait == CACHE_WAIT) ||
1013                  (wait == CACHE_ONLY_WAIT ) )
1014         CACHE_wbL1dWait();
1015     else if ( (wait == CACHE_FENCE_WAIT) ||
1016                       (wait == CACHE_FENCE_ONLY_WAIT) )
1017         _mfence();
1019     if (advisory6) 
1020     {
1021         asm   (" nop      4");
1022         asm   (" nop      4");
1023         asm   (" nop      4");
1024         asm   (" nop      4");
1025         _restore_interrupts (gie);      
1026     }   
1029 /** ============================================================================
1030  *   @n@b CACHE_wbInvL1dWait
1031  *
1032  *   @b Description
1033  *   @n This function is used to wait for the L1D invalidate/writeback block 
1034  *      operation to complete. This API should be used only if the CACHE_wbInvL1d 
1035  *      was called with the CACHE_NOWAIT argument. 
1036  *
1037  *   @b Arguments
1038  *   @n None
1039  *
1040  *   <b> Return Value </b>  
1041  *   @n  None
1042  *
1043  *   <b> Pre Condition </b>
1044  *   @n  @a CACHE_wbInvL1d(wait=CACHE_NOWAIT) must be called.
1045  *
1046  *   <b> Post Condition </b>
1047  *   @n  The dirty lines of the L1D Block Cache have been written back and the cache
1048  *       contents pointed to by the block address are also invalidated.
1049  *
1050  *   @b Reads
1051  *   @n CGEM_L1DWIWC_WC=0
1052  *
1053  *   @b Example
1054  *   @verbatim
1055                 
1056         CACHE_wbInvL1d((void *)ptr_buffer, 128, CACHE_NOWAIT);
1057         ...        
1058         CACHE_wbInvL1dWait();        // Wait for the operation to complete.
1060      @endverbatim
1061  * =============================================================================
1062  */
1063 static inline void CACHE_wbInvL1dWait (void)
1065     /* Wait for the Block Writeback/Invalidate operation to complete. */
1066     while (CSL_FEXT(hCache->L1DWIWC, CGEM_L1DWIWC_WC) != 0);
1069 /** ============================================================================
1070  *   @n@b CACHE_wbInvL1d
1071  *
1072  *   @b Description
1073  *   @n This function is used to invalidate and writeback the dirty lines 
1074  *      of the block address.  Although the block size can be specified in 
1075  *      the number of bytes, the cache controller operates on whole cache lines. 
1076  *      To prevent unintended behavior "blockPtr" should be aligned on the 
1077  *      cache line size and "byteCnt" should be a multiple of the cache line size.
1078  *
1079  *   @b Arguments
1080       @verbatim
1081           blockPtr      Address of the block which is to be invalidated/written back
1082           byteCnt       Size of the block to be invalidated/written back.
1083           wait          Indicates if the call should block or not.
1084      @endverbatim 
1085  *
1086  *   <b> Return Value </b>  
1087  *   @n  None
1088  *
1089  *   <b> Pre Condition </b>
1090  *   @n  None
1091  *
1092  *   <b> Post Condition </b>
1093  *   @n  The contents of the blockPtr are being invalidated and the dirty lines are
1094  *       written back  
1095  *
1096  *   @b Writes
1097  *   @n CGEM_L1DWIBAR_ADDR,CGEM_L1DWIWC_WC
1098  *
1099  *   @b Example
1100  *   @verbatim
1101         
1102         Uint8* ptr_buffer;
1103                 
1104         // Writeback/Invalidate 128 bytes of the buffer.
1105         CACHE_wbInvL1d((void *)ptr_buffer, 128, CACHE_WAIT); 
1107      @endverbatim
1108  * =============================================================================
1109  */
1110 static inline void CACHE_wbInvL1d 
1112     void*       blockPtr,
1113     Uint32      byteCnt,
1114     CACHE_Wait  wait
1117         uint32_t gie, advisory6;
1118         
1119         if ( (wait == CACHE_WAIT ) ||
1120                  (wait == CACHE_FENCE_WAIT) )
1121                  advisory6 = 1;
1122         else
1123                  advisory6 = 0;
1124         
1125         if ( advisory6 ) 
1126         {
1127                 /* disable the interrupts */
1128                 gie = _disable_interrupts ();
1129                 CSL_XMC_invalidatePrefetchBuffer();
1130         }
1132     /* Setup the block address and length */
1133     hCache->L1DWIBAR = CSL_FMK(CGEM_L1DWIBAR_ADDR, (Uint32)blockPtr);
1134     hCache->L1DWIWC  = CSL_FMK(CGEM_L1DWIWC_WC,    (Uint32)((byteCnt+3)>>2));
1135  
1136     /* Determine if we need to wait for the operation to complete. */
1137     if ( (wait == CACHE_WAIT) ||
1138                  (wait == CACHE_ONLY_WAIT) )
1139         CACHE_wbInvL1dWait();
1140     else if ( (wait == CACHE_FENCE_WAIT) ||
1141                       (wait == CACHE_FENCE_ONLY_WAIT) )
1142         _mfence();
1144     if (advisory6) 
1145     {
1146         asm   (" nop      4");
1147         asm   (" nop      4");
1148         asm   (" nop      4");
1149         asm   (" nop      4");
1150         _restore_interrupts (gie);      
1151     }   
1154 /** ============================================================================
1155  *   @n@b CACHE_setL1PSize
1156  *
1157  *   @b Description
1158  *   @n This function is used to set the L1P Cache Size.  
1159  *
1160  *   @b Arguments
1161       @verbatim
1162           newSize      Cache Size to be configured.
1163      @endverbatim 
1164  *
1165  *   <b> Return Value </b>  
1166  *   @n  None
1167  *
1168  *   <b> Pre Condition </b>
1169  *   @n  None
1170  *
1171  *   <b> Post Condition </b>
1172  *   @n  None
1173  *
1174  *   @b Writes
1175  *   @n CGEM_L1PCFG_L1PMODE
1176  *
1177  *   @b Example
1178  *   @verbatim
1179         
1180         CACHE_setL1PSize(1); // Configure 4K Cache Size
1182      @endverbatim
1183  * =============================================================================
1184  */
1185 static inline void CACHE_setL1PSize (CACHE_L1Size newSize)
1187     CSL_FINS (hCache->L1PCFG, CGEM_L1PCFG_L1PMODE, newSize);
1190 /** ============================================================================
1191  *   @n@b CACHE_getL1PSize
1192  *
1193  *   @b Description
1194  *   @n This function is used to get the L1P Cache Size.  
1195  *
1196  *   @b Arguments
1197  *   @n None
1198  * 
1199  *   <b> Return Value </b>  
1200  *   @n  None
1201  *
1202  *   <b> Pre Condition </b>
1203  *   @n  None
1204  *
1205  *   <b> Post Condition </b>
1206  *   @n  None
1207  *
1208  *   @b Reads
1209  *   @n CGEM_L1PCFG_L1PMODE
1210  *
1211  *   @b Example
1212  *   @verbatim
1213         CACHE_L1Size cacheSize;
1214         
1215         cacheSize = CACHE_getL1PSize();
1217      @endverbatim
1218  * =============================================================================
1219  */
1220 static inline CACHE_L1Size CACHE_getL1PSize (void)
1222     return (CACHE_L1Size)CSL_FEXT (hCache->L1PCFG, CGEM_L1PCFG_L1PMODE);
1225 /** ============================================================================
1226  *   @n@b CACHE_freezeL1P
1227  *
1228  *   @b Description
1229  *   @n This function is used to freeze the L1P cache.  
1230  *
1231  *   @b Arguments
1232  *   @n None
1233  *
1234  *   <b> Return Value </b>  
1235  *   @n  None
1236  *
1237  *   <b> Pre Condition </b>
1238  *   @n  None
1239  *
1240  *   <b> Post Condition </b>
1241  *   @n  None
1242  *
1243  *   @b Writes
1244  *   @n CGEM_L1PCC_OPER=1
1245  *
1246  *   @b Example
1247  *   @verbatim
1248         
1249         CACHE_freezeL1P();
1251      @endverbatim
1252  * =============================================================================
1253  */
1254 static inline void CACHE_freezeL1P(void)
1256     /* Set the Freeze Mode Enabled bit. */
1257     CSL_FINS (hCache->L1PCC, CGEM_L1PCC_OPER, 1);
1260 /** ============================================================================
1261  *   @n@b CACHE_unfreezeL1P
1262  *
1263  *   @b Description
1264  *   @n This function is used to unfreeze the L1D cache.  
1265  *
1266  *   @b Arguments
1267  *   @n None
1268  *
1269  *   <b> Return Value </b>  
1270  *   @n  None
1271  *
1272  *   <b> Pre Condition </b>
1273  *   @n  None
1274  *
1275  *   <b> Post Condition </b>
1276  *   @n  None
1277  *
1278  *   @b Writes
1279  *   @n CGEM_L1PCC_OPER=0
1280  *
1281  *   @b Example
1282  *   @verbatim
1283         
1284         CACHE_unfreezeL1D();
1286      @endverbatim
1287  * =============================================================================
1288  */
1289 static inline void CACHE_unfreezeL1P(void)
1291     /* Reset the Freeze Mode Enabled bit. */
1292     CSL_FINS (hCache->L1PCC, CGEM_L1PCC_OPER, 0);
1295 /** ============================================================================
1296  *   @n@b CACHE_getPrevL1PMode
1297  *
1298  *   @b Description
1299  *   @n This function is used get the previous operating state of the L1P cache 
1300  *
1301  *   @b Arguments
1302  *   @n None
1303  *
1304  *   <b> Return Value </b>  
1305  *   @n  None
1306  *
1307  *   <b> Pre Condition </b>
1308  *   @n  None
1309  *
1310  *   <b> Post Condition </b>
1311  *   @n  None
1312  *
1313  *   @b Reads
1314  *   @n CGEM_L1PCC_POPER
1315  *
1316  *   @b Example
1317  *   @verbatim
1318         Uint32  prev;
1319         
1320         prev = CACHE_getPrevL1PMode();
1322      @endverbatim
1323  * =============================================================================
1324  */
1325 static inline Uint32 CACHE_getPrevL1PMode(void)
1327     return CSL_FEXT (hCache->L1PCC, CGEM_L1PCC_POPER);    
1330 /** ============================================================================
1331  *   @n@b CACHE_invL1pWait
1332  *
1333  *   @b Description
1334  *   @n This function is used to wait for the L1D invalidate block operation to 
1335  *      complete. This API should be used only if the CACHE_invL1p was called 
1336  *      with the CACHE_NOWAIT argument. 
1337  *
1338  *   @b Arguments
1339  *   @n None
1340  *
1341  *   <b> Return Value </b>  
1342  *   @n  None
1343  *
1344  *   <b> Pre Condition </b>
1345  *   @n  @a CACHE_invL1p(wait=CACHE_NOWAIT) must be called.
1346  *
1347  *   <b> Post Condition </b>
1348  *   @n  The L1D Block Cache is invalidated. 
1349  *
1350  *   @b Reads
1351  *   @n CGEM_L1PIWC_WC=0
1352  *
1353  *   @b Example
1354  *   @verbatim
1355                 
1356         CACHE_invL1p((void *)&foo, 128, CACHE_NOWAIT);
1357         ...        
1358         CACHE_invL1pWait();        // Wait for the Invalidate operation to complete.
1360      @endverbatim
1361  * =============================================================================
1362  */
1363 static inline void CACHE_invL1pWait (void)
1365     /* Wait for the Invalidate operation to complete. */
1366     while (CSL_FEXT(hCache->L1PIWC, CGEM_L1PIWC_WC) != 0);    
1369 /** ============================================================================
1370  *   @n@b CACHE_invL1p
1371  *
1372  *   @b Description
1373  *   @n This function is used to invalidate the L1P Cache pointed by the block 
1374  *      address. Although the block size can be specified in the number of bytes, 
1375  *      the cache controller operates on whole cache lines. To prevent unintended 
1376  *      behavior "blockPtr" should be aligned on the cache line size and "byteCnt" 
1377  *      should be a multiple of the cache line size.
1378  *
1379  *   @b Arguments
1380       @verbatim
1381           blockPtr      Address of the block which is to be invalidated
1382           byteCnt       Size of the block to be invalidated.
1383           wait          Indicates if the call should block or not.
1384      @endverbatim 
1385  *
1386  *   <b> Return Value </b>  
1387  *   @n  None
1388  *
1389  *   <b> Pre Condition </b>
1390  *   @n  None
1391  *
1392  *   <b> Post Condition </b>
1393  *   @n  The contents of the blockPtr are being invalidated
1394  *
1395  *   @b Writes
1396  *   @n CGEM_L1PIBAR_ADDR,CGEM_L1PIWC_WC
1397  *
1398  *   @b Example
1399  *   @verbatim
1400  
1401         // Invalidate the 128 bytes of the function 'foo'
1402         CACHE_invL1p((void *)&foo, 128, CACHE_WAIT); 
1404      @endverbatim
1405  * =============================================================================
1406  */
1407 static inline void CACHE_invL1p 
1409     void*       blockPtr,
1410     Uint32      byteCnt,
1411     CACHE_Wait  wait
1414     /* Setup the block address and length which is to be invalidated */
1415     hCache->L1PIBAR = CSL_FMK(CGEM_L1PIBAR_ADDR, (Uint32)blockPtr);
1416     hCache->L1PIWC  = CSL_FMK(CGEM_L1PIWC_WC,    (Uint32)((byteCnt+3)>>2));
1418     /* Determine if we need to wait for the operation to complete. */
1419     if (wait == CACHE_WAIT)
1420         CACHE_invL1pWait();
1421     else if (wait == CACHE_FENCE_WAIT)
1422         _mfence();
1425 /** ============================================================================
1426  *   @n@b CACHE_invAllL1pWait
1427  *
1428  *   @b Description
1429  *   @n This function is used to wait for the L1P invalidate operation to complete. 
1430  *      This API should be used only if the CACHE_invAllL1p was called with the 
1431  *      CACHE_NOWAIT argument.  
1432  *
1433  *   @b Arguments
1434  *   @n None
1435  *
1436  *   <b> Return Value </b>  
1437  *   @n  None
1438  *
1439  *   <b> Pre Condition </b>
1440  *   @n  @a CACHE_invAllL1p(wait=CACHE_NOWAIT) must be called.
1441  *
1442  *   <b> Post Condition </b>
1443  *   @n  The L1P Cache is invalidated. 
1444  *
1445  *   @b Reads
1446  *   @n CGEM_L1PINV_I=0
1447  *
1448  *   @b Example
1449  *   @verbatim
1450                 
1451         CACHE_invAllL1p(CACHE_NOWAIT);
1452         ...        
1453         CACHE_invAllL1pWait();        // Wait for the Invalidate operation to complete.
1455      @endverbatim
1456  * =============================================================================
1457  */
1458 static inline void CACHE_invAllL1pWait (void)
1460     /* Wait for the Invalidate operation to complete. */
1461     while (CSL_FEXT(hCache->L1PINV, CGEM_L1PINV_I) == 1);    
1464 /** ============================================================================
1465  *   @n@b CACHE_invAllL1p
1466  *
1467  *   @b Description
1468  *   @n This function is used to invalidate the entire L1P Cache 
1469  *
1470  *   @b Arguments
1471       @verbatim
1472           wait          Indicates if the call should block or not.
1473      @endverbatim 
1474  *
1475  *   <b> Return Value </b>  
1476  *   @n  None
1477  *
1478  *   <b> Pre Condition </b>
1479  *   @n  None
1480  *
1481  *   <b> Post Condition </b>
1482  *   @n  The entire L1P cache is being invalidated.  
1483  *
1484  *   @b Writes
1485  *   @n CGEM_L1PINV_I=1
1486  *
1487  *   @b Example
1488  *   @verbatim
1489          
1490         CACHE_invAllL1p(CACHE_WAIT); 
1492      @endverbatim
1493  * =============================================================================
1494  */
1495 static inline void CACHE_invAllL1p (CACHE_Wait wait)
1497     /* Invalidate the L1P Cache. */
1498     CSL_FINS (hCache->L1PINV, CGEM_L1PINV_I, 1);    
1500     /* Determine if we need to wait for the operation to complete. */
1501     if (wait)
1502         CACHE_invAllL1pWait();
1505 /** ============================================================================
1506  *   @n@b CACHE_setL2Size
1507  *
1508  *   @b Description
1509  *   @n This function is used to set the new size of the L2 Cache.  
1510  *
1511  *   @b Arguments
1512       @verbatim
1513           newSize   New Size of the L2 Cache to be set.
1514      @endverbatim 
1515  *
1516  *   <b> Return Value </b>  
1517  *   @n  None
1518  *
1519  *   <b> Pre Condition </b>
1520  *   @n  None
1521  *
1522  *   <b> Post Condition </b>
1523  *   @n  The L2 Cache is configured to use the new size.  
1524  *
1525  *   @b Writes
1526  *   @n CGEM_L2CFG_L2MODE
1527  *
1528  *   @b Example
1529  *   @verbatim
1530          
1531         CACHE_setL2Size(CACHE_32KCACHE); // Use 32K L2 Cache. 
1533      @endverbatim
1534  * =============================================================================
1535  */
1536 static inline void CACHE_setL2Size (CACHE_L2Size newSize)
1538     /* Set the new L2 cache size. */
1539     CSL_FINS (hCache->L2CFG, CGEM_L2CFG_L2MODE, newSize);
1542 /** ============================================================================
1543  *   @n@b CACHE_getL2Size
1544  *
1545  *   @b Description
1546  *   @n This function is used to get the L2 cache size.  
1547  *
1548  *   @b Arguments
1549  *   @n None
1550  *
1551  *   <b> Return Value </b>  
1552  *   @n  CACHE_L2Size
1553  *
1554  *   <b> Pre Condition </b>
1555  *   @n  None
1556  *
1557  *   <b> Post Condition </b>
1558  *   @n  None  
1559  *
1560  *   @b Reads
1561  *   @n CGEM_L2CFG_L2MODE
1562  *
1563  *   @b Example
1564  *   @verbatim
1565         CACHE_L2Size size;
1566         
1567         size = CACHE_getL2Size(); 
1569      @endverbatim
1570  * =============================================================================
1571  */
1572 static inline CACHE_L2Size CACHE_getL2Size (void)
1573 {    
1574     return (CACHE_L2Size) CSL_FEXT (hCache->L2CFG, CGEM_L2CFG_L2MODE);
1577 /** ============================================================================
1578  *   @n@b CACHE_freezeL2
1579  *
1580  *   @b Description
1581  *   @n This function is used to freeze the L2 Cache  
1582  *
1583  *   @b Arguments
1584  *   @n  None
1585  *
1586  *   <b> Return Value </b>  
1587  *   @n  None
1588  *
1589  *   <b> Pre Condition </b>
1590  *   @n  None
1591  *
1592  *   <b> Post Condition </b>
1593  *   @n  The L2 Cache is frozen.  
1594  *
1595  *   @b Example
1596  *   @verbatim
1597          
1598         CACHE_freezeL2(); 
1600      @endverbatim
1601  * =============================================================================
1602  */
1603 static inline void CACHE_freezeL2 (void)
1605     /* The RL File does not define the L2CC bit so we used the RAW macro to 
1606      * configure the corresponding bit. */
1607     CSL_FINSR(hCache->L2CFG, 3, 3, 1);
1610 /** ============================================================================
1611  *   @n@b CACHE_unfreezeL2
1612  *
1613  *   @b Description
1614  *   @n This function is used to unfreeze the L2 Cache  
1615  *
1616  *   @b Arguments
1617  *   @n  None
1618  *
1619  *   <b> Return Value </b>  
1620  *   @n  None
1621  *
1622  *   <b> Pre Condition </b>
1623  *   @n  None
1624  *
1625  *   <b> Post Condition </b>
1626  *   @n  The L2 Cache is unfrozen  
1627  *
1628  *   @b Example
1629  *   @verbatim
1630          
1631         CACHE_unfreezeL2(); 
1633      @endverbatim
1634  * =============================================================================
1635  */
1636 static inline void CACHE_unfreezeL2 (void)
1638     /* The RL File does not define the L2CC bit so we used the RAW macro to 
1639      * configure the corresponding bit. */
1640     CSL_FINSR(hCache->L2CFG, 3, 3, 0);
1643 /** ============================================================================
1644  *   @n@b CACHE_wbL2Wait
1645  *
1646  *   @b Description
1647  *   @n This function is used to wait for the L2 writeback block operation to 
1648  *      complete. This API should be used only if the CACHE_wbL2 was called 
1649  *      with the CACHE_NOWAIT argument. 
1650  *
1651  *   @b Arguments
1652  *   @n None
1653  *
1654  *   <b> Return Value </b>  
1655  *   @n  None
1656  *
1657  *   <b> Pre Condition </b>
1658  *   @n  @a CACHE_wbL2(wait=CACHE_NOWAIT) must be called.
1659  *
1660  *   <b> Post Condition </b>
1661  *   @n  The dirty lines of the L1D Block Cache have been written back. 
1662  *
1663  *   @b Reads
1664  *   @n CGEM_L2WWC_WC=0
1665  *
1666  *   @b Example
1667  *   @verbatim
1668                 
1669         CACHE_wbL2((void *)ptr_buffer, 128, CACHE_NOWAIT);
1670         ...        
1671         CACHE_wbL2Wait();        // Wait for the writeback operation to complete.
1673      @endverbatim
1674  * =============================================================================
1675  */
1676 static inline void CACHE_wbL2Wait (void)
1678     /* Wait for the Writeback operation to complete. */
1679     while (CSL_FEXT(hCache->L2WWC, CGEM_L2WWC_WC) != 0);        
1682 /** ============================================================================
1683  *   @n@b CACHE_wbL2
1684  *
1685  *   @b Description
1686  *   @n This function is used to writeback the contents of the L2 Cache. Although 
1687  *      the block size can be specified in the number of bytes, the cache 
1688  *      controller operates on whole cache lines. To prevent unintended behavior 
1689  *      "blockPtr" should be aligned on the  cache line size and "byteCnt" 
1690  *      should be a multiple of the cache line size.
1691  *
1692  *   @b Arguments
1693       @verbatim
1694           blockPtr      Address of the block which is to be written back
1695           byteCnt       Size of the block to be written block.
1696           wait          Indicates if the call should block or not.
1697      @endverbatim 
1698  *
1699  *   <b> Return Value </b>  
1700  *   @n  None
1701  *
1702  *   <b> Pre Condition </b>
1703  *   @n  None
1704  *
1705  *   <b> Post Condition </b>
1706  *   @n  The dirty lines of the L2 Cache are being written back.   
1707  *
1708  *   @b Writes
1709  *   @n CGEM_L2WBAR_ADDR,CGEM_L2WWC_WC
1710  *
1711  *   @b Example
1712  *   @verbatim
1713         Uint8* ptr_buffer;
1714         
1715         // Writeback the contents of the buffer. 
1716         CACHE_wbL2(ptr_buffer, 100, CACHE_WAIT); 
1718      @endverbatim
1719  * =============================================================================
1720  */
1721 static inline void CACHE_wbL2 
1723     void*       blockPtr,
1724     Uint32      byteCnt,
1725     CACHE_Wait  wait
1728         uint32_t gie, advisory6;
1729         
1730         if ( (wait == CACHE_WAIT ) ||
1731                  (wait == CACHE_FENCE_WAIT) )
1732                  advisory6 = 1;
1733         else
1734                  advisory6 = 0;
1735         
1736         if ( advisory6 ) 
1737         {
1738                 /* disable the interrupts */
1739                 gie = _disable_interrupts ();
1740         }
1742     /* Setup the block address and length */
1743     hCache->L2WBAR = CSL_FMK (CGEM_L2WBAR_ADDR, (Uint32)blockPtr);    
1744     hCache->L2WWC  = CSL_FMK (CGEM_L2WWC_WC,    (Uint32)((byteCnt+3)>>2));
1746     /* Determine if we need to wait for the operation to complete. */
1747     if ( (wait == CACHE_WAIT) ||
1748                  (wait == CACHE_ONLY_WAIT) )
1749         CACHE_wbL2Wait();
1750     else if ( (wait == CACHE_FENCE_WAIT) ||
1751                       (wait == CACHE_FENCE_ONLY_WAIT) )
1752         _mfence();
1754     if (advisory6) 
1755     {
1756         asm   (" nop      4");
1757         asm   (" nop      4");
1758         asm   (" nop      4");
1759         asm   (" nop      4");
1760         _restore_interrupts (gie);      
1761     }   
1764 /** ============================================================================
1765  *   @n@b CACHE_invL2Wait
1766  *
1767  *   @b Description
1768  *   @n This function is used to wait for the L2 invalidate block operation to 
1769  *      complete. This API should be used only if the CACHE_invL2 was called 
1770  *      with the CACHE_NOWAIT argument. 
1771  *
1772  *   @b Arguments
1773  *   @n None
1774  *
1775  *   <b> Return Value </b>  
1776  *   @n  None
1777  *
1778  *   <b> Pre Condition </b>
1779  *   @n  @a CACHE_invL2(wait=CACHE_NOWAIT) must be called.
1780  *
1781  *   <b> Post Condition </b>
1782  *   @n  Invalidate the contents of the L2 Cache. 
1783  *
1784  *   @b Reads
1785  *   @n CGEM_L2IWC_WC=0
1786  *
1787  *   @b Example
1788  *   @verbatim
1789                 
1790         CACHE_invL2((void *)ptr_buffer, 128, CACHE_NOWAIT);
1791         ...        
1792         CACHE_invL2Wait();        // Wait for the Invalidate operation to complete.
1794      @endverbatim
1795  * =============================================================================
1796  */
1797 static inline void CACHE_invL2Wait (void)
1799     /* Wait for the Invalidate operation to complete. */
1800     while (CSL_FEXT(hCache->L2IWC, CGEM_L2IWC_WC) != 0);        
1803 /** ============================================================================
1804  *   @n@b CACHE_invL2
1805  *
1806  *   @b Description
1807  *   @n This function is used to invalidate the contents of the L2 Cache. 
1808  *      Although the block size can be specified in  the number of bytes, 
1809  *      the cache controller operates on whole cache lines. To prevent unintended 
1810  *      behavior "blockPtr" should be aligned on the cache line size and "byteCnt" 
1811  *      should be a multiple of the cache line size.
1812  *
1813  *   @b Arguments
1814       @verbatim
1815           blockPtr      Address of the block which is to be invalidated
1816           byteCnt       Size of the block to be invalidated.
1817           wait          Indicates if the call should block or not.
1818      @endverbatim 
1819  *
1820  *   <b> Return Value </b>  
1821  *   @n  None
1822  *
1823  *   <b> Pre Condition </b>
1824  *   @n  None
1825  *
1826  *   <b> Post Condition </b>
1827  *   @n  The contents of the L2 Cache are being invalidated.   
1828  *
1829  *   @b Writes
1830  *   @n CGEM_L2IBAR_ADDR,CGEM_L2IWC_WC
1831  *
1832  *   @b Example
1833  *   @verbatim
1834         Uint8* ptr_buffer;
1835         
1836         // Invalidate the contents of the buffer. 
1837         CACHE_invL2(ptr_buffer, 100, CACHE_WAIT); 
1839      @endverbatim
1840  * =============================================================================
1841  */
1842 static inline void CACHE_invL2 
1844     void*       blockPtr,
1845     Uint32      byteCnt,
1846     CACHE_Wait  wait
1849         uint32_t gie, advisory6;
1850         
1851         if ( (wait == CACHE_WAIT ) ||
1852                  (wait == CACHE_FENCE_WAIT) )
1853                  advisory6 = 1;
1854         else
1855                  advisory6 = 0;
1856         
1857         if ( advisory6 ) 
1858         {
1859                 /* disable the interrupts */
1860                 gie = _disable_interrupts ();
1861                 CSL_XMC_invalidatePrefetchBuffer();
1862         }
1864     /* Setup the block address and length */
1865     hCache->L2IBAR = CSL_FMK (CGEM_L2IBAR_ADDR, (Uint32)blockPtr);    
1866     hCache->L2IWC  = CSL_FMK (CGEM_L2IWC_WC,    (Uint32)((byteCnt+3)>>2));
1868     /* Determine if we need to wait for the operation to complete. */
1869     if ( (wait == CACHE_WAIT) ||
1870                  (wait == CACHE_ONLY_WAIT) )
1871         CACHE_invL2Wait();
1872     else if ((wait == CACHE_FENCE_WAIT) ||
1873                      (wait == CACHE_FENCE_ONLY_WAIT))
1874         _mfence();
1876     if (advisory6) 
1877     {
1878         asm   (" nop      4");
1879         asm   (" nop      4");
1880         asm   (" nop      4");
1881         asm   (" nop      4");
1882         _restore_interrupts (gie);      
1883     }   
1886 /** ============================================================================
1887  *   @n@b CACHE_wbInvL2Wait
1888  *
1889  *   @b Description
1890  *   @n This function is used to wait for the L2 Writeback & invalidate block 
1891  *      operation to complete. This API should be used only if the CACHE_wbInvL2 
1892  *      was called with the CACHE_NOWAIT argument. 
1893  *
1894  *   @b Arguments
1895  *   @n None
1896  *
1897  *   <b> Return Value </b>  
1898  *   @n  None
1899  *
1900  *   <b> Pre Condition </b>
1901  *   @n  @a CACHE_wbInvL2(wait=CACHE_NOWAIT) must be called.
1902  *
1903  *   <b> Post Condition </b>
1904  *   @n  Invalidate the contents of the L2 Cache. 
1905  *
1906  *   @b Reads
1907  *   @n CGEM_L2WIWC_WC=0
1908  *
1909  *   @b Example
1910  *   @verbatim
1911                 
1912         CACHE_wbInvL2((void *)ptr_buffer, 128, CACHE_NOWAIT);
1913         ...        
1914         CACHE_wbInvL2Wait();  // Wait for the Writeback-Invalidate operation to complete.
1916      @endverbatim
1917  * =============================================================================
1918  */
1919 static inline void CACHE_wbInvL2Wait (void)
1921     /* Wait for the Writeback & Invalidate operation to complete. */
1922     while (CSL_FEXT(hCache->L2WIWC, CGEM_L2WIWC_WC) != 0);        
1925 /** ============================================================================
1926  *   @n@b CACHE_wbInvL2
1927  *
1928  *   @b Description
1929  *   @n This function is used to write back and invalidate the contents of the L2 Cache.
1930  *      Although the block size can be specified in the number of bytes, 
1931  *      the cache controller operates on whole cache lines. To prevent unintended 
1932  *      behavior "blockPtr" should be aligned on the cache line size and "byteCnt" 
1933  *      should be a multiple of the cache line size.
1934  *
1935  *   @b Arguments
1936       @verbatim
1937           blockPtr      Address of the block which is to be written back & invalidated
1938           byteCnt       Size of the block to be written back & invalidated.
1939           wait          Indicates if the call should block or not.
1940      @endverbatim 
1941  *
1942  *   <b> Return Value </b>  
1943  *   @n  None
1944  *
1945  *   <b> Pre Condition </b>
1946  *   @n  None
1947  *
1948  *   <b> Post Condition </b>
1949  *   @n  The contents of the L2 Cache are being written back & invalidated.   
1950  *
1951  *   @b Writes
1952  *   @n CGEM_L2WIBAR_ADDR,CGEM_L2WIWC_WC
1953  *
1954  *   @b Example
1955  *   @verbatim
1956         Uint8* ptr_buffer;
1957         
1958         // Invalidate the contents of the buffer. 
1959         CACHE_wbInvL2(ptr_buffer, 100, CACHE_WAIT); 
1961      @endverbatim
1962  * =============================================================================
1963  */
1964 static inline void CACHE_wbInvL2 (
1965     void*       blockPtr,
1966     Uint32      byteCnt,
1967     CACHE_Wait  wait
1970         uint32_t gie, advisory6;
1971         
1972         if ( (wait == CACHE_WAIT ) ||
1973                  (wait == CACHE_FENCE_WAIT) )
1974                  advisory6 = 1;
1975         else
1976                  advisory6 = 0;
1977         
1978         if ( advisory6 ) 
1979         {
1980                 /* disable the interrupts */
1981                 gie = _disable_interrupts ();
1982                 CSL_XMC_invalidatePrefetchBuffer();
1983         }
1985     /* Setup the block address and length */
1986     hCache->L2WIBAR = CSL_FMK(CGEM_L2WIBAR_ADDR, (Uint32)blockPtr);
1987     hCache->L2WIWC  = CSL_FMK(CGEM_L2WIWC_WC,    (Uint32)((byteCnt+3)>>2));
1988  
1989     /* Determine if we need to wait for the operation to complete. */
1990     if ( (wait == CACHE_WAIT) ||
1991                  (wait == CACHE_ONLY_WAIT) )
1992         CACHE_wbInvL2Wait();
1993     else if ( (wait == CACHE_FENCE_WAIT) ||
1994                       (wait == CACHE_FENCE_ONLY_WAIT) )
1995         _mfence();
1997     if (advisory6) 
1998     {
1999         asm   (" nop      4");
2000         asm   (" nop      4");
2001         asm   (" nop      4");
2002         asm   (" nop      4");
2003         _restore_interrupts (gie);      
2004     }   
2007 /** ============================================================================
2008  *   @n@b CACHE_wbAllL2Wait
2009  *
2010  *   @b Description
2011  *   @n This function is used to wait for the L2 Writeback & invalidate operation 
2012  *      to complete. This API should be used only if the CACHE_wbAllL2 was called 
2013  *      with the CACHE_NOWAIT argument.   
2014  *
2015  *   @b Arguments
2016  *   @n  None
2017  *
2018  *   <b> Return Value </b>  
2019  *   @n  None
2020  *
2021  *   <b> Pre Condition </b>
2022  *   @n  @a CACHE_wbAllL2(wait=CACHE_NOWAIT) must be called.
2023  *
2024  *   <b> Post Condition </b>
2025  *   @n  The contents of the L2 Cache have been written back
2026  *
2027  *   @b Reads
2028  *   @n CGEM_L2WB_C=0
2029  *
2030  *   @b Example
2031  *   @verbatim
2032         
2033         // Writeback the contents of the L2 Cache.
2034         CACHE_wbAllL2(CACHE_NOWAIT);
2035         
2036         // Wait for the operation to complete. 
2037         CACHE_wbAllL2Wait(); 
2039      @endverbatim
2040  * =============================================================================
2041  */
2042 static inline void CACHE_wbAllL2Wait (void)
2044     /* Wait for the writeback operation to complete. */
2045     while (CSL_FEXT(hCache->L2WB, CGEM_L2WB_C) == 1);    
2048 /** ============================================================================
2049  *   @n@b CACHE_wbAllL2
2050  *
2051  *   @b Description
2052  *   @n This function is used to write back all the contents of the L2 Cache.  
2053  *
2054  *   @b Arguments
2055       @verbatim
2056           wait          Indicates if the call should block or not.
2057      @endverbatim 
2058  *
2059  *   <b> Return Value </b>  
2060  *   @n  None
2061  *
2062  *   <b> Pre Condition </b>
2063  *   @n  None
2064  *
2065  *   <b> Post Condition </b>
2066  *   @n  The contents of the L2 Cache are being written back.   
2067  *
2068  *   @b Writes
2069  *   @n CGEM_L2WB_C=1
2070  *
2071  *   @b Example
2072  *   @verbatim
2073         
2074         // Writeback the contents of the L2 Cache. 
2075         CACHE_wbAllL2(CACHE_WAIT); 
2077      @endverbatim
2078  * =============================================================================
2079  */
2080 static inline void CACHE_wbAllL2 (CACHE_Wait wait)
2082         uint32_t gie, advisory6;
2083         
2084         if ( (wait == CACHE_WAIT ) ||
2085                  (wait == CACHE_FENCE_WAIT) )
2086                  advisory6 = 1;
2087         else
2088                  advisory6 = 0;
2089         
2090         if ( advisory6 ) 
2091         {
2092                 /* disable the interrupts */
2093                 gie = _disable_interrupts ();   
2094         }
2096     CSL_FINS (hCache->L2WB, CGEM_L2WB_C, 1);
2097     
2098     /* Determine if we need to wait for the operation to complete. */
2099     if (wait)
2100         CACHE_wbAllL2Wait();
2102     if (advisory6) 
2103     {
2104         asm   (" nop      4");
2105         asm   (" nop      4");
2106         asm   (" nop      4");
2107         asm   (" nop      4");
2108         _restore_interrupts (gie);      
2109     }   
2112 /** ============================================================================
2113  *   @n@b CACHE_invAllL2Wait
2114  *
2115  *   @b Description
2116  *   @n This function is used to wait for the L2 Invalidate operation to complete. 
2117  *      This API should be used only if the CACHE_invAllL2 was called with the 
2118  *      CACHE_NOWAIT argument.   
2119  *
2120  *   @b Arguments
2121  *   @n  None
2122  *
2123  *   <b> Return Value </b>  
2124  *   @n  None
2125  *
2126  *   <b> Pre Condition </b>
2127  *   @n  @a CACHE_invAllL2(wait=CACHE_NOWAIT) must be called.
2128  *
2129  *   <b> Post Condition </b>
2130  *   @n  The contents of the L2 Cache have been invalidated   
2131  *
2132  *   @b Reads
2133  *   @n CGEM_L2INV_I=0
2134  *
2135  *   @b Example
2136  *   @verbatim
2137         
2138         // Invalidate the contents of the L2 Cache.
2139         CACHE_invAllL2(CACHE_NOWAIT);
2140         
2141         // Wait for the operation to complete. 
2142         CACHE_invAllL2Wait(); 
2144      @endverbatim
2145  * =============================================================================
2146  */
2147 static inline void CACHE_invAllL2Wait (void)
2149     /* Wait for the invalidate operation to complete. */
2150     while (CSL_FEXT(hCache->L2INV, CGEM_L2INV_I) == 1);    
2153 /** ============================================================================
2154  *   @n@b CACHE_invAllL2
2155  *
2156  *   @b Description
2157  *   @n This function is used to invalidate all the contents of the L2 Cache.  
2158  *
2159  *   @b Arguments
2160       @verbatim
2161           wait          Indicates if the call should block or not.
2162      @endverbatim 
2163  *
2164  *   <b> Return Value </b>  
2165  *   @n  None
2166  *
2167  *   <b> Pre Condition </b>
2168  *   @n  None
2169  *
2170  *   <b> Post Condition </b>
2171  *   @n  The contents of the L2 Cache are being invalidated.   
2172  *
2173  *   @b Writes
2174  *   @n CGEM_L2INV_I=1 
2175  *
2176  *   @b Example
2177  *   @verbatim
2178         
2179         // Invalidate the contents of the L2 Cache. 
2180         CACHE_invAllL2(CACHE_WAIT); 
2182      @endverbatim
2183  * =============================================================================
2184  */
2185 static inline void CACHE_invAllL2 (CACHE_Wait wait)
2187         uint32_t gie, advisory6;
2188         
2189         if ( (wait == CACHE_WAIT ) ||
2190                  (wait == CACHE_FENCE_WAIT) )
2191                  advisory6 = 1;
2192         else
2193                  advisory6 = 0;
2194         
2195         if ( advisory6 ) 
2196         {
2197                 /* disable the interrupts */
2198                 gie = _disable_interrupts ();
2199                 CSL_XMC_invalidatePrefetchBuffer();
2200         }
2202     CSL_FINS (hCache->L2INV, CGEM_L2INV_I, 1);
2203     
2204     /* Determine if we need to wait for the operation to complete. */
2205     if (wait)
2206         CACHE_invAllL2Wait();  
2208     if (advisory6) 
2209     {
2210         asm   (" nop      4");
2211         asm   (" nop      4");
2212         asm   (" nop      4");
2213         asm   (" nop      4");
2214         _restore_interrupts (gie);      
2215     }   
2218 /** ============================================================================
2219  *   @n@b CACHE_wbInvAllL2Wait
2220  *
2221  *   @b Description
2222  *   @n This function is used to wait for the L2 Writeback and Invalidate 
2223  *      operation to complete. This API should be used only if the CACHE_wbInvAllL2 was 
2224  *      called with the CACHE_NOWAIT argument.   
2225  *
2226  *   @b Arguments
2227  *   @n  None
2228  *
2229  *   <b> Return Value </b>  
2230  *   @n  None
2231  *
2232  *   <b> Pre Condition </b>
2233  *   @n  @a CACHE_wbInvAllL2(wait=CACHE_NOWAIT) must be called.
2234  *
2235  *   <b> Post Condition </b>
2236  *   @n  The contents of the L2 Cache have been invalidated and written back
2237  *
2238  *   @b Reads
2239  *   @n CGEM_L2WBINV_C=0
2240  *
2241  *   @b Example
2242  *   @verbatim
2243         
2244         // Writeback & Invalidate the contents of the L2 Cache.
2245         CACHE_wbInvAllL2(CACHE_NOWAIT);
2246         
2247         // Wait for the operation to complete. 
2248         CACHE_wbInvAllL2Wait(); 
2250      @endverbatim
2251  * =============================================================================
2252  */
2253 static inline void CACHE_wbInvAllL2Wait (void)
2255     /* Wait for the writeback-invalidate operation to complete. */
2256     while (CSL_FEXT(hCache->L2WBINV, CGEM_L2WBINV_C) == 1);    
2259 /** ============================================================================
2260  *   @n@b CACHE_wbInvAllL2
2261  *
2262  *   @b Description
2263  *   @n This function is used to writeback and invalidate all the contents of the L2 Cache.  
2264  *
2265  *   @b Arguments
2266       @verbatim
2267           wait          Indicates if the call should block or not.
2268      @endverbatim 
2269  *
2270  *   <b> Return Value </b>  
2271  *   @n  None
2272  *
2273  *   <b> Pre Condition </b>
2274  *   @n  None
2275  *
2276  *   <b> Post Condition </b>
2277  *   @n  The contents of the L2 Cache are being written back & invalidated.   
2278  *
2279  *   @b Writes
2280  *   @n CGEM_L2WBINV_C=1
2281  *
2282  *   @b Example
2283  *   @verbatim
2284         
2285         // Invalidate the contents of the L2 Cache. 
2286         CACHE_wbInvAllL2(CACHE_WAIT); 
2288      @endverbatim
2289  * =============================================================================
2290  */
2291 static inline void CACHE_wbInvAllL2 (CACHE_Wait wait)
2293         uint32_t gie, advisory6;
2294         
2295         if ( (wait == CACHE_WAIT ) ||
2296                  (wait == CACHE_FENCE_WAIT) )
2297                  advisory6 = 1;
2298         else
2299                  advisory6 = 0;
2300         
2301         if ( advisory6 ) 
2302         {
2303                 /* disable the interrupts */
2304                 gie = _disable_interrupts ();
2305                 CSL_XMC_invalidatePrefetchBuffer();
2306         }
2308     CSL_FINS (hCache->L2WBINV, CGEM_L2WBINV_C, 1);
2309     
2310     /* Determine if we need to wait for the operation to complete. */
2311     if (wait)
2312         CACHE_wbInvAllL2Wait();  
2314     if (advisory6) 
2315     {
2316         asm   (" nop      4");
2317         asm   (" nop      4");
2318         asm   (" nop      4");
2319         asm   (" nop      4");
2320         _restore_interrupts (gie);      
2321     }   
2324 /**
2325 @}
2326 */
2328 #ifdef __cplusplus
2330 #endif
2332 #endif /*CSL_CACHEAUX_H_*/