Таки не понял. У NXP:
/*****************************************************************************
* irq.c: Interrupt handler C file for NXP LPC23xx/24xx Family Microprocessors
*
* Copyright(C) 2006, NXP Semiconductor
* All rights reserved.
*
* History
* 2006.07.13 ver 1.00 Prelimnary version, first Release
*
******************************************************************************/
#include "lpc2478.h" /* LPC23XX/24xx Peripheral Registers */
#include "type.h"
#include "irq.h"
/* Initialize the interrupt controller */
/******************************************************************************
** Function name: init_VIC
**
** Descriptions: Initialize VIC interrupt controller.
** parameters: None
** Returned value: None
**
******************************************************************************/
void init_VIC(void)
{
DWORD i = 0;
DWORD *vect_addr, *vect_prio;
/* initialize VIC*/
VICIntEnClr = 0xffffffff;
VICVectAddr = 0;
VICIntSelect = 0;
/* set all the vector and vector control register to 0 */
for ( i = 0; i < VIC_SIZE; i++ )
{
vect_addr = (DWORD *)(VIC_BASE_ADDR + VECT_ADDR_INDEX + i*4);
vect_prio = (DWORD *)(VIC_BASE_ADDR + VECT_PRIO_INDEX + i*4);
*vect_addr = 0x0;
*vect_prio = 0xF;
}
return;
}
/******************************************************************************
** Function name: install_irq
**
** Descriptions: Install interrupt handler
** parameters: Interrupt number, interrupt handler address,
** interrupt priority
** Returned value: true or false, return false if IntNum is out of range
**
******************************************************************************/
unsigned int install_irq(unsigned int IntNumber, void *HandlerAddr, unsigned int Priority )
{
DWORD *vect_addr;
DWORD *vect_prio;
VICIntEnClr = 1 << IntNumber; /* Disable Interrupt */
if ( IntNumber >= VIC_SIZE )
{
return ( FALSE );
}
else
{
/* find first un-assigned VIC address for the handler */
vect_addr = (DWORD *)(VIC_BASE_ADDR + VECT_ADDR_INDEX + IntNumber*4);
vect_prio = (DWORD *)(VIC_BASE_ADDR + VECT_PRIO_INDEX + IntNumber*4);
*vect_addr = (DWORD)HandlerAddr; /* set interrupt vector */
*vect_prio = Priority;
VICIntEnable = 1 << IntNumber; /* Enable Interrupt */
return( TRUE );
}
}
__irq __arm void IRQ_Handler(void)
{
void (*interrupt_function)();
unsigned int vector;
vector=VICVectAddr;
if(vector==0)goto EXIT_IRQ;
interrupt_function = (void(*)())vector;
(*interrupt_function)();
EXIT_IRQ:
VICVectAddr=0;
}
/******************************************************************************
** End Of File
******************************************************************************/
Где такое для STM найти можно?
-
- написал же где. открываете хелп к либе, там где я написал, далее сылки на файлы, там целиком проекты, или ручками там AVF(69 знак., 29.07.2012 23:09)
- Скачать с сайта um0427, там внутри примеры. Vladimir Ljaschko(11367 знак., 29.07.2012 22:59)