Simon Yang / Mbed 2 deprecated BenchCoreMark

Dependencies:   mbed

Fork of ClockControl by Michael Wei

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "mbed.h"
00002 #include "ClockControl/ClockControl.h"
00003 #include "CoreMark/core_portme.h"
00004 
00005 int main() {
00006 
00007     printf("mbed Clock Control test\r\n");
00008     printf("(c) 2015 Simon_mbed\r\n");
00009     
00010 //    unsigned short newM = 12;
00011 //    unsigned short newN = 1;
00012     
00013 //    printf("Value of M? (default = 12):\r\n");
00014 //    scanf("%d", &newM);
00015 //    
00016 //    printf("Value of N? (default = 1):\r\n");
00017 //    scanf("%d", &newN);
00018     
00019 //    setSystemFrequency(0x3, 0x1, newM, newN);
00020     
00021 
00022     
00023     //This code by Simon Ford: http://mbed.org/forum/mbed/topic/229/?page=1#comment-1225
00024     
00025 //    int Fin = 12000000; // 12MHz XTAL
00026 //    pc.printf("PLL Registers:\r\n");
00027 //    pc.printf(" - PLL0CFG = 0x%08X\r\n", LPC_SC->PLL0CFG);
00028 //    pc.printf(" - CLKCFG  = 0x%08X\r\n", LPC_SC->CCLKCFG);
00029 //    
00030 //    int M = (LPC_SC->PLL0CFG & 0xFFFF) + 1;
00031 //    int N = (LPC_SC->PLL0CFG >> 16) + 1;
00032 //    int CCLKDIV = LPC_SC->CCLKCFG + 1;
00033 //
00034 //    pc.printf("Clock Variables:\r\n");
00035 //    pc.printf(" - Fin = %d\r\n", Fin);
00036 //    pc.printf(" - M   = %d\r\n", M);
00037 //    pc.printf(" - N   = %d\r\n", N);
00038 //    pc.printf(" - CCLKDIV = %d\r\n", CCLKDIV);
00039 //
00040 //    int Fcco = (2 * M * 12000000) / N;
00041 //    int CCLK = Fcco / CCLKDIV;
00042 
00043 //    pc.printf("Clock Results:\r\n");    
00044 //    pc.printf(" - Fcco = %d\r\n", Fcco);
00045 //    
00046 //    printf(" - CCLK = %d\r\n", CCLK);
00047     
00048     printf("Run CoreMark? (Y/N)\n");
00049     char buf[8];
00050     scanf("%s", buf);
00051     if (buf[0] == 'y' || buf[0] == 'Y')
00052     {
00053         mainCoreMark();
00054     }
00055 }