00001 /* init.h 00002 00003 Copyright 2008 Fred Cooke 00004 00005 This file is part of the FreeEMS project. 00006 00007 FreeEMS software is free software: you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation, either version 3 of the License, or 00010 (at your option) any later version. 00011 00012 FreeEMS software is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with any FreeEMS software. If not, see <http://www.gnu.org/licenses/>. 00019 00020 We ask that if you make any changes to this file you send them upstream to us at admin@diyefi.org 00021 00022 Thank you for choosing FreeEMS to run your engine! */ 00023 00024 00025 /* Header file multiple inclusion protection courtesy eclipse Header Template */ 00026 /* and http://gcc.gnu.org/onlinedocs/gcc-3.1.1/cpp/ C pre processor manual */ 00027 #ifndef FILE_INIT_H_SEEN 00028 #define FILE_INIT_H_SEEN 00029 00030 #ifdef INIT_C 00031 #define EXTERN 00032 #else 00033 #define EXTERN extern 00034 #endif 00035 00036 EXTERN void init(void); 00037 00038 //wrap these in an if to keep them hidden away 00039 EXTERN void initPLL(void) FIXEDCONF2; 00040 EXTERN void checkChecksum(void) FIXEDCONF2; 00041 EXTERN void initIO(void) FIXEDCONF2; 00042 EXTERN void initIO(void) FIXEDCONF2; 00043 EXTERN void initPagedRam(void); 00044 EXTERN void initStats(void); 00045 EXTERN void initVariables(void); 00046 EXTERN void initFlash(void) FIXEDCONF2; 00047 EXTERN void initECTTimer(void) FIXEDCONF2; 00048 EXTERN void initPITTimer(void); 00049 EXTERN void initSCIStuff(void); 00050 EXTERN void initConfiguration(void); 00051 EXTERN void initInterrupts(void); 00052 00053 00054 /* Various masks and values used for initialising the contents of control registers. */ 00055 /* For information on how these are being used, try this link : */ 00056 /* http://www.vipan.com/htdocs/bitwisehelp.html */ 00057 00058 // PLL control values 00059 #define PLLLOCK 0x08 /* Mask for checking to see when the PLL loop is locked onto its target */ 00060 #define PLLSELOFF 0x7F /* Mask for switching to base external OSCCLK clock 0b_0111_1111 */ 00061 #define PLLSELON 0x80 /* Mask for switching to internally multiplied PLL clock 0b_1000_0000 */ 00062 #define PLLOFF 0xBF /* Mask for turning the PLLON bit to ZERO 0b_1011_1111, IE, turning PLL off */ 00063 #define PLLON 0x40 /* Mask for setting PLLON bit to ONE 0b_0100_0000, IE, turning PLL on */ 00064 #define PLLDIVISOR 0x03 /* Input crystal frequency is divided by this number */ 00065 #define PLLMULTIPLIER 0x09 /* The result of the above is multiplied by this number to give the bus frequency */ 00066 00067 // TODO define other macros such that raw values aren't used in the code 00068 00069 #undef EXTERN 00070 00071 #else 00072 /* let us know if we are being untidy with headers */ 00073 #warning "Header file INIT_H seen before, sort it out!" 00074 /* end of the wrapper ifdef from the very top */ 00075 #endif