SFBCodeFlow.h

Go to the documentation of this file.
00001 /*                                              -*- mode:C++; fill-column:100 -*-
00002   SFBCodeFlow.h - Support for the SFB Code Flow protocol
00003   Copyright (C) 2008 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 
00027 #ifndef SFBCODEFLOW_H_
00028 #define SFBCODEFLOW_H_
00029 
00030 #include "SFBTypes.h"
00031 #include "SFBConstants.h"
00032 #include "SFBAssert.h"
00033 #include "SFBProvenance.h"
00034 #include "SFBSerial.h"
00035 
00036 extern u8 sectorOfAddress(u32 address) ;
00037 
00038 extern u32 sectorStart(u8 sectorNumber) ;
00039 
00040 extern u32 sectorSize(u8 sectorNumber) ;
00041 
00042 extern u32 sectorEnd(u8 sectorNumber) ;
00043 
00044 bool plausibleProvenance(SFBProvenance * p, uptr startAddr, uptr endAddr) ;
00045 
00046 enum { CHECKSUM_IGNORE, CHECKSUM_CHECK, CHECKSUM_GENERATE };
00047 
00048 bool validProvenance(SFBProvenance * p, uptr startAddr, uptr endAddr, int checksumMode=CHECKSUM_CHECK) ;
00049 
00050 SFBProvenance * findProvenance(uptr startAddr, uptr endAddr, int checksumMode=CHECKSUM_CHECK) ;
00051 
00052 extern void programServerDispatcher(u8 * packet) ; // Handler for 'P' packets
00053 
00054 extern void programServerInit(u8 face) ; // Initializer for 'P' packets
00055 
00056 extern void programServerSetSketch(const volatile SFBProvenance * theSketch, u32 startAddress, uptr addressOffset, u8 pflags = 0) ;
00057 
00058 extern void printPhSketchInfo(u8 toFace, const volatile SFBProvenance * theSketch) ;
00059 
00060 extern bool announcePhSketchInfoIfAny(u8 toFace) ;
00061 
00062 enum CodeFlowStatus {
00063   CODE_FLOW_INIT,
00064   CODE_FLOW_IDLE,
00065   CODE_FLOW_ACTIVE,
00066   CODE_FLOW_SUCCEEDED
00067 };
00068 typedef void (*CodeFlowStatusCallback)(u8 face, CodeFlowStatus status) ;
00069 
00070 extern void setCodeFlowStatusCallback(CodeFlowStatusCallback ptr) ;
00071 
00072 extern int wantPhPacketCodeUpdate(u8 * packet) __attribute__ ((weak));
00073 
00074 extern void initProgramServerSketch() __attribute__ ((weak)); /* Defer to real init call in SFBProvenanceData.h, if it got compiled in.. */
00075 
00076 #endif /* SFBCODEFLOW_H_ */

Generated on Fri Apr 22 06:54:11 2011 for SFB by doxygen 1.5.9