修改发送逻辑
Some checks failed
Build / set-matrix (push) Has been cancelled
Build / make-os (macos-latest) (push) Has been cancelled
Build / make-os (windows-latest) (push) Has been cancelled
Build / zephyr (push) Has been cancelled
Build / hil-hfp (push) Has been cancelled
pre-commit / pre-commit (push) Has been cancelled
Build / cmake (aarch64-gcc) (push) Has been cancelled
Build / cmake (arm-gcc) (push) Has been cancelled
Build / cmake (esp-idf) (push) Has been cancelled
Build / cmake (msp430-gcc) (push) Has been cancelled
Build / cmake (riscv-gcc) (push) Has been cancelled
Build / make (aarch64-gcc) (push) Has been cancelled
Build / make (arm-gcc) (push) Has been cancelled
Build / make (msp430-gcc) (push) Has been cancelled
Build / make (riscv-gcc) (push) Has been cancelled
Build / make (rx-gcc) (push) Has been cancelled
Build / arm-iar (make) (push) Has been cancelled
Build / hil-build (arm-gcc) (push) Has been cancelled
Build / hil-build (esp-idf) (push) Has been cancelled
Build / hil-tinyusb (push) Has been cancelled
Some checks failed
Build / set-matrix (push) Has been cancelled
Build / make-os (macos-latest) (push) Has been cancelled
Build / make-os (windows-latest) (push) Has been cancelled
Build / zephyr (push) Has been cancelled
Build / hil-hfp (push) Has been cancelled
pre-commit / pre-commit (push) Has been cancelled
Build / cmake (aarch64-gcc) (push) Has been cancelled
Build / cmake (arm-gcc) (push) Has been cancelled
Build / cmake (esp-idf) (push) Has been cancelled
Build / cmake (msp430-gcc) (push) Has been cancelled
Build / cmake (riscv-gcc) (push) Has been cancelled
Build / make (aarch64-gcc) (push) Has been cancelled
Build / make (arm-gcc) (push) Has been cancelled
Build / make (msp430-gcc) (push) Has been cancelled
Build / make (riscv-gcc) (push) Has been cancelled
Build / make (rx-gcc) (push) Has been cancelled
Build / arm-iar (make) (push) Has been cancelled
Build / hil-build (arm-gcc) (push) Has been cancelled
Build / hil-build (esp-idf) (push) Has been cancelled
Build / hil-tinyusb (push) Has been cancelled
This commit is contained in:
@@ -57,6 +57,7 @@ try changing the first byte of tud_network_mac_address[] below from 0x02 to 0x00
|
||||
|
||||
#include "bsp/board_api.h"
|
||||
#include "tusb.h"
|
||||
#include "usbd_pvt.h"
|
||||
|
||||
#include "dhserver.h"
|
||||
#include "dnserver.h"
|
||||
@@ -103,6 +104,23 @@ static const dhcp_config_t dhcp_config = {
|
||||
entries /* entries */
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static int tud_output_fn(void *t){
|
||||
struct pbuf *p = t;
|
||||
/* if the network driver can accept another packet, we make it happen */
|
||||
if (tud_network_can_xmit(p->tot_len)) {
|
||||
tud_network_xmit(p, 0 /* unused for this example */);
|
||||
return ERR_OK;
|
||||
}
|
||||
return ERR_USE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static err_t linkoutput_fn(struct netif *netif, struct pbuf *p) {
|
||||
(void) netif;
|
||||
|
||||
@@ -110,13 +128,8 @@ static err_t linkoutput_fn(struct netif *netif, struct pbuf *p) {
|
||||
/* if TinyUSB isn't ready, we must signal back to lwip that there is nothing we can do */
|
||||
if (!tud_ready())
|
||||
return ERR_USE;
|
||||
|
||||
/* if the network driver can accept another packet, we make it happen */
|
||||
if (tud_network_can_xmit(p->tot_len)) {
|
||||
tud_network_xmit(p, 0 /* unused for this example */);
|
||||
return ERR_OK;
|
||||
}
|
||||
return ERR_USE;
|
||||
/*rc this packet will be sent in usbd task */
|
||||
return usbd_defer_func_wait(tud_output_fn, p);
|
||||
/* transfer execution to TinyUSB in the hopes that it will finish transmitting the prior packet */
|
||||
/*rc: if use rtos, this function still will be called? */
|
||||
// tud_task();
|
||||
@@ -124,6 +137,7 @@ static err_t linkoutput_fn(struct netif *netif, struct pbuf *p) {
|
||||
}
|
||||
|
||||
static err_t ip4_output_fn(struct netif *netif, struct pbuf *p, const ip4_addr_t *addr) {
|
||||
/*rc etharp_output() will call netif->linkoutput() */
|
||||
return etharp_output(netif, p, addr);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user