dummy/master.c
author Florian Pose <fp@igh-essen.com>
Wed, 19 Sep 2007 09:44:48 +0000
changeset 736 53afedcb52f6
parent 666 825ead3e0559
permissions -rw-r--r--
Ignore TAGS.
665
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     1
/******************************************************************************
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     2
 *
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     3
 *  $Id$
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     4
 *
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     5
 *  Copyright (C) 2006  Florian Pose, Ingenieurgemeinschaft IgH
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     6
 *
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     7
 *  This file is part of the IgH EtherCAT Master.
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     8
 *
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     9
 *  The IgH EtherCAT Master is free software; you can redistribute it
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    10
 *  and/or modify it under the terms of the GNU General Public License
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    11
 *  as published by the Free Software Foundation; either version 2 of the
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    12
 *  License, or (at your option) any later version.
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    13
 *
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    14
 *  The IgH EtherCAT Master is distributed in the hope that it will be
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    15
 *  useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    17
 *  GNU General Public License for more details.
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    18
 *
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    19
 *  You should have received a copy of the GNU General Public License
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    20
 *  along with the IgH EtherCAT Master; if not, write to the Free Software
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    21
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    22
 *
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    23
 *  The right to use EtherCAT Technology is granted and comes free of
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    24
 *  charge under condition of compatibility of product made by
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    25
 *  Licensee. People intending to distribute/sell products based on the
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    26
 *  code, have to sign an agreement to guarantee that products using
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    27
 *  software based on IgH EtherCAT master stay compatible with the actual
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    28
 *  EtherCAT specification (which are released themselves as an open
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    29
 *  standard) as the (only) precondition to have the right to use EtherCAT
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    30
 *  Technology, IP and trade marks.
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    31
 *
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    32
 *****************************************************************************/
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    33
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    34
/**
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    35
   \file
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    36
   EtherCAT DUMMY master methods.
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    37
*/
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    38
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    39
/*****************************************************************************/
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    40
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    41
#include "../include/ecrt.h"
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    42
#include "../master/master.h"
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    43
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    44
/******************************************************************************
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    45
 *  Realtime interface
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    46
 *****************************************************************************/
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    47
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    48
/** \cond */
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    49
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    50
ec_domain_t *ecrt_master_create_domain(ec_master_t *master)
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    51
{
666
825ead3e0559 Improved dummy module.
Florian Pose <fp@igh-essen.com>
parents: 665
diff changeset
    52
    static unsigned int domain = 1;
825ead3e0559 Improved dummy module.
Florian Pose <fp@igh-essen.com>
parents: 665
diff changeset
    53
    return (ec_domain_t *) domain++;
665
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    54
}
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    55
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    56
/*****************************************************************************/
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    57
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    58
int ecrt_master_activate(ec_master_t *master)
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    59
{
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    60
    return 0;
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    61
}
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    62
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    63
/*****************************************************************************/
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    64
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    65
void ecrt_master_send(ec_master_t *master)
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    66
{
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    67
}
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    68
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    69
/*****************************************************************************/
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    70
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    71
void ecrt_master_receive(ec_master_t *master)
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    72
{
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    73
}
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    74
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    75
/*****************************************************************************/
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    76
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    77
ec_slave_t *ecrt_master_get_slave(
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    78
        const ec_master_t *master,
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    79
        const char *address,
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    80
        uint32_t v,
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    81
        uint32_t p
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    82
        )
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    83
{
666
825ead3e0559 Improved dummy module.
Florian Pose <fp@igh-essen.com>
parents: 665
diff changeset
    84
    static unsigned int slave = 1;
825ead3e0559 Improved dummy module.
Florian Pose <fp@igh-essen.com>
parents: 665
diff changeset
    85
    return (ec_slave_t *) slave++;
665
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    86
}
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    87
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    88
/*****************************************************************************/
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    89
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    90
void ecrt_master_callbacks(ec_master_t *m,
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    91
                           int (*q)(void *),
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    92
                           void (*l)(void *),
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    93
                           void *u
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    94
                           )
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    95
{
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    96
}
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    97
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    98
/*****************************************************************************/
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    99
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   100
void ecrt_master_get_status(const ec_master_t *master, /**< EtherCAT master */
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   101
        ec_master_status_t *status /**< target status object */
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   102
        )
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   103
{
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   104
    status->bus_status = EC_BUS_OK;
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   105
    status->bus_tainted = 0; 
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   106
    status->slaves_responding = 999;
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   107
}
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   108
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   109
/*****************************************************************************/
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   110
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   111
EXPORT_SYMBOL(ecrt_master_create_domain);
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   112
EXPORT_SYMBOL(ecrt_master_activate);
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   113
EXPORT_SYMBOL(ecrt_master_send);
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   114
EXPORT_SYMBOL(ecrt_master_receive);
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   115
EXPORT_SYMBOL(ecrt_master_callbacks);
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   116
EXPORT_SYMBOL(ecrt_master_get_slave);
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   117
EXPORT_SYMBOL(ecrt_master_get_status);
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   118
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   119
/** \endcond */
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   120
a9794f927d78 Added dummy module for simulation purposes.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   121
/*****************************************************************************/