rt/msr_module.c
author Florian Pose <fp@igh-essen.com>
Mon, 20 Mar 2006 11:02:39 +0000
changeset 111 9963537ec776
parent 106 d6679c77ad3f
child 112 eec7639c7be9
permissions -rw-r--r--
Bugfix: SDO download. SDO abort codes ausgeben.
42
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents: 40
diff changeset
     1
/******************************************************************************
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents: 40
diff changeset
     2
 *
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents: 40
diff changeset
     3
 *  msr_module.c
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents: 40
diff changeset
     4
 *
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents: 40
diff changeset
     5
 *  Kernelmodul für 2.6 Kernel zur Meßdatenerfassung, Steuerung und Regelung.
47
ad5f969f263b Prozessdatentimeout, Buszeit und weniger Klemmen.
Florian Pose <fp@igh-essen.com>
parents: 45
diff changeset
     6
 *
ad5f969f263b Prozessdatentimeout, Buszeit und weniger Klemmen.
Florian Pose <fp@igh-essen.com>
parents: 45
diff changeset
     7
 *  Autor: Wilhelm Hagemeister, Florian Pose
42
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents: 40
diff changeset
     8
 *
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents: 40
diff changeset
     9
 *  (C) Copyright IgH 2002
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents: 40
diff changeset
    10
 *  Ingenieurgemeinschaft IgH
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents: 40
diff changeset
    11
 *  Heinz-Bäcker Str. 34
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents: 40
diff changeset
    12
 *  D-45356 Essen
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents: 40
diff changeset
    13
 *  Tel.: +49 201/61 99 31
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents: 40
diff changeset
    14
 *  Fax.: +49 201/61 98 36
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents: 40
diff changeset
    15
 *  E-mail: hm@igh-essen.com
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents: 40
diff changeset
    16
 *
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents: 40
diff changeset
    17
 *  $Id$
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents: 40
diff changeset
    18
 *
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents: 40
diff changeset
    19
 *****************************************************************************/
28
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
    20
45
f525f7db2d90 Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents: 43
diff changeset
    21
// Linux
28
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
    22
#include <linux/module.h>
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
    23
#include <linux/ipipe.h>
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
    24
#include <linux/slab.h>
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
    25
#include <linux/vmalloc.h>
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
    26
#include <linux/delay.h>
28
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
    27
45
f525f7db2d90 Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents: 43
diff changeset
    28
// RT_lib
f525f7db2d90 Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents: 43
diff changeset
    29
#include <msr_main.h>
f525f7db2d90 Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents: 43
diff changeset
    30
#include <msr_utils.h>
f525f7db2d90 Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents: 43
diff changeset
    31
#include <msr_messages.h>
f525f7db2d90 Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents: 43
diff changeset
    32
#include <msr_float.h>
28
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
    33
#include <msr_reg.h>
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
    34
#include <msr_time.h>
45
f525f7db2d90 Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents: 43
diff changeset
    35
#include "msr_param.h"
f525f7db2d90 Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents: 43
diff changeset
    36
f525f7db2d90 Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents: 43
diff changeset
    37
// EtherCAT
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
    38
#include "../include/ecrt.h"
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
    39
106
d6679c77ad3f ecrt_master_prepare_async_io() hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents: 104
diff changeset
    40
#define ASYNC
28
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
    41
45
f525f7db2d90 Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents: 43
diff changeset
    42
// Defines/Makros
47
ad5f969f263b Prozessdatentimeout, Buszeit und weniger Klemmen.
Florian Pose <fp@igh-essen.com>
parents: 45
diff changeset
    43
#define HZREDUCTION (MSR_ABTASTFREQUENZ / HZ)
28
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
    44
45
f525f7db2d90 Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents: 43
diff changeset
    45
/*****************************************************************************/
f525f7db2d90 Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents: 43
diff changeset
    46
/* Globale Variablen */
f525f7db2d90 Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents: 43
diff changeset
    47
f525f7db2d90 Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents: 43
diff changeset
    48
// Adeos
28
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
    49
static struct ipipe_domain this_domain;
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
    50
static struct ipipe_sysinfo sys_info;
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
    51
45
f525f7db2d90 Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents: 43
diff changeset
    52
// EtherCAT
54
7506e67dd122 Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents: 51
diff changeset
    53
ec_master_t *master = NULL;
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
    54
ec_domain_t *domain1 = NULL;
98
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 91
diff changeset
    55
ec_domain_t *domain2 = NULL;
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
    56
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
    57
// Prozessdaten
82
30d0708229b9 Buskoppler werden jetzt gesondert behandelt.
Florian Pose <fp@igh-essen.com>
parents: 81
diff changeset
    58
void *r_ssi;
98
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 91
diff changeset
    59
void *r_ssi2;
82
30d0708229b9 Buskoppler werden jetzt gesondert behandelt.
Florian Pose <fp@igh-essen.com>
parents: 81
diff changeset
    60
void *r_inc;
30d0708229b9 Buskoppler werden jetzt gesondert behandelt.
Florian Pose <fp@igh-essen.com>
parents: 81
diff changeset
    61
30d0708229b9 Buskoppler werden jetzt gesondert behandelt.
Florian Pose <fp@igh-essen.com>
parents: 81
diff changeset
    62
uint32_t k_angle;
30d0708229b9 Buskoppler werden jetzt gesondert behandelt.
Florian Pose <fp@igh-essen.com>
parents: 81
diff changeset
    63
uint32_t k_pos;
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
    64
uint32_t k_preio;
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
    65
uint32_t k_postio;
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
    66
uint32_t k_finished;
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
    67
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
    68
ec_field_init_t domain1_fields[] = {
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
    69
    {&r_ssi,  "1", "Beckhoff", "EL5001", "InputValue", 0, 1},
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
    70
    {}
61
cd014255f94f register_slave_list() und Bugfix in deactivate_slaves()
Florian Pose <fp@igh-essen.com>
parents: 59
diff changeset
    71
};
cd014255f94f register_slave_list() und Bugfix in deactivate_slaves()
Florian Pose <fp@igh-essen.com>
parents: 59
diff changeset
    72
98
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 91
diff changeset
    73
ec_field_init_t domain2_fields[] = {
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
    74
    {&r_ssi2,  "1", "Beckhoff", "EL5001", "InputValue", 0, 1},
98
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 91
diff changeset
    75
    {}
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 91
diff changeset
    76
};
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 91
diff changeset
    77
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
    78
/*****************************************************************************/
28
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
    79
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
    80
static void msr_controller_run(void)
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
    81
{
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
    82
    cycles_t offset;
98
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 91
diff changeset
    83
    static unsigned int counter = 0;
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 91
diff changeset
    84
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
    85
    offset = get_cycles();
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
    86
98
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 91
diff changeset
    87
    if (counter) counter--;
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 91
diff changeset
    88
    else {
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 91
diff changeset
    89
        //EtherCAT_rt_master_debug(master, 2);
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 91
diff changeset
    90
        counter = MSR_ABTASTFREQUENZ;
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 91
diff changeset
    91
    }
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 91
diff changeset
    92
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
    93
    k_preio = (uint32_t) (get_cycles() - offset) * 1e6 / cpu_khz;
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
    94
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
    95
#ifdef ASYNC
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
    96
    // Empfangen
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
    97
    ecrt_master_async_receive(master);
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
    98
    ecrt_domain_process(domain1);
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
    99
    ecrt_domain_process(domain2);
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   100
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   101
    // Prozessdaten verarbeiten
82
30d0708229b9 Buskoppler werden jetzt gesondert behandelt.
Florian Pose <fp@igh-essen.com>
parents: 81
diff changeset
   102
    k_pos = EC_READ_U32(r_ssi);
98
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 91
diff changeset
   103
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   104
    // Senden
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   105
    ecrt_domain_queue(domain1);
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   106
    ecrt_domain_queue(domain2);
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   107
    ecrt_master_async_send(master);
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   108
#else
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   109
    // Senden und empfangen
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   110
    ecrt_domain_queue(domain1);
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   111
    ecrt_domain_queue(domain2);
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   112
    ecrt_master_sync_io(master);
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   113
    ecrt_domain_process(domain1);
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   114
    ecrt_domain_process(domain2);
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   115
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   116
    // Prozessdaten verarbeiten
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   117
    k_pos = EC_READ_U32(r_ssi);
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   118
#endif
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   119
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   120
    k_postio = (uint32_t) (get_cycles() - offset) * 1e6 / cpu_khz;
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   121
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   122
    //ecrt_master_debug(master, 0);
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   123
    k_finished = (uint32_t) (get_cycles() - offset) * 1e6 / cpu_khz;
82
30d0708229b9 Buskoppler werden jetzt gesondert behandelt.
Florian Pose <fp@igh-essen.com>
parents: 81
diff changeset
   124
}
30d0708229b9 Buskoppler werden jetzt gesondert behandelt.
Florian Pose <fp@igh-essen.com>
parents: 81
diff changeset
   125
