dummy/domain.c
changeset 665 a9794f927d78
child 666 825ead3e0559
equal deleted inserted replaced
664:18c48cb7de06 665:a9794f927d78
       
     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 DUMMY domain methods.
       
    37 */
       
    38 
       
    39 /*****************************************************************************/
       
    40 
       
    41 #include "../master/globals.h"
       
    42 #include "../master/domain.h"
       
    43 #include "../master/master.h"
       
    44 
       
    45 /*****************************************************************************/
       
    46 
       
    47 uint8_t dummy_data[PAGE_SIZE];
       
    48 
       
    49 /*****************************************************************************/
       
    50 
       
    51 /** \cond */
       
    52 
       
    53 int ecrt_domain_register_pdo(
       
    54         ec_domain_t *domain, /**< EtherCAT domain */
       
    55         ec_slave_t *slave, /**< EtherCAT slave */
       
    56         uint16_t pdo_entry_index, /**< PDO entry index */
       
    57         uint8_t pdo_entry_subindex, /**< PDO entry subindex */
       
    58         void **data_ptr /**< address of the process data pointer */
       
    59         )
       
    60 {
       
    61 	*data_ptr = dummy_data;
       
    62 	return 0;
       
    63 }
       
    64 
       
    65 /*****************************************************************************/
       
    66 
       
    67 /**
       
    68  * Registers a bunch of data fields.
       
    69  * \attention The list has to be terminated with a NULL structure ({})!
       
    70  * \return 0 in case of success, else < 0
       
    71  * \ingroup RealtimeInterface
       
    72  */
       
    73 
       
    74 int ecrt_domain_register_pdo_list(
       
    75         ec_domain_t *domain, /**< EtherCAT domain */
       
    76         const ec_pdo_reg_t *pdo_regs /**< array of PDO registrations */
       
    77         )
       
    78 {
       
    79     const ec_pdo_reg_t *reg;
       
    80     
       
    81     for (reg = pdo_regs; reg->slave_address; reg++) {
       
    82 		*(reg->data_ptr) = dummy_data;
       
    83     }
       
    84 
       
    85     return 0;
       
    86 }
       
    87 
       
    88 /*****************************************************************************/
       
    89 
       
    90 /**
       
    91  * Registers a PDO range in a domain.
       
    92  * \return 0 on success, else non-zero
       
    93  * \ingroup RealtimeInterface
       
    94  */
       
    95 
       
    96 int ecrt_domain_register_pdo_range(
       
    97         ec_domain_t *domain, /**< EtherCAT domain */
       
    98         ec_slave_t *slave, /**< EtherCAT slave */
       
    99         ec_direction_t dir, /**< data direction */
       
   100         uint16_t offset, /**< offset in slave's PDO range */
       
   101         uint16_t length, /**< length of this range */
       
   102         void **data_ptr /**< address of the process data pointer */
       
   103         )
       
   104 {
       
   105 	*data_ptr = dummy_data;
       
   106     return 0;
       
   107 }
       
   108 
       
   109 /*****************************************************************************/
       
   110 
       
   111 /**
       
   112    Processes received process data and requeues the domain datagram(s).
       
   113    \ingroup RealtimeInterface
       
   114 */
       
   115 
       
   116 void ecrt_domain_process(ec_domain_t *domain /**< EtherCAT domain */)
       
   117 {
       
   118 }
       
   119 
       
   120 /*****************************************************************************/
       
   121 
       
   122 /**
       
   123    Places all process data datagrams in the masters datagram queue.
       
   124    \ingroup RealtimeInterface
       
   125 */
       
   126 
       
   127 void ecrt_domain_queue(ec_domain_t *domain /**< EtherCAT domain */)
       
   128 {
       
   129 }
       
   130 
       
   131 /*****************************************************************************/
       
   132 
       
   133 /**
       
   134    Returns the state of a domain.
       
   135    \return 0 if all datagrams were received, else -1.
       
   136    \ingroup RealtimeInterface
       
   137 */
       
   138 
       
   139 int ecrt_domain_state(const ec_domain_t *domain /**< EtherCAT domain */)
       
   140 {
       
   141     return 0;
       
   142 }
       
   143 
       
   144 /*****************************************************************************/
       
   145 
       
   146 /** \cond */
       
   147 
       
   148 EXPORT_SYMBOL(ecrt_domain_register_pdo);
       
   149 EXPORT_SYMBOL(ecrt_domain_register_pdo_list);
       
   150 EXPORT_SYMBOL(ecrt_domain_register_pdo_range);
       
   151 EXPORT_SYMBOL(ecrt_domain_process);
       
   152 EXPORT_SYMBOL(ecrt_domain_queue);
       
   153 EXPORT_SYMBOL(ecrt_domain_state);
       
   154 
       
   155 /** \endcond */
       
   156 
       
   157 /*****************************************************************************/