system.h
Go to the documentation of this file.
00001 /*
00002 
00003 Copyright (c) 2011, Ascending Technologies GmbH
00004 All rights reserved.
00005 
00006 Redistribution and use in source and binary forms, with or without
00007 modification, are permitted provided that the following conditions are met:
00008 
00009  * Redistributions of source code must retain the above copyright notice,
00010    this list of conditions and the following disclaimer.
00011  * Redistributions in binary form must reproduce the above copyright
00012    notice, this list of conditions and the following disclaimer in the
00013    documentation and/or other materials provided with the distribution.
00014 
00015 THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
00016 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00017 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00018 DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY
00019 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00020 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00021 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00022 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00023 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
00024 OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
00025 DAMAGE.
00026 
00027  */
00028 
00029 #ifndef SYSTEM_H_
00030 #define SYSTEM_H_
00031 
00032 extern unsigned int processorClockFrequency(void);
00033 extern unsigned int peripheralClockFrequency(void);
00034 extern void delay(int);
00035 extern void init(void);
00036 extern void pll_init(void);
00037 extern void pll_feed(void);
00038 extern void init_timer0(void);
00039 extern void init_timer1(void);
00040 extern void init_interrupts(void);
00041 extern void init_ports(void);
00042 extern void init_spi(void);
00043 extern void init_pwm(void);
00044 extern void init_get_calibdata_from_flash(void);
00045 extern void write_calibdata_to_flash(void);
00046 extern void init_spi1(void);
00047 extern void SPI1Send(char *, unsigned int, unsigned char);
00048 extern void PWM_Init( void );
00049 extern void SPI_get_data(unsigned int);
00050 
00051 extern unsigned char CAM_Commands_received;
00052 
00053 struct HL_STATUS {
00054       short battery_voltage_1;
00055       short battery_voltage_2;
00056       
00057       short up_time; 
00058       short flight_time;
00059       
00060       int latitude;
00061       int longitude;
00062       
00063       short status;
00064       short cpu_load;
00065       short yawenabled;
00066       short chksum_error;
00067 };
00068 
00069 extern struct HL_STATUS HL_Status;
00070 
00071 
00072 //PWM defines
00073 #define PWM_CYCLE               1200
00074 #define PWM_OFFSET              200
00075 
00076 #define MR0_INT                 1 << 0
00077 #define MR1_INT                 1 << 1
00078 #define MR2_INT                 1 << 2
00079 #define MR3_INT                 1 << 3
00080 #define MR4_INT                 1 << 8
00081 #define MR5_INT                 1 << 9
00082 #define MR6_INT                 1 << 10
00083 
00084 #define TCR_CNT_EN              0x00000001
00085 #define TCR_RESET               0x00000002
00086 #define TCR_PWM_EN              0x00000008
00087 
00088 #define PWMMR0I                 1 << 0
00089 #define PWMMR0R                 1 << 1
00090 #define PWMMR0S                 1 << 2
00091 #define PWMMR1I                 1 << 3
00092 #define PWMMR1R                 1 << 4
00093 #define PWMMR1S                 1 << 5
00094 #define PWMMR2I                 1 << 6
00095 #define PWMMR2R                 1 << 7
00096 #define PWMMR2S                 1 << 8
00097 #define PWMMR3I                 1 << 9
00098 #define PWMMR3R                 1 << 10
00099 #define PWMMR3S                 1 << 11
00100 #define PWMMR4I                 1 << 12
00101 #define PWMMR4R                 1 << 13
00102 #define PWMMR4S                 1 << 14
00103 #define PWMMR5I                 1 << 15
00104 #define PWMMR5R                 1 << 16
00105 #define PWMMR5S                 1 << 17
00106 #define PWMMR6I                 1 << 18
00107 #define PWMMR6R                 1 << 19
00108 #define PWMMR6S                 1 << 20
00109 
00110 #define PWMSEL2                 1 << 2
00111 #define PWMSEL3                 1 << 3
00112 #define PWMSEL4                 1 << 4
00113 #define PWMSEL5                 1 << 5
00114 #define PWMSEL6                 1 << 6
00115 #define PWMENA1                 1 << 9
00116 #define PWMENA2                 1 << 10
00117 #define PWMENA3                 1 << 11
00118 #define PWMENA4                 1 << 12
00119 #define PWMENA5                 1 << 13
00120 #define PWMENA6                 1 << 14
00121 
00122 #define LER0_EN                 1 << 0
00123 #define LER1_EN                 1 << 1
00124 #define LER2_EN                 1 << 2
00125 #define LER3_EN                 1 << 3
00126 #define LER4_EN                 1 << 4
00127 #define LER5_EN                 1 << 5
00128 #define LER6_EN                 1 << 6
00129 
00130 #endif /*SYSTEM_H_*/
00131 


asctec_hl_firmware
Author(s): Markus Achtelik, Michael Achtelik, Stephan Weiss, Laurent Kneip
autogenerated on Tue Jan 7 2014 11:05:19