src/sync.c
author lbessard
Thu, 06 Dec 2007 17:55:46 +0100
changeset 323 4df7e6d2d1db
parent 291 6165554cbfe9
child 365 9b76e0881beb
permissions -rw-r--r--
Adding "ParameterValue" as optional parameter for "VAR" entries
252
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
     1
/*
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
     2
This file is part of CanFestival, a library implementing CanOpen Stack. 
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
     3
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
     4
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
     5
Copyright (C): Edouard TISSERANT and Francis DUPIN
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
     6
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
     7
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
     8
See COPYING file for copyrights details.
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
     9
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    10
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    11
This library is free software; you can redistribute it and/or
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    12
modify it under the terms of the GNU Lesser General Public
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    13
License as published by the Free Software Foundation; either
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    14
version 2.1 of the License, or (at your option) any later version.
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    15
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    16
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    17
This library is distributed in the hope that it will be useful,
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    18
but WITHOUT ANY WARRANTY; without even the implied warranty of
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    19
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    20
Lesser General Public License for more details.
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    21
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    22
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    23
You should have received a copy of the GNU Lesser General Public
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    24
License along with this library; if not, write to the Free Software
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    25
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    26
*/
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    27
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    28
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    29
/*!
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    30
** @file   sync.c
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    31
** @author Edouard TISSERANT and Francis DUPIN
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    32
** @date   Tue Jun  5 09:32:32 2007
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    33
**
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    34
** @brief
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    35
**
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    36
**
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    37
*/
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    38
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    39
#include "data.h"
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    40
#include "sync.h"
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    41
#include "canfestival.h"
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    42
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    43
/* Prototypes for internals functions */
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    44
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    45
/*!                                                                                                
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    46
**                                                                                                 
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    47
**                                                                                                 
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    48
** @param d                                                                                        
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    49
** @param id                                                                                       
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    50
**/  
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    51
void SyncAlarm(CO_Data* d, UNS32 id);
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    52
UNS32 OnCOB_ID_SyncUpdate(CO_Data* d, const indextable * unsused_indextable, 
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    53
	UNS8 unsused_bSubindex);
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    54
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    55
/*!                                                                                                
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    56
**                                                                                                 
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    57
**                                                                                                 
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    58
** @param d                                                                                        
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    59
** @param id                                                                                       
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    60
**/   
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    61
void SyncAlarm(CO_Data* d, UNS32 id)
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    62
{
291
6165554cbfe9 Some tricks in communication services status struct (states.c) and in sync.c to fit with Beremiz generated node code.
etisserant
parents: 263
diff changeset
    63
	sendSYNC(d) ;
252
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    64
}
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    65
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    66
/*!                                                                                                
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    67
** This is called when Index 0x1005 is updated.                                                                                                
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    68
**                                                                                                 
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    69
** @param d                                                                                        
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    70
** @param unsused_indextable                                                                       
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    71
** @param unsused_bSubindex                                                                        
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    72
**                                                                                                 
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    73
** @return                                                                                         
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    74
**/  
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    75
UNS32 OnCOB_ID_SyncUpdate(CO_Data* d, const indextable * unsused_indextable, UNS8 unsused_bSubindex)
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    76
{
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    77
	startSYNC(d);
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    78
	return 0;
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    79
}
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    80
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    81
/*!                                                                                                
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    82
**                                                                                                 
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    83
**                                                                                                 
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    84
** @param d                                                                                        
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    85
**/ 
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    86
void startSYNC(CO_Data* d)
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    87
{
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    88
	RegisterSetODentryCallBack(d, 0x1005, 0, &OnCOB_ID_SyncUpdate);
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    89
	RegisterSetODentryCallBack(d, 0x1006, 0, &OnCOB_ID_SyncUpdate);
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    90
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    91
	if(d->syncTimer != TIMER_NONE){
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    92
		stopSYNC(d);
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    93
	}
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    94
	
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    95
	if(*d->COB_ID_Sync & 0x40000000 && *d->Sync_Cycle_Period)
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    96
	{
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    97
		d->syncTimer = SetAlarm(
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    98
				d,
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    99
				0 /*No id needed*/,
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   100
				&SyncAlarm,
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   101
				US_TO_TIMEVAL(*d->Sync_Cycle_Period), 
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   102
				US_TO_TIMEVAL(*d->Sync_Cycle_Period));
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   103
	}
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   104
}
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   105
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   106
/*!                                                                                                
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   107
**                                                                                                 
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   108
**                                                                                                 
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   109
** @param d                                                                                        
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   110
**/   
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   111
void stopSYNC(CO_Data* d)
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   112
{
263
d221d387ad2f Minor changes in SYNC. Splitted SendSync in SendSync and SendSyncMessage to allow manual SYNC message transmission and separate SYNC proceeding (synced TPDOs)
etisserant
parents: 252
diff changeset
   113
    RegisterSetODentryCallBack(d, 0x1005, 0, NULL);
d221d387ad2f Minor changes in SYNC. Splitted SendSync in SendSync and SendSyncMessage to allow manual SYNC message transmission and separate SYNC proceeding (synced TPDOs)
etisserant
parents: 252
diff changeset
   114
    RegisterSetODentryCallBack(d, 0x1006, 0, NULL);
252
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   115
	d->syncTimer = DelAlarm(d->syncTimer);
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   116
}
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   117
263
d221d387ad2f Minor changes in SYNC. Splitted SendSync in SendSync and SendSyncMessage to allow manual SYNC message transmission and separate SYNC proceeding (synced TPDOs)
etisserant
parents: 252
diff changeset
   118
