Help with rtai_serial

martino_davide at tiscali.it martino_davide at tiscali.it
Wed Jun 1 20:34:38 CEST 2005


Hi list,
I have generated an executable file from the source code " Hello World "
shown below.
But the function rt_spopen returns a negative number ( the port cannot be
opened).
Looking at the kernel output with the command dmesg,the following message
appears:
" Trying to free free IRQ0
  BAD: null rt_fun_ext[14] "

Is there anyone who has any idea to solve this problem ?



Thanks in advance, Davide
##############################################################################
##############################################################################
##############################################################################

#include <linux/ioport.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <rtai_lxrt.h>
#include <rtai_serial.h>
                        
 int main(int argc, char **argv)
  {
   unsigned long testcomtsk_name =
   nam2num("TESTCOM");
   RT_TASK *testcomtsk;
   char hello[] = "Hello World\n\r";
   int retval = 0;
   
   mlockall(MCL_CURRENT | MCL_FUTURE);
   if (!(testcomtsk =rt_task_init(testcomtsk_name, 1, 0, 0))) 
       {
                  printf("CANNOT INIT MASTER TASK\n");
                  exit(1);
          }
                                                        
                          
         rt_set_oneshot_mode();
         start_rt_timer(0);
         rt_make_hard_real_time();
  
                                                    
    if(rt_spopen(COM1, 9600, 8, 1,RT_SP_PARITY_NONE, RT_SP_NO_HAND_SHAKE,RT_SP_FIFO_DISABLE)
< 0 ) {
     printf("hello_world_lxrt: error in rt_spopen()\n");
            retval = 1;
         } 
        else 
             {
             rt_spwrite(COM1, hello, sizeof(hello));
             rt_sleep(nano2count(500000000));
             printf("rt_com_lxrt test: >>%s<< sent.\n",hello );
             rt_spclose(COM1);
             printf("rt_com_lxrt test: finished\n");
         }
                                                     
                         
        rt_make_soft_real_time();
        stop_rt_timer();
        rt_task_delete(testcomtsk);
         exit(retval);
 }


##################################################################################################
##################################################################################################
##################################################################################################

__________________________________________________________________
TISCALI ADSL 1.25 MEGA a soli 19.95 euro/mese
Solo con Tiscali Adsl navighi senza limiti di tempo
a meno di 20 euro al mese e in piu' telefoni senza
pagare il canone Telecom. Scopri come
http://abbonati.tiscali.it/adsl/sa/1e25flat_tc/







More information about the Rtai mailing list