37 #include <linux/slab.h> 38 #include <linux/err.h> 111 list_for_each_entry_safe(entry, next, &pdo->
entries, list) {
112 list_del(&entry->
list);
132 if (pdo->
name && name && !strcmp(pdo->
name, name))
138 if (name && (len = strlen(name))) {
139 if (!(pdo->
name = (
char *) kmalloc(len + 1, GFP_KERNEL))) {
140 EC_ERR(
"Failed to allocate PDO name.\n");
143 memcpy(pdo->
name, name, len + 1);
167 EC_ERR(
"Failed to allocate memory for PDO entry.\n");
168 return ERR_PTR(-ENOMEM);
172 entry->
index = index;
196 list_for_each_entry(other_entry, &other->
entries, list) {
199 EC_ERR(
"Failed to allocate memory for PDO entry copy.\n");
227 const struct list_head *head1, *head2, *item1, *item2;
230 head1 = item1 = &pdo1->
entries;
231 head2 = item2 = &pdo2->
entries;
237 if ((item1 == head1) ^ (item2 == head2))
262 unsigned int num = 0;
264 list_for_each_entry(entry, &pdo->
entries, list) {
286 list_for_each_entry(entry, &pdo->
entries, list) {
305 if (list_empty(&pdo->
entries)) {
306 printk(KERN_CONT
"(none)");
308 list_for_each_entry(entry, &pdo->
entries, list) {
309 printk(KERN_CONT
"0x%04X:%02X/%u",
312 printk(KERN_CONT
" ");
int ec_pdo_set_name(ec_pdo_t *pdo, const char *name)
Set PDO name.
void ec_pdo_clear_entries(ec_pdo_t *pdo)
Clear PDO entry list.
void ec_pdo_init(ec_pdo_t *pdo)
PDO constructor.
ec_pdo_entry_t * ec_pdo_add_entry(ec_pdo_t *pdo, uint16_t index, uint8_t subindex, uint8_t bit_length)
Add a new PDO entry to the configuration.
void ec_pdo_clear(ec_pdo_t *pdo)
PDO destructor.
int8_t sync_index
Assigned sync manager.
const ec_pdo_entry_t * ec_pdo_find_entry_by_pos_const(const ec_pdo_t *pdo, unsigned int pos)
Finds a PDO entry via its position in the list.
uint16_t index
PDO entry index.
unsigned int ec_pdo_entry_count(const ec_pdo_t *pdo)
Get the number of PDO entries.
int ec_pdo_init_copy(ec_pdo_t *pdo, const ec_pdo_t *other_pdo)
PDO copy constructor.
void ec_pdo_entry_clear(ec_pdo_entry_t *entry)
PDO entry destructor.
int ec_pdo_entry_equal(const ec_pdo_entry_t *entry1, const ec_pdo_entry_t *entry2)
Compares two PDO entries.
uint8_t bit_length
entry length in bit
int ec_pdo_entry_init_copy(ec_pdo_entry_t *entry, const ec_pdo_entry_t *other)
PDO entry copy constructor.
int ec_pdo_equal_entries(const ec_pdo_t *pdo1, const ec_pdo_t *pdo2)
Compares the entries of two PDOs.
struct list_head entries
List of PDO entries.
void ec_pdo_entry_init(ec_pdo_entry_t *entry)
PDO entry constructor.
uint8_t subindex
PDO entry subindex.
int ec_pdo_copy_entries(ec_pdo_t *pdo, const ec_pdo_t *other)
Copy PDO entries from another PDO.
#define EC_ERR(fmt, args...)
Convenience macro for printing EtherCAT-specific errors to syslog.
void ec_pdo_print_entries(const ec_pdo_t *pdo)
Outputs the PDOs in the list.
struct list_head list
list item
EtherCAT Process data object structure.