Newer
Older
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
uint8_t sdo_subindex, /**< SDO subindex */
uint8_t value /**< new SDO value */
)
{
uint8_t data[1];
EC_WRITE_U8(data, value);
return ec_slave_conf_sdo(slave, sdo_index, sdo_subindex, data, 1);
}
/*****************************************************************************/
/**
\return 0 in case of success, else < 0
\ingroup RealtimeInterface
*/
int ecrt_slave_conf_sdo16(ec_slave_t *slave, /**< EtherCAT slave */
uint16_t sdo_index, /**< SDO index */
uint8_t sdo_subindex, /**< SDO subindex */
uint16_t value /**< new SDO value */
)
{
uint8_t data[2];
EC_WRITE_U16(data, value);
return ec_slave_conf_sdo(slave, sdo_index, sdo_subindex, data, 2);
}
/*****************************************************************************/
/**
\return 0 in case of success, else < 0
\ingroup RealtimeInterface
*/
int ecrt_slave_conf_sdo32(ec_slave_t *slave, /**< EtherCAT slave */
uint16_t sdo_index, /**< SDO index */
uint8_t sdo_subindex, /**< SDO subindex */
uint32_t value /**< new SDO value */
)
{
uint8_t data[4];
EC_WRITE_U32(data, value);
return ec_slave_conf_sdo(slave, sdo_index, sdo_subindex, data, 4);
}
/*****************************************************************************/
/**
\return 0 in case of success, else < 0
\ingroup RealtimeInterface
*/
int ecrt_slave_pdo_size(ec_slave_t *slave, /**< EtherCAT slave */
uint16_t pdo_index, /**< PDO index */
uint8_t pdo_subindex, /**< PDO subindex */
size_t size /**< new PDO size */
)
EC_WARN("ecrt_slave_pdo_size() currently not available.\n");
return -1;
#if 0
const ec_sii_sync_t *sync;
const ec_pdo_t *pdo;
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
ec_varsize_t *var;
if (!slave->type) {
EC_ERR("Slave %i has no type information!\n", slave->ring_position);
return -1;
}
field_counter = 0;
for (i = 0; (sync = slave->type->sync_managers[i]); i++) {
for (j = 0; (field = sync->fields[j]); j++) {
if (!strcmp(field->name, field_name)) {
if (field_counter++ == field_index) {
// is the size of this field variable?
if (field->size) {
EC_ERR("Field \"%s\"[%i] of slave %i has no variable"
" size!\n", field->name, field_index,
slave->ring_position);
return -1;
}
// does a size specification already exist?
list_for_each_entry(var, &slave->varsize_fields, list) {
if (var->field == field) {
EC_WARN("Resizing field \"%s\"[%i] of slave %i.\n",
field->name, field_index,
slave->ring_position);
var->size = size;
return 0;
}
}
// create a new size specification...
if (!(var = kmalloc(sizeof(ec_varsize_t), GFP_KERNEL))) {
EC_ERR("Failed to allocate memory for varsize_t!\n");
return -1;
}
var->field = field;
var->size = size;
list_add_tail(&var->list, &slave->varsize_fields);
return 0;
}
}
}
}
EC_ERR("Slave %i (\"%s %s\") has no field \"%s\"[%i]!\n",
slave->ring_position, slave->type->vendor_name,
slave->type->product_name, field_name, field_index);
return -1;
}
/*****************************************************************************/
/**< \cond */
EXPORT_SYMBOL(ecrt_slave_conf_sdo8);
EXPORT_SYMBOL(ecrt_slave_conf_sdo16);
EXPORT_SYMBOL(ecrt_slave_conf_sdo32);
EXPORT_SYMBOL(ecrt_slave_pdo_size);
/**< \endcond */
/*****************************************************************************/