Signal manager
groups at chichak.ca
groups at chichak.ca
Tue May 17 05:30:44 UTC 2016
> On 2016-May-16, at 11:10, Ярослав Лещинский <midniwalker at gmail.com> wrote:
>
> Hello. I'm try to use rtems with my stm board(stm32f4xx). And for now i have one problem: it's about ISR. The thing is, i have my own drivers, which uses isr(exti driver, uart and etc). I read rtems c-user manual properly, but still can't understand clearly, how i can bring control to rtems signal manager via ASR. I'll be appreciated, if someone can give some advise.
>
> Yaroslavl.
In my code I use interrupts for DMA with ADCs, and CAN using the HAL interrupt handler callback structure.
In this case, DMA2_Stream2_IRQHandler calls HAL_DMA_IRQHandler in stm32f4xx_hal_dma.c which figures what caused the interrupt and calls the appropriate callback.
In my ADC code I use this:
rtems_status_code status;
const char ADC1handlerName[] = "AD1r";
status = rtems_interrupt_handler_install((rtems_vector_number) DMA2_Stream2_IRQn,
ADC2handlerName, RTEMS_INTERRUPT_UNIQUE,
(rtems_interrupt_handler) DMA2_Stream2_IRQHandler, NULL);
if (status != RTEMS_SUCCESSFUL) {
printk("interrupt handler install 2 failed with %d\n", status);
}
Later, I have the interrupt callbacks:
void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc) {
rtems_status_code status;
status = rtems_event_send(ADCTaskId, RTEMS_EVENT_0);
if (status != RTEMS_SUCCESSFUL) {
printk("complete callback failed with %d", status);
}
}
void HAL_ADC_ConvHalfCpltCallback(ADC_HandleTypeDef* hadc) {
rtems_status_code status;
status = rtems_event_send(ADCTaskId, RTEMS_EVENT_1);
if (status != RTEMS_SUCCESSFUL) {
printk("half complete callback failed with %d", status);
}
}
In my CAN code I use:
rtems_status_code status;
status = rtems_interrupt_handler_install(CAN1_RX0_IRQn, "CANR", RTEMS_INTERRUPT_UNIQUE,
(rtems_interrupt_handler) CAN1_RX0_IRQHandler, NULL);
if (status != RTEMS_SUCCESSFUL) {
printk("Pressure task interrupt install bombed with %d\n", status);
}
and use the two call back functions HAL_CAN_RxCpltCallback and HAL_CAN_ErrorCallback in the same way as the ADC callbacks.
The symbol for external interrupt looks like EXTI0_IRQn and the UART would be like USART2_IRQn.
Andrei from The Great White North.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20160516/31b291b4/attachment-0002.html>
More information about the users
mailing list