0,0 → 1,469 |
/*#######################################################################################*/ |
/* !!! THIS IS NOT FREE SOFTWARE !!! */ |
/*#######################################################################################*/ |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Copyright (c) 2008 Ingo Busker, Holger Buss |
// + Nur für den privaten Gebrauch |
// + FOR NON COMMERCIAL USE ONLY |
// + www.MikroKopter.com |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Es gilt für das gesamte Projekt (Hardware, Software, Binärfiles, Sourcecode und Dokumentation), |
// + dass eine Nutzung (auch auszugsweise) nur für den privaten (nicht-kommerziellen) Gebrauch zulässig ist. |
// + Sollten direkte oder indirekte kommerzielle Absichten verfolgt werden, ist mit uns (info@mikrokopter.de) Kontakt |
// + bzgl. der Nutzungsbedingungen aufzunehmen. |
// + Eine kommerzielle Nutzung ist z.B.Verkauf von MikroKoptern, Bestückung und Verkauf von Platinen oder Bausätzen, |
// + Verkauf von Luftbildaufnahmen, usw. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Werden Teile des Quellcodes (mit oder ohne Modifikation) weiterverwendet oder veröffentlicht, |
// + unterliegen sie auch diesen Nutzungsbedingungen und diese Nutzungsbedingungen incl. Copyright müssen dann beiliegen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Sollte die Software (auch auszugesweise) oder sonstige Informationen des MikroKopter-Projekts |
// + auf anderen Webseiten oder sonstigen Medien veröffentlicht werden, muss unsere Webseite "http://www.mikrokopter.de" |
// + eindeutig als Ursprung verlinkt werden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Keine Gewähr auf Fehlerfreiheit, Vollständigkeit oder Funktion |
// + Benutzung auf eigene Gefahr |
// + Wir übernehmen keinerlei Haftung für direkte oder indirekte Personen- oder Sachschäden |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die PORTIERUNG der Software (oder Teile davon) auf andere Systeme (ausser der Hardware von www.mikrokopter.de) ist nur |
// + mit unserer Zustimmung zulässig |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Die Funktion printf_P() unterliegt ihrer eigenen Lizenz und ist hiervon nicht betroffen |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
// + Redistributions of source code (with or without modifications) must retain the above copyright notice, |
// + this list of conditions and the following disclaimer. |
// + * Neither the name of the copyright holders nor the names of contributors may be used to endorse or promote products derived |
// + from this software without specific prior written permission. |
// + * The use of this project (hardware, software, binary files, sources and documentation) is only permitted |
// + for non-commercial use (directly or indirectly) |
// + Commercial use (for excample: selling of MikroKopters, selling of PCBs, assembly, ...) is only permitted |
// + with our written permission |
// + * If sources or documentations are redistributet on other webpages, out webpage (http://www.MikroKopter.de) must be |
// + clearly linked as origin |
// + * PORTING this software (or part of it) to systems (other than hardware from www.mikrokopter.de) is NOT allowed |
// |
// + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
// + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
// + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
// + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE |
// + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
// + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
// + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
// + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
// + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
// + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
// + POSSIBILITY OF SUCH DAMAGE. |
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
#include "91x_lib.h" |
#include "usb_lib.h" |
#include "fat16.h" |
#include "main.h" |
#include "uart1.h" |
#define global extern /* to declare external variables and functions */ |
|
extern void USB_Istr(void); |
|
void SWI_Handler (void) __attribute__ ((interrupt ("SWI"))); |
void Prefetch_Handler (void) __attribute__ ((interrupt ("ABORT"))); |
void Abort_Handler (void) __attribute__ ((interrupt ("ABORT"))); |
void Undefined_Handler (void) __attribute__ ((interrupt ("UNDEF"))); |
void FIQ_Handler (void) __attribute__ ((interrupt ("FIQ"))); |
|
void Dummy_Handler(void) |
{ |
VIC0->VAR = 0xFF; |
VIC1->VAR = 0xFF; |
} |
|
/* avoid the surprising reset-like behaviour by spurious interrupts */ |
void Interrupt_Init(void) |
{ |
VIC0->DVAR = (u32)Dummy_Handler; |
VIC1->DVAR = (u32)Dummy_Handler; |
} |
/******************************************************************************* |
* Function Name : SWI_Handler |
* Description : This function handles SW exception. |
* Input : None |
* Output : None |
* Return : None |
*******************************************************************************/ |
void SWI_Handler (void) |
{ |
} |
|
/******************************************************************************* |
* Function Name : Abort_Handler |
* Description : This function handles data abort exception. |
* Input : None |
* Output : None |
* Return : None |
*******************************************************************************/ |
void Abort_Handler (void) |
{ |
SerialPutString("\r\nAbort Handler"); |
while(1) |
{ |
// infinite loop |
} |
} |
|
/******************************************************************************* |
* Function Name : Undefined_Handler |
* Description : This function handles undefined instruction exception. |
* Input : None |
* Output : None |
* Return : None |
*******************************************************************************/ |
void Undefined_Handler (void) |
{ |
SerialPutString("\r\nUndefined Handler"); |
while(1) |
{ |
// infinite loop |
} |
} |
/******************************************************************************* |
* Function Name : FIQ_Handler |
* Description : This function handles FIQ exception. |
* Input : None |
* Output : None |
* Return : None |
*******************************************************************************/ |
void FIQ_Handler (void) |
{ |
} |
/******************************************************************************* |
* Function Name : Prefetch_Handler |
* Description : This function handles preftetch abort exception. |
*******************************************************************************/ |
void Prefetch_Handler(void) |
{ |
SerialPutString("\r\nPrefetch Handler"); |
while(1) |
{ |
// infinite loop |
} |
} |
/******************************************************************************* |
* Function Name : WDG_IRQHandler |
* Description : This function handles the WDG interrupt request |
*******************************************************************************/ |
void WDG_IRQHandler(void) |
{ |
/*write your handler here*/ |
/* ... */ |
|
|
/*write any value to VIC0 VAR*/ |
VIC0->VAR = 0xFF; |
} |
/******************************************************************************* |
* Function Name : SW_IRQHandler |
* Description : This function handles the SW interrupt request |
*******************************************************************************/ |
void SW_IRQHandler(void) |
{ |
/*write your handler here*/ |
/* ... */ |
|
|
/*write any value to VIC0 VAR*/ |
VIC0->VAR = 0xFF; |
} |
/******************************************************************************* |
* Function Name : ARMRX_IRQHandler |
* Description : This function handles the ARMRX interrupt request |
*******************************************************************************/ |
void ARMRX_IRQHandler(void) |
{ |
/*write your handler here*/ |
/* ... */ |
|
|
/*write any value to VIC0 VAR*/ |
VIC0->VAR = 0xFF; |
} |
/******************************************************************************* |
* Function Name : ARMTX_IRQHandler |
* Description : This function handles the ARMTX interrupt request |
*******************************************************************************/ |
void ARMTX_IRQHandler(void) |
{ |
/*write your handler here*/ |
/* ... */ |
|
|
/*write any value to VIC0 VAR*/ |
VIC0->VAR = 0xFF; |
} |
/******************************************************************************* |
* Function Name : TIM0_IRQHandler |
* Description : This function handles the TIM0 interrupt request |
*******************************************************************************/ |
void TIM0_IRQHandler(void) |
{ |
/*write your handler here*/ |
/* ... */ |
|
|
/*write any value to VIC0 VAR*/ |
VIC0->VAR = 0xFF; |
} |
/******************************************************************************* |
* Function Name : TIM1_IRQHandler |
* Description : This function handles the TIM1 interrupt request |
*******************************************************************************/ |
/* |
void TIM1_IRQHandler(void) |
{ |
// write any value to VIC0 VAR // |
VIC0->VAR = 0xFF; |
} |
*/ |
/******************************************************************************* |
* Function Name : TIM2_IRQHandler |
* Description : This function handles the TIM2 interrupt request |
*******************************************************************************/ |
void TIM2_IRQHandler(void) |
{ |
/*write your handler here*/ |
/* ... */ |
|
|
/*write any value to VIC0 VAR*/ |
VIC0->VAR = 0xFF; |
} |
/******************************************************************************* |
* Function Name : TIM3_IRQHandler |
* Description : This function handles the TIM3 interrupt request |
*******************************************************************************/ |
void TIM3_IRQHandler(void) |
{ |
/*write your handler here*/ |
/* ... */ |
|
|
/*write any value to VIC0 VAR*/ |
VIC0->VAR = 0xFF; |
} |
/******************************************************************************* |
* Function Name : USBHP_IRQHandler |
* Description : This function handles the USBHP interrupt request |
*******************************************************************************/ |
void USBHP_IRQHandler(void) |
{ |
CTR_HP(); |
/*write any value to VIC0 VAR*/ |
VIC0->VAR = 0xFF; |
} |
/******************************************************************************* |
* Function Name : USBLP_IRQHandler |
* Description : This function handles the USBLP interrupt request |
*******************************************************************************/ |
void USBLP_IRQHandler(void) |
{ |
USB_Istr(); /*write any value to VIC0 VAR*/ |
VIC0->VAR = 0xFF; |
} |
/******************************************************************************* |
* Function Name : SCU_IRQHandler |
* Description : This function handles the SCU interrupt request |
*******************************************************************************/ |
void SCU_IRQHandler(void) |
{ |
/*write your handler here*/ |
/* ... */ |
|
|
/*write any value to VIC0 VAR*/ |
VIC0->VAR = 0xFF; |
} |
/******************************************************************************* |
* Function Name : ENET_IRQHandler |
* Description : This function handles the DENET interrupt request |
*******************************************************************************/ |
void ENET_IRQHandler(void) |
{ |
/*write your handler here*/ |
/* ... */ |
|
|
/*write any value to VIC0 VAR*/ |
VIC0->VAR = 0xFF; |
} |
/******************************************************************************* |
* Function Name : DMA_IRQHandler |
* Description : This function handles the DMA interrupt request |
*******************************************************************************/ |
void DMA_IRQHandler(void) |
{ |
/*write your handler here*/ |
/* ... */ |
|
|
/*write any value to VIC0 VAR*/ |
VIC0->VAR = 0xFF; |
} |
/******************************************************************************* |
* Function Name : CAN_IRQHandler |
* Description : This function handles the CAN interrupt request |
*******************************************************************************/ |
void CAN_IRQHandler(void) |
{ |
/*write your handler here*/ |
/* ... */ |
|
|
/*write any value to VIC0 VAR*/ |
VIC0->VAR = 0xFF; |
} |
/******************************************************************************* |
* Function Name : MC_IRQHandler |
* Description : This function handles the MC interrupt request |
*******************************************************************************/ |
void MC_IRQHandler(void) |
{ |
/*write your handler here*/ |
/* ... */ |
|
|
/*write any value to VIC0 VAR*/ |
VIC0->VAR = 0xFF; |
} |
/******************************************************************************* |
* Function Name : ADC_IRQHandler |
* Description : This function handles the ADC interrupt request |
*******************************************************************************/ |
void ADC_IRQHandler(void) |
{ |
/*write your handler here*/ |
/* ... */ |
|
|
/*write any value to VIC0 VAR*/ |
VIC0->VAR = 0xFF; |
} |
/******************************************************************************* |
* Function Name : UART0_IRQHandler |
* Description : This function handles the UART0 interrupt request |
*******************************************************************************/ |
/*void UART0_IRQHandler(void) |
{ |
} */ |
/******************************************************************************* |
* Function Name : UART1_IRQHandler |
* Description : This function handles the UART1 interrupt request |
*******************************************************************************/ |
/*void UART1_IRQHandler(void) |
{ |
} */ |
/******************************************************************************* |
* Function Name : UART2_IRQHandler |
* Description : This function handles the UART2 interrupt request |
*******************************************************************************/ |
/*void UART2_IRQHandler(void) |
{ |
} */ |
/******************************************************************************* |
* Function Name : I2C0_IRQHandler |
* Description : This function handles the I2C0 interrupt request |
*******************************************************************************/ |
void I2C0_IRQHandler(void) |
{ |
} |
/******************************************************************************* |
* Function Name : I2C1_IRQHandler |
* Description : This function handles the I2C1 interrupt request |
*******************************************************************************/ |
/*void I2C1_IRQHandler(void) |
{ |
} */ |
/******************************************************************************* |
* Function Name : SSP0_IRQHandler |
* Description : This function handles the SSP0 interrupt request |
*******************************************************************************/ |
/*void SSP0_IRQHandler(void) |
{ |
} */ |
/******************************************************************************* |
* Function Name : SSP1_IRQHandler |
* Description : This function handles the SSP1 interrupt request |
*******************************************************************************/ |
void SSP1_IRQHandler(void) |
{ |
} |
/******************************************************************************* |
* Function Name : LVD_IRQHandler |
* Description : This function handles the LVD interrupt request |
*******************************************************************************/ |
void LVD_IRQHandler(void) |
{ |
} |
/******************************************************************************* |
* Function Name : RTC_IRQHandler |
* Description : This function handles the RTC interrupt request |
*******************************************************************************/ |
void RTC_IRQHandler(void) |
{ |
} |
/******************************************************************************* |
* Function Name : WIU_IRQHandler |
* Description : This function handles the WIU interrupt request |
*******************************************************************************/ |
void WIU_IRQHandler(void) |
{ |
} |
/******************************************************************************* |
* Function Name : EXTIT0_IRQHandler |
* Description : This function handles the EXTIT0 interrupt request |
*******************************************************************************/ |
void EXTIT0_IRQHandler(void) |
{ |
} |
/******************************************************************************* |
* Function Name : EXTIT1_IRQHandler |
* Description : This function handles the EXTIT1 interrupt request |
*******************************************************************************/ |
void EXTIT1_IRQHandler(void) |
{ |
VIC_ITCmd(EXTIT1_ITLine, DISABLE); |
if(WIU_GetITStatus(WIU_Line11) != RESET) |
{ |
BeepTime = 100; |
Fat16_Init(); // initialize sd-card file system. |
|
WIU_ClearFlag(WIU_Line1); |
WIU_ClearITPendingBit(WIU_Line11); |
} |
VIC_ITCmd(EXTIT1_ITLine, ENABLE); |
} |
/******************************************************************************* |
* Function Name : EXTIT2_IRQHandler |
* Description : This function handles the EXTIT2 interrupt request |
*******************************************************************************/ |
void EXTIT2_IRQHandler(void) |
{ |
} |
/******************************************************************************* |
* Function Name : EXTIT3_IRQHandler |
* Description : This function handles the EXTIT3 interrupt request |
*******************************************************************************/ |
void EXTIT3_IRQHandler(void) |
{ |
} |
/******************************************************************************* |
* Function Name : USBWU_IRQHandler |
* Description : This function handles the USBWU interrupt request |
*******************************************************************************/ |
void USBWU_IRQHandler(void) |
{ |
} |
/******************************************************************************* |
* Function Name : PFQBC_IRQHandler |
* Description : This function handles the PFQBC interrupt request |
*******************************************************************************/ |
void PFQBC_IRQHandler(void) |
{ |
} |
|