# clock.h

Go to the documentation of this file.

    00001 /*                                             -*- mode:C++; fill-column:100  -*-
    00002   clock.h Support for changing/setting the system clock speed
    00003   Copyright (C) 2010 The Regents of the University of New Mexico.  All rights reserved.
    00004
    00005   This library is free software; you can redistribute it and/or
    00006   modify it under the terms of the GNU Lesser General Public
    00007   License as published by the Free Software Foundation; either
    00008   version 2.1 of the License, or (at your option) any later version.
    00009
    00010   This library is distributed in the hope that it will be useful,
    00011   but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00013   Lesser General Public License for more details.
    00014
    00015   You should have received a copy of the GNU General Public License
    00016   along with this library; if not, write to the Free Software
    00017   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
    00018   USA
    00019 */
    00027 #ifndef CLOCK_H_
    00028 #define CLOCK_H_
    00029
    00030 #include "SFBTypes.h"
    00031
    00032 #ifdef __cplusplus
    00033 extern "C"{
    00034 #endif
    00035
    00036 enum ClockSpeedCode {
    00037   CSC_UNSET = 0,
    00038   CSC_12MHZ = 1,
    00039   CSC_24MHZ = 2,
    00040   CSC_36MHZ = 3,
    00041   CSC_48MHZ = 4,
    00042   CSC_60MHZ = 5,
    00043   CSC_72MHZ = 6,
    00045   CSC_MAX = 7,
    00046
    00047   CSC_MIN_MHZ = CSC_12MHZ,
    00048   CSC_MAX_MHZ = CSC_72MHZ,
    00050   CSC_AUTO = 8
    00051 };
    00052
    00055 typedef struct clockConfiguration {
    00056   u8 pllMulM;
    00057   u8 pllDivN;
    00058   u8 clkDiv;
    00059   u8 mamtim;
    00060   u8 pclkDiv;
    00061   u8 pclkMHz;
    00062 } ClockConfiguration;
    00063
    00066 extern const ClockConfiguration * getCurrentClockConfiguration() ;
    00067
    00070 extern const ClockConfiguration * getClockConfigurationForCode(u32 code) ;
    00071
    00073 extern u32 getCCLK() ;
    00074
    00076 extern u8 getCCLKCode() ;
    00077
    00079 extern void setClockSpeed(u32 code) ;
    00080
    00082 typedef void (*ClockSpeedChangeCallback)(u32 newClockSpeed);
    00083
    00099 extern ClockSpeedChangeCallback setClockSpeedChangeCallback(ClockSpeedChangeCallback callback) ;
    00100
    00101 #ifdef __cplusplus
    00102 } /* extern "C" */
    00103 #endif
    00104
    00105 #endif /*CLOCK_H_*/