1 |
4 |
DFC |
/******************************************************************************
|
2 |
|
|
*
|
3 |
|
|
* Copyright (C) 2002 - 2015 Xilinx, Inc. All rights reserved.
|
4 |
|
|
*
|
5 |
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
6 |
|
|
* of this software and associated documentation files (the "Software"), to deal
|
7 |
|
|
* in the Software without restriction, including without limitation the rights
|
8 |
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9 |
|
|
* copies of the Software, and to permit persons to whom the Software is
|
10 |
|
|
* furnished to do so, subject to the following conditions:
|
11 |
|
|
*
|
12 |
|
|
* The above copyright notice and this permission notice shall be included in
|
13 |
|
|
* all copies or substantial portions of the Software.
|
14 |
|
|
*
|
15 |
|
|
* Use of the Software is limited solely to applications:
|
16 |
|
|
* (a) running on a Xilinx device, or
|
17 |
|
|
* (b) that interact with a Xilinx device through a bus or interconnect.
|
18 |
|
|
*
|
19 |
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
20 |
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
21 |
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
22 |
|
|
* XILINX BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
23 |
|
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
|
24 |
|
|
* OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
25 |
|
|
* SOFTWARE.
|
26 |
|
|
*
|
27 |
|
|
* Except as contained in this notice, the name of the Xilinx shall not be used
|
28 |
|
|
* in advertising or otherwise to promote the sale, use or other dealings in
|
29 |
|
|
* this Software without prior written authorization from Xilinx.
|
30 |
|
|
*
|
31 |
|
|
******************************************************************************/
|
32 |
|
|
/*****************************************************************************/
|
33 |
|
|
/**
|
34 |
|
|
*
|
35 |
|
|
* @file xiic_stats.c
|
36 |
|
|
* @addtogroup iic_v3_1
|
37 |
|
|
* @{
|
38 |
|
|
*
|
39 |
|
|
* Contains statistics functions for the XIic component.
|
40 |
|
|
*
|
41 |
|
|
* <pre>
|
42 |
|
|
* MODIFICATION HISTORY:
|
43 |
|
|
*
|
44 |
|
|
* Ver Who Date Changes
|
45 |
|
|
* ----- --- ------- -----------------------------------------------
|
46 |
|
|
* 1.01b jhl 3/26/02 repartioned the driver
|
47 |
|
|
* 1.01c ecm 12/05/02 new rev
|
48 |
|
|
* 1.13a wgr 03/22/07 Converted to new coding style.
|
49 |
|
|
* 2.00a ktn 10/22/09 Converted all register accesses to 32 bit access.
|
50 |
|
|
* Updated to use the HAL APIs/macros.
|
51 |
|
|
* XIic_ClearStats function is updated as the
|
52 |
|
|
* macro XIIC_CLEAR_STATS has been removed.
|
53 |
|
|
* </pre>
|
54 |
|
|
*
|
55 |
|
|
****************************************************************************/
|
56 |
|
|
|
57 |
|
|
/***************************** Include Files *******************************/
|
58 |
|
|
|
59 |
|
|
#include "xiic.h"
|
60 |
|
|
#include "xiic_i.h"
|
61 |
|
|
|
62 |
|
|
/************************** Constant Definitions ***************************/
|
63 |
|
|
|
64 |
|
|
/**************************** Type Definitions *****************************/
|
65 |
|
|
|
66 |
|
|
/***************** Macros (Inline Functions) Definitions *******************/
|
67 |
|
|
|
68 |
|
|
/************************** Function Prototypes ****************************/
|
69 |
|
|
|
70 |
|
|
/************************** Variable Definitions **************************/
|
71 |
|
|
|
72 |
|
|
/*****************************************************************************/
|
73 |
|
|
/**
|
74 |
|
|
*
|
75 |
|
|
* Gets a copy of the statistics for an IIC device.
|
76 |
|
|
*
|
77 |
|
|
* @param InstancePtr is a pointer to the XIic instance to be worked on.
|
78 |
|
|
* @param StatsPtr is a pointer to a XIicStats structure which will get a
|
79 |
|
|
* copy of current statistics.
|
80 |
|
|
*
|
81 |
|
|
* @return None.
|
82 |
|
|
*
|
83 |
|
|
* @note None.
|
84 |
|
|
*
|
85 |
|
|
****************************************************************************/
|
86 |
|
|
void XIic_GetStats(XIic *InstancePtr, XIicStats * StatsPtr)
|
87 |
|
|
{
|
88 |
|
|
u8 NumBytes;
|
89 |
|
|
u8 *SrcPtr;
|
90 |
|
|
u8 *DestPtr;
|
91 |
|
|
|
92 |
|
|
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
93 |
|
|
Xil_AssertVoid(InstancePtr != NULL);
|
94 |
|
|
Xil_AssertVoid(StatsPtr != NULL);
|
95 |
|
|
|
96 |
|
|
/*
|
97 |
|
|
* Setup pointers to copy the stats structure
|
98 |
|
|
*/
|
99 |
|
|
SrcPtr = (u8 *) &InstancePtr->Stats;
|
100 |
|
|
DestPtr = (u8 *) StatsPtr;
|
101 |
|
|
|
102 |
|
|
/*
|
103 |
|
|
* Copy the current statistics to the structure passed in
|
104 |
|
|
*/
|
105 |
|
|
for (NumBytes = 0; NumBytes < sizeof(XIicStats); NumBytes++) {
|
106 |
|
|
*DestPtr++ = *SrcPtr++;
|
107 |
|
|
}
|
108 |
|
|
}
|
109 |
|
|
|
110 |
|
|
/*****************************************************************************/
|
111 |
|
|
/**
|
112 |
|
|
*
|
113 |
|
|
* Clears the statistics for the IIC device by zeroing all counts.
|
114 |
|
|
*
|
115 |
|
|
* @param InstancePtr is a pointer to the XIic instance to be worked on.
|
116 |
|
|
*
|
117 |
|
|
* @return None.
|
118 |
|
|
*
|
119 |
|
|
* @note None.
|
120 |
|
|
*
|
121 |
|
|
****************************************************************************/
|
122 |
|
|
void XIic_ClearStats(XIic *InstancePtr)
|
123 |
|
|
{
|
124 |
|
|
u8 NumBytes;
|
125 |
|
|
u8 *DestPtr;
|
126 |
|
|
|
127 |
|
|
Xil_AssertVoid(InstancePtr->IsReady == XIL_COMPONENT_IS_READY);
|
128 |
|
|
Xil_AssertVoid(InstancePtr != NULL);
|
129 |
|
|
|
130 |
|
|
DestPtr = (u8 *)&InstancePtr->Stats;
|
131 |
|
|
for (NumBytes = 0; NumBytes < sizeof(XIicStats); NumBytes++) {
|
132 |
|
|
*DestPtr++ = 0;
|
133 |
|
|
}
|
134 |
|
|
|
135 |
|
|
}
|
136 |
|
|
/** @} */
|