master/device.c
branchredundancy
changeset 2160 e3bf5adad75f
parent 2158 69f2b2702336
child 2267 2d36f36a433c
equal deleted inserted replaced
2159:72ac85ee3729 2160:e3bf5adad75f
   638         ec_device_t *device, /**< EtherCAT device */
   638         ec_device_t *device, /**< EtherCAT device */
   639         uint8_t state /**< new link state */
   639         uint8_t state /**< new link state */
   640         )
   640         )
   641 {
   641 {
   642     if (unlikely(!device)) {
   642     if (unlikely(!device)) {
   643         EC_MASTER_WARN(device->master, "ecdev_set_link(): No device!\n");
   643         EC_WARN("ecdev_set_link() called with null device!\n");
   644         return;
   644         return;
   645     }
   645     }
   646 
   646 
   647     if (likely(state != device->link_state)) {
   647     if (likely(state != device->link_state)) {
   648         device->link_state = state;
   648         device->link_state = state;
   649         EC_MASTER_INFO(device->master,
   649         EC_MASTER_INFO(device->master,
   650                 "Link state changed to %s.\n", (state ? "UP" : "DOWN"));
   650                 "Link state of %s changed to %s.\n",
       
   651                 device->dev->name, (state ? "UP" : "DOWN"));
   651     }
   652     }
   652 }
   653 }
   653 
   654 
   654 /*****************************************************************************/
   655 /*****************************************************************************/
   655 
   656 
   660 uint8_t ecdev_get_link(
   661 uint8_t ecdev_get_link(
   661         const ec_device_t *device /**< EtherCAT device */
   662         const ec_device_t *device /**< EtherCAT device */
   662         )
   663         )
   663 {
   664 {
   664     if (unlikely(!device)) {
   665     if (unlikely(!device)) {
   665         EC_MASTER_WARN(device->master, "ecdev_get_link(): No device!\n");
   666         EC_WARN("ecdev_get_link() called with null device!\n");
   666         return 0;
   667         return 0;
   667     }
   668     }
   668 
   669 
   669     return device->link_state;
   670     return device->link_state;
   670 }
   671 }