can_pm: if powered up by raw interface, fix sleeping timer.
This commit is contained in:
parent
6bbb908d59
commit
ced8094e1a
@ -40,14 +40,12 @@
|
|||||||
#ifdef MODULE_CAN_PM
|
#ifdef MODULE_CAN_PM
|
||||||
#define CAN_DEVICE_PM_DEFAULT_RX_TIMEOUT (10 * US_PER_SEC)
|
#define CAN_DEVICE_PM_DEFAULT_RX_TIMEOUT (10 * US_PER_SEC)
|
||||||
#define CAN_DEVICE_PM_DEFAULT_TX_TIMEOUT (2 * US_PER_SEC)
|
#define CAN_DEVICE_PM_DEFAULT_TX_TIMEOUT (2 * US_PER_SEC)
|
||||||
|
static void pm_cb(void *arg);
|
||||||
|
static void pm_reset(candev_dev_t *candev_dev, uint32_t value);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int power_up(candev_dev_t *candev_dev);
|
static int power_up(candev_dev_t *candev_dev);
|
||||||
static int power_down(candev_dev_t *candev_dev);
|
static int power_down(candev_dev_t *candev_dev);
|
||||||
#ifdef MODULE_CAN_PM
|
|
||||||
static void pm_cb(void *arg);
|
|
||||||
static void pm_reset(candev_dev_t *candev_dev, uint32_t value);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void _can_event(candev_t *dev, candev_event_t event, void *arg)
|
static void _can_event(candev_t *dev, candev_event_t event, void *arg)
|
||||||
{
|
{
|
||||||
@ -157,11 +155,11 @@ static int power_down(candev_dev_t *candev_dev)
|
|||||||
#ifdef MODULE_CAN_PM
|
#ifdef MODULE_CAN_PM
|
||||||
static void pm_cb(void *arg)
|
static void pm_cb(void *arg)
|
||||||
{
|
{
|
||||||
candev_dev_t *dev = arg;
|
candev_dev_t *candev_dev = (candev_dev_t *)arg;
|
||||||
msg_t msg;
|
msg_t msg;
|
||||||
msg.type = CAN_MSG_PM;
|
msg.type = CAN_MSG_PM;
|
||||||
|
|
||||||
msg_send(&msg, dev->pid);
|
msg_send(&msg, candev_dev->pid);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pm_reset(candev_dev_t *candev_dev, uint32_t value)
|
static void pm_reset(candev_dev_t *candev_dev, uint32_t value)
|
||||||
@ -307,7 +305,7 @@ static void *_can_device_thread(void *args)
|
|||||||
DEBUG("can device: CAN_MSG_POWER_UP received\n");
|
DEBUG("can device: CAN_MSG_POWER_UP received\n");
|
||||||
res = power_up(candev_dev);
|
res = power_up(candev_dev);
|
||||||
#ifdef MODULE_CAN_PM
|
#ifdef MODULE_CAN_PM
|
||||||
pm_reset(candev_dev, 0);
|
pm_reset(candev_dev, candev_dev->tx_wakeup_timeout);
|
||||||
#endif
|
#endif
|
||||||
/* send reply to calling thread */
|
/* send reply to calling thread */
|
||||||
reply.type = CAN_MSG_ACK;
|
reply.type = CAN_MSG_ACK;
|
||||||
@ -317,6 +315,9 @@ static void *_can_device_thread(void *args)
|
|||||||
case CAN_MSG_POWER_DOWN:
|
case CAN_MSG_POWER_DOWN:
|
||||||
DEBUG("can device: CAN_MSG_POWER_DOWN received\n");
|
DEBUG("can device: CAN_MSG_POWER_DOWN received\n");
|
||||||
res = power_down(candev_dev);
|
res = power_down(candev_dev);
|
||||||
|
#ifdef MODULE_CAN_PM
|
||||||
|
pm_reset(candev_dev, 0);
|
||||||
|
#endif
|
||||||
/* send reply to calling thread */
|
/* send reply to calling thread */
|
||||||
reply.type = CAN_MSG_ACK;
|
reply.type = CAN_MSG_ACK;
|
||||||
reply.content.value = (uint32_t)res;
|
reply.content.value = (uint32_t)res;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user