examples/mini/mini.c
author Florian Pose <fp@igh-essen.com>
Thu, 31 Jul 2008 16:17:53 +0000
changeset 1175 4684e0206eb9
parent 1171 de880622f253
child 1179 c0e6adec1aee
permissions -rw-r--r--
Avoided compiler warning.
220
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     1
/******************************************************************************
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     2
 *
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     3
 *  $Id$
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     4
 *
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     5
 *  Copyright (C) 2006  Florian Pose, Ingenieurgemeinschaft IgH
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     6
 *
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     7
 *  This file is part of the IgH EtherCAT Master.
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     8
 *
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     9
 *  The IgH EtherCAT Master is free software; you can redistribute it
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    10
 *  and/or modify it under the terms of the GNU General Public License
246
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 226
diff changeset
    11
 *  as published by the Free Software Foundation; either version 2 of the
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 226
diff changeset
    12
 *  License, or (at your option) any later version.
220
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    13
 *
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    14
 *  The IgH EtherCAT Master is distributed in the hope that it will be
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    15
 *  useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    17
 *  GNU General Public License for more details.
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    18
 *
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    19
 *  You should have received a copy of the GNU General Public License
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    20
 *  along with the IgH EtherCAT Master; if not, write to the Free Software
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    21
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    22
 *
246
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 226
diff changeset
    23
 *  The right to use EtherCAT Technology is granted and comes free of
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 226
diff changeset
    24
 *  charge under condition of compatibility of product made by
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 226
diff changeset
    25
 *  Licensee. People intending to distribute/sell products based on the
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 226
diff changeset
    26
 *  code, have to sign an agreement to guarantee that products using
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 226
diff changeset
    27
 *  software based on IgH EtherCAT master stay compatible with the actual
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 226
diff changeset
    28
 *  EtherCAT specification (which are released themselves as an open
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 226
diff changeset
    29
 *  standard) as the (only) precondition to have the right to use EtherCAT
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 226
diff changeset
    30
 *  Technology, IP and trade marks.
0bf7c769de06 Changed license headers and added EtherCAT license notice.
Florian Pose <fp@igh-essen.com>
parents: 226
diff changeset
    31
 *
220
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    32
 *****************************************************************************/
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    33
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    34
#include <linux/module.h>
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    35
#include <linux/timer.h>
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    36
#include <linux/spinlock.h>
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    37
#include <linux/interrupt.h>
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    38
223
daa5e5656b35 Applied new path information to example modules.
Florian Pose <fp@igh-essen.com>
parents: 220
diff changeset
    39
#include "../../include/ecrt.h" // EtherCAT realtime interface
220
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    40
820
f8e6f5966cce Cleaned up mini module.
Florian Pose <fp@igh-essen.com>
parents: 818
diff changeset
    41
/*****************************************************************************/
f8e6f5966cce Cleaned up mini module.
Florian Pose <fp@igh-essen.com>
parents: 818
diff changeset
    42
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
    43
// Module parameters
220
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    44
#define FREQUENCY 100
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
    45
1171
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
    46
// Optional features
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
    47
#define CONFIGURE_PDOS  1
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
    48
#define EL3162_ALT_PDOS 0
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
    49
#define EXTERNAL_MEMORY 1
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
    50
#define SDO_ACCESS      0
457
2b4ba84b6058 Minor changes to minimal example.
Florian Pose <fp@igh-essen.com>
parents: 454
diff changeset
    51
820
f8e6f5966cce Cleaned up mini module.
Florian Pose <fp@igh-essen.com>
parents: 818
diff changeset
    52
#define PFX "ec_mini: "
f8e6f5966cce Cleaned up mini module.
Florian Pose <fp@igh-essen.com>
parents: 818
diff changeset
    53
f8e6f5966cce Cleaned up mini module.
Florian Pose <fp@igh-essen.com>
parents: 818
diff changeset
    54
/*****************************************************************************/
220
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    55
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    56
// EtherCAT
612
aede068f9a74 Introduced master status, ecrt_master_get_status(), tainted flag,
Florian Pose <fp@igh-essen.com>
parents: 551
diff changeset
    57
static ec_master_t *master = NULL;
818
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
    58
static ec_master_state_t master_state = {};
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
    59
spinlock_t master_lock = SPIN_LOCK_UNLOCKED;
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
    60
612
aede068f9a74 Introduced master status, ecrt_master_get_status(), tainted flag,
Florian Pose <fp@igh-essen.com>
parents: 551
diff changeset
    61
static ec_domain_t *domain1 = NULL;
818
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
    62
static ec_domain_state_t domain1_state = {};
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
    63
1022
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
    64
static ec_slave_config_t *sc_ana_in = NULL;
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
    65
static ec_slave_config_state_t sc_ana_in_state = {};
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
    66
