master/sync.c
changeset 2149 98e1e773bed0
parent 1921 d9cf40facbc4
child 2411 01370d59233d
equal deleted inserted replaced
2148:289c42960b04 2149:98e1e773bed0
     1 /******************************************************************************
     1 /******************************************************************************
     2  *
     2  *
     3  *  $Id$
     3  *  $Id: sync.c,v d9cf40facbc4 2010/05/03 16:07:57 fp $
     4  *
     4  *
     5  *  Copyright (C) 2006-2008  Florian Pose, Ingenieurgemeinschaft IgH
     5  *  Copyright (C) 2006-2008  Florian Pose, Ingenieurgemeinschaft IgH
     6  *
     6  *
     7  *  This file is part of the IgH EtherCAT Master.
     7  *  This file is part of the IgH EtherCAT Master.
     8  *
     8  *
    94 void ec_sync_page(
    94 void ec_sync_page(
    95         const ec_sync_t *sync, /**< Sync manager. */
    95         const ec_sync_t *sync, /**< Sync manager. */
    96         uint8_t sync_index, /**< Index of the sync manager. */
    96         uint8_t sync_index, /**< Index of the sync manager. */
    97         uint16_t data_size, /**< Data size. */
    97         uint16_t data_size, /**< Data size. */
    98         const ec_sync_config_t *sync_config, /**< Configuration. */
    98         const ec_sync_config_t *sync_config, /**< Configuration. */
       
    99         uint8_t pdo_xfer, /**< Non-zero, if PDOs will be transferred via this
       
   100                             sync manager. */
    99         uint8_t *data /**> Configuration memory. */
   101         uint8_t *data /**> Configuration memory. */
   100         )
   102         )
   101 {
   103 {
   102     // enable only if SII enable is set and size is > 0 and SM is not virtual
   104     // enable only if (SII enable is set or PDO xfer)
   103     uint16_t enable = (sync->enable & 0x01)
   105     // and size is > 0 and SM is not virtual
       
   106     uint16_t enable = ((sync->enable & 0x01) || pdo_xfer)
   104                         && data_size
   107                         && data_size
   105                         && ((sync->enable & 0x04) == 0);
   108                         && ((sync->enable & 0x04) == 0);
   106     uint8_t control = sync->control_register;
   109     uint8_t control = sync->control_register;
   107 
   110 
   108     if (sync_config) {
   111     if (sync_config) {