master/pdo.h
author Florian Pose
Tue, 06 Feb 2018 14:58:14 +0100
branchstable-1.5
changeset 2697 4f5ae7e0fbaa
parent 1823 2bf892fe8080
permissions -rw-r--r--
Use sched_setscheduler() to set priority in user example.
627
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     1
/******************************************************************************
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     2
 *
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     3
 *  $Id$
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     4
 *
1326
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
     5
 *  Copyright (C) 2006-2008  Florian Pose, Ingenieurgemeinschaft IgH
627
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     6
 *
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     7
 *  This file is part of the IgH EtherCAT Master.
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     8
 *
1326
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
     9
 *  The IgH EtherCAT Master is free software; you can redistribute it and/or
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
    10
 *  modify it under the terms of the GNU General Public License version 2, as
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
    11
 *  published by the Free Software Foundation.
627
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    12
 *
1326
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
    13
 *  The IgH EtherCAT Master is distributed in the hope that it will be useful,
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
    14
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
    15
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
    16
 *  Public License for more details.
627
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    17
 *
1326
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
    18
 *  You should have received a copy of the GNU General Public License along
ef907b0b5125 merge -c1603 branches/stable-1.4: Changed licence headers to avoid conflicts with the GPL; restricted licence to GPLv2 only.
Florian Pose <fp@igh-essen.com>
parents: 1209
diff changeset
    19
 *  with the IgH EtherCAT Master; if not, write to the Free Software
627
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    20
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    21
 *
1363
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
    22
 *  ---
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
    23
 *
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
    24
 *  The license mentioned above concerns the source code only. Using the
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
    25
 *  EtherCAT technology and brand is only permitted in compliance with the
11c0b2caa253 Improved and added license headers.
Florian Pose <fp@igh-essen.com>
parents: 1327
diff changeset
    26
 *  industrial property and similar rights of Beckhoff Automation GmbH.
627
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    27
 *
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    28
 *****************************************************************************/
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    29
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    30
/**
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    31
   \file
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    32
   EtherCAT Process data object structure.
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    33
*/
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    34
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    35
/*****************************************************************************/
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    36
883
4963e22a267a Equalized defines against duplicated header inclusion.
Florian Pose <fp@igh-essen.com>
parents: 842
diff changeset
    37
#ifndef __EC_PDO_H__
4963e22a267a Equalized defines against duplicated header inclusion.
Florian Pose <fp@igh-essen.com>
parents: 842
diff changeset
    38
#define __EC_PDO_H__
627
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    39
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    40
#include <linux/list.h>
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    41
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    42
#include "globals.h"
933
618ab9e03321 Separated Pdo and Pdo entry classes.
Florian Pose <fp@igh-essen.com>
parents: 883
diff changeset
    43
#include "pdo_entry.h"
627
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    44
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    45
/*****************************************************************************/
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    46
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
    47
/** PDO description.
627
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    48
 */
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 627
diff changeset
    49
typedef struct {
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 627
diff changeset
    50
    struct list_head list; /**< List item. */
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
    51
    uint16_t index; /**< PDO index. */
1055
2be8918682fa Store sync manager configurations in ec_slave_config_t instead of Pdo
Florian Pose <fp@igh-essen.com>
parents: 996
diff changeset
    52
    int8_t sync_index; /**< Assigned sync manager. \todo remove? */
1327
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
    53
    char *name; /**< PDO name. */
4d179b06dd3c merge -c1604 branches/stable-1.4: Fixed spelling of EtherCAT terms.
Florian Pose <fp@igh-essen.com>
parents: 1326
diff changeset
    54
    struct list_head entries; /**< List of PDO entries. */
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 627
diff changeset
    55
} ec_pdo_t;
627
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    56
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    57
/*****************************************************************************/
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    58
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    59
void ec_pdo_init(ec_pdo_t *);
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 627
diff changeset
    60
int ec_pdo_init_copy(ec_pdo_t *, const ec_pdo_t *);
627
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    61
void ec_pdo_clear(ec_pdo_t *);
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
    62
void ec_pdo_clear_entries(ec_pdo_t *);
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 627
diff changeset
    63
int ec_pdo_set_name(ec_pdo_t *, const char *);
842
40e27e5a8dce Added ecrt_slave_config_pdo() and ecrt_slave_config_pdo_entry().
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
    64
ec_pdo_entry_t *ec_pdo_add_entry(ec_pdo_t *, uint16_t, uint8_t, uint8_t);
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 627
diff changeset
    65
int ec_pdo_copy_entries(ec_pdo_t *, const ec_pdo_t *);
799
068a58b96965 Pdo configuration.
Florian Pose <fp@igh-essen.com>
parents: 792
diff changeset
    66
int ec_pdo_equal_entries(const ec_pdo_t *, const ec_pdo_t *);
934
96241b092fac Added entry access functions.
Florian Pose <fp@igh-essen.com>
parents: 933
diff changeset
    67
unsigned int ec_pdo_entry_count(const ec_pdo_t *);
96241b092fac Added entry access functions.
Florian Pose <fp@igh-essen.com>
parents: 933
diff changeset
    68
const ec_pdo_entry_t *ec_pdo_find_entry_by_pos_const(
96241b092fac Added entry access functions.
Florian Pose <fp@igh-essen.com>
parents: 933
diff changeset
    69
        const ec_pdo_t *, unsigned int);
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 627
diff changeset
    70
1823
2bf892fe8080 Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents: 1363
diff changeset
    71
void ec_pdo_print_entries(const ec_pdo_t *);
2bf892fe8080 Improved output when PDO assignment/mapping fails.
Florian Pose <fp@igh-essen.com>
parents: 1363
diff changeset
    72
627
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    73
/*****************************************************************************/
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    74
4793ca94f082 Layed out PDO structures to own files.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    75
#endif