1080
088a61306930 Removed MSR example; adapted RTAI example; README files for examples.
Florian Pose <fp@igh-essen.com>
parents: 1061
diff changeset
    67
// Timer
820
f8e6f5966cce Cleaned up mini module.
Florian Pose <fp@igh-essen.com>
parents: 818
diff changeset
    68
static struct timer_list timer;
f8e6f5966cce Cleaned up mini module.
Florian Pose <fp@igh-essen.com>
parents: 818
diff changeset
    69
f8e6f5966cce Cleaned up mini module.
Florian Pose <fp@igh-essen.com>
parents: 818
diff changeset
    70
/*****************************************************************************/
f8e6f5966cce Cleaned up mini module.
Florian Pose <fp@igh-essen.com>
parents: 818
diff changeset
    71
f8e6f5966cce Cleaned up mini module.
Florian Pose <fp@igh-essen.com>
parents: 818
diff changeset
    72
// process data
f8e6f5966cce Cleaned up mini module.
Florian Pose <fp@igh-essen.com>
parents: 818
diff changeset
    73
static uint8_t *domain1_pd; // process data memory
f8e6f5966cce Cleaned up mini module.
Florian Pose <fp@igh-essen.com>
parents: 818
diff changeset
    74
1080
088a61306930 Removed MSR example; adapted RTAI example; README files for examples.
Florian Pose <fp@igh-essen.com>
parents: 1061
diff changeset
    75
#define AnaInSlavePos  0, 1
088a61306930 Removed MSR example; adapted RTAI example; README files for examples.
Florian Pose <fp@igh-essen.com>
parents: 1061
diff changeset
    76
#define DigOutSlavePos 0, 3
088a61306930 Removed MSR example; adapted RTAI example; README files for examples.
Florian Pose <fp@igh-essen.com>
parents: 1061
diff changeset
    77
088a61306930 Removed MSR example; adapted RTAI example; README files for examples.
Florian Pose <fp@igh-essen.com>
parents: 1061
diff changeset
    78
#define Beckhoff_EL2004 0x00000002, 0x07D43052
088a61306930 Removed MSR example; adapted RTAI example; README files for examples.
Florian Pose <fp@igh-essen.com>
parents: 1061
diff changeset
    79
#define Beckhoff_EL3162 0x00000002, 0x0C5A3052
088a61306930 Removed MSR example; adapted RTAI example; README files for examples.
Florian Pose <fp@igh-essen.com>
parents: 1061
diff changeset
    80
820
f8e6f5966cce Cleaned up mini module.
Florian Pose <fp@igh-essen.com>
parents: 818
diff changeset
    81
static unsigned int off_ana_in; // offsets for Pdo entries
f8e6f5966cce Cleaned up mini module.
Florian Pose <fp@igh-essen.com>
parents: 818
diff changeset
    82
static unsigned int off_dig_out;
f8e6f5966cce Cleaned up mini module.
Florian Pose <fp@igh-essen.com>
parents: 818
diff changeset
    83
1080
088a61306930 Removed MSR example; adapted RTAI example; README files for examples.
Florian Pose <fp@igh-essen.com>
parents: 1061
diff changeset
    84
const static ec_pdo_entry_reg_t domain1_regs[] = {
1171
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
    85
#if EL3162_ALT_PDOS
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
    86
    {AnaInSlavePos,  Beckhoff_EL3162, 0x6401, 2, &off_ana_in},
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
    87
#else
1080
088a61306930 Removed MSR example; adapted RTAI example; README files for examples.
Florian Pose <fp@igh-essen.com>
parents: 1061
diff changeset
    88
    {AnaInSlavePos,  Beckhoff_EL3162, 0x3101, 2, &off_ana_in},
1171
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
    89
#endif
1080
088a61306930 Removed MSR example; adapted RTAI example; README files for examples.
Florian Pose <fp@igh-essen.com>
parents: 1061
diff changeset
    90
    {DigOutSlavePos, Beckhoff_EL2004, 0x3001, 1, &off_dig_out},
088a61306930 Removed MSR example; adapted RTAI example; README files for examples.
Florian Pose <fp@igh-essen.com>
parents: 1061
diff changeset
    91
    {}
088a61306930 Removed MSR example; adapted RTAI example; README files for examples.
Florian Pose <fp@igh-essen.com>
parents: 1061
diff changeset
    92
};
088a61306930 Removed MSR example; adapted RTAI example; README files for examples.
Florian Pose <fp@igh-essen.com>
parents: 1061
diff changeset
    93
088a61306930 Removed MSR example; adapted RTAI example; README files for examples.
Florian Pose <fp@igh-essen.com>
parents: 1061
diff changeset
    94
static unsigned int counter = 0;
820
f8e6f5966cce Cleaned up mini module.
Florian Pose <fp@igh-essen.com>
parents: 818
diff changeset
    95
