Skip to content

Commit

Permalink
Added link status call to the device driver interface
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniele Lacamera committed Jan 28, 2015
1 parent ca74557 commit 0a3b361
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/pico_device.h
Expand Up @@ -26,6 +26,7 @@ struct pico_device {
struct pico_ethdev *eth; /* Null if non-ethernet */
struct pico_queue *q_in;
struct pico_queue *q_out;
int (*link_state)(struct pico_device *self);
int (*send)(struct pico_device *self, void *buf, int len); /* Send function. Return 0 if busy */
int (*poll)(struct pico_device *self, int loop_score);
void (*destroy)(struct pico_device *self);
Expand All @@ -44,5 +45,6 @@ void pico_device_destroy(struct pico_device *dev);
int pico_devices_loop(int loop_score, int direction);
struct pico_device*pico_get_device(const char*name);
int32_t pico_device_broadcast(struct pico_frame *f);
int pico_device_link_state(struct pico_device *dev);

#endif
7 changes: 7 additions & 0 deletions stack/pico_device.c
Expand Up @@ -369,3 +369,10 @@ int32_t pico_device_broadcast(struct pico_frame *f)
}
return ret;
}

int pico_device_link_state(struct pico_device *dev)
{
if (!dev->link_state)
return 1; /* Not supported, assuming link is always up */
return dev->link_state(dev);
}

0 comments on commit 0a3b361

Please sign in to comment.