29 #include <linux/slab.h> 30 #include <linux/err.h> 103 list_for_each_entry_safe(entry, next, &pdo->
entries, list) {
104 list_del(&entry->
list);
124 if (pdo->
name && name && !strcmp(pdo->
name, name))
130 if (name && (len = strlen(name))) {
131 if (!(pdo->
name = (
char *) kmalloc(len + 1, GFP_KERNEL))) {
132 EC_ERR(
"Failed to allocate PDO name.\n");
135 memcpy(pdo->
name, name, len + 1);
159 EC_ERR(
"Failed to allocate memory for PDO entry.\n");
160 return ERR_PTR(-ENOMEM);
164 entry->
index = index;
188 list_for_each_entry(other_entry, &other->
entries, list) {
191 EC_ERR(
"Failed to allocate memory for PDO entry copy.\n");
219 const struct list_head *head1, *head2, *item1, *item2;
222 head1 = item1 = &pdo1->
entries;
223 head2 = item2 = &pdo2->
entries;
229 if ((item1 == head1) ^ (item2 == head2))
254 unsigned int num = 0;
256 list_for_each_entry(entry, &pdo->
entries, list) {
278 list_for_each_entry(entry, &pdo->
entries, list) {
297 if (list_empty(&pdo->
entries)) {
298 printk(KERN_CONT
"(none)");
300 list_for_each_entry(entry, &pdo->
entries, list) {
301 printk(KERN_CONT
"0x%04X:%02X/%u",
304 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.