1
0
Fork 0
forked from nuttx/nuttx-update

add a flag of lin internal sleep/wakeup state

Signed-off-by: wangxiaoxin <wangxiaoxin@xiaomi.com>
This commit is contained in:
wangxiaoxin 2024-08-07 16:46:36 +08:00 committed by Xiang Xiao
parent 43d483efc0
commit 2a99490ed6
2 changed files with 10 additions and 4 deletions

View file

@ -198,7 +198,7 @@ struct can_ioctl_filter_s
uint8_t fprio; /* See CAN_MSGPRIO_* definitions */ 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 enum can_ioctl_state_e
{ {
@ -208,6 +208,12 @@ enum can_ioctl_state_e
CAN_STATE_BUSY /* The can/lin bus is busy */ 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. /* There are two forms of the I/F request structure.
* One for IPv6 and one for IPv4. * One for IPv6 and one for IPv4.
* Notice that they are (and must be) cast compatible and really different * 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 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_data_s lifru_can_data; /* CAN bitrate request data */
struct can_ioctl_filter_s lifru_can_filter; /* CAN filter 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; } lifr_ifru;
}; };
@ -288,7 +294,7 @@ struct ifreq
struct mii_ioctl_data_s ifru_mii_data; /* MII request data */ 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_data_s ifru_can_data; /* CAN bitrate request data */
struct can_ioctl_filter_s ifru_can_filter; /* CAN filter 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 */ FAR void *ifru_data; /* For use by interface */
} ifr_ifru; } ifr_ifru;
}; };

View file

@ -1217,7 +1217,7 @@ static int netdev_ifr_ioctl(FAR struct socket *psock, int cmd,
case SIOCSCANSTATE: /* Set the LIN/CAN controller state */ case SIOCSCANSTATE: /* Set the LIN/CAN controller state */
if (dev->d_ioctl) 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; &req->ifr_ifru.ifru_can_state;
ret = dev->d_ioctl(dev, cmd, ret = dev->d_ioctl(dev, cmd,
(unsigned long)(uintptr_t)can_state); (unsigned long)(uintptr_t)can_state);