aboutsummaryrefslogtreecommitdiffstats
path: root/package/kernel/lantiq/ltq-adsl/patches/200-fix-elapsed-time.patch
blob: 42ec214371554e23dd84e84184c3ee1b91cd2a19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
--- a/src/include/drv_dsl_cpe_pm_core.h
+++ b/src/include/drv_dsl_cpe_pm_core.h
@@ -1525,9 +1525,9 @@ typedef struct
    DSL_boolean_t bShowtimeProcessingStart;
    /** Showtime reached flag*/
    DSL_boolean_t bShowtimeInvTrigger;
-   /** Current Showtime synchronization time to be used, (msec) */
+   /** Current Showtime synchronization time to be used, (sec) */
    DSL_uint32_t nCurrShowtimeTime;
-   /** Showtime synchronization time to be used, (msec) */
+   /** Showtime synchronization time to be used, (sec) */
    DSL_uint32_t nElapsedShowtimeTime;
    /** Actual Line state*/
    DSL_LineStateValue_t nLineState;
--- a/src/pm/drv_dsl_cpe_api_pm.c
+++ b/src/pm/drv_dsl_cpe_api_pm.c
@@ -1445,7 +1445,7 @@ DSL_Error_t DSL_DRV_PM_ChannelCountersTo
    }
 
    /* Fill Total Counters elapsed time*/
-   pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC;
+   pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime;
 
    pChCounters = DSL_DRV_PM_PTR_CHANNEL_COUNTERS_TOTAL(pCounters->nChannel,pCounters->nDirection);
 
@@ -1501,7 +1501,7 @@ DSL_Error_t DSL_DRV_PM_ChannelCountersEx
    }
 
    /* Fill Total Counters elapsed time*/
-   pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC;
+   pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime;
 
    pChCounters = DSL_DRV_PM_PTR_CHANNEL_COUNTERS_TOTAL_EXT(pCounters->nChannel);
 
@@ -2418,7 +2418,7 @@ DSL_Error_t DSL_DRV_PM_DataPathCountersT
    }
 
    /* Fill Total Counters elapsed time*/
-   pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC;
+   pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime;
 
    pDpCounters = DSL_DRV_PM_PTR_DATAPATH_COUNTERS_TOTAL(pCounters->nChannel,pCounters->nDirection);
 
@@ -3190,7 +3190,7 @@ DSL_Error_t DSL_DRV_PM_DataPathFailureCo
    }
 
    /* Fill Total Counters elapsed time*/
-   pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC;
+   pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime;
 
    pDpCounters = DSL_DRV_PM_PTR_DATAPATH_FAILURE_COUNTERS_TOTAL(pCounters->nChannel,pCounters->nDirection);
 
@@ -3950,7 +3950,7 @@ DSL_Error_t DSL_DRV_PM_LineSecCountersTo
    }
 
    /* Fill Total Counters elapsed time*/
-   pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC;
+   pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime;
 
    pLineCounters = DSL_DRV_PM_PTR_LINE_SEC_COUNTERS_TOTAL(pCounters->nDirection);
 
@@ -4602,7 +4602,7 @@ DSL_Error_t DSL_DRV_PM_LineInitCountersT
    }
 
    /* Fill Total Counters elapsed time*/
-   pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC;
+   pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime;
 
    pLinitCounters = DSL_DRV_PM_PTR_LINE_INIT_COUNTERS_TOTAL();
 
@@ -5131,7 +5131,7 @@ DSL_Error_t DSL_DRV_PM_LineEventShowtime
    }
 
    /* Fill Total Counters elapsed time*/
-   pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC;
+   pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime;
 
    pLfCounters = DSL_DRV_PM_PTR_LINE_EVENT_SHOWTIME_COUNTERS_TOTAL(pCounters->nDirection);
 
@@ -5670,7 +5670,7 @@ DSL_Error_t DSL_DRV_PM_ReTxCountersTotal
    }
 
    /* Fill Total Counters elapsed time*/
-   pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime/DSL_PM_MSEC;
+   pCounters->total.nElapsedTime = DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime;
 
    pReTxCounters = DSL_DRV_PM_PTR_RETX_COUNTERS_TOTAL(pCounters->nDirection);
 
--- a/src/pm/drv_dsl_cpe_pm_core.c
+++ b/src/pm/drv_dsl_cpe_pm_core.c
@@ -61,6 +61,7 @@ static DSL_Error_t DSL_DRV_PM_SyncTimeUp
 {
    DSL_Error_t nErrCode = DSL_SUCCESS;
    DSL_uint32_t msecTimeFrame = DSL_PM_COUNTER_POLLING_CYCLE,
+                secTimeFrame = DSL_PM_COUNTER_POLLING_CYCLE/DSL_PM_MSEC,
                 nCurrMsTime = 0;
 #ifdef INCLUDE_DSL_CPE_PM_HISTORY
    DSL_uint32_t nCurrSysTime = 0, nPrevElapsedTime = 0;
@@ -100,10 +101,13 @@ static DSL_Error_t DSL_DRV_PM_SyncTimeUp
    {
       /* Get elapsed time [msec] since the last entry*/
       msecTimeFrame = nCurrMsTime  - DSL_DRV_PM_CONTEXT(pContext)->nLastMsTimeCheck;
+
+      /* Get elapsed time [sec] since the last entry*/
+      secTimeFrame = (nCurrMsTime/DSL_PM_MSEC) - (DSL_DRV_PM_CONTEXT(pContext)->nLastMsTimeCheck/DSL_PM_MSEC);
    }
 
    /* Get Total Elapsed Time Since the PM module startup*/
-   DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime += msecTimeFrame;
+   DSL_DRV_PM_CONTEXT(pContext)->nPmTotalElapsedTime += secTimeFrame;
 
    /* Set last time check to the current time*/
    DSL_DRV_PM_CONTEXT(pContext)->nLastMsTimeCheck = nCurrMsTime;
@@ -141,7 +145,7 @@ static DSL_Error_t DSL_DRV_PM_SyncTimeUp
       else
       {
          /* Update current showtime elapsed time*/
-         DSL_DRV_PM_CONTEXT(pContext)->nCurrShowtimeTime   += (msecTimeFrame/DSL_PM_MSEC);
+         DSL_DRV_PM_CONTEXT(pContext)->nCurrShowtimeTime   += secTimeFrame;
          DSL_DRV_PM_CONTEXT(pContext)->nElapsedShowtimeTime =
             DSL_DRV_PM_CONTEXT(pContext)->nCurrShowtimeTime;
       }