373a8c32b2
git-svn-id: file:///srv/dev-disk-by-uuid-17e88007-4d0c-45e0-8757-cacfcc458630/repositories/svn/Diplomarbeit@55 9fe90eed-be63-e94b-8204-d34ff4c2ff93
158 lines
4.9 KiB
C
158 lines
4.9 KiB
C
/******************************************************************************
|
|
*
|
|
* $RCSfile: $
|
|
* $Revision: $
|
|
*
|
|
* This module provides the interface definitions for setting up and
|
|
* controlling the various interrupt modes present on the ARM processor.
|
|
* Copyright 2004, R O SoftWare
|
|
* No guarantees, warrantees, or promises, implied or otherwise.
|
|
* May be used for hobby or commercial purposes provided copyright
|
|
* notice remains intact.
|
|
*
|
|
*****************************************************************************/
|
|
#ifndef INC_ARM_VIC_H
|
|
#define INC_ARM_VIC_H
|
|
|
|
/******************************************************************************
|
|
*
|
|
* 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}^")
|
|
|
|
/******************************************************************************
|
|
*
|
|
* Function Name: disableIRQ()
|
|
*
|
|
* Description:
|
|
* This function sets the IRQ disable bit in the status register
|
|
*
|
|
* Calling Sequence:
|
|
* void
|
|
*
|
|
* Returns:
|
|
* previous value of CPSR
|
|
*
|
|
*****************************************************************************/
|
|
unsigned disableIRQ(void);
|
|
|
|
/******************************************************************************
|
|
*
|
|
* Function Name: enableIRQ()
|
|
*
|
|
* Description:
|
|
* This function clears the IRQ disable bit in the status register
|
|
*
|
|
* Calling Sequence:
|
|
* void
|
|
*
|
|
* Returns:
|
|
* previous value of CPSR
|
|
*
|
|
*****************************************************************************/
|
|
unsigned enableIRQ(void);
|
|
|
|
/******************************************************************************
|
|
*
|
|
* Function Name: restoreIRQ()
|
|
*
|
|
* Description:
|
|
* This function restores the IRQ disable bit in the status register
|
|
* to the value contained within passed oldCPSR
|
|
*
|
|
* Calling Sequence:
|
|
* void
|
|
*
|
|
* Returns:
|
|
* previous value of CPSR
|
|
*
|
|
*****************************************************************************/
|
|
unsigned restoreIRQ(unsigned oldCPSR);
|
|
|
|
/******************************************************************************
|
|
*
|
|
* Function Name: disableFIQ()
|
|
*
|
|
* Description:
|
|
* This function sets the FIQ disable bit in the status register
|
|
*
|
|
* Calling Sequence:
|
|
* void
|
|
*
|
|
* Returns:
|
|
* previous value of CPSR
|
|
*
|
|
*****************************************************************************/
|
|
unsigned disableFIQ(void);
|
|
|
|
/******************************************************************************
|
|
*
|
|
* Function Name: enableFIQ()
|
|
*
|
|
* Description:
|
|
* This function clears the FIQ disable bit in the status register
|
|
*
|
|
* Calling Sequence:
|
|
* void
|
|
*
|
|
* Returns:
|
|
* previous value of CPSR
|
|
*
|
|
*****************************************************************************/
|
|
unsigned enableFIQ(void);
|
|
|
|
/******************************************************************************
|
|
*
|
|
* Function Name: restoreIRQ()
|
|
*
|
|
* Description:
|
|
* This function restores the FIQ disable bit in the status register
|
|
* to the value contained within passed oldCPSR
|
|
*
|
|
* Calling Sequence:
|
|
* void
|
|
*
|
|
* Returns:
|
|
* previous value of CPSR
|
|
*
|
|
*****************************************************************************/
|
|
unsigned restoreFIQ(unsigned oldCPSR);
|
|
|
|
#endif
|