static unsigned int blink = 0;
f8e6f5966cce Cleaned up mini module.
Florian Pose <fp@igh-essen.com>
parents: 818
diff changeset
    96
f8e6f5966cce Cleaned up mini module.
Florian Pose <fp@igh-essen.com>
parents: 818
diff changeset
    97
/*****************************************************************************/
f8e6f5966cce Cleaned up mini module.
Florian Pose <fp@igh-essen.com>
parents: 818
diff changeset
    98
1171
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
    99
#if CONFIGURE_PDOS
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   100
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   101
static ec_pdo_entry_info_t el3162_pdo_entries[] = {
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   102
    {0x3101, 1,  8}, // channel 1 status
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   103
    {0x3101, 2, 16}, // channel 1 value
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   104
    {0x3102, 1,  8}, // channel 2 status
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   105
    {0x3102, 2, 16}, // channel 2 value
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   106
    {0x6401, 1, 16}, // channel 1 value (alt.)
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   107
    {0x6401, 2, 16}  // channel 2 value (alt.)
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   108
};
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   109
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   110
#if EL3162_ALT_PDOS
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   111
static ec_pdo_info_t el3162_pdos[] = {
1171
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   112
    {0x1A10, 2, el3162_pdo_entries + 4},
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   113
};
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   114
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   115
static ec_sync_info_t el3162_syncs[] = {
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   116
    {2, EC_DIR_OUTPUT},
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   117
    {3, EC_DIR_INPUT, 1, el3162_pdos},
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   118
    {0xff}
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   119
};
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   120
#else
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   121
static ec_pdo_info_t el3162_pdos[] = {
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   122
    {0x1A00, 2, el3162_pdo_entries},
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   123
    {0x1A01, 2, el3162_pdo_entries + 2}
1061
90c3d75057e4 Adapted minimal example to sync manager configuration interface.
Florian Pose <fp@igh-essen.com>
parents: 1027
diff changeset
   124
};
90c3d75057e4 Adapted minimal example to sync manager configuration interface.
Florian Pose <fp@igh-essen.com>
parents: 1027
diff changeset
   125
90c3d75057e4 Adapted minimal example to sync manager configuration interface.
Florian Pose <fp@igh-essen.com>
parents: 1027
diff changeset
   126
static ec_sync_info_t el3162_syncs[] = {
90c3d75057e4 Adapted minimal example to sync manager configuration interface.
Florian Pose <fp@igh-essen.com>
parents: 1027
diff changeset
   127
    {2, EC_DIR_OUTPUT},
90c3d75057e4 Adapted minimal example to sync manager configuration interface.
Florian Pose <fp@igh-essen.com>
parents: 1027
diff changeset
   128
    {3, EC_DIR_INPUT, 2, el3162_pdos},
90c3d75057e4 Adapted minimal example to sync manager configuration interface.
Florian Pose <fp@igh-essen.com>
parents: 1027
diff changeset
   129
    {0xff}
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 654
diff changeset
   130
};
1171
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   131
#endif
809
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   132
851
2bb18adcd204 Removed 'const' from Pdo configuration entries.
Florian Pose <fp@igh-essen.com>
parents: 846
diff changeset
   133
static ec_pdo_entry_info_t el2004_channels[] = {
809
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   134
    {0x3001, 1, 1}, // Value 1
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   135
    {0x3001, 2, 1}, // Value 2
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   136
    {0x3001, 3, 1}, // Value 3
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   137
    {0x3001, 4, 1}  // Value 4
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   138
};
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   139
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   140
static ec_pdo_info_t el2004_pdos[] = {
1061
90c3d75057e4 Adapted minimal example to sync manager configuration interface.
Florian Pose <fp@igh-essen.com>
parents: 1027
diff changeset
   141
    {0x1600, 1, &el2004_channels[0]},
90c3d75057e4 Adapted minimal example to sync manager configuration interface.
Florian Pose <fp@igh-essen.com>
parents: 1027
diff changeset
   142
    {0x1601, 1, &el2004_channels[1]},
90c3d75057e4 Adapted minimal example to sync manager configuration interface.
Florian Pose <fp@igh-essen.com>
parents: 1027
diff changeset
   143
    {0x1602, 1, &el2004_channels[2]},
90c3d75057e4 Adapted minimal example to sync manager configuration interface.
Florian Pose <fp@igh-essen.com>
parents: 1027
diff changeset
   144
    {0x1603, 1, &el2004_channels[3]}
90c3d75057e4 Adapted minimal example to sync manager configuration interface.
Florian Pose <fp@igh-essen.com>
parents: 1027
diff changeset
   145
};
90c3d75057e4 Adapted minimal example to sync manager configuration interface.
Florian Pose <fp@igh-essen.com>
parents: 1027
diff changeset
   146
