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
c4c50a92
Commit
c4c50a92
authored
19 years ago
by
Florian Pose
Browse files
Options
Downloads
Patches
Plain Diff
Feldregistrierung: NULL als data_ptr möglich, field_count 0 = 1.
parent
e163a681
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
master/domain.c
+17
-16
17 additions, 16 deletions
master/domain.c
mini/mini.c
+14
-15
14 additions, 15 deletions
mini/mini.c
rt/msr_module.c
+2
-2
2 additions, 2 deletions
rt/msr_module.c
with
33 additions
and
33 deletions
master/domain.c
+
17
−
16
View file @
c4c50a92
...
@@ -122,7 +122,7 @@ int ec_domain_alloc(ec_domain_t *domain, /**< Dom
...
@@ -122,7 +122,7 @@ int ec_domain_alloc(ec_domain_t *domain, /**< Dom
ec_field_reg_t
*
field_reg
;
ec_field_reg_t
*
field_reg
;
ec_slave_t
*
slave
;
ec_slave_t
*
slave
;
ec_fmmu_t
*
fmmu
;
ec_fmmu_t
*
fmmu
;
unsigned
int
i
,
j
,
found
;
unsigned
int
i
,
j
;
uint32_t
data_offset
;
uint32_t
data_offset
;
if
(
domain
->
data
)
{
if
(
domain
->
data
)
{
...
@@ -163,22 +163,15 @@ int ec_domain_alloc(ec_domain_t *domain, /**< Dom
...
@@ -163,22 +163,15 @@ int ec_domain_alloc(ec_domain_t *domain, /**< Dom
// Alle Prozessdatenzeiger setzen
// Alle Prozessdatenzeiger setzen
list_for_each_entry
(
field_reg
,
&
domain
->
field_regs
,
list
)
{
list_for_each_entry
(
field_reg
,
&
domain
->
field_regs
,
list
)
{
found
=
0
;
for
(
i
=
0
;
i
<
field_reg
->
slave
->
fmmu_count
;
i
++
)
{
for
(
i
=
0
;
i
<
field_reg
->
slave
->
fmmu_count
;
i
++
)
{
fmmu
=
&
field_reg
->
slave
->
fmmus
[
i
];
fmmu
=
&
field_reg
->
slave
->
fmmus
[
i
];
if
(
fmmu
->
domain
==
domain
&&
fmmu
->
sync
==
field_reg
->
sync
)
{
if
(
fmmu
->
domain
==
domain
&&
fmmu
->
sync
==
field_reg
->
sync
)
{
data_offset
=
fmmu
->
logical_start_address
-
base_address
data_offset
=
fmmu
->
logical_start_address
-
base_address
+
field_reg
->
field_offset
;
+
field_reg
->
field_offset
;
*
field_reg
->
data_ptr
=
domain
->
data
+
data_offset
;
*
field_reg
->
data_ptr
=
domain
->
data
+
data_offset
;
found
=
1
;
break
;
break
;
}
}
}
}
if
(
!
found
)
{
// Sollte nie passieren
EC_ERR
(
"FMMU not found. Please report!
\n
"
);
return
-
1
;
}
}
}
// Kommando-Array erzeugen
// Kommando-Array erzeugen
...
@@ -224,6 +217,12 @@ void ec_domain_response_count(ec_domain_t *domain, /**< Dom
...
@@ -224,6 +217,12 @@ void ec_domain_response_count(ec_domain_t *domain, /**< Dom
/**
/**
Registriert ein Datenfeld innerhalb einer Domne.
Registriert ein Datenfeld innerhalb einer Domne.
- Ist \a data_ptr NULL, so wird der Slave nur auf den Typ berprft.
- Wenn \a field_count 0 ist, wird angenommen, dass 1 Feld registriert werden
soll.
- Wenn \a field_count grer als 1 ist, wird angenommen, dass \a data_ptr
auf ein entsprechend groes Array zeigt.
\return Zeiger auf den Slave bei Erfolg, sonst NULL
\return Zeiger auf den Slave bei Erfolg, sonst NULL
*/
*/
...
@@ -257,11 +256,6 @@ ec_slave_t *ecrt_domain_register_field(ec_domain_t *domain,
...
@@ -257,11 +256,6 @@ ec_slave_t *ecrt_domain_register_field(ec_domain_t *domain,
unsigned
int
field_counter
,
i
,
j
,
orig_field_index
,
orig_field_count
;
unsigned
int
field_counter
,
i
,
j
,
orig_field_index
,
orig_field_count
;
uint32_t
field_offset
;
uint32_t
field_offset
;
if
(
!
field_count
)
{
EC_ERR
(
"field_count may not be 0!
\n
"
);
return
NULL
;
}
master
=
domain
->
master
;
master
=
domain
->
master
;
// Adresse bersetzen
// Adresse bersetzen
...
@@ -281,6 +275,12 @@ ec_slave_t *ecrt_domain_register_field(ec_domain_t *domain,
...
@@ -281,6 +275,12 @@ ec_slave_t *ecrt_domain_register_field(ec_domain_t *domain,
return
NULL
;
return
NULL
;
}
}
if
(
!
data_ptr
)
{
// Wenn data_ptr NULL, Slave als registriert ansehen (nicht warnen).
slave
->
registered
=
1
;
}
if
(
!
field_count
)
field_count
=
1
;
orig_field_index
=
field_index
;
orig_field_index
=
field_index
;
orig_field_count
=
field_count
;
orig_field_count
=
field_count
;
...
@@ -292,8 +292,9 @@ ec_slave_t *ecrt_domain_register_field(ec_domain_t *domain,
...
@@ -292,8 +292,9 @@ ec_slave_t *ecrt_domain_register_field(ec_domain_t *domain,
field
=
sync
->
fields
[
j
];
field
=
sync
->
fields
[
j
];
if
(
!
strcmp
(
field
->
name
,
field_name
))
{
if
(
!
strcmp
(
field
->
name
,
field_name
))
{
if
(
field_counter
++
==
field_index
)
{
if
(
field_counter
++
==
field_index
)
{
ec_domain_reg_field
(
domain
,
slave
,
sync
,
field_offset
,
if
(
data_ptr
)
data_ptr
++
);
ec_domain_reg_field
(
domain
,
slave
,
sync
,
field_offset
,
data_ptr
++
);
if
(
!
(
--
field_count
))
return
slave
;
if
(
!
(
--
field_count
))
return
slave
;
field_index
++
;
field_index
++
;
}
}
...
@@ -326,7 +327,7 @@ int ecrt_domain_register_field_list(ec_domain_t *domain,
...
@@ -326,7 +327,7 @@ int ecrt_domain_register_field_list(ec_domain_t *domain,
{
{
ec_field_init_t
*
field
;
ec_field_init_t
*
field
;
for
(
field
=
fields
;
field
->
data_ptr
;
field
++
)
for
(
field
=
fields
;
field
->
slave_address
;
field
++
)
if
(
!
ecrt_domain_register_field
(
domain
,
field
->
slave_address
,
if
(
!
ecrt_domain_register_field
(
domain
,
field
->
slave_address
,
field
->
vendor_name
,
field
->
vendor_name
,
field
->
product_name
,
field
->
data_ptr
,
field
->
product_name
,
field
->
data_ptr
,
...
...
This diff is collapsed.
Click to expand it.
mini/mini.c
+
14
−
15
View file @
c4c50a92
...
@@ -29,25 +29,23 @@ ec_master_t *master = NULL;
...
@@ -29,25 +29,23 @@ ec_master_t *master = NULL;
ec_domain_t
*
domain1
=
NULL
;
ec_domain_t
*
domain1
=
NULL
;
// Datenfelder
// Datenfelder
void
*
r_ssi_input
,
*
r_ssi_status
;
void
*
r_ssi_input
,
*
r_ssi_status
,
*
r_4102
[
3
];
void
*
r_field
[
9
];
void
*
r_4102
[
3
];
// Kanle
// Kanle
uint32_t
k_pos
;
uint32_t
k_pos
;
uint8_t
k_stat
;
uint8_t
k_stat
;
ec_field_init_t
domain1_fields
[]
=
{
ec_field_init_t
domain1_fields
[]
=
{
{
&
r_ssi_input
,
"1"
,
"Beckhoff"
,
"EL5001"
,
"InputValue"
,
0
,
1
},
{
&
r_ssi_input
,
"1"
,
"Beckhoff"
,
"EL5001"
,
"InputValue"
,
0
},
{
&
r_ssi_status
,
"1"
,
"Beckhoff"
,
"EL5001"
,
"Status"
,
0
,
1
},
{
&
r_ssi_status
,
"1"
,
"Beckhoff"
,
"EL5001"
,
"Status"
,
0
},
{
&
r_field
[
1
],
"2"
,
"Beckhoff"
,
"EL4132"
,
"OutputValue"
,
0
,
1
},
{
NULL
,
"2"
,
"Beckhoff"
,
"EL4132"
,
"OutputValue"
,
0
},
{
&
r_field
[
2
],
"3"
,
"Beckhoff"
,
"EL3162"
,
"InputValue"
,
0
,
1
},
{
NULL
,
"3"
,
"Beckhoff"
,
"EL3162"
,
"InputValue"
,
0
},
{
r_4102
,
"4"
,
"Beckhoff"
,
"EL4102"
,
"OutputValue"
,
0
,
2
},
{
r_4102
,
"4"
,
"Beckhoff"
,
"EL4102"
,
"OutputValue"
,
0
,
2
},
{
&
r_field
[
4
],
"5"
,
"Beckhoff"
,
"EL5001"
,
"InputValue"
,
0
,
1
},
{
NULL
,
"5"
,
"Beckhoff"
,
"EL5001"
,
"InputValue"
,
0
},
{
&
r_field
[
5
],
"6"
,
"Beckhoff"
,
"EL1014"
,
"InputValue"
,
0
,
1
},
{
NULL
,
"6"
,
"Beckhoff"
,
"EL1014"
,
"InputValue"
,
0
},
{
&
r_field
[
6
],
"7"
,
"Beckhoff"
,
"EL2004"
,
"OutputValue"
,
0
,
1
},
{
NULL
,
"7"
,
"Beckhoff"
,
"EL2004"
,
"OutputValue"
,
0
},
{
&
r_field
[
7
],
"8"
,
"Beckhoff"
,
"EL4132"
,
"OutputValue"
,
0
,
1
},
{
NULL
,
"8"
,
"Beckhoff"
,
"EL4132"
,
"OutputValue"
,
0
},
{
&
r_field
[
8
],
"9"
,
"Beckhoff"
,
"EL4132"
,
"OutputValue"
,
0
,
1
},
{
NULL
,
"9"
,
"Beckhoff"
,
"EL4132"
,
"OutputValue"
,
0
},
{}
{}
};
};
...
@@ -58,7 +56,7 @@ void run(unsigned long data)
...
@@ -58,7 +56,7 @@ void run(unsigned long data)
static
unsigned
int
counter
=
0
;
static
unsigned
int
counter
=
0
;
#ifdef ASYNC
#ifdef ASYNC
// Prozessdaten em
f
pangen
// Prozessdaten emp
f
angen
ecrt_master_async_receive
(
master
);
ecrt_master_async_receive
(
master
);
ecrt_domain_process
(
domain1
);
ecrt_domain_process
(
domain1
);
...
@@ -70,13 +68,14 @@ void run(unsigned long data)
...
@@ -70,13 +68,14 @@ void run(unsigned long data)
ecrt_domain_queue
(
domain1
);
ecrt_domain_queue
(
domain1
);
ecrt_master_async_send
(
master
);
ecrt_master_async_send
(
master
);
#else
#else
// Prozessdaten senden und em
f
pangen
// Prozessdaten senden und emp
f
angen
ecrt_domain_queue
(
domain1
);
ecrt_domain_queue
(
domain1
);
ecrt_master_sync_io
(
master
);
ecrt_master_sync_io
(
master
);
ecrt_domain_process
(
domain1
);
ecrt_domain_process
(
domain1
);
// Prozessdaten verarbeiten
// Prozessdaten verarbeiten
k_pos
=
EC_READ_U32
(
r_ssi
);
k_pos
=
EC_READ_U32
(
r_ssi_input
);
k_stat
=
EC_READ_U8
(
r_ssi_status
);
#endif
#endif
if
(
counter
)
{
if
(
counter
)
{
...
...
This diff is collapsed.
Click to expand it.
rt/msr_module.c
+
2
−
2
View file @
c4c50a92
...
@@ -66,12 +66,12 @@ uint32_t k_postio;
...
@@ -66,12 +66,12 @@ uint32_t k_postio;
uint32_t
k_finished
;
uint32_t
k_finished
;
ec_field_init_t
domain1_fields
[]
=
{
ec_field_init_t
domain1_fields
[]
=
{
{
&
r_ssi
,
"1"
,
"Beckhoff"
,
"EL5001"
,
"InputValue"
,
0
,
1
},
{
&
r_ssi
,
"1"
,
"Beckhoff"
,
"EL5001"
,
"InputValue"
,
0
},
{}
{}
};
};
ec_field_init_t
domain2_fields
[]
=
{
ec_field_init_t
domain2_fields
[]
=
{
{
&
r_ssi2
,
"1"
,
"Beckhoff"
,
"EL5001"
,
"InputValue"
,
0
,
1
},
{
&
r_ssi2
,
"1"
,
"Beckhoff"
,
"EL5001"
,
"InputValue"
,
0
},
{}
{}
};
};
...
...
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