From 2a99490ed63b9e4c85fef08ba713cbd1af3d24a7 Mon Sep 17 00:00:00 2001 From: wangxiaoxin Date: Wed, 7 Aug 2024 16:46:36 +0800 Subject: [PATCH] add a flag of lin internal sleep/wakeup state Signed-off-by: wangxiaoxin --- include/net/if.h | 12 +++++++++--- net/netdev/netdev_ioctl.c | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/include/net/if.h b/include/net/if.h index b5db231748820..1992c08ed4960 100644 --- a/include/net/if.h +++ b/include/net/if.h @@ -198,7 +198,7 @@ struct can_ioctl_filter_s uint8_t fprio; /* See CAN_MSGPRIO_* definitions */ }; -/* Define an enumeration type that describes the CAN/LIN state */ +/* Define an struct type that describes the CAN/LIN state */ enum can_ioctl_state_e { @@ -208,6 +208,12 @@ enum can_ioctl_state_e CAN_STATE_BUSY /* The can/lin bus is busy */ }; +struct can_ioctl_state_s +{ + uintptr_t priv; /* This is private data. */ + enum can_ioctl_state_e state; +}; + /* There are two forms of the I/F request structure. * One for IPv6 and one for IPv4. * Notice that they are (and must be) cast compatible and really different @@ -234,7 +240,7 @@ struct lifreq struct mii_ioctl_data_s lifru_mii_data; /* MII request data */ struct can_ioctl_data_s lifru_can_data; /* CAN bitrate request data */ struct can_ioctl_filter_s lifru_can_filter; /* CAN filter request data */ - enum can_ioctl_state_e lifru_can_state; /* CAN/LIN controller state */ + struct can_ioctl_state_s lifru_can_state; /* CAN/LIN controller state */ } lifr_ifru; }; @@ -288,7 +294,7 @@ struct ifreq struct mii_ioctl_data_s ifru_mii_data; /* MII request data */ struct can_ioctl_data_s ifru_can_data; /* CAN bitrate request data */ struct can_ioctl_filter_s ifru_can_filter; /* CAN filter request data */ - enum can_ioctl_state_e ifru_can_state; /* CAN/LIN controller state */ + struct can_ioctl_state_s ifru_can_state; /* CAN/LIN controller state */ FAR void *ifru_data; /* For use by interface */ } ifr_ifru; }; diff --git a/net/netdev/netdev_ioctl.c b/net/netdev/netdev_ioctl.c index 4b5fbcb46e71f..e1749eedcd76a 100644 --- a/net/netdev/netdev_ioctl.c +++ b/net/netdev/netdev_ioctl.c @@ -1217,7 +1217,7 @@ static int netdev_ifr_ioctl(FAR struct socket *psock, int cmd, case SIOCSCANSTATE: /* Set the LIN/CAN controller state */ if (dev->d_ioctl) { - FAR enum can_ioctl_state_e *can_state = + FAR struct can_ioctl_state_s *can_state = &req->ifr_ifru.ifru_can_state; ret = dev->d_ioctl(dev, cmd, (unsigned long)(uintptr_t)can_state);