master/types.h
changeset 325 7833cf70c4f2
parent 324 9aa51cbdbfae
child 326 ddb48b173680
equal deleted inserted replaced
324:9aa51cbdbfae 325:7833cf70c4f2
     1 /******************************************************************************
       
     2  *
       
     3  *  $Id$
       
     4  *
       
     5  *  Copyright (C) 2006  Florian Pose, Ingenieurgemeinschaft IgH
       
     6  *
       
     7  *  This file is part of the IgH EtherCAT Master.
       
     8  *
       
     9  *  The IgH EtherCAT Master is free software; you can redistribute it
       
    10  *  and/or modify it under the terms of the GNU General Public License
       
    11  *  as published by the Free Software Foundation; either version 2 of the
       
    12  *  License, or (at your option) any later version.
       
    13  *
       
    14  *  The IgH EtherCAT Master is distributed in the hope that it will be
       
    15  *  useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    17  *  GNU General Public License for more details.
       
    18  *
       
    19  *  You should have received a copy of the GNU General Public License
       
    20  *  along with the IgH EtherCAT Master; if not, write to the Free Software
       
    21  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
       
    22  *
       
    23  *  The right to use EtherCAT Technology is granted and comes free of
       
    24  *  charge under condition of compatibility of product made by
       
    25  *  Licensee. People intending to distribute/sell products based on the
       
    26  *  code, have to sign an agreement to guarantee that products using
       
    27  *  software based on IgH EtherCAT master stay compatible with the actual
       
    28  *  EtherCAT specification (which are released themselves as an open
       
    29  *  standard) as the (only) precondition to have the right to use EtherCAT
       
    30  *  Technology, IP and trade marks.
       
    31  *
       
    32  *****************************************************************************/
       
    33 
       
    34 /**
       
    35    \file
       
    36    EtherCAT slave types.
       
    37 */
       
    38 
       
    39 /*****************************************************************************/
       
    40 
       
    41 #ifndef _EC_TYPES_H_
       
    42 #define _EC_TYPES_H_
       
    43 
       
    44 #include <linux/types.h>
       
    45 
       
    46 #include "../include/ecrt.h"
       
    47 
       
    48 /*****************************************************************************/
       
    49 
       
    50 #define EC_MAX_FIELDS 10 /**< maximal number of data fields per sync manager */
       
    51 #define EC_MAX_SYNC   16 /**< maximal number of sync managers per type */
       
    52 
       
    53 /*****************************************************************************/
       
    54 
       
    55 /**
       
    56    Special slaves.
       
    57 */
       
    58 
       
    59 typedef enum
       
    60 {
       
    61     EC_TYPE_NORMAL, /**< no special slave */
       
    62     EC_TYPE_BUS_COUPLER, /**< slave is a bus coupler */
       
    63     EC_TYPE_INFRA, /**< infrastructure slaves, that contain no process data */
       
    64     EC_TYPE_EOE /**< slave is an EoE switch */
       
    65 }
       
    66 ec_special_type_t;
       
    67 
       
    68 /*****************************************************************************/
       
    69 
       
    70 /**
       
    71    Process data field.
       
    72 */
       
    73 
       
    74 typedef struct
       
    75 {
       
    76     const char *name; /**< field name */
       
    77     size_t size; /**< field size in bytes */
       
    78 }
       
    79 ec_field_t;
       
    80 
       
    81 /*****************************************************************************/
       
    82 
       
    83 /**
       
    84    Sync manager.
       
    85 */
       
    86 
       
    87 typedef struct
       
    88 {
       
    89     uint16_t physical_start_address; /**< physical start address */
       
    90     uint16_t size; /**< size in bytes */
       
    91     uint8_t control_byte; /**< control register value */
       
    92     const ec_field_t *fields[EC_MAX_FIELDS]; /**< field array */
       
    93 }
       
    94 ec_sync_t;
       
    95 
       
    96 /*****************************************************************************/
       
    97 
       
    98 /**
       
    99    Slave description type.
       
   100 */
       
   101 
       
   102 typedef struct ec_slave_type
       
   103 {
       
   104     const char *vendor_name; /**< vendor name*/
       
   105     const char *product_name; /**< product name */
       
   106     const char *description; /**< free description */
       
   107     ec_special_type_t special; /**< special slave type? */
       
   108     const ec_sync_t *sync_managers[EC_MAX_SYNC]; /**< sync managers */
       
   109 }
       
   110 ec_slave_type_t;
       
   111 
       
   112 /*****************************************************************************/
       
   113 
       
   114 /**
       
   115    Slave type identification.
       
   116 */
       
   117 
       
   118 typedef struct
       
   119 {
       
   120     uint32_t vendor_id; /**< vendor id */
       
   121     uint32_t product_code; /**< product code */
       
   122     const ec_slave_type_t *type; /**< associated slave description object */
       
   123 }
       
   124 ec_slave_ident_t;
       
   125 
       
   126 extern ec_slave_ident_t slave_idents[]; /**< array with slave descriptions */
       
   127 
       
   128 /*****************************************************************************/
       
   129 
       
   130 #endif