30d0708229b9 Buskoppler werden jetzt gesondert behandelt.
Florian Pose <fp@igh-essen.com>
parents: 81
diff changeset
   126
/*****************************************************************************/
30d0708229b9 Buskoppler werden jetzt gesondert behandelt.
Florian Pose <fp@igh-essen.com>
parents: 81
diff changeset
   127
30d0708229b9 Buskoppler werden jetzt gesondert behandelt.
Florian Pose <fp@igh-essen.com>
parents: 81
diff changeset
   128
int msr_globals_register(void)
30d0708229b9 Buskoppler werden jetzt gesondert behandelt.
Florian Pose <fp@igh-essen.com>
parents: 81
diff changeset
   129
{
30d0708229b9 Buskoppler werden jetzt gesondert behandelt.
Florian Pose <fp@igh-essen.com>
parents: 81
diff changeset
   130
    msr_reg_kanal("/angle0", "", &k_angle, TUINT);
30d0708229b9 Buskoppler werden jetzt gesondert behandelt.
Florian Pose <fp@igh-essen.com>
parents: 81
diff changeset
   131
    msr_reg_kanal("/pos0",   "", &k_pos,   TUINT);
30d0708229b9 Buskoppler werden jetzt gesondert behandelt.
Florian Pose <fp@igh-essen.com>
parents: 81
diff changeset
   132
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   133
    msr_reg_kanal("/Timing/Pre-IO",   "ns", &k_preio,    TUINT);
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   134
    msr_reg_kanal("/Timing/Post-IO",  "ns", &k_postio,   TUINT);
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   135
    msr_reg_kanal("/Timing/Finished", "ns", &k_finished, TUINT);
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   136
82
30d0708229b9 Buskoppler werden jetzt gesondert behandelt.
Florian Pose <fp@igh-essen.com>
parents: 81
diff changeset
   137
    return 0;
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
   138
}
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
   139
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
   140
/*****************************************************************************/
28
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
   141
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
   142
void msr_run(unsigned irq)
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
   143
{
45
f525f7db2d90 Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents: 43
diff changeset
   144
    static int counter = 0;
f525f7db2d90 Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents: 43
diff changeset
   145
f525f7db2d90 Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents: 43
diff changeset
   146
    MSR_ADEOS_INTERRUPT_CODE(msr_controller_run(); msr_write_kanal_list(););
28
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
   147
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
   148
    ipipe_control_irq(irq, 0, IPIPE_ENABLE_MASK); // Interrupt bestŽätigen
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
   149
    if (++counter >= HZREDUCTION) {
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
   150
	ipipe_propagate_irq(irq);  // und weiterreichen
28
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
   151
	counter = 0;
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
   152
    }
42
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents: 40
diff changeset
   153
}
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents: 40
diff changeset
   154
45
f525f7db2d90 Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents: 43
diff changeset
   155
/*****************************************************************************/
f525f7db2d90 Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents: 43
diff changeset
   156
f525f7db2d90 Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents: 43
diff changeset
   157
void domain_entry(void)
42
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents: 40
diff changeset
   158
{
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents: 40
diff changeset
   159
    printk("Domain %s started.\n", ipipe_current_domain->name);
28
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
   160
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
   161
    ipipe_get_sysinfo(&sys_info);
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
   162
    ipipe_virtualize_irq(ipipe_current_domain,sys_info.archdep.tmirq,
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
   163
			 &msr_run, NULL, IPIPE_HANDLE_MASK);
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
   164
68
a452700db994 Neue ASCII-Adressierung und Code-Dokumantation.
Florian Pose <fp@igh-essen.com>
parents: 62
diff changeset
   165
    ipipe_tune_timer(1000000000UL / MSR_ABTASTFREQUENZ, 0);
42
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents: 40
diff changeset
   166
}
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents: 40
diff changeset
   167
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
   168
