src/sync.c
changeset 208 05d95c45b388
parent 204 44ce74232ccb
child 215 f49e5a6b7804
--- a/src/sync.c	Mon Jun 04 17:59:50 2007 +0200
+++ b/src/sync.c	Tue Jun 05 16:41:38 2007 +0200
@@ -20,33 +20,63 @@
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
 
+/*!
+** @file   sync.c
+** @author Edouard TISSERANT and Francis DUPIN
+** @date   Tue Jun  5 09:32:32 2007
+**
+** @brief
+**
+**
+*/
 
 #include "data.h"
 #include "sync.h"
 #include "canfestival.h"
 
 /* Prototypes for internals functions */
+
+/*!                                                                                                
+**                                                                                                 
+**                                                                                                 
+** @param d                                                                                        
+** @param id                                                                                       
+**/  
 void SyncAlarm(CO_Data* d, UNS32 id);
 UNS32 OnCOB_ID_SyncUpdate(CO_Data* d, const indextable * unsused_indextable, 
 	UNS8 unsused_bSubindex);
 
-
-
-/*****************************************************************************/
+/*!                                                                                                
+**                                                                                                 
+**                                                                                                 
+** @param d                                                                                        
+** @param id                                                                                       
+**/   
 void SyncAlarm(CO_Data* d, UNS32 id)
 {
 	sendSYNC(d, *d->COB_ID_Sync & 0x1FFFFFFF) ;
 }
 
-/*****************************************************************************/
-/* This is called when Index 0x1005 is updated.*/
+/*!                                                                                                
+** This is called when Index 0x1005 is updated.                                                                                                
+**                                                                                                 
+** @param d                                                                                        
+** @param unsused_indextable                                                                       
+** @param unsused_bSubindex                                                                        
+**                                                                                                 
+** @return                                                                                         
+**/  
 UNS32 OnCOB_ID_SyncUpdate(CO_Data* d, const indextable * unsused_indextable, UNS8 unsused_bSubindex)
 {
 	startSYNC(d);
 	return 0;
 }
 
-/*****************************************************************************/
+/*!                                                                                                
+**                                                                                                 
+**                                                                                                 
+** @param d                                                                                        
+**/ 
 void startSYNC(CO_Data* d)
 {
 	RegisterSetODentryCallBack(d, 0x1005, 0, &OnCOB_ID_SyncUpdate);
@@ -67,13 +97,24 @@
 	}
 }
 
-/*****************************************************************************/
+/*!                                                                                                
+**                                                                                                 
+**                                                                                                 
+** @param d                                                                                        
+**/   
 void stopSYNC(CO_Data* d)
 {
 	d->syncTimer = DelAlarm(d->syncTimer);
 }
 
-/*********************************************************************/
+/*!                                                                                                
+**                                                                                                 
+**                                                                                                 
+** @param d                                                                                        
+** @param cob_id                                                                                   
+**                                                                                                 
+** @return                                                                                         
+**/  
 UNS8 sendSYNC(CO_Data* d, UNS32 cob_id)
 {
   Message m;
@@ -89,7 +130,14 @@
   return resultat ;
 }
 
