summaryrefslogtreecommitdiffstats
path: root/SD-VBS/common/c/photonReportTiming.c
blob: c41d1033a798187895e94b724cf083677c2a4c76 (plain) (blame)
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
/********************************
Author: Sravanthi Kota Venkata
********************************/

/** C File **/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <math.h>
#include "timingUtils.h"
#include "sdvbs_common.h"

unsigned int * photonReportTiming(unsigned int* startCycles,unsigned int* endCycles)
{

    static unsigned int *elapsed;
    elapsed = (unsigned int*)malloc(sizeof(unsigned int)*2);
	unsigned long long start = (((unsigned long long)0x0) | startCycles[0]) << 32 | startCycles[1];
	unsigned long long end = (((unsigned long long)0x0) | endCycles[0]) << 32 | endCycles[1];
	unsigned long long diff = end - start;
	elapsed[0] = (unsigned int)(diff >> 32);
	elapsed[1] = (unsigned int)(diff & 0xffffffff);
    return elapsed;

}

/** End of C Code **/