fp@628: /******************************************************************************
fp@628:  *
fp@628:  *  $Id$
fp@628:  *
fp@628:  *  Copyright (C) 2006  Florian Pose, Ingenieurgemeinschaft IgH
fp@628:  *
fp@628:  *  This file is part of the IgH EtherCAT Master.
fp@628:  *
fp@628:  *  The IgH EtherCAT Master is free software; you can redistribute it
fp@628:  *  and/or modify it under the terms of the GNU General Public License
fp@628:  *  as published by the Free Software Foundation; either version 2 of the
fp@628:  *  License, or (at your option) any later version.
fp@628:  *
fp@628:  *  The IgH EtherCAT Master is distributed in the hope that it will be
fp@628:  *  useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
fp@628:  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
fp@628:  *  GNU General Public License for more details.
fp@628:  *
fp@628:  *  You should have received a copy of the GNU General Public License
fp@628:  *  along with the IgH EtherCAT Master; if not, write to the Free Software
fp@628:  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
fp@628:  *
fp@628:  *  The right to use EtherCAT Technology is granted and comes free of
fp@628:  *  charge under condition of compatibility of product made by
fp@628:  *  Licensee. People intending to distribute/sell products based on the
fp@628:  *  code, have to sign an agreement to guarantee that products using
fp@628:  *  software based on IgH EtherCAT master stay compatible with the actual
fp@628:  *  EtherCAT specification (which are released themselves as an open
fp@628:  *  standard) as the (only) precondition to have the right to use EtherCAT
fp@628:  *  Technology, IP and trade marks.
fp@628:  *
fp@628:  *****************************************************************************/
fp@628: 
fp@792: /** \file
fp@792:  * EtherCAT sync manager.
fp@792:  */
fp@628: 
fp@628: /*****************************************************************************/
fp@628: 
fp@883: #ifndef __EC_SYNC_H__
fp@883: #define __EC_SYNC_H__
fp@628: 
fp@628: #include "../include/ecrt.h"
fp@792: 
fp@628: #include "globals.h"
fp@879: #include "pdo_list.h"
fp@628: 
fp@628: /*****************************************************************************/
fp@628: 
fp@879: /** EtherCAT Pdo assignment source.
fp@792:  */
fp@792: typedef enum {
fp@879:     EC_ASSIGN_NONE, /**< No Pdos assigned. */
fp@879:     EC_ASSIGN_SII, /**< Pdo assignment read from SII. */
fp@879:     EC_ASSIGN_COE, /**< Pdo assignment read via CoE. */
fp@879:     EC_ASSIGN_CUSTOM, /**< Pdos assignment set by application. */
fp@879: } ec_assign_source_t;
fp@629: 
fp@629: /*****************************************************************************/
fp@629: 
fp@792: /** Sync manager.
fp@762:  */
fp@792: typedef struct {
fp@792:     ec_slave_t *slave; /**< Slave, the sync manager belongs to. */
fp@792:     uint16_t physical_start_address; /**< Physical start address. */
fp@1055:     uint16_t default_length; /**< Data length in bytes. */
fp@792:     uint8_t control_register; /**< Control register value. */
fp@792:     uint8_t enable; /**< Enable bit. */
fp@879:     ec_pdo_list_t pdos; /**< Current Pdo assignment. */
fp@879:     ec_assign_source_t assign_source; /**< Pdo assignment source. */
fp@792: } ec_sync_t;
fp@628: 
fp@628: /*****************************************************************************/
fp@628: 
fp@1055: void ec_sync_init(ec_sync_t *, ec_slave_t *);
fp@873: void ec_sync_init_copy(ec_sync_t *, const ec_sync_t *);
fp@628: void ec_sync_clear(ec_sync_t *);
fp@1055: void ec_sync_page(const ec_sync_t *, uint8_t, uint16_t, ec_direction_t,
fp@1055:         uint8_t *);
fp@635: int ec_sync_add_pdo(ec_sync_t *, const ec_pdo_t *);
fp@1055: ec_direction_t ec_sync_default_direction(const ec_sync_t *);
fp@748: 
fp@628: /*****************************************************************************/
fp@628: 
fp@628: #endif