This commit is contained in:
reccetear 2017-05-19 00:39:43 +08:00
parent 6361c0ecce
commit 4ac4e3ffc2
2 changed files with 10 additions and 2 deletions

View File

@ -12,6 +12,7 @@
#define CTRL 0x0c
#define HZ 50000000
#define MAX_MEMORY_SIZE 0x4000000
#define INTERVAL 1000
static inline u8 R(_Pixel p) { return p >> 16; }
static inline u8 G(_Pixel p) { return p >> 8; }

View File

@ -15,14 +15,21 @@ static char *crecv = SERIAL_PORT + Rx;
ulong _uptime(){
ulong low = GetCount(0);
ulong high = GetCount(1) + 1;
npc_time = high * 1000 * ((1 << 32) / HZ) + low * 1000 / HZ; //npc_time returns ms
/*npc_time = high * 1000 * ((1 << 32) / HZ) + low * 1000 / HZ;
*npc_time = (high << 22) * 1000 * 1024 / HZ + low * 1000 / HZ;
*/
npc_time = (high << 22) * 1000 * 1024 / HZ + low * 1000 / HZ; //npc_time returns ms
return npc_time;
}
ulong _cycles(){
u32 low = GetCount(0);
ulong high = GetCount(1) + 1;
npc_cycles = (high * ((1 << 32) >> 3) + (low >> 3); //npc_cycles returns Kcycles
/*npc_cycles = high * ((1 << 32) >> 3) + (low >> 3);
*npc_cycles = high * (1 << 29) + (low >> 3);
*npc_cycles = (high << 29) + (low >> 3);
*/
npc_cycles = (high << 29) + (low >> 3); //npc_cycles returns Kcycles
return npc_cycles;
}