fp@1732: /****************************************************************************** fp@1732: * fp@1732: * $Id$ fp@1732: * fp@1732: * Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH fp@1732: * fp@1732: * This file is part of the IgH EtherCAT Master. fp@1732: * fp@1732: * The IgH EtherCAT Master is free software; you can redistribute it fp@1732: * and/or modify it under the terms of the GNU General Public License fp@1732: * as published by the Free Software Foundation; either version 2 of the fp@1732: * License, or (at your option) any later version. fp@1732: * fp@1732: * The IgH EtherCAT Master is distributed in the hope that it will be fp@1732: * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of fp@1732: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the fp@1732: * GNU General Public License for more details. fp@1732: * fp@1732: * You should have received a copy of the GNU General Public License fp@1732: * along with the IgH EtherCAT Master; if not, write to the Free Software fp@1732: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA fp@1732: * fp@1732: * The right to use EtherCAT Technology is granted and comes free of fp@1732: * charge under condition of compatibility of product made by fp@1732: * Licensee. People intending to distribute/sell products based on the fp@1732: * code, have to sign an agreement to guarantee that products using fp@1732: * software based on IgH EtherCAT master stay compatible with the actual fp@1732: * EtherCAT specification (which are released themselves as an open fp@1732: * standard) as the (only) precondition to have the right to use EtherCAT fp@1732: * Technology, IP and trade marks. fp@1732: * fp@1732: *****************************************************************************/ fp@1732: fp@1732: /** fp@1732: \file fp@1732: EtherCAT CANopen structures. fp@1732: */ fp@1732: fp@1732: /*****************************************************************************/ fp@1732: fp@1732: #ifndef _EC_CANOPEN_H_ fp@1732: #define _EC_CANOPEN_H_ fp@1732: fp@1732: #include fp@1732: #include fp@1732: fp@1732: #include "globals.h" fp@1732: #include "slave.h" fp@1732: fp@1732: /*****************************************************************************/ fp@1732: fp@1732: /** fp@1732: CANopen SDO. fp@1732: */ fp@1732: fp@1746: struct ec_sdo fp@1732: { fp@1732: struct kobject kobj; /**< kobject */ fp@1732: struct list_head list; /**< list item */ fp@1732: ec_slave_t *slave; /**< parent slave */ fp@1732: uint16_t index; /**< SDO index */ fp@1732: uint8_t object_code; /**< object code */ fp@1732: char *name; /**< SDO name */ fp@1732: uint8_t subindices; /**< subindices */ fp@1732: struct list_head entries; /**< entry list */ fp@1746: }; fp@1732: fp@1732: /*****************************************************************************/ fp@1732: fp@1732: /** fp@1732: CANopen SDO entry. fp@1732: */ fp@1732: fp@1732: typedef struct fp@1732: { fp@1732: struct kobject kobj; /**< kobject */ fp@1732: struct list_head list; /**< list item */ fp@1732: ec_sdo_t *sdo; /**< parent SDO */ fp@1732: uint8_t subindex; /**< entry subindex */ fp@1732: uint16_t data_type; /**< entry data type */ fp@1732: uint16_t bit_length; /**< entry length in bit */ fp@1732: char *description; /**< entry description */ fp@1732: } fp@1732: ec_sdo_entry_t; fp@1732: fp@1732: /*****************************************************************************/ fp@1732: fp@1732: /** fp@1732: CANopen SDO configuration data. fp@1732: */ fp@1732: fp@1732: typedef struct fp@1732: { fp@1732: struct list_head list; /**< list item */ fp@1732: uint16_t index; /**< SDO index */ fp@1732: uint8_t subindex; /**< SDO subindex */ fp@1732: uint8_t *data; /**< pointer to SDO data */ fp@1732: size_t size; /**< size of SDO data */ fp@1732: } fp@1732: ec_sdo_data_t; fp@1732: fp@1732: /*****************************************************************************/ fp@1732: fp@1732: /** fp@1732: CANopen SDO request. fp@1732: */ fp@1732: fp@1732: typedef struct fp@1732: { fp@1744: struct list_head list; /**< list item */ fp@1746: ec_sdo_entry_t *entry; /**< SDO entry */ fp@1732: uint8_t *data; /**< pointer to SDO data */ fp@1732: size_t size; /**< size of SDO data */ fp@1746: ec_request_state_t state; /**< SDO request state */ fp@1732: } fp@1732: ec_sdo_request_t; fp@1732: fp@1732: /*****************************************************************************/ fp@1732: fp@1732: int ec_sdo_init(ec_sdo_t *, uint16_t, ec_slave_t *); fp@1732: void ec_sdo_destroy(ec_sdo_t *); fp@1746: ec_sdo_entry_t *ec_sdo_get_entry(ec_sdo_t *, uint8_t); fp@1732: fp@1732: int ec_sdo_entry_init(ec_sdo_entry_t *, uint8_t, ec_sdo_t *); fp@1732: void ec_sdo_entry_destroy(ec_sdo_entry_t *); fp@1732: fp@1746: void ec_sdo_request_init_read(ec_sdo_request_t *, ec_sdo_entry_t *); fp@1746: void ec_sdo_request_clear(ec_sdo_request_t *); fp@1746: fp@1732: /*****************************************************************************/ fp@1732: fp@1732: #endif