/****************************************Copyright (c)****************************************************************** ** Guangzou ZLG-MCU Development Co.,LTD. ** graduate school ** http://www.zlgmcu.com ** **--------------File Info------------------------------------------------------------------------------- ** File name : target.h ** Last modified Date : 2004-09-17 ** Last Version : 1.0 ** Descriptions : header file of the specific codes for LPC2100 target boards ** Every project should include a copy of this file, user may modify it as needed **----------------------------------------------------------------------------------------------------- ** Created by : Chenmingji ** Created date : 2004-02-02 ** Version : 1.0 ** Descriptions : The original version ** **----------------------------------------------------------------------------------------------------- ** Modified by : Chenmingji ** Modified date : 2004-09-17 ** Version : 1.01 ** Descriptions : Renewed the template, added codes to surport more compilers ** **----------------------------------------------------------------------------------------------------- ** Modified by : ** Modified date : ** Version : ** Descriptions : ** ************************************************************************************************************************/ #ifndef __TARGET_H #define __TARGET_H #ifdef __cplusplus extern "C" { #endif #ifndef IN_TARGET /************************************************************************************************************************ ** Function name : Reset ** Descriptions : resets the target board. ** input parameters : None ** ** Returned value : None ** ** Used global variables: None ** Calling modules : None ** ** Created by : Chenmingji ** Created Date : 2004/02/02 **------------------------------------------------------------------------------------------------------- ** Modified by : ** Modified date : **------------------------------------------------------------------------------------------------------- **************************************************************************************************************************/ extern void Reset(void); /************************************************************************************************************************ ** Function name : TargetInit ** ** Descriptions : Initialize the target board; it is called in a necessary place, change it as needed ** ** input parameters : None ** Returned value : None ** ** Used global variables: None ** Calling modules : None ** ** Created by : Chenmingji ** Created Date : 2004/02/02 **------------------------------------------------------------------------------------------------------- ** Modified by : Chenxibing ** Modified date : 2004-12-09 ** Notice : Add IntDisable() and IntEnable() Functions **------------------------------------------------------------------------------------------------------ **************************************************************************************************************************/ extern void TargetInit(void); #endif #ifdef __cplusplus } #endif #endif #define IRQDisable() asm volatile ("swi 0") #define IRQEnable() asm volatile ("swi 1") #define FIQDisable() asm volatile ("swi 2") #define FIQEnable() asm volatile ("swi 3") /************************************************************************************************************************ * * MACRO Name: ISR_ENTRY() * * Description: * This MACRO is used upon entry to an ISR. The current version of * the gcc compiler for ARM does not produce correct code for * interrupt routines to operate properly with THUMB code. The MACRO * performs the following steps: * * 1 - Adjust address at which execution should resume after servicing * ISR to compensate for IRQ entry * 2 - Save the non-banked registers r0-r12 and lr onto the IRQ stack. * 3 - Get the status of the interrupted program is in SPSR. * 4 - Push it onto the IRQ stack as well. * **************************************************************************************************************************/ #define ISR_ENTRY() asm volatile(" sub lr, lr,#4\n" \ " stmfd sp!,{r0-r12,lr}\n" \ " mrs r1, spsr\n" \ " stmfd sp!,{r1}") /************************************************************************************************************************ * * MACRO Name: ISR_EXIT() * * Description: * This MACRO is used to exit an ISR. The current version of the gcc * compiler for ARM does not produce correct code for interrupt * routines to operate properly with THUMB code. The MACRO performs * the following steps: * * 1 - Recover SPSR value from stack * 2 - and restore its value * 3 - Pop the return address & the saved general registers from * the IRQ stack & return * **************************************************************************************************************************/ #define ISR_EXIT() asm volatile(" ldmfd sp!,{r1}\n" \ " msr spsr_c,r1\n" \ " ldmfd sp!,{r0-r12,pc}^") /************************************************************************************************************************ ** End Of File **************************************************************************************************************************/