Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
etherlabmaster
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ICS Control System Infrastructure
etherlabmaster
Commits
0b080530
Commit
0b080530
authored
19 years ago
by
Florian Pose
Browse files
Options
Downloads
Patches
Plain Diff
EtherCAT_release() im Fehlerfall beim Laden von Modulen mini und rt.
--HG-- branch : kernel2.6
parent
f6e62af7
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
mini/ec_mini.c
+37
-33
37 additions, 33 deletions
mini/ec_mini.c
rt/msr_module.c
+44
-60
44 additions, 60 deletions
rt/msr_module.c
with
81 additions
and
93 deletions
mini/ec_mini.c
+
37
−
33
View file @
0b080530
...
...
@@ -228,47 +228,51 @@ static void run(unsigned long data)
int
__init
init_module
()
{
printk
(
KERN_INFO
"=== Starting Minimal EtherCAT environment... ===
\n
"
);
printk
(
KERN_INFO
"=== Starting Minimal EtherCAT environment... ===
\n
"
);
if
((
ecat_master
=
EtherCAT_request
(
0
))
==
NULL
)
{
printk
(
KERN_ERR
"EtherCAT master 0 not available!
\n
"
);
return
-
1
;
}
if
((
ecat_master
=
EtherCAT_request
(
0
))
==
NULL
)
{
printk
(
KERN_ERR
"EtherCAT master 0 not available!
\n
"
);
goto
out_return
;
}
printk
(
"Checking EtherCAT slaves.
\n
"
);
printk
(
"Checking EtherCAT slaves.
\n
"
);
if
(
EtherCAT_check_slaves
(
ecat_master
,
ecat_slaves
,
ECAT_SLAVES_COUNT
)
!=
0
)
{
printk
(
KERN_ERR
"EtherCAT: Could not init slaves!
\n
"
);
return
-
1
;
}
if
(
EtherCAT_check_slaves
(
ecat_master
,
ecat_slaves
,
ECAT_SLAVES_COUNT
)
!=
0
)
{
printk
(
KERN_ERR
"EtherCAT: Could not init slaves!
\n
"
);
goto
out_release_master
;
}
printk
(
"Activating all EtherCAT slaves.
\n
"
);
printk
(
"Activating all EtherCAT slaves.
\n
"
);
if
(
EtherCAT_activate_all_slaves
(
ecat_master
)
!=
0
)
{
printk
(
KERN_ERR
"EtherCAT: Could not activate slaves!
\n
"
);
return
-
1
;
}
if
(
EtherCAT_activate_all_slaves
(
ecat_master
)
!=
0
)
{
printk
(
KERN_ERR
"EtherCAT: Could not activate slaves!
\n
"
);
goto
out_release_master
;
}
#ifdef ECAT_CYCLIC_DATA
printk
(
"Starting cyclic sample thread.
\n
"
);
printk
(
"Starting cyclic sample thread.
\n
"
);
init_timer
(
&
timer
);
init_timer
(
&
timer
);
timer
.
function
=
run
;
timer
.
data
=
0
;
timer
.
expires
=
jiffies
+
10
;
// Das erste Mal sofort feuern
last_start_jiffies
=
timer
.
expires
;
add_timer
(
&
timer
);
timer
.
function
=
run
;
timer
.
data
=
0
;
timer
.
expires
=
jiffies
+
10
;
// Das erste Mal sofort feuern
last_start_jiffies
=
timer
.
expires
;
add_timer
(
&
timer
);
printk
(
"Initialised sample thread.
\n
"
);
printk
(
"Initialised sample thread.
\n
"
);
#endif
printk
(
KERN_INFO
"=== Minimal EtherCAT environment started. ===
\n
"
);
printk
(
KERN_INFO
"=== Minimal EtherCAT environment started. ===
\n
"
);
return
0
;
out_release_master:
EtherCAT_release
(
ecat_master
);
return
0
;
out_return:
return
-
1
;
}
/******************************************************************************
...
...
@@ -284,14 +288,14 @@ void __exit cleanup_module()
if
(
ecat_master
)
{
#ifdef ECAT_CYCLIC_DATA
del_timer_sync
(
&
timer
);
EtherCAT_clear_process_data
(
ecat_master
);
del_timer_sync
(
&
timer
);
EtherCAT_clear_process_data
(
ecat_master
);
#endif // ECAT_CYCLIC_DATA
printk
(
KERN_INFO
"Deactivating slaves.
\n
"
);
EtherCAT_deactivate_all_slaves
(
ecat_master
);
printk
(
KERN_INFO
"Deactivating slaves.
\n
"
);
EtherCAT_deactivate_all_slaves
(
ecat_master
);
EtherCAT_release
(
ecat_master
);
EtherCAT_release
(
ecat_master
);
}
printk
(
KERN_INFO
"=== Minimal EtherCAT environment stopped. ===
\n
"
);
...
...
This diff is collapsed.
Click to expand it.
rt/msr_module.c
+
44
−
60
View file @
0b080530
...
...
@@ -31,7 +31,7 @@
* *** empty log message ***
*
*
*
*
Hello Emacs: -*- c-basic-offset: 2; -*-
*
**************************************************************************************************/
...
...
@@ -163,7 +163,8 @@ static EtherCAT_slave_t ecat_slaves[] =
ECAT_INIT_SLAVE
(
Beckhoff_EL4102
),
ECAT_INIT_SLAVE
(
Beckhoff_EL4102
),
ECAT_INIT_SLAVE
(
Beckhoff_EL4102
),
ECAT_INIT_SLAVE
(
Beckhoff_EL4102
)
ECAT_INIT_SLAVE
(
Beckhoff_EL4102
),
ECAT_INIT_SLAVE
(
Beckhoff_EL4132
)
#endif
...
...
@@ -294,8 +295,8 @@ static void msr_controller_run(void)
*
* Parameter: Zeiger auf msr_data
*
* Rckgabe:
*
* Rckgabe:
*
* Status: exp
*
***************************************************************************************************
...
...
@@ -305,10 +306,10 @@ static void msr_controller_run(void)
void
msr_run
(
unsigned
irq
)
{
static
int
counter
=
0
;
static
int
counter
=
0
;
#ifdef USE_MSR_LIB
timeval_add
(
&
process_time
,
&
process_time
,
&
msr_time_increment
);
timeval_add
(
&
process_time
,
&
process_time
,
&
msr_time_increment
);
MSR_ADEOS_INTERRUPT_CODE
(
msr_controller_run
();
...
...
@@ -318,7 +319,7 @@ void msr_run(unsigned irq)
msr_controller_run
();
#endif
/* und wieder in die Timerliste eintragen */
/* und neu in die Taskqueue eintragen */
/* und neu in die Taskqueue eintragen */
// timer.expires += 1;
// add_timer(&timer);
...
...
@@ -382,52 +383,42 @@ int msr_globals_register(void)
int
__init
init_module
()
{
int
result
=
0
;
struct
ipipe_domain_attr
attr
;
//ipipe
//
a
ls allererstes die RT-lib initialisieren
//
A
ls allererstes die RT-lib initialisieren
#ifdef USE_MSR_LIB
result
=
msr_rtlib_init
(
1
,
MSR_ABTASTFREQUENZ
,
10
,
&
msr_globals_register
);
if
(
result
<
0
)
{
if
(
msr_rtlib_init
(
1
,
MSR_ABTASTFREQUENZ
,
10
,
&
msr_globals_register
)
<
0
)
{
msr_print_warn
(
"msr_modul: can't initialize rtlib!"
);
return
result
;
goto
out_return
;
}
#endif
msr_jitter_init
();
printk
(
KERN_INFO
"=== Starting EtherCAT environment... ===
\n
"
);
if
((
ecat_master
=
EtherCAT_request
(
0
))
==
NULL
)
{
printk
(
KERN_ERR
"EtherCAT master 0 not available!
\n
"
);
msr_rtlib_cleanup
();
return
-
1
;
}
printk
(
KERN_INFO
"=== Starting EtherCAT environment... ===
\n
"
);
printk
(
"Checking EtherCAT slaves.
\n
"
);
if
((
ecat_master
=
EtherCAT_request
(
0
))
==
NULL
)
{
printk
(
KERN_ERR
"EtherCAT master 0 not available!
\n
"
);
goto
out_msr_cleanup
;
}
if
(
EtherCAT_check_slaves
(
ecat_master
,
ecat_slaves
,
ECAT_SLAVES_COUNT
)
!=
0
)
{
printk
(
KERN_ERR
"EtherCAT: Could not init slaves!
\n
"
);
msr_rtlib_cleanup
();
return
-
1
;
}
printk
(
"Checking EtherCAT slaves.
\n
"
);
printk
(
"Activating all EtherCAT slaves.
\n
"
);
if
(
EtherCAT_check_slaves
(
ecat_master
,
ecat_slaves
,
ECAT_SLAVES_COUNT
)
!=
0
)
{
printk
(
KERN_ERR
"EtherCAT: Could not init slaves!
\n
"
);
goto
out_release_master
;
}
if
(
EtherCAT_activate_all_slaves
(
ecat_master
)
!=
0
)
{
printk
(
KERN_ERR
"EtherCAT: Could not activate slaves!
\n
"
);
msr_rtlib_cleanup
();
return
-
1
;
}
printk
(
"Activating all EtherCAT slaves.
\n
"
);
if
(
EtherCAT_activate_all_slaves
(
ecat_master
)
!=
0
)
{
printk
(
KERN_ERR
"EtherCAT: Could not activate slaves!
\n
"
);
goto
out_release_master
;
}
do_gettimeofday
(
&
process_time
);
msr_time_increment
.
tv_sec
=
0
;
msr_time_increment
.
tv_usec
=
(
unsigned
int
)(
1000000
/
MSR_ABTASTFREQUENZ
);
do_gettimeofday
(
&
process_time
);
msr_time_increment
.
tv_sec
=
0
;
msr_time_increment
.
tv_usec
=
(
unsigned
int
)(
1000000
/
MSR_ABTASTFREQUENZ
);
ipipe_init_attr
(
&
attr
);
attr
.
name
=
"IPIPE-MSR-MODULE"
;
...
...
@@ -435,16 +426,16 @@ int __init init_module()
attr
.
entry
=
&
domain_entry
;
ipipe_register_domain
(
&
this_domain
,
&
attr
);
//den Timertakt
/*
init_timer(&timer);
return
0
;
timer.function = msr_run;
timer.data = 0;
timer.expires = jiffies+10; // Das erste Mal sofort feuern
add_timer(&timer);
*/
return
0
;
/* succeed */
out_release_master:
EtherCAT_release
(
ecat_master
);
out_msr_cleanup:
msr_rtlib_cleanup
();
out_return:
return
-
1
;
}
...
...
@@ -454,30 +445,23 @@ void __exit cleanup_module()
{
msr_print_info
(
"msk_modul: unloading..."
);
// del_timer_sync(&timer);
ipipe_tune_timer
(
1000000000UL
/
HZ
,
0
);
//alten Timertakt wieder herstellen
ipipe_unregister_domain
(
&
this_domain
);
printk
(
KERN_INFO
"=== Stopping EtherCAT environment... ===
\n
"
);
if
(
ecat_master
)
{
EtherCAT_clear_process_data
(
ecat_master
);
printk
(
KERN_INFO
"Deactivating slaves.
\n
"
);
EtherCAT_deactivate_all_slaves
(
ecat_master
);
EtherCAT_release
(
ecat_master
);
EtherCAT_clear_process_data
(
ecat_master
);
printk
(
KERN_INFO
"Deactivating slaves.
\n
"
);
EtherCAT_deactivate_all_slaves
(
ecat_master
);
EtherCAT_release
(
ecat_master
);
}
printk
(
KERN_INFO
"=== EtherCAT environment stopped. ===
\n
"
);
// msr_controller_cleanup();
#ifdef USE_MSR_LIB
msr_rtlib_cleanup
();
msr_rtlib_cleanup
();
#endif
}
...
...
@@ -487,7 +471,7 @@ MODULE_DESCRIPTION ("EtherCAT test environment");
module_init
(
init_module
);
module_exit
(
cleanup_module
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment