can--installing can interrupt handler
Gedare Bloom
gedare at rtems.org
Tue May 1 14:58:02 UTC 2012
On Mon, Apr 30, 2012 at 11:24 PM, zhoupeng <zpeng563 at 126.com> wrote:
> Thank you for your answer!
> As you answer , I can run my test program now! But i can't understand how
> this "interrutp instanll" very well.
> May I ask you another question?
>
> IN my program
> "status = BSP_install_rtems_irq_handler( &can_isr_data );"
> if( status != RTEMS_SUCCESSFUL)
>
> {
> printk("Error installing can interrupt handler!\n");
> rtems_fatal_error_occurred(status);
> }
>
> Let's look at some system code about interrupt install.
> IN irq-legacy.c
> /**
> * @deprecated Use rtems_interrupt_handler_install() instead.
> */
> int BSP_install_rtems_irq_handler(const rtems_irq_connect_data *cd)
> {
> rtems_status_code sc = RTEMS_SUCCESSFUL;
> sc = rtems_interrupt_handler_install(
> cd->name,
> "LEGACY INSTALLED",
> RTEMS_INTERRUPT_UNIQUE,
> cd->hdl,
> cd->handle
> );
> if (sc != RTEMS_SUCCESSFUL) {
> return 0;
> }
> if (cd->on != NULL) {
> cd->on(cd);
> }
> return 1;
> }
>
> irq-generic.c
>
> rtems_status_code rtems_interrupt_handler_install(
> rtems_vector_number vector,
> const char *info,
> rtems_option options,
> rtems_interrupt_handler handler,
> void *arg
> )
> {
> return bsp_interrupt_handler_install(vector, info, options, handler, arg);
> }
>
>
> bsp_interrupt_handler_install will return RTEMS_SUCCESSFUL;
> rtems_interrupt_handler_install will return RTEMS_SUCCESSFUL;
> BSP_install_rtems_irq_handler will return 1;
> status = 1; This is not as we expect ( return RTEMS_SUCCESSFUL / 0)
>
The comments before the function BSP_install_rtems_irq_handler say it
is deprecated so it should not be used. If you are using it then I
suppose you should be aware of this issue.
>
>
>
> At 2012-05-01 01:28:46,"Gedare Bloom" <gedare at rtems.org> wrote:
>
>>Hi,
>>
>>I can't say much but it looks like you are checking for success by saying
>>if (!status) {
>> // fatal error
>>}
>>
>>which won't work as you expect because RTEMS_SUCCESSFUL is 0. You might try
>>if (status) {
>> // fatal error
>>}
>>or better yet
>>if(status != RTEMS_SUCCESSFUL) {
>> // fatal error
>>}
>>
>>Good luck
>>-Gedare
>
>
> ________________________________
> 网易Lofter,专注兴趣,分享创作!
More information about the users
mailing list