90c3d75057e4 Adapted minimal example to sync manager configuration interface.
Florian Pose <fp@igh-essen.com>
parents: 1027
diff changeset
   147
static ec_sync_info_t el2004_syncs[] = {
90c3d75057e4 Adapted minimal example to sync manager configuration interface.
Florian Pose <fp@igh-essen.com>
parents: 1027
diff changeset
   148
    {0, EC_DIR_OUTPUT, 4, el2004_pdos},
90c3d75057e4 Adapted minimal example to sync manager configuration interface.
Florian Pose <fp@igh-essen.com>
parents: 1027
diff changeset
   149
    {1, EC_DIR_INPUT},
90c3d75057e4 Adapted minimal example to sync manager configuration interface.
Florian Pose <fp@igh-essen.com>
parents: 1027
diff changeset
   150
    {0xff}
809
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   151
};
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 654
diff changeset
   152
#endif
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 654
diff changeset
   153
818
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   154
/*****************************************************************************/
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   155
1171
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   156
#if SDO_ACCESS
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   157
static ec_sdo_request_t *sdo;
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   158
#endif
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   159
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   160
/*****************************************************************************/
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   161
818
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   162
void check_domain1_state(void)
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   163
{
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   164
    ec_domain_state_t ds;
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   165
1022
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   166
    spin_lock(&master_lock);
818
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   167
    ecrt_domain_state(domain1, &ds);
1022
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   168
    spin_unlock(&master_lock);
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   169
818
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   170
    if (ds.working_counter != domain1_state.working_counter)
1022
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   171
        printk(KERN_INFO PFX "Domain1: WC %u.\n", ds.working_counter);
818
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   172
    if (ds.wc_state != domain1_state.wc_state)
1022
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   173
        printk(KERN_INFO PFX "Domain1: State %u.\n", ds.wc_state);
818
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   174
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   175
    domain1_state = ds;
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   176
}
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   177
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   178
/*****************************************************************************/
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   179
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   180
void check_master_state(void)
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   181
{
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   182
    ec_master_state_t ms;
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   183
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   184
    spin_lock(&master_lock);
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   185
    ecrt_master_state(master, &ms);
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   186
    spin_unlock(&master_lock);
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   187
1022
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   188
    if (ms.slaves_responding != master_state.slaves_responding)
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   189
        printk(KERN_INFO PFX "%u slave(s).\n", ms.slaves_responding);
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   190
    if (ms.al_states != master_state.al_states)
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   191
        printk(KERN_INFO PFX "AL states: 0x%02X.\n", ms.al_states);
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   192
    if (ms.link_up != master_state.link_up)
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   193
        printk(KERN_INFO PFX "Link is %s.\n", ms.link_up ? "up" : "down");
818
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   194
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   195
    master_state = ms;
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   196
}
220
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   197
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   198
/*****************************************************************************/
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   199
1022
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   200
void check_slave_config_states(void)
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   201
{
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   202
    ec_slave_config_state_t s;
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   203
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   204
    spin_lock(&master_lock);
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   205
    ecrt_slave_config_state(sc_ana_in, &s);
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   206
    spin_unlock(&master_lock);
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   207
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   208
    if (s.al_state != sc_ana_in_state.al_state)
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   209
        printk(KERN_INFO PFX "AnaIn: State 0x%02X.\n", s.al_state);
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   210
    if (s.online != sc_ana_in_state.online)
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   211
        printk(KERN_INFO PFX "AnaIn: %s.\n", s.online ? "online" : "offline");
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   212
    if (s.operational != sc_ana_in_state.operational)
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   213
        printk(KERN_INFO PFX "AnaIn: %soperational.\n",
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   214
                s.operational ? "" : "Not ");
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   215
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   216
    sc_ana_in_state = s;
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   217
}
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   218
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   219
/*****************************************************************************/
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   220
1171
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   221
#if SDO_ACCESS
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   222
void read_sdo(void)
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   223
{
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   224
    switch (ecrt_sdo_request_state(sdo)) {
861
6e3de145421a Introduced ec_sdo_request_state_t, making ec_request_t private again;
Florian Pose <fp@igh-essen.com>
parents: 858
diff changeset
   225
        case EC_SDO_REQUEST_UNUSED: // request was not used yet
867
93a0180ee938 Minor changes.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   226
            ecrt_sdo_request_read(sdo); // trigger first read
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   227
            break;
861
6e3de145421a Introduced ec_sdo_request_state_t, making ec_request_t private again;
Florian Pose <fp@igh-essen.com>
parents: 858
diff changeset
   228
        case EC_SDO_REQUEST_BUSY:
6e3de145421a Introduced ec_sdo_request_state_t, making ec_request_t private again;
Florian Pose <fp@igh-essen.com>
parents: 858
diff changeset
   229
            printk(KERN_INFO PFX "Still busy...\n");
6e3de145421a Introduced ec_sdo_request_state_t, making ec_request_t private again;
Florian Pose <fp@igh-essen.com>
parents: 858
diff changeset
   230
            break;
6e3de145421a Introduced ec_sdo_request_state_t, making ec_request_t private again;
Florian Pose <fp@igh-essen.com>
parents: 858
diff changeset
   231
        case EC_SDO_REQUEST_SUCCESS:
6e3de145421a Introduced ec_sdo_request_state_t, making ec_request_t private again;
Florian Pose <fp@igh-essen.com>
parents: 858
diff changeset
   232
            printk(KERN_INFO PFX "Sdo value: 0x%04X\n",
6e3de145421a Introduced ec_sdo_request_state_t, making ec_request_t private again;
Florian Pose <fp@igh-essen.com>
parents: 858
diff changeset
   233
                    EC_READ_U16(ecrt_sdo_request_data(sdo)));
867
93a0180ee938 Minor changes.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   234
            ecrt_sdo_request_read(sdo); // trigger next read
861
6e3de145421a Introduced ec_sdo_request_state_t, making ec_request_t private again;
Florian Pose <fp@igh-essen.com>
parents: 858
diff changeset
   235
            break;
6e3de145421a Introduced ec_sdo_request_state_t, making ec_request_t private again;
Florian Pose <fp@igh-essen.com>
parents: 858
diff changeset
   236
        case EC_SDO_REQUEST_ERROR:
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   237
            printk(KERN_INFO PFX "Failed to read Sdo!\n");
867
93a0180ee938 Minor changes.
Florian Pose <fp@igh-essen.com>
parents: 861
diff changeset
   238
            ecrt_sdo_request_read(sdo); // retry reading
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   239
            break;
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   240
    }
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   241
}
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   242
#endif
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   243
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   244
/*****************************************************************************/
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   245
820
f8e6f5966cce Cleaned up mini module.
Florian Pose <fp@igh-essen.com>
parents: 818
diff changeset
   246
