1 /* ============================================================================
2 * Copyright (c) Texas Instruments Incorporated 2008, 2009
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 *
11 * Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the
14 * distribution.
15 *
16 * Neither the name of Texas Instruments Incorporated nor the names of
17 * its contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 */
34 /**
35 * @file csl_xmcAux.h
36 *
37 * @brief
38 * API Auxilary header file for XMC CSL. It gives the definitions of the
39 * status query & control functions.
40 *
41 * \par
42 * ============================================================================
43 * @n (C) Copyright 2008, 2009, Texas Instruments, Inc.
44 * @n Use of this software is controlled by the terms and conditions found
45 * @n in the license agreement under which this software has been supplied.
46 * ===========================================================================
47 * \par
48 */
50 #ifndef _CSL_XMCAUX_H_
51 #define _CSL_XMCAUX_H_
53 #ifdef __cplusplus
54 extern "C" {
55 #endif
57 #include <ti/csl/csl_xmc.h>
59 /** @addtogroup CSL_XMC_FUNCTION
60 @{ */
62 /** ============================================================================
63 * @n@b CSL_XMC_setXMPAXH
64 *
65 * @b Description
66 * @n This function sets the contents of XMPAXH register indicated by the
67 * index here.
68 * please see section 7.3 on MPAX unit http://www.ti.com/lit/sprugw0
69 * for details on the sample arguments and example values to set
70 * XMPAXH register as provided under table 7-2
71 *
72 * @b Arguments
73 @verbatim
74 index Index into the set of 16 registers (0-15)
75 mpaxh CSL_XMC_XMPAXH structure that needs to be set into the
76 register
77 @endverbatim
78 *
79 * <b> Return Value </b>
80 * @n None
81 *
82 * <b> Pre Condition </b>
83 * @n None
84 *
85 * <b> Post Condition </b>
86 * @n Corresponding XMPAXH register configured with the value passed.
87 *
88 * @b Writes
89 * @n XMC_XMPAXH_SEGSZ, XMC_XMPAXH_BADDR
90 *
91 * @b Example
92 * @verbatim
93 Uint32 index = 0;
94 CSL_XMC_XMPAXH mpaxh;
96 mpaxh.segSize = 4;
97 mpaxh.baseAddress = 0x1000;
99 CSL_XMC_setXMPAXH (index, &mpaxh);
101 @endverbatim
102 * =============================================================================
103 */
104 static inline void CSL_XMC_setXMPAXH
105 (
106 Uint32 index,
107 CSL_XMC_XMPAXH* mpaxh
108 )
109 {
110 hXmc->XMPAX[index].XMPAXH = CSL_FMK(XMC_XMPAXH_SEGSZ, mpaxh->segSize) |
111 CSL_FMK(XMC_XMPAXH_BADDR, mpaxh->bAddr);
112 }
114 /** ============================================================================
115 * @n@b CSL_XMC_setXMPAXL
116 *
117 * @b Description
118 * @n This function sets the contents of XMPAXL register corresponding to the
119 * index specified.
120 * please see section 7.3 on MPAX unit http://www.ti.com/lit/sprugw0
121 * for details on the sample arguments and example values to set
122 * XMPAXL register as provided under table 7-2
123 *
124 * @b Arguments
125 @verbatim
126 index Index into the set of 16 registers (0-15)
127 mpaxl CSL_XMC_XMPAXL structure that needs to be set into the
128 register
129 @endverbatim
130 *
131 * <b> Return Value </b>
132 * @n None
133 *
134 * <b> Pre Condition </b>
135 * @n None
136 *
137 * <b> Post Condition </b>
138 * @n Corresponding XMPAXL register configured with the value passed.
139 *
140 * @b Writes
141 * @n XMC_XMPAXL_RADDR,
142 * XMC_XMPAXL_UX,
143 * XMC_XMPAXL_UW,
144 * XMC_XMPAXL_UR,
145 * XMC_XMPAXL_SX,
146 * XMC_XMPAXL_SW,
147 * XMC_XMPAXL_SR
148 *
149 * @b Example
150 * @verbatim
151 Uint32 index = 0;
152 CSL_XMC_XMPAXL mpaxl;
154 mpaxl.ux = 1;
155 mpaxl.uw = 1;
156 mpaxl.ur = 1;
157 mpaxl.sx = 1;
158 mpaxl.sw = 1;
159 mpaxl.sr = 1;
160 mpaxl.rAddr = 0x4000 ;
162 CSL_XMC_setXMPAXL (index, &mpaxl);
164 @endverbatim
165 * =============================================================================
166 */
167 static inline void CSL_XMC_setXMPAXL
168 (
169 Uint32 index,
170 CSL_XMC_XMPAXL* mpaxl
171 )
172 {
173 Uint32 value = 0;
175 /* Configure the XMPAXL register specified by the index. */
176 CSL_FINS (value, XMC_XMPAXL_UX, mpaxl->ux);
177 CSL_FINS (value, XMC_XMPAXL_UW, mpaxl->uw);
178 CSL_FINS (value, XMC_XMPAXL_UR, mpaxl->ur);
179 CSL_FINS (value, XMC_XMPAXL_SX, mpaxl->sx);
180 CSL_FINS (value, XMC_XMPAXL_SW, mpaxl->sw);
181 CSL_FINS (value, XMC_XMPAXL_SR, mpaxl->sr);
182 CSL_FINS (value, XMC_XMPAXL_RADDR, mpaxl->rAddr);
184 hXmc->XMPAX[index].XMPAXL = value;
185 }
187 /** ============================================================================
188 * @n@b CSL_XMC_getXMPAXH
189 *
190 * @b Description
191 * @n This function gets the contents of XMPAXH register.
192 *
193 * please see section 7.3 on MPAX unit http://www.ti.com/lit/sprugw0
194 * for details on the sample arguments and example values to set
195 * XMPAXH register as provided under table 7-2
196 *
197 * @b Arguments
198 @verbatim
199 index Index into the set of 16 XMPAXH registers
200 mpaxh CSL_XMC_XMPAXH structure that needs to be populated with
201 XMPAXH register contents.
202 @endverbatim
203 *
204 * <b> Return Value </b>
205 * @n None
206 *
207 * <b> Pre Condition </b>
208 * @n None
209 *
210 * <b> Post Condition </b>
211 * @n None
212 *
213 * @b Reads
214 * @n XMC_XMPAXH_SEGSZ, XMC_XMPAXH_BADDR
215 *
216 * @b Example
217 * @verbatim
218 Uint32 index = 0;
219 CSL_XMC_XMPAXH mpaxh;
221 CSL_XMC_getXMPAXH (index, &mpaxh);
223 @endverbatim
224 * =============================================================================
225 */
226 static inline void CSL_XMC_getXMPAXH
227 (
228 Uint32 index,
229 CSL_XMC_XMPAXH* mpaxh
230 )
231 {
232 Uint32 value = hXmc->XMPAX[index].XMPAXH;
234 /* Retrieve contents of XMPAXH register specified by the index */
235 mpaxh->segSize = CSL_FEXT (value, XMC_XMPAXH_SEGSZ);
236 mpaxh->bAddr = CSL_FEXT (value, XMC_XMPAXH_BADDR);
237 }
239 /** ============================================================================
240 * @n@b CSL_XMC_getXMPAXL
241 *
242 * @b Description
243 * @n This function gets the contents of XMPAXL register.
244 *
245 * please see section 7.3 on MPAX unit http://www.ti.com/lit/sprugw0
246 * for details on the sample arguments and example values to set
247 * XMPAXL register as provided under table 7-2
248 *
249 * @b Arguments
250 @verbatim
251 index Index into the set of 16 registers
252 mpaxl CSL_XMC_XMPAXL structure that needs to be populated with
253 XMPAXL register contents.
254 @endverbatim
255 *
256 * <b> Return Value </b>
257 * @n None
258 *
259 * <b> Pre Condition </b>
260 * @n None
261 *
262 * <b> Post Condition </b>
263 * @n None
264 *
265 * @b Reads
266 * @n XMC_XMPAXL_RADDR,
267 * XMC_XMPAXL_UX,
268 * XMC_XMPAXL_UW,
269 * XMC_XMPAXL_UR,
270 * XMC_XMPAXL_SX,
271 * XMC_XMPAXL_SW,
272 * XMC_XMPAXL_SR
273 *
274 * @b Example
275 * @verbatim
276 Uint32 index = 0;
277 CSL_XMC_XMPAXL mpaxl;
279 CSL_XMC_getXMPAXL (index, &mpaxl);
281 @endverbatim
282 * =============================================================================
283 */
284 static inline void CSL_XMC_getXMPAXL (
285 Uint32 index,
286 CSL_XMC_XMPAXL * mpaxl
287 )
288 {
289 Uint32 value = hXmc->XMPAX[index].XMPAXL;
291 /* Retrieve contents of XMPAXL register using the index specified */
292 mpaxl->rAddr = CSL_FEXT (value, XMC_XMPAXL_RADDR);
293 mpaxl->sr = CSL_FEXT (value, XMC_XMPAXL_SR);
294 mpaxl->sw = CSL_FEXT (value, XMC_XMPAXL_SW);
295 mpaxl->sx = CSL_FEXT (value, XMC_XMPAXL_SX);
296 mpaxl->ur = CSL_FEXT (value, XMC_XMPAXL_UR);
297 mpaxl->uw = CSL_FEXT (value, XMC_XMPAXL_UW);
298 mpaxl->ux = CSL_FEXT (value, XMC_XMPAXL_UX);
299 }
301 /** ============================================================================
302 * @n@b CSL_XMC_getFaultAddress
303 *
304 * @b Description
305 * @n This function gets the access address causing the fault.
306 *
307 * @b Arguments
308 * @n None
309 *
310 * <b> Return Value </b> Uint32
311 *
312 * <b> Pre Condition </b>
313 * @n None
314 *
315 * <b> Post Condition </b>
316 * @n None
317 *
318 * @b Reads
319 * @n XMC_XMPFAR_FADDR
320 *
321 * @b Example
322 * @verbatim
323 Uint32 faultAddr;
325 faultAddr = CSL_XMC_getFaultAddress ();
327 @endverbatim
328 * =============================================================================
329 */
330 static inline Uint32 CSL_XMC_getFaultAddress (void)
331 {
332 return CSL_FEXT (hXmc->XMPFAR, XMC_XMPFAR_FADDR);
333 }
335 /** ============================================================================
336 * @n@b CSL_XMC_clearFault
337 *
338 * @b Description
339 * @n This function clears the fault information.
340 *
341 * @b Arguments
342 * @n None
343 *
344 * <b> Return Value </b>
345 * @n None
346 *
347 * <b> Pre Condition </b>
348 * @n None
349 *
350 * <b> Post Condition </b>
351 * @n XMPFCR register configured with the value passed. Fault
352 * address and status registers are cleared.
353 *
354 * @b Writes
355 * @n XMC_XMPFCR_MPFCLR=1
356 *
357 * @b Affects
358 * @n XMC_XMPFAR_FADDR=0,
359 * XMC_XMPFSR_LOCAL=0,
360 * XMC_XMPFSR_SR=0,
361 * XMC_XMPFSR_SX=0,
362 * XMC_XMPFSR_UR=0,
363 * XMC_XMPFSR_UW=0,
364 * XMC_XMPFSR_UW=0
365 *
366 * @b Example
367 * @verbatim
368 CSL_XMC_clearFault ();
370 @endverbatim
371 * =============================================================================
372 */
373 static inline void CSL_XMC_clearFault (void)
374 {
375 hXmc->XMPFCR = CSL_FMK(XMC_XMPFCR_MPFCLR, 1);
376 }
378 /** ============================================================================
379 * @n@b CSL_XMC_getFaultStatus
380 *
381 * @b Description
382 * @n This function gets the contents of Fault Status Register XMPFSR.
383 *
384 * @b Arguments
385 @verbatim
386 xmpfsr CSL_XMC_MPFSR structure that needs to be filled in from
387 XMPFSR register
388 @endverbatim
389 *
390 * <b> Return Value </b>
391 * @n None
392 *
393 * <b> Pre Condition </b>
394 * @n None
395 *
396 * <b> Post Condition </b>
397 * @n None
398 *
399 * @b Reads
400 * @n XMC_XMPFSR_LOCAL,
401 * XMC_XMPFSR_SR,
402 * XMC_XMPFSR_SX,
403 * XMC_XMPFSR_UR,
404 * XMC_XMPFSR_UW,
405 * XMC_XMPFSR_UW
406 *
407 * @b Example
408 * @verbatim
409 CSL_XMC_MPFSR xmpfsr;
411 CSL_XMC_getFaultStatus (&xmpfsr);
413 @endverbatim
414 * =============================================================================
415 */
416 static inline void CSL_XMC_getFaultStatus (CSL_XMC_MPFSR * xmpfsr)
417 {
418 Uint32 value = hXmc->XMPFSR;
420 xmpfsr->local = CSL_FEXT (value, XMC_XMPFSR_LOCAL);
421 xmpfsr->sr = CSL_FEXT (value, XMC_XMPFSR_SR);
422 xmpfsr->sw = CSL_FEXT (value, XMC_XMPFSR_SW);
423 xmpfsr->sx = CSL_FEXT (value, XMC_XMPFSR_SX);
424 xmpfsr->ur = CSL_FEXT (value, XMC_XMPFSR_UR);
425 xmpfsr->uw = CSL_FEXT (value, XMC_XMPFSR_UW);
426 xmpfsr->ux = CSL_FEXT (value, XMC_XMPFSR_UX);
427 }
429 /** ============================================================================
430 * @n@b CSL_XMC_invalidatePrefetchBuffer
431 *
432 * @b Description
433 * @n This function when called marks all slots in the data prefetch buffer and program
434 * prefetch buffer invalid by writing 1 in the XPFCMD register's INV bit.
435 *
436 * @b Arguments
437 * @n None
438 *
439 * <b> Return Value </b>
440 * @n None
441 *
442 * <b> Pre Condition </b>
443 * @n None
444 *
445 * <b> Post Condition </b>
446 * @n CSL_XMC_XPFCMD_INV bit set to 1 and data and program prefetch buffers are
447 * invalidated.
448 *
449 * @b Writes
450 * @n XMC_XPFCMD_INV=1
451 *
452 * @b Affects
453 * @n XMC_XPFADDR_DVH=0,
454 * XMC_XPFADDR_DVL=0
455 *
456 *
457 * @b Example
458 * @verbatim
459 *
460 CSL_XMC_invalidatePrefetchBuffer ();
462 @endverbatim
463 * =============================================================================
464 */
465 static inline void CSL_XMC_invalidatePrefetchBuffer (void)
466 {
467 hXmc->XPFCMD = CSL_FMK(XMC_XPFCMD_INV, 1);
468 }
470 /** ============================================================================
471 * @n@b CSL_XMC_loadAnalysisCounterEnable
472 *
473 * @b Description
474 * @n This function when called sets the 'ACENL' bit of the XPFCMD register, thus
475 * triggering a copy/load of ACEN bits (Analysis counter enable mode) into
476 * ACEN bits of XPFACS register.
477 *
478 * @b Arguments
479 * @n None
480 *
481 * <b> Return Value </b>
482 * @n None
483 *
484 * <b> Pre Condition </b>
485 * @n None
486 *
487 * <b> Post Condition </b>
488 * @n CSL_XMC_XPFCMD_ACENL bit set to 1 and ACEN bits value is loaded into the
489 * ACEN bits of XPFACS register.
490 *
491 * @b Writes
492 * @n XMC_XPFCMD_ACENL=1
493 *
494 * @b Affects
495 * @n XMC_XPFACS_ACEN
496 *
497 * @b Example
498 * @verbatim
499 *
500 CSL_XMC_loadAnalysisCounterEnable ();
502 @endverbatim
503 * =============================================================================
504 */
505 static inline void CSL_XMC_loadAnalysisCounterEnable (void)
506 {
507 hXmc->XPFCMD = CSL_FMK (XMC_XPFCMD_ACENL, 1);
508 }
510 /** ============================================================================
511 * @n@b CSL_XMC_setAnalysisCounterEnableMode
512 *
513 * @b Description
514 * @n This function when called sets up the Event counting mode by writing to
515 * the 'ACEN' bits of the XPFCMD register.
516 *
517 * @b Arguments
518 @verbatim
519 acenMode Analyis counter mode.
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 CSL_XMC_XPFCMD_ACEN bits written with the Analysis counter mode specified.
530 *
531 * @b Writes
532 * @n XMC_XPFCMD_ACEN
533 *
534 * @b Example
535 * @verbatim
537 // Enable both program and data events
538 CSL_XMC_setAnalysisCounterEnableMode (CSL_XMC_ACEN_MODE_COUNT_ALL);
540 @endverbatim
541 * =============================================================================
542 */
543 static inline void CSL_XMC_setAnalysisCounterEnableMode (CSL_XMC_ACEN_MODE acenMode)
544 {
545 uint32_t acen;
547 acen = CSL_FMK(XMC_XPFCMD_ACEN, acenMode);
548 acen |= CSL_FMK (XMC_XPFCMD_ACENL, 1);
550 /* Set all the information for enabling the ACEN at one shot */
551 hXmc->XPFCMD = acen;
552 }
554 /** ============================================================================
555 * @n@b CSL_XMC_resetAnalysisCounters
556 *
557 * @b Description
558 * @n This function when called sets the 'ACRST' bit of the XPFCMD register, thus
559 * triggering a clear/reset operation on the prefetch analysis counter registers.
560 *
561 * @b Arguments
562 * @n None
563 *
564 * <b> Return Value </b>
565 * @n None
566 *
567 * <b> Pre Condition </b>
568 * @n None
569 *
570 * <b> Post Condition </b>
571 * @n CSL_XMC_XPFCMD_ACRST bit set to 1 and prefetch analysis counter registers
572 * are cleared.
573 *
574 * @b Writes
575 * @n XMC_XPFCMD_ACRST=1
576 *
577 * @b Affects
578 * @n XMC_XPFAC0_SENT=0,
579 * XMC_XPFAC1_CANCELED=0,
580 * XMC_XPFAC2_HIT=0,
581 * XMC_XPFAC3_MISS=0
582 *
583 *
584 * @b Example
585 * @verbatim
586 *
587 CSL_XMC_resetAnalysisCounters ();
589 @endverbatim
590 * =============================================================================
591 */
592 static inline void CSL_XMC_resetAnalysisCounters (void)
593 {
594 hXmc->XPFCMD = CSL_FMK(XMC_XPFCMD_ACRST, 1);
595 }
597 /** ============================================================================
598 * @n@b CSL_XMC_setPrefetchCommand
599 *
600 * @b Description
601 * @n This function sets up the contents of the XPFCMD register based on the
602 * inputs specified.
603 *
604 * @b Arguments
605 @verbatim
606 inv Invalidate Prefetch Buffer command flag. When set to 1,
607 data and program prefetch buffers are invalidated.
608 acEnLoad Analysis Counter Enable Load flag. When set to 1, the
609 Analysis Counter Enable mode is loaded into the XPFACS status
610 register.
611 acEnMode Analyis counter enable mode. Specifies the event counting mode
612 for the prefetcher.
613 acRst Analysis counter Reset flag. When set to 1, resets all
614 the prefetch event counters.
615 @endverbatim
616 *
617 * <b> Return Value </b>
618 * @n None
619 *
620 * <b> Pre Condition </b>
621 * @n None
622 *
623 * <b> Post Condition </b>
624 * @n CSL_XMC_XPFCMD written with the settings specified.
625 *
626 * @b Writes
627 * @n XMC_XPFCMD_INV,
628 * XMC_XPFCMD_ACENL,
629 * XMC_XPFCMD_ACEN,
630 * XMC_XPFCMD_ACRST
631 *
632 * @b Example
633 * @verbatim
634 // Issue the following prefetch commands:
635 // - Dont invalidate prefetch buffers
636 // - Enable Analysis Counter Enable load
637 // - Enable both program and data event counting
638 // - Dont reset the prefetch counters
639 CSL_XMC_setPrefetchCommand (0, 1, CSL_XMC_ACEN_MODE_COUNT_ALL, 0);
641 @endverbatim
642 * =============================================================================
643 */
644 static inline void CSL_XMC_setPrefetchCommand
645 (
646 Uint8 inv,
647 Uint8 acEnLoad,
648 CSL_XMC_ACEN_MODE acenMode,
649 Uint8 acRst
650 )
651 {
652 hXmc->XPFCMD = CSL_FMK (XMC_XPFCMD_INV, inv) |
653 CSL_FMK (XMC_XPFCMD_ACENL, acEnLoad) |
654 CSL_FMK (XMC_XPFCMD_ACEN, acenMode) |
655 CSL_FMK (XMC_XPFCMD_ACRST, acRst);
656 }
658 /** ============================================================================
659 * @n@b CSL_XMC_getAnalysisCounterEnableStatus
660 *
661 * @b Description
662 * @n This function returns the Analysis counter enable mode by reading the
663 * contents of 'ACEN' bits from the XPFACS register.
664 *
665 * @b Arguments
666 * @n None
667 *
668 * <b> Return Value </b> CSL_XMC_ACEN_MODE - Event counting mode
669 *
670 * <b> Pre Condition </b>
671 * @n None
672 *
673 * <b> Post Condition </b>
674 * @n CSL_XMC_XPFACS_ACEN bits read and returned
675 *
676 * @b Reads
677 * @n XMC_XPFACS_ACEN
678 *
679 * @b Example
680 * @verbatim
681 CSL_XMC_ACEN_MODE acenMode;
683 // Read ACEN Mode Status
684 acenMode = CSL_XMC_getAnalysisCounterEnableStatus ();
685 if (acenMode == CSL_XMC_ACEN_MODE_COUNT_DISABLE)
686 {
687 ...
688 }
690 @endverbatim
691 * =============================================================================
692 */
693 static inline CSL_XMC_ACEN_MODE CSL_XMC_getAnalysisCounterEnableStatus (void)
694 {
695 return (CSL_XMC_ACEN_MODE) CSL_FEXT (hXmc->XPFACS, XMC_XPFACS_ACEN);
696 }
698 /** ============================================================================
699 * @n@b CSL_XMC_getNumPrefetchSent
700 *
701 * @b Description
702 * @n This function returns the contents of XPFAC0 register, i.e., the number
703 * of prefetch requests sent into the system.
704 *
705 * @b Arguments
706 * @n None
707 *
708 * <b> Return Value </b> Uint32
709 *
710 * <b> Pre Condition </b>
711 * @n None
712 *
713 * <b> Post Condition </b>
714 * @n None
715 *
716 * @b Reads
717 * @n XMC_XPFAC0_SENT
718 *
719 * @b Example
720 * @verbatim
721 Uint32 numPrefetchSent;
723 // Read Prefetch request sent count
724 numPrefetchSent = CSL_XMC_getNumPrefetchSent ();
726 @endverbatim
727 * =============================================================================
728 */
729 static inline Uint32 CSL_XMC_getNumPrefetchSent (void)
730 {
731 return CSL_FEXT (hXmc->XPFAC0, XMC_XPFAC0_SENT);
732 }
734 /** ============================================================================
735 * @n@b CSL_XMC_getNumPrefetchCanceled
736 *
737 * @b Description
738 * @n This function returns the contents of XPFAC1 register, i.e., the number
739 * of prefetch requests canceled (prefetch requests that returned a non-zero
740 * rstatus or other error).
741 *
742 * @b Arguments
743 * @n None
744 *
745 * <b> Return Value </b> Uint32
746 *
747 * <b> Pre Condition </b>
748 * @n None
749 *
750 * <b> Post Condition </b>
751 * @n None
752 *
753 * @b Reads
754 * @n XMC_XPFAC1_CANCELED
755 *
756 * @b Example
757 * @verbatim
758 Uint32 numPrefetchCanceled;
760 // Read Prefetch request canceled
761 numPrefetchCanceled = CSL_XMC_getNumPrefetchCanceled ();
763 @endverbatim
764 * =============================================================================
765 */
766 static inline Uint32 CSL_XMC_getNumPrefetchCanceled (void)
767 {
768 return CSL_FEXT (hXmc->XPFAC1, XMC_XPFAC1_CANCELED);
769 }
771 /** ============================================================================
772 * @n@b CSL_XMC_getNumPrefetchHits
773 *
774 * @b Description
775 * @n This function returns the contents of XPFAC2 register, i.e., the number
776 * of demand prefetch requests that resulted in a successful prefetch.
777 *
778 * @b Arguments
779 * @n None
780 *
781 * <b> Return Value </b> Uint32
782 *
783 * <b> Pre Condition </b>
784 * @n None
785 *
786 * <b> Post Condition </b>
787 * @n None
788 *
789 * @b Reads
790 * @n XMC_XPFAC2_HIT
791 *
792 * @b Example
793 * @verbatim
794 Uint32 numPrefetchHits;
796 // Read Number of Prefetch request hits
797 numPrefetchHits = CSL_XMC_getNumPrefetchHits ();
799 @endverbatim
800 * =============================================================================
801 */
802 static inline Uint32 CSL_XMC_getNumPrefetchHits (void)
803 {
804 return CSL_FEXT (hXmc->XPFAC2, XMC_XPFAC2_HIT);
805 }
807 /** ============================================================================
808 * @n@b CSL_XMC_getNumPrefetchMisses
809 *
810 * @b Description
811 * @n This function returns the contents of XPFAC3 register, i.e., the number
812 * of prefetch requests that resulted in a miss and had to be submitted as
813 * a demand prefetch request into the system.
814 *
815 * @b Arguments
816 * @n None
817 *
818 * <b> Return Value </b> Uint32
819 *
820 * <b> Pre Condition </b>
821 * @n None
822 *
823 * <b> Post Condition </b>
824 * @n None
825 *
826 * @b Reads
827 * @n XMC_XPFAC3_MISS
828 *
829 * @b Example
830 * @verbatim
831 Uint32 numPrefetchMisses;
833 // Read Number of Prefetch request misses
834 numPrefetchMisses = CSL_XMC_getNumPrefetchMisses ();
836 @endverbatim
837 * =============================================================================
838 */
839 static inline Uint32 CSL_XMC_getNumPrefetchMisses (void)
840 {
841 return CSL_FEXT (hXmc->XPFAC3, XMC_XPFAC3_MISS);
842 }
844 /** ============================================================================
845 * @n@b CSL_XMC_getPrefetchAddress
846 *
847 * @b Description
848 * @n This function gets the contents of XPFADDR register.
849 *
850 * @b Arguments
851 @verbatim
852 index Index into the set of 8 registers
853 xpfaddr CSL_XMC_XPFADDR structure that needs to be filled from
854 XPFADDR register
855 @endverbatim
856 *
857 * <b> Return Value </b>
858 * @n None
859 *
860 * <b> Pre Condition </b>
861 * @n None
862 *
863 * <b> Post Condition </b>
864 * @n None
865 *
866 * @b Reads
867 * @n XMC_XPFADDR_ADDR,
868 * XMC_XPFADDR_DIR,
869 * XMC_XPFADDR_DPH,
870 * XMC_XPFADDR_DVH,
871 * XMC_XPFADDR_AVH,
872 * XMC_XPFADDR_DPL,
873 * XMC_XPFADDR_DVL,
874 * XMC_XPFADDR_AVL
875 *
876 * @b Example
877 * @verbatim
878 Uint32 index = 0;
879 CSL_XMC_XPFADDR xpfaddr;
881 CSL_XMC_getPrefetchAddress (index, &xpfaddr);
883 @endverbatim
884 * =============================================================================
885 */
886 static inline void CSL_XMC_getPrefetchAddress
887 (
888 Uint32 index,
889 CSL_XMC_XPFADDR* xpfaddr
890 )
891 {
892 Uint32 value = hXmc->XPFADDR[index];
894 xpfaddr->addr = CSL_FEXT (value, XMC_XPFADDR_ADDR);
895 xpfaddr->dir = CSL_FEXT (value, XMC_XPFADDR_DIR);
896 xpfaddr->dph = CSL_FEXT (value, XMC_XPFADDR_DPH);
897 xpfaddr->dvh = CSL_FEXT (value, XMC_XPFADDR_DVH);
898 xpfaddr->avh = CSL_FEXT (value, XMC_XPFADDR_AVH);
899 xpfaddr->dpl = CSL_FEXT (value, XMC_XPFADDR_DPL);
900 xpfaddr->dvl = CSL_FEXT (value, XMC_XPFADDR_DVL);
901 xpfaddr->avl = CSL_FEXT (value, XMC_XPFADDR_AVL);
902 }
904 /** ============================================================================
905 * @n@b CSL_XMC_setMDMAPriority
906 *
907 * @b Description
908 * @n This function configures the priority of transaction submissions to
909 * Master DMA (MDMA).
910 *
911 * @b Arguments
912 @verbatim
913 priority Priority value to set for MDMA transactions.
914 @endverbatim
915 *
916 * <b> Return Value </b>
917 * @n None
918 *
919 * <b> Pre Condition </b>
920 * @n None
921 *
922 * <b> Post Condition </b>
923 * @n None
924 *
925 * @b Writes
926 * @n XMC_MDMAARBX_PRI
927 *
928 * @b Example
929 * @verbatim
930 Uint32 priority = 4;
932 CSL_XMC_setMDMAPriority (priority);
934 @endverbatim
935 * =============================================================================
936 */
937 static inline void CSL_XMC_setMDMAPriority (Uint32 priority)
938 {
939 CSL_FINS (hXmc->MDMAARBX, XMC_MDMAARBX_PRI, priority);
940 }
942 /** ============================================================================
943 * @n@b CSL_XMC_getMDMAPriority
944 *
945 * @b Description
946 * @n This function retrieves the priority of transaction submissions to
947 * Master DMA (MDMA).
948 *
949 * @b Arguments
950 * @n None
951 *
952 * <b> Return Value </b> Uint32
953 *
954 * <b> Pre Condition </b>
955 * @n None
956 *
957 * <b> Post Condition </b>
958 * @n None
959 *
960 * @b Reads
961 * @n XMC_MDMAARBX_PRI
962 *
963 * @b Example
964 * @verbatim
965 Uint32 priority;
967 priority = CSL_XMC_getMDMAPriority ();
969 @endverbatim
970 * =============================================================================
971 */
972 static inline Uint32 CSL_XMC_getMDMAPriority (void)
973 {
974 return CSL_FEXT (hXmc->MDMAARBX, XMC_MDMAARBX_PRI);
975 }
978 #ifdef __cplusplus
979 }
980 #endif
982 /* @} */
983 #endif /* _CSL_XMCAUX_H_ */