Помощь - Поиск - Пользователи - Календарь
Полная версия этой страницы: Microblaze Interrupt
Форум разработчиков электроники ELECTRONIX.ru > Программируемая логика ПЛИС (FPGA,CPLD, PLD) > Системы на ПЛИС - System on a Programmable Chip (SoPC)
-=Vitaly=-
Здравствуйте. Помогите обработать прерывание в Микроблейзе.

Использую одно прерывание ядра, контроллера прерываний нету. Вывел порт настроил его в ЕДК на восходящий фронт.
В программе написал:
Код
#include "mb_interface.h"
void microblaze_enable_interrupts (void);

Это должно выставлять битик IE в MSR?
А как написать обработчик? Функцией microblaze_register_handler ??
Может я что-то забыл?

Спасибо.
Camelot
The interrupt controller is not required when only one interrupting device is present and the interrupting pin and signal are level sensitive
The interrupt signal of the peripheral (or the external interrupt signal) must be connected to the interrupt input of the MicroBlaze processor in the MHS file
Define the signal in MSS file to associate them to peripherals
e.g. PARAMETER int_handler = uart_int_handler, int_port = Interrupt
Write an interrupt handler routine to service the request
The base address of the peripheral instance can be accessed as XPAR_INSTANCE_NAME_BASEADDR
-=Vitaly=-
Цитата(Camelot @ Nov 9 2007, 15:55) *
The interrupt controller is not required when only one interrupting device is present and the interrupting pin and signal are level sensitive
The interrupt signal of the peripheral (or the external interrupt signal) must be connected to the interrupt input of the MicroBlaze processor in the MHS file
Define the signal in MSS file to associate them to peripherals
e.g. PARAMETER int_handler = uart_int_handler, int_port = Interrupt
Write an interrupt handler routine to service the request
The base address of the peripheral instance can be accessed as XPAR_INSTANCE_NAME_BASEADDR


Так я так и сделал, у меня прерывание не от периферии а от внешнего пина. Я просто в С не спец, если не тяжело бросьте 2 строчки.
И в MSR битик ставится и в преывание входит.
-=Vitaly=-
Всем кому может пригодиться делается это так:

В MHS файле прописываем:
Код
PORT microblaze_0_INTERRUPT_pin = microblaze_0_INTERRUPT, DIR = I, SIGIS = INTERRUPT, SENSITIVITY = LEVEL_HIGH


BEGIN microblaze
PARAMETER INSTANCE = microblaze_0
PARAMETER HW_VER = 6.00.b
PARAMETER C_USE_FPU = 0
PARAMETER C_DEBUG_ENABLED = 1
PARAMETER C_NUMBER_OF_PC_BRK = 2
PARAMETER C_AREA_OPTIMIZED = 1
PARAMETER C_USE_HW_MUL = 0
BUS_INTERFACE DLMB = dlmb
BUS_INTERFACE ILMB = ilmb
BUS_INTERFACE DOPB = mb_opb
BUS_INTERFACE IOPB = mb_opb
PORT DBG_CAPTURE = DBG_CAPTURE_s
PORT DBG_CLK = DBG_CLK_s
PORT DBG_REG_EN = DBG_REG_EN_s
PORT DBG_TDI = DBG_TDI_s
PORT DBG_TDO = DBG_TDO_s
PORT DBG_UPDATE = DBG_UPDATE_s
--------------------PORT INTERRUPT = microblaze_0_INTERRUPT-----------------------
END

Выделено то, что надо добавить.
Тоже самое можно сделать просто вытянув порт прерывания микроблейза наружу ( я так и делал)

в MSS:

Код
PARAMETER int_handler = isr_handler, int_port = microblaze_0_INTERRUPT_pin


где isr_handler -имя вашего обработчика

В С файле пишете:
Код
void isr_handler (void)
{
  То, что хотите сделать  при обработке прерывания
}

void ISR_init (void)
{
microblaze_register_handler(isr_handler,(void *)0); - регистрация прерывания
microblaze_enable_interrupts();                               -разрешение прерывания
}

ISR_init засовываете в main там где у вас инициализация. И все прерывашка готова!
Для просмотра полной версии этой страницы, пожалуйста, пройдите по ссылке.
Invision Power Board © 2001-2025 Invision Power Services, Inc.