RunCoreMark on STM32F091

Dependencies:   mbed

Fork of ClockControl by Michael Wei

main.cpp

Committer:
Simon_mbed
Date:
2015-09-03
Revision:
2:6a9131b3df01
Parent:
0:b5d3bd64d2dc

File content as of revision 2:6a9131b3df01:

#include "mbed.h"
#include "ClockControl/ClockControl.h"
#include "CoreMark/core_portme.h"

int main() {

    printf("mbed Clock Control test\r\n");
    printf("(c) 2015 Simon_mbed\r\n");
    
//    unsigned short newM = 12;
//    unsigned short newN = 1;
    
//    printf("Value of M? (default = 12):\r\n");
//    scanf("%d", &newM);
//    
//    printf("Value of N? (default = 1):\r\n");
//    scanf("%d", &newN);
    
//    setSystemFrequency(0x3, 0x1, newM, newN);
    

    
    //This code by Simon Ford: http://mbed.org/forum/mbed/topic/229/?page=1#comment-1225
    
//    int Fin = 12000000; // 12MHz XTAL
//    pc.printf("PLL Registers:\r\n");
//    pc.printf(" - PLL0CFG = 0x%08X\r\n", LPC_SC->PLL0CFG);
//    pc.printf(" - CLKCFG  = 0x%08X\r\n", LPC_SC->CCLKCFG);
//    
//    int M = (LPC_SC->PLL0CFG & 0xFFFF) + 1;
//    int N = (LPC_SC->PLL0CFG >> 16) + 1;
//    int CCLKDIV = LPC_SC->CCLKCFG + 1;
//
//    pc.printf("Clock Variables:\r\n");
//    pc.printf(" - Fin = %d\r\n", Fin);
//    pc.printf(" - M   = %d\r\n", M);
//    pc.printf(" - N   = %d\r\n", N);
//    pc.printf(" - CCLKDIV = %d\r\n", CCLKDIV);
//
//    int Fcco = (2 * M * 12000000) / N;
//    int CCLK = Fcco / CCLKDIV;

//    pc.printf("Clock Results:\r\n");    
//    pc.printf(" - Fcco = %d\r\n", Fcco);
//    
//    printf(" - CCLK = %d\r\n", CCLK);
    
    printf("Run CoreMark? (Y/N)\n");
    char buf[8];
    scanf("%s", buf);
    if (buf[0] == 'y' || buf[0] == 'Y')
    {
        mainCoreMark();
    }
}