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@628: /** fp@628: \file fp@628: EtherCAT sync manager. fp@628: */ 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@628: #include "globals.h" fp@628: fp@628: /*****************************************************************************/ fp@628: fp@629: /** size of a sync manager configuration page */ fp@629: #define EC_SYNC_SIZE 8 fp@629: fp@629: /*****************************************************************************/ fp@629: fp@628: /** fp@762: * EtherCAT sync manager PDO mapping information source. fp@762: */ fp@762: fp@762: typedef enum { fp@762: EC_SYNC_MAPPING_NONE, /**< No PDO mapping information */ fp@762: EC_SYNC_MAPPING_SII, /**< PDO mapping information from SII */ fp@762: EC_SYNC_MAPPING_COE /**< PDO mapping information from CoE dictionary */ fp@762: } fp@762: ec_sync_mapping_source_t; fp@762: fp@762: /*****************************************************************************/ fp@762: fp@762: /** fp@628: * Sync manager. fp@628: */ fp@628: fp@628: typedef struct fp@628: { fp@635: ec_slave_t *slave; /**< slave, the sync manager belongs to */ fp@628: unsigned int index; /**< sync manager index */ fp@628: uint16_t physical_start_address; /**< physical start address */ fp@628: uint16_t length; /**< data length in bytes */ fp@628: uint8_t control_register; /**< control register value */ fp@628: uint8_t enable; /**< enable bit */ fp@628: fp@635: uint16_t est_length; /**< used to calculate the length via PDO ranges */ fp@635: struct list_head pdos; /**< list of mapped PDOs */ fp@635: unsigned int alt_mapping; /**< alternative mapping configured */ fp@762: ec_sync_mapping_source_t mapping_source; /**< pdo mapping source */ fp@628: } fp@628: ec_sync_t; fp@628: fp@628: /*****************************************************************************/ fp@628: fp@635: void ec_sync_init(ec_sync_t *, ec_slave_t *, unsigned int); fp@628: void ec_sync_clear(ec_sync_t *); fp@628: fp@635: uint16_t ec_sync_size(const ec_sync_t *); fp@628: void ec_sync_config(const ec_sync_t *, uint8_t *); fp@628: fp@635: int ec_sync_add_pdo(ec_sync_t *, const ec_pdo_t *); fp@635: void ec_sync_clear_pdos(ec_sync_t *); fp@635: fp@748: ec_pdo_type_t ec_sync_get_pdo_type(const ec_sync_t *); fp@748: fp@628: /*****************************************************************************/ fp@628: fp@628: #endif