summaryrefslogtreecommitdiff
path: root/src/class/net/net_device.h
diff options
context:
space:
mode:
authorPeter Lawrence <[email protected]>2020-10-24 20:27:57 -0500
committerPeter Lawrence <[email protected]>2020-10-24 20:27:57 -0500
commita097b7e51aac7fc92708e1bc536e84a9ec2af3ec (patch)
treece49f6b51b2c2f169e9e5def66eb2eab10075d3b /src/class/net/net_device.h
parentf5b72f5796554910e14040cf747d6eea9505ee1a (diff)
net_device: re-factor code so as to not be specific to lwIP
Diffstat (limited to 'src/class/net/net_device.h')
-rw-r--r--src/class/net/net_device.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/class/net/net_device.h b/src/class/net/net_device.h
index 0175ea56b..795b2f9e3 100644
--- a/src/class/net/net_device.h
+++ b/src/class/net/net_device.h
@@ -32,15 +32,13 @@
#include "device/usbd.h"
#include "class/cdc/cdc.h"
-// TODO should not include external files
-#include "lwip/pbuf.h"
-#include "netif/ethernet.h"
-
/* declared here, NOT in usb_descriptors.c, so that the driver can intelligently ZLP as needed */
#define CFG_TUD_NET_ENDPOINT_SIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
/* Maximum Tranmission Unit (in bytes) of the network, including Ethernet header */
-#define CFG_TUD_NET_MTU (1500 + SIZEOF_ETH_HDR)
+#ifndef CFG_TUD_NET_MTU
+#define CFG_TUD_NET_MTU 1514
+#endif
#ifdef __cplusplus
extern "C" {
@@ -54,7 +52,10 @@
void tud_network_init_cb(void);
// client must provide this: return false if the packet buffer was not accepted
-bool tud_network_recv_cb(struct pbuf *p);
+bool tud_network_recv_cb(const uint8_t *src, uint16_t size);
+
+// client must provide this: copy from network stack packet pointer to dst
+uint16_t tud_network_xmit_cb(uint8_t *dst, void *ref, uint16_t arg);
// client must provide this: 48-bit MAC address
// TODO removed later since it is not part of tinyusb stack
@@ -67,7 +68,7 @@ void tud_network_recv_renew(void);
bool tud_network_can_xmit(void);
// if network_can_xmit() returns true, network_xmit() can be called once
-void tud_network_xmit(struct pbuf *p);
+void tud_network_xmit(void *ref, uint16_t arg);
//--------------------------------------------------------------------+
// INTERNAL USBD-CLASS DRIVER API