]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - armsrc/util.c
0. its alpha version!!!
[proxmark3-svn] / armsrc / util.c
index 5a8cfeec72ba0a063cee5ba87f12a6c4b1908431..9c6b3e8d76f919e957c468877c63df37a75b0f84 100644 (file)
@@ -235,3 +235,30 @@ void FormatVersionInformation(char *dst, int len, const char *prefix, void *vers
        strncat(dst, " ", len);
        strncat(dst, v->buildtime, len);
 }
+
+//  -------------------------------------------------------------------------
+//  timer lib
+//  -------------------------------------------------------------------------
+//  test procedure:
+//
+//     ti = GetTickCount();
+//     SpinDelay(1000);
+//     ti = GetTickCount() - ti;
+//     Dbprintf("timer(1s): %d t=%d", ti, GetTickCount());
+
+void StartTickCount()
+{
+//  must be 0x40, but on my cpu - included divider is optimal
+//  0x20 - 1 ms / bit 
+//  0x40 - 2 ms / bit
+
+       AT91C_BASE_RTTC->RTTC_RTMR = AT91C_RTTC_RTTRST + 0x003B;
+}
+
+/*
+* Get the current count.
+*/
+uint32_t RAMFUNC GetTickCount(){
+       return AT91C_BASE_RTTC->RTTC_RTVR * 2;
+}
+
Impressum, Datenschutz