include/ec_rtdm.h
author Andreas Stewering-Bone <ab@igh-essen.com>
Wed, 23 Mar 2011 08:06:58 +0100
changeset 2059 ab0b96ac18bb
parent 2055 d246ab6b50d2
permissions -rw-r--r--
Working RTAI LXRT example
Add README's for RTDM examples
2054
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
     1
/******************************************************************************
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
     2
 *
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
     3
 *  $Id$
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
     4
 *
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
     5
 *  ec_rtdm.h	Copyright (C) 2009-2010  Moehwald GmbH B.Benner
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
     6
 *			                      2011       IgH Andreas Stewering-Bone
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
     7
 *
2055
d246ab6b50d2 Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents: 2054
diff changeset
     8
 *  This file is part of the IgH EtherCAT master 
2054
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
     9
 *  
2055
d246ab6b50d2 Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents: 2054
diff changeset
    10
 *  The IgH EtherCAT master is free software; you can
2054
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    11
 *  redistribute it and/or modify it under the terms of the GNU Lesser General
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    12
 *  Public License as published by the Free Software Foundation; version 2.1
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    13
 *  of the License.
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    14
 *
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    15
 *  The IgH EtherCAT master userspace library is distributed in the hope that
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    16
 *  it will be useful, but WITHOUT ANY WARRANTY; without even the implied
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    17
 *  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    18
 *  GNU Lesser General Public License for more details.
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    19
 *
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    20
 *  You should have received a copy of the GNU Lesser General Public License
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    21
 *  along with the IgH EtherCAT master userspace library. If not, see
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    22
 *  <http://www.gnu.org/licenses/>.
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    23
 *  
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    24
 *  The license mentioned above concerns the source code only. Using the
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    25
 *  EtherCAT technology and brand is only permitted in compliance with the
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    26
 *  industrial property and similar rights of Beckhoff Automation GmbH.
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    27
 *
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    28
 *****************************************************************************/
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    29
#ifndef __ECRT_RTDM_H
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    30
#define __ECRT_RTDM_H
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    31
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    32
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    33
//
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    34
// Basefilename of RTDM device
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    35
//
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    36
#define EC_RTDM_DEV_FILE_NAME  "ec_rtdm"
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    37
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    38
//
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    39
// IOCTRL Values for RTDM_EXTENSION
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    40
//
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    41
// Realtime IOCTRL function
2055
d246ab6b50d2 Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents: 2054
diff changeset
    42
#define EC_RTDM_MSTRATTACH                  1   // attach to a running master
d246ab6b50d2 Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents: 2054
diff changeset
    43
#define EC_RTDM_MSTRGETMUTNAME              2   // return the mutexname
d246ab6b50d2 Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents: 2054
diff changeset
    44
#define EC_RTDM_MASTER_RECEIVE              3   // call the master receive
d246ab6b50d2 Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents: 2054
diff changeset
    45
#define EC_RTDM_DOMAIN_PROCESS              4   // process domain data
d246ab6b50d2 Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents: 2054
diff changeset
    46
#define EC_RTDM_DOMAIN_QUEQUE               5   // prepare domain data
d246ab6b50d2 Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents: 2054
diff changeset
    47
#define EC_RTDM_MASTER_SEND                 6   // call the master send
d246ab6b50d2 Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents: 2054
diff changeset
    48
#define EC_RTDM_DOMAINSTATE	                7   // get domain state
d246ab6b50d2 Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents: 2054
diff changeset
    49
#define EC_RTDM_MASTERSTATE	                8   // get master state
d246ab6b50d2 Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents: 2054
diff changeset
    50
#define EC_RTDM_MASTER_APP_TIME             9   // set app time	
d246ab6b50d2 Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents: 2054
diff changeset
    51
#define EC_RTDM_SYNC_REF_CLOCK              10  // sync ref clock
d246ab6b50d2 Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents: 2054
diff changeset
    52
#define EC_RTDM_SYNC_SLAVE_CLOCK            11  // sync slave clocks
d246ab6b50d2 Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents: 2054
diff changeset
    53
#define EC_RTDM_MASTER_SYNC_MONITOR_QUEQUE  12  // prepare DC sync information
d246ab6b50d2 Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents: 2054
diff changeset
    54
#define EC_RTDM_MASTER_SYNC_MONITOR_PROCESS 13  // get DC sync information
2054
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    55
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    56
typedef struct _CstructMstrAttach
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    57
{
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    58
  unsigned int        domainindex;
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    59
  unsigned int        masterindex;
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    60
} CstructMstrAttach;
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    61
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    62
2055
d246ab6b50d2 Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents: 2054
diff changeset
    63
#define ecrt_rtdm_master_attach(X,Y)                  rt_dev_ioctl(X, EC_RTDM_MSTRATTACH, Y)
d246ab6b50d2 Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents: 2054
diff changeset
    64
#define ecrt_rtdm_master_recieve(X)                   rt_dev_ioctl(X, EC_RTDM_MASTER_RECEIVE)
d246ab6b50d2 Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents: 2054
diff changeset
    65
#define ecrt_rtdm_domain_process(X)                   rt_dev_ioctl(X, EC_RTDM_DOMAIN_PROCESS)
d246ab6b50d2 Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents: 2054
diff changeset
    66
#define ecrt_rtdm_domain_queque(X)                    rt_dev_ioctl(X, EC_RTDM_DOMAIN_QUEQUE)
d246ab6b50d2 Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents: 2054
diff changeset
    67
#define ecrt_rtdm_master_send(X)                      rt_dev_ioctl(X, EC_RTDM_MASTER_SEND)
d246ab6b50d2 Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents: 2054
diff changeset
    68
#define ecrt_rtdm_domain_state(X,Y)                   rt_dev_ioctl(X, EC_RTDM_DOMAINSTATE, Y)
d246ab6b50d2 Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents: 2054
diff changeset
    69
#define ecrt_rtdm_master_state(X,Y)                   rt_dev_ioctl(X, EC_RTDM_MASTERSTATE, Y)
d246ab6b50d2 Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents: 2054
diff changeset
    70
#define ecrt_rtdm_master_application_time(X,Y)        rt_dev_ioctl(X, EC_RTDM_MASTER_APP_TIME, Y)
d246ab6b50d2 Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents: 2054
diff changeset
    71
#define ecrt_rtdm_master_sync_reference_clock(X)      rt_dev_ioctl(X, EC_RTDM_SYNC_REF_CLOCK)
d246ab6b50d2 Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents: 2054
diff changeset
    72
#define ecrt_rtdm_master_sync_slave_clocks(X)         rt_dev_ioctl(X, EC_RTDM_SYNC_SLAVE_CLOCK)
d246ab6b50d2 Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents: 2054
diff changeset
    73
#define ecrt_rtdm_master_sync_monitor_queque(X)       rt_dev_ioctl(X, EC_RTDM_MASTER_MONITOR_QUEQUE)
d246ab6b50d2 Fix application time for RTDM interface
Andreas Stewering-Bone <ab@igh-essen.com>
parents: 2054
diff changeset
    74
#define ecrt_rtdm_master_sync_monitor_process(X,Y)    rt_dev_ioctl(X, EC_RTDM_MASTER_MONITOR_PROCESS,Y)
2054
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    75
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    76
#endif
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    77
3417bbc4ad2f First working RTDM Version,
Andreas Stewering-Bone <ab@igh-essen.com>
parents:
diff changeset
    78