Before accessing the TSC registers, you need to enable them by calling: TSC_enable();
To get the DSP cycles, the best option is to use TSC_read(). This returns a 64 bit unsigned int containing the value of both TSCH and TSCL registers. Regards, Anand -----Original Message----- From: davinci-linux-open-source-boun...@linux.davincidsp.com [mailto:davinci-linux-open-source-boun...@linux.davincidsp.com] On Behalf Of Griffis, Brad Sent: Friday, April 17, 2009 10:53 PM To: Joshi, Prasad; davinci-linux-open-source@linux.davincidsp.com Subject: RE: DSP Cycles measurement on DM6467 Prasad, The high resolution clock that DSP/BIOS uses on 64x+ architecture is called the time-stamp counter (TSC), which is part of the 64x+ Megamodule. It's a 64-bit counter consisting of two registers, TSCH and TSCL, that operate at CPU/1. When you call CLK_gethtime it reads TSCL. By default TSC does not count. The software needs to do a dummy write to TSCL to make it start. In my experience that is always done automatically by BIOS. Perhaps in your BIOS configuration something turned it off. Make sure that bios.CLK.ENABLEHTIME = 1 in your tcf. That is the default value, so unless someone explicitly set it to 0 somewhere it should be on. That seems the most likely config option to affect this. Once you enable that option you should see CLK_cpuCyclesPerHtime return 1 since the TSC counts at CPU/1. Brad -----Original Message----- From: davinci-linux-open-source-boun...@linux.davincidsp.com [mailto:davinci-linux-open-source-boun...@linux.davincidsp.com] On Behalf Of Joshi, Prasad Sent: Friday, April 17, 2009 4:21 AM To: davinci-linux-open-source@linux.davincidsp.com Subject: DSP Cycles measurement on DM6467 I want to measure DSP cycles consumed in a function. what i am doing is as follows. //////////////////////////////////////////////////////////////////////////// time1 = CLK_gethtime(); function() { //some code } time2 = CLK_gethtime(); DSP_Cycles = (time2- time1) * (CLK_cpuCyclesPerHtime()) //////////////////////////////////////////////////////////////////////////// When i print DSP_Cycles, it gives zero. Then i tried printing (CLK_cpuCyclesPerHtime()) directly & found that it is returning zero. CLK_cpuCyclesPerHtime() returns a Float value. I tried printing it with %f, %32.3g %ld (After type proper casting), but every time it is prinintg zero. I have added all header files (bios/include/log.h, bios/include/clk.h, bios/include/gbl.h) & CLK is initialised too. Can anyone tell where am I making mistake? Thanks & Regards Prasad V. Joshi Texas Instruments Off: 080-25099173 _______________________________________________ Davinci-linux-open-source mailing list Davinci-linux-open-source@linux.davincidsp.com http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source _______________________________________________ Davinci-linux-open-source mailing list Davinci-linux-open-source@linux.davincidsp.com http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source _______________________________________________ Davinci-linux-open-source mailing list Davinci-linux-open-source@linux.davincidsp.com http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source