projekty/Source/example1/src/armVIC.h

Go to the documentation of this file.
00001 /******************************************************************************
00002  *
00003  * $RCSfile: $
00004  * $Revision: $
00005  *
00006  * This module provides the interface definitions for setting up and
00007  * controlling the various interrupt modes present on the ARM processor.
00008  * Copyright 2004, R O SoftWare
00009  * No guarantees, warrantees, or promises, implied or otherwise.
00010  * May be used for hobby or commercial purposes provided copyright
00011  * notice remains intact.
00012  *
00013  *****************************************************************************/
00014 #ifndef INC_ARM_VIC_H
00015 #define INC_ARM_VIC_H
00016 
00017 /******************************************************************************
00018  *
00019  * Function Name: getCPRS()
00020  *
00021  * Description:
00022  *    This function return the status register
00023  *
00024  * Calling Sequence: 
00025  *    void
00026  *
00027  * Returns:
00028  *    value of CPSR
00029  *
00030  *****************************************************************************/
00031 unsigned getCPRS(void);
00032 /******************************************************************************
00033  *
00034  * Function Name: setCPRS(cprs)
00035  *
00036  * Description:
00037  *    This function set the status register
00038  *
00039  * Calling Sequence: 
00040  *    short unsigned - new cprs value
00041  *
00042  * Returns:
00043  *    old value of CPSR
00044  *
00045  *****************************************************************************/
00046 unsigned setCPRS(unsigned);
00047 /******************************************************************************
00048  *
00049  * MACRO Name: ISR_ENTRY()
00050  *
00051  * Description:
00052  *    This MACRO is used upon entry to an ISR.  The current version of
00053  *    the gcc compiler for ARM does not produce correct code for
00054  *    interrupt routines to operate properly with THUMB code.  The MACRO
00055  *    performs the following steps:
00056  *
00057  *    1 - Adjust address at which execution should resume after servicing
00058  *        ISR to compensate for IRQ entry
00059  *    2 - Save the non-banked registers r0-r12 and lr onto the IRQ stack.
00060  *    3 - Get the status of the interrupted program is in SPSR.
00061  *    4 - Push it onto the IRQ stack as well.
00062  *
00063  *****************************************************************************/
00064 #define ISR_ENTRY() asm volatile(" sub   lr, lr,#4\n" \
00065                                  " stmfd sp!,{r0-r12,lr}\n" \
00066                                  " mrs   r1, spsr\n" \
00067                                  " stmfd sp!,{r1}")
00068 
00069 /******************************************************************************
00070  *
00071  * MACRO Name: ISR_EXIT()
00072  *
00073  * Description:
00074  *    This MACRO is used to exit an ISR.  The current version of the gcc
00075  *    compiler for ARM does not produce correct code for interrupt
00076  *    routines to operate properly with THUMB code.  The MACRO performs
00077  *    the following steps:
00078  *
00079  *    1 - Recover SPSR value from stack       
00080  *    2 - and restore  its value                   
00081  *    3 - Pop the return address & the saved general registers from
00082  *        the IRQ stack & return
00083  *
00084  *****************************************************************************/
00085 #define ISR_EXIT()  asm volatile(" ldmfd sp!,{r1}\n" \
00086                                  " msr   spsr_c,r1\n" \
00087                                  " ldmfd sp!,{r0-r12,pc}^")
00088 
00089 /******************************************************************************
00090  *
00091  * Function Name: disableIRQ()
00092  *
00093  * Description:
00094  *    This function sets the IRQ disable bit in the status register
00095  *
00096  * Calling Sequence: 
00097  *    void
00098  *
00099  * Returns:
00100  *    previous value of CPSR
00101  *
00102  *****************************************************************************/
00103 unsigned disableIRQ(void);
00104 
00105 /******************************************************************************
00106  *
00107  * Function Name: enableIRQ()
00108  *
00109  * Description:
00110  *    This function clears the IRQ disable bit in the status register
00111  *
00112  * Calling Sequence: 
00113  *    void
00114  *
00115  * Returns:
00116  *    previous value of CPSR
00117  *
00118  *****************************************************************************/
00119 unsigned enableIRQ(void);
00120 
00121 /******************************************************************************
00122  *
00123  * Function Name: restoreIRQ()
00124  *
00125  * Description:
00126  *    This function restores the IRQ disable bit in the status register
00127  *    to the value contained within passed oldCPSR
00128  *
00129  * Calling Sequence: 
00130  *    void
00131  *
00132  * Returns:
00133  *    previous value of CPSR
00134  *
00135  *****************************************************************************/
00136 unsigned restoreIRQ(unsigned oldCPSR);
00137 
00138 /******************************************************************************
00139  *
00140  * Function Name: disableFIQ()
00141  *
00142  * Description:
00143  *    This function sets the FIQ disable bit in the status register
00144  *
00145  * Calling Sequence: 
00146  *    void
00147  *
00148  * Returns:
00149  *    previous value of CPSR
00150  *
00151  *****************************************************************************/
00152 unsigned disableFIQ(void);
00153 
00154 /******************************************************************************
00155  *
00156  * Function Name: enableFIQ()
00157  *
00158  * Description:
00159  *    This function clears the FIQ disable bit in the status register
00160  *
00161  * Calling Sequence: 
00162  *    void
00163  *
00164  * Returns:
00165  *    previous value of CPSR
00166  *
00167  *****************************************************************************/
00168 unsigned enableFIQ(void);
00169 
00170 /******************************************************************************
00171  *
00172  * Function Name: restoreIRQ()
00173  *
00174  * Description:
00175  *    This function restores the FIQ disable bit in the status register
00176  *    to the value contained within passed oldCPSR
00177  *
00178  * Calling Sequence: 
00179  *    void
00180  *
00181  * Returns:
00182  *    previous value of CPSR
00183  *
00184  *****************************************************************************/
00185 unsigned restoreFIQ(unsigned oldCPSR);
00186 
00187 #endif

Generated on Fri Sep 21 13:41:54 2007 for example1 by  doxygen 1.4.7