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_interrupts(void);
00040 extern void init_ports(void);
00041 extern void init_spi(void);
00042 extern void init_pwm(void);
00043 extern void init_get_calibdata_from_flash(void);
00044 extern void write_calibdata_to_flash(void);
00045 extern void init_spi1(void);
00046 extern void SPI1Send(char *, unsigned int, unsigned char);
00047 extern void PWM_Init( void );
00048 extern void SPI_get_data(unsigned int);
00049 
00050 extern unsigned char CAM_Commands_received;
00051 
00052 struct HL_STATUS {
00053       short battery_voltage_1;
00054       short battery_voltage_2;
00055       
00056       short up_time; 
00057       short flight_time;
00058       
00059       int latitude;
00060       int longitude;
00061       
00062       short status;
00063       short cpu_load;
00064       short yawenabled;
00065       short chksum_error;
00066 };
00067 
00068 extern struct HL_STATUS HL_Status;
00069 
00070 
00071 //PWM defines
00072 #define PWM_CYCLE               1200
00073 #define PWM_OFFSET              200
00074 
00075 #define MR0_INT                 1 << 0
00076 #define MR1_INT                 1 << 1
00077 #define MR2_INT                 1 << 2
00078 #define MR3_INT                 1 << 3
00079 #define MR4_INT                 1 << 8
00080 #define MR5_INT                 1 << 9
00081 #define MR6_INT                 1 << 10
00082 
00083 #define TCR_CNT_EN              0x00000001
00084 #define TCR_RESET               0x00000002
00085 #define TCR_PWM_EN              0x00000008
00086 
00087 #define PWMMR0I                 1 << 0
00088 #define PWMMR0R                 1 << 1
00089 #define PWMMR0S                 1 << 2
00090 #define PWMMR1I                 1 << 3
00091 #define PWMMR1R                 1 << 4
00092 #define PWMMR1S                 1 << 5
00093 #define PWMMR2I                 1 << 6
00094 #define PWMMR2R                 1 << 7
00095 #define PWMMR2S                 1 << 8
00096 #define PWMMR3I                 1 << 9
00097 #define PWMMR3R                 1 << 10
00098 #define PWMMR3S                 1 << 11
00099 #define PWMMR4I                 1 << 12
00100 #define PWMMR4R                 1 << 13
00101 #define PWMMR4S                 1 << 14
00102 #define PWMMR5I                 1 << 15
00103 #define PWMMR5R                 1 << 16
00104 #define PWMMR5S                 1 << 17
00105 #define PWMMR6I                 1 << 18
00106 #define PWMMR6R                 1 << 19
00107 #define PWMMR6S                 1 << 20
00108 
00109 #define PWMSEL2                 1 << 2
00110 #define PWMSEL3                 1 << 3
00111 #define PWMSEL4                 1 << 4
00112 #define PWMSEL5                 1 << 5
00113 #define PWMSEL6                 1 << 6
00114 #define PWMENA1                 1 << 9
00115 #define PWMENA2                 1 << 10
00116 #define PWMENA3                 1 << 11
00117 #define PWMENA4                 1 << 12
00118 #define PWMENA5                 1 << 13
00119 #define PWMENA6                 1 << 14
00120 
00121 #define LER0_EN                 1 << 0
00122 #define LER1_EN                 1 << 1
00123 #define LER2_EN                 1 << 2
00124 #define LER3_EN                 1 << 3
00125 #define LER4_EN                 1 << 4
00126 #define LER5_EN                 1 << 5
00127 #define LER6_EN                 1 << 6
00128 
00129 #endif /*SYSTEM_H_*/
00130 


asctec_hl_firmware
Author(s): Markus Achtelik, Michael Achtelik, Stephan Weiss, Laurent Kneip
autogenerated on Tue Dec 17 2013 11:39:27