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@628: #ifndef _EC_SYNC_H_ fp@628: #define _EC_SYNC_H_ fp@628: fp@628: #include fp@628: fp@628: #include "../include/ecrt.h" fp@792: fp@628: #include "globals.h" fp@792: #include "pdo_mapping.h" fp@628: fp@628: /*****************************************************************************/ fp@628: fp@814: /** EtherCAT sync manager Pdo mapping information source. fp@792: */ fp@792: typedef enum { fp@814: EC_SYNC_MAPPING_NONE, /**< No Pdo mapping information. */ fp@814: EC_SYNC_MAPPING_SII, /**< Pdo mapping information from SII. */ fp@814: EC_SYNC_MAPPING_COE, /**< Pdo mapping information from CoE dictionary. */ fp@814: EC_SYNC_MAPPING_CUSTOM, /**< Pdo mapping configured externally. */ fp@792: } ec_sync_mapping_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: unsigned int index; /**< Sync manager index. */ fp@792: uint16_t physical_start_address; /**< Physical start address. */ fp@792: uint16_t length; /**< Data length in bytes. */ fp@792: uint8_t control_register; /**< Control register value. */ fp@792: uint8_t enable; /**< Enable bit. */ fp@792: ec_pdo_mapping_t mapping; /**< Current Pdo mapping. */ fp@792: ec_sync_mapping_source_t mapping_source; /**< Pdo mapping source. */ fp@792: } ec_sync_t; fp@628: fp@628: /*****************************************************************************/ fp@628: fp@635: void ec_sync_init(ec_sync_t *, ec_slave_t *, unsigned int); fp@873: void ec_sync_init_copy(ec_sync_t *, const ec_sync_t *); fp@628: void ec_sync_clear(ec_sync_t *); fp@628: fp@792: void ec_sync_config(const ec_sync_t *, uint16_t, uint8_t *); fp@628: fp@635: int ec_sync_add_pdo(ec_sync_t *, const ec_pdo_t *); fp@635: fp@792: ec_direction_t ec_sync_direction(const ec_sync_t *); fp@748: fp@628: /*****************************************************************************/ fp@628: fp@628: #endif