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