fp@1744: /****************************************************************************** fp@1744: * fp@1744: * $Id$ fp@1744: * fp@1744: * Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH fp@1744: * fp@1744: * This file is part of the IgH EtherCAT Master. fp@1744: * fp@1744: * The IgH EtherCAT Master is free software; you can redistribute it fp@1744: * and/or modify it under the terms of the GNU General Public License fp@1744: * as published by the Free Software Foundation; either version 2 of the fp@1744: * License, or (at your option) any later version. fp@1744: * fp@1744: * The IgH EtherCAT Master is distributed in the hope that it will be fp@1744: * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of fp@1744: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the fp@1744: * GNU General Public License for more details. fp@1744: * fp@1744: * You should have received a copy of the GNU General Public License fp@1744: * along with the IgH EtherCAT Master; if not, write to the Free Software fp@1744: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA fp@1744: * fp@1744: * The right to use EtherCAT Technology is granted and comes free of fp@1744: * charge under condition of compatibility of product made by fp@1744: * Licensee. People intending to distribute/sell products based on the fp@1744: * code, have to sign an agreement to guarantee that products using fp@1744: * software based on IgH EtherCAT master stay compatible with the actual fp@1744: * EtherCAT specification (which are released themselves as an open fp@1744: * standard) as the (only) precondition to have the right to use EtherCAT fp@1744: * Technology, IP and trade marks. fp@1744: * fp@1744: *****************************************************************************/ fp@1744: fp@1744: /** fp@1744: \file fp@1744: EtherCAT sync manager. fp@1744: */ fp@1744: fp@1744: /*****************************************************************************/ fp@1744: fp@1744: #ifndef _EC_SYNC_H_ fp@1744: #define _EC_SYNC_H_ fp@1744: fp@1744: #include fp@1744: fp@1744: #include "../include/ecrt.h" fp@1744: #include "globals.h" fp@1744: fp@1744: /*****************************************************************************/ fp@1744: fp@1744: /** size of a sync manager configuration page */ fp@1744: #define EC_SYNC_SIZE 8 fp@1744: fp@1744: /*****************************************************************************/ fp@1744: fp@1744: /** fp@1749: * EtherCAT sync manager PDO mapping information source. fp@1749: */ fp@1749: fp@1749: typedef enum { fp@1749: EC_SYNC_MAPPING_NONE, /**< No PDO mapping information */ fp@1749: EC_SYNC_MAPPING_SII, /**< PDO mapping information from SII */ fp@1749: EC_SYNC_MAPPING_COE /**< PDO mapping information from CoE dictionary */ fp@1749: } fp@1749: ec_sync_mapping_source_t; fp@1749: fp@1749: /*****************************************************************************/ fp@1749: fp@1749: /** fp@1744: * Sync manager. fp@1744: */ fp@1744: fp@1744: typedef struct fp@1744: { fp@1744: ec_slave_t *slave; /**< slave, the sync manager belongs to */ fp@1744: unsigned int index; /**< sync manager index */ fp@1744: uint16_t physical_start_address; /**< physical start address */ fp@1744: uint16_t length; /**< data length in bytes */ fp@1744: uint8_t control_register; /**< control register value */ fp@1744: uint8_t enable; /**< enable bit */ fp@1744: fp@1744: uint16_t est_length; /**< used to calculate the length via PDO ranges */ fp@1744: struct list_head pdos; /**< list of mapped PDOs */ fp@1744: unsigned int alt_mapping; /**< alternative mapping configured */ fp@1749: ec_sync_mapping_source_t mapping_source; /**< pdo mapping source */ fp@1744: } fp@1744: ec_sync_t; fp@1744: fp@1744: /*****************************************************************************/ fp@1744: fp@1744: void ec_sync_init(ec_sync_t *, ec_slave_t *, unsigned int); fp@1744: void ec_sync_clear(ec_sync_t *); fp@1744: fp@1744: uint16_t ec_sync_size(const ec_sync_t *); fp@1744: void ec_sync_config(const ec_sync_t *, uint8_t *); fp@1744: fp@1744: int ec_sync_add_pdo(ec_sync_t *, const ec_pdo_t *); fp@1744: void ec_sync_clear_pdos(ec_sync_t *); fp@1744: fp@1746: ec_pdo_type_t ec_sync_get_pdo_type(const ec_sync_t *); fp@1746: fp@1744: /*****************************************************************************/ fp@1744: fp@1744: #endif