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
d8ce4abb
Commit
d8ce4abb
authored
19 years ago
by
Florian Pose
Browse files
Options
Downloads
Patches
Plain Diff
Neue Schnittstellen in Mini übertragen.
parent
634b016a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
mini/mini.c
+21
-40
21 additions, 40 deletions
mini/mini.c
with
21 additions
and
40 deletions
mini/mini.c
+
21
−
40
View file @
d8ce4abb
...
@@ -13,17 +13,12 @@
...
@@ -13,17 +13,12 @@
#include
<linux/timer.h>
#include
<linux/timer.h>
#include
"../include/EtherCAT_rt.h"
#include
"../include/EtherCAT_rt.h"
#include
"../include/EtherCAT_si.h"
/*****************************************************************************/
// Auskommentieren, wenn keine zyklischen Daten erwuenscht
#define ECAT_CYCLIC_DATA
/*****************************************************************************/
/*****************************************************************************/
ec_master_t
*
master
=
NULL
;
ec_master_t
*
master
=
NULL
;
ec_slave_t
*
s_in
,
*
s_out
;
#ifdef ECAT_CYCLIC_DATA
int
value
;
int
value
;
int
dig1
;
int
dig1
;
...
@@ -31,31 +26,28 @@ int dig1;
...
@@ -31,31 +26,28 @@ int dig1;
struct
timer_list
timer
;
struct
timer_list
timer
;
unsigned
long
last_start_jiffies
;
unsigned
long
last_start_jiffies
;
#endif // ECAT_CYCLIC_DATA
/*****************************************************************************/
/******************************************************************************
int
__init
check_slaves
(
void
)
*
{
* Function: run
s_in
=
EtherCAT_rt_register_slave
(
master
,
1
,
"Beckhoff"
,
"EL3102"
,
1
);
*
s_out
=
EtherCAT_rt_register_slave
(
master
,
9
,
"Beckhoff"
,
"EL2004"
,
1
);
* Beschreibung: Zyklischer Prozess
*
*****************************************************************************/
#ifdef ECAT_CYCLIC_DATA
return
s_in
&&
s_out
;
}
/*****************************************************************************/
static
void
run
(
unsigned
long
data
)
void
run
(
unsigned
long
data
)
{
{
static
int
ms
=
0
;
static
int
ms
=
0
;
static
unsigned
long
int
k
=
0
;
static
unsigned
long
int
k
=
0
;
static
int
firstrun
=
1
;
static
int
firstrun
=
1
;
ms
++
;
ms
++
;
ms
%=
1000
;
ms
%=
1000
;
#if 0
EC_WRITE_EL20XX
(
s_out
,
3
,
EC_READ_EL31XX
(
s_in
,
0
)
<
0
);
if (klemme >= 0)
EtherCAT_write_value(&ecat_slaves[klemme], kanal, up_down);
#endif
// Prozessdaten lesen und schreiben
// Prozessdaten lesen und schreiben
rdtscl
(
k
);
rdtscl
(
k
);
...
@@ -66,13 +58,7 @@ static void run(unsigned long data)
...
@@ -66,13 +58,7 @@ static void run(unsigned long data)
add_timer
(
&
timer
);
add_timer
(
&
timer
);
}
}
#endif // ECAT_CYCLIC_DATA
/*****************************************************************************/
/******************************************************************************
*
* Function: init
*
*****************************************************************************/
int
__init
init_mini_module
(
void
)
int
__init
init_mini_module
(
void
)
{
{
...
@@ -83,7 +69,10 @@ int __init init_mini_module(void)
...
@@ -83,7 +69,10 @@ int __init init_mini_module(void)
goto
out_return
;
goto
out_return
;
}
}
//check_slaves();
if
(
!
check_slaves
())
{
printk
(
KERN_ERR
"Could not register slaves!
\n
"
);
goto
out_release_master
;
}
printk
(
"Activating all EtherCAT slaves.
\n
"
);
printk
(
"Activating all EtherCAT slaves.
\n
"
);
...
@@ -92,19 +81,17 @@ int __init init_mini_module(void)
...
@@ -92,19 +81,17 @@ int __init init_mini_module(void)
goto
out_release_master
;
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
.
function
=
run
;
timer
.
data
=
0
;
timer
.
data
=
0
;
timer
.
expires
=
jiffies
+
10
;
// Das erste Mal sofort feuern
timer
.
expires
=
jiffies
+
10
;
// Das erste Mal sofort feuern
last_start_jiffies
=
timer
.
expires
;
last_start_jiffies
=
timer
.
expires
;
add_timer
(
&
timer
);
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
"
);
...
@@ -117,11 +104,7 @@ int __init init_mini_module(void)
...
@@ -117,11 +104,7 @@ int __init init_mini_module(void)
return
-
1
;
return
-
1
;
}
}
/******************************************************************************
/*****************************************************************************/
*
* Function: cleanup
*
*****************************************************************************/
void
__exit
cleanup_mini_module
(
void
)
void
__exit
cleanup_mini_module
(
void
)
{
{
...
@@ -129,9 +112,7 @@ void __exit cleanup_mini_module(void)
...
@@ -129,9 +112,7 @@ void __exit cleanup_mini_module(void)
if
(
master
)
if
(
master
)
{
{
#ifdef ECAT_CYCLIC_DATA
del_timer_sync
(
&
timer
);
del_timer_sync
(
&
timer
);
#endif // ECAT_CYCLIC_DATA
printk
(
KERN_INFO
"Deactivating slaves.
\n
"
);
printk
(
KERN_INFO
"Deactivating slaves.
\n
"
);
...
...
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