I have a TMDXEVM6678L. I have code for getting the wallclock which uses CLK_gethtime. I am trying to remove all the DSP/BIOS code from my project so I don't have that dependency, and I believe CLK_gethtime requires DSP/BIOS. Is it possible to write my own version of this function which accesses clock registers directly or otherwise computes the same thing?
My existing code is
static int CLOCK_STARTED = 0;
static unsigned long CLOCK_START_TICK; /* ticks */
static float CLOCK_TICKS_PER_S;
int embWallclock(int *seconds) {
unsigned long tick;
float time;
if (!CLOCK_STARTED) {
unsigned long ticks_per_ms;
CLOCK_STARTED = 1;
ticks_per_ms = CLK_countspms();
CLOCK_TICKS_PER_S = (float)ticks_per_ms*1000.0;
CLOCK_START_TICK = CLK_gethtime();
}
tick = CLK_gethtime() - CLOCK_START_TICK;
time = (float)tick/CLOCK_TICKS_PER_S;
*seconds = (int)time;
return (int)((time - *seconds) * 1e9);
}