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

    can_peak_linux.c

    Go to the documentation of this file.
    00001 /*
     00002 This file is part of CanFestival, a library implementing CanOpen Stack. 
     00003 
    @@ -55,12 +55,12 @@
     00034 #include "can_driver.h"
     00035 
     00036 // Define for rtr CAN message
    -00037 #define CAN_INIT_TYPE_ST_RTR MSGTYPE_STANDARD | MSGTYPE_RTR 
    +00037 #define CAN_INIT_TYPE_ST_RTR MSGTYPE_STANDARD | MSGTYPE_RTR 
     00038 
     00039 /*********functions which permit to communicate with the board****************/
    -00040 UNS8 canReceive_driver(CAN_HANDLE fd0, Message *m)
    +00040 UNS8 canReceive_driver(CAN_HANDLE fd0, Message *m)
     00041 {
    -00042   UNS8 data; 
    +00042   UNS8 data; 
     00043   TPCANMsg peakMsg;
     00044   if ((errno = CAN_Read(fd0, & peakMsg))) {             // Blocks until no new message or error.
     00045     if(errno != -EIDRM && errno != -EPERM) // error is not "Can Port closed while reading" 
    @@ -69,33 +69,33 @@
     00048     }
     00049     return 1;
     00050   }
    -00051   m->cob_id.w = peakMsg.ID;   
    +00051   m->cob_id.w = peakMsg.ID;   
     00052   if (peakMsg.MSGTYPE == CAN_INIT_TYPE_ST)              /* bits of MSGTYPE_*/
    -00053     m->rtr = 0;
    +00053     m->rtr = 0;
     00054   else 
    -00055     m->rtr = 1;
    -00056   m->len = peakMsg.LEN;                                 /* count of data bytes (0..8) */
    +00055     m->rtr = 1;
    +00056   m->len = peakMsg.LEN;                                 /* count of data bytes (0..8) */
     00057   for(data = 0  ; data < peakMsg.LEN ; data++)                                  
    -00058     m->data[data] = peakMsg.DATA[data];                 /* data bytes, up to 8 */
    +00058     m->data[data] = peakMsg.DATA[data];                 /* data bytes, up to 8 */
     00059   
     00060   return 0;
     00061 }
     00062 
     00063 /***************************************************************************/
    -00064 UNS8 canSend_driver(CAN_HANDLE fd0, Message *m)
    +00064 UNS8 canSend_driver(CAN_HANDLE fd0, Message *m)
     00065 {
    -00066   UNS8 data;
    +00066   UNS8 data;
     00067   TPCANMsg peakMsg;
     00068   peakMsg.ID=m -> cob_id.w;                                     /* 11/29 bit code */
    -00069   if(m->rtr == 0)       
    +00069   if(m->rtr == 0)       
     00070     peakMsg.MSGTYPE = CAN_INIT_TYPE_ST;       /* bits of MSGTYPE_*/
     00071   else {
    -00072     peakMsg.MSGTYPE = CAN_INIT_TYPE_ST_RTR;       /* bits of MSGTYPE_*/
    +00072     peakMsg.MSGTYPE = CAN_INIT_TYPE_ST_RTR;       /* bits of MSGTYPE_*/
     00073   }
    -00074   peakMsg.LEN = m->len;   
    +00074   peakMsg.LEN = m->len;   
     00075                                 /* count of data bytes (0..8) */
    -00076   for(data = 0 ; data <  m->len; data ++)
    -00077         peakMsg.DATA[data] = m->data[data];             /* data bytes, up to 8 */
    +00076   for(data = 0 ; data <  m->len; data ++)
    +00077         peakMsg.DATA[data] = m->data[data];             /* data bytes, up to 8 */
     00078   
     00079   if((errno = CAN_Write(fd0, & peakMsg))) {
     00080     perror("canSend_driver (Peak_Linux) : error of writing.\n");
    @@ -107,7 +107,7 @@
     00086 
     00087 
     00088 /***************************************************************************/
    -00089 int TranslateBaudeRate(char* optarg){
    +00089 int TranslateBaudeRate(char* optarg){
     00090         if(!strcmp( optarg, "1M")) return CAN_BAUD_1M;
     00091         if(!strcmp( optarg, "500K")) return CAN_BAUD_500K;
     00092         if(!strcmp( optarg, "250K")) return CAN_BAUD_250K;
    @@ -122,7 +122,7 @@
     00101 }
     00102 
     00103 /***************************************************************************/
    -00104 CAN_HANDLE canOpen_driver(s_BOARD *board)
    +00104 CAN_HANDLE canOpen_driver(s_BOARD *board)
     00105 {
     00106   HANDLE fd0 = NULL;
     00107   char busname[64];
    @@ -130,29 +130,29 @@
     00109   int i;  
     00110   int baudrate;
     00111   
    -00112   if(strtol(board->busname, &pEnd,0) >= 0)
    +00112   if(strtol(board->busname, &pEnd,0) >= 0)
     00113   {
    -00114     sprintf(busname,"/dev/pcan%s",board->busname);
    +00114     sprintf(busname,"/dev/pcan%s",board->busname);
     00115     fd0 = LINUX_CAN_Open(busname, O_RDWR);
     00116   }
     00117 
    -00118   if(fd0 && (baudrate = TranslateBaudeRate(board->baudrate)))
    +00118   if(fd0 && (baudrate = TranslateBaudeRate(board->baudrate)))
     00119   {
     00120         CAN_Init(fd0, baudrate, CAN_INIT_TYPE_ST);
     00121   }else{
     00122         fprintf(stderr, "canOpen_driver (Peak_Linux) : error opening %s\n", busname);
     00123   }
     00124 
    -00125    return (CAN_HANDLE)fd0;
    +00125    return (CAN_HANDLE)fd0;
     00126 }
     00127 
     00128 /***************************************************************************/
    -00129 int canClose_driver(CAN_HANDLE fd0)
    +00129 int canClose_driver(CAN_HANDLE fd0)
     00130 {
     00131   CAN_Close(fd0);
     00132   return 0;
     00133 }
    -

    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