-/*****************************************************************************/
+/*!                                                                                                
+**                                                                                                 
+**                                                                                                 
+** @param d                                                                                        
+** @param m                                                                                        
+**                                                                                                 
+** @return                                                                                         
+**/ 
 UNS8 proceedSYNC(CO_Data* d, Message *m)
 {
 
@@ -97,11 +145,11 @@
         prp_j;
 
   const UNS8 *     pMappingCount = NULL;      /* count of mapped objects...*/
-  /* pointer to the var which is mapped to a pdo */
+  /** pointer to the var which is mapped to a pdo */
   /* void *     pMappedAppObject = NULL; */
-  /* pointer fo the var which holds the mapping parameter of an mapping entry  */
+  /** pointer fo the var which holds the mapping parameter of an mapping entry  */
   UNS32 *    pMappingParameter = NULL;  
-  /* pointer to the transmissiontype...*/
+  /** pointer to the transmissiontype...*/
   UNS8 *     pTransmissionType = NULL;  
   UNS32 *    pwCobId = NULL;	
 
@@ -125,12 +173,12 @@
   
   (*d->post_sync)();
 
-  /* only operational state allows PDO transmission */
+  /** only operational state allows PDO transmission */
   if( d->nodeState != Operational ) 
     return 0;
   
-  /* So, the node is in operational state */
-  /* study all PDO stored in the objects dictionary */	
+  /** So, the node is in operational state */
+  /** study all PDO stored in the objects dictionary */	
  
   offsetObjdict = d->firstIndex->PDO_TRS;
   lastIndex = d->lastIndex->PDO_TRS;
@@ -139,7 +187,7 @@
   if(offsetObjdict) while( offsetObjdict <= lastIndex) {  
     switch( status ) {
                     
-    case state3:    /* get the PDO transmission type */
+    case state3:    /** get the PDO transmission type */
       if (d->objdict[offsetObjdict].bSubCount <= 2) {
 	  MSG_ERR(0x1004, "Subindex 2  not found at index ", 0x1800 + pdoNum);
 	  return 0xFF;
@@ -148,8 +196,8 @@
       MSG_WAR(0x3005, "Reading PDO at index : ", 0x1800 + pdoNum);
       status = state4; 
       break;     
-    case state4:	/* check if transmission type is after (this) SYNC */
-                        /* The message may not be transmited every SYNC but every n SYNC */      
+    case state4:	/** check if transmission type is after (this) SYNC */
+                        /** The message may not be transmited every SYNC but every n SYNC */      
       if( (*pTransmissionType >= TRANS_SYNC_MIN) && (*pTransmissionType <= TRANS_SYNC_MAX) &&
           (++d->count_sync[pdoNum] == *pTransmissionType) ) {	
 	d->count_sync[pdoNum] = 0;
@@ -166,23 +214,23 @@
 	status = state11;
 	break;
       }      
-    case state5:	/* get PDO CobId */
+    case state5:	/** get PDO CobId */
         pwCobId = d->objdict[offsetObjdict].pSubindex[1].pObject;     
 	MSG_WAR(0x3009, "  PDO CobId is : ", *pwCobId);
 	status = state7;
 	break;     
-    case state7:  /* get mapped objects number to transmit with this PDO */
+    case state7:  /** get mapped objects number to transmit with this PDO */
       pMappingCount = d->objdict[offsetObjdictMap].pSubindex[0].pObject;
 	MSG_WAR(0x300D, "  Number of objects mapped : ",*pMappingCount );
 	status = state8;
-    case state8:	/* get mapping parameters */
+    case state8:	/** get mapping parameters */
       pMappingParameter = d->objdict[offsetObjdictMap].pSubindex[prp_j + 1].pObject;
 	MSG_WAR(0x300F, "  got mapping parameter : ", *pMappingParameter);
 	MSG_WAR(0x3050, "    at index : ", 0x1A00 + pdoNum);
 	MSG_WAR(0x3051, "    sub-index : ", prp_j + 1);
 	status = state9;
     
-    case state9:	/* get data to transmit */ 
+    case state9:	/** get data to transmit */ 
 	{
 	  UNS8 ByteSize;
 	  UNS8 tmp[]= {0,0,0,0,0,0,0,0};
@@ -191,7 +239,7 @@
 	  Size = (UNS8)(*pMappingParameter); /* Size in bits */
 	  ByteSize = 1 + ((Size - 1) >> 3); /*1->8 => 1 ; 9->16 => 2, ... */
 	  objDict = getODentry(d, index, subIndex, tmp, &ByteSize, &dataType, 0 );
-	  /* copy bit per bit in little endian*/
+	  /** copy bit per bit in little endian*/
 	  CopyBits(Size, ((UNS8*)tmp), 0 , 0, (UNS8*)&d->process_var.data[offset>>3], offset%8, 0);
 	}   
         if( objDict != OD_SUCCESSFUL ){
@@ -205,7 +253,7 @@
 	status = state10;	 
 	break;					
       
-    case state10:	/* loop to get all the data to transmit */
+    case state10:	/** loop to get all the data to transmit */
       if( prp_j < *pMappingCount ){
 	MSG_WAR(0x3014, "  next variable mapped : ", prp_j);
 	status = state8;