00001 /*! \file processor.h \brief LPC2100 Processor Initialization and Support. */ 00002 //***************************************************************************** 00003 // 00004 // File Name : 'processor.h' 00005 // Title : LPC2100 Processor Initialization and Support 00006 // Author : Pascal Stang - Copyright (C) 2004 00007 // Created : 2004.05.05 00008 // Revised : 2004.07.12 00009 // Version : 0.1 00010 // Target MCU : ARM processors 00011 // Editor Tabs : 4 00012 // 00013 // NOTE: This code is currently below version 1.0, and therefore is considered 00014 // to be lacking in some functionality or documentation, or may not be fully 00015 // tested. Nonetheless, you can expect most functions to work. 00016 // 00017 /// \ingroup driver_arm_lpc2000 00018 /// \defgroup processor_lpc2000 LPC2000 Processor Initialization and Support (armlib/arch/lpc2000/processor.c) 00019 /// \code #include "processor.h" \endcode 00020 /// \par Overview 00021 /// To be written... 00022 // 00023 // This code is distributed under the GNU Public License 00024 // which can be found at http://www.gnu.org/licenses/gpl.txt 00025 // 00026 //***************************************************************************** 00027 //@{ 00028 00029 #ifndef PROCESSOR_H 00030 #define PROCESSOR_H 00031 00032 #include "global.h" 00033 00034 // masks for use with enable/disable ARM core interrupts 00035 #define CPSR_MASK_IRQ 0x00000080 00036 #define CPSR_MASK_FIQ 0x00000040 00037 #define CPSR_MASK_INT (CPSR_MASK_IRQ | CPSR_MASK_FIQ) 00038 00039 // general processor functions 00040 void processorInit(void); 00041 unsigned int processorEnableInt(unsigned int cpsr_mask); 00042 unsigned int processorDisableInt(unsigned int cpsr_mask); 00043 unsigned int processorRestoreInt(unsigned int cpsr_orig); 00044 00045 // VIC functions 00046 00047 // initialize the VIC vectors 00048 void processorVicInit(void); 00049 00050 // Attach an interrupt handler on specified peripheral-ID interrupt channel. 00051 // Also enables interrupt in VIC. 00052 void processorVicAttach(int pid, int srcmode, void (*userFunc)(void) ); 00053 00054 // Detach current interrupt handler on specified peripheral-ID interrupt channel. 00055 // Also disables interrupt in VIC. 00056 void processorVicDetach(int pid); 00057 00058 00059 // Macro for use upon entry to naked interrupt handler 00060 // - saves non-banked CPU registers and SPSR onto IRQ/FIQ stack 00061 #define ISR_ENTRY() asm volatile(" sub lr, lr,#4\n" \ 00062 " stmfd sp!,{r0-r12,lr}\n" \ 00063 " mrs r1, spsr\n" \ 00064 " stmfd sp!,{r1}") 00065 00066 // Macro for use upon exit from naked interrupt handler 00067 // - restores SPSR and non-banked CPU registers from IRQ/FIQ stack 00068 #define ISR_EXIT() asm volatile(" ldmfd sp!,{r1}\n" \ 00069 " msr spsr_c,r1\n" \ 00070 " ldmfd sp!,{r0-r12,pc}^") 00071 00072 #endif 00073 //@}