void cyclic_task(unsigned long data)
f8e6f5966cce Cleaned up mini module.
Florian Pose <fp@igh-essen.com>
parents: 818
diff changeset
   247
{
818
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   248
    // receive process data
220
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   249
    spin_lock(&master_lock);
325
7833cf70c4f2 VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents: 280
diff changeset
   250
    ecrt_master_receive(master);
220
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   251
    ecrt_domain_process(domain1);
512
24292123d174 Shorter critical sections in examples.
Florian Pose <fp@igh-essen.com>
parents: 509
diff changeset
   252
    spin_unlock(&master_lock);
220
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   253
818
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   254
    // check process data state (optional)
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   255
    check_domain1_state();
512
24292123d174 Shorter critical sections in examples.
Florian Pose <fp@igh-essen.com>
parents: 509
diff changeset
   256
24292123d174 Shorter critical sections in examples.
Florian Pose <fp@igh-essen.com>
parents: 509
diff changeset
   257
    if (counter) {
24292123d174 Shorter critical sections in examples.
Florian Pose <fp@igh-essen.com>
parents: 509
diff changeset
   258
        counter--;
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   259
    } else { // do this at 1 Hz
512
24292123d174 Shorter critical sections in examples.
Florian Pose <fp@igh-essen.com>
parents: 509
diff changeset
   260
        counter = FREQUENCY;
818
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   261
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   262
        // calculate new process data
512
24292123d174 Shorter critical sections in examples.
Florian Pose <fp@igh-essen.com>
parents: 509
diff changeset
   263
        blink = !blink;
612
aede068f9a74 Introduced master status, ecrt_master_get_status(), tainted flag,
Florian Pose <fp@igh-essen.com>
parents: 551
diff changeset
   264
818
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   265
        // check for master state (optional)
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   266
        check_master_state();
1022
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   267
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   268
        // check for islave configuration state(s) (optional)
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   269
        check_slave_config_states();
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   270
        
1171
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   271
#if SDO_ACCESS
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   272
        // read process data Sdo
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   273
        read_sdo();
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   274
#endif
818
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   275
    }
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   276
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   277
    // write process data
846
19248bbf9308 Cross blinking.
Florian Pose <fp@igh-essen.com>
parents: 820
diff changeset
   278
    EC_WRITE_U8(domain1_pd + off_dig_out, blink ? 0x06 : 0x09);
818
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   279
b6c87ae254c9 Calculate expected working counter for domains.
Florian Pose <fp@igh-essen.com>
parents: 814
diff changeset
   280
    // send process data
512
24292123d174 Shorter critical sections in examples.
Florian Pose <fp@igh-essen.com>
parents: 509
diff changeset
   281
    spin_lock(&master_lock);
509
87baea61d0c7 Adjusted examples to 1.2.0 interface changes.
Florian Pose <fp@igh-essen.com>
parents: 472
diff changeset
   282
    ecrt_domain_queue(domain1);
325
7833cf70c4f2 VERSION 1.1: New realtime interface, only state machines.
Florian Pose <fp@igh-essen.com>
parents: 280
diff changeset
   283
    ecrt_master_send(master);
220
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   284
    spin_unlock(&master_lock);
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   285
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   286
    // restart timer
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   287
    timer.expires += HZ / FREQUENCY;
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   288
    add_timer(&timer);
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   289
}
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   290
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   291
/*****************************************************************************/
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   292
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   293
int request_lock(void *data)
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   294
{
516
f703e33ee395 Adjusted examples to EtherLab starter kit hardware.
Florian Pose <fp@igh-essen.com>
parents: 513
diff changeset
   295
    spin_lock(&master_lock);
226
07247920a7ba EoE with workqueue; bugfix in ec_master_init()
Florian Pose <fp@igh-essen.com>
parents: 223
diff changeset
   296
    return 0; // access allowed
220
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   297
}
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   298
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   299
/*****************************************************************************/
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   300
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   301
void release_lock(void *data)
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   302
{
516
f703e33ee395 Adjusted examples to EtherLab starter kit hardware.
Florian Pose <fp@igh-essen.com>
parents: 513
diff changeset
   303
    spin_unlock(&master_lock);
220
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   304
}
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   305
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   306
/*****************************************************************************/
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   307
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   308
int __init init_mini_module(void)
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   309
{
1171
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   310
#if CONFIGURE_PDOS
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 654
diff changeset
   311
    ec_slave_config_t *sc;
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 654
diff changeset
   312
#endif
1171
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   313
#if EXTERNAL_MEMORY
809
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   314
    unsigned int size;
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   315
#endif
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 654
diff changeset
   316
    
612
aede068f9a74 Introduced master status, ecrt_master_get_status(), tainted flag,
Florian Pose <fp@igh-essen.com>
parents: 551
diff changeset
   317
    printk(KERN_INFO PFX "Starting...\n");
220
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   318
509
87baea61d0c7 Adjusted examples to 1.2.0 interface changes.
Florian Pose <fp@igh-essen.com>
parents: 472
diff changeset
   319
    if (!(master = ecrt_request_master(0))) {
612
aede068f9a74 Introduced master status, ecrt_master_get_status(), tainted flag,
Florian Pose <fp@igh-essen.com>
parents: 551
diff changeset
   320
        printk(KERN_ERR PFX "Requesting master 0 failed!\n");
220
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   321
        goto out_return;
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   322
    }
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   323
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   324
    ecrt_master_callbacks(master, request_lock, release_lock, NULL);
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   325
612
aede068f9a74 Introduced master status, ecrt_master_get_status(), tainted flag,
Florian Pose <fp@igh-essen.com>
parents: 551
diff changeset
   326
    printk(KERN_INFO PFX "Registering domain...\n");
509
87baea61d0c7 Adjusted examples to 1.2.0 interface changes.
Florian Pose <fp@igh-essen.com>
parents: 472
diff changeset
   327
    if (!(domain1 = ecrt_master_create_domain(master))) {
612
aede068f9a74 Introduced master status, ecrt_master_get_status(), tainted flag,
Florian Pose <fp@igh-essen.com>
parents: 551
diff changeset
   328
        printk(KERN_ERR PFX "Domain creation failed!\n");
aede068f9a74 Introduced master status, ecrt_master_get_status(), tainted flag,
Florian Pose <fp@igh-essen.com>
parents: 551
diff changeset
   329
        goto out_release_master;
aede068f9a74 Introduced master status, ecrt_master_get_status(), tainted flag,
Florian Pose <fp@igh-essen.com>
parents: 551
diff changeset
   330
    }
aede068f9a74 Introduced master status, ecrt_master_get_status(), tainted flag,
Florian Pose <fp@igh-essen.com>
parents: 551
diff changeset
   331
1022
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   332
    if (!(sc_ana_in = ecrt_master_slave_config(
1080
088a61306930 Removed MSR example; adapted RTAI example; README files for examples.
Florian Pose <fp@igh-essen.com>
parents: 1061
diff changeset
   333
                    master, AnaInSlavePos, Beckhoff_EL3162))) {
1022
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   334
        printk(KERN_ERR PFX "Failed to get slave configuration.\n");
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   335
        goto out_release_master;
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   336
    }
8e49b519e6ba Implemented ecrt_slave_config_state(); minor changes in
Florian Pose <fp@igh-essen.com>
parents: 909
diff changeset
   337
1171
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   338
#if CONFIGURE_PDOS
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   339
    printk(KERN_INFO PFX "Configuring Pdos...\n");
1082
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1080
diff changeset
   340
    if (ecrt_slave_config_pdos(sc_ana_in, EC_END, el3162_syncs)) {
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   341
        printk(KERN_ERR PFX "Failed to configure Pdos.\n");
809
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   342
        goto out_release_master;
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   343
    }
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   344
1080
088a61306930 Removed MSR example; adapted RTAI example; README files for examples.
Florian Pose <fp@igh-essen.com>
parents: 1061
diff changeset
   345
    if (!(sc = ecrt_master_slave_config(
088a61306930 Removed MSR example; adapted RTAI example; README files for examples.
Florian Pose <fp@igh-essen.com>
parents: 1061
diff changeset
   346
                    master, DigOutSlavePos, Beckhoff_EL2004))) {
809
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   347
        printk(KERN_ERR PFX "Failed to get slave configuration.\n");
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   348
        goto out_release_master;
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   349
    }
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   350
1082
ff06c58e269c Renamed ecrt_slave_config_sync_managers() to ecrt_slave_config_pdos();
Florian Pose <fp@igh-essen.com>
parents: 1080
diff changeset
   351
    if (ecrt_slave_config_pdos(sc, EC_END, el2004_syncs)) {
879
9b395c5646ab Changed terms "Pdo mapping" -> "Pdo assignment" and "Pdo configuration"
Florian Pose <fp@igh-essen.com>
parents: 878
diff changeset
   352
        printk(KERN_ERR PFX "Failed to configure Pdos.\n");
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 654
diff changeset
   353
        goto out_release_master;
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 654
diff changeset
   354
    }
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 654
diff changeset
   355
#endif
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 654
diff changeset
   356
1171
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   357
#if SDO_ACCESS
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   358
    printk(KERN_INFO PFX "Creating Sdo requests...\n");
1026
021b8cdeb384 Minor changes to minimal example.
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   359
    if (!(sdo = ecrt_slave_config_create_sdo_request(sc_ana_in, 0x3102, 2, 2))) {
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   360
        printk(KERN_ERR PFX "Failed to create Sdo request.\n");
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   361
        goto out_release_master;
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   362
    }
1026
021b8cdeb384 Minor changes to minimal example.
Florian Pose <fp@igh-essen.com>
parents: 1022
diff changeset
   363
    ecrt_sdo_request_timeout(sdo, 500); // ms
858
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   364
#endif
69122084d066 Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents: 851
diff changeset
   365
814
a51f857b1b2d Renamed [PS]DO to [PS]do.
Florian Pose <fp@igh-essen.com>
parents: 809
diff changeset
   366
    printk(KERN_INFO PFX "Registering Pdo entries...\n");
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 654
diff changeset
   367
    if (ecrt_domain_reg_pdo_entry_list(domain1, domain1_regs)) {
814
a51f857b1b2d Renamed [PS]DO to [PS]do.
Florian Pose <fp@igh-essen.com>
parents: 809
diff changeset
   368
        printk(KERN_ERR PFX "Pdo entry registration failed!\n");
792
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 654
diff changeset
   369
        goto out_release_master;
3778920f61e4 Implemented most realtime interface changes for version 1.4, improved
Florian Pose <fp@igh-essen.com>
parents: 654
diff changeset
   370
    }
635
d304ef4af542 Implemented alternative PDO mapping configuration interface.
Florian Pose <fp@igh-essen.com>
parents: 612
diff changeset
   371
1171
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   372
#if EXTERNAL_MEMORY
809
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   373
    if ((size = ecrt_domain_size(domain1))) {
820
f8e6f5966cce Cleaned up mini module.
Florian Pose <fp@igh-essen.com>
parents: 818
diff changeset
   374
        if (!(domain1_pd = (uint8_t *) kmalloc(size, GFP_KERNEL))) {
809
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   375
            printk(KERN_ERR PFX "Failed to allocate %u bytes of process data"
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   376
                    " memory!\n", size);
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   377
            goto out_release_master;
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   378
        }
820
f8e6f5966cce Cleaned up mini module.
Florian Pose <fp@igh-essen.com>
parents: 818
diff changeset
   379
        ecrt_domain_external_memory(domain1, domain1_pd);
809
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   380
    }
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   381
#endif
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   382
612
aede068f9a74 Introduced master status, ecrt_master_get_status(), tainted flag,
Florian Pose <fp@igh-essen.com>
parents: 551
diff changeset
   383
    printk(KERN_INFO PFX "Activating master...\n");
220
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   384
    if (ecrt_master_activate(master)) {
612
aede068f9a74 Introduced master status, ecrt_master_get_status(), tainted flag,
Florian Pose <fp@igh-essen.com>
parents: 551
diff changeset
   385
        printk(KERN_ERR PFX "Failed to activate master!\n");
1171
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   386
#if EXTERNAL_MEMORY
809
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   387
        goto out_free_process_data;
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   388
#else
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   389
        goto out_release_master;
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   390
#endif
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   391
    }
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   392
1171
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   393
#if !EXTERNAL_MEMORY
809
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   394
    // Get internal process data for domain
820
f8e6f5966cce Cleaned up mini module.
Florian Pose <fp@igh-essen.com>
parents: 818
diff changeset
   395
    domain1_pd = ecrt_domain_data(domain1);
809
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   396
#endif
612
aede068f9a74 Introduced master status, ecrt_master_get_status(), tainted flag,
Florian Pose <fp@igh-essen.com>
parents: 551
diff changeset
   397
aede068f9a74 Introduced master status, ecrt_master_get_status(), tainted flag,
Florian Pose <fp@igh-essen.com>
parents: 551
diff changeset
   398
    printk(KERN_INFO PFX "Starting cyclic sample thread.\n");
220
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   399
    init_timer(&timer);
820
f8e6f5966cce Cleaned up mini module.
Florian Pose <fp@igh-essen.com>
parents: 818
diff changeset
   400
    timer.function = cyclic_task;
220
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   401
    timer.expires = jiffies + 10;
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   402
    add_timer(&timer);
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   403
612
aede068f9a74 Introduced master status, ecrt_master_get_status(), tainted flag,
Florian Pose <fp@igh-essen.com>
parents: 551
diff changeset
   404
    printk(KERN_INFO PFX "Started.\n");
220
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   405
    return 0;
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   406
1171
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   407
#if EXTERNAL_MEMORY
809
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   408
out_free_process_data:
820
f8e6f5966cce Cleaned up mini module.
Florian Pose <fp@igh-essen.com>
parents: 818
diff changeset
   409
    kfree(domain1_pd);
809
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   410
#endif
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   411
out_release_master:
654
8278e1e27010 Minor changes in minimal example.
Florian Pose <fp@igh-essen.com>
parents: 643
diff changeset
   412
    printk(KERN_ERR PFX "Releasing master...\n");
220
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   413
    ecrt_release_master(master);
809
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   414
out_return:
654
8278e1e27010 Minor changes in minimal example.
Florian Pose <fp@igh-essen.com>
parents: 643
diff changeset
   415
    printk(KERN_ERR PFX "Failed to load. Aborting.\n");
220
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   416
    return -1;
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   417
}
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   418
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   419
/*****************************************************************************/
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   420
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   421
void __exit cleanup_mini_module(void)
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   422
{
612
aede068f9a74 Introduced master status, ecrt_master_get_status(), tainted flag,
Florian Pose <fp@igh-essen.com>
parents: 551
diff changeset
   423
    printk(KERN_INFO PFX "Stopping...\n");
220
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   424
449
3caf8ff4d8a2 Moved functionality of ecrt_master_deactivate() (now deprecated) to ecrt_master_release().
Florian Pose <fp@igh-essen.com>
parents: 446
diff changeset
   425
    del_timer_sync(&timer);
809
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   426
1171
de880622f253 Alternative Pdo assignment for el3162.
Florian Pose <fp@igh-essen.com>
parents: 1082
diff changeset
   427
#if EXTERNAL_MEMORY
820
f8e6f5966cce Cleaned up mini module.
Florian Pose <fp@igh-essen.com>
parents: 818
diff changeset
   428
    kfree(domain1_pd);
809
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   429
#endif
ec4ef8911824 External domain memory.
Florian Pose <fp@igh-essen.com>
parents: 799
diff changeset
   430
612
aede068f9a74 Introduced master status, ecrt_master_get_status(), tainted flag,
Florian Pose <fp@igh-essen.com>
parents: 551
diff changeset
   431
    printk(KERN_INFO PFX "Releasing master...\n");
449
3caf8ff4d8a2 Moved functionality of ecrt_master_deactivate() (now deprecated) to ecrt_master_release().
Florian Pose <fp@igh-essen.com>
parents: 446
diff changeset
   432
    ecrt_release_master(master);
220
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   433
654
8278e1e27010 Minor changes in minimal example.
Florian Pose <fp@igh-essen.com>
parents: 643
diff changeset
   434
    printk(KERN_INFO PFX "Unloading.\n");
220
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   435
}
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   436
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   437
/*****************************************************************************/
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   438
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   439
MODULE_LICENSE("GPL");
512
24292123d174 Shorter critical sections in examples.
Florian Pose <fp@igh-essen.com>
parents: 509
diff changeset
   440
MODULE_AUTHOR("Florian Pose <fp@igh-essen.com>");
24292123d174 Shorter critical sections in examples.
Florian Pose <fp@igh-essen.com>
parents: 509
diff changeset
   441
MODULE_DESCRIPTION("EtherCAT minimal test environment");
220
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   442
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   443
module_init(init_mini_module);
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   444
module_exit(cleanup_mini_module);
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   445
342ad851ec78 Added examples directory.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   446
/*****************************************************************************/