d221d387ad2f Minor changes in SYNC. Splitted SendSync in SendSync and SendSyncMessage to allow manual SYNC message transmission and separate SYNC proceeding (synced TPDOs)
etisserant
parents: 252
diff changeset
   119
/*!                                                                                                
d221d387ad2f Minor changes in SYNC. Splitted SendSync in SendSync and SendSyncMessage to allow manual SYNC message transmission and separate SYNC proceeding (synced TPDOs)
etisserant
parents: 252
diff changeset
   120
**                                                                                                 
d221d387ad2f Minor changes in SYNC. Splitted SendSync in SendSync and SendSyncMessage to allow manual SYNC message transmission and separate SYNC proceeding (synced TPDOs)
etisserant
parents: 252
diff changeset
   121
**                                                                                                 
d221d387ad2f Minor changes in SYNC. Splitted SendSync in SendSync and SendSyncMessage to allow manual SYNC message transmission and separate SYNC proceeding (synced TPDOs)
etisserant
parents: 252
diff changeset
   122
** @param d                                                                                        
d221d387ad2f Minor changes in SYNC. Splitted SendSync in SendSync and SendSyncMessage to allow manual SYNC message transmission and separate SYNC proceeding (synced TPDOs)
etisserant
parents: 252
diff changeset
   123
** @param cob_id                                                                                   
d221d387ad2f Minor changes in SYNC. Splitted SendSync in SendSync and SendSyncMessage to allow manual SYNC message transmission and separate SYNC proceeding (synced TPDOs)
etisserant
parents: 252
diff changeset
   124
**                                                                                                 
d221d387ad2f Minor changes in SYNC. Splitted SendSync in SendSync and SendSyncMessage to allow manual SYNC message transmission and separate SYNC proceeding (synced TPDOs)
etisserant
parents: 252
diff changeset
   125
** @return                                                                                         
d221d387ad2f Minor changes in SYNC. Splitted SendSync in SendSync and SendSyncMessage to allow manual SYNC message transmission and separate SYNC proceeding (synced TPDOs)
etisserant
parents: 252
diff changeset
   126
**/  
291
6165554cbfe9 Some tricks in communication services status struct (states.c) and in sync.c to fit with Beremiz generated node code.
etisserant
parents: 263
diff changeset
   127
UNS8 sendSYNCMessage(CO_Data* d)
263
d221d387ad2f Minor changes in SYNC. Splitted SendSync in SendSync and SendSyncMessage to allow manual SYNC message transmission and separate SYNC proceeding (synced TPDOs)
etisserant
parents: 252
diff changeset
   128
{
d221d387ad2f Minor changes in SYNC. Splitted SendSync in SendSync and SendSyncMessage to allow manual SYNC message transmission and separate SYNC proceeding (synced TPDOs)
etisserant
parents: 252
diff changeset
   129
  Message m;
d221d387ad2f Minor changes in SYNC. Splitted SendSync in SendSync and SendSyncMessage to allow manual SYNC message transmission and separate SYNC proceeding (synced TPDOs)
etisserant
parents: 252
diff changeset
   130
  
d221d387ad2f Minor changes in SYNC. Splitted SendSync in SendSync and SendSyncMessage to allow manual SYNC message transmission and separate SYNC proceeding (synced TPDOs)
etisserant
parents: 252
diff changeset
   131
  MSG_WAR(0x3001, "sendSYNC ", 0);
d221d387ad2f Minor changes in SYNC. Splitted SendSync in SendSync and SendSyncMessage to allow manual SYNC message transmission and separate SYNC proceeding (synced TPDOs)
etisserant
parents: 252
diff changeset
   132
  
291
6165554cbfe9 Some tricks in communication services status struct (states.c) and in sync.c to fit with Beremiz generated node code.
etisserant
parents: 263
diff changeset
   133
  m.cob_id.w = *d->COB_ID_Sync & 0x1FFFFFFF;
263
d221d387ad2f Minor changes in SYNC. Splitted SendSync in SendSync and SendSyncMessage to allow manual SYNC message transmission and separate SYNC proceeding (synced TPDOs)
etisserant
parents: 252
diff changeset
   134
  m.rtr = NOT_A_REQUEST;
d221d387ad2f Minor changes in SYNC. Splitted SendSync in SendSync and SendSyncMessage to allow manual SYNC message transmission and separate SYNC proceeding (synced TPDOs)
etisserant
parents: 252
diff changeset
   135
  m.len = 0;
d221d387ad2f Minor changes in SYNC. Splitted SendSync in SendSync and SendSyncMessage to allow manual SYNC message transmission and separate SYNC proceeding (synced TPDOs)
etisserant
parents: 252
diff changeset
   136
  
d221d387ad2f Minor changes in SYNC. Splitted SendSync in SendSync and SendSyncMessage to allow manual SYNC message transmission and separate SYNC proceeding (synced TPDOs)
etisserant
parents: 252
diff changeset
   137
  return canSend(d->canHandle,&m);
d221d387ad2f Minor changes in SYNC. Splitted SendSync in SendSync and SendSyncMessage to allow manual SYNC message transmission and separate SYNC proceeding (synced TPDOs)
etisserant
parents: 252
diff changeset
   138
}
d221d387ad2f Minor changes in SYNC. Splitted SendSync in SendSync and SendSyncMessage to allow manual SYNC message transmission and separate SYNC proceeding (synced TPDOs)
etisserant
parents: 252
diff changeset
   139
d221d387ad2f Minor changes in SYNC. Splitted SendSync in SendSync and SendSyncMessage to allow manual SYNC message transmission and separate SYNC proceeding (synced TPDOs)
etisserant
parents: 252
diff changeset
   140
252
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   141
/*!                                                                                                
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   142
**                                                                                                 
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   143
**                                                                                                 
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   144
** @param d                                                                                        
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   145
** @param cob_id                                                                                   
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   146
**                                                                                                 
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   147
** @return                                                                                         
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   148
**/  
291
6165554cbfe9 Some tricks in communication services status struct (states.c) and in sync.c to fit with Beremiz generated node code.
etisserant
parents: 263
diff changeset
   149
UNS8 sendSYNC(CO_Data* d)
252
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   150
{
263
d221d387ad2f Minor changes in SYNC. Splitted SendSync in SendSync and SendSyncMessage to allow manual SYNC message transmission and separate SYNC proceeding (synced TPDOs)
etisserant
parents: 252
diff changeset
   151
  UNS8 res;
291
6165554cbfe9 Some tricks in communication services status struct (states.c) and in sync.c to fit with Beremiz generated node code.
etisserant
parents: 263
diff changeset
   152
  res = sendSYNCMessage(d);
263
d221d387ad2f Minor changes in SYNC. Splitted SendSync in SendSync and SendSyncMessage to allow manual SYNC message transmission and separate SYNC proceeding (synced TPDOs)
etisserant
parents: 252
diff changeset
   153
  proceedSYNC(d) ; 
d221d387ad2f Minor changes in SYNC. Splitted SendSync in SendSync and SendSyncMessage to allow manual SYNC message transmission and separate SYNC proceeding (synced TPDOs)
etisserant
parents: 252
diff changeset
   154
  return res ;
252
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   155
}
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   156
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   157
/*!                                                                                                
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   158
**                                                                                                 
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   159
**                                                                                                 
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   160
** @param d                                                                                        
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   161
** @param m                                                                                        
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   162
**                                                                                                 
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   163
** @return                                                                                         
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   164
**/ 
263
d221d387ad2f Minor changes in SYNC. Splitted SendSync in SendSync and SendSyncMessage to allow manual SYNC message transmission and separate SYNC proceeding (synced TPDOs)
etisserant
parents: 252
diff changeset
   165
UNS8 proceedSYNC(CO_Data* d)
252
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   166
{
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   167
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   168
  UNS8 res;
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   169
  
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   170
  MSG_WAR(0x3002, "SYNC received. Proceed. ", 0);
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   171
  
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   172
  (*d->post_sync)();
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   173
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   174
  /* only operational state allows PDO transmission */
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   175
  if(! d->CurrentCommunicationState.csPDO) 
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   176
    return 0;
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   177
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   178
  res = _sendPDOevent(d, 1 /*isSyncEvent*/ );
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   179
  
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   180
  /*Call user app callback*/
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   181
  (*d->post_TPDO)();
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   182
  
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   183
  return res;
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   184
  
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   185
}
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   186
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   187
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   188
void _post_sync(){}
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   189
void _post_TPDO(){}