src/sync.c
author greg
Wed, 16 Sep 2009 15:16:19 +0200
changeset 588 ee181b4f177b
parent 587 c175351a6994
permissions -rw-r--r--
Replace macro functions for setODentry and getODentry
(prevent compilation errors with visual studio c++ compiler)
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"
370
6fecf36df407 Fixed some endianization problems caused by switch to UNS16 for cob_id member in CAN messages. To be continued.
etisserant
parents: 365
diff changeset
    42
#include "sysdep.h"
252
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    43
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    44
/* Prototypes for internals functions */
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
**                                                                                                 
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    49
** @param d                                                                                        
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    50
** @param id                                                                                       
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    51
**/  
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    52
void SyncAlarm(CO_Data* d, UNS32 id);
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    53
UNS32 OnCOB_ID_SyncUpdate(CO_Data* d, const indextable * unsused_indextable, 
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    54
	UNS8 unsused_bSubindex);
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
**                                                                                                 
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    59
** @param d                                                                                        
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    60
** @param id                                                                                       
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    61
**/   
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    62
void SyncAlarm(CO_Data* d, UNS32 id)
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    63
{
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
    64
	sendSYNC(d) ;
252
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
/*!                                                                                                
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    68
** This is called when Index 0x1005 is updated.                                                                                                
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    69
**                                                                                                 
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    70
** @param d                                                                                        
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    71
** @param unsused_indextable                                                                       
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    72
** @param unsused_bSubindex                                                                        
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    73
**                                                                                                 
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    74
** @return                                                                                         
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    75
**/  
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    76
UNS32 OnCOB_ID_SyncUpdate(CO_Data* d, const indextable * unsused_indextable, UNS8 unsused_bSubindex)
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    77
{
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    78
	startSYNC(d);
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    79
	return 0;
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
**                                                                                                 
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    85
** @param d                                                                                        
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    86
**/ 
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    87
void startSYNC(CO_Data* d)
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    88
{
443
994c99afb344 sync.c : fixed some endianize problem, and calback de-registering when re-starting service.
etisserant
parents: 378
diff changeset
    89
	if(d->syncTimer != TIMER_NONE){
994c99afb344 sync.c : fixed some endianize problem, and calback de-registering when re-starting service.
etisserant
parents: 378
diff changeset
    90
		stopSYNC(d);
994c99afb344 sync.c : fixed some endianize problem, and calback de-registering when re-starting service.
etisserant
parents: 378
diff changeset
    91
	}
994c99afb344 sync.c : fixed some endianize problem, and calback de-registering when re-starting service.
etisserant
parents: 378
diff changeset
    92
252
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    93
	RegisterSetODentryCallBack(d, 0x1005, 0, &OnCOB_ID_SyncUpdate);
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    94
	RegisterSetODentryCallBack(d, 0x1006, 0, &OnCOB_ID_SyncUpdate);
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    95
443
994c99afb344 sync.c : fixed some endianize problem, and calback de-registering when re-starting service.
etisserant
parents: 378
diff changeset
    96
	if(*d->COB_ID_Sync & 0x40000000ul && *d->Sync_Cycle_Period)
252
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    97
	{
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    98
		d->syncTimer = SetAlarm(
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
    99
				d,
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   100
				0 /*No id needed*/,
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   101
				&SyncAlarm,
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
				US_TO_TIMEVAL(*d->Sync_Cycle_Period));
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
**                                                                                                 
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   110
** @param d                                                                                        
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   111
**/   
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   112
void stopSYNC(CO_Data* d)
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   113
{
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
   114
    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
   115
    RegisterSetODentryCallBack(d, 0x1006, 0, NULL);
252
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   116
	d->syncTimer = DelAlarm(d->syncTimer);
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   117
}
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   118
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
   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
**                                                                                                 
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 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
   124
** @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
   125
**                                                                                                 
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
** @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
   127
**/  
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
   128
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
   129
{
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
  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
   131
  
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
  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
   133
  
587
c175351a6994 fix warnings with msvc compiler
greg
parents: 447
diff changeset
   134
  m.cob_id = (UNS16)UNS16_LE(*d->COB_ID_Sync);
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
   135
  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
   136
  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
   137
  
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
  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
   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
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
   141
252
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
**                                                                                                 
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   145
** @param d                                                                                        
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   146
** @param cob_id                                                                                   
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   147
**                                                                                                 
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   148
** @return                                                                                         
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   149
**/  
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
   150
UNS8 sendSYNC(CO_Data* d)
252
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   151
{
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
   152
  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
   153
  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
   154
  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
   155
  return res ;
252
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
**                                                                                                 
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   161
** @param d                                                                                        
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   162
** @param m                                                                                        
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   163
**                                                                                                 
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   164
** @return                                                                                         
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   165
**/ 
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
   166
UNS8 proceedSYNC(CO_Data* d)
252
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   167
{
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   168
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   169
  UNS8 res;
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   170
  
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   171
  MSG_WAR(0x3002, "SYNC received. Proceed. ", 0);
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   172
  
378
d2abf6c8c27b As requested long ago, added CoData* parameter to all this applications callback, let application designer use identical callback for multiple nodes, and reduce source code length.
etisserant
parents: 370
diff changeset
   173
  (*d->post_sync)(d);
252
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   174
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   175
  /* only operational state allows PDO transmission */
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   176
  if(! d->CurrentCommunicationState.csPDO) 
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   177
    return 0;
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   178
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   179
  res = _sendPDOevent(d, 1 /*isSyncEvent*/ );
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   180
  
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   181
  /*Call user app callback*/
378
d2abf6c8c27b As requested long ago, added CoData* parameter to all this applications callback, let application designer use identical callback for multiple nodes, and reduce source code length.
etisserant
parents: 370
diff changeset
   182
  (*d->post_TPDO)(d);
252
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   183
  
b0dd37421d28 *** empty log message ***
leonid
parents: 236
diff changeset
   184
  return res;
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
378
d2abf6c8c27b As requested long ago, added CoData* parameter to all this applications callback, let application designer use identical callback for multiple nodes, and reduce source code length.
etisserant
parents: 370
diff changeset
   189
void _post_sync(CO_Data* d){}
d2abf6c8c27b As requested long ago, added CoData* parameter to all this applications callback, let application designer use identical callback for multiple nodes, and reduce source code length.
etisserant
parents: 370
diff changeset
   190
void _post_TPDO(CO_Data* d){}