Signal manager

Ярослав Лещинский midniwalker at gmail.com
Fri Aug 19 13:52:42 UTC 2016


Hi, everyone!

My battle with stm32 interrupts continues. Three month ago Andrei from The
Great White North gave me some code advise:

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);
> }
> }



i was trying the same but only for EXTI driver and no result. I have such
code:
http://pastebin.com/BZBNPRbg

After flashing, i received in console string "53", when i pushed the button
- all stopped, only reset can brought him back to life.

In C user guide i didn't find any references to
 rtems_interrupt_handler_install, some info was
about rtems_interrupt_catch, but when i try to use this, i received
"undefined reference".

Maybe, someone can help me with that problem?

Thanks.

P.S. Sorry for my english.


2016-05-17 8:40 GMT+03:00 Ярослав Лещинский <midniwalker at gmail.com>:

> Andrei, thanks!
> 17 мая 2016 г. 8:31 пользователь <groups at chichak.ca> написал:
>
>
>> 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
>> i*n 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.
>>
>>
>>
>>
>>


-- 

С уважением, Лещинский Ярослав.
+79814031224
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20160819/eeaed56a/attachment.html>


More information about the users mailing list