Changed names of debug interfaces.

This commit is contained in:
Florian Pose 2007-08-08 13:58:24 +00:00
parent 61161ca30d
commit 2ce79f1433
3 changed files with 19 additions and 4 deletions

View File

@ -59,7 +59,10 @@ struct net_device_stats *ec_dbgdev_stats(struct net_device *);
Initializes the debug object, creates a net_device and registeres it.
*/
int ec_debug_init(ec_debug_t *dbg /**< debug object */)
int ec_debug_init(
ec_debug_t *dbg, /**< debug object */
const char *name /**< interface name */
)
{
int result;
@ -67,7 +70,7 @@ int ec_debug_init(ec_debug_t *dbg /**< debug object */)
memset(&dbg->stats, 0, sizeof(struct net_device_stats));
if (!(dbg->dev =
alloc_netdev(sizeof(ec_debug_t *), "ec%d", ether_setup))) {
alloc_netdev(sizeof(ec_debug_t *), name, ether_setup))) {
EC_ERR("Unable to allocate net_device for debug object!\n");
goto out_return;
}

View File

@ -56,7 +56,7 @@ ec_debug_t;
/*****************************************************************************/
int ec_debug_init(ec_debug_t *);
int ec_debug_init(ec_debug_t *, const char *);
void ec_debug_clear(ec_debug_t *);
void ec_debug_send(ec_debug_t *, const uint8_t *, size_t);

View File

@ -57,10 +57,22 @@ int ec_device_init(ec_device_t *device, /**< EtherCAT device */
ec_master_t *master /**< master owning the device */
)
{
#ifdef EC_DEBUG_IF
char ifname[10];
char mb = 'x';
#endif
device->master = master;
#ifdef EC_DEBUG_IF
if (ec_debug_init(&device->dbg)) {
if (device == &master->main_device)
mb = 'm';
else if (device == &master->backup_device)
mb = 'b';
sprintf(ifname, "ecdbg%c%u", mb, master->index);
if (ec_debug_init(&device->dbg, ifname)) {
EC_ERR("Failed to init debug device!\n");
goto out_return;
}