Modify IPC-related functions in rndis host

This commit is contained in:
songyanguang 2024-07-24 15:44:24 +08:00
parent 1d7bcb479d
commit 181362892a
1 changed files with 16 additions and 4 deletions

View File

@ -21,6 +21,10 @@ Modification: rndis bulk transfer buffer uses physical addresses.
3. Date: 2024-07-23
Author: AIIT XUOS Lab
Modification: Modify MessageLength in usbh_rndis_eth_tx, see https://github.com/cherry-embedded/CherryUSB.
4. Date: 2024-07-24
Author: AIIT XUOS Lab
Modification: Modify IPC-related functions in rndis.
*************************************************/
#include <usb_osal.h>
#include "usbh_core.h"
@ -61,8 +65,16 @@ usb_osal_sem_t mutex_sem_handle;
usb_osal_thread_t timer_handle;
usb_osal_thread_t data_recv_task_handle;
extern void eth_device_linkchange(bool up); //todo IPC function
extern void eth_device_ready(void *dataptr, size_t len); //todo IPC function
__WEAK int eth_device_linkchange(bool up)
{
return 0;
}
__WEAK int eth_device_ready(void *dataptr, size_t len)
{
return 0;
}
static void rndis_dev_keepalive_timeout(void *pdata)
{
@ -121,7 +133,7 @@ static void usbh_rndis_data_recv_entry(void *pdata)
while (ret > 0) {
pmsg = (rndis_data_packet_t *)(rx_buffer + pmg_offset);
if (pmsg->MessageType == REMOTE_NDIS_PACKET_MSG) {
eth_device_ready((uint8_t *)(&pmsg->DataOffset) + pmsg->DataOffset, pmsg->MessageLength);
eth_device_ready((uint8_t *)(&pmsg->DataOffset) + pmsg->DataOffset, pmsg->DataLength);
pmg_offset += pmsg->MessageLength;
ret -= pmsg->MessageLength;
}
@ -248,7 +260,7 @@ int usbh_rndis_eth_tx(void *dataptr, size_t tot_len)
return rndis_msg_data_send(s_rndis_class_ptr, (uint8_t *)tx_buffer_phy, hdr->MessageLength);
}
int usbh_rndis_eth_control(int cmd, void *args)
int usbh_rndis_eth_control(int cmd, void *args, size_t len)
{
switch (cmd) {
case NIOCTL_GADDR: