diff -r f45fd4cd3832 -r 34654679f262 doc/doxygen/html/can__virtual_8c-source.html --- a/doc/doxygen/html/can__virtual_8c-source.html Fri Jul 06 10:53:15 2007 +0200 +++ b/doc/doxygen/html/can__virtual_8c-source.html Mon Jul 16 08:56:03 2007 +0200 @@ -18,7 +18,7 @@
  • Globals
  • +drivers » can_virtual

    can_virtual.c

    Go to the documentation of this file.
    00001 /*
     00002 This file is part of CanFestival, a library implementing CanOpen Stack. 
     00003 
    @@ -51,17 +51,17 @@
     00030 #include "can_driver.h"
     00031 #include "def.h"
     00032 
    -00033 #define MAX_NB_CAN_PIPES 16
    +00033 #define MAX_NB_CAN_PIPES 16
     00034 
     00035 typedef struct {
    -00036   char used;
    -00037   int pipe[2];
    +00036   char used;
    +00037   int pipe[2];
     00038 } CANPipe;
     00039 
    -00040 CANPipe canpipes[MAX_NB_CAN_PIPES] = {{0,},{0,},{0,},{0,},{0,},{0,},{0,},{0,},{0,},{0,},{0,},{0,},{0,},{0,},{0,},{0,},};
    +00040 CANPipe canpipes[MAX_NB_CAN_PIPES] = {{0,},{0,},{0,},{0,},{0,},{0,},{0,},{0,},{0,},{0,},{0,},{0,},{0,},{0,},{0,},{0,},};
     00041 
     00042 /*********functions which permit to communicate with the board****************/
    -00043 UNS8 canReceive_driver(CAN_HANDLE fd0, Message *m)
    +00043 UNS8 canReceive_driver(CAN_HANDLE fd0, Message *m)
     00044 {
     00045         if(read(((CANPipe*)fd0)->pipe[0], m, sizeof(Message)) != (ssize_t)sizeof(Message))
     00046         {
    @@ -70,56 +70,56 @@
     00049         return 0;
     00050 }
     00051 
    -00052 #define MyCase(fc) case fc: printf(#fc);break;
    -00053 void print_message(Message *m)
    +00052 #define MyCase(fc) case fc: printf(#fc);break;
    +00053 void print_message(Message *m)
     00054 {
     00055         int i;
    -00056         switch(m->cob_id.w >> 7)
    +00056         switch(m->cob_id.w >> 7)
     00057         {
    -00058                 MyCase(SYNC)
    -00059                 MyCase(TIME_STAMP)
    -00060                 MyCase(PDO1tx)
    -00061                 MyCase(PDO1rx)
    -00062                 MyCase(PDO2tx)
    -00063                 MyCase(PDO2rx)
    -00064                 MyCase(PDO3tx)
    -00065                 MyCase(PDO3rx)
    -00066                 MyCase(PDO4tx)
    -00067                 MyCase(PDO4rx)
    -00068                 MyCase(SDOtx)
    -00069                 MyCase(SDOrx)
    -00070                 MyCase(NODE_GUARD)
    -00071                 MyCase(NMT)
    +00058                 MyCase(SYNC)
    +00059                 MyCase(TIME_STAMP)
    +00060                 MyCase(PDO1tx)
    +00061                 MyCase(PDO1rx)
    +00062                 MyCase(PDO2tx)
    +00063                 MyCase(PDO2rx)
    +00064                 MyCase(PDO3tx)
    +00065                 MyCase(PDO3rx)
    +00066                 MyCase(PDO4tx)
    +00067                 MyCase(PDO4rx)
    +00068                 MyCase(SDOtx)
    +00069                 MyCase(SDOrx)
    +00070                 MyCase(NODE_GUARD)
    +00071                 MyCase(NMT)
     00072         }
    -00073         printf(" rtr:%d", m->rtr);
    -00074         printf(" len:%d", m->len);
    -00075         for (i = 0 ; i < m->len ; i++)
    -00076                 printf(" %02x", m->data[i]);
    +00073         printf(" rtr:%d", m->rtr);
    +00074         printf(" len:%d", m->len);
    +00075         for (i = 0 ; i < m->len ; i++)
    +00076                 printf(" %02x", m->data[i]);
     00077         printf("\n");
     00078 }
     00079 
     00080 /***************************************************************************/
    -00081 UNS8 canSend_driver(CAN_HANDLE fd0, Message *m)
    +00081 UNS8 canSend_driver(CAN_HANDLE fd0, Message *m)
     00082 {
     00083   int i;
     00084   
    -00085   printf("%x->[ ", (CANPipe*)fd0 - &canpipes[0]); 
    -00086   for(i=0; i < MAX_NB_CAN_PIPES; i++)
    +00085   printf("%x->[ ", (CANPipe*)fd0 - &canpipes[0]); 
    +00086   for(i=0; i < MAX_NB_CAN_PIPES; i++)
     00087   {
    -00088         if(canpipes[i].used && &canpipes[i] != (CANPipe*)fd0)
    +00088         if(canpipes[i].used && &canpipes[i] != (CANPipe*)fd0)
     00089         {
     00090                 printf("%x ",i);        
     00091         }
     00092   }
     00093   printf(" ]"); 
    -00094   print_message(m);
    +00094   print_message(m);
     00095   
     00096   // Send to all readers, except myself
     00097   for(i=0; i < MAX_NB_CAN_PIPES; i++)
     00098   {
    -00099         if(canpipes[i].used && &canpipes[i] != (CANPipe*)fd0)
    +00099         if(canpipes[i].used && &canpipes[i] != (CANPipe*)fd0)
     00100         {
    -00101                 write(canpipes[i].pipe[1], m, sizeof(Message));
    +00101                 write(canpipes[i].pipe[1], m, sizeof(Message));
     00102         }
     00103   }
     00104   return 0;
    @@ -139,28 +139,28 @@
     00118         return 0;
     00119 }*/
     00120 /***************************************************************************/
    -00121 CAN_HANDLE canOpen_driver(s_BOARD *board)
    +00121 CAN_HANDLE canOpen_driver(s_BOARD *board)
     00122 {
     00123   int i;  
    -00124   for(i=0; i < MAX_NB_CAN_PIPES; i++)
    +00124   for(i=0; i < MAX_NB_CAN_PIPES; i++)
     00125   {
    -00126         if(!canpipes[i].used)
    +00126         if(!canpipes[i].used)
     00127                 break;
     00128   }
     00129 
     00130   /* Create the pipe.  */
    -00131   if (i==MAX_NB_CAN_PIPES || pipe(canpipes[i].pipe))
    +00131   if (i==MAX_NB_CAN_PIPES || pipe(canpipes[i].pipe))
     00132     {
     00133       fprintf (stderr, "Open failed.\n");
    -00134       return (CAN_HANDLE)NULL;
    +00134       return (CAN_HANDLE)NULL;
     00135     }
     00136 
    -00137    canpipes[i].used = 1;
    -00138    return (CAN_HANDLE) &canpipes[i];
    +00137    canpipes[i].used = 1;
    +00138    return (CAN_HANDLE) &canpipes[i];
     00139 }
     00140 
     00141 /***************************************************************************/
    -00142 int canClose_driver(CAN_HANDLE fd0)
    +00142 int canClose_driver(CAN_HANDLE fd0)
     00143 {
     00144   close(((CANPipe*)fd0)->pipe[0]);
     00145   close(((CANPipe*)fd0)->pipe[1]);
    @@ -169,7 +169,7 @@
     00148 }
     00149 
     00150 
    -

    Generated on Fri Jun 8 08:51:38 2007 for CanFestival by  +
    Generated on Mon Jul 2 19:10:16 2007 for CanFestival by  doxygen 1.5.1