/*****************************************************************************/
28
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
   169
54
7506e67dd122 Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents: 51
diff changeset
   170
int __init init_rt_module(void)
7506e67dd122 Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents: 51
diff changeset
   171
{
28
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
   172
    struct ipipe_domain_attr attr; //ipipe
80
8cd08d73b560 CANopen SDO read implementiert.
Florian Pose <fp@igh-essen.com>
parents: 73
diff changeset
   173
    uint32_t version;
28
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
   174
36
6e9de6fbf74c EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents: 33
diff changeset
   175
    // Als allererstes die RT-lib initialisieren
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
   176
    if (msr_rtlib_init(1, MSR_ABTASTFREQUENZ, 10, &msr_globals_register) < 0) {
28
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
   177
        msr_print_warn("msr_modul: can't initialize rtlib!");
36
6e9de6fbf74c EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents: 33
diff changeset
   178
        goto out_return;
28
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
   179
    }
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
   180
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   181
    if ((master = ecrt_request_master(0)) == NULL) {
55
059a9e712aa7 Mit neuer Schnittstelle wieder lauff?hig.
Florian Pose <fp@igh-essen.com>
parents: 54
diff changeset
   182
        printk(KERN_ERR "Error requesting master 0!\n");
36
6e9de6fbf74c EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents: 33
diff changeset
   183
        goto out_msr_cleanup;
6e9de6fbf74c EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents: 33
diff changeset
   184
    }
6e9de6fbf74c EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents: 33
diff changeset
   185
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   186
    //ecrt_master_print(master);
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
   187
98
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 91
diff changeset
   188
    printk(KERN_INFO "Registering domains...\n");
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
   189
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   190
    if (!(domain1 = ecrt_master_create_domain(master))) {
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
   191
        printk(KERN_ERR "EtherCAT: Could not register domain!\n");
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
   192
        goto out_release_master;
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
   193
    }
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
   194
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   195
    if (!(domain2 = ecrt_master_create_domain(master))) {
98
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 91
diff changeset
   196
        printk(KERN_ERR "EtherCAT: Could not register domain!\n");
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 91
diff changeset
   197
        goto out_release_master;
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 91
diff changeset
   198
    }
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 91
diff changeset
   199
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
   200
    printk(KERN_INFO "Registering domain fields...\n");
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
   201
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   202
    if (ecrt_domain_register_field_list(domain1, domain1_fields)) {
98
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 91
diff changeset
   203
        printk(KERN_ERR "Failed to register domain fields.\n");
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 91
diff changeset
   204
        goto out_release_master;
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 91
diff changeset
   205
    }
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 91
diff changeset
   206
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   207
    if (ecrt_domain_register_field_list(domain2, domain2_fields)) {
98
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 91
diff changeset
   208
        printk(KERN_ERR "Failed to register domain fields.\n");
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 91
diff changeset
   209
        goto out_release_master;
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
   210
    }
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
   211
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
   212
    printk(KERN_INFO "Activating master...\n");
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
   213
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   214
    //ecrt_master_debug(master, 2);
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   215
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   216
    if (ecrt_master_activate(master)) {
80
8cd08d73b560 CANopen SDO read implementiert.
Florian Pose <fp@igh-essen.com>
parents: 73
diff changeset
   217
        printk(KERN_ERR "Could not activate master!\n");
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
   218
        goto out_release_master;
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
   219
    }
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
   220
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   221
    //ecrt_master_debug(master, 0);
98
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 91
diff changeset
   222
81
28b1defdcc88 Nicht registrierte Slaves in PREOP schalten.
Florian Pose <fp@igh-essen.com>
parents: 80
diff changeset
   223
#if 1
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   224
    if (ecrt_master_sdo_read(master, "6", 0x100A, 1, &version)) {
80
8cd08d73b560 CANopen SDO read implementiert.
Florian Pose <fp@igh-essen.com>
parents: 73
diff changeset
   225
        printk(KERN_ERR "Could not read SSI version!\n");
68
a452700db994 Neue ASCII-Adressierung und Code-Dokumantation.
Florian Pose <fp@igh-essen.com>
parents: 62
diff changeset
   226
        goto out_release_master;
a452700db994 Neue ASCII-Adressierung und Code-Dokumantation.
Florian Pose <fp@igh-essen.com>
parents: 62
diff changeset
   227
    }
83
e8b76a509bc9 Beispiel-Echtzeitcode angepasst.
Florian Pose <fp@igh-essen.com>
parents: 82
diff changeset
   228
    printk(KERN_INFO "Software-version: %u\n", version);
81
28b1defdcc88 Nicht registrierte Slaves in PREOP schalten.
Florian Pose <fp@igh-essen.com>
parents: 80
diff changeset
   229
#endif
61
cd014255f94f register_slave_list() und Bugfix in deactivate_slaves()
Florian Pose <fp@igh-essen.com>
parents: 59
diff changeset
   230
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   231
#ifdef ASYNC
106
d6679c77ad3f ecrt_master_prepare_async_io() hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents: 104
diff changeset
   232
    // Einmal senden und warten...
d6679c77ad3f ecrt_master_prepare_async_io() hinzugef?gt.
Florian Pose <fp@igh-essen.com>
parents: 104
diff changeset
   233
    ecrt_master_prepare_async_io(master);
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   234
#endif
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   235
61
cd014255f94f register_slave_list() und Bugfix in deactivate_slaves()
Florian Pose <fp@igh-essen.com>
parents: 59
diff changeset
   236
    ipipe_init_attr(&attr);
cd014255f94f register_slave_list() und Bugfix in deactivate_slaves()
Florian Pose <fp@igh-essen.com>
parents: 59
diff changeset
   237
    attr.name = "IPIPE-MSR-MODULE";
28
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
   238
    attr.priority = IPIPE_ROOT_PRIO + 1;
61
cd014255f94f register_slave_list() und Bugfix in deactivate_slaves()
Florian Pose <fp@igh-essen.com>
parents: 59
diff changeset
   239
    attr.entry = &domain_entry;
cd014255f94f register_slave_list() und Bugfix in deactivate_slaves()
Florian Pose <fp@igh-essen.com>
parents: 59
diff changeset
   240
    ipipe_register_domain(&this_domain, &attr);
28
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
   241
36
6e9de6fbf74c EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents: 33
diff changeset
   242
    return 0;
6e9de6fbf74c EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents: 33
diff changeset
   243
6e9de6fbf74c EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents: 33
diff changeset
   244
 out_release_master:
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   245
    ecrt_release_master(master);
36
6e9de6fbf74c EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents: 33
diff changeset
   246
6e9de6fbf74c EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents: 33
diff changeset
   247
 out_msr_cleanup:
6e9de6fbf74c EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents: 33
diff changeset
   248
    msr_rtlib_cleanup();
6e9de6fbf74c EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents: 33
diff changeset
   249
6e9de6fbf74c EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents: 33
diff changeset
   250
 out_return:
6e9de6fbf74c EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents: 33
diff changeset
   251
    return -1;
28
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
   252
}
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
   253
