root/trunk/libffado/src/libieee1394/test-cyclecalc.cpp

Revision 2651, 3.9 kB (checked in by jwoithe, 7 years ago)

Fix some warnings emitted by recent versions of gcc. These are mostly connected with printf format strings: spaces are now required between string literals and PR* format macros. Patch from Xavier Forestier.

Line 
1 /*
2  * Copyright (C) 2005-2008 by Pieter Palmers
3  *
4  * This file is part of FFADO
5  * FFADO = Free Firewire (pro-)audio drivers for linux
6  *
7  * FFADO is based upon FreeBoB
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 2 of the License, or
12  * (at your option) version 3 of the License.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21  *
22  */
23
24 #include "cycletimer.h"
25 #include "debugmodule/debugmodule.h"
26 #include <stdio.h>
27
28 DECLARE_GLOBAL_DEBUG_MODULE;
29
30 int main() {
31     setDebugLevel(DEBUG_LEVEL_VERY_VERBOSE);
32     printf("Cycle timer operation tests (incomplete)\n");
33    
34     /* TEST 1
35      * check reconstruction of SYT RECEIVE timestamp
36      *
37      * The now_ctr has wrapped, while the cycle and syt have not
38      *
39      */
40
41     #ifdef DEBUG_MESSAGES
42     uint32_t now_ctr = 0x140001DA;
43     uint64_t now = CYCLE_TIMER_TO_TICKS(0x140001DA);
44     unsigned int cycle = 7968;
45     uint16_t syt = 0x583B;
46    
47     debugOutput(DEBUG_LEVEL_VERBOSE,"NOW_CTR          : %08X (%03us %04uc %04ut)\n",
48                           now_ctr,
49                           (unsigned int)CYCLE_TIMER_GET_SECS(now_ctr),
50                           (unsigned int)CYCLE_TIMER_GET_CYCLES(now_ctr),
51                           (unsigned int)CYCLE_TIMER_GET_OFFSET(now_ctr));
52
53     debugOutput(DEBUG_LEVEL_VERBOSE,"NOW              : %011" PRIu64 " (%03us %04uc %04ut)\n",
54                           now,
55                           (unsigned int)TICKS_TO_SECS(now),
56                           (unsigned int)TICKS_TO_CYCLES(now),
57                           (unsigned int)TICKS_TO_OFFSET(now));
58     debugOutput(DEBUG_LEVEL_VERBOSE,"SYT              : %08X (%03us %04uc %04ut)\n",
59                           syt,
60                           (unsigned int)CYCLE_TIMER_GET_SECS(syt),
61                           (unsigned int)CYCLE_TIMER_GET_CYCLES(syt),
62                           (unsigned int)CYCLE_TIMER_GET_OFFSET(syt));
63     debugOutput(DEBUG_LEVEL_VERBOSE,"CYCLE            : %uc\n",
64                           cycle);
65     uint64_t calc_ts = sytRecvToFullTicks(syt, cycle, now_ctr);
66
67     debugOutput(DEBUG_LEVEL_VERBOSE,"CALC_TS          : %011" PRIu64 " (%03us %04uc %04ut)\n",
68                           calc_ts,
69                           (unsigned int)TICKS_TO_SECS(calc_ts),
70                           (unsigned int)TICKS_TO_CYCLES(calc_ts),
71                           (unsigned int)TICKS_TO_OFFSET(calc_ts));
72     #else
73     printf("DEBUG_MESSAGES not enabled for build.  This program won't show anything without it.\n");
74     #endif
75    
76 // BL: 1211722982: Debug (IsoHandler.cpp)[ 420] putPacket: received packet: length=168, channel=0, cycle=7968
77 // BL: 1211723031: Debug (cycletimer.h)[ 308] sytRecvToFullTicks: SYT=583B CY=7968 CTR=140001DA
78 // BL: 1211723037: Debug (StreamProcessor.cpp)[ 346] putPacket: RECV: CY=7968 TS=00245679163
79 // BL: 1211723043: Debug (AmdtpReceiveStreamProcessor.cpp)[ 135] processPacketData: STMP: 245679163ticks | syt_interval=8, tpf=557.254395
80 // BL: 1211723051: Debug (TimestampedBuffer.cpp)[1153] incrementFrameCounter:  nbframes: 8, m_update_period: 8
81 // BL: 1211723052: Debug (AmdtpTransmitStreamProcessor.cpp)[ 250] generatePacketHeader: Too early: CY=0254, TC=0257, CUT=0003, TST=00271126073 (0257), TSP=00271137849 (0261)
82 // BL: 1211723055: Debug (TimestampedBuffer.cpp)[1155] incrementFrameCounter:  tail TS:  270250705.174, next tail TS:  270255163.209
83 // BL: 1211723062: Debug (TimestampedBuffer.cpp)[1157] incrementFrameCounter:  new TS:  245679163.000, wrapped new TS:  245679163.000
84 //     
85
86 }
Note: See TracBrowser for help on using the browser.