# SFBPower.h

Go to the documentation of this file.

    00001 /*
    00002   SFBPower.h The ADC (including power monitoring) handling routines for the SFB.
    00003   Copyright (C) 2009 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
    00020   $Id$
    00021 */
    00022
    00030 #ifndef SFBPOWER_H
    00031 #define SFBPOWER_H
    00032
    00033 #include "SFBTypes.h"     /* For u8 */
    00034 #include "SFBConstants.h" /* For FACE_COUNT */
    00035
    00036 extern void initADC();
    00037
    00038 extern int powerDraw();
    00039
    00040 extern int powerDraw(u32 face);
    00041
    00042 extern int rawPower(u32 face);
    00043
    00044 extern int railVoltage();
    00045
    00046 extern int rawVoltage();
    00047
    00048 extern void powerOut(u32 face, int on);
    00053 extern void powerIn(u32 face, int on);
    00054
    00055 /* Set all outbound power ON */
    00056 extern void initPowerOuts();
    00057
    00058 #define RAIL_SAMPLE_INDEX (FACE_COUNT)
    00059 #define ADC_SAMPLE_COUNT (RAIL_SAMPLE_INDEX+1)
    00060
    00061 #if ADC_SAMPLE_COUNT > 8
    00062 #error ADC_SAMPLE_COUNT too large
    00063 #endif
    00064
    00065 extern uv32 adcSamples[ADC_SAMPLE_COUNT];
    00066
    00067 extern uv16 adcSmooth[ADC_SAMPLE_COUNT];
    00068
    00069 extern uv16 adcSmoother[ADC_SAMPLE_COUNT];
    00070
    00071 #endif /* SFBPOWER_H */