42
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents: 40
diff changeset
   254
/*****************************************************************************/
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents: 40
diff changeset
   255
54
7506e67dd122 Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents: 51
diff changeset
   256
void __exit cleanup_rt_module(void)
7506e67dd122 Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents: 51
diff changeset
   257
{
28
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
   258
    msr_print_info("msk_modul: unloading...");
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
   259
45
f525f7db2d90 Verbesserte Makefiles (MODPOST-Warnungen entfernt).
Florian Pose <fp@igh-essen.com>
parents: 43
diff changeset
   260
    ipipe_tune_timer(1000000000UL / HZ, 0); //alten Timertakt wieder herstellen
28
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
   261
    ipipe_unregister_domain(&this_domain);
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
   262
54
7506e67dd122 Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents: 51
diff changeset
   263
    if (master)
28
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
   264
    {
43
35120a61d55e Sch?nheitskorrekturen.
Florian Pose <fp@igh-essen.com>
parents: 42
diff changeset
   265
        printk(KERN_INFO "=== Stopping EtherCAT environment... ===\n");
35120a61d55e Sch?nheitskorrekturen.
Florian Pose <fp@igh-essen.com>
parents: 42
diff changeset
   266
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
   267
        printk(KERN_INFO "Deactivating master...\n");
104
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   268
        ecrt_master_deactivate(master);
052bc82d5442 MERGE branches/async -> trunk (alle Unterschiede ?bernommen)
Florian Pose <fp@igh-essen.com>
parents: 98
diff changeset
   269
        ecrt_release_master(master);
43
35120a61d55e Sch?nheitskorrekturen.
Florian Pose <fp@igh-essen.com>
parents: 42
diff changeset
   270
35120a61d55e Sch?nheitskorrekturen.
Florian Pose <fp@igh-essen.com>
parents: 42
diff changeset
   271
        printk(KERN_INFO "=== EtherCAT environment stopped. ===\n");
35120a61d55e Sch?nheitskorrekturen.
Florian Pose <fp@igh-essen.com>
parents: 42
diff changeset
   272
    }
28
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
   273
36
6e9de6fbf74c EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
Florian Pose <fp@igh-essen.com>
parents: 33
diff changeset
   274
    msr_rtlib_cleanup();
28
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
   275
}
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
   276
42
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents: 40
diff changeset
   277
/*****************************************************************************/
a22a202d0f42 Domains, Warten beim Senden, 10kHz.
Florian Pose <fp@igh-essen.com>
parents: 40
diff changeset
   278
98
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 91
diff changeset
   279
#define EC_LIT(X) #X
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 91
diff changeset
   280
#define EC_STR(X) EC_LIT(X)
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 91
diff changeset
   281
#define COMPILE_INFO "Revision " EC_STR(SVNREV) \
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 91
diff changeset
   282
                     ", compiled by " EC_STR(USER) \
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 91
diff changeset
   283
                     " at " __DATE__ " " __TIME__
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 91
diff changeset
   284
28
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
   285
MODULE_LICENSE("GPL");
73
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
   286
MODULE_AUTHOR ("Florian Pose <fp@igh-essen.com>");
9f4ea66d89a3 Dynamische FMMU-Konfiguration, zwei Kopieroperationen eingespart, Einr?ckungen angepasst.
Florian Pose <fp@igh-essen.com>
parents: 68
diff changeset
   287
MODULE_DESCRIPTION ("EtherCAT real-time test environment");
98
f564d0929292 MERGE branches/async 222:233 -> trunk (Kommando-Warteschlangen).
Florian Pose <fp@igh-essen.com>
parents: 91
diff changeset
   288
MODULE_VERSION(COMPILE_INFO);
28
801dc7eabf51 IPIPE,floatpoint,rtlib
Wilhelm Hagemeister <hm@igh-essen.com>
parents:
diff changeset
   289
54
7506e67dd122 Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents: 51
diff changeset
   290
module_init(init_rt_module);
7506e67dd122 Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents: 51
diff changeset
   291
module_exit(cleanup_rt_module);
7506e67dd122 Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents: 51
diff changeset
   292
7506e67dd122 Vereinheitlichte Schnittstellen, Include-Verzeichnis und Module getrennt.
Florian Pose <fp@igh-essen.com>
parents: 51
diff changeset
   293
/*****************************************************************************/
55
059a9e712aa7 Mit neuer Schnittstelle wieder lauff?hig.
Florian Pose <fp@igh-essen.com>
parents: 54
diff changeset
   294
059a9e712aa7 Mit neuer Schnittstelle wieder lauff?hig.
Florian Pose <fp@igh-essen.com>
parents: 54
diff changeset
   295
/* Emacs-Konfiguration
059a9e712aa7 Mit neuer Schnittstelle wieder lauff?hig.
Florian Pose <fp@igh-essen.com>
parents: 54
diff changeset
   296
;;; Local Variables: ***
059a9e712aa7 Mit neuer Schnittstelle wieder lauff?hig.
Florian Pose <fp@igh-essen.com>
parents: 54
diff changeset
   297
;;; c-basic-offset:4 ***
059a9e712aa7 Mit neuer Schnittstelle wieder lauff?hig.
Florian Pose <fp@igh-essen.com>
parents: 54
diff changeset
   298
;;; End: ***
059a9e712aa7 Mit neuer Schnittstelle wieder lauff?hig.
Florian Pose <fp@igh-essen.com>
parents: 54
diff